From 5f83e9ad0e57396b58520f2bb1dfb3e10c7113b3 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Fri, 6 Feb 2026 10:36:03 +0000 Subject: [PATCH 001/120] 8377179: Improve and document racy use of start/end in ThreadLocalAllocBuffer Reviewed-by: iwalulya, ayang --- .../gc/shared/threadLocalAllocBuffer.cpp | 23 ++++++++---- .../gc/shared/threadLocalAllocBuffer.hpp | 36 +++++++------------ src/hotspot/share/runtime/thread.inline.hpp | 25 ++++--------- 3 files changed, 36 insertions(+), 48 deletions(-) diff --git a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp index 9635ed4d0cb..e86881d3523 100644 --- a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp +++ b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -458,10 +458,19 @@ size_t ThreadLocalAllocBuffer::end_reserve() { return MAX2(reserve_size, (size_t)_reserve_for_allocation_prefetch); } -const HeapWord* ThreadLocalAllocBuffer::start_relaxed() const { - return AtomicAccess::load(&_start); -} - -const HeapWord* ThreadLocalAllocBuffer::top_relaxed() const { - return AtomicAccess::load(&_top); +size_t ThreadLocalAllocBuffer::estimated_used_bytes() const { + HeapWord* start = AtomicAccess::load(&_start); + HeapWord* top = AtomicAccess::load(&_top); + // There has been a race when retrieving _top and _start. Return 0. + if (_top < _start) { + return 0; + } + size_t used_bytes = pointer_delta(_top, _start, 1); + // Comparing diff with the maximum allowed size will ensure that we don't add + // the used bytes from a semi-initialized TLAB ending up with implausible values. + // In this case also just return 0. + if (used_bytes > ThreadLocalAllocBuffer::max_size_in_bytes()) { + return 0; + } + return used_bytes; } diff --git a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp index 8267a103539..a50e7c9533c 100644 --- a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp +++ b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2026, Oracle and/or its affiliates. All rights reserved. * 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,16 +33,13 @@ class ThreadLocalAllocStats; // ThreadLocalAllocBuffer: a descriptor for thread-local storage used by -// the threads for allocation. -// It is thread-private at any time, but maybe multiplexed over -// time across multiple threads. The park()/unpark() pair is -// used to make it available for such multiplexing. +// the threads for allocation. It is thread-private at any time. // -// Heap sampling is performed via the end and allocation_end -// fields. -// allocation_end contains the real end of the tlab allocation, -// whereas end can be set to an arbitrary spot in the tlab to -// trip the return and sample the allocation. +// Heap sampling is performed via the end and allocation_end +// fields. +// allocation_end contains the real end of the tlab allocation, +// whereas end can be set to an arbitrary spot in the tlab to +// trip the return and sample the allocation. class ThreadLocalAllocBuffer: public CHeapObj { friend class VMStructs; friend class JVMCIVMStructs; @@ -116,17 +113,18 @@ public: HeapWord* end() const { return _end; } HeapWord* top() const { return _top; } HeapWord* hard_end(); - HeapWord* pf_top() const { return _pf_top; } size_t desired_size() const { return _desired_size; } - size_t used() const { return pointer_delta(top(), start()); } size_t used_bytes() const { return pointer_delta(top(), start(), 1); } size_t free() const { return pointer_delta(end(), top()); } // Don't discard tlab if remaining space is larger than this. size_t refill_waste_limit() const { return _refill_waste_limit; } - // For external inspection. - const HeapWord* start_relaxed() const; - const HeapWord* top_relaxed() const; + // Returns an estimate of the number of bytes currently used in the TLAB. + // Due to races with concurrent allocations and/or resetting the TLAB the return + // value may be inconsistent with any other metrics (e.g. total allocated + // bytes), and may just incorrectly return 0. + // Intented fo external inspection only where accuracy is not 100% required. + size_t estimated_used_bytes() const; // Allocate size HeapWords. The memory is NOT initialized to zero. inline HeapWord* allocate(size_t size); @@ -171,14 +169,6 @@ public: static size_t refill_waste_limit_increment(); - template void addresses_do(T f) { - f(&_start); - f(&_top); - f(&_pf_top); - f(&_end); - f(&_allocation_end); - } - // Code generation support static ByteSize start_offset() { return byte_offset_of(ThreadLocalAllocBuffer, _start); } static ByteSize end_offset() { return byte_offset_of(ThreadLocalAllocBuffer, _end); } diff --git a/src/hotspot/share/runtime/thread.inline.hpp b/src/hotspot/share/runtime/thread.inline.hpp index 8e80cfc6125..61866674224 100644 --- a/src/hotspot/share/runtime/thread.inline.hpp +++ b/src/hotspot/share/runtime/thread.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2026, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, Azul Systems, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -37,25 +37,14 @@ inline jlong Thread::cooked_allocated_bytes() { jlong allocated_bytes = AtomicAccess::load_acquire(&_allocated_bytes); + size_t used_bytes = 0; if (UseTLAB) { - // These reads are unsynchronized and unordered with the thread updating its tlab pointers. - // Use only if top > start && used_bytes <= max_tlab_size_bytes. - const HeapWord* const top = tlab().top_relaxed(); - const HeapWord* const start = tlab().start_relaxed(); - if (top <= start) { - return allocated_bytes; - } - const size_t used_bytes = pointer_delta(top, start, 1); - if (used_bytes <= ThreadLocalAllocBuffer::max_size_in_bytes()) { - // Comparing used_bytes with the maximum allowed size will ensure - // that we don't add the used bytes from a semi-initialized TLAB - // ending up with incorrect values. There is still a race between - // incrementing _allocated_bytes and clearing the TLAB, that might - // cause double counting in rare cases. - return allocated_bytes + used_bytes; - } + // cooked_used_bytes() does its best to not return implausible values, but + // there is still a potential race between incrementing _allocated_bytes and + // clearing the TLAB, that might cause double-counting. + used_bytes = tlab().estimated_used_bytes(); } - return allocated_bytes; + return allocated_bytes + used_bytes; } inline ThreadsList* Thread::cmpxchg_threads_hazard_ptr(ThreadsList* exchange_value, ThreadsList* compare_value) { From cd6a7a54c5e323ec53747f76b07edb7f90e1f965 Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Fri, 6 Feb 2026 10:42:52 +0000 Subject: [PATCH 002/120] 8377245: AbstractMemorySegmentImpl#getString with length should be @ForceInline Reviewed-by: mcimadamore --- .../classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/java.base/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java b/src/java.base/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java index f75d67adbbb..235797f66e3 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java +++ b/src/java.base/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java @@ -551,6 +551,7 @@ public abstract sealed class AbstractMemorySegmentImpl unsafeGetOffset() == that.unsafeGetOffset(); } + @ForceInline @Override public String getString(long offset, Charset charset, long byteLength) { Utils.checkNonNegativeArgument(byteLength, "byteLength"); From 7a37d370e3fe0a2adb4c6ae336803b87be8d8547 Mon Sep 17 00:00:00 2001 From: Martin Doerr Date: Fri, 6 Feb 2026 11:01:18 +0000 Subject: [PATCH 003/120] 8377326: [PPC64] build without C1 and C2 broken Reviewed-by: dbriemann, mbaesken --- src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp index 4eb2028f529..5260ed978ff 100644 --- a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp +++ b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2025 SAP SE. All rights reserved. + * Copyright (c) 2012, 2026 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -775,7 +775,6 @@ int SharedRuntime::java_calling_convention(const BasicType *sig_bt, return stk; } -#if defined(COMPILER1) || defined(COMPILER2) // Calling convention for calling C code. int SharedRuntime::c_calling_convention(const BasicType *sig_bt, VMRegPair *regs, @@ -913,7 +912,6 @@ int SharedRuntime::c_calling_convention(const BasicType *sig_bt, return MAX2(arg, 8) * 2 + additional_frame_header_slots; #endif } -#endif // COMPILER2 int SharedRuntime::vector_calling_convention(VMRegPair *regs, uint num_bits, @@ -2874,7 +2872,6 @@ void SharedRuntime::generate_deopt_blob() { CodeBuffer buffer(name, 2048, 1024); InterpreterMacroAssembler* masm = new InterpreterMacroAssembler(&buffer); Label exec_mode_initialized; - int frame_size_in_words; OopMap* map = nullptr; OopMapSet *oop_maps = new OopMapSet(); @@ -2886,6 +2883,9 @@ void SharedRuntime::generate_deopt_blob() { const Register exec_mode_reg = R21_tmp1; const address start = __ pc(); + int exception_offset = 0; + int exception_in_tls_offset = 0; + int reexecute_offset = 0; #if defined(COMPILER1) || defined(COMPILER2) // -------------------------------------------------------------------------- @@ -2925,7 +2925,7 @@ void SharedRuntime::generate_deopt_blob() { // - R3_ARG1: exception oop // - R4_ARG2: exception pc - int exception_offset = __ pc() - start; + exception_offset = __ pc() - start; BLOCK_COMMENT("Prolog for exception case"); @@ -2936,7 +2936,7 @@ void SharedRuntime::generate_deopt_blob() { __ std(R4_ARG2, _abi0(lr), R1_SP); // Vanilla deoptimization with an exception pending in exception_oop. - int exception_in_tls_offset = __ pc() - start; + exception_in_tls_offset = __ pc() - start; // Push the "unpack frame". // Save everything in sight. @@ -2949,8 +2949,6 @@ void SharedRuntime::generate_deopt_blob() { __ li(exec_mode_reg, Deoptimization::Unpack_exception); // fall through - - int reexecute_offset = 0; #ifdef COMPILER1 __ b(exec_mode_initialized); @@ -3068,11 +3066,12 @@ void SharedRuntime::generate_deopt_blob() { // Return to the interpreter entry point. __ blr(); - __ flush(); -#else // COMPILER2 +#else // !defined(COMPILER1) && !defined(COMPILER2) __ unimplemented("deopt blob needed only with compiler"); - int exception_offset = __ pc() - start; -#endif // COMPILER2 +#endif + + // Make sure all code is generated + __ flush(); _deopt_blob = DeoptimizationBlob::create(&buffer, oop_maps, 0, exception_offset, reexecute_offset, first_frame_size_in_bytes / wordSize); From 77e680b11efea0eb707b72f4f3bb9e3422e170fd Mon Sep 17 00:00:00 2001 From: Yasumasa Suenaga Date: Fri, 6 Feb 2026 12:52:43 +0000 Subject: [PATCH 004/120] 8376269: Mixed jstack cannot find function in vDSO Reviewed-by: kevinw, cjplummer --- .../linux/native/libsaproc/libproc_impl.h | 5 +- .../linux/native/libsaproc/ps_core.c | 55 ++++++++++- .../sa/LingeredAppWithVDSOCall.java | 61 ++++++++++++ .../TestJhsdbJstackMixedWithVDSOCallCore.java | 96 +++++++++++++++++++ test/lib/jdk/test/lib/apps/LingeredApp.java | 16 +++- 5 files changed, 225 insertions(+), 8 deletions(-) create mode 100644 test/hotspot/jtreg/serviceability/sa/LingeredAppWithVDSOCall.java create mode 100644 test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixedWithVDSOCallCore.java diff --git a/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.h b/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.h index 42a6212510c..262e99f4a64 100644 --- a/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.h +++ b/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -95,6 +95,9 @@ struct core_data { // part of the class sharing workaround int classes_jsa_fd; // file descriptor of class share archive uintptr_t dynamic_addr; // address of dynamic section of a.out + uintptr_t vdso_addr; // address of vDSO + off64_t vdso_offset; // offset of vDSO in core + size_t vdso_size; // size of vDSO uintptr_t ld_base_addr; // base address of ld.so size_t num_maps; // number of maps. map_info* maps; // maps in a linked list diff --git a/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c b/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c index 899d42152d1..61bd1e80005 100644 --- a/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c +++ b/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved. * 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,6 +31,9 @@ #include #include #include +#include +#include +#include #include "libproc_impl.h" #include "ps_core_common.h" #include "proc_service.h" @@ -285,6 +288,8 @@ static bool core_handle_note(struct ps_prochandle* ph, ELF_PHDR* note_phdr) { // We will adjust it in read_exec_segments(). ph->core->dynamic_addr = auxv->a_un.a_val; break; + } else if (auxv->a_type == AT_SYSINFO_EHDR) { + ph->core->vdso_addr = auxv->a_un.a_val; } auxv++; } @@ -350,6 +355,10 @@ static bool read_core_segments(struct ps_prochandle* ph, ELF_EHDR* core_ehdr) { print_error("failed to add map info\n"); goto err; } + if (core_php->p_vaddr == ph->core->vdso_addr) { + ph->core->vdso_offset = core_php->p_offset; + ph->core->vdso_size = core_php->p_memsz; + } } break; } @@ -593,6 +602,39 @@ static uintptr_t calc_prelinked_load_address(struct ps_prochandle* ph, int lib_f return load_addr; } +// Check for vDSO binary in kernel directory (/lib/modules//vdso), +// rewrite the given lib_name string if found. +// Otherwise copy vDSO memory in coredump to temporal memory generated by +// memfd_create(). +// Returns FD for vDSO (should be closed by caller), or -1 on error. +static int handle_vdso(struct ps_prochandle* ph, char* lib_name, size_t lib_name_len) { + int lib_fd; + struct utsname uts; + uname(&uts); + + // Check vDSO binary first (for referring debuginfo if possible). + char *vdso_path = (char*)malloc(lib_name_len); + snprintf(vdso_path, lib_name_len, "/lib/modules/%s/vdso/vdso64.so", uts.release); + lib_fd = pathmap_open(vdso_path); + if (lib_fd != -1) { + print_debug("replace vDSO: %s -> %s\n", lib_name, vdso_path); + strncpy(lib_name, vdso_path, lib_name_len); + } else { + // Copy vDSO memory segment from core to temporal memory + // if vDSO binary is not available. + lib_fd = memfd_create("[vdso] in core", 0); + off64_t ofs = ph->core->vdso_offset; + if (sendfile64(lib_fd, ph->core->core_fd, &ofs, ph->core->vdso_size) == -1) { + print_debug("can't copy vDSO (%d)\n", errno); + close(lib_fd); + lib_fd = -1; + } + } + + free(vdso_path); + return lib_fd; +} + // read shared library info from runtime linker's data structures. // This work is done by librtlb_db in Solaris static bool read_shared_lib_info(struct ps_prochandle* ph) { @@ -687,9 +729,14 @@ static bool read_shared_lib_info(struct ps_prochandle* ph) { // it will fail later. } - if (lib_name[0] != '\0') { - // ignore empty lib names - lib_fd = pathmap_open(lib_name); + if (lib_name[0] != '\0') { // ignore empty lib names + // We can use lib_base_diff to compare with vdso_addr + // because base address of vDSO should be 0. + if (lib_base_diff == ph->core->vdso_addr) { + lib_fd = handle_vdso(ph, lib_name, sizeof(lib_name)); + } else { + lib_fd = pathmap_open(lib_name); + } if (lib_fd < 0) { print_debug("can't open shared object %s\n", lib_name); diff --git a/test/hotspot/jtreg/serviceability/sa/LingeredAppWithVDSOCall.java b/test/hotspot/jtreg/serviceability/sa/LingeredAppWithVDSOCall.java new file mode 100644 index 00000000000..d893ddf6f89 --- /dev/null +++ b/test/hotspot/jtreg/serviceability/sa/LingeredAppWithVDSOCall.java @@ -0,0 +1,61 @@ + +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2026, NTT DATA + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.lang.invoke.MethodHandle; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; +import java.lang.foreign.ValueLayout; + +import jdk.test.lib.Asserts; +import jdk.test.lib.apps.LingeredApp; + + +public class LingeredAppWithVDSOCall extends LingeredApp { + + private static final MethodHandle gettimeofday; + + static { + var desc = FunctionDescriptor.of(ValueLayout.JAVA_INT, // return + ValueLayout.JAVA_LONG, // tv + ValueLayout.JAVA_LONG); // tz + var linker = Linker.nativeLinker(); + var gettimeofdayPtr = linker.defaultLookup().findOrThrow("gettimeofday"); + gettimeofday = linker.downcallHandle(gettimeofdayPtr, desc); + } + + private static void crashAtGettimeofday(long tvAddr, long tzAddr) { + try { + gettimeofday.invoke(tvAddr, tzAddr); + } catch (Throwable t) { + throw new RuntimeException(t); + } + Asserts.fail("gettimeofday() didn't crash"); + } + + public static void main(String[] args) { + setCrasher(() -> crashAtGettimeofday(100L, 200L)); + LingeredApp.main(args); + } +} diff --git a/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixedWithVDSOCallCore.java b/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixedWithVDSOCallCore.java new file mode 100644 index 00000000000..84da46e272f --- /dev/null +++ b/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixedWithVDSOCallCore.java @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2026, NTT DATA + * 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.nio.file.Path; + +import jtreg.SkippedException; + +import jdk.test.lib.JDKToolFinder; +import jdk.test.lib.JDKToolLauncher; +import jdk.test.lib.Platform; +import jdk.test.lib.SA.SATestUtils; +import jdk.test.lib.Utils; +import jdk.test.lib.apps.LingeredApp; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.util.CoreUtils; + +/** + * @test + * @bug 8376269 + * @requires (os.family == "linux") & (vm.hasSA) + * @requires os.arch == "amd64" + * @library /test/lib + * @run driver TestJhsdbJstackMixedWithVDSOCallCore + */ +public class TestJhsdbJstackMixedWithVDSOCallCore { + + private static void runJstackMixed(String coreFileName) throws Exception { + JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jhsdb"); + launcher.addVMArgs(Utils.getTestJavaOpts()); + launcher.addToolArg("jstack"); + launcher.addToolArg("--mixed"); + launcher.addToolArg("--exe"); + launcher.addToolArg(JDKToolFinder.getTestJDKTool("java")); + launcher.addToolArg("--core"); + launcher.addToolArg(coreFileName); + + ProcessBuilder pb = SATestUtils.createProcessBuilder(launcher); + Process jhsdb = pb.start(); + OutputAnalyzer out = new OutputAnalyzer(jhsdb); + + jhsdb.waitFor(); + + System.out.println(out.getStdout()); + System.err.println(out.getStderr()); + + out.shouldContain("vdso_gettimeofday"); + } + + private static void checkVDSODebugInfo() { + var kernelVersion = System.getProperty("os.version"); + var vdso = Path.of("/lib", "modules", kernelVersion, "vdso", "vdso64.so"); + if (SATestUtils.getDebugInfo(vdso.toString()) == null) { + // Skip this test if debuginfo of vDSO not found because internal + // function of gettimeofday() would not be exported, and vDSO + // binary might be stripped. + throw new SkippedException("vDSO debuginfo not found (" + vdso.toString() + ")"); + } + } + + public static void main(String... args) throws Throwable { + if (Platform.isMusl()) { + throw new SkippedException("This test does not work on musl libc."); + } + checkVDSODebugInfo(); + + var app = new LingeredAppWithVDSOCall(); + app.setForceCrash(true); + LingeredApp.startApp(app, CoreUtils.getAlwaysPretouchArg(true)); + app.waitAppTerminate(); + + String crashOutput = app.getOutput().getStdout(); + String coreFileName = CoreUtils.getCoreFileLocation(crashOutput, app.getPid()); + runJstackMixed(coreFileName); + } +} diff --git a/test/lib/jdk/test/lib/apps/LingeredApp.java b/test/lib/jdk/test/lib/apps/LingeredApp.java index 13008e68c54..38ad9ae5b0e 100644 --- a/test/lib/jdk/test/lib/apps/LingeredApp.java +++ b/test/lib/jdk/test/lib/apps/LingeredApp.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -122,6 +122,12 @@ public class LingeredApp { this.forceCrash = forceCrash; } + private static Runnable crasher; + + public static void setCrasher(Runnable runnable) { + crasher = runnable; + } + native private static int crash(); /** @@ -628,8 +634,12 @@ public class LingeredApp { synchronized(steadyStateObj) { startSteadyStateThread(steadyStateObj); if (forceCrash) { - System.loadLibrary("LingeredApp"); // location of native crash() method - crash(); + if (crasher == null) { + System.loadLibrary("LingeredApp"); // location of native crash() method + crash(); + } else { + crasher.run(); + } } while (Files.exists(path)) { // Touch the lock to indicate our readiness From 8620e67c87cf561c858c2528b3b00b016eec3a51 Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Fri, 6 Feb 2026 12:53:03 +0000 Subject: [PATCH 005/120] 8377231: Build jpackage with SIZE optimization Reviewed-by: erikj, asemenyuk --- make/modules/jdk.jpackage/Lib.gmk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/make/modules/jdk.jpackage/Lib.gmk b/make/modules/jdk.jpackage/Lib.gmk index 704436bbde6..86b11bdafee 100644 --- a/make/modules/jdk.jpackage/Lib.gmk +++ b/make/modules/jdk.jpackage/Lib.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -54,7 +54,7 @@ $(eval $(call SetupJdkExecutable, BUILD_JPACKAGEAPPLAUNCHER, \ SRC := applauncher, \ EXTRA_SRC := common, \ INCLUDE_FILES := $(JPACKAGEAPPLAUNCHER_INCLUDE_FILES), \ - OPTIMIZATION := LOW, \ + OPTIMIZATION := SIZE, \ DISABLED_WARNINGS_clang_JvmLauncherLib.c := format-nonliteral, \ DISABLED_WARNINGS_clang_LinuxPackage.c := format-nonliteral, \ DISABLED_WARNINGS_clang_Log.cpp := unused-const-variable, \ @@ -91,7 +91,7 @@ ifeq ($(call isTargetOs, linux), true) common, \ EXCLUDE_FILES := LinuxLauncher.c LinuxPackage.c, \ LINK_TYPE := C++, \ - OPTIMIZATION := LOW, \ + OPTIMIZATION := SIZE, \ DISABLED_WARNINGS_gcc_Log.cpp := unused-const-variable, \ DISABLED_WARNINGS_clang_JvmLauncherLib.c := format-nonliteral, \ DISABLED_WARNINGS_clang_tstrings.cpp := format-nonliteral, \ From d1b226dec293804cd6f929c4a46ae59cb246253e Mon Sep 17 00:00:00 2001 From: Yasumasa Suenaga Date: Fri, 6 Feb 2026 13:40:54 +0000 Subject: [PATCH 006/120] 8376264: Mixed jstack could not unwind optimized frame Reviewed-by: cjplummer, kevinw --- .../linux/native/libsaproc/DwarfParser.cpp | 17 +- .../linux/native/libsaproc/dwarf.cpp | 24 ++- .../linux/native/libsaproc/dwarf.hpp | 13 +- .../debugger/linux/LinuxCDebugger.java | 8 +- .../debugger/linux/amd64/DwarfParser.java | 12 +- .../linux/amd64/LinuxAMD64CFrame.java | 187 ++++++++---------- .../sa/TestJhsdbJstackMixedCore.java | 10 +- 7 files changed, 122 insertions(+), 149 deletions(-) diff --git a/src/jdk.hotspot.agent/linux/native/libsaproc/DwarfParser.cpp b/src/jdk.hotspot.agent/linux/native/libsaproc/DwarfParser.cpp index 8df08c49e09..6c94992e1e2 100644 --- a/src/jdk.hotspot.agent/linux/native/libsaproc/DwarfParser.cpp +++ b/src/jdk.hotspot.agent/linux/native/libsaproc/DwarfParser.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2020, 2021, NTT DATA. + * Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2026, NTT DATA. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -219,16 +219,3 @@ JNIEXPORT jint JNICALL Java_sun_jvm_hotspot_debugger_linux_amd64_DwarfParser_get DwarfParser *parser = reinterpret_cast(get_dwarf_context(env, this_obj)); return parser->get_bp_cfa_offset(); } - -/* - * Class: sun_jvm_hotspot_debugger_linux_amd64_DwarfParser - * Method: isBPOffsetAvailable - * Signature: ()Z - */ -extern "C" -JNIEXPORT jboolean JNICALL Java_sun_jvm_hotspot_debugger_linux_amd64_DwarfParser_isBPOffsetAvailable - (JNIEnv *env, jobject this_obj) { - DwarfParser *parser = reinterpret_cast(get_dwarf_context(env, this_obj)); - return parser->is_bp_offset_available(); -} - diff --git a/src/jdk.hotspot.agent/linux/native/libsaproc/dwarf.cpp b/src/jdk.hotspot.agent/linux/native/libsaproc/dwarf.cpp index a0c54230530..2636bdf691a 100644 --- a/src/jdk.hotspot.agent/linux/native/libsaproc/dwarf.cpp +++ b/src/jdk.hotspot.agent/linux/native/libsaproc/dwarf.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2020, NTT DATA. + * Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2026, NTT DATA. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -99,12 +99,11 @@ bool DwarfParser::process_cie(unsigned char *start_of_entry, uint32_t id) { // Clear state _current_pc = 0L; - _cfa_reg = RSP; + _cfa_reg = MAX_VALUE; _return_address_reg = RA; _cfa_offset = 0; - _ra_cfa_offset = 0; - _bp_cfa_offset = 0; - _bp_offset_available = false; + _ra_cfa_offset = 8; + _bp_cfa_offset = INT_MAX; parse_dwarf_instructions(0L, static_cast(-1L), end); @@ -119,8 +118,8 @@ void DwarfParser::parse_dwarf_instructions(uintptr_t begin, uintptr_t pc, const /* for remember state */ enum DWARF_Register rem_cfa_reg = MAX_VALUE; int rem_cfa_offset = 0; - int rem_ra_cfa_offset = 0; - int rem_bp_cfa_offset = 0; + int rem_ra_cfa_offset = 8; + int rem_bp_cfa_offset = INT_MAX; while ((_buf < end) && (_current_pc < pc)) { unsigned char op = *_buf++; @@ -147,7 +146,6 @@ void DwarfParser::parse_dwarf_instructions(uintptr_t begin, uintptr_t pc, const enum DWARF_Register reg = static_cast(opa); if (reg == RBP) { _bp_cfa_offset = operand1 * _data_factor; - _bp_offset_available = true; } else if (reg == RA) { _ra_cfa_offset = operand1 * _data_factor; } @@ -184,6 +182,14 @@ void DwarfParser::parse_dwarf_instructions(uintptr_t begin, uintptr_t pc, const } break; } + case 0x07: { // DW_CFA_undefined + enum DWARF_Register reg = static_cast(read_leb(false)); + // We are only interested in BP here because CFA and RA should not be undefined. + if (reg == RBP) { + _bp_cfa_offset = INT_MAX; + } + break; + } case 0x0d: {// DW_CFA_def_cfa_register _cfa_reg = static_cast(read_leb(false)); break; diff --git a/src/jdk.hotspot.agent/linux/native/libsaproc/dwarf.hpp b/src/jdk.hotspot.agent/linux/native/libsaproc/dwarf.hpp index a047ffae247..a2692738ce1 100644 --- a/src/jdk.hotspot.agent/linux/native/libsaproc/dwarf.hpp +++ b/src/jdk.hotspot.agent/linux/native/libsaproc/dwarf.hpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2020, NTT DATA. + * Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2026, NTT DATA. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -73,7 +73,6 @@ class DwarfParser { int _cfa_offset; int _ra_cfa_offset; int _bp_cfa_offset; - bool _bp_offset_available; uintptr_t read_leb(bool sign); uint64_t get_entry_length(); @@ -86,15 +85,14 @@ class DwarfParser { DwarfParser(lib_info *lib) : _lib(lib), _buf(NULL), _encoding(0), - _cfa_reg(RSP), + _cfa_reg(MAX_VALUE), _return_address_reg(RA), _code_factor(0), _data_factor(0), _current_pc(0L), _cfa_offset(0), - _ra_cfa_offset(0), - _bp_cfa_offset(0), - _bp_offset_available(false) {}; + _ra_cfa_offset(8), + _bp_cfa_offset(INT_MAX) {}; ~DwarfParser() {} bool process_dwarf(const uintptr_t pc); @@ -102,7 +100,6 @@ class DwarfParser { int get_cfa_offset() { return _cfa_offset; } int get_ra_cfa_offset() { return _ra_cfa_offset; } int get_bp_cfa_offset() { return _bp_cfa_offset; } - bool is_bp_offset_available() { return _bp_offset_available; } bool is_in(long pc) { return (_lib->exec_start <= pc) && (pc < _lib->exec_end); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java index e3543503216..15f6615421c 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, Red Hat Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -81,11 +81,7 @@ class LinuxCDebugger implements CDebugger { String cpu = dbg.getCPU(); if (cpu.equals("amd64")) { AMD64ThreadContext context = (AMD64ThreadContext) thread.getContext(); - Address sp = context.getRegisterAsAddress(AMD64ThreadContext.RSP); - if (sp == null) return null; - Address pc = context.getRegisterAsAddress(AMD64ThreadContext.RIP); - if (pc == null) return null; - return LinuxAMD64CFrame.getTopFrame(dbg, sp, pc, context); + return LinuxAMD64CFrame.getTopFrame(dbg, context); } else if (cpu.equals("ppc64")) { PPC64ThreadContext context = (PPC64ThreadContext) thread.getContext(); Address sp = context.getRegisterAsAddress(PPC64ThreadContext.SP); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/amd64/DwarfParser.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/amd64/DwarfParser.java index 3b63ee0a21e..53351c918d3 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/amd64/DwarfParser.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/amd64/DwarfParser.java @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2020, NTT DATA. + * Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2026, NTT DATA. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -66,9 +66,15 @@ public class DwarfParser { processDwarf0(pc.asLongValue()); } + /** + * @return true if BP offset is declared in DWARF instructions. + */ + public boolean isBPOffsetAvailable() { + return getBasePointerOffsetFromCFA() != Integer.MAX_VALUE; + } + public native int getCFARegister(); public native int getCFAOffset(); public native int getReturnAddressOffsetFromCFA(); public native int getBasePointerOffsetFromCFA(); - public native boolean isBPOffsetAvailable(); } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/amd64/LinuxAMD64CFrame.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/amd64/LinuxAMD64CFrame.java index 0ec7f1949bd..4d3d9d5998d 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/amd64/LinuxAMD64CFrame.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/amd64/LinuxAMD64CFrame.java @@ -40,8 +40,9 @@ public final class LinuxAMD64CFrame extends BasicCFrame { private static LinuxAMD64CFrame getFrameFromReg(LinuxDebugger dbg, Function getreg) { Address rip = getreg.apply(AMD64ThreadContext.RIP); Address rsp = getreg.apply(AMD64ThreadContext.RSP); + Address rbp = getreg.apply(AMD64ThreadContext.RBP); Address libptr = dbg.findLibPtrByAddress(rip); - Address cfa = getreg.apply(AMD64ThreadContext.RBP); + Address cfa = null; DwarfParser dwarf = null; if (libptr != null) { // Native frame @@ -52,61 +53,34 @@ public final class LinuxAMD64CFrame extends BasicCFrame { // DWARF processing should succeed when the frame is native // but it might fail if Common Information Entry (CIE) has language // personality routine and/or Language Specific Data Area (LSDA). - return new LinuxAMD64CFrame(dbg, rsp, cfa, rip, dwarf, true); + return new LinuxAMD64CFrame(dbg, rsp, rbp, cfa, rip, dwarf, true); } cfa = getreg.apply(dwarf.getCFARegister()) .addOffsetTo(dwarf.getCFAOffset()); } - return (cfa == null) ? null - : new LinuxAMD64CFrame(dbg, rsp, cfa, rip, dwarf); + return (rbp == null && cfa == null) + ? null + : new LinuxAMD64CFrame(dbg, rsp, rbp, cfa, rip, dwarf); } - public static LinuxAMD64CFrame getTopFrame(LinuxDebugger dbg, Address rip, ThreadContext context) { + public static LinuxAMD64CFrame getTopFrame(LinuxDebugger dbg, ThreadContext context) { return getFrameFromReg(dbg, context::getRegisterAsAddress); } - public static LinuxAMD64CFrame getTopFrame(LinuxDebugger dbg, Address rsp, Address rip, ThreadContext context) { - Address libptr = dbg.findLibPtrByAddress(rip); - Address cfa = context.getRegisterAsAddress(AMD64ThreadContext.RBP); - DwarfParser dwarf = null; - - if (libptr != null) { // Native frame - dwarf = new DwarfParser(libptr); - try { - dwarf.processDwarf(rip); - } catch (DebuggerException e) { - // DWARF processing should succeed when the frame is native - // but it might fail if Common Information Entry (CIE) has language - // personality routine and/or Language Specific Data Area (LSDA). - return new LinuxAMD64CFrame(dbg, rsp, cfa, rip, dwarf, true); - } - - cfa = context.getRegisterAsAddress(dwarf.getCFARegister()) - .addOffsetTo(dwarf.getCFAOffset()); - } - - return (cfa == null) ? null - : new LinuxAMD64CFrame(dbg, rsp, cfa, rip, dwarf); + private LinuxAMD64CFrame(LinuxDebugger dbg, Address rsp, Address rbp, Address cfa, Address rip, DwarfParser dwarf) { + this(dbg, rsp, rbp, cfa, rip, dwarf, false); } - private LinuxAMD64CFrame(LinuxDebugger dbg, Address rsp, Address cfa, Address rip, DwarfParser dwarf) { - this(dbg, rsp, cfa, rip, dwarf, false); - } - - private LinuxAMD64CFrame(LinuxDebugger dbg, Address rsp, Address cfa, Address rip, DwarfParser dwarf, boolean finalFrame) { - this(dbg, rsp, cfa, rip, dwarf, finalFrame, false); - } - - private LinuxAMD64CFrame(LinuxDebugger dbg, Address rsp, Address cfa, Address rip, DwarfParser dwarf, boolean finalFrame, boolean use1ByteBeforeToLookup) { + private LinuxAMD64CFrame(LinuxDebugger dbg, Address rsp, Address rbp, Address cfa, Address rip, DwarfParser dwarf, boolean use1ByteBeforeToLookup) { super(dbg.getCDebugger()); this.rsp = rsp; + this.rbp = rbp; this.cfa = cfa; this.rip = rip; this.dbg = dbg; this.dwarf = dwarf; - this.finalFrame = finalFrame; this.use1ByteBeforeToLookup = use1ByteBeforeToLookup; } @@ -127,82 +101,74 @@ public final class LinuxAMD64CFrame extends BasicCFrame { } public Address localVariableBase() { - return cfa; + return (dwarf != null && dwarf.isBPOffsetAvailable()) + ? cfa.addOffsetTo(dwarf.getBasePointerOffsetFromCFA()) + : rbp; } - private Address getNextPC(boolean useDwarf) { + private Address getNextPC() { try { - long offs = useDwarf ? dwarf.getReturnAddressOffsetFromCFA() - : ADDRESS_SIZE; - return cfa.getAddressAt(offs); + return dwarf == null + ? rbp.getAddressAt(ADDRESS_SIZE) // Java frame + : cfa.getAddressAt(dwarf.getReturnAddressOffsetFromCFA()); // Native frame } catch (UnmappedAddressException | UnalignedAddressException e) { return null; } } - private boolean isValidFrame(Address nextCFA, boolean isNative) { - // CFA should never be null. - // nextCFA must be greater than current CFA, if frame is native. - // Java interpreter frames can share the CFA (frame pointer). - return nextCFA != null && - (!isNative || (isNative && nextCFA.greaterThan(cfa))); + private boolean isValidFrame(Address nextCFA, Address nextRBP) { + // Both CFA and RBP must not be null. + if (nextCFA == null && nextRBP == null) { + return false; + } + + // RBP must not be null if CFA is null - it happens between Java frame and Native frame. + // We cannot validate RBP value because it might be used as GPR. Thus returns true + // if RBP is not null. + if (nextCFA == null && nextRBP != null) { + return true; + } + + // nextCFA must be greater than current CFA. + if (nextCFA != null && nextCFA.greaterThanOrEqual(cfa)) { + return true; + } + + // Otherwise, the frame is not valid. + return false; } private Address getNextRSP() { - // next RSP should be previous slot of return address. - var bp = dwarf == null ? cfa.addOffsetTo(ADDRESS_SIZE) // top of BP points callser BP - : cfa.addOffsetTo(dwarf.getReturnAddressOffsetFromCFA()); - return bp.addOffsetTo(ADDRESS_SIZE); + return dwarf == null ? rbp.addOffsetTo(2 * ADDRESS_SIZE) // Java frame - skip saved BP and RA + : cfa.addOffsetTo(dwarf.getReturnAddressOffsetFromCFA()) + .addOffsetTo(ADDRESS_SIZE); // Native frame } - private Address getNextCFA(DwarfParser nextDwarf, ThreadContext context, Address senderFP, Address senderPC) { - Address nextCFA; - boolean isNative = false; - - if (senderFP == null) { - senderFP = cfa.getAddressAt(0); // RBP by default + private Address getNextRBP(Address senderFP) { + if (senderFP != null) { + return senderFP; + } else if (dwarf == null) { // Current frame is Java + return rbp.getAddressAt(0); + } else { // Current frame is Native + return dwarf.isBPOffsetAvailable() + ? cfa.getAddressAt(dwarf.getBasePointerOffsetFromCFA()) + : rbp; } + } - if (VM.getVM().getCodeCache().contains(senderPC)) { // Next frame is Java - nextCFA = (dwarf == null) ? senderFP // Current frame is Java - : cfa.getAddressAt(dwarf.getBasePointerOffsetFromCFA()); // Current frame is Native - } else { // Next frame is Native - if (VM.getVM().getCodeCache().contains(pc())) { // Current frame is Java - nextCFA = senderFP.addOffsetTo(-nextDwarf.getBasePointerOffsetFromCFA()); - } else { // Current frame is Native - if (nextDwarf == null) { // maybe runtime entrypoint (_start()) - throw new DebuggerException("nextDwarf is null even though native call"); - } - - isNative = true; - int nextCFAReg = nextDwarf.getCFARegister(); - if (nextCFAReg == AMD64ThreadContext.RBP) { - Address rbp = dwarf.isBPOffsetAvailable() ? cfa.addOffsetTo(dwarf.getBasePointerOffsetFromCFA()) - : context.getRegisterAsAddress(AMD64ThreadContext.RBP); - Address nextRBP = rbp.getAddressAt(0); - nextCFA = nextRBP.addOffsetTo(-nextDwarf.getBasePointerOffsetFromCFA()); - } else if (nextCFAReg == AMD64ThreadContext.RSP) { - nextCFA = getNextRSP().addOffsetTo(nextDwarf.getCFAOffset()); - } else { - throw new DebuggerException("Unsupported CFA register: " + nextCFAReg); - } - } - } - - // Sanity check for next CFA address - try { - nextCFA.getAddressAt(0); - } catch (Exception e) { - // return null if next CFA address is invalid + private Address getNextCFA(DwarfParser nextDwarf, Address senderFP, Address senderPC) { + if (nextDwarf == null) { // Next frame is Java + // CFA is not available on Java frame return null; } - if (dbg.isSignalTrampoline(senderPC)) { - // Return without frame check if sender is signal trampoline. - return nextCFA; - } else { - return isValidFrame(nextCFA, isNative) ? nextCFA : null; - } + // Next frame is Native + int nextCFAReg = nextDwarf.getCFARegister(); + return switch(nextCFAReg){ + case AMD64ThreadContext.RBP -> getNextRBP(senderFP).addOffsetTo(nextDwarf.getCFAOffset()); + case AMD64ThreadContext.RSP -> getNextRSP().addOffsetTo(nextDwarf.getCFAOffset()); + default -> throw new DebuggerException("Unsupported CFA register: " + nextCFAReg); + }; } @Override @@ -212,10 +178,6 @@ public final class LinuxAMD64CFrame extends BasicCFrame { @Override public CFrame sender(ThreadProxy th, Address sp, Address fp, Address pc) { - if (finalFrame) { - return null; - } - if (dbg.isSignalTrampoline(pc())) { // RSP points signal context // https://github.com/torvalds/linux/blob/v6.17/arch/x86/kernel/signal.c#L94 @@ -228,8 +190,7 @@ public final class LinuxAMD64CFrame extends BasicCFrame { if (nextRSP == null) { return null; } - - Address nextPC = pc != null ? pc : getNextPC(dwarf != null); + Address nextPC = pc != null ? pc : getNextPC(); if (nextPC == null) { return null; } @@ -252,11 +213,23 @@ public final class LinuxAMD64CFrame extends BasicCFrame { } } + Address nextRBP = getNextRBP(fp); + try { - Address nextCFA = getNextCFA(nextDwarf, context, fp, nextPC); - return new LinuxAMD64CFrame(dbg, nextRSP, nextCFA, nextPC, nextDwarf, false, fallback); - } catch (DebuggerException _) { - return null; + Address nextCFA = getNextCFA(nextDwarf, fp, nextPC); + return isValidFrame(nextCFA, nextRBP) + ? new LinuxAMD64CFrame(dbg, nextRSP, nextRBP, nextCFA, nextPC, nextDwarf, fallback) + : null; + } catch (DebuggerException e) { + if (dbg.isSignalTrampoline(nextPC)) { + // We can through the caller frame if it is signal trampoline. + // getNextCFA() might fail because DwarfParser cannot find out CFA register. + return new LinuxAMD64CFrame(dbg, nextRSP, nextRBP, null, nextPC, nextDwarf, fallback); + } + + // Rethrow the original exception if getNextCFA() failed + // and the caller is not signal trampoline. + throw e; } } @@ -280,16 +253,16 @@ public final class LinuxAMD64CFrame extends BasicCFrame { @Override public Frame toFrame() { - return new AMD64Frame(rsp, cfa, rip); + return new AMD64Frame(rsp, localVariableBase(), rip); } // package/class internals only private static final int ADDRESS_SIZE = 8; private Address rsp; + private Address rbp; private Address rip; private Address cfa; private LinuxDebugger dbg; private DwarfParser dwarf; - private boolean finalFrame; private boolean use1ByteBeforeToLookup; } diff --git a/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixedCore.java b/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixedCore.java index 9fc304d1854..d781e8c5c09 100644 --- a/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixedCore.java +++ b/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixedCore.java @@ -22,8 +22,11 @@ * questions. */ +import jtreg.SkippedException; + import jdk.test.lib.JDKToolFinder; import jdk.test.lib.JDKToolLauncher; +import jdk.test.lib.Platform; import jdk.test.lib.SA.SATestUtils; import jdk.test.lib.Utils; import jdk.test.lib.apps.LingeredApp; @@ -34,7 +37,7 @@ import jtreg.SkippedException; /** * @test - * @bug 8374482 8376284 + * @bug 8374482 8376264 8376284 * @requires (os.family == "linux") & (vm.hasSA) * @requires os.arch == "amd64" * @library /test/lib @@ -63,9 +66,14 @@ public class TestJhsdbJstackMixedCore { out.shouldContain("__restore_rt "); out.shouldContain("Java_jdk_test_lib_apps_LingeredApp_crash"); + out.shouldContain("* jdk.test.lib.apps.LingeredApp.crash()"); } public static void main(String... args) throws Throwable { + if (Platform.isMusl()) { + throw new SkippedException("This test does not work on musl libc."); + } + // Check whether the symbol of signal trampoline is available. var libc = SATestUtils.getLibCPath(); From 77e8469fb0a67d4a795f049acee7e67eaedfb5b7 Mon Sep 17 00:00:00 2001 From: Andrew Haley Date: Fri, 6 Feb 2026 13:50:54 +0000 Subject: [PATCH 007/120] 8328306: AArch64: MacOS lazy JIT "write xor execute" switching Co-authored-by: Dean Long Reviewed-by: dlong, adinn --- src/hotspot/cpu/aarch64/assembler_aarch64.hpp | 1 + .../gc/shared/barrierSetNMethod_aarch64.cpp | 4 + .../cpu/aarch64/macroAssembler_aarch64.cpp | 5 + .../cpu/aarch64/nativeInst_aarch64.cpp | 4 +- .../cpu/aarch64/nativeInst_aarch64.hpp | 21 +++-- .../cpu/aarch64/stubGenerator_aarch64.cpp | 4 +- .../cpu/aarch64/vm_version_aarch64.cpp | 16 ++++ src/hotspot/os/bsd/globals_bsd.hpp | 19 +++- src/hotspot/os/bsd/os_bsd.cpp | 1 + .../os_cpu/bsd_aarch64/os_bsd_aarch64.cpp | 91 +++++++++++++++++-- src/hotspot/share/asm/codeBuffer.cpp | 2 + src/hotspot/share/c1/c1_Runtime1.cpp | 1 + src/hotspot/share/classfile/classLoader.cpp | 2 + src/hotspot/share/classfile/classLoader.hpp | 4 + src/hotspot/share/code/codeBlob.cpp | 2 + src/hotspot/share/code/nmethod.cpp | 8 ++ src/hotspot/share/code/vtableStubs.cpp | 3 + .../share/gc/shared/barrierSetNMethod.cpp | 2 + src/hotspot/share/memory/heap.cpp | 6 ++ src/hotspot/share/opto/runtime.cpp | 2 + src/hotspot/share/prims/upcallStubs.cpp | 1 + src/hotspot/share/runtime/deoptimization.cpp | 1 + .../share/runtime/interfaceSupport.inline.hpp | 31 +++++-- src/hotspot/share/runtime/javaCalls.cpp | 29 +++--- src/hotspot/share/runtime/javaThread.cpp | 14 +-- src/hotspot/share/runtime/javaThread.hpp | 10 ++ src/hotspot/share/runtime/os.hpp | 25 ++++- src/hotspot/share/runtime/thread.hpp | 9 +- src/hotspot/share/runtime/thread.inline.hpp | 20 +++- .../share/runtime/threadWXSetters.inline.hpp | 55 +++++++++-- .../share/utilities/forbiddenFunctions.hpp | 4 + src/hotspot/share/utilities/macros.hpp | 3 + .../utilities/permitForbiddenFunctions.hpp | 4 + .../jtreg/runtime/os/TestWXHealing.java | 58 ++++++++++++ test/hotspot/jtreg/runtime/os/WXHealing.java | 48 ++++++++++ 35 files changed, 436 insertions(+), 74 deletions(-) create mode 100644 test/hotspot/jtreg/runtime/os/TestWXHealing.java create mode 100644 test/hotspot/jtreg/runtime/os/WXHealing.java diff --git a/src/hotspot/cpu/aarch64/assembler_aarch64.hpp b/src/hotspot/cpu/aarch64/assembler_aarch64.hpp index fc6e58b801c..19b3bb1a65b 100644 --- a/src/hotspot/cpu/aarch64/assembler_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/assembler_aarch64.hpp @@ -4329,6 +4329,7 @@ public: #undef INSN Assembler(CodeBuffer* code) : AbstractAssembler(code) { + MACOS_AARCH64_ONLY(os::thread_wx_enable_write()); } // Stack overflow checking diff --git a/src/hotspot/cpu/aarch64/gc/shared/barrierSetNMethod_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/shared/barrierSetNMethod_aarch64.cpp index 4d5ca01b6b4..3d5261c31d1 100644 --- a/src/hotspot/cpu/aarch64/gc/shared/barrierSetNMethod_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/gc/shared/barrierSetNMethod_aarch64.cpp @@ -209,6 +209,10 @@ void BarrierSetNMethod::set_guard_value(nmethod* nm, int value, int bit_mask) { bs_asm->increment_patching_epoch(); } + // Enable WXWrite: the function is called directly from nmethod_entry_barrier + // stub. + MACOS_AARCH64_ONLY(ThreadWXEnable wx(WXWrite, Thread::current())); + NativeNMethodBarrier barrier(nm); barrier.set_value(value, bit_mask); } diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp index ba42602ddc1..409343b6b8d 100644 --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp @@ -473,6 +473,7 @@ address MacroAssembler::target_addr_for_insn(address insn_addr) { // Patch any kind of instruction; there may be several instructions. // Return the total length (in bytes) of the instructions. int MacroAssembler::pd_patch_instruction_size(address insn_addr, address target) { + MACOS_AARCH64_ONLY(os::thread_wx_enable_write()); return RelocActions::run(insn_addr, target); } @@ -481,6 +482,8 @@ int MacroAssembler::patch_oop(address insn_addr, address o) { unsigned insn = *(unsigned*)insn_addr; assert(nativeInstruction_at(insn_addr+4)->is_movk(), "wrong insns in patch"); + MACOS_AARCH64_ONLY(os::thread_wx_enable_write()); + // OOPs are either narrow (32 bits) or wide (48 bits). We encode // narrow OOPs by setting the upper 16 bits in the first // instruction. @@ -510,6 +513,8 @@ int MacroAssembler::patch_narrow_klass(address insn_addr, narrowKlass n) { assert(Instruction_aarch64::extract(insn->encoding(), 31, 21) == 0b11010010101 && nativeInstruction_at(insn_addr+4)->is_movk(), "wrong insns in patch"); + MACOS_AARCH64_ONLY(os::thread_wx_enable_write()); + Instruction_aarch64::patch(insn_addr, 20, 5, n >> 16); Instruction_aarch64::patch(insn_addr+4, 20, 5, n & 0xffff); return 2 * NativeInstruction::instruction_size; diff --git a/src/hotspot/cpu/aarch64/nativeInst_aarch64.cpp b/src/hotspot/cpu/aarch64/nativeInst_aarch64.cpp index f2003dd9b55..0cdf36f0bc5 100644 --- a/src/hotspot/cpu/aarch64/nativeInst_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/nativeInst_aarch64.cpp @@ -133,7 +133,6 @@ void NativeMovConstReg::verify() { intptr_t NativeMovConstReg::data() const { - // das(uint64_t(instruction_address()),2); address addr = MacroAssembler::target_addr_for_insn(instruction_address()); if (maybe_cpool_ref(instruction_address())) { return *(intptr_t*)addr; @@ -144,6 +143,7 @@ intptr_t NativeMovConstReg::data() const { void NativeMovConstReg::set_data(intptr_t x) { if (maybe_cpool_ref(instruction_address())) { + MACOS_AARCH64_ONLY(os::thread_wx_enable_write()); address addr = MacroAssembler::target_addr_for_insn(instruction_address()); *(intptr_t*)addr = x; } else { @@ -350,8 +350,6 @@ bool NativeInstruction::is_stop() { //------------------------------------------------------------------- -void NativeGeneralJump::verify() { } - // MT-safe patching of a long jump instruction. void NativeGeneralJump::replace_mt_safe(address instr_addr, address code_buffer) { ShouldNotCallThis(); diff --git a/src/hotspot/cpu/aarch64/nativeInst_aarch64.hpp b/src/hotspot/cpu/aarch64/nativeInst_aarch64.hpp index c30cb911d96..15b6c9ff215 100644 --- a/src/hotspot/cpu/aarch64/nativeInst_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/nativeInst_aarch64.hpp @@ -90,16 +90,18 @@ protected: s_char sbyte_at(int offset) const { return *(s_char*)addr_at(offset); } u_char ubyte_at(int offset) const { return *(u_char*)addr_at(offset); } - jint int_at(int offset) const { return *(jint*)addr_at(offset); } - juint uint_at(int offset) const { return *(juint*)addr_at(offset); } - address ptr_at(int offset) const { return *(address*)addr_at(offset); } - oop oop_at(int offset) const { return *(oop*)addr_at(offset); } + jint int_at(int offset) const { return *(jint*)addr_at(offset); } + juint uint_at(int offset) const { return *(juint*)addr_at(offset); } + address ptr_at(int offset) const { return *(address*)addr_at(offset); } + oop oop_at(int offset) const { return *(oop*)addr_at(offset); } - void set_char_at(int offset, char c) { *addr_at(offset) = (u_char)c; } - void set_int_at(int offset, jint i) { *(jint*)addr_at(offset) = i; } - void set_uint_at(int offset, jint i) { *(juint*)addr_at(offset) = i; } - void set_ptr_at(int offset, address ptr) { *(address*)addr_at(offset) = ptr; } - void set_oop_at(int offset, oop o) { *(oop*)addr_at(offset) = o; } +#define MACOS_WX_WRITE MACOS_AARCH64_ONLY(os::thread_wx_enable_write()) + void set_char_at(int offset, char c) { MACOS_WX_WRITE; *addr_at(offset) = (u_char)c; } + void set_int_at(int offset, jint i) { MACOS_WX_WRITE; *(jint*)addr_at(offset) = i; } + void set_uint_at(int offset, jint i) { MACOS_WX_WRITE; *(juint*)addr_at(offset) = i; } + void set_ptr_at(int offset, address ptr) { MACOS_WX_WRITE; *(address*)addr_at(offset) = ptr; } + void set_oop_at(int offset, oop o) { MACOS_WX_WRITE; *(oop*)addr_at(offset) = o; } +#undef MACOS_WX_WRITE void wrote(int offset); @@ -380,7 +382,6 @@ public: void set_jump_destination(address dest); static void replace_mt_safe(address instr_addr, address code_buffer); - static void verify(); }; inline NativeGeneralJump* nativeGeneralJump_at(address address) { diff --git a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp index db653bcf236..a459a28b09e 100644 --- a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp @@ -11742,7 +11742,9 @@ class StubGenerator: public StubCodeGenerator { } #endif - StubRoutines::_unsafe_setmemory = generate_unsafe_setmemory(); + if (vmIntrinsics::is_intrinsic_available(vmIntrinsics::_setMemory)) { + StubRoutines::_unsafe_setmemory = generate_unsafe_setmemory(); + } StubRoutines::aarch64::set_completed(); // Inidicate that arraycopy and zero_blocks stubs are generated } diff --git a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp b/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp index 3fa85f8f47d..0a7bc5a8962 100644 --- a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp @@ -622,6 +622,22 @@ void VM_Version::initialize() { check_virtualizations(); +#ifdef __APPLE__ + DefaultWXWriteMode = UseOldWX ? WXWrite : WXArmedForWrite; + + if (TraceWXHealing) { + if (pthread_jit_write_protect_supported_np()) { + tty->print_cr("### TraceWXHealing is in use"); + if (StressWXHealing) { + tty->print_cr("### StressWXHealing is in use"); + } + } else { + tty->print_cr("WX Healing is not in use because MAP_JIT write protection " + "does not work on this system."); + } + } +#endif + // Sync SVE related CPU features with flags if (UseSVE < 2) { clear_feature(CPU_SVE2); diff --git a/src/hotspot/os/bsd/globals_bsd.hpp b/src/hotspot/os/bsd/globals_bsd.hpp index 850d491a11f..22f587ed789 100644 --- a/src/hotspot/os/bsd/globals_bsd.hpp +++ b/src/hotspot/os/bsd/globals_bsd.hpp @@ -28,6 +28,7 @@ // // Declare Bsd specific flags. They are not available on other platforms. // +#ifdef AARCH64 #define RUNTIME_OS_FLAGS(develop, \ develop_pd, \ product, \ @@ -35,9 +36,21 @@ range, \ constraint) \ \ - AARCH64_ONLY(develop(bool, AssertWXAtThreadSync, true, \ - "Conservatively check W^X thread state at possible safepoint" \ - "or handshake")) + develop(bool, TraceWXHealing, false, \ + "track occurrences of W^X mode healing") \ + develop(bool, UseOldWX, false, \ + "Choose old W^X implementation.") \ + product(bool, StressWXHealing, false, DIAGNOSTIC, \ + "Stress W xor X healing on MacOS") + +#else +#define RUNTIME_OS_FLAGS(develop, \ + develop_pd, \ + product, \ + product_pd, \ + range, \ + constraint) +#endif // end of RUNTIME_OS_FLAGS diff --git a/src/hotspot/os/bsd/os_bsd.cpp b/src/hotspot/os/bsd/os_bsd.cpp index 0e21c2d1785..81320b4f1aa 100644 --- a/src/hotspot/os/bsd/os_bsd.cpp +++ b/src/hotspot/os/bsd/os_bsd.cpp @@ -841,6 +841,7 @@ jlong os::javaTimeNanos() { // We might also condition (c) on the magnitude of the delta between obsv and now. // Avoiding excessive CAS operations to hot RW locations is critical. // See https://blogs.oracle.com/dave/entry/cas_and_cache_trivia_invalidate + // https://web.archive.org/web/20131214182431/https://blogs.oracle.com/dave/entry/cas_and_cache_trivia_invalidate return (prev == obsv) ? now : obsv; } diff --git a/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp b/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp index 62dba218b2f..36599594842 100644 --- a/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp +++ b/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp @@ -54,8 +54,11 @@ #include "signals_posix.hpp" #include "utilities/align.hpp" #include "utilities/debug.hpp" +#include "utilities/decoder.hpp" #include "utilities/events.hpp" +#include "utilities/nativeStackPrinter.hpp" #include "utilities/vmError.hpp" +#include "compiler/disassembler.hpp" // put OS-includes here # include @@ -85,6 +88,8 @@ #define SPELL_REG_SP "sp" #ifdef __APPLE__ +WXMode DefaultWXWriteMode; + // see darwin-xnu/osfmk/mach/arm/_structs.h // 10.5 UNIX03 member name prefixes @@ -233,19 +238,56 @@ NOINLINE frame os::current_frame() { bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, ucontext_t* uc, JavaThread* thread) { - // Enable WXWrite: this function is called by the signal handler at arbitrary - // point of execution. - ThreadWXEnable wx(WXWrite, thread); - // decide if this trap can be handled by a stub address stub = nullptr; - - address pc = nullptr; + address pc = nullptr; //%note os_trap_1 if (info != nullptr && uc != nullptr && thread != nullptr) { pc = (address) os::Posix::ucontext_get_pc(uc); +#ifdef MACOS_AARCH64 + // If we got a SIGBUS because we tried to write into the code + // cache, try enabling WXWrite mode. + if (sig == SIGBUS + && pc != info->si_addr + && CodeCache::contains(info->si_addr) + && os::address_is_in_vm(pc)) { + WXMode *entry_mode = thread->_cur_wx_mode; + if (entry_mode != nullptr && *entry_mode == WXArmedForWrite) { + if (TraceWXHealing) { + static const char *mode_names[3] = {"WXWrite", "WXExec", "WXArmedForWrite"}; + tty->print("Healing WXMode %s at %p to WXWrite", + mode_names[*entry_mode], entry_mode); + char name[128]; + int offset = 0; + if (os::dll_address_to_function_name(pc, name, sizeof name, &offset)) { + tty->print_cr(" (%s+0x%x)", name, offset); + } else { + tty->cr(); + } + if (Verbose) { + char buf[O_BUFLEN]; + NativeStackPrinter nsp(thread); + nsp.print_stack(tty, buf, sizeof(buf), pc, + true /* print_source_info */, -1 /* max stack */); + } + } +#ifndef PRODUCT + guarantee(StressWXHealing, + "We should not reach here unless StressWXHealing"); +#endif + *(thread->_cur_wx_mode) = WXWrite; + return thread->wx_enable_write(); + } + } + + // There may be cases where code after this point that we call + // from the signal handler changes WX state, so we protect against + // that by saving and restoring the state. + ThreadWXEnable wx(thread->get_wx_state(), thread); +#endif + // Handle ALL stack overflow variations here if (sig == SIGSEGV || sig == SIGBUS) { address addr = (address) info->si_addr; @@ -515,11 +557,42 @@ int os::extra_bang_size_in_bytes() { return 0; } -#ifdef __APPLE__ +#ifdef MACOS_AARCH64 +THREAD_LOCAL bool os::_jit_exec_enabled; + +// This is a wrapper around the standard library function +// pthread_jit_write_protect_np(3). We keep track of the state of +// per-thread write protection on the MAP_JIT region in the +// thread-local variable os::_jit_exec_enabled void os::current_thread_enable_wx(WXMode mode) { - pthread_jit_write_protect_np(mode == WXExec); + bool exec_enabled = mode != WXWrite; + if (exec_enabled != _jit_exec_enabled NOT_PRODUCT( || DefaultWXWriteMode == WXWrite)) { + permit_forbidden_function::pthread_jit_write_protect_np(exec_enabled); + _jit_exec_enabled = exec_enabled; + } } -#endif + +// If the current thread is in the WX state WXArmedForWrite, change +// the state to WXWrite. +bool Thread::wx_enable_write() { + if (_wx_state == WXArmedForWrite) { + _wx_state = WXWrite; + os::current_thread_enable_wx(WXWrite); + return true; + } else { + return false; + } +} + +// A wrapper around wx_enable_write() for when the current thread is +// not known. +void os::thread_wx_enable_write_impl() { + if (!StressWXHealing) { + Thread::current()->wx_enable_write(); + } +} + +#endif // MACOS_AARCH64 static inline void atomic_copy64(const volatile void *src, volatile void *dst) { *(jlong *) dst = *(const jlong *) src; diff --git a/src/hotspot/share/asm/codeBuffer.cpp b/src/hotspot/share/asm/codeBuffer.cpp index 7871134e923..d94f52c18f6 100644 --- a/src/hotspot/share/asm/codeBuffer.cpp +++ b/src/hotspot/share/asm/codeBuffer.cpp @@ -98,6 +98,8 @@ CodeBuffer::CodeBuffer(const CodeBlob* blob) DEBUG_ONLY(: Scrubber(this, sizeof( } void CodeBuffer::initialize(csize_t code_size, csize_t locs_size) { + MACOS_AARCH64_ONLY(os::thread_wx_enable_write()); + // Always allow for empty slop around each section. int slop = (int) CodeSection::end_slop(); diff --git a/src/hotspot/share/c1/c1_Runtime1.cpp b/src/hotspot/share/c1/c1_Runtime1.cpp index a4c956ff5be..63764dd113a 100644 --- a/src/hotspot/share/c1/c1_Runtime1.cpp +++ b/src/hotspot/share/c1/c1_Runtime1.cpp @@ -541,6 +541,7 @@ extern void vm_exit(int code); // unpack_with_exception entry instead. This makes life for the exception blob easier // because making that same check and diverting is painful from assembly language. JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* current, oopDesc* ex, address pc, nmethod*& nm)) + MACOS_AARCH64_ONLY(current->wx_enable_write()); Handle exception(current, ex); // This function is called when we are about to throw an exception. Therefore, diff --git a/src/hotspot/share/classfile/classLoader.cpp b/src/hotspot/share/classfile/classLoader.cpp index f631bfaa102..eced83577cb 100644 --- a/src/hotspot/share/classfile/classLoader.cpp +++ b/src/hotspot/share/classfile/classLoader.cpp @@ -127,6 +127,7 @@ PerfCounter* ClassLoader::_perf_ik_link_methods_count = nullptr; PerfCounter* ClassLoader::_perf_method_adapters_count = nullptr; PerfCounter* ClassLoader::_unsafe_defineClassCallCounter = nullptr; PerfCounter* ClassLoader::_perf_secondary_hash_time = nullptr; +PerfCounter* ClassLoader::_perf_change_wx_time = nullptr; PerfCounter* ClassLoader::_perf_resolve_indy_time = nullptr; PerfCounter* ClassLoader::_perf_resolve_invokehandle_time = nullptr; @@ -1370,6 +1371,7 @@ void ClassLoader::initialize(TRAPS) { NEWPERFBYTECOUNTER(_perf_sys_classfile_bytes_read, SUN_CLS, "sysClassBytes"); NEWPERFEVENTCOUNTER(_unsafe_defineClassCallCounter, SUN_CLS, "unsafeDefineClassCalls"); NEWPERFTICKCOUNTER(_perf_secondary_hash_time, SUN_CLS, "secondarySuperHashTime"); + NEWPERFTICKCOUNTER(_perf_change_wx_time, SUN_CLS, "changeWXTime"); if (log_is_enabled(Info, perf, class, link)) { NEWPERFTICKCOUNTER(_perf_ik_link_methods_time, SUN_CLS, "linkMethodsTime"); diff --git a/src/hotspot/share/classfile/classLoader.hpp b/src/hotspot/share/classfile/classLoader.hpp index afb0a581dcc..a935d3027ac 100644 --- a/src/hotspot/share/classfile/classLoader.hpp +++ b/src/hotspot/share/classfile/classLoader.hpp @@ -184,6 +184,7 @@ class ClassLoader: AllStatic { // Count the time taken to hash the scondary superclass arrays. static PerfCounter* _perf_secondary_hash_time; + static PerfCounter* _perf_change_wx_time; // The boot class path consists of 3 ordered pieces: // 1. the module/path pairs specified to --patch-module @@ -268,6 +269,9 @@ class ClassLoader: AllStatic { static PerfCounter* perf_secondary_hash_time() { return _perf_secondary_hash_time; } + static PerfCounter* perf_change_wx_time() { + return _perf_change_wx_time; + } static PerfCounter* perf_sys_classload_time() { return _perf_sys_classload_time; } static PerfCounter* perf_app_classload_time() { return _perf_app_classload_time; } static PerfCounter* perf_app_classload_selftime() { return _perf_app_classload_selftime; } diff --git a/src/hotspot/share/code/codeBlob.cpp b/src/hotspot/share/code/codeBlob.cpp index a0a34ec23fa..094b4f82cf0 100644 --- a/src/hotspot/share/code/codeBlob.cpp +++ b/src/hotspot/share/code/codeBlob.cpp @@ -520,6 +520,8 @@ VtableBlob* VtableBlob::create(const char* name, int buffer_size) { // eventually. return nullptr; } + + MACOS_AARCH64_ONLY(os::thread_wx_enable_write()); blob = new (size) VtableBlob(name, size); CodeCache_lock->unlock(); } diff --git a/src/hotspot/share/code/nmethod.cpp b/src/hotspot/share/code/nmethod.cpp index edfca5c98ee..13eb1ff1604 100644 --- a/src/hotspot/share/code/nmethod.cpp +++ b/src/hotspot/share/code/nmethod.cpp @@ -2137,6 +2137,9 @@ void nmethod::make_deoptimized() { ResourceMark rm; RelocIterator iter(this, oops_reloc_begin()); + // Assume there will be some calls to make deoptimized. + MACOS_AARCH64_ONLY(os::thread_wx_enable_write()); + while (iter.next()) { switch (iter.type()) { @@ -2213,6 +2216,7 @@ void nmethod::verify_clean_inline_caches() { } void nmethod::mark_as_maybe_on_stack() { + MACOS_AARCH64_ONLY(os::thread_wx_enable_write()); AtomicAccess::store(&_gc_epoch, CodeCache::gc_epoch()); } @@ -2305,6 +2309,8 @@ bool nmethod::make_not_entrant(InvalidationReason invalidation_reason) { return false; } + MACOS_AARCH64_ONLY(os::thread_wx_enable_write()); + { // Enter critical section. Does not block for safepoint. ConditionalMutexLocker ml(NMethodState_lock, !NMethodState_lock->owned_by_self(), Mutex::_no_safepoint_check_flag); @@ -2740,6 +2746,8 @@ bool nmethod::is_unloading() { state_is_unloading = IsUnloadingBehaviour::is_unloading(this); uint8_t new_state = IsUnloadingState::create(state_is_unloading, state_unloading_cycle); + MACOS_AARCH64_ONLY(os::thread_wx_enable_write()); + // Note that if an nmethod has dead oops, everyone will agree that the // nmethod is_unloading. However, the is_cold heuristics can yield // different outcomes, so we guard the computed result with a CAS diff --git a/src/hotspot/share/code/vtableStubs.cpp b/src/hotspot/share/code/vtableStubs.cpp index b926888595d..35b226a8798 100644 --- a/src/hotspot/share/code/vtableStubs.cpp +++ b/src/hotspot/share/code/vtableStubs.cpp @@ -51,6 +51,9 @@ VMReg VtableStub::_receiver_location = VMRegImpl::Bad(); void* VtableStub::operator new(size_t size, int code_size) throw() { assert_lock_strong(VtableStubs_lock); assert(size == sizeof(VtableStub), "mismatched size"); + + MACOS_AARCH64_ONLY(os::thread_wx_enable_write()); + // compute real VtableStub size (rounded to nearest word) const int real_size = align_up(code_size + (int)sizeof(VtableStub), wordSize); // malloc them in chunks to minimize header overhead diff --git a/src/hotspot/share/gc/shared/barrierSetNMethod.cpp b/src/hotspot/share/gc/shared/barrierSetNMethod.cpp index ab94bae079a..a1f03a4bf50 100644 --- a/src/hotspot/share/gc/shared/barrierSetNMethod.cpp +++ b/src/hotspot/share/gc/shared/barrierSetNMethod.cpp @@ -111,6 +111,8 @@ bool BarrierSetNMethod::nmethod_entry_barrier(nmethod* nm) { return true; } + // Enable WXWrite: the function is called directly from nmethod_entry_barrier + // stub. MACOS_AARCH64_ONLY(ThreadWXEnable wx(WXWrite, Thread::current())); // If the nmethod is the only thing pointing to the oops, and we are using a diff --git a/src/hotspot/share/memory/heap.cpp b/src/hotspot/share/memory/heap.cpp index a1333ed13e9..3ade5169eef 100644 --- a/src/hotspot/share/memory/heap.cpp +++ b/src/hotspot/share/memory/heap.cpp @@ -163,6 +163,7 @@ void CodeHeap::mark_segmap_as_used(size_t beg, size_t end, bool is_FreeBlock_joi void CodeHeap::invalidate(size_t beg, size_t end, size_t hdr_size) { #ifndef PRODUCT + MACOS_AARCH64_ONLY(os::thread_wx_enable_write()); // Fill the given range with some bad value. // length is expected to be in segment_size units. // This prevents inadvertent execution of code leftover from previous use. @@ -172,11 +173,13 @@ void CodeHeap::invalidate(size_t beg, size_t end, size_t hdr_size) { } void CodeHeap::clear(size_t beg, size_t end) { + MACOS_AARCH64_ONLY(os::thread_wx_enable_write()); mark_segmap_as_free(beg, end); invalidate(beg, end, 0); } void CodeHeap::clear() { + MACOS_AARCH64_ONLY(os::thread_wx_enable_write()); _next_segment = 0; clear(_next_segment, _number_of_committed_segments); } @@ -190,6 +193,7 @@ static size_t align_to_page_size(size_t size) { bool CodeHeap::reserve(ReservedSpace rs, size_t committed_size, size_t segment_size) { + MACOS_AARCH64_ONLY(os::thread_wx_enable_write()); assert(rs.size() >= committed_size, "reserved < committed"); assert(is_aligned(committed_size, rs.page_size()), "must be page aligned"); assert(segment_size >= sizeof(FreeBlock), "segment size is too small"); @@ -230,6 +234,7 @@ bool CodeHeap::reserve(ReservedSpace rs, size_t committed_size, size_t segment_s bool CodeHeap::expand_by(size_t size) { + MACOS_AARCH64_ONLY(os::thread_wx_enable_write()); assert_locked_or_safepoint(CodeCache_lock); // expand _memory space @@ -259,6 +264,7 @@ bool CodeHeap::expand_by(size_t size) { void* CodeHeap::allocate(size_t instance_size) { + MACOS_AARCH64_ONLY(os::thread_wx_enable_write()); size_t number_of_segments = size_to_segments(instance_size + header_size()); assert(segments_to_size(number_of_segments) >= sizeof(FreeBlock), "not enough room for FreeList"); assert_locked_or_safepoint(CodeCache_lock); diff --git a/src/hotspot/share/opto/runtime.cpp b/src/hotspot/share/opto/runtime.cpp index 6dbbfb0a130..0d2dbb813bd 100644 --- a/src/hotspot/share/opto/runtime.cpp +++ b/src/hotspot/share/opto/runtime.cpp @@ -1865,6 +1865,8 @@ JRT_ENTRY_NO_ASYNC(address, OptoRuntime::handle_exception_C_helper(JavaThread* c // has updated oops. StackWatermarkSet::after_unwind(current); + MACOS_AARCH64_ONLY(os::thread_wx_enable_write()); + // Do not confuse exception_oop with pending_exception. The exception_oop // is only used to pass arguments into the method. Not for general // exception handling. DO NOT CHANGE IT to use pending_exception, since diff --git a/src/hotspot/share/prims/upcallStubs.cpp b/src/hotspot/share/prims/upcallStubs.cpp index 5215e6d1735..a3271589fbb 100644 --- a/src/hotspot/share/prims/upcallStubs.cpp +++ b/src/hotspot/share/prims/upcallStubs.cpp @@ -26,6 +26,7 @@ #include "runtime/interfaceSupport.inline.hpp" JVM_ENTRY(static jboolean, UH_FreeUpcallStub0(JNIEnv *env, jobject _unused, jlong addr)) + MACOS_AARCH64_ONLY(os::thread_wx_enable_write()); // safe to call 'find_blob' without code cache lock, because stub is always alive CodeBlob* cb = CodeCache::find_blob((char*)addr); if (cb == nullptr) { diff --git a/src/hotspot/share/runtime/deoptimization.cpp b/src/hotspot/share/runtime/deoptimization.cpp index e2029a26d37..2beba9abb06 100644 --- a/src/hotspot/share/runtime/deoptimization.cpp +++ b/src/hotspot/share/runtime/deoptimization.cpp @@ -132,6 +132,7 @@ void DeoptimizationScope::mark(nmethod* nm, bool inc_recompile_counts) { return; } + MACOS_AARCH64_ONLY(os::thread_wx_enable_write()); nmethod::DeoptimizationStatus status = inc_recompile_counts ? nmethod::deoptimize : nmethod::deoptimize_noupdate; AtomicAccess::store(&nm->_deoptimization_status, status); diff --git a/src/hotspot/share/runtime/interfaceSupport.inline.hpp b/src/hotspot/share/runtime/interfaceSupport.inline.hpp index ecd7397d81a..cd3a45a8d3c 100644 --- a/src/hotspot/share/runtime/interfaceSupport.inline.hpp +++ b/src/hotspot/share/runtime/interfaceSupport.inline.hpp @@ -279,12 +279,14 @@ class VMNativeEntryWrapper { os::verify_stack_alignment(); \ /* begin of body */ - #define JRT_ENTRY(result_type, header) \ result_type header { \ assert(current == JavaThread::current(), "Must be"); \ - MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, current)); \ ThreadInVMfromJava __tiv(current); \ + MACOS_AARCH64_ONLY( \ + static WXMode wx_mode = DefaultWXWriteMode; \ + ThreadWXEnable __wx(&wx_mode, current); \ + ) \ VM_ENTRY_BASE(result_type, header, current) \ DEBUG_ONLY(VMEntryWrapper __vew;) @@ -311,8 +313,11 @@ class VMNativeEntryWrapper { #define JRT_ENTRY_NO_ASYNC(result_type, header) \ result_type header { \ assert(current == JavaThread::current(), "Must be"); \ - MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, current)); \ ThreadInVMfromJava __tiv(current, false /* check asyncs */); \ + MACOS_AARCH64_ONLY( \ + static WXMode wx_mode = DefaultWXWriteMode; \ + ThreadWXEnable __wx(&wx_mode, current); \ + ) \ VM_ENTRY_BASE(result_type, header, current) \ DEBUG_ONLY(VMEntryWrapper __vew;) @@ -321,7 +326,10 @@ class VMNativeEntryWrapper { #define JRT_BLOCK_ENTRY(result_type, header) \ result_type header { \ assert(current == JavaThread::current(), "Must be"); \ - MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, current)); \ + MACOS_AARCH64_ONLY( \ + static WXMode wx_mode = DefaultWXWriteMode; \ + ThreadWXEnable __wx(&wx_mode, current); \ + ) \ HandleMarkCleaner __hm(current); #define JRT_BLOCK \ @@ -358,8 +366,11 @@ extern "C" { \ result_type JNICALL header { \ JavaThread* thread=JavaThread::thread_from_jni_environment(env); \ assert(thread == Thread::current(), "JNIEnv is only valid in same thread"); \ - MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread)); \ ThreadInVMfromNative __tiv(thread); \ + MACOS_AARCH64_ONLY( \ + static WXMode wx_mode = DefaultWXWriteMode; \ + ThreadWXEnable __wx(&wx_mode, thread); \ + ) \ DEBUG_ONLY(VMNativeEntryWrapper __vew;) \ VM_ENTRY_BASE(result_type, header, thread) @@ -383,8 +394,11 @@ extern "C" { \ extern "C" { \ result_type JNICALL header { \ JavaThread* thread=JavaThread::thread_from_jni_environment(env); \ - MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread)); \ ThreadInVMfromNative __tiv(thread); \ + MACOS_AARCH64_ONLY( \ + static WXMode wx_mode = DefaultWXWriteMode; \ + ThreadWXEnable __wx(&wx_mode, thread); \ + ) \ DEBUG_ONLY(VMNativeEntryWrapper __vew;) \ VM_ENTRY_BASE(result_type, header, thread) @@ -393,8 +407,11 @@ extern "C" { \ extern "C" { \ result_type JNICALL header { \ JavaThread* thread = JavaThread::current(); \ - MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread)); \ ThreadInVMfromNative __tiv(thread); \ + MACOS_AARCH64_ONLY( \ + static WXMode wx_mode = DefaultWXWriteMode; \ + ThreadWXEnable __wx(&wx_mode, thread); \ + ) \ DEBUG_ONLY(VMNativeEntryWrapper __vew;) \ VM_ENTRY_BASE(result_type, header, thread) diff --git a/src/hotspot/share/runtime/javaCalls.cpp b/src/hotspot/share/runtime/javaCalls.cpp index 3ed678284e4..da701640006 100644 --- a/src/hotspot/share/runtime/javaCalls.cpp +++ b/src/hotspot/share/runtime/javaCalls.cpp @@ -94,16 +94,12 @@ JavaCallWrapper::JavaCallWrapper(const methodHandle& callee_method, Handle recei DEBUG_ONLY(_thread->inc_java_call_counter()); _thread->set_active_handles(new_handles); // install new handle block and reset Java frame linkage - - MACOS_AARCH64_ONLY(_thread->enable_wx(WXExec)); } JavaCallWrapper::~JavaCallWrapper() { assert(_thread == JavaThread::current(), "must still be the same thread"); - MACOS_AARCH64_ONLY(_thread->enable_wx(WXWrite)); - // restore previous handle block & Java frame linkage JNIHandleBlock *_old_handles = _thread->active_handles(); _thread->set_active_handles(_handles); @@ -413,17 +409,20 @@ void JavaCalls::call_helper(JavaValue* result, const methodHandle& method, JavaC #endif } } - StubRoutines::call_stub()( - (address)&link, - // (intptr_t*)&(result->_value), // see NOTE above (compiler problem) - result_val_address, // see NOTE above (compiler problem) - result_type, - method(), - entry_point, - parameter_address, - args->size_of_parameters(), - CHECK - ); + { + MACOS_AARCH64_ONLY(ThreadWXEnable wx(WXExec, thread)); + StubRoutines::call_stub()( + (address)&link, + // (intptr_t*)&(result->_value), // see NOTE above (compiler problem) + result_val_address, // see NOTE above (compiler problem) + result_type, + method(), + entry_point, + parameter_address, + args->size_of_parameters(), + CHECK + ); + } result = link.result(); // circumvent MS C++ 5.0 compiler bug (result is clobbered across call) // Preserve oop return value across possible gc points diff --git a/src/hotspot/share/runtime/javaThread.cpp b/src/hotspot/share/runtime/javaThread.cpp index e73347f35d8..a891e333d4c 100644 --- a/src/hotspot/share/runtime/javaThread.cpp +++ b/src/hotspot/share/runtime/javaThread.cpp @@ -377,15 +377,6 @@ void JavaThread::check_possible_safepoint() { // Clear unhandled oops in JavaThreads so we get a crash right away. clear_unhandled_oops(); #endif // CHECK_UNHANDLED_OOPS - - // Macos/aarch64 should be in the right state for safepoint (e.g. - // deoptimization needs WXWrite). Crashes caused by the wrong state rarely - // happens in practice, making such issues hard to find and reproduce. -#if defined(__APPLE__) && defined(AARCH64) - if (AssertWXAtThreadSync) { - assert_wx_state(WXWrite); - } -#endif } void JavaThread::check_for_valid_safepoint_state() { @@ -521,6 +512,11 @@ JavaThread::JavaThread(MemTag mem_tag) : _last_freeze_fail_result(freeze_ok), #endif +#ifdef MACOS_AARCH64 + _cur_wx_enable(nullptr), + _cur_wx_mode(0), +#endif + _lock_stack(this), _om_cache(this) { set_jni_functions(jni_functions()); diff --git a/src/hotspot/share/runtime/javaThread.hpp b/src/hotspot/share/runtime/javaThread.hpp index 1aae37c0697..755a6abe0d8 100644 --- a/src/hotspot/share/runtime/javaThread.hpp +++ b/src/hotspot/share/runtime/javaThread.hpp @@ -81,6 +81,7 @@ class JavaThread; typedef void (*ThreadFunction)(JavaThread*, TRAPS); class EventVirtualThreadPinned; +class ThreadWXEnable; class JavaThread: public Thread { friend class VMStructs; @@ -1288,6 +1289,15 @@ public: bool get_and_clear_interrupted(); private: + +#ifdef MACOS_AARCH64 + friend class ThreadWXEnable; + friend class PosixSignals; + + ThreadWXEnable* _cur_wx_enable; + WXMode* _cur_wx_mode; +#endif + LockStack _lock_stack; OMCache _om_cache; diff --git a/src/hotspot/share/runtime/os.hpp b/src/hotspot/share/runtime/os.hpp index 29c872157fd..c6a1d670926 100644 --- a/src/hotspot/share/runtime/os.hpp +++ b/src/hotspot/share/runtime/os.hpp @@ -140,11 +140,16 @@ enum ThreadPriority { // JLS 20.20.1-3 CriticalPriority = 11 // Critical thread priority }; +#ifdef MACOS_AARCH64 enum WXMode { - WXWrite, - WXExec + WXWrite = 0, + WXExec = 1, + WXArmedForWrite = 2, }; +extern WXMode DefaultWXWriteMode; +#endif // MACOS_AARCH64 + // Executable parameter flag for os::commit_memory() and // os::commit_memory_or_exit(). const bool ExecMem = true; @@ -1128,9 +1133,23 @@ class os: AllStatic { static char* build_agent_function_name(const char *sym, const char *cname, bool is_absolute_path); -#if defined(__APPLE__) && defined(AARCH64) +#ifdef MACOS_AARCH64 // Enables write or execute access to writeable and executable pages. static void current_thread_enable_wx(WXMode mode); + // Macos-AArch64 only. + static void thread_wx_enable_write_impl(); + + // Short circuit write enabling if it's already enabled. This + // function is executed many times, so it makes sense to inline a + // small part of it. +private: + static THREAD_LOCAL bool _jit_exec_enabled; +public: + static void thread_wx_enable_write() { + if (__builtin_expect(_jit_exec_enabled, false)) { + thread_wx_enable_write_impl(); + } + } #endif // __APPLE__ && AARCH64 protected: diff --git a/src/hotspot/share/runtime/thread.hpp b/src/hotspot/share/runtime/thread.hpp index 29e3c07ba20..dc09d4c68c2 100644 --- a/src/hotspot/share/runtime/thread.hpp +++ b/src/hotspot/share/runtime/thread.hpp @@ -602,18 +602,21 @@ protected: jint _hashStateY; jint _hashStateZ; -#if defined(__APPLE__) && defined(AARCH64) +#ifdef MACOS_AARCH64 private: DEBUG_ONLY(bool _wx_init); WXMode _wx_state; public: void init_wx(); WXMode enable_wx(WXMode new_state); - + bool wx_enable_write(); void assert_wx_state(WXMode expected) { assert(_wx_state == expected, "wrong state"); } -#endif // __APPLE__ && AARCH64 + WXMode get_wx_state() { + return _wx_state; + } +#endif // MACOS_AARCH64 private: bool _in_asgct = false; diff --git a/src/hotspot/share/runtime/thread.inline.hpp b/src/hotspot/share/runtime/thread.inline.hpp index 61866674224..b194f5e2a7f 100644 --- a/src/hotspot/share/runtime/thread.inline.hpp +++ b/src/hotspot/share/runtime/thread.inline.hpp @@ -30,8 +30,9 @@ #include "gc/shared/tlab_globals.hpp" #include "runtime/atomicAccess.hpp" +#include "utilities/permitForbiddenFunctions.hpp" -#if defined(__APPLE__) && defined(AARCH64) +#ifdef MACOS_AARCH64 #include "runtime/os.hpp" #endif @@ -60,11 +61,17 @@ inline void Thread::set_threads_hazard_ptr(ThreadsList* new_list) { } #if defined(__APPLE__) && defined(AARCH64) + +static void dummy() { } + inline void Thread::init_wx() { assert(this == Thread::current(), "should only be called for current thread"); assert(!_wx_init, "second init"); _wx_state = WXWrite; + permit_forbidden_function::pthread_jit_write_protect_np(false); os::current_thread_enable_wx(_wx_state); + // Side effect: preload base address of libjvm + guarantee(os::address_is_in_vm(CAST_FROM_FN_PTR(address, &dummy)), "must be"); DEBUG_ONLY(_wx_init = true); } @@ -74,10 +81,19 @@ inline WXMode Thread::enable_wx(WXMode new_state) { WXMode old = _wx_state; if (_wx_state != new_state) { _wx_state = new_state; - os::current_thread_enable_wx(new_state); + switch (new_state) { + case WXWrite: + case WXExec: + os::current_thread_enable_wx(new_state); + break; + case WXArmedForWrite: + break; + default: ShouldNotReachHere(); break; + } } return old; } + #endif // __APPLE__ && AARCH64 #endif // SHARE_RUNTIME_THREAD_INLINE_HPP diff --git a/src/hotspot/share/runtime/threadWXSetters.inline.hpp b/src/hotspot/share/runtime/threadWXSetters.inline.hpp index 121584b81be..e7e37fcde1b 100644 --- a/src/hotspot/share/runtime/threadWXSetters.inline.hpp +++ b/src/hotspot/share/runtime/threadWXSetters.inline.hpp @@ -28,25 +28,62 @@ // No threadWXSetters.hpp -#if defined(__APPLE__) && defined(AARCH64) +#ifdef MACOS_AARCH64 +#include "classfile/classLoader.hpp" +#include "runtime/perfData.inline.hpp" #include "runtime/thread.inline.hpp" class ThreadWXEnable { Thread* _thread; WXMode _old_mode; + WXMode *_this_wx_mode; + ThreadWXEnable *_prev; public: - ThreadWXEnable(WXMode new_mode, Thread* thread) : - _thread(thread), - _old_mode(_thread ? _thread->enable_wx(new_mode) : WXWrite) - { } - ~ThreadWXEnable() { - if (_thread) { - _thread->enable_wx(_old_mode); + ThreadWXEnable(WXMode* new_mode, Thread* thread) : + _thread(thread), _this_wx_mode(new_mode) { + NOT_PRODUCT(PerfTraceTime ptt(ClassLoader::perf_change_wx_time());) + JavaThread* javaThread + = _thread && _thread->is_Java_thread() + ? JavaThread::cast(_thread) : nullptr; + _prev = javaThread != nullptr ? javaThread->_cur_wx_enable: nullptr; + _old_mode = _thread != nullptr ? _thread->enable_wx(*new_mode) : WXWrite; + if (javaThread != nullptr) { + javaThread->_cur_wx_enable = this; + javaThread->_cur_wx_mode = new_mode; } } + ThreadWXEnable(WXMode new_mode, Thread* thread) : + _thread(thread), _this_wx_mode(nullptr) { + NOT_PRODUCT(PerfTraceTime ptt(ClassLoader::perf_change_wx_time());) + JavaThread* javaThread + = _thread && _thread->is_Java_thread() + ? JavaThread::cast(_thread) : nullptr; + _prev = javaThread != nullptr ? javaThread->_cur_wx_enable: nullptr; + _old_mode = _thread != nullptr ? _thread->enable_wx(new_mode) : WXWrite; + if (javaThread) { + javaThread->_cur_wx_enable = this; + javaThread->_cur_wx_mode = nullptr; + } + } + + ~ThreadWXEnable() { + NOT_PRODUCT(PerfTraceTime ptt(ClassLoader::perf_change_wx_time());) + if (_thread) { + _thread->enable_wx(_old_mode); + JavaThread* javaThread + = _thread && _thread->is_Java_thread() + ? JavaThread::cast(_thread) : nullptr; + if (javaThread != nullptr) { + javaThread->_cur_wx_enable = _prev; + javaThread->_cur_wx_mode = _prev != nullptr ? _prev->_this_wx_mode : nullptr; + } + } + } + + static bool test(address p); }; -#endif // __APPLE__ && AARCH64 +#endif // MACOS_AARCH64 #endif // SHARE_RUNTIME_THREADWXSETTERS_INLINE_HPP diff --git a/src/hotspot/share/utilities/forbiddenFunctions.hpp b/src/hotspot/share/utilities/forbiddenFunctions.hpp index 9d1b88e6233..9b3c65b0656 100644 --- a/src/hotspot/share/utilities/forbiddenFunctions.hpp +++ b/src/hotspot/share/utilities/forbiddenFunctions.hpp @@ -63,4 +63,8 @@ PRAGMA_DIAG_POP FORBID_IMPORTED_C_FUNCTION(char* strdup(const char *s), noexcept, "use os::strdup"); FORBID_IMPORTED_C_FUNCTION(wchar_t* wcsdup(const wchar_t *s), noexcept, "don't use"); +// Disallow non-wrapped raw library function. +MACOS_AARCH64_ONLY(FORBID_C_FUNCTION(void pthread_jit_write_protect_np(int enabled), noexcept, \ + "use os::current_thread_enable_wx");) + #endif // SHARE_UTILITIES_FORBIDDENFUNCTIONS_HPP diff --git a/src/hotspot/share/utilities/macros.hpp b/src/hotspot/share/utilities/macros.hpp index 8404fc757f0..a03255b5cf3 100644 --- a/src/hotspot/share/utilities/macros.hpp +++ b/src/hotspot/share/utilities/macros.hpp @@ -548,6 +548,9 @@ #endif #define MACOS_AARCH64_ONLY(x) MACOS_ONLY(AARCH64_ONLY(x)) +#if defined(__APPLE__) && defined(AARCH64) +#define MACOS_AARCH64 1 +#endif #if defined(RISCV32) || defined(RISCV64) #define RISCV diff --git a/src/hotspot/share/utilities/permitForbiddenFunctions.hpp b/src/hotspot/share/utilities/permitForbiddenFunctions.hpp index 71719ac8a76..5dec5062b0c 100644 --- a/src/hotspot/share/utilities/permitForbiddenFunctions.hpp +++ b/src/hotspot/share/utilities/permitForbiddenFunctions.hpp @@ -70,6 +70,10 @@ inline void* realloc(void* ptr, size_t size) { return ::realloc(ptr, size); } inline char* strdup(const char* s) { return ::strdup(s); } +MACOS_AARCH64_ONLY( \ + inline void pthread_jit_write_protect_np(int enabled) { return ::pthread_jit_write_protect_np(enabled); } \ +) + END_ALLOW_FORBIDDEN_FUNCTIONS } // namespace permit_forbidden_function diff --git a/test/hotspot/jtreg/runtime/os/TestWXHealing.java b/test/hotspot/jtreg/runtime/os/TestWXHealing.java new file mode 100644 index 00000000000..46875848a89 --- /dev/null +++ b/test/hotspot/jtreg/runtime/os/TestWXHealing.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2025 IBM Corporation. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @requires os.family == "mac" + * @requires os.arch == "aarch64" + * @summary Run shell with -XX:+StressWXHealing. This tests most of + * the triggers for WX mode. + * @library /test/lib + * @compile WXHealing.java + * @run main TestWXHealing + */ + +import java.util.regex.*; +import jdk.test.lib.process.*; + +import static java.nio.charset.StandardCharsets.*; + +public class TestWXHealing { + + public static void main(String[] args) throws Throwable { + String[] opts = {"-XX:+UnlockDiagnosticVMOptions", + "-XX:+TraceWXHealing", "-XX:+StressWXHealing", "WXHealing"}; + var process = ProcessTools.createTestJavaProcessBuilder(opts).start(); + String output = new String(process.getInputStream().readAllBytes(), UTF_8); + System.out.println(output); + if (output.contains("MAP_JIT write protection does not work on this system")) { + System.out.println("Test was not run because MAP_JIT write protection does not work on this system"); + } else { + var pattern = Pattern.compile("Healing WXMode WXArmedForWrite at 0x[0-9a-f]* to WXWrite "); + var matches = pattern.matcher(output).results().count(); + if (matches < 10) { + throw new RuntimeException("Only " + matches + " healings in\n" + output); + } + } + } +} diff --git a/test/hotspot/jtreg/runtime/os/WXHealing.java b/test/hotspot/jtreg/runtime/os/WXHealing.java new file mode 100644 index 00000000000..ba790db2c59 --- /dev/null +++ b/test/hotspot/jtreg/runtime/os/WXHealing.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2025 IBM Corporation. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.*; +import jdk.jshell.tool.*; + +public class WXHealing { + + // There's nothing special about jshell here: we just need an + // application that does a lot of compilation and class loading. + public static void main(String[] args) throws Throwable { + JavaShellToolBuilder + .builder() + .in(new ByteArrayInputStream + (""" + void main() { + System.out.println("Hello, World!"); + } + main() + 2+2 + Math.sqrt(2) + 4 * Math.atan(1) + Math.exp(1) + """ + .getBytes()), null) + .start(); + } +} From 9f13ec1ccb684398e311b5f139773ca9f39561fe Mon Sep 17 00:00:00 2001 From: Christian Hagedorn Date: Fri, 6 Feb 2026 14:15:09 +0000 Subject: [PATCH 008/120] 8377365: [BACKOUT] Mixed jstack cannot find function in vDSO Reviewed-by: thartmann --- .../linux/native/libsaproc/libproc_impl.h | 5 +- .../linux/native/libsaproc/ps_core.c | 55 +---------- .../sa/LingeredAppWithVDSOCall.java | 61 ------------ .../TestJhsdbJstackMixedWithVDSOCallCore.java | 96 ------------------- test/lib/jdk/test/lib/apps/LingeredApp.java | 16 +--- 5 files changed, 8 insertions(+), 225 deletions(-) delete mode 100644 test/hotspot/jtreg/serviceability/sa/LingeredAppWithVDSOCall.java delete mode 100644 test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixedWithVDSOCallCore.java diff --git a/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.h b/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.h index 262e99f4a64..42a6212510c 100644 --- a/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.h +++ b/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -95,9 +95,6 @@ struct core_data { // part of the class sharing workaround int classes_jsa_fd; // file descriptor of class share archive uintptr_t dynamic_addr; // address of dynamic section of a.out - uintptr_t vdso_addr; // address of vDSO - off64_t vdso_offset; // offset of vDSO in core - size_t vdso_size; // size of vDSO uintptr_t ld_base_addr; // base address of ld.so size_t num_maps; // number of maps. map_info* maps; // maps in a linked list diff --git a/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c b/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c index 61bd1e80005..899d42152d1 100644 --- a/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c +++ b/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * 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,9 +31,6 @@ #include #include #include -#include -#include -#include #include "libproc_impl.h" #include "ps_core_common.h" #include "proc_service.h" @@ -288,8 +285,6 @@ static bool core_handle_note(struct ps_prochandle* ph, ELF_PHDR* note_phdr) { // We will adjust it in read_exec_segments(). ph->core->dynamic_addr = auxv->a_un.a_val; break; - } else if (auxv->a_type == AT_SYSINFO_EHDR) { - ph->core->vdso_addr = auxv->a_un.a_val; } auxv++; } @@ -355,10 +350,6 @@ static bool read_core_segments(struct ps_prochandle* ph, ELF_EHDR* core_ehdr) { print_error("failed to add map info\n"); goto err; } - if (core_php->p_vaddr == ph->core->vdso_addr) { - ph->core->vdso_offset = core_php->p_offset; - ph->core->vdso_size = core_php->p_memsz; - } } break; } @@ -602,39 +593,6 @@ static uintptr_t calc_prelinked_load_address(struct ps_prochandle* ph, int lib_f return load_addr; } -// Check for vDSO binary in kernel directory (/lib/modules//vdso), -// rewrite the given lib_name string if found. -// Otherwise copy vDSO memory in coredump to temporal memory generated by -// memfd_create(). -// Returns FD for vDSO (should be closed by caller), or -1 on error. -static int handle_vdso(struct ps_prochandle* ph, char* lib_name, size_t lib_name_len) { - int lib_fd; - struct utsname uts; - uname(&uts); - - // Check vDSO binary first (for referring debuginfo if possible). - char *vdso_path = (char*)malloc(lib_name_len); - snprintf(vdso_path, lib_name_len, "/lib/modules/%s/vdso/vdso64.so", uts.release); - lib_fd = pathmap_open(vdso_path); - if (lib_fd != -1) { - print_debug("replace vDSO: %s -> %s\n", lib_name, vdso_path); - strncpy(lib_name, vdso_path, lib_name_len); - } else { - // Copy vDSO memory segment from core to temporal memory - // if vDSO binary is not available. - lib_fd = memfd_create("[vdso] in core", 0); - off64_t ofs = ph->core->vdso_offset; - if (sendfile64(lib_fd, ph->core->core_fd, &ofs, ph->core->vdso_size) == -1) { - print_debug("can't copy vDSO (%d)\n", errno); - close(lib_fd); - lib_fd = -1; - } - } - - free(vdso_path); - return lib_fd; -} - // read shared library info from runtime linker's data structures. // This work is done by librtlb_db in Solaris static bool read_shared_lib_info(struct ps_prochandle* ph) { @@ -729,14 +687,9 @@ static bool read_shared_lib_info(struct ps_prochandle* ph) { // it will fail later. } - if (lib_name[0] != '\0') { // ignore empty lib names - // We can use lib_base_diff to compare with vdso_addr - // because base address of vDSO should be 0. - if (lib_base_diff == ph->core->vdso_addr) { - lib_fd = handle_vdso(ph, lib_name, sizeof(lib_name)); - } else { - lib_fd = pathmap_open(lib_name); - } + if (lib_name[0] != '\0') { + // ignore empty lib names + lib_fd = pathmap_open(lib_name); if (lib_fd < 0) { print_debug("can't open shared object %s\n", lib_name); diff --git a/test/hotspot/jtreg/serviceability/sa/LingeredAppWithVDSOCall.java b/test/hotspot/jtreg/serviceability/sa/LingeredAppWithVDSOCall.java deleted file mode 100644 index d893ddf6f89..00000000000 --- a/test/hotspot/jtreg/serviceability/sa/LingeredAppWithVDSOCall.java +++ /dev/null @@ -1,61 +0,0 @@ - -/* - * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2026, NTT DATA - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import java.lang.invoke.MethodHandle; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.ValueLayout; - -import jdk.test.lib.Asserts; -import jdk.test.lib.apps.LingeredApp; - - -public class LingeredAppWithVDSOCall extends LingeredApp { - - private static final MethodHandle gettimeofday; - - static { - var desc = FunctionDescriptor.of(ValueLayout.JAVA_INT, // return - ValueLayout.JAVA_LONG, // tv - ValueLayout.JAVA_LONG); // tz - var linker = Linker.nativeLinker(); - var gettimeofdayPtr = linker.defaultLookup().findOrThrow("gettimeofday"); - gettimeofday = linker.downcallHandle(gettimeofdayPtr, desc); - } - - private static void crashAtGettimeofday(long tvAddr, long tzAddr) { - try { - gettimeofday.invoke(tvAddr, tzAddr); - } catch (Throwable t) { - throw new RuntimeException(t); - } - Asserts.fail("gettimeofday() didn't crash"); - } - - public static void main(String[] args) { - setCrasher(() -> crashAtGettimeofday(100L, 200L)); - LingeredApp.main(args); - } -} diff --git a/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixedWithVDSOCallCore.java b/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixedWithVDSOCallCore.java deleted file mode 100644 index 84da46e272f..00000000000 --- a/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixedWithVDSOCallCore.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2026, NTT DATA - * 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.nio.file.Path; - -import jtreg.SkippedException; - -import jdk.test.lib.JDKToolFinder; -import jdk.test.lib.JDKToolLauncher; -import jdk.test.lib.Platform; -import jdk.test.lib.SA.SATestUtils; -import jdk.test.lib.Utils; -import jdk.test.lib.apps.LingeredApp; -import jdk.test.lib.process.OutputAnalyzer; -import jdk.test.lib.util.CoreUtils; - -/** - * @test - * @bug 8376269 - * @requires (os.family == "linux") & (vm.hasSA) - * @requires os.arch == "amd64" - * @library /test/lib - * @run driver TestJhsdbJstackMixedWithVDSOCallCore - */ -public class TestJhsdbJstackMixedWithVDSOCallCore { - - private static void runJstackMixed(String coreFileName) throws Exception { - JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jhsdb"); - launcher.addVMArgs(Utils.getTestJavaOpts()); - launcher.addToolArg("jstack"); - launcher.addToolArg("--mixed"); - launcher.addToolArg("--exe"); - launcher.addToolArg(JDKToolFinder.getTestJDKTool("java")); - launcher.addToolArg("--core"); - launcher.addToolArg(coreFileName); - - ProcessBuilder pb = SATestUtils.createProcessBuilder(launcher); - Process jhsdb = pb.start(); - OutputAnalyzer out = new OutputAnalyzer(jhsdb); - - jhsdb.waitFor(); - - System.out.println(out.getStdout()); - System.err.println(out.getStderr()); - - out.shouldContain("vdso_gettimeofday"); - } - - private static void checkVDSODebugInfo() { - var kernelVersion = System.getProperty("os.version"); - var vdso = Path.of("/lib", "modules", kernelVersion, "vdso", "vdso64.so"); - if (SATestUtils.getDebugInfo(vdso.toString()) == null) { - // Skip this test if debuginfo of vDSO not found because internal - // function of gettimeofday() would not be exported, and vDSO - // binary might be stripped. - throw new SkippedException("vDSO debuginfo not found (" + vdso.toString() + ")"); - } - } - - public static void main(String... args) throws Throwable { - if (Platform.isMusl()) { - throw new SkippedException("This test does not work on musl libc."); - } - checkVDSODebugInfo(); - - var app = new LingeredAppWithVDSOCall(); - app.setForceCrash(true); - LingeredApp.startApp(app, CoreUtils.getAlwaysPretouchArg(true)); - app.waitAppTerminate(); - - String crashOutput = app.getOutput().getStdout(); - String coreFileName = CoreUtils.getCoreFileLocation(crashOutput, app.getPid()); - runJstackMixed(coreFileName); - } -} diff --git a/test/lib/jdk/test/lib/apps/LingeredApp.java b/test/lib/jdk/test/lib/apps/LingeredApp.java index 38ad9ae5b0e..13008e68c54 100644 --- a/test/lib/jdk/test/lib/apps/LingeredApp.java +++ b/test/lib/jdk/test/lib/apps/LingeredApp.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -122,12 +122,6 @@ public class LingeredApp { this.forceCrash = forceCrash; } - private static Runnable crasher; - - public static void setCrasher(Runnable runnable) { - crasher = runnable; - } - native private static int crash(); /** @@ -634,12 +628,8 @@ public class LingeredApp { synchronized(steadyStateObj) { startSteadyStateThread(steadyStateObj); if (forceCrash) { - if (crasher == null) { - System.loadLibrary("LingeredApp"); // location of native crash() method - crash(); - } else { - crasher.run(); - } + System.loadLibrary("LingeredApp"); // location of native crash() method + crash(); } while (Files.exists(path)) { // Touch the lock to indicate our readiness From cd5256d5a654d436e5ef926f6afb1bcbfc7a8bd1 Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Fri, 6 Feb 2026 15:19:01 +0000 Subject: [PATCH 009/120] 8374170: I/O Poller updates Reviewed-by: michaelm --- .../sun/nio/ch/DefaultPollerProvider.java | 17 +- .../aix/classes/sun/nio/ch/PollsetPoller.java | 12 +- .../sun/nio/ch/DefaultPollerProvider.java | 34 +- .../linux/classes/sun/nio/ch/EPollPoller.java | 94 ++- .../sun/nio/ch/DefaultPollerProvider.java | 14 +- .../classes/sun/nio/ch/KQueuePoller.java | 98 ++- .../share/classes/java/lang/System.java | 10 +- .../share/classes/java/lang/Thread.java | 11 + .../jdk/internal/access/JavaLangAccess.java | 10 + .../sun/nio/ch/DatagramChannelImpl.java | 16 +- .../share/classes/sun/nio/ch/IOUtil.java | 8 +- .../classes/sun/nio/ch/NativeDispatcher.java | 21 +- .../classes/sun/nio/ch/NativeThreadSet.java | 31 +- .../classes/sun/nio/ch/NioSocketImpl.java | 30 +- .../share/classes/sun/nio/ch/Poller.java | 783 ++++++++++++------ .../classes/sun/nio/ch/PollerProvider.java | 41 +- .../sun/nio/ch/ServerSocketChannelImpl.java | 12 +- .../classes/sun/nio/ch/SocketChannelImpl.java | 38 +- .../unix/classes/sun/nio/ch/NativeThread.java | 58 +- .../classes/sun/nio/ch/SinkChannelImpl.java | 12 +- .../classes/sun/nio/ch/SourceChannelImpl.java | 15 +- .../classes/sun/nio/ch/UnixDispatcher.java | 10 +- src/java.base/unix/native/libnio/ch/IOUtil.c | 7 +- .../sun/nio/ch/DefaultPollerProvider.java | 22 +- .../classes/sun/nio/ch/NativeThread.java | 54 +- .../classes/sun/nio/ch/WEPollPoller.java | 26 +- .../windows/native/libnio/ch/IOUtil.c | 5 +- .../sun/nio/ch/sctp/SctpChannelImpl.java | 28 +- .../sun/nio/ch/sctp/SctpMultiChannelImpl.java | 20 +- .../nio/ch/sctp/SctpServerChannelImpl.java | 14 +- .../java/net/vthread/BlockingSocketOps.java | 1 + .../channels/vthread/BlockingChannelOps.java | 1 + .../nio/channels/vthread/SelectorOps.java | 1 + 33 files changed, 1043 insertions(+), 511 deletions(-) diff --git a/src/java.base/aix/classes/sun/nio/ch/DefaultPollerProvider.java b/src/java.base/aix/classes/sun/nio/ch/DefaultPollerProvider.java index b645b735533..eb895d5a3a1 100644 --- a/src/java.base/aix/classes/sun/nio/ch/DefaultPollerProvider.java +++ b/src/java.base/aix/classes/sun/nio/ch/DefaultPollerProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * 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,15 +30,28 @@ import java.io.IOException; * Default PollerProvider for AIX. */ class DefaultPollerProvider extends PollerProvider { - DefaultPollerProvider() { } + DefaultPollerProvider(Poller.Mode mode) { + if (mode != Poller.Mode.SYSTEM_THREADS) { + throw new UnsupportedOperationException(); + } + super(mode); + } + + DefaultPollerProvider() { + this(Poller.Mode.SYSTEM_THREADS); + } @Override Poller readPoller(boolean subPoller) throws IOException { + if (subPoller) + throw new UnsupportedOperationException(); return new PollsetPoller(true); } @Override Poller writePoller(boolean subPoller) throws IOException { + if (subPoller) + throw new UnsupportedOperationException(); return new PollsetPoller(false); } } diff --git a/src/java.base/aix/classes/sun/nio/ch/PollsetPoller.java b/src/java.base/aix/classes/sun/nio/ch/PollsetPoller.java index 724f14495a8..3eee39906ee 100644 --- a/src/java.base/aix/classes/sun/nio/ch/PollsetPoller.java +++ b/src/java.base/aix/classes/sun/nio/ch/PollsetPoller.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2026, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2023, IBM Corp. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -52,13 +52,19 @@ class PollsetPoller extends Poller { this.pollBuffer = Pollset.allocatePollArray(MAX_EVENTS_TO_POLL); } + @Override + void close() { + Pollset.pollsetDestroy(setid); + Pollset.freePollArray(pollBuffer); + } + @Override int fdVal() { return setid; } @Override - void implRegister(int fd) throws IOException { + void implStartPoll(int fd) throws IOException { int ret = Pollset.pollsetCtl(setid, Pollset.PS_MOD, fd, Pollset.PS_POLLPRI | event); if (ret != 0) { throw new IOException("Unable to register fd " + fd); @@ -66,7 +72,7 @@ class PollsetPoller extends Poller { } @Override - void implDeregister(int fd, boolean polled) { + void implStopPoll(int fd, boolean polled) { int ret = Pollset.pollsetCtl(setid, Pollset.PS_DELETE, fd, 0); assert ret == 0; } diff --git a/src/java.base/linux/classes/sun/nio/ch/DefaultPollerProvider.java b/src/java.base/linux/classes/sun/nio/ch/DefaultPollerProvider.java index a9b169a4657..b53a90e4f7f 100644 --- a/src/java.base/linux/classes/sun/nio/ch/DefaultPollerProvider.java +++ b/src/java.base/linux/classes/sun/nio/ch/DefaultPollerProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * 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,34 +31,34 @@ import jdk.internal.vm.ContinuationSupport; * Default PollerProvider for Linux. */ class DefaultPollerProvider extends PollerProvider { - DefaultPollerProvider() { } + DefaultPollerProvider(Poller.Mode mode) { + super(mode); + } - @Override - Poller.Mode defaultPollerMode() { - if (ContinuationSupport.isSupported()) { - return Poller.Mode.VTHREAD_POLLERS; - } else { - return Poller.Mode.SYSTEM_THREADS; - } + DefaultPollerProvider() { + var mode = ContinuationSupport.isSupported() + ? Poller.Mode.VTHREAD_POLLERS + : Poller.Mode.SYSTEM_THREADS; + this(mode); } @Override - int defaultReadPollers(Poller.Mode mode) { + int defaultReadPollers() { int ncpus = Runtime.getRuntime().availableProcessors(); - if (mode == Poller.Mode.VTHREAD_POLLERS) { - return Math.min(Integer.highestOneBit(ncpus), 32); - } else { - return Math.max(Integer.highestOneBit(ncpus / 4), 1); - } + return switch (pollerMode()) { + case SYSTEM_THREADS -> Math.max(Integer.highestOneBit(ncpus / 4), 1); + case VTHREAD_POLLERS -> Math.min(Integer.highestOneBit(ncpus), 32); + default -> super.defaultReadPollers(); + }; } @Override Poller readPoller(boolean subPoller) throws IOException { - return new EPollPoller(subPoller, true); + return new EPollPoller(pollerMode(), subPoller, true); } @Override Poller writePoller(boolean subPoller) throws IOException { - return new EPollPoller(subPoller, false); + return new EPollPoller(pollerMode(), subPoller, false); } } diff --git a/src/java.base/linux/classes/sun/nio/ch/EPollPoller.java b/src/java.base/linux/classes/sun/nio/ch/EPollPoller.java index cdebff7c766..5c45393bd62 100644 --- a/src/java.base/linux/classes/sun/nio/ch/EPollPoller.java +++ b/src/java.base/linux/classes/sun/nio/ch/EPollPoller.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * 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,8 @@ package sun.nio.ch; import java.io.IOException; +import java.lang.ref.Cleaner.Cleanable; +import jdk.internal.ref.CleanerFactory; import static sun.nio.ch.EPoll.*; /** @@ -38,12 +40,70 @@ class EPollPoller extends Poller { private final int event; private final int maxEvents; private final long address; + private final EventFD eventfd; // wakeup event, used for shutdown - EPollPoller(boolean subPoller, boolean read) throws IOException { - this.epfd = EPoll.create(); + // close action, and cleaner if this is subpoller + private final Runnable closer; + private final Cleanable cleaner; + + EPollPoller(Poller.Mode mode, boolean subPoller, boolean read) throws IOException { + boolean wakeable = (mode == Mode.POLLER_PER_CARRIER) && subPoller; + int maxEvents = (subPoller) ? 16 : 64; + + int epfd = EPoll.create(); + long address = 0L; + EventFD eventfd = null; + try { + address = EPoll.allocatePollArray(maxEvents); + + // register one end of the pipe with epoll to allow for wakeup + if (wakeable) { + eventfd = new EventFD(); + IOUtil.configureBlocking(eventfd.efd(), false); + EPoll.ctl(epfd, EPOLL_CTL_ADD, eventfd.efd(), EPOLLIN); + } + } catch (Throwable e) { + FileDispatcherImpl.closeIntFD(epfd); + if (address != 0L) EPoll.freePollArray(address); + if (eventfd != null) eventfd.close(); + throw e; + } + + this.epfd = epfd; this.event = (read) ? EPOLLIN : EPOLLOUT; - this.maxEvents = (subPoller) ? 64 : 512; - this.address = EPoll.allocatePollArray(maxEvents); + this.maxEvents = maxEvents; + this.address = address; + this.eventfd = eventfd; + + // create action to close epoll instance, register cleaner when wakeable + this.closer = closer(epfd, address, eventfd); + if (wakeable) { + this.cleaner = CleanerFactory.cleaner().register(this, closer); + } else { + this.cleaner = null; + } + } + + /** + * Returns an action to close the epoll instance and release other resources. + */ + private static Runnable closer(int epfd, long address, EventFD eventfd) { + return () -> { + try { + FileDispatcherImpl.closeIntFD(epfd); + EPoll.freePollArray(address); + if (eventfd != null) eventfd.close(); + } catch (IOException _) { } + }; + } + + @Override + void close() { + if (cleaner != null) { + cleaner.clean(); + } else { + closer.run(); + } } @Override @@ -52,8 +112,8 @@ class EPollPoller extends Poller { } @Override - void implRegister(int fdVal) throws IOException { - // re-arm + void implStartPoll(int fdVal) throws IOException { + // re-enable if already registered but disabled (previously polled) int err = EPoll.ctl(epfd, EPOLL_CTL_MOD, fdVal, (event | EPOLLONESHOT)); if (err == ENOENT) err = EPoll.ctl(epfd, EPOLL_CTL_ADD, fdVal, (event | EPOLLONESHOT)); @@ -62,24 +122,36 @@ class EPollPoller extends Poller { } @Override - void implDeregister(int fdVal, boolean polled) { + void implStopPoll(int fdVal, boolean polled) { // event is disabled if already polled if (!polled) { EPoll.ctl(epfd, EPOLL_CTL_DEL, fdVal, 0); } } + @Override + void wakeupPoller() throws IOException { + if (eventfd == null) { + throw new UnsupportedOperationException(); + } + eventfd.set(); + } + @Override int poll(int timeout) throws IOException { int n = EPoll.wait(epfd, address, maxEvents, timeout); + int polled = 0; int i = 0; while (i < n) { long eventAddress = EPoll.getEvent(address, i); - int fdVal = EPoll.getDescriptor(eventAddress); - polled(fdVal); + int fd = EPoll.getDescriptor(eventAddress); + if (eventfd == null || fd != eventfd.efd()) { + polled(fd); + polled++; + } i++; } - return n; + return polled; } } diff --git a/src/java.base/macosx/classes/sun/nio/ch/DefaultPollerProvider.java b/src/java.base/macosx/classes/sun/nio/ch/DefaultPollerProvider.java index dc32c2cd90c..6349ae503e4 100644 --- a/src/java.base/macosx/classes/sun/nio/ch/DefaultPollerProvider.java +++ b/src/java.base/macosx/classes/sun/nio/ch/DefaultPollerProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * 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,15 +30,21 @@ import java.io.IOException; * Default PollerProvider for macOS. */ class DefaultPollerProvider extends PollerProvider { - DefaultPollerProvider() { } + DefaultPollerProvider(Poller.Mode mode) { + super(mode); + } + + DefaultPollerProvider() { + this(Poller.Mode.SYSTEM_THREADS); + } @Override Poller readPoller(boolean subPoller) throws IOException { - return new KQueuePoller(subPoller, true); + return new KQueuePoller(pollerMode(), subPoller, true); } @Override Poller writePoller(boolean subPoller) throws IOException { - return new KQueuePoller(subPoller, false); + return new KQueuePoller(pollerMode(), subPoller, false); } } diff --git a/src/java.base/macosx/classes/sun/nio/ch/KQueuePoller.java b/src/java.base/macosx/classes/sun/nio/ch/KQueuePoller.java index 6a1c771820e..69c191913a9 100644 --- a/src/java.base/macosx/classes/sun/nio/ch/KQueuePoller.java +++ b/src/java.base/macosx/classes/sun/nio/ch/KQueuePoller.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * 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,8 @@ package sun.nio.ch; import java.io.IOException; +import java.lang.ref.Cleaner.Cleanable; +import jdk.internal.ref.CleanerFactory; import static sun.nio.ch.KQueue.*; /** @@ -36,11 +38,77 @@ class KQueuePoller extends Poller { private final int maxEvents; private final long address; - KQueuePoller(boolean subPoller, boolean read) throws IOException { - this.kqfd = KQueue.create(); + // file descriptors used for wakeup during shutdown + private final int fd0; + private final int fd1; + + // close action, and cleaner if this is subpoller + private final Runnable closer; + private final Cleanable cleaner; + + KQueuePoller(Poller.Mode mode, boolean subPoller, boolean read) throws IOException { + boolean wakeable = (mode == Mode.POLLER_PER_CARRIER) && subPoller; + int maxEvents = (subPoller) ? 16 : 64; + + int kqfd = KQueue.create(); + long address = 0L; + int fd0 = -1; + int fd1 = -1; + try { + address = KQueue.allocatePollArray(maxEvents); + + // register one end of the pipe with kqueue to allow for wakeup + if (wakeable) { + long fds = IOUtil.makePipe(false); + fd0 = (int) (fds >>> 32); + fd1 = (int) fds; + KQueue.register(kqfd, fd0, EVFILT_READ, EV_ADD); + } + } catch (Throwable e) { + FileDispatcherImpl.closeIntFD(kqfd); + if (address != 0L) KQueue.freePollArray(address); + if (fd0 >= 0) FileDispatcherImpl.closeIntFD(fd0); + if (fd1 >= 0) FileDispatcherImpl.closeIntFD(fd1); + throw e; + } + + this.kqfd = kqfd; this.filter = (read) ? EVFILT_READ : EVFILT_WRITE; - this.maxEvents = (subPoller) ? 64 : 512; - this.address = KQueue.allocatePollArray(maxEvents); + this.maxEvents = maxEvents; + this.address = address; + this.fd0 = fd0; + this.fd1 = fd1; + + // create action to close kqueue, register cleaner when wakeable + this.closer = closer(kqfd, address, fd0, fd1); + if (wakeable) { + this.cleaner = CleanerFactory.cleaner().register(this, closer); + } else { + this.cleaner = null; + } + } + + /** + * Returns an action to close the kqueue and release other resources. + */ + private static Runnable closer(int kqfd, long address, int fd0, int fd1) { + return () -> { + try { + FileDispatcherImpl.closeIntFD(kqfd); + KQueue.freePollArray(address); + if (fd0 >= 0) FileDispatcherImpl.closeIntFD(fd0); + if (fd1 >= 0) FileDispatcherImpl.closeIntFD(fd1); + } catch (IOException _) { } + }; + } + + @Override + void close() { + if (cleaner != null) { + cleaner.clean(); + } else { + closer.run(); + } } @Override @@ -49,30 +117,42 @@ class KQueuePoller extends Poller { } @Override - void implRegister(int fdVal) throws IOException { + void implStartPoll(int fdVal) throws IOException { int err = KQueue.register(kqfd, fdVal, filter, (EV_ADD|EV_ONESHOT)); if (err != 0) throw new IOException("kevent failed: " + err); } @Override - void implDeregister(int fdVal, boolean polled) { + void implStopPoll(int fdVal, boolean polled) { // event was deleted if already polled if (!polled) { KQueue.register(kqfd, fdVal, filter, EV_DELETE); } } + @Override + void wakeupPoller() throws IOException { + if (fd1 < 0) { + throw new UnsupportedOperationException(); + } + IOUtil.write1(fd1, (byte)0); + } + @Override int poll(int timeout) throws IOException { int n = KQueue.poll(kqfd, address, maxEvents, timeout); + int polled = 0; int i = 0; while (i < n) { long keventAddress = KQueue.getEvent(address, i); int fdVal = KQueue.getDescriptor(keventAddress); - polled(fdVal); + if (fdVal != fd0) { + polled(fdVal); + polled++; + } i++; } - return n; + return polled; } } diff --git a/src/java.base/share/classes/java/lang/System.java b/src/java.base/share/classes/java/lang/System.java index bd684fab629..2f772e4d065 100644 --- a/src/java.base/share/classes/java/lang/System.java +++ b/src/java.base/share/classes/java/lang/System.java @@ -2277,6 +2277,14 @@ public final class System { return Thread.scopedValueBindings(); } + public long nativeThreadID(Thread thread) { + return thread.nativeThreadID(); + } + + public void setThreadNativeID(long id) { + Thread.currentThread().setNativeThreadID(id); + } + public Continuation getContinuation(Thread thread) { return thread.getContinuation(); } @@ -2311,7 +2319,7 @@ public final class System { if (thread instanceof BaseVirtualThread vthread) { vthread.unpark(); } else { - throw new WrongThreadException(); + throw new IllegalArgumentException(); } } diff --git a/src/java.base/share/classes/java/lang/Thread.java b/src/java.base/share/classes/java/lang/Thread.java index bb1292b374a..57d28aca5f4 100644 --- a/src/java.base/share/classes/java/lang/Thread.java +++ b/src/java.base/share/classes/java/lang/Thread.java @@ -286,6 +286,9 @@ public class Thread implements Runnable { volatile boolean daemon; volatile int threadStatus; + // Used by NativeThread for signalling + @Stable long nativeThreadID; + // This map is maintained by the ThreadLocal class ThreadLocal.ThreadLocalMap terminatingThreadLocals; @@ -312,6 +315,14 @@ public class Thread implements Runnable { holder.terminatingThreadLocals = map; } + long nativeThreadID() { + return holder.nativeThreadID; + } + + void setNativeThreadID(long id) { + holder.nativeThreadID = id; + } + /* * ThreadLocal values pertaining to this thread. This map is maintained * by the ThreadLocal class. diff --git a/src/java.base/share/classes/jdk/internal/access/JavaLangAccess.java b/src/java.base/share/classes/jdk/internal/access/JavaLangAccess.java index 4ae1905aa10..9d980c3ba3b 100644 --- a/src/java.base/share/classes/jdk/internal/access/JavaLangAccess.java +++ b/src/java.base/share/classes/jdk/internal/access/JavaLangAccess.java @@ -581,6 +581,16 @@ public interface JavaLangAccess { */ Object scopedValueBindings(); + /** + * Returns the native thread ID for the given platform thread or 0 if not set. + */ + long nativeThreadID(Thread thread); + + /** + * Sets the native thread ID for the current platform thread. + */ + void setThreadNativeID(long id); + /** * Returns the innermost mounted continuation */ diff --git a/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java b/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java index afb312ed722..f5002e8b716 100644 --- a/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java +++ b/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java @@ -134,9 +134,9 @@ class DatagramChannelImpl private static final int ST_CLOSED = 3; private int state; - // IDs of native threads doing reads and writes, for signalling - private long readerThread; - private long writerThread; + // Threads doing reads and writes, for signalling + private Thread readerThread; + private Thread writerThread; // Local and remote (connected) address private InetSocketAddress localAddress; @@ -523,7 +523,7 @@ class DatagramChannelImpl if (localAddress == null) bindInternal(null); if (blocking) - readerThread = NativeThread.current(); + readerThread = NativeThread.threadToSignal(); } return remote; } @@ -538,7 +538,7 @@ class DatagramChannelImpl { if (blocking) { synchronized (stateLock) { - readerThread = 0; + readerThread = null; if (state == ST_CLOSING) { tryFinishClose(); } @@ -1030,7 +1030,7 @@ class DatagramChannelImpl if (localAddress == null) bindInternal(null); if (blocking) - writerThread = NativeThread.current(); + writerThread = NativeThread.threadToSignal(); } return remote; } @@ -1045,7 +1045,7 @@ class DatagramChannelImpl { if (blocking) { synchronized (stateLock) { - writerThread = 0; + writerThread = null; if (state == ST_CLOSING) { tryFinishClose(); } @@ -1714,7 +1714,7 @@ class DatagramChannelImpl */ private boolean tryClose() throws IOException { assert Thread.holdsLock(stateLock) && state == ST_CLOSING; - if ((readerThread == 0) && (writerThread == 0) && !isRegistered()) { + if ((readerThread == null) && (writerThread == null) && !isRegistered()) { state = ST_CLOSED; try { // close socket diff --git a/src/java.base/share/classes/sun/nio/ch/IOUtil.java b/src/java.base/share/classes/sun/nio/ch/IOUtil.java index 45f8cb2e588..df6677ab94d 100644 --- a/src/java.base/share/classes/sun/nio/ch/IOUtil.java +++ b/src/java.base/share/classes/sun/nio/ch/IOUtil.java @@ -587,9 +587,11 @@ public final class IOUtil { */ static native int drain1(int fd) throws IOException; - public static native void configureBlocking(FileDescriptor fd, - boolean blocking) - throws IOException; + static native void configureBlocking(int fd, boolean blocking) throws IOException; + + public static void configureBlocking(FileDescriptor fd, boolean blocking) throws IOException { + configureBlocking(fdVal(fd), blocking); + } public static native int fdVal(FileDescriptor fd); diff --git a/src/java.base/share/classes/sun/nio/ch/NativeDispatcher.java b/src/java.base/share/classes/sun/nio/ch/NativeDispatcher.java index 9b65310784a..63009b407ac 100644 --- a/src/java.base/share/classes/sun/nio/ch/NativeDispatcher.java +++ b/src/java.base/share/classes/sun/nio/ch/NativeDispatcher.java @@ -27,8 +27,6 @@ package sun.nio.ch; import java.io.FileDescriptor; import java.io.IOException; -import jdk.internal.access.JavaIOFileDescriptorAccess; -import jdk.internal.access.SharedSecrets; /** * Allows different platforms to call different native methods @@ -36,7 +34,6 @@ import jdk.internal.access.SharedSecrets; */ abstract class NativeDispatcher { - private static final JavaIOFileDescriptorAccess JIOFDA = SharedSecrets.getJavaIOFileDescriptorAccess(); abstract int read(FileDescriptor fd, long address, int len) throws IOException; @@ -78,12 +75,17 @@ abstract class NativeDispatcher { * if a platform thread is blocked on the file descriptor then the file descriptor is * dup'ed to a special fd and the thread signalled so that the syscall fails with EINTR. */ - final void preClose(FileDescriptor fd, long reader, long writer) throws IOException { - if (NativeThread.isVirtualThread(reader) || NativeThread.isVirtualThread(writer)) { - int fdVal = JIOFDA.get(fd); - Poller.stopPoll(fdVal); + final void preClose(FileDescriptor fd, Thread reader, Thread writer) throws IOException { + if (reader != null && reader.isVirtual()) { + NativeThread.signal(reader); // unparks virtual thread + reader = null; } - if (NativeThread.isNativeThread(reader) || NativeThread.isNativeThread(writer)) { + if (writer != null && writer.isVirtual()) { + NativeThread.signal(writer); // unparks virtual thread + writer = null; + } + // dup2 and signal platform threads + if (reader != null || writer != null) { implPreClose(fd, reader, writer); } } @@ -92,8 +94,7 @@ abstract class NativeDispatcher { * This method does nothing by default. On Unix systems the file descriptor is dup'ed * to a special fd and native threads signalled. */ - - void implPreClose(FileDescriptor fd, long reader, long writer) throws IOException { + void implPreClose(FileDescriptor fd, Thread reader, Thread writer) throws IOException { // Do nothing by default; this is only needed on Unix } diff --git a/src/java.base/share/classes/sun/nio/ch/NativeThreadSet.java b/src/java.base/share/classes/sun/nio/ch/NativeThreadSet.java index 079291572a8..c5423141789 100644 --- a/src/java.base/share/classes/sun/nio/ch/NativeThreadSet.java +++ b/src/java.base/share/classes/sun/nio/ch/NativeThreadSet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. * 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,9 +31,9 @@ class NativeThreadSet { private static final int OTHER_THREAD_INDEX = -99; private final int initialCapacity; - private long[] threads; // array of thread handles, created lazily - private int used; // number of thread handles in threads array - private int otherThreads; // count of threads without a native thread handle + private Thread[] threads; // array of platform threads, created lazily + private int used; // number of elements in threads array + private int otherThreads; // additional threads that can't be signalled private boolean waitingToEmpty; NativeThreadSet(int n) { @@ -45,28 +45,28 @@ class NativeThreadSet { * it can efficiently be removed later. */ int add() { - long th = NativeThread.current(); synchronized (this) { - if (!NativeThread.isNativeThread(th)) { + final Thread t = NativeThread.threadToSignal(); + if (t == null || t.isVirtual()) { otherThreads++; return OTHER_THREAD_INDEX; } - // add native thread handle to array, creating or growing array if needed + // add platform threads to array, creating or growing array if needed int start = 0; if (threads == null) { - threads = new long[initialCapacity]; + threads = new Thread[initialCapacity]; } else if (used >= threads.length) { int on = threads.length; int nn = on * 2; - long[] nthreads = new long[nn]; + Thread[] nthreads = new Thread[nn]; System.arraycopy(threads, 0, nthreads, 0, on); threads = nthreads; start = on; } for (int i = start; i < threads.length; i++) { - if (threads[i] == 0) { - threads[i] = th; + if (threads[i] == null) { + threads[i] = t; used++; return i; } @@ -81,8 +81,7 @@ class NativeThreadSet { void remove(int i) { synchronized (this) { if (i >= 0) { - assert threads[i] == NativeThread.current(); - threads[i] = 0; + threads[i] = null; used--; } else if (i == OTHER_THREAD_INDEX) { otherThreads--; @@ -104,9 +103,9 @@ class NativeThreadSet { while (used > 0 || otherThreads > 0) { int u = used, i = 0; while (u > 0 && i < threads.length) { - long th = threads[i]; - if (th != 0) { - NativeThread.signal(th); + Thread t = threads[i]; + if (t != null) { + NativeThread.signal(t); u--; } i++; diff --git a/src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java b/src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java index 01f894be227..58b3bc7aaba 100644 --- a/src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java +++ b/src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java @@ -103,8 +103,8 @@ public final class NioSocketImpl extends SocketImpl implements PlatformSocketImp private volatile boolean nonBlocking; // used by connect/read/write/accept, protected by stateLock - private long readerThread; - private long writerThread; + private Thread readerThread; + private Thread writerThread; // used when SO_REUSEADDR is emulated, protected by stateLock private boolean isReuseAddress; @@ -218,7 +218,7 @@ public final class NioSocketImpl extends SocketImpl implements PlatformSocketImp private FileDescriptor beginRead() throws SocketException { synchronized (stateLock) { ensureOpenAndConnected(); - readerThread = NativeThread.current(); + readerThread = NativeThread.threadToSignal(); return fd; } } @@ -229,7 +229,7 @@ public final class NioSocketImpl extends SocketImpl implements PlatformSocketImp */ private void endRead(boolean completed) throws SocketException { synchronized (stateLock) { - readerThread = 0; + readerThread = null; int state = this.state; if (state == ST_CLOSING) tryFinishClose(); @@ -370,7 +370,7 @@ public final class NioSocketImpl extends SocketImpl implements PlatformSocketImp private FileDescriptor beginWrite() throws SocketException { synchronized (stateLock) { ensureOpenAndConnected(); - writerThread = NativeThread.current(); + writerThread = NativeThread.threadToSignal(); return fd; } } @@ -381,7 +381,7 @@ public final class NioSocketImpl extends SocketImpl implements PlatformSocketImp */ private void endWrite(boolean completed) throws SocketException { synchronized (stateLock) { - writerThread = 0; + writerThread = null; int state = this.state; if (state == ST_CLOSING) tryFinishClose(); @@ -511,7 +511,7 @@ public final class NioSocketImpl extends SocketImpl implements PlatformSocketImp this.address = address; this.port = port; - readerThread = NativeThread.current(); + readerThread = NativeThread.threadToSignal(); return fd; } } @@ -522,7 +522,7 @@ public final class NioSocketImpl extends SocketImpl implements PlatformSocketImp */ private void endConnect(FileDescriptor fd, boolean completed) throws IOException { synchronized (stateLock) { - readerThread = 0; + readerThread = null; int state = this.state; if (state == ST_CLOSING) tryFinishClose(); @@ -666,7 +666,7 @@ public final class NioSocketImpl extends SocketImpl implements PlatformSocketImp ensureOpen(); if (localport == 0) throw new SocketException("Not bound"); - readerThread = NativeThread.current(); + readerThread = NativeThread.threadToSignal(); return fd; } } @@ -678,7 +678,7 @@ public final class NioSocketImpl extends SocketImpl implements PlatformSocketImp private void endAccept(boolean completed) throws SocketException { synchronized (stateLock) { int state = this.state; - readerThread = 0; + readerThread = null; if (state == ST_CLOSING) tryFinishClose(); if (!completed && state >= ST_CLOSING) @@ -844,7 +844,7 @@ public final class NioSocketImpl extends SocketImpl implements PlatformSocketImp */ private boolean tryClose() throws IOException { assert Thread.holdsLock(stateLock) && state == ST_CLOSING; - if (readerThread == 0 && writerThread == 0) { + if (readerThread == null && writerThread == null) { try { cleaner.clean(); } catch (UncheckedIOException ioe) { @@ -1143,8 +1143,8 @@ public final class NioSocketImpl extends SocketImpl implements PlatformSocketImp ensureOpenAndConnected(); if (!isInputClosed) { Net.shutdown(fd, Net.SHUT_RD); - if (NativeThread.isVirtualThread(readerThread)) { - Poller.stopPoll(fdVal(fd), Net.POLLIN); + if (readerThread != null && readerThread.isVirtual()) { + Poller.stopPoll(readerThread); } isInputClosed = true; } @@ -1157,8 +1157,8 @@ public final class NioSocketImpl extends SocketImpl implements PlatformSocketImp ensureOpenAndConnected(); if (!isOutputClosed) { Net.shutdown(fd, Net.SHUT_WR); - if (NativeThread.isVirtualThread(writerThread)) { - Poller.stopPoll(fdVal(fd), Net.POLLOUT); + if (writerThread != null && writerThread.isVirtual()) { + Poller.stopPoll(writerThread); } isOutputClosed = true; } diff --git a/src/java.base/share/classes/sun/nio/ch/Poller.java b/src/java.base/share/classes/sun/nio/ch/Poller.java index 4a2cb4d8fdf..9360bcc8327 100644 --- a/src/java.base/share/classes/sun/nio/ch/Poller.java +++ b/src/java.base/share/classes/sun/nio/ch/Poller.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * 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,61 +25,107 @@ package sun.nio.ch; import java.io.IOException; +import java.io.UncheckedIOException; +import java.lang.ref.Reference; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.concurrent.ThreadFactory; import java.util.concurrent.locks.LockSupport; import java.util.function.BooleanSupplier; +import jdk.internal.access.JavaLangAccess; +import jdk.internal.access.SharedSecrets; import jdk.internal.misc.InnocuousThread; +import jdk.internal.misc.TerminatingThreadLocal; +import jdk.internal.vm.Continuation; +import jdk.internal.vm.ContinuationSupport; import jdk.internal.vm.annotation.Stable; /** - * Polls file descriptors. Virtual threads invoke the poll method to park - * until a given file descriptor is ready for I/O. + * I/O poller to allow virtual threads park until a file descriptor is ready for I/O. */ public abstract class Poller { - private static final Pollers POLLERS; - static { - try { - var pollers = new Pollers(); - pollers.start(); - POLLERS = pollers; - } catch (IOException ioe) { - throw new ExceptionInInitializerError(ioe); - } - } + private static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess(); - // the poller or sub-poller thread + // the poller group for the I/O pollers and poller threads + private static final PollerGroup POLLER_GROUP = createPollerGroup(); + + // the poller or sub-poller thread (used for observability only) private @Stable Thread owner; // maps file descriptors to parked Thread private final Map map = new ConcurrentHashMap<>(); + // shutdown (if supported by poller group) + private volatile boolean shutdown; + /** * Poller mode. */ enum Mode { /** - * ReadPoller and WritePoller are dedicated platform threads that block waiting - * for events and unpark virtual threads when file descriptors are ready for I/O. + * Read and write pollers are platform threads that block waiting for events and + * unpark virtual threads when file descriptors are ready for I/O. */ SYSTEM_THREADS, /** - * ReadPoller and WritePoller threads are virtual threads that poll for events, - * yielding between polls and unparking virtual threads when file descriptors are + * Read and write pollers are virtual threads that poll for events, yielding + * between polls and unparking virtual threads when file descriptors are * ready for I/O. If there are no events then the poller threads park until there * are I/O events to poll. This mode helps to integrate polling with virtual * thread scheduling. The approach is similar to the default scheme in "User-level * Threading: Have Your Cake and Eat It Too" by Karsten and Barghi 2020 * (https://dl.acm.org/doi/10.1145/3379483). */ - VTHREAD_POLLERS + VTHREAD_POLLERS, + + /** + * Read pollers are per-carrier virtual threads that poll for events, yielding + * between polls and unparking virtual threads when file descriptors are ready + * for I/O. If there are no events then the poller threads park until there + * are I/O events to poll. The write poller is a system-wide platform thread. + */ + POLLER_PER_CARRIER + } + + /** + * Create and return the PollerGroup. + */ + private static PollerGroup createPollerGroup() { + try { + PollerProvider provider; + if (System.getProperty("jdk.pollerMode") instanceof String s) { + Mode mode = switch (s) { + case "1" -> Mode.SYSTEM_THREADS; + case "2" -> Mode.VTHREAD_POLLERS; + case "3" -> Mode.POLLER_PER_CARRIER; + default -> { + throw new RuntimeException(s + " is not a valid polling mode"); + } + }; + provider = PollerProvider.createProvider(mode); + } else { + provider = PollerProvider.createProvider(); + } + + int readPollers = pollerCount("jdk.readPollers", provider.defaultReadPollers()); + int writePollers = pollerCount("jdk.writePollers", provider.defaultWritePollers()); + PollerGroup group = switch (provider.pollerMode()) { + case SYSTEM_THREADS -> new SystemThreadsPollerGroup(provider, readPollers, writePollers); + case VTHREAD_POLLERS -> new VThreadsPollerGroup(provider, readPollers, writePollers); + case POLLER_PER_CARRIER -> new PollerPerCarrierPollerGroup(provider, writePollers); + }; + group.start(); + return group; + } catch (IOException ioe) { + throw new UncheckedIOException(ioe); + } } /** @@ -89,9 +135,34 @@ public abstract class Poller { } /** - * Returns the poller's file descriptor, used when the read and write poller threads - * are virtual threads. - * + * Closes the poller and release resources. This method can only be used to cleanup + * when creating a poller group fails. + */ + abstract void close() throws IOException; + + /** + * Sets the poller's thread owner. + */ + private void setOwner() { + owner = Thread.currentThread(); + } + + /** + * Returns true if this poller is marked for shutdown. + */ + boolean isShutdown() { + return shutdown; + } + + /** + * Marks this poller for shutdown. + */ + private void setShutdown() { + shutdown = true; + } + + /** + * Returns the poller's file descriptor to use when polling with the master poller. * @throws UnsupportedOperationException if not supported */ int fdVal() { @@ -99,16 +170,18 @@ public abstract class Poller { } /** - * Register the file descriptor. The registration is "one shot", meaning it should - * be polled at most once. + * Register the file descriptor with the I/O event management facility so that it is + * polled when the file descriptor is ready for I/O. The registration is "one shot", + * meaning it should be polled at most once. */ - abstract void implRegister(int fdVal) throws IOException; + abstract void implStartPoll(int fdVal) throws IOException; /** - * Deregister the file descriptor. + * Deregister a file descriptor from the I/O event management facility. This may be + * a no-op in some implementations when the file descriptor has already been polled. * @param polled true if the file descriptor has already been polled */ - abstract void implDeregister(int fdVal, boolean polled); + abstract void implStopPoll(int fdVal, boolean polled) throws IOException; /** * Poll for events. The {@link #polled(int)} method is invoked for each @@ -116,15 +189,26 @@ public abstract class Poller { * * @param timeout if positive then block for up to {@code timeout} milliseconds, * if zero then don't block, if -1 then block indefinitely - * @return the number of file descriptors polled + * @return >0 if file descriptors are polled, 0 if no file descriptor polled */ abstract int poll(int timeout) throws IOException; + /** + * Wakeup the poller thread if blocked in poll so it can shutdown. + * @throws UnsupportedOperationException if not supported + */ + void wakeupPoller() throws IOException { + throw new UnsupportedOperationException(); + } + /** * Callback by the poll method when a file descriptor is polled. */ final void polled(int fdVal) { - wakeup(fdVal); + Thread t = map.remove(fdVal); + if (t != null) { + LockSupport.unpark(t); + } } /** @@ -132,19 +216,10 @@ public abstract class Poller { * @param fdVal the file descriptor * @param event POLLIN or POLLOUT * @param nanos the waiting time or 0 to wait indefinitely - * @param supplier supplies a boolean to indicate if the enclosing object is open + * @param isOpen supplies a boolean to indicate if the enclosing object is open */ - static void poll(int fdVal, int event, long nanos, BooleanSupplier supplier) - throws IOException - { - assert nanos >= 0L; - if (event == Net.POLLIN) { - POLLERS.readPoller(fdVal).poll(fdVal, nanos, supplier); - } else if (event == Net.POLLOUT) { - POLLERS.writePoller(fdVal).poll(fdVal, nanos, supplier); - } else { - assert false; - } + public static void poll(int fdVal, int event, long nanos, BooleanSupplier isOpen) throws IOException { + POLLER_GROUP.poll(fdVal, event, nanos, isOpen); } /** @@ -152,45 +227,24 @@ public abstract class Poller { * @param fdVal the Selector's file descriptor * @param nanos the waiting time or 0 to wait indefinitely */ - static void pollSelector(int fdVal, long nanos) throws IOException { - assert nanos >= 0L; - Poller poller = POLLERS.masterPoller(); - if (poller == null) { - poller = POLLERS.readPoller(fdVal); - } - poller.poll(fdVal, nanos, () -> true); + public static void pollSelector(int fdVal, long nanos) throws IOException { + POLLER_GROUP.pollSelector(fdVal, nanos); } /** - * If there is a thread polling the given file descriptor for the given event then - * the thread is unparked. + * Unpark the given thread so that it stops polling. */ - static void stopPoll(int fdVal, int event) { - if (event == Net.POLLIN) { - POLLERS.readPoller(fdVal).wakeup(fdVal); - } else if (event == Net.POLLOUT) { - POLLERS.writePoller(fdVal).wakeup(fdVal); - } else { - throw new IllegalArgumentException(); - } - } - - /** - * If there are any threads polling the given file descriptor then they are unparked. - */ - static void stopPoll(int fdVal) { - stopPoll(fdVal, Net.POLLIN); - stopPoll(fdVal, Net.POLLOUT); + public static void stopPoll(Thread thread) { + LockSupport.unpark(thread); } /** * Parks the current thread until a file descriptor is ready. */ - private void poll(int fdVal, long nanos, BooleanSupplier supplier) throws IOException { - register(fdVal); + private void poll(int fdVal, long nanos, BooleanSupplier isOpen) throws IOException { + startPoll(fdVal); try { - boolean isOpen = supplier.getAsBoolean(); - if (isOpen) { + if (isOpen.getAsBoolean() && !isShutdown()) { if (nanos > 0) { LockSupport.parkNanos(nanos); } else { @@ -198,42 +252,38 @@ public abstract class Poller { } } } finally { - deregister(fdVal); + stopPoll(fdVal); } } /** - * Registers the file descriptor to be polled at most once when the file descriptor - * is ready for I/O. + * Register a file descriptor with the I/O event management facility so that it is + * polled when the file descriptor is ready for I/O. */ - private void register(int fdVal) throws IOException { + private void startPoll(int fdVal) throws IOException { Thread previous = map.put(fdVal, Thread.currentThread()); assert previous == null; try { - implRegister(fdVal); + implStartPoll(fdVal); } catch (Throwable t) { map.remove(fdVal); throw t; + } finally { + Reference.reachabilityFence(this); } } /** - * Deregister the file descriptor so that the file descriptor is not polled. + * Deregister a file descriptor from the I/O event management facility. */ - private void deregister(int fdVal) { + private void stopPoll(int fdVal) throws IOException { Thread previous = map.remove(fdVal); boolean polled = (previous == null); assert polled || previous == Thread.currentThread(); - implDeregister(fdVal, polled); - } - - /** - * Unparks any thread that is polling the given file descriptor. - */ - private void wakeup(int fdVal) { - Thread t = map.remove(fdVal); - if (t != null) { - LockSupport.unpark(t); + try { + implStopPoll(fdVal, polled); + } finally { + Reference.reachabilityFence(this); } } @@ -242,9 +292,9 @@ public abstract class Poller { * descriptor that is polled. */ private void pollerLoop() { - owner = Thread.currentThread(); + setOwner(); try { - for (;;) { + while (!isShutdown()) { poll(-1); } } catch (Exception e) { @@ -263,10 +313,10 @@ public abstract class Poller { */ private void subPollerLoop(Poller masterPoller) { assert Thread.currentThread().isVirtual(); - owner = Thread.currentThread(); + setOwner(); try { int polled = 0; - for (;;) { + while (!isShutdown()) { if (polled == 0) { masterPoller.poll(fdVal(), 0, () -> true); // park } else { @@ -280,194 +330,463 @@ public abstract class Poller { } /** - * Returns the number I/O operations currently registered with this poller. + * Unparks all threads waiting on a file descriptor registered with this poller. */ - public int registered() { - return map.size(); + private void wakeupAll() { + map.values().forEach(LockSupport::unpark); } @Override public String toString() { return String.format("%s [registered = %d, owner = %s]", - Objects.toIdentityString(this), registered(), owner); + Objects.toIdentityString(this), map.size(), owner); } /** - * The Pollers used for read and write events. + * A group of poller threads that support virtual threads polling file descriptors. */ - private static class Pollers { + private static abstract class PollerGroup { private final PollerProvider provider; - private final Poller.Mode pollerMode; - private final Poller masterPoller; - private final Poller[] readPollers; - private final Poller[] writePollers; - - // used by start method to executor is kept alive - private Executor executor; - - /** - * Creates the Poller instances based on configuration. - */ - Pollers() throws IOException { - PollerProvider provider = PollerProvider.provider(); - Poller.Mode mode; - String s = System.getProperty("jdk.pollerMode"); - if (s != null) { - if (s.equalsIgnoreCase(Mode.SYSTEM_THREADS.name()) || s.equals("1")) { - mode = Mode.SYSTEM_THREADS; - } else if (s.equalsIgnoreCase(Mode.VTHREAD_POLLERS.name()) || s.equals("2")) { - mode = Mode.VTHREAD_POLLERS; - } else { - throw new RuntimeException("Can't parse '" + s + "' as polling mode"); - } - } else { - mode = provider.defaultPollerMode(); - } - - // vthread poller mode needs a master poller - Poller masterPoller = (mode == Mode.VTHREAD_POLLERS) - ? provider.readPoller(false) - : null; - - // read pollers (or sub-pollers) - int readPollerCount = pollerCount("jdk.readPollers", provider.defaultReadPollers(mode)); - Poller[] readPollers = new Poller[readPollerCount]; - for (int i = 0; i < readPollerCount; i++) { - readPollers[i] = provider.readPoller(mode == Mode.VTHREAD_POLLERS); - } - - // write pollers (or sub-pollers) - int writePollerCount = pollerCount("jdk.writePollers", provider.defaultWritePollers(mode)); - Poller[] writePollers = new Poller[writePollerCount]; - for (int i = 0; i < writePollerCount; i++) { - writePollers[i] = provider.writePoller(mode == Mode.VTHREAD_POLLERS); - } + PollerGroup(PollerProvider provider) { this.provider = provider; - this.pollerMode = mode; - this.masterPoller = masterPoller; - this.readPollers = readPollers; - this.writePollers = writePollers; + } + + final PollerProvider provider() { + return provider; } /** - * Starts the Poller threads. + * Starts the poller group and any system-wide poller threads. */ - void start() { - if (pollerMode == Mode.VTHREAD_POLLERS) { - startPlatformThread("MasterPoller", masterPoller::pollerLoop); - ThreadFactory factory = Thread.ofVirtual() - .inheritInheritableThreadLocals(false) - .name("SubPoller-", 0) - .uncaughtExceptionHandler((t, e) -> e.printStackTrace()) - .factory(); - executor = Executors.newThreadPerTaskExecutor(factory); - Arrays.stream(readPollers).forEach(p -> { - executor.execute(() -> p.subPollerLoop(masterPoller)); - }); - Arrays.stream(writePollers).forEach(p -> { - executor.execute(() -> p.subPollerLoop(masterPoller)); - }); - } else { - Arrays.stream(readPollers).forEach(p -> { - startPlatformThread("Read-Poller", p::pollerLoop); - }); - Arrays.stream(writePollers).forEach(p -> { - startPlatformThread("Write-Poller", p::pollerLoop); - }); - } - } + abstract void start(); /** - * Returns the master poller, or null if there is no master poller. + * Parks the current thread until a file descriptor is ready for the given op. */ - Poller masterPoller() { - return masterPoller; - } + abstract void poll(int fdVal, int event, long nanos, BooleanSupplier isOpen) throws IOException; /** - * Returns the read poller for the given file descriptor. + * Parks the current thread until a Selector's file descriptor is ready. */ - Poller readPoller(int fdVal) { - int index = provider.fdValToIndex(fdVal, readPollers.length); - return readPollers[index]; - } - - /** - * Returns the write poller for the given file descriptor. - */ - Poller writePoller(int fdVal) { - int index = provider.fdValToIndex(fdVal, writePollers.length); - return writePollers[index]; - } - - /** - * Return the list of read pollers. - */ - List readPollers() { - return List.of(readPollers); - } - - /** - * Return the list of write pollers. - */ - List writePollers() { - return List.of(writePollers); - } - - - /** - * Reads the given property name to get the poller count. If the property is - * set then the value must be a power of 2. Returns 1 if the property is not - * set. - * @throws IllegalArgumentException if the property is set to a value that - * is not a power of 2. - */ - private static int pollerCount(String propName, int defaultCount) { - String s = System.getProperty(propName); - int count = (s != null) ? Integer.parseInt(s) : defaultCount; - - // check power of 2 - if (count != Integer.highestOneBit(count)) { - String msg = propName + " is set to a value that is not a power of 2"; - throw new IllegalArgumentException(msg); - } - return count; + void pollSelector(int fdVal, long nanos) throws IOException { + poll(fdVal, Net.POLLIN, nanos, () -> true); } /** * Starts a platform thread to run the given task. */ - private void startPlatformThread(String name, Runnable task) { - try { - Thread thread = InnocuousThread.newSystemThread(name, task); - thread.setDaemon(true); - thread.setUncaughtExceptionHandler((t, e) -> e.printStackTrace()); - thread.start(); - } catch (Exception e) { - throw new InternalError(e); + protected final void startPlatformThread(String name, Runnable task) { + Thread thread = InnocuousThread.newSystemThread(name, task); + thread.setDaemon(true); + thread.setUncaughtExceptionHandler((t, e) -> e.printStackTrace()); + thread.start(); + } + + /** + * Return the master poller, or null if no master poller. + */ + abstract Poller masterPoller(); + + /** + * Return the read pollers. + */ + abstract List readPollers(); + + /** + * Return the write pollers. + */ + abstract List writePollers(); + + /** + * Close the given pollers. + */ + static void closeAll(Poller... pollers) { + for (Poller poller : pollers) { + if (poller != null) { + try { + poller.close(); + } catch (IOException _) { } + } } } } + /** + * SYSTEM_THREADS poller group. The read and write pollers are system-wide platform threads. + */ + private static class SystemThreadsPollerGroup extends PollerGroup { + // system-wide read and write pollers + private final Poller[] readPollers; + private final Poller[] writePollers; + + SystemThreadsPollerGroup(PollerProvider provider, + int readPollerCount, + int writePollerCount) throws IOException { + super(provider); + Poller[] readPollers = new Poller[readPollerCount]; + Poller[] writePollers = new Poller[writePollerCount]; + try { + for (int i = 0; i < readPollerCount; i++) { + readPollers[i] = provider.readPoller(false); + } + for (int i = 0; i < writePollerCount; i++) { + writePollers[i] = provider.writePoller(false); + } + } catch (Throwable e) { + closeAll(readPollers); + closeAll(writePollers); + throw e; + } + + this.readPollers = readPollers; + this.writePollers = writePollers; + } + + @Override + void start() { + Arrays.stream(readPollers).forEach(p -> { + startPlatformThread("Read-Poller", p::pollerLoop); + }); + Arrays.stream(writePollers).forEach(p -> { + startPlatformThread("Write-Poller", p::pollerLoop); + }); + } + + private Poller readPoller(int fdVal) { + int index = provider().fdValToIndex(fdVal, readPollers.length); + return readPollers[index]; + } + + private Poller writePoller(int fdVal) { + int index = provider().fdValToIndex(fdVal, writePollers.length); + return writePollers[index]; + } + + @Override + void poll(int fdVal, int event, long nanos, BooleanSupplier isOpen) throws IOException { + Poller poller = (event == Net.POLLIN) + ? readPoller(fdVal) + : writePoller(fdVal); + poller.poll(fdVal, nanos, isOpen); + } + + @Override + Poller masterPoller() { + return null; + } + + @Override + List readPollers() { + return List.of(readPollers); + } + + @Override + List writePollers() { + return List.of(writePollers); + } + } + + /** + * VTHREAD_POLLERS poller group. The read and write pollers are virtual threads. + * When read and write pollers need to block then they register with a system-wide + * "master poller" that runs in a dedicated platform thread. + */ + private static class VThreadsPollerGroup extends PollerGroup { + private final Poller masterPoller; + private final Poller[] readPollers; + private final Poller[] writePollers; + + // keep virtual thread pollers alive + private final Executor executor; + + VThreadsPollerGroup(PollerProvider provider, + int readPollerCount, + int writePollerCount) throws IOException { + super(provider); + Poller masterPoller = provider.readPoller(false); + Poller[] readPollers = new Poller[readPollerCount]; + Poller[] writePollers = new Poller[writePollerCount]; + + try { + for (int i = 0; i < readPollerCount; i++) { + readPollers[i] = provider.readPoller(true); + } + for (int i = 0; i < writePollerCount; i++) { + writePollers[i] = provider.writePoller(true); + } + } catch (Throwable e) { + masterPoller.close(); + closeAll(readPollers); + closeAll(writePollers); + throw e; + } + + this.masterPoller = masterPoller; + this.readPollers = readPollers; + this.writePollers = writePollers; + + ThreadFactory factory = Thread.ofVirtual() + .inheritInheritableThreadLocals(false) + .name("SubPoller-", 0) + .uncaughtExceptionHandler((_, e) -> e.printStackTrace()) + .factory(); + this.executor = Executors.newThreadPerTaskExecutor(factory); + } + + @Override + void start() { + startPlatformThread("Master-Poller", masterPoller::pollerLoop); + Arrays.stream(readPollers).forEach(p -> { + executor.execute(() -> p.subPollerLoop(masterPoller)); + }); + Arrays.stream(writePollers).forEach(p -> { + executor.execute(() -> p.subPollerLoop(masterPoller)); + }); + } + + private Poller readPoller(int fdVal) { + int index = provider().fdValToIndex(fdVal, readPollers.length); + return readPollers[index]; + } + + private Poller writePoller(int fdVal) { + int index = provider().fdValToIndex(fdVal, writePollers.length); + return writePollers[index]; + } + + @Override + void poll(int fdVal, int event, long nanos, BooleanSupplier isOpen) throws IOException { + Poller poller = (event == Net.POLLIN) + ? readPoller(fdVal) + : writePoller(fdVal); + poller.poll(fdVal, nanos, isOpen); + } + + @Override + void pollSelector(int fdVal, long nanos) throws IOException { + masterPoller.poll(fdVal, nanos, () -> true); + } + + @Override + Poller masterPoller() { + return masterPoller; + } + + @Override + List readPollers() { + return List.of(readPollers); + } + + @Override + List writePollers() { + return List.of(writePollers); + } + } + + /** + * POLLER_PER_CARRIER poller group. The read poller is a per-carrier virtual thread. + * When a virtual thread polls a file descriptor for POLLIN, then it will use (almost + * always, not guaranteed) the read poller for its carrier. When a read poller needs + * to block then it registers with a system-wide "master poller" that runs in a + * dedicated platform thread. The read poller terminates if the carrier terminates. + * The write pollers are system-wide platform threads (usually one). + */ + private static class PollerPerCarrierPollerGroup extends PollerGroup { + private record CarrierPoller(PollerPerCarrierPollerGroup group, Poller readPoller) { } + private static final TerminatingThreadLocal CARRIER_POLLER = + new TerminatingThreadLocal<>() { + @Override + protected void threadTerminated(CarrierPoller carrierPoller) { + Poller readPoller = carrierPoller.readPoller(); + carrierPoller.group().carrierTerminated(readPoller); + } + }; + + private final Poller masterPoller; + private final Set readPollers; + private final Poller[] writePollers; + + /** + * Create a PollerPerCarrierPollerGroup with the given number of write pollers. + */ + PollerPerCarrierPollerGroup(PollerProvider provider, + int writePollerCount) throws IOException { + super(provider); + Poller masterPoller = provider.readPoller(false); + Poller[] writePollers = new Poller[writePollerCount]; + try { + for (int i = 0; i < writePollerCount; i++) { + writePollers[i] = provider.writePoller(false); + } + } catch (Throwable e) { + masterPoller.close(); + closeAll(writePollers); + throw e; + } + this.masterPoller = masterPoller; + this.readPollers = ConcurrentHashMap.newKeySet();; + this.writePollers = writePollers; + } + + @Override + void start() { + startPlatformThread("Master-Poller", masterPoller::pollerLoop); + Arrays.stream(writePollers).forEach(p -> { + startPlatformThread("Write-Poller", p::pollerLoop); + }); + } + + private Poller writePoller(int fdVal) { + int index = provider().fdValToIndex(fdVal, writePollers.length); + return writePollers[index]; + } + + /** + * Starts a read sub-poller in a virtual thread. + */ + private Poller startReadPoller() throws IOException { + assert Thread.currentThread().isVirtual() && ContinuationSupport.isSupported(); + + // create read sub-poller + Poller readPoller = provider().readPoller(true); + readPollers.add(readPoller); + + // start virtual thread to execute sub-polling loop + Thread carrier = JLA.currentCarrierThread(); + Thread.ofVirtual() + .inheritInheritableThreadLocals(false) + .name(carrier.getName() + "-Read-Poller") + .uncaughtExceptionHandler((_, e) -> e.printStackTrace()) + .start(() -> subPollerLoop(readPoller)); + return readPoller; + } + + /** + * Returns the read poller for the current carrier, starting it if required. + */ + private Poller readPoller() throws IOException { + assert Thread.currentThread().isVirtual() && ContinuationSupport.isSupported(); + Continuation.pin(); + try { + CarrierPoller carrierPoller = CARRIER_POLLER.get(); + if (carrierPoller != null) { + return carrierPoller.readPoller(); + } else { + // first poll on this carrier will start poller + Poller readPoller = startReadPoller(); + CARRIER_POLLER.set(new CarrierPoller(this, readPoller)); + return readPoller; + } + } finally { + Continuation.unpin(); + } + } + + @Override + void poll(int fdVal, int event, long nanos, BooleanSupplier isOpen) throws IOException { + // for POLLIN, get the read poller for this carrier + if (event == Net.POLLIN + && Thread.currentThread().isVirtual() + && ContinuationSupport.isSupported()) { + readPoller().poll(fdVal, nanos, isOpen); + return; + } + + // -XX:-VMContinuations or POLLIN from platform thread does master poller + if (event == Net.POLLIN) { + masterPoller.poll(fdVal, nanos, isOpen); + } else { + writePoller(fdVal).poll(fdVal, nanos, isOpen); + } + } + + @Override + void pollSelector(int fdVal, long nanos) throws IOException { + masterPoller.poll(fdVal, nanos, () -> true); + } + + /** + * Sub-poller polling loop. + */ + private void subPollerLoop(Poller readPoller) { + try { + readPoller.subPollerLoop(masterPoller); + } finally { + // wakeup all threads waiting on file descriptors registered with the + // read poller, these I/O operation will migrate to another carrier. + readPoller.wakeupAll(); + + // remove from serviceability view + readPollers.remove(readPoller); + } + } + + /** + * Invoked by the carrier thread before it terminates. + */ + private void carrierTerminated(Poller readPoller) { + readPoller.setShutdown(); + try { + readPoller.wakeupPoller(); + } catch (Throwable e) { + e.printStackTrace(); + } + } + + @Override + Poller masterPoller() { + return masterPoller; + } + + @Override + List readPollers() { + return readPollers.stream().toList(); + } + + @Override + List writePollers() { + return List.of(writePollers); + } + } + + /** + * Reads the given property name to get the poller count. If the property is + * set then the value must be a power of 2. Returns 1 if the property is not + * set. + * @throws IllegalArgumentException if the property is set to a value that + * is not a power of 2. + */ + private static int pollerCount(String propName, int defaultCount) { + String s = System.getProperty(propName); + int count = (s != null) ? Integer.parseInt(s) : defaultCount; + + // check power of 2 + if (count != Integer.highestOneBit(count)) { + String msg = propName + " is set to a value that is not a power of 2"; + throw new IllegalArgumentException(msg); + } + return count; + } + /** * Return the master poller or null if there is no master poller. */ public static Poller masterPoller() { - return POLLERS.masterPoller(); + return POLLER_GROUP.masterPoller(); } /** * Return the list of read pollers. */ public static List readPollers() { - return POLLERS.readPollers(); + return POLLER_GROUP.readPollers(); } /** * Return the list of write pollers. */ public static List writePollers() { - return POLLERS.writePollers(); + return POLLER_GROUP.writePollers(); } } diff --git a/src/java.base/share/classes/sun/nio/ch/PollerProvider.java b/src/java.base/share/classes/sun/nio/ch/PollerProvider.java index b10ec309265..7d19b72d2fc 100644 --- a/src/java.base/share/classes/sun/nio/ch/PollerProvider.java +++ b/src/java.base/share/classes/sun/nio/ch/PollerProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * 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,38 +30,43 @@ import java.io.IOException; * Provider class for Poller implementations. */ abstract class PollerProvider { - private static final PollerProvider INSTANCE = new DefaultPollerProvider(); + private final Poller.Mode mode; - PollerProvider() { } + PollerProvider(Poller.Mode mode) { + this.mode = mode; + } - /** - * Returns the system-wide PollerProvider. - */ - static PollerProvider provider() { - return INSTANCE; + final Poller.Mode pollerMode() { + return mode; } /** - * Returns the default poller mode. - * @implSpec The default implementation uses system threads. + * Creates a PollerProvider that uses its preferred/default poller mode. */ - Poller.Mode defaultPollerMode() { - return Poller.Mode.SYSTEM_THREADS; + static PollerProvider createProvider() { + return new DefaultPollerProvider(); } /** - * Default number of read pollers for the given mode. The count must be a power of 2. + * Creates a PollerProvider that uses the given poller mode. + */ + static PollerProvider createProvider(Poller.Mode mode) { + return new DefaultPollerProvider(mode); + } + + /** + * Default number of read pollers. The count must be a power of 2. * @implSpec The default implementation returns 1. */ - int defaultReadPollers(Poller.Mode mode) { + int defaultReadPollers() { return 1; } /** - * Default number of write pollers for the given mode. The count must be a power of 2. + * Default number of write pollers. The count must be a power of 2. * @implSpec The default implementation returns 1. */ - int defaultWritePollers(Poller.Mode mode) { + int defaultWritePollers() { return 1; } @@ -74,13 +79,13 @@ abstract class PollerProvider { } /** - * Creates a Poller for read ops. + * Creates a Poller for POLLIN polling. * @param subPoller true to create a sub-poller */ abstract Poller readPoller(boolean subPoller) throws IOException; /** - * Creates a Poller for write ops. + * Creates a Poller for POLLOUT polling. * @param subPoller true to create a sub-poller */ abstract Poller writePoller(boolean subPoller) throws IOException; diff --git a/src/java.base/share/classes/sun/nio/ch/ServerSocketChannelImpl.java b/src/java.base/share/classes/sun/nio/ch/ServerSocketChannelImpl.java index e75110a76ad..98f79e6671b 100644 --- a/src/java.base/share/classes/sun/nio/ch/ServerSocketChannelImpl.java +++ b/src/java.base/share/classes/sun/nio/ch/ServerSocketChannelImpl.java @@ -90,8 +90,8 @@ class ServerSocketChannelImpl private static final int ST_CLOSED = 2; private int state; - // ID of native thread currently blocked in this channel, for signalling - private long thread; + // Thread currently blocked in this channel, for signalling + private Thread thread; // Binding private SocketAddress localAddress; // null => unbound @@ -349,7 +349,7 @@ class ServerSocketChannelImpl if (localAddress == null) throw new NotYetBoundException(); if (blocking) - thread = NativeThread.current(); + thread = NativeThread.threadToSignal(); } } @@ -364,7 +364,7 @@ class ServerSocketChannelImpl { if (blocking) { synchronized (stateLock) { - thread = 0; + thread = null; if (state == ST_CLOSING) { tryFinishClose(); } @@ -551,7 +551,7 @@ class ServerSocketChannelImpl */ private boolean tryClose() throws IOException { assert Thread.holdsLock(stateLock) && state == ST_CLOSING; - if ((thread == 0) && !isRegistered()) { + if ((thread == null) && !isRegistered()) { state = ST_CLOSED; nd.close(fd); return true; @@ -583,7 +583,7 @@ class ServerSocketChannelImpl assert state < ST_CLOSING; state = ST_CLOSING; if (!tryClose()) { - nd.preClose(fd, thread, 0); + nd.preClose(fd, thread, null); } } } diff --git a/src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java b/src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java index 868ed3b64bc..010b1832190 100644 --- a/src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java +++ b/src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java @@ -113,9 +113,9 @@ class SocketChannelImpl private static final int ST_CLOSED = 4; private volatile int state; // need stateLock to change - // IDs of native threads doing reads and writes, for signalling - private long readerThread; - private long writerThread; + // Threads doing reads and writes, for signalling + private Thread readerThread; + private Thread writerThread; // Binding private SocketAddress localAddress; @@ -368,7 +368,7 @@ class SocketChannelImpl synchronized (stateLock) { ensureOpen(); // record thread so it can be signalled if needed - readerThread = NativeThread.current(); + readerThread = NativeThread.threadToSignal(); } } } @@ -384,7 +384,7 @@ class SocketChannelImpl { if (blocking) { synchronized (stateLock) { - readerThread = 0; + readerThread = null; if (state == ST_CLOSING) { tryFinishClose(); } @@ -522,7 +522,7 @@ class SocketChannelImpl if (isOutputClosed) throw new ClosedChannelException(); // record thread so it can be signalled if needed - writerThread = NativeThread.current(); + writerThread = NativeThread.threadToSignal(); } } } @@ -538,7 +538,7 @@ class SocketChannelImpl { if (blocking) { synchronized (stateLock) { - writerThread = 0; + writerThread = null; if (state == ST_CLOSING) { tryFinishClose(); } @@ -673,7 +673,7 @@ class SocketChannelImpl ensureOpenAndConnected(); if (isOutputClosed) throw new ClosedChannelException(); - writerThread = NativeThread.current(); + writerThread = NativeThread.threadToSignal(); completed = true; } } finally { @@ -689,7 +689,7 @@ class SocketChannelImpl */ void afterTransferTo(boolean completed) throws AsynchronousCloseException { synchronized (stateLock) { - writerThread = 0; + writerThread = null; if (state == ST_CLOSING) { tryFinishClose(); } @@ -874,7 +874,7 @@ class SocketChannelImpl if (blocking) { // record thread so it can be signalled if needed - readerThread = NativeThread.current(); + readerThread = NativeThread.threadToSignal(); } } } @@ -993,7 +993,7 @@ class SocketChannelImpl throw new NoConnectionPendingException(); if (blocking) { // record thread so it can be signalled if needed - readerThread = NativeThread.current(); + readerThread = NativeThread.threadToSignal(); } } } @@ -1072,7 +1072,7 @@ class SocketChannelImpl */ private boolean tryClose() throws IOException { assert Thread.holdsLock(stateLock) && state == ST_CLOSING; - if ((readerThread == 0) && (writerThread == 0) && !isRegistered()) { + if ((readerThread == null) && (writerThread == null) && !isRegistered()) { state = ST_CLOSED; nd.close(fd); return true; @@ -1215,11 +1215,8 @@ class SocketChannelImpl throw new NotYetConnectedException(); if (!isInputClosed) { Net.shutdown(fd, Net.SHUT_RD); - long reader = readerThread; - if (NativeThread.isVirtualThread(reader)) { - Poller.stopPoll(fdVal, Net.POLLIN); - } else if (NativeThread.isNativeThread(reader)) { - NativeThread.signal(reader); + if (readerThread != null && readerThread.isVirtual()) { + Poller.stopPoll(readerThread); } isInputClosed = true; } @@ -1235,11 +1232,8 @@ class SocketChannelImpl throw new NotYetConnectedException(); if (!isOutputClosed) { Net.shutdown(fd, Net.SHUT_WR); - long writer = writerThread; - if (NativeThread.isVirtualThread(writer)) { - Poller.stopPoll(fdVal, Net.POLLOUT); - } else if (NativeThread.isNativeThread(writer)) { - NativeThread.signal(writer); + if (writerThread != null && writerThread.isVirtual()) { + Poller.stopPoll(writerThread); } isOutputClosed = true; } diff --git a/src/java.base/unix/classes/sun/nio/ch/NativeThread.java b/src/java.base/unix/classes/sun/nio/ch/NativeThread.java index 8d0bcea48d9..75cf36d6d52 100644 --- a/src/java.base/unix/classes/sun/nio/ch/NativeThread.java +++ b/src/java.base/unix/classes/sun/nio/ch/NativeThread.java @@ -25,6 +25,9 @@ package sun.nio.ch; +import java.util.concurrent.locks.LockSupport; +import jdk.internal.access.JavaLangAccess; +import jdk.internal.access.SharedSecrets; // Signalling operations on native threads // @@ -37,45 +40,38 @@ package sun.nio.ch; // always returns -1 and the signal(long) method has no effect. public class NativeThread { - private static final long VIRTUAL_THREAD_ID = -1L; + private static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess(); + + private NativeThread() { } /** - * Returns the id of the current native thread if the platform can signal - * native threads, 0 if the platform can not signal native threads, or - * -1L if the current thread is a virtual thread. - */ - public static long current() { - if (Thread.currentThread().isVirtual()) { - return VIRTUAL_THREAD_ID; - } else { - return current0(); - } - } - - /** - * Signals the given native thread. + * Returns the Thread to signal the current thread. * - * @throws IllegalArgumentException if tid is not a token to a native thread + * The first use of this method on a platform thread will capture the thread's + * native thread ID. */ - public static void signal(long tid) { - if (tid == 0 || tid == VIRTUAL_THREAD_ID) - throw new IllegalArgumentException(); - signal0(tid); + public static Thread threadToSignal() { + Thread t = Thread.currentThread(); + if (!t.isVirtual() && JLA.nativeThreadID(t) == 0) { + JLA.setThreadNativeID(current0()); + } + return t; } /** - * Returns true the tid is the id of a native thread. + * Signals the given thread. For a platform thread it sends a signal to the thread. + * For a virtual thread it just unparks it. + * @throws IllegalStateException if the thread is a platform thread that hasn't set its native ID */ - static boolean isNativeThread(long tid) { - return (tid != 0 && tid != VIRTUAL_THREAD_ID); - } - - /** - * Returns true if tid is -1L. - * @see #current() - */ - static boolean isVirtualThread(long tid) { - return (tid == VIRTUAL_THREAD_ID); + public static void signal(Thread thread) { + if (thread.isVirtual()) { + LockSupport.unpark(thread); + } else { + long id = JLA.nativeThreadID(thread); + if (id == 0) + throw new IllegalStateException("Native thread ID not set"); + signal0(id); + } } /** diff --git a/src/java.base/unix/classes/sun/nio/ch/SinkChannelImpl.java b/src/java.base/unix/classes/sun/nio/ch/SinkChannelImpl.java index b073c287bfb..09d280b370c 100644 --- a/src/java.base/unix/classes/sun/nio/ch/SinkChannelImpl.java +++ b/src/java.base/unix/classes/sun/nio/ch/SinkChannelImpl.java @@ -63,8 +63,8 @@ class SinkChannelImpl private static final int ST_CLOSED = 2; private int state; - // ID of native thread doing write, for signalling - private long thread; + // Thread doing write, for signalling + private Thread writerThread; // True if the channel's socket has been forced into non-blocking mode // by a virtual thread. It cannot be reset. When the channel is in @@ -120,7 +120,7 @@ class SinkChannelImpl */ private boolean tryClose() throws IOException { assert Thread.holdsLock(stateLock) && state == ST_CLOSING; - if (thread == 0 && !isRegistered()) { + if (writerThread == null && !isRegistered()) { state = ST_CLOSED; nd.close(fd); return true; @@ -152,7 +152,7 @@ class SinkChannelImpl assert state < ST_CLOSING; state = ST_CLOSING; if (!tryClose()) { - nd.preClose(fd, thread, 0); + nd.preClose(fd, null, writerThread); } } } @@ -270,7 +270,7 @@ class SinkChannelImpl synchronized (stateLock) { ensureOpen(); if (blocking) - thread = NativeThread.current(); + writerThread = NativeThread.threadToSignal(); } } @@ -285,7 +285,7 @@ class SinkChannelImpl { if (blocking) { synchronized (stateLock) { - thread = 0; + writerThread = null; if (state == ST_CLOSING) { tryFinishClose(); } diff --git a/src/java.base/unix/classes/sun/nio/ch/SourceChannelImpl.java b/src/java.base/unix/classes/sun/nio/ch/SourceChannelImpl.java index 571d7f483d2..52188c12b17 100644 --- a/src/java.base/unix/classes/sun/nio/ch/SourceChannelImpl.java +++ b/src/java.base/unix/classes/sun/nio/ch/SourceChannelImpl.java @@ -63,8 +63,8 @@ class SourceChannelImpl private static final int ST_CLOSED = 2; private int state; - // ID of native thread doing read, for signalling - private long thread; + // Thread doing read, for signalling + private Thread readerThread; // True if the channel's socket has been forced into non-blocking mode // by a virtual thread. It cannot be reset. When the channel is in @@ -120,7 +120,7 @@ class SourceChannelImpl */ private boolean tryClose() throws IOException { assert Thread.holdsLock(stateLock) && state == ST_CLOSING; - if (thread == 0 && !isRegistered()) { + if (readerThread == null && !isRegistered()) { state = ST_CLOSED; nd.close(fd); return true; @@ -152,7 +152,7 @@ class SourceChannelImpl assert state < ST_CLOSING; state = ST_CLOSING; if (!tryClose()) { - nd.preClose(fd, thread, 0); + nd.preClose(fd, readerThread, null); } } } @@ -269,8 +269,9 @@ class SourceChannelImpl } synchronized (stateLock) { ensureOpen(); - if (blocking) - thread = NativeThread.current(); + if (blocking) { + readerThread = NativeThread.threadToSignal(); + } } } @@ -285,7 +286,7 @@ class SourceChannelImpl { if (blocking) { synchronized (stateLock) { - thread = 0; + readerThread = null; if (state == ST_CLOSING) { tryFinishClose(); } diff --git a/src/java.base/unix/classes/sun/nio/ch/UnixDispatcher.java b/src/java.base/unix/classes/sun/nio/ch/UnixDispatcher.java index 4cdd0c400ec..3656b172822 100644 --- a/src/java.base/unix/classes/sun/nio/ch/UnixDispatcher.java +++ b/src/java.base/unix/classes/sun/nio/ch/UnixDispatcher.java @@ -36,15 +36,17 @@ abstract class UnixDispatcher extends NativeDispatcher { close0(fd); } - private void signalThreads(long reader, long writer) { - if (NativeThread.isNativeThread(reader)) + private void signalThreads(Thread reader, Thread writer) { + if (reader != null) { NativeThread.signal(reader); - if (NativeThread.isNativeThread(writer)) + } + if (writer != null) { NativeThread.signal(writer); + } } @Override - void implPreClose(FileDescriptor fd, long reader, long writer) throws IOException { + void implPreClose(FileDescriptor fd, Thread reader, Thread writer) throws IOException { if (SUPPORTS_PENDING_SIGNALS) { signalThreads(reader, writer); } diff --git a/src/java.base/unix/native/libnio/ch/IOUtil.c b/src/java.base/unix/native/libnio/ch/IOUtil.c index dfa99658fa6..3a7693b2ee0 100644 --- a/src/java.base/unix/native/libnio/ch/IOUtil.c +++ b/src/java.base/unix/native/libnio/ch/IOUtil.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -77,10 +77,9 @@ configureBlocking(int fd, jboolean blocking) } JNIEXPORT void JNICALL -Java_sun_nio_ch_IOUtil_configureBlocking(JNIEnv *env, jclass clazz, - jobject fdo, jboolean blocking) +Java_sun_nio_ch_IOUtil_configureBlocking(JNIEnv *env, jclass clazz, jint fd, jboolean blocking) { - if (configureBlocking(fdval(env, fdo), blocking) < 0) + if (configureBlocking(fd, blocking) < 0) JNU_ThrowIOExceptionWithLastError(env, "Configure blocking failed"); } diff --git a/src/java.base/windows/classes/sun/nio/ch/DefaultPollerProvider.java b/src/java.base/windows/classes/sun/nio/ch/DefaultPollerProvider.java index abd2f34a229..d1af62fbd73 100644 --- a/src/java.base/windows/classes/sun/nio/ch/DefaultPollerProvider.java +++ b/src/java.base/windows/classes/sun/nio/ch/DefaultPollerProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * 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,11 +30,19 @@ import java.io.IOException; * Default PollerProvider for Windows based on wepoll. */ class DefaultPollerProvider extends PollerProvider { - DefaultPollerProvider() { } + DefaultPollerProvider(Poller.Mode mode) { + if (mode != Poller.Mode.SYSTEM_THREADS) { + throw new UnsupportedOperationException(); + } + super(mode); + } + + DefaultPollerProvider() { + this(Poller.Mode.SYSTEM_THREADS); + } @Override - int defaultReadPollers(Poller.Mode mode) { - assert mode == Poller.Mode.SYSTEM_THREADS; + int defaultReadPollers() { int ncpus = Runtime.getRuntime().availableProcessors(); return Math.max(Integer.highestOneBit(ncpus / 8), 1); } @@ -46,13 +54,15 @@ class DefaultPollerProvider extends PollerProvider { @Override Poller readPoller(boolean subPoller) throws IOException { - assert !subPoller; + if (subPoller) + throw new UnsupportedOperationException(); return new WEPollPoller(true); } @Override Poller writePoller(boolean subPoller) throws IOException { - assert !subPoller; + if (subPoller) + throw new UnsupportedOperationException(); return new WEPollPoller(false); } } diff --git a/src/java.base/windows/classes/sun/nio/ch/NativeThread.java b/src/java.base/windows/classes/sun/nio/ch/NativeThread.java index 1870c95494f..28d8c6303d9 100644 --- a/src/java.base/windows/classes/sun/nio/ch/NativeThread.java +++ b/src/java.base/windows/classes/sun/nio/ch/NativeThread.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. * 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,47 +25,29 @@ package sun.nio.ch; - -// Signalling operations on native threads +import java.util.concurrent.locks.LockSupport; public class NativeThread { - private static final long VIRTUAL_THREAD_ID = -1L; + private NativeThread() { } /** - * Returns the id of the current native thread if the platform can signal - * native threads, 0 if the platform can not signal native threads, or - * -1L if the current thread is a virtual thread. + * Returns the Thread to signal the current thread or {@code null} if the current + * thread cannot be signalled. */ - public static long current() { - if (Thread.currentThread().isVirtual()) { - return VIRTUAL_THREAD_ID; + public static Thread threadToSignal() { + Thread thread = Thread.currentThread(); + return thread.isVirtual() ? thread : null; + } + + /** + * Signals the given thread. + * @throws UnsupportedOperationException is not supported + */ + public static void signal(Thread thread) { + if (thread.isVirtual()) { + LockSupport.unpark(thread); } else { - // no support for signalling threads on Windows - return 0; + throw new UnsupportedOperationException(); } } - - /** - * Signals the given native thread. - * - * @throws IllegalArgumentException if tid is not a token to a native thread - */ - static void signal(long tid) { - throw new UnsupportedOperationException(); - } - - /** - * Returns true the tid is the id of a native thread. - */ - static boolean isNativeThread(long tid) { - return false; - } - - /** - * Returns true if tid is -1L. - * @see #current() - */ - static boolean isVirtualThread(long tid) { - return (tid == VIRTUAL_THREAD_ID); - } } diff --git a/src/java.base/windows/classes/sun/nio/ch/WEPollPoller.java b/src/java.base/windows/classes/sun/nio/ch/WEPollPoller.java index 3db8d67acc6..9f575072f22 100644 --- a/src/java.base/windows/classes/sun/nio/ch/WEPollPoller.java +++ b/src/java.base/windows/classes/sun/nio/ch/WEPollPoller.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * 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,27 +32,41 @@ import static sun.nio.ch.WEPoll.*; */ class WEPollPoller extends Poller { private static final int MAX_EVENTS_TO_POLL = 256; - private static final int ENOENT = 2; private final long handle; private final int event; private final long address; WEPollPoller(boolean read) throws IOException { - this.handle = WEPoll.create(); + long handle = WEPoll.create(); + long address; + try { + address = WEPoll.allocatePollArray(MAX_EVENTS_TO_POLL); + } catch (Throwable e) { + WEPoll.close(handle); + throw e; + } + this.event = (read) ? EPOLLIN : EPOLLOUT; - this.address = WEPoll.allocatePollArray(MAX_EVENTS_TO_POLL); + this.handle = handle; + this.address = address; } @Override - void implRegister(int fdVal) throws IOException { + void close() { + WEPoll.close(handle); + WEPoll.freePollArray(address); + } + + @Override + void implStartPoll(int fdVal) throws IOException { int err = WEPoll.ctl(handle, EPOLL_CTL_ADD, fdVal, (event | EPOLLONESHOT)); if (err != 0) throw new IOException("epoll_ctl failed: " + err); } @Override - void implDeregister(int fdVal, boolean polled) { + void implStopPoll(int fdVal, boolean polled) { WEPoll.ctl(handle, EPOLL_CTL_DEL, fdVal, 0); } diff --git a/src/java.base/windows/native/libnio/ch/IOUtil.c b/src/java.base/windows/native/libnio/ch/IOUtil.c index 850c237d9e9..a6b81b7afec 100644 --- a/src/java.base/windows/native/libnio/ch/IOUtil.c +++ b/src/java.base/windows/native/libnio/ch/IOUtil.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -134,11 +134,10 @@ Java_sun_nio_ch_IOUtil_setfdVal(JNIEnv *env, jclass clazz, jobject fdo, jint val JNIEXPORT void JNICALL Java_sun_nio_ch_IOUtil_configureBlocking(JNIEnv *env, jclass clazz, - jobject fdo, jboolean blocking) + jint fd, jboolean blocking) { u_long argp; int result = 0; - jint fd = fdval(env, fdo); if (blocking == JNI_FALSE) { argp = SET_NONBLOCKING; diff --git a/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpChannelImpl.java b/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpChannelImpl.java index 485ebf13f2c..263aa58e098 100644 --- a/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpChannelImpl.java +++ b/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpChannelImpl.java @@ -84,9 +84,9 @@ public class SctpChannelImpl extends SctpChannel private final int fdVal; - /* IDs of native threads doing send and receive, for signalling */ - private volatile long receiverThread; - private volatile long senderThread; + /* Threads doing send and receive, for signalling */ + private volatile Thread receiverThread; + private volatile Thread senderThread; /* Lock held by current receiving or connecting thread */ private final Object receiveLock = new Object(); @@ -326,7 +326,7 @@ public class SctpChannelImpl extends SctpChannel private void receiverCleanup() throws IOException { synchronized (stateLock) { - receiverThread = 0; + receiverThread = null; if (state == ChannelState.KILLPENDING) kill(); } @@ -334,7 +334,7 @@ public class SctpChannelImpl extends SctpChannel private void senderCleanup() throws IOException { synchronized (stateLock) { - senderThread = 0; + senderThread = null; if (state == ChannelState.KILLPENDING) kill(); } @@ -367,7 +367,7 @@ public class SctpChannelImpl extends SctpChannel if (!isOpen()) { return false; } - receiverThread = NativeThread.current(); + receiverThread = NativeThread.threadToSignal(); } for (;;) { InetAddress ia = isa.getAddress(); @@ -472,7 +472,7 @@ public class SctpChannelImpl extends SctpChannel if (!isOpen()) { return false; } - receiverThread = NativeThread.current(); + receiverThread = NativeThread.threadToSignal(); } if (!isBlocking()) { connected = Net.pollConnect(fd, 0); @@ -484,7 +484,7 @@ public class SctpChannelImpl extends SctpChannel } } finally { synchronized (stateLock) { - receiverThread = 0; + receiverThread = null; if (state == ChannelState.KILLPENDING) { kill(); connected = false; @@ -541,10 +541,10 @@ public class SctpChannelImpl extends SctpChannel if (state != ChannelState.KILLED) SctpNet.preClose(fdVal); - if (receiverThread != 0) + if (receiverThread != null) NativeThread.signal(receiverThread); - if (senderThread != 0) + if (senderThread != null) NativeThread.signal(senderThread); if (!isRegistered()) @@ -644,7 +644,7 @@ public class SctpChannelImpl extends SctpChannel /* Postpone the kill if there is a waiting reader * or writer thread. */ - if (receiverThread == 0 && senderThread == 0) { + if (receiverThread == null && senderThread == null) { state = ChannelState.KILLED; SctpNet.close(fdVal); } else { @@ -743,7 +743,7 @@ public class SctpChannelImpl extends SctpChannel synchronized (stateLock) { if(!isOpen()) return null; - receiverThread = NativeThread.current(); + receiverThread = NativeThread.threadToSignal(); } do { @@ -936,7 +936,7 @@ public class SctpChannelImpl extends SctpChannel synchronized (stateLock) { if(!isOpen()) return 0; - senderThread = NativeThread.current(); + senderThread = NativeThread.threadToSignal(); } do { @@ -1031,7 +1031,7 @@ public class SctpChannelImpl extends SctpChannel ensureSendOpen(); SctpNet.shutdown(fdVal, -1); - if (senderThread != 0) + if (senderThread != null) NativeThread.signal(senderThread); isShutdown = true; } diff --git a/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java b/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java index 31e83d72f96..c08c6dc88d0 100644 --- a/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java +++ b/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java @@ -81,9 +81,9 @@ public class SctpMultiChannelImpl extends SctpMultiChannel private final int fdVal; - /* IDs of native threads doing send and receives, for signalling */ - private volatile long receiverThread; - private volatile long senderThread; + /* Threads doing send and receives, for signalling */ + private volatile Thread receiverThread; + private volatile Thread senderThread; /* Lock held by current receiving thread */ private final Object receiveLock = new Object(); @@ -265,7 +265,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel private void receiverCleanup() throws IOException { synchronized (stateLock) { - receiverThread = 0; + receiverThread = null; if (state == ChannelState.KILLPENDING) kill(); } @@ -273,7 +273,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel private void senderCleanup() throws IOException { synchronized (stateLock) { - senderThread = 0; + senderThread = null; if (state == ChannelState.KILLPENDING) kill(); } @@ -290,10 +290,10 @@ public class SctpMultiChannelImpl extends SctpMultiChannel if (state != ChannelState.KILLED) SctpNet.preClose(fdVal); - if (receiverThread != 0) + if (receiverThread != null) NativeThread.signal(receiverThread); - if (senderThread != 0) + if (senderThread != null) NativeThread.signal(senderThread); if (!isRegistered()) @@ -378,7 +378,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel assert !isOpen() && !isRegistered(); /* Postpone the kill if there is a thread sending or receiving. */ - if (receiverThread == 0 && senderThread == 0) { + if (receiverThread == null && senderThread == null) { state = ChannelState.KILLED; SctpNet.close(fdVal); } else { @@ -484,7 +484,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel synchronized (stateLock) { if(!isOpen()) return null; - receiverThread = NativeThread.current(); + receiverThread = NativeThread.threadToSignal(); } do { @@ -765,7 +765,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel synchronized (stateLock) { if(!isOpen()) return 0; - senderThread = NativeThread.current(); + senderThread = NativeThread.threadToSignal(); /* Determine what address or association to send to */ Association assoc = messageInfo.association(); diff --git a/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java b/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java index 4b2be742c6d..f72e0938eb5 100644 --- a/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java +++ b/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,8 +58,8 @@ public class SctpServerChannelImpl extends SctpServerChannel private final int fdVal; - /* IDs of native thread doing accept, for signalling */ - private volatile long thread; + /* thread doing accept, for signalling */ + private volatile Thread thread; /* Lock held by thread currently blocked in this channel */ private final Object lock = new Object(); @@ -200,7 +200,7 @@ public class SctpServerChannelImpl extends SctpServerChannel private void acceptCleanup() throws IOException { synchronized (stateLock) { - thread = 0; + thread = null; if (state == ChannelState.KILLPENDING) kill(); } @@ -222,7 +222,7 @@ public class SctpServerChannelImpl extends SctpServerChannel begin(); if (!isOpen()) return null; - thread = NativeThread.current(); + thread = NativeThread.threadToSignal(); for (;;) { n = Net.accept(fd, newfd, isaa); if ((n == IOStatus.INTERRUPTED) && isOpen()) @@ -253,7 +253,7 @@ public class SctpServerChannelImpl extends SctpServerChannel synchronized (stateLock) { if (state != ChannelState.KILLED) SctpNet.preClose(fdVal); - if (thread != 0) + if (thread != null) NativeThread.signal(thread); if (!isRegistered()) kill(); @@ -273,7 +273,7 @@ public class SctpServerChannelImpl extends SctpServerChannel assert !isOpen() && !isRegistered(); // Postpone the kill if there is a thread in accept - if (thread == 0) { + if (thread == null) { state = ChannelState.KILLED; SctpNet.close(fdVal); } else { diff --git a/test/jdk/java/net/vthread/BlockingSocketOps.java b/test/jdk/java/net/vthread/BlockingSocketOps.java index ef58e06b915..d3db734f36a 100644 --- a/test/jdk/java/net/vthread/BlockingSocketOps.java +++ b/test/jdk/java/net/vthread/BlockingSocketOps.java @@ -35,6 +35,7 @@ * @library /test/lib * @run junit/othervm -Djdk.pollerMode=1 BlockingSocketOps * @run junit/othervm -Djdk.pollerMode=2 BlockingSocketOps + * @run junit/othervm -Djdk.pollerMode=3 BlockingSocketOps */ /* diff --git a/test/jdk/java/nio/channels/vthread/BlockingChannelOps.java b/test/jdk/java/nio/channels/vthread/BlockingChannelOps.java index eb2229d927a..7e934301892 100644 --- a/test/jdk/java/nio/channels/vthread/BlockingChannelOps.java +++ b/test/jdk/java/nio/channels/vthread/BlockingChannelOps.java @@ -35,6 +35,7 @@ * @library /test/lib * @run junit/othervm/timeout=480 -Djdk.pollerMode=1 BlockingChannelOps * @run junit/othervm/timeout=480 -Djdk.pollerMode=2 BlockingChannelOps + * @run junit/othervm/timeout=480 -Djdk.pollerMode=3 BlockingChannelOps */ /* diff --git a/test/jdk/java/nio/channels/vthread/SelectorOps.java b/test/jdk/java/nio/channels/vthread/SelectorOps.java index 81821a85791..11fe98a3a01 100644 --- a/test/jdk/java/nio/channels/vthread/SelectorOps.java +++ b/test/jdk/java/nio/channels/vthread/SelectorOps.java @@ -34,6 +34,7 @@ * @library /test/lib * @run junit/othervm/native -Djdk.pollerMode=1 --enable-native-access=ALL-UNNAMED SelectorOps * @run junit/othervm/native -Djdk.pollerMode=2 --enable-native-access=ALL-UNNAMED SelectorOps + * @run junit/othervm/native -Djdk.pollerMode=3 --enable-native-access=ALL-UNNAMED SelectorOps */ /* From 986d3772248098c0ba845861611a5a4ceb7b645a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eirik=20Bj=C3=B8rsn=C3=B8s?= Date: Fri, 6 Feb 2026 17:06:04 +0000 Subject: [PATCH 010/120] 8376533: Remove test dependencies on ReferenceQueue$Lock in preparation for JDK-8376477 Reviewed-by: rriggs, shade, cjplummer --- .../hotspot/jtreg/serviceability/sa/ClhsdbInspect.java | 8 ++++---- .../jtreg/serviceability/sa/LingeredAppWithLock.java | 8 +++++++- .../ConcurrentHashMap/ConcurrentAssociateTest.java | 10 +++------- test/jdk/java/util/concurrent/Phaser/Basic.java | 6 ++---- .../bench/jdk/internal/jrtfs/ImageReaderBenchmark.java | 6 ++---- 5 files changed, 18 insertions(+), 20 deletions(-) diff --git a/test/hotspot/jtreg/serviceability/sa/ClhsdbInspect.java b/test/hotspot/jtreg/serviceability/sa/ClhsdbInspect.java index e7531226d2d..553706e502d 100644 --- a/test/hotspot/jtreg/serviceability/sa/ClhsdbInspect.java +++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbInspect.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,7 +52,7 @@ public class ClhsdbInspect { System.out.println("Started LingeredApp with pid " + theApp.getPid()); // Run the 'jstack -v' command to get the address of a Method*, - // the oop address of a java.lang.ref.ReferenceQueue$Lock + // the oop address of a LingeredAppWithLock$NestedLock // and the oop address of a java.lang.Class object List cmds = List.of("jstack -v"); @@ -63,8 +63,8 @@ public class ClhsdbInspect { tokensMap.put("(a java.lang.Class for LingeredAppWithLock)", "instance of Oop for java/lang/Class"); tokensMap.put("Method*=", "Type is Method"); - tokensMap.put("(a java.lang.ref.ReferenceQueue$Lock)", - "instance of Oop for java/lang/ref/ReferenceQueue\\$Lock"); + tokensMap.put("(a LingeredAppWithLock$NestedLock)", + "instance of Oop for LingeredAppWithLock\\$NestedLock"); String[] lines = jstackOutput.split("\\R"); diff --git a/test/hotspot/jtreg/serviceability/sa/LingeredAppWithLock.java b/test/hotspot/jtreg/serviceability/sa/LingeredAppWithLock.java index 4319d576590..9a51aef75ce 100644 --- a/test/hotspot/jtreg/serviceability/sa/LingeredAppWithLock.java +++ b/test/hotspot/jtreg/serviceability/sa/LingeredAppWithLock.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2026, Oracle and/or its affiliates. All rights reserved. * 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 jdk.test.lib.apps.LingeredApp; public class LingeredAppWithLock extends LingeredApp { private static Object lockObj = new Object(); + private static class NestedLock {} + public static void lockMethod(Object lock) { synchronized (lock) { try { @@ -50,12 +52,14 @@ public class LingeredAppWithLock extends LingeredApp { public static void main(String args[]) { Thread classLock1 = new Thread(() -> lockMethod(LingeredAppWithLock.class)); Thread classLock2 = new Thread(() -> lockMethod(LingeredAppWithLock.class)); + Thread nestedClassLock = new Thread(() -> lockMethod(new NestedLock())); Thread objectLock = new Thread(() -> lockMethod(classLock1)); Thread primitiveLock = new Thread(() -> lockMethod(int.class)); Thread objectWait = new Thread(() -> waitMethod()); classLock1.start(); classLock2.start(); + nestedClassLock.start(); objectLock.start(); primitiveLock.start(); objectWait.start(); @@ -65,6 +69,8 @@ public class LingeredAppWithLock extends LingeredApp { classLock1.getState() != Thread.State.TIMED_WAITING) || (classLock2.getState() != Thread.State.BLOCKED && classLock2.getState() != Thread.State.TIMED_WAITING) || + (nestedClassLock.getState() != Thread.State.BLOCKED && + nestedClassLock.getState() != Thread.State.TIMED_WAITING) || (objectLock.getState() != Thread.State.TIMED_WAITING) || (primitiveLock.getState() != Thread.State.TIMED_WAITING) || (objectWait.getState() != Thread.State.TIMED_WAITING)) { diff --git a/test/jdk/java/util/concurrent/ConcurrentHashMap/ConcurrentAssociateTest.java b/test/jdk/java/util/concurrent/ConcurrentHashMap/ConcurrentAssociateTest.java index e6afff5b329..014272a8f96 100644 --- a/test/jdk/java/util/concurrent/ConcurrentHashMap/ConcurrentAssociateTest.java +++ b/test/jdk/java/util/concurrent/ConcurrentHashMap/ConcurrentAssociateTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -171,13 +171,9 @@ public class ConcurrentAssociateTest { String lockName; if ("Signal Dispatcher".equals(name)) continue; - if ("Reference Handler".equals(name) - && (lockName = info.getLockName()) != null - && lockName.startsWith("java.lang.ref.Reference$Lock")) + if ("Reference Handler".equals(name)) continue; - if ("Finalizer".equals(name) - && (lockName = info.getLockName()) != null - && lockName.startsWith("java.lang.ref.ReferenceQueue$Lock")) + if ("Finalizer".equals(name)) continue; System.err.print(info); } diff --git a/test/jdk/java/util/concurrent/Phaser/Basic.java b/test/jdk/java/util/concurrent/Phaser/Basic.java index 2ea09dced99..500e106891b 100644 --- a/test/jdk/java/util/concurrent/Phaser/Basic.java +++ b/test/jdk/java/util/concurrent/Phaser/Basic.java @@ -434,11 +434,9 @@ public class Basic { String name = info.getThreadName(); if ("Signal Dispatcher".equals(name)) continue; - if ("Reference Handler".equals(name) - && info.getLockName().startsWith("java.lang.ref.Reference$Lock")) + if ("Reference Handler".equals(name)) continue; - if ("Finalizer".equals(name) - && info.getLockName().startsWith("java.lang.ref.ReferenceQueue$Lock")) + if ("Finalizer".equals(name)) continue; if (name.startsWith("process reaper")) continue; diff --git a/test/micro/org/openjdk/bench/jdk/internal/jrtfs/ImageReaderBenchmark.java b/test/micro/org/openjdk/bench/jdk/internal/jrtfs/ImageReaderBenchmark.java index 1b89b510fae..b6876e66d98 100644 --- a/test/micro/org/openjdk/bench/jdk/internal/jrtfs/ImageReaderBenchmark.java +++ b/test/micro/org/openjdk/bench/jdk/internal/jrtfs/ImageReaderBenchmark.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -447,7 +447,6 @@ public class ImageReaderBenchmark { "/modules/java.base/jdk/internal/access/JavaLangRefAccess.class", "/modules/java.base/java/lang/ref/ReferenceQueue.class", "/modules/java.base/java/lang/ref/ReferenceQueue$Null.class", - "/modules/java.base/java/lang/ref/ReferenceQueue$Lock.class", "/modules/java.base/jdk/internal/access/JavaLangAccess.class", "/modules/java.base/jdk/internal/util/SystemProps.class", "/modules/java.base/jdk/internal/util/SystemProps$Raw.class", @@ -1073,6 +1072,5 @@ public class ImageReaderBenchmark { "/modules/java.base/java/nio/charset/CoderResult.class", "/modules/java.base/java/util/IdentityHashMap$IdentityHashMapIterator.class", "/modules/java.base/java/util/IdentityHashMap$KeyIterator.class", - "/modules/java.base/java/lang/Shutdown.class", - "/modules/java.base/java/lang/Shutdown$Lock.class"); + "/modules/java.base/java/lang/Shutdown.class"); } From eec76d7b8c4c8a64593d85338225906c188f679c Mon Sep 17 00:00:00 2001 From: Kelvin Nilsen Date: Sat, 7 Feb 2026 00:57:23 +0000 Subject: [PATCH 011/120] 8377180: Shenandoah: make escalation from degen to full more conservative Reviewed-by: wkemper, xpeng --- .../shenandoah/shenandoahCollectorPolicy.hpp | 19 ++++++------------- .../gc/shenandoah/shenandoahDegeneratedGC.cpp | 2 +- .../test_shenandoahCollectorPolicy.cpp | 12 ++++++------ 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/src/hotspot/share/gc/shenandoah/shenandoahCollectorPolicy.hpp b/src/hotspot/share/gc/shenandoah/shenandoahCollectorPolicy.hpp index 5fe90f64f98..1166333ae3a 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahCollectorPolicy.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahCollectorPolicy.hpp @@ -63,17 +63,10 @@ private: public: // The most common scenario for lack of good progress following a degenerated GC is an accumulation of floating - // garbage during the most recently aborted concurrent GC effort. With generational GC, it is far more effective to + // garbage during the most recently aborted concurrent GC effort. Usually, it is far more effective to // reclaim this floating garbage with another degenerated cycle (which focuses on young generation and might require - // a pause of 200 ms) rather than a full GC cycle (which may require over 2 seconds with a 10 GB old generation). - // - // In generational mode, we'll only upgrade to full GC if we've done two degen cycles in a row and both indicated - // bad progress. In non-generational mode, we'll preserve the original behavior, which is to upgrade to full - // immediately following a degenerated cycle with bad progress. This preserves original behavior of non-generational - // Shenandoah to avoid introducing "surprising new behavior." It also makes less sense with non-generational - // Shenandoah to replace a full GC with a degenerated GC, because both have similar pause times in non-generational - // mode. - static constexpr size_t GENERATIONAL_CONSECUTIVE_BAD_DEGEN_PROGRESS_THRESHOLD = 2; + // a pause of 200 ms) rather than a full GC cycle (which may require multiple seconds with a 10 GB old generation). + static constexpr size_t CONSECUTIVE_BAD_DEGEN_PROGRESS_THRESHOLD = 2; ShenandoahCollectorPolicy(); @@ -117,9 +110,9 @@ public: return _consecutive_degenerated_gcs; } - // Genshen will only upgrade to a full gc after the configured number of futile degenerated cycles. - bool generational_should_upgrade_degenerated_gc() const { - return _consecutive_degenerated_gcs_without_progress >= GENERATIONAL_CONSECUTIVE_BAD_DEGEN_PROGRESS_THRESHOLD; + // Only upgrade to a full gc after the configured number of futile degenerated cycles. + bool should_upgrade_degenerated_gc() const { + return _consecutive_degenerated_gcs_without_progress >= CONSECUTIVE_BAD_DEGEN_PROGRESS_THRESHOLD; } static bool is_allocation_failure(GCCause::Cause cause); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahDegeneratedGC.cpp b/src/hotspot/share/gc/shenandoah/shenandoahDegeneratedGC.cpp index 333bdbc6e72..99776e38bfe 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahDegeneratedGC.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahDegeneratedGC.cpp @@ -314,7 +314,7 @@ void ShenandoahDegenGC::op_degenerated() { if (progress) { heap->notify_gc_progress(); _generation->heuristics()->record_degenerated(); - } else if (!heap->mode()->is_generational() || policy->generational_should_upgrade_degenerated_gc()) { + } else if (policy->should_upgrade_degenerated_gc()) { // Upgrade to full GC, register full-GC impact on heuristics. op_degenerated_futile(); } else { diff --git a/test/hotspot/gtest/gc/shenandoah/test_shenandoahCollectorPolicy.cpp b/test/hotspot/gtest/gc/shenandoah/test_shenandoahCollectorPolicy.cpp index b5c974f65ad..70d458ec5e5 100644 --- a/test/hotspot/gtest/gc/shenandoah/test_shenandoahCollectorPolicy.cpp +++ b/test/hotspot/gtest/gc/shenandoah/test_shenandoahCollectorPolicy.cpp @@ -28,7 +28,7 @@ TEST(ShenandoahCollectorPolicyTest, track_degen_cycles_sanity) { ShenandoahCollectorPolicy policy; EXPECT_EQ(policy.consecutive_degenerated_gc_count(), 0UL); - EXPECT_EQ(policy.generational_should_upgrade_degenerated_gc(), false); + EXPECT_EQ(policy.should_upgrade_degenerated_gc(), false); } TEST(ShenandoahCollectorPolicyTest, track_degen_cycles_no_upgrade) { @@ -36,7 +36,7 @@ TEST(ShenandoahCollectorPolicyTest, track_degen_cycles_no_upgrade) { policy.record_degenerated(true, true, true); policy.record_degenerated(true, true, true); EXPECT_EQ(policy.consecutive_degenerated_gc_count(), 2UL); - EXPECT_EQ(policy.generational_should_upgrade_degenerated_gc(), false); + EXPECT_EQ(policy.should_upgrade_degenerated_gc(), false); } TEST(ShenandoahCollectorPolicyTest, track_degen_cycles_upgrade) { @@ -44,7 +44,7 @@ TEST(ShenandoahCollectorPolicyTest, track_degen_cycles_upgrade) { policy.record_degenerated(true, true, false); policy.record_degenerated(true, true, false); EXPECT_EQ(policy.consecutive_degenerated_gc_count(), 2UL); - EXPECT_EQ(policy.generational_should_upgrade_degenerated_gc(), true); + EXPECT_EQ(policy.should_upgrade_degenerated_gc(), true); } TEST(ShenandoahCollectorPolicyTest, track_degen_cycles_reset_progress) { @@ -52,7 +52,7 @@ TEST(ShenandoahCollectorPolicyTest, track_degen_cycles_reset_progress) { policy.record_degenerated(true, true, false); policy.record_degenerated(true, true, true); EXPECT_EQ(policy.consecutive_degenerated_gc_count(), 2UL); - EXPECT_EQ(policy.generational_should_upgrade_degenerated_gc(), false); + EXPECT_EQ(policy.should_upgrade_degenerated_gc(), false); } TEST(ShenandoahCollectorPolicyTest, track_degen_cycles_full_reset) { @@ -60,7 +60,7 @@ TEST(ShenandoahCollectorPolicyTest, track_degen_cycles_full_reset) { policy.record_degenerated(true, true, false); policy.record_success_full(); EXPECT_EQ(policy.consecutive_degenerated_gc_count(), 0UL); - EXPECT_EQ(policy.generational_should_upgrade_degenerated_gc(), false); + EXPECT_EQ(policy.should_upgrade_degenerated_gc(), false); } TEST(ShenandoahCollectorPolicyTest, track_degen_cycles_reset) { @@ -68,5 +68,5 @@ TEST(ShenandoahCollectorPolicyTest, track_degen_cycles_reset) { policy.record_degenerated(true, true, false); policy.record_success_concurrent(true, true); EXPECT_EQ(policy.consecutive_degenerated_gc_count(), 0UL); - EXPECT_EQ(policy.generational_should_upgrade_degenerated_gc(), false); + EXPECT_EQ(policy.should_upgrade_degenerated_gc(), false); } From 4c322344cd08608ae4d4e9bf99e7333ac8009f26 Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Sat, 7 Feb 2026 01:59:33 +0000 Subject: [PATCH 012/120] 8377018: Convert java/nio/file/DirectoryStream/SecureDS.java to junit Reviewed-by: bpb, alanb --- .../nio/file/DirectoryStream/SecureDS.java | 167 +++++++----------- 1 file changed, 67 insertions(+), 100 deletions(-) diff --git a/test/jdk/java/nio/file/DirectoryStream/SecureDS.java b/test/jdk/java/nio/file/DirectoryStream/SecureDS.java index a115d56c52f..870a84a8927 100644 --- a/test/jdk/java/nio/file/DirectoryStream/SecureDS.java +++ b/test/jdk/java/nio/file/DirectoryStream/SecureDS.java @@ -21,20 +21,13 @@ * questions. */ -/* @test id=tmp +/* @test * @bug 4313887 6838333 8343020 8357425 * @summary Unit test for java.nio.file.SecureDirectoryStream * @requires (os.family == "linux" | os.family == "mac" | os.family == "aix") * @library .. /test/lib - * @build jdk.test.lib.Platform jtreg.SkippedException - * @run main SecureDS - */ - -/* @test id=cwd - * @requires (os.family == "linux" | os.family == "mac" | os.family == "aix") - * @library .. /test/lib - * @build jdk.test.lib.Platform jtreg.SkippedException - * @run main SecureDS cwd + * @build jdk.test.lib.Platform + * @run junit SecureDS */ import java.nio.file.*; @@ -46,14 +39,22 @@ import java.io.IOException; import java.util.*; import jdk.test.lib.Platform; -import jtreg.SkippedException; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.fail; +import static org.junit.jupiter.api.Assumptions.assumeTrue; public class SecureDS { static boolean supportsSymbolicLinks; - public static void main(String[] args) throws IOException { + @ParameterizedTest + @ValueSource(strings = {"tmp","cwd"}) + public void testSecureDS(String mode) throws IOException { Path dir; - if (args.length > 0 && args[0].equals("cwd")) { + if (mode.equals("cwd")) { dir = TestUtil.createTemporaryDirectory(System.getProperty("user.dir")); } else { dir = TestUtil.createTemporaryDirectory(); @@ -61,9 +62,7 @@ public class SecureDS { try { DirectoryStream stream = newDirectoryStream(dir); stream.close(); - if (!(stream instanceof SecureDirectoryStream)) { - throw new AssertionError("SecureDirectoryStream not supported."); - } + assumeTrue(stream instanceof SecureDirectoryStream); supportsSymbolicLinks = TestUtil.supportsSymbolicLinks(dir); @@ -106,7 +105,7 @@ public class SecureDS { // Test: iterate over all entries int count = 0; for (Path entry: stream) { count++; } - assertTrue(count == (supportsSymbolicLinks ? 4 : 2)); + assertEquals((supportsSymbolicLinks ? 4 : 2), count); // Test: getFileAttributeView to access directory's attributes assertTrue(stream @@ -155,13 +154,12 @@ public class SecureDS { stream.newByteChannel(fileEntry, opts).close(); if (supportsSymbolicLinks) { stream.newByteChannel(link1Entry, opts).close(); - try { + assertThrows(IOException.class, () -> { Set mixed = new HashSet<>(); mixed.add(READ); mixed.add(NOFOLLOW_LINKS); stream.newByteChannel(link1Entry, mixed).close(); - shouldNotGetHere(); - } catch (IOException x) { } + }); } // Test: newDirectoryStream @@ -169,11 +167,10 @@ public class SecureDS { stream.newDirectoryStream(dirEntry, LinkOption.NOFOLLOW_LINKS).close(); if (supportsSymbolicLinks) { stream.newDirectoryStream(link2Entry).close(); - try { + assertThrows(IOException.class, () -> { stream.newDirectoryStream(link2Entry, LinkOption.NOFOLLOW_LINKS) .close(); - shouldNotGetHere(); - } catch (IOException x) { } + }); } // Test: delete @@ -201,10 +198,10 @@ public class SecureDS { // Test setting permission on directory with no permissions setPosixFilePermissions(aDir, noperms); - assertTrue(getPosixFilePermissions(aDir).equals(noperms)); + assertEquals(noperms, getPosixFilePermissions(aDir)); PosixFileAttributeView view = stream.getFileAttributeView(PosixFileAttributeView.class); view.setPermissions(permsDir); - assertTrue(getPosixFilePermissions(aDir).equals(permsDir)); + assertEquals(permsDir, getPosixFilePermissions(aDir)); if (supportsSymbolicLinks) { // Create a file and a link to the file @@ -218,22 +215,21 @@ public class SecureDS { // Test following link to file view = stream.getFileAttributeView(link, PosixFileAttributeView.class); view.setPermissions(noperms); - assertTrue(getPosixFilePermissions(file).equals(noperms)); - assertTrue(getPosixFilePermissions(link, NOFOLLOW_LINKS).equals(permsLink)); + assertEquals(noperms, getPosixFilePermissions(file)); + assertEquals(permsLink, getPosixFilePermissions(link, NOFOLLOW_LINKS)); view.setPermissions(permsFile); - assertTrue(getPosixFilePermissions(file).equals(permsFile)); - assertTrue(getPosixFilePermissions(link, NOFOLLOW_LINKS).equals(permsLink)); - + assertEquals(permsFile, getPosixFilePermissions(file)); + assertEquals(permsLink, getPosixFilePermissions(link, NOFOLLOW_LINKS)); // Symbolic link permissions do not apply on Linux if (!Platform.isLinux()) { // Test not following link to file view = stream.getFileAttributeView(link, PosixFileAttributeView.class, NOFOLLOW_LINKS); view.setPermissions(noperms); - assertTrue(getPosixFilePermissions(file).equals(permsFile)); - assertTrue(getPosixFilePermissions(link, NOFOLLOW_LINKS).equals(noperms)); + assertEquals(permsFile, getPosixFilePermissions(file)); + assertEquals(noperms, getPosixFilePermissions(link, NOFOLLOW_LINKS)); view.setPermissions(permsLink); - assertTrue(getPosixFilePermissions(file).equals(permsFile)); - assertTrue(getPosixFilePermissions(link, NOFOLLOW_LINKS).equals(permsLink)); + assertEquals(permsFile, getPosixFilePermissions(file)); + assertEquals(permsLink, getPosixFilePermissions(link, NOFOLLOW_LINKS)); } delete(link); @@ -295,10 +291,9 @@ public class SecureDS { SecureDirectoryStream ts = (SecureDirectoryStream)newDirectoryStream(testDir); createFile(dir1.resolve(fileEntry)); - try { + assertThrows(AtomicMoveNotSupportedException.class, () -> { stream1.move(fileEntry, ts, target); - shouldNotGetHere(); - } catch (AtomicMoveNotSupportedException x) { } + }); ts.close(); stream1.deleteFile(fileEntry); } @@ -316,18 +311,13 @@ public class SecureDS { try { sds.move(file, null, file); } catch (AtomicMoveNotSupportedException e) { - if (Files.getFileStore(cwd).equals(Files.getFileStore(dir))) { - // re-throw if move between same volume - throw e; - } else { - throw new SkippedException( - "java.nio.file.AtomicMoveNotSupportedException"); - } + assumeTrue(Files.getFileStore(cwd).equals(Files.getFileStore(dir))); + // re-throw if move between same volume + throw e; } - if (!TEXT.equals(Files.readString(result))) - throw new RuntimeException(result + " content incorrect"); + assertEquals(TEXT, Files.readString(result), result + " content incorrect"); } else { - throw new RuntimeException("Not a SecureDirectoryStream"); + fail("Not a SecureDirectoryStream"); } } finally { boolean fileDeleted = Files.deleteIfExists(filepath); @@ -348,82 +338,59 @@ public class SecureDS { (SecureDirectoryStream)newDirectoryStream(dir); // NullPointerException - try { + assertThrows(NullPointerException.class, () -> { stream.getFileAttributeView(null); - shouldNotGetHere(); - } catch (NullPointerException x) { } - try { + }); + assertThrows(NullPointerException.class, () -> { stream.getFileAttributeView(null, BasicFileAttributeView.class); - shouldNotGetHere(); - } catch (NullPointerException x) { } - try { + }); + assertThrows(NullPointerException.class, () -> { stream.getFileAttributeView(file, null); - shouldNotGetHere(); - } catch (NullPointerException x) { } - try { + }); + assertThrows(NullPointerException.class, () -> { stream.newByteChannel(null, EnumSet.of(CREATE,WRITE)); - shouldNotGetHere(); - } catch (NullPointerException x) { } - try { + }); + assertThrows(NullPointerException.class, () -> { stream.newByteChannel(null, EnumSet.of(CREATE,WRITE,null)); - shouldNotGetHere(); - } catch (NullPointerException x) { } - try { + }); + assertThrows(NullPointerException.class, () -> { stream.newByteChannel(file, null); - shouldNotGetHere(); - } catch (NullPointerException x) { } - try { + }); + assertThrows(NullPointerException.class, () -> { stream.move(null, stream, file); - shouldNotGetHere(); - } catch (NullPointerException x) { } - try { + }); + assertThrows(NullPointerException.class, () -> { stream.move(file, stream, null); - shouldNotGetHere(); - } catch (NullPointerException x) { } - try { + }); + assertThrows(NullPointerException.class, () -> { stream.newDirectoryStream(null); - shouldNotGetHere(); - } catch (NullPointerException x) { } - try { + }); + assertThrows(NullPointerException.class, () -> { stream.deleteFile(null); - shouldNotGetHere(); - } catch (NullPointerException x) { } - try { + }); + assertThrows(NullPointerException.class, () -> { stream.deleteDirectory(null); - shouldNotGetHere(); - } catch (NullPointerException x) { } + }); // close stream stream.close(); stream.close(); // should be no-op // ClosedDirectoryStreamException - try { + assertThrows(ClosedDirectoryStreamException.class, () -> { stream.newDirectoryStream(file); - shouldNotGetHere(); - } catch (ClosedDirectoryStreamException x) { } - try { + }); + assertThrows(ClosedDirectoryStreamException.class, () -> { stream.newByteChannel(file, EnumSet.of(READ)); - shouldNotGetHere(); - } catch (ClosedDirectoryStreamException x) { } - try { + }); + assertThrows(ClosedDirectoryStreamException.class, () -> { stream.move(file, stream, file); - shouldNotGetHere(); - } catch (ClosedDirectoryStreamException x) { } - try { + }); + assertThrows(ClosedDirectoryStreamException.class, () -> { stream.deleteFile(file); - shouldNotGetHere(); - } catch (ClosedDirectoryStreamException x) { } + }); // clean-up delete(dir.resolve(file)); } - - static void assertTrue(boolean b) { - if (!b) throw new RuntimeException("Assertion failed"); - } - - static void shouldNotGetHere() { - assertTrue(false); - } } From 40bf0870f788c142f0eb1c2bfbda540ae4a93a08 Mon Sep 17 00:00:00 2001 From: Alexey Semenyuk Date: Sat, 7 Feb 2026 03:18:11 +0000 Subject: [PATCH 013/120] 8377392: jpackage: Fix member function called from the CfgFile.Referencies compact canonical constructor Reviewed-by: liach, almatvee --- .../share/classes/jdk/jpackage/internal/CfgFile.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/CfgFile.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/CfgFile.java index 9cb9fb5cba0..7958dcdef2d 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/CfgFile.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/CfgFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -124,21 +124,19 @@ final class CfgFile { Files.write(cfgFile, (Iterable) lines::iterator); } - private record Referencies(Path appModsDirectory) { + private record Referencies(Path appModsDirectory, Path appDirectory) { Referencies { - if (!appModsDirectory.startsWith(appDirectory())) { + if (!appModsDirectory.startsWith(appDirectory)) { throw new IllegalArgumentException(); } } Referencies(ApplicationLayout appLayout) { - this(Path.of("$APPDIR").resolve(appLayout.appModsDirectory().getFileName())); + this(BASEDIR.resolve(appLayout.appModsDirectory().getFileName()), BASEDIR); } - Path appDirectory() { - return Path.of("$APPDIR"); - } + private static final Path BASEDIR = Path.of("$APPDIR"); } private final LauncherStartupInfo startupInfo; From 5152fdcd490412025ba5f608378982abc1eadc07 Mon Sep 17 00:00:00 2001 From: Alexey Semenyuk Date: Sat, 7 Feb 2026 03:27:23 +0000 Subject: [PATCH 014/120] 8377331: jpackage: improve sign errors reporting Reviewed-by: almatvee --- .../jdk/jpackage/internal/AppImageSigner.java | 21 +--- .../jdk/jpackage/internal/Codesign.java | 20 +-- .../resources/MacResources.properties | 1 - .../jdk/jpackage/internal/cli/Main.java | 8 +- .../test/FailedCommandErrorValidator.java | 115 ++++++++++++++++++ .../jdk/jpackage/test/JPackageCommand.java | 9 +- .../helpers/jdk/jpackage/test/MacHelper.java | 16 +++ .../helpers/jdk/jpackage/test/TKit.java | 43 ++++++- .../jdk/jpackage/internal/cli/MainTest.java | 4 +- .../tools/jpackage/macosx/MacSignTest.java | 79 ++++++------ 10 files changed, 243 insertions(+), 73 deletions(-) create mode 100644 test/jdk/tools/jpackage/helpers/jdk/jpackage/test/FailedCommandErrorValidator.java diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/AppImageSigner.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/AppImageSigner.java index 19ff78f174e..c908ec7447c 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/AppImageSigner.java +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/AppImageSigner.java @@ -24,7 +24,6 @@ */ package jdk.jpackage.internal; -import static java.util.stream.Collectors.joining; import static jdk.jpackage.internal.MacPackagingPipeline.APPLICATION_LAYOUT; import static jdk.jpackage.internal.model.MacPackage.RUNTIME_BUNDLE_LAYOUT; import static jdk.jpackage.internal.util.function.ThrowingConsumer.toConsumer; @@ -40,7 +39,6 @@ import java.util.Optional; import java.util.Set; import java.util.function.Consumer; import java.util.function.Predicate; -import java.util.stream.Stream; import jdk.jpackage.internal.Codesign.CodesignException; import jdk.jpackage.internal.model.Application; import jdk.jpackage.internal.model.ApplicationLayout; @@ -63,9 +61,10 @@ final class AppImageSigner { throw handleCodesignException(app, ex); } catch (ExceptionBox ex) { if (ex.getCause() instanceof CodesignException codesignEx) { - handleCodesignException(app, codesignEx); + throw handleCodesignException(app, codesignEx); + } else { + throw ex; } - throw ex; } }); } @@ -165,13 +164,9 @@ final class AppImageSigner { } } - private static CodesignException handleCodesignException(MacApplication app, CodesignException ex) { - // Log output of "codesign" in case of error. It should help - // user to diagnose issues when using --mac-app-image-sign-identity. - // In addition add possible reason for failure. For example - // "--app-content" can fail "codesign". - + private static IOException handleCodesignException(MacApplication app, CodesignException ex) { if (!app.contentDirSources().isEmpty()) { + // Additional content may cause signing error. Log.info(I18N.getString("message.codesign.failed.reason.app.content")); } @@ -182,11 +177,7 @@ final class AppImageSigner { Log.info(I18N.getString("message.codesign.failed.reason.xcode.tools")); } - // Log "codesign" output - Log.info(I18N.format("error.tool.failed.with.output", "codesign")); - Log.info(Stream.of(ex.getOutput()).collect(joining("\n")).strip()); - - return ex; + return ex.getCause(); } private static boolean isXcodeDevToolsInstalled() { diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/Codesign.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/Codesign.java index a7cd17b06b9..984202bbfaf 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/Codesign.java +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/Codesign.java @@ -34,22 +34,21 @@ import java.util.Objects; import java.util.Optional; import java.util.function.Consumer; import java.util.function.Supplier; - +import jdk.jpackage.internal.util.CommandOutputControl.UnexpectedExitCodeException; public final class Codesign { public static final class CodesignException extends Exception { - CodesignException(String[] output) { - this.output = output; + CodesignException(UnexpectedExitCodeException cause) { + super(Objects.requireNonNull(cause)); } - String[] getOutput() { - return output; + @Override + public UnexpectedExitCodeException getCause() { + return (UnexpectedExitCodeException)super.getCause(); } - private final String[] output; - private static final long serialVersionUID = 1L; } @@ -96,9 +95,10 @@ public final class Codesign { var exec = Executor.of(cmdline).args(path.toString()).saveOutput(true); configureExecutor.ifPresent(configure -> configure.accept(exec)); - var result = exec.execute(); - if (result.getExitCode() != 0) { - throw new CodesignException(result.getOutput().toArray(String[]::new)); + try { + exec.execute().expectExitCode(0); + } catch (UnexpectedExitCodeException ex) { + throw new CodesignException(ex); } } diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources.properties b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources.properties index 0237d49f399..e1b154c5933 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources.properties +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources.properties @@ -28,7 +28,6 @@ error.certificate.expired=Certificate expired {0} error.cert.not.found=No certificate found matching [{0}] using keychain [{1}] error.multiple.certs.found=Multiple certificates matching name [{0}] found in keychain [{1}] error.app-image.mac-sign.required=--mac-sign option is required with predefined application image and with type [app-image] -error.tool.failed.with.output="{0}" failed with following output: error.invalid-runtime-image-missing-file=Runtime image "{0}" is missing "{1}" file error.invalid-runtime-image-bin-dir=Runtime image "{0}" should not contain "bin" folder error.invalid-runtime-image-bin-dir.advice=Use --strip-native-commands jlink option when generating runtime image used with {0} option diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/Main.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/Main.java index 562a0d2d3c1..73b4850344b 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/Main.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/Main.java @@ -271,11 +271,9 @@ public final class Main { } messagePrinter.accept(I18N.format("message.error-header", msg)); - if (!verbose) { - messagePrinter.accept(I18N.format("message.failed-command-output-header")); - try (var lines = new BufferedReader(new StringReader(commandOutput)).lines()) { - lines.forEach(messagePrinter); - } + messagePrinter.accept(I18N.format("message.failed-command-output-header")); + try (var lines = new BufferedReader(new StringReader(commandOutput)).lines()) { + lines.forEach(messagePrinter); } } diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/FailedCommandErrorValidator.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/FailedCommandErrorValidator.java new file mode 100644 index 00000000000..ab644c36a5c --- /dev/null +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/FailedCommandErrorValidator.java @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * 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.jpackage.test; + +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.regex.Pattern; + +/** + * Validates failed command error in jpackage's output. + */ +public final class FailedCommandErrorValidator { + + public FailedCommandErrorValidator(Pattern cmdlinePattern) { + this.cmdlinePattern = Objects.requireNonNull(cmdlinePattern); + } + + public TKit.TextStreamVerifier.Group createGroup() { + var asPredicate = cmdlinePattern.asPredicate(); + + var errorMessage = exitCode().map(v -> { + return JPackageStringBundle.MAIN.cannedFormattedString("error.command-failed-unexpected-exit-code", v, ""); + }).orElseGet(() -> { + return JPackageStringBundle.MAIN.cannedFormattedString("error.command-failed-unexpected-output", ""); + }); + + var errorMessageWithPrefix = JPackageCommand.makeError(errorMessage).getValue(); + + var group = TKit.TextStreamVerifier.group(); + + group.add(TKit.assertTextStream(cmdlinePattern.pattern()).predicate(line -> { + if (line.startsWith(errorMessageWithPrefix)) { + line = line.substring(errorMessageWithPrefix.length()); + return asPredicate.test(line); + } else { + return false; + } + })); + + group.add(TKit.assertTextStream( + JPackageStringBundle.MAIN.cannedFormattedString("message.failed-command-output-header").getValue() + ).predicate(String::equals)); + + outputVerifier().ifPresent(group::add); + + return group; + } + + public void applyTo(JPackageCommand cmd) { + cmd.validateOutput(createGroup().create()); + } + + public FailedCommandErrorValidator validator(TKit.TextStreamVerifier.Group v) { + outputValidator = v; + return this; + } + + public FailedCommandErrorValidator validator(List validators) { + var group = TKit.TextStreamVerifier.group(); + validators.forEach(group::add); + return validator(group); + } + + public FailedCommandErrorValidator validators(TKit.TextStreamVerifier... validators) { + return validator(List.of(validators)); + } + + public FailedCommandErrorValidator output(List v) { + return validator(v.stream().map(TKit::assertTextStream).toList()); + } + + public FailedCommandErrorValidator output(String... output) { + return output(List.of(output)); + } + + public FailedCommandErrorValidator exitCode(int v) { + exitCode = v; + return this; + } + + private Optional exitCode() { + return Optional.ofNullable(exitCode); + } + + private Optional outputVerifier() { + return Optional.ofNullable(outputValidator); + } + + private final Pattern cmdlinePattern; + private TKit.TextStreamVerifier.Group outputValidator; + private Integer exitCode; +} diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageCommand.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageCommand.java index f81c35cea0b..8c7526be9f9 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageCommand.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageCommand.java @@ -906,6 +906,11 @@ public class JPackageCommand extends CommandArguments { return this; } + public JPackageCommand validateOutput(TKit.TextStreamVerifier.Group group) { + group.tryCreate().ifPresent(this::validateOutput); + return this; + } + @FunctionalInterface public interface CannedArgument { public String value(JPackageCommand cmd); @@ -947,11 +952,11 @@ public class JPackageCommand extends CommandArguments { public JPackageCommand validateOutput(CannedFormattedString... str) { // Will look up the given errors in the order they are specified. - Stream.of(str).map(this::getValue) + validateOutput(Stream.of(str).map(this::getValue) .map(TKit::assertTextStream) .reduce(TKit.TextStreamVerifier.group(), TKit.TextStreamVerifier.Group::add, - TKit.TextStreamVerifier.Group::add).tryCreate().ifPresent(this::validateOutput); + TKit.TextStreamVerifier.Group::add)); return this; } diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/MacHelper.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/MacHelper.java index dc1a7b3512b..1191cd02221 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/MacHelper.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/MacHelper.java @@ -782,6 +782,10 @@ public final class MacHelper { return sign(cmd); } + public Optional optionName() { + return type.mapOptionName(certRequest.type()); + } + public List asCmdlineArgs() { String[] args = new String[2]; applyTo((optionName, optionValue) -> { @@ -791,6 +795,10 @@ public final class MacHelper { return List.of(args); } + public Optional passThrough() { + return optionName().map(Name::passThrough); + } + private void applyTo(BiConsumer sink) { type.mapOptionName(certRequest.type()).ifPresent(optionName -> { sink.accept(optionName.optionName(), optionValue()); @@ -886,6 +894,14 @@ public final class MacHelper { return signKeyOption.certRequest(); } + public Optional optionName() { + return signKeyOption.optionName(); + } + + public Optional passThrough() { + return signKeyOption.passThrough(); + } + public JPackageCommand addTo(JPackageCommand cmd) { Optional.ofNullable(cmd.getArgumentValue("--mac-signing-keychain")).ifPresentOrElse(configuredKeychain -> { if (!configuredKeychain.equals(keychain.name())) { diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java index 1639beadb28..7666d1e5167 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java @@ -65,6 +65,7 @@ import java.util.function.BiPredicate; import java.util.function.Consumer; import java.util.function.Predicate; import java.util.function.Supplier; +import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.Stream; import jdk.internal.util.OperatingSystem; @@ -1082,6 +1083,11 @@ public final class TKit { predicate(String::contains); } + TextStreamVerifier(Pattern value) { + this(Objects.requireNonNull(value).pattern()); + predicate(value.asPredicate()); + } + TextStreamVerifier(TextStreamVerifier other) { predicate = other.predicate; label = other.label; @@ -1091,6 +1097,10 @@ public final class TKit { value = other.value; } + public TextStreamVerifier copy() { + return new TextStreamVerifier(this); + } + public TextStreamVerifier label(String v) { label = v; return this; @@ -1101,6 +1111,13 @@ public final class TKit { return this; } + public TextStreamVerifier predicate(Predicate v) { + Objects.requireNonNull(v); + return predicate((str, _) -> { + return v.test(str); + }); + } + public TextStreamVerifier negate() { negate = true; return this; @@ -1116,7 +1133,12 @@ public final class TKit { return this; } - private String findMatch(Iterator lineIt) { + public TextStreamVerifier mutate(Consumer mutator) { + mutator.accept(this); + return this; + } + + private String find(Iterator lineIt) { while (lineIt.hasNext()) { final var line = lineIt.next(); if (predicate.test(line, value)) { @@ -1131,7 +1153,7 @@ public final class TKit { } public void apply(Iterator lineIt) { - final String matchedStr = findMatch(lineIt); + final String matchedStr = find(lineIt); final String labelStr = Optional.ofNullable(label).orElse("output"); if (negate) { String msg = String.format( @@ -1180,6 +1202,11 @@ public final class TKit { return this; } + public Group mutate(Consumer mutator) { + mutator.accept(this); + return this; + } + public boolean isEmpty() { return verifiers.isEmpty(); } @@ -1226,6 +1253,18 @@ public final class TKit { return new TextStreamVerifier(what); } + public static TextStreamVerifier assertTextStream(Pattern what) { + return new TextStreamVerifier(what); + } + + public static Consumer> assertEndOfTextStream() { + return it -> { + var tail = new ArrayList(); + it.forEachRemaining(tail::add); + assertStringListEquals(List.of(), tail, "Check the end of the output"); + }; + } + public record PathSnapshot(List contentHashes) { public PathSnapshot { contentHashes.forEach(Objects::requireNonNull); diff --git a/test/jdk/tools/jpackage/junit/share/jdk.jpackage/jdk/jpackage/internal/cli/MainTest.java b/test/jdk/tools/jpackage/junit/share/jdk.jpackage/jdk/jpackage/internal/cli/MainTest.java index 79648260274..46de970a829 100644 --- a/test/jdk/tools/jpackage/junit/share/jdk.jpackage/jdk/jpackage/internal/cli/MainTest.java +++ b/test/jdk/tools/jpackage/junit/share/jdk.jpackage/jdk/jpackage/internal/cli/MainTest.java @@ -279,9 +279,7 @@ public class MainTest extends JUnitAdapter { expectedOutput.add(ExceptionFormatter.STACK_TRACE); } expectedOutput.add(expect.getValue()); - if (!verbose) { - expectedOutput.add(ExceptionFormatter.FAILED_COMMAND_OUTPUT); - } + expectedOutput.add(ExceptionFormatter.FAILED_COMMAND_OUTPUT); data.add(new ErrorReporterTestSpec(cause, expect.getKey(), verbose, expectedOutput)); } } diff --git a/test/jdk/tools/jpackage/macosx/MacSignTest.java b/test/jdk/tools/jpackage/macosx/MacSignTest.java index a824fdb0925..0be494ea469 100644 --- a/test/jdk/tools/jpackage/macosx/MacSignTest.java +++ b/test/jdk/tools/jpackage/macosx/MacSignTest.java @@ -22,22 +22,23 @@ */ import static jdk.jpackage.test.MacHelper.SignKeyOption.Type.SIGN_KEY_IDENTITY; +import static jdk.jpackage.test.MacHelper.SignKeyOption.Type.SIGN_KEY_IDENTITY_APP_IMAGE; import static jdk.jpackage.test.MacHelper.SignKeyOption.Type.SIGN_KEY_USER_FULL_NAME; import static jdk.jpackage.test.MacHelper.SignKeyOption.Type.SIGN_KEY_USER_SHORT_NAME; -import static jdk.jpackage.test.MacHelper.SignKeyOption.Type.SIGN_KEY_IDENTITY_APP_IMAGE; import java.io.IOException; import java.nio.file.Files; -import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.function.Function; import java.util.function.Predicate; +import java.util.regex.Pattern; import java.util.stream.Stream; import jdk.jpackage.test.Annotations.Parameter; import jdk.jpackage.test.Annotations.ParameterSupplier; import jdk.jpackage.test.Annotations.Test; import jdk.jpackage.test.CannedFormattedString; +import jdk.jpackage.test.FailedCommandErrorValidator; import jdk.jpackage.test.JPackageCommand; import jdk.jpackage.test.JPackageStringBundle; import jdk.jpackage.test.MacHelper; @@ -74,22 +75,32 @@ public class MacSignTest { Files.createDirectory(appContent); Files.createFile(appContent.resolve("file")); - final List expectedStrings = new ArrayList<>(); - expectedStrings.add(JPackageStringBundle.MAIN.cannedFormattedString("message.codesign.failed.reason.app.content")); + final var group = TKit.TextStreamVerifier.group(); - expectedStrings.add(JPackageStringBundle.MAIN.cannedFormattedString("error.tool.failed.with.output", "codesign")); + group.add(TKit.assertTextStream(JPackageStringBundle.MAIN.cannedFormattedString( + "message.codesign.failed.reason.app.content").getValue()).predicate(String::equals)); + + final var xcodeWarning = TKit.assertTextStream(JPackageStringBundle.MAIN.cannedFormattedString( + "message.codesign.failed.reason.xcode.tools").getValue()).predicate(String::equals); - final var xcodeWarning = JPackageStringBundle.MAIN.cannedFormattedString("message.codesign.failed.reason.xcode.tools"); if (!MacHelper.isXcodeDevToolsInstalled()) { - expectedStrings.add(xcodeWarning); + group.add(xcodeWarning); } - MacSign.withKeychain(keychain -> { + var keychain = SigningBase.StandardKeychain.MAIN.keychain(); - var signingKeyOption = new SignKeyOptionWithKeychain( - SIGN_KEY_IDENTITY, - SigningBase.StandardCertificateRequest.CODESIGN, - keychain); + var signingKeyOption = new SignKeyOptionWithKeychain( + SIGN_KEY_IDENTITY, + SigningBase.StandardCertificateRequest.CODESIGN, + keychain); + + new FailedCommandErrorValidator(Pattern.compile(String.format( + "/usr/bin/codesign -s %s -vvvv --timestamp --options runtime --prefix \\S+ --keychain %s --entitlements \\S+ \\S+", + Pattern.quote(String.format("'%s'", signingKeyOption.certRequest().name())), + Pattern.quote(keychain.name()) + ))).exitCode(1).createGroup().mutate(group::add); + + MacSign.withKeychain(_ -> { // --app-content and --type app-image // Expect `message.codesign.failed.reason.app.content` message in the log. @@ -97,51 +108,49 @@ public class MacSignTest { // To make jpackage fail, specify bad additional content. JPackageCommand.helloAppImage() .ignoreDefaultVerbose(true) - .validateOutput(expectedStrings.toArray(CannedFormattedString[]::new)) + .validateOutput(group.create()) .addArguments("--app-content", appContent) .mutate(signingKeyOption::addTo) .mutate(cmd -> { if (MacHelper.isXcodeDevToolsInstalled()) { // Check there is no warning about missing xcode command line developer tools. - cmd.validateOutput(TKit.assertTextStream(xcodeWarning.getValue()).negate()); + cmd.validateOutput(xcodeWarning.copy().negate()); } }).execute(1); - }, MacSign.Keychain.UsageBuilder::addToSearchList, SigningBase.StandardKeychain.MAIN.keychain()); + }, MacSign.Keychain.UsageBuilder::addToSearchList, keychain); } @Test - public static void testCodesignUnspecifiedFailure() throws IOException { - - var appImageCmd = JPackageCommand.helloAppImage().setFakeRuntime(); - - appImageCmd.executeIgnoreExitCode().assertExitCodeIsZero(); + public static void testCodesignUnspecificFailure() throws IOException { // This test expects jpackage to respond in a specific way on a codesign failure. - // The simplest option to trigger codesign failure is to request the signing of an invalid bundle. - // Create app content directory with the name known to fail signing. - final var appContent = appImageCmd.appLayout().contentDirectory().resolve("foo.1"); - Files.createDirectory(appContent); - Files.createFile(appContent.resolve("file")); + // There are a few ways to make jpackage fail signing. One is using an erroneous + // combination of a signing key and a keychain. - final List expectedStrings = new ArrayList<>(); - expectedStrings.add(JPackageStringBundle.MAIN.cannedFormattedString("error.tool.failed.with.output", "codesign")); + var signingKeyOption = new SignKeyOption( + SIGN_KEY_IDENTITY, + SigningBase.StandardCertificateRequest.CODESIGN_ACME_TECH_LTD.certRequest( + SigningBase.StandardKeychain.MAIN.keychain())); MacSign.withKeychain(keychain -> { - var signingKeyOption = new SignKeyOptionWithKeychain( - SIGN_KEY_IDENTITY, - SigningBase.StandardCertificateRequest.CODESIGN, - keychain); + // Build a matcher for jpackage's failed command output. + var errorValidator = new FailedCommandErrorValidator(Pattern.compile(String.format( + "/usr/bin/codesign -s %s -vvvv --timestamp --options runtime --prefix \\S+ --keychain %s", + Pattern.quote(String.format("'%s'", signingKeyOption.certRequest().name())), + Pattern.quote(keychain.name()) + ))).exitCode(1).output(String.format("%s: no identity found", signingKeyOption.certRequest().name())).createGroup(); - new JPackageCommand().setPackageType(PackageType.IMAGE) + JPackageCommand.helloAppImage() + .setFakeRuntime() .ignoreDefaultVerbose(true) - .validateOutput(expectedStrings.toArray(CannedFormattedString[]::new)) - .addArguments("--app-image", appImageCmd.outputBundle()) + .validateOutput(errorValidator.create()) .mutate(signingKeyOption::addTo) + .mutate(MacHelper.useKeychain(keychain)) .execute(1); - }, MacSign.Keychain.UsageBuilder::addToSearchList, SigningBase.StandardKeychain.MAIN.keychain()); + }, MacSign.Keychain.UsageBuilder::addToSearchList, SigningBase.StandardKeychain.DUPLICATE.keychain()); } @Test From 9cd25d517c25477be6643bfb795843ca080d4e38 Mon Sep 17 00:00:00 2001 From: Martin Doerr Date: Sat, 7 Feb 2026 11:18:01 +0000 Subject: [PATCH 015/120] 8377359: TestOpaqueConstantBoolNodes fails on PPC64 Reviewed-by: dbriemann, chagedorn --- .../compiler/intrinsics/string/TestOpaqueConstantBoolNodes.java | 1 + 1 file changed, 1 insertion(+) diff --git a/test/hotspot/jtreg/compiler/intrinsics/string/TestOpaqueConstantBoolNodes.java b/test/hotspot/jtreg/compiler/intrinsics/string/TestOpaqueConstantBoolNodes.java index 66f3da23abe..b8db97f7ecb 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/string/TestOpaqueConstantBoolNodes.java +++ b/test/hotspot/jtreg/compiler/intrinsics/string/TestOpaqueConstantBoolNodes.java @@ -40,6 +40,7 @@ public class TestOpaqueConstantBoolNodes { public static void main(String[] args) { TestFramework.runWithFlags( + "-XX:CompileCommand=inline,java.lang.String::*", "-XX:CompileCommand=inline,java.lang.StringCoding::*", "-XX:CompileCommand=exclude,jdk.internal.util.Preconditions::checkFromIndexSize"); } From 6665a78ee27617a5c9f272ee4471625a64636ac7 Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Sat, 7 Feb 2026 18:20:55 +0000 Subject: [PATCH 016/120] 8376688: Gtest os.attempt_reserve_memory_between_small_range_fill_hole_vm fails on AIX 7.3 Reviewed-by: mdoerr, lucy --- test/hotspot/gtest/runtime/test_os_reserve_between.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/hotspot/gtest/runtime/test_os_reserve_between.cpp b/test/hotspot/gtest/runtime/test_os_reserve_between.cpp index 8e68be22749..7c256c7c3db 100644 --- a/test/hotspot/gtest/runtime/test_os_reserve_between.cpp +++ b/test/hotspot/gtest/runtime/test_os_reserve_between.cpp @@ -335,6 +335,8 @@ TEST_VM(os, attempt_reserve_memory_randomization_cornercases) { // Test that, regardless where the hole is in the [min, max) range, if we probe nonrandomly, we will fill that hole // as long as the range size is smaller than the number of probe attempts +// On AIX, the allocation granularity is too large and not well suited for 'small' holes, so we avoid the test +#if !defined(_AIX) TEST_VM(os, attempt_reserve_memory_between_small_range_fill_hole) { const size_t ps = os::vm_page_size(); const size_t ag = allocation_granularity(); @@ -348,3 +350,4 @@ TEST_VM(os, attempt_reserve_memory_between_small_range_fill_hole) { } } } +#endif From ffb6279c885e9d9a1a53ce7657390e286136c4b7 Mon Sep 17 00:00:00 2001 From: Chen Liang Date: Sun, 8 Feb 2026 01:29:48 +0000 Subject: [PATCH 017/120] 8377334: Test framework used by langtools regression tests can produce false positives Co-authored-by: Vicente Romero Reviewed-by: vromero --- .../combo/tools/javac/combo/JavacTemplateTestBase.java | 5 +++-- .../tools/javac/records/RecordCompilationTests.java | 8 ++++---- .../tools/javac/sealed/SealedCompilationTests.java | 5 +++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/test/langtools/lib/combo/tools/javac/combo/JavacTemplateTestBase.java b/test/langtools/lib/combo/tools/javac/combo/JavacTemplateTestBase.java index 02c94b589c8..dd3f5639c21 100644 --- a/test/langtools/lib/combo/tools/javac/combo/JavacTemplateTestBase.java +++ b/test/langtools/lib/combo/tools/javac/combo/JavacTemplateTestBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -246,7 +246,8 @@ public abstract class JavacTemplateTestBase { return destDir; } else { - ct.analyze(); + ct.call(); + // Failed result will show up in diags return nullDir; } } diff --git a/test/langtools/tools/javac/records/RecordCompilationTests.java b/test/langtools/tools/javac/records/RecordCompilationTests.java index 1de0ec48f0d..a8384ba4692 100644 --- a/test/langtools/tools/javac/records/RecordCompilationTests.java +++ b/test/langtools/tools/javac/records/RecordCompilationTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -335,7 +335,7 @@ class RecordCompilationTests extends CompilationTestCase { assertFail("compiler.err.invalid.accessor.method.in.record", "public record R(int x) {\n" + - " static private final j = 0;" + + " static private final int j = 0;" + " static public int x() { return j; };" + "}"); } @@ -539,10 +539,10 @@ class RecordCompilationTests extends CompilationTestCase { "record R() { void test1() { class X { U u; } } }", "interface I { default void test1() { class X { void test2() { System.err.println(localVar); } } } }", - "interface I() { default void test1() { class X { void test2() {System.err.println(param);} } } }", + "interface I { default void test1() { class X { void test2() {System.err.println(param);} } } }", "interface I { default void test1() { class X { void test2() { System.err.println(instanceField); } } } }", "interface I { default void test1() { class X { T t; } } }", - "interface I() { default void test1() { class X {U u;} } }", + "interface I { default void test1() { class X {U u;} } }", "enum E { A; void test1() { class X { void test2() { System.err.println(localVar); } } } }", "enum E { A; void test1() { class X { void test2() {System.err.println(param);} } } }", diff --git a/test/langtools/tools/javac/sealed/SealedCompilationTests.java b/test/langtools/tools/javac/sealed/SealedCompilationTests.java index 17141ee3c67..b7207b777c6 100644 --- a/test/langtools/tools/javac/sealed/SealedCompilationTests.java +++ b/test/langtools/tools/javac/sealed/SealedCompilationTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -855,12 +855,13 @@ class SealedCompilationTests extends CompilationTestCase { @Test void testSealedNonSealedWithOtherModifiers() { + // Sup must be static so Sub may be static String template1 = """ @interface A {} class Outer { - sealed class Sup { } + static sealed class Sup { } # # class Sub extends Sup {} final class Sub2 extends Sub {} } From dc80ce7aec8e466a29fd4c94ee70c90a7244869f Mon Sep 17 00:00:00 2001 From: ikarostsin Date: Mon, 9 Feb 2026 07:41:20 +0000 Subject: [PATCH 018/120] 8374056: RISC-V: Fix argument passing for the RiscvFlushIcache::flush Reviewed-by: fyang, rehn --- src/hotspot/cpu/riscv/icache_riscv.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hotspot/cpu/riscv/icache_riscv.cpp b/src/hotspot/cpu/riscv/icache_riscv.cpp index 258bc665770..20de2dbb2ad 100644 --- a/src/hotspot/cpu/riscv/icache_riscv.cpp +++ b/src/hotspot/cpu/riscv/icache_riscv.cpp @@ -39,7 +39,8 @@ static int icache_flush(address addr, int lines, int magic) { // We need to make sure stores happens before the I/D cache synchronization. __asm__ volatile("fence rw, rw" : : : "memory"); - RiscvFlushIcache::flush((uintptr_t)addr, ((uintptr_t)lines) << ICache::log2_line_size); + uintptr_t end = (uintptr_t)addr + ((uintptr_t)lines << ICache::log2_line_size); + RiscvFlushIcache::flush((uintptr_t)addr, end); return magic; } From 1314857b335502998e22f114b401c29af2517548 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Mon, 9 Feb 2026 08:49:30 +0000 Subject: [PATCH 019/120] 8377443: G1: Remove unnecessary cast in ResizeTLABAndSwapCardTableTask Reviewed-by: ayang --- src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp b/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp index 46d12df575c..3f47d386015 100644 --- a/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp +++ b/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp @@ -854,7 +854,7 @@ public: void do_thread(Thread* thread) { if (UseTLAB && ResizeTLAB) { - static_cast(thread)->tlab().resize(); + thread->tlab().resize(); } G1BarrierSet::g1_barrier_set()->update_card_table_base(thread); From ee5b10c7f0ac5dba69d69fdd4b8a30b6443e6720 Mon Sep 17 00:00:00 2001 From: Ramkumar Sunderbabu Date: Mon, 9 Feb 2026 09:03:47 +0000 Subject: [PATCH 020/120] 8375443: AVX-512: Disabling through UseSHA doesn't affect UseSHA3Intrinsics Reviewed-by: mhaessig, kvn --- src/hotspot/cpu/x86/vm_version_x86.cpp | 14 +- ...nsicsWithUseSHADisabledOnSupportedCPU.java | 150 +++++++++++++++++ ...icsWithUseSHADisabledOnUnsupportedCPU.java | 153 ++++++++++++++++++ 3 files changed, 310 insertions(+), 7 deletions(-) create mode 100644 test/hotspot/jtreg/compiler/arguments/TestUseSHA3IntrinsicsWithUseSHADisabledOnSupportedCPU.java create mode 100644 test/hotspot/jtreg/compiler/arguments/TestUseSHA3IntrinsicsWithUseSHADisabledOnUnsupportedCPU.java diff --git a/src/hotspot/cpu/x86/vm_version_x86.cpp b/src/hotspot/cpu/x86/vm_version_x86.cpp index eb401e4f877..c65c1c7d219 100644 --- a/src/hotspot/cpu/x86/vm_version_x86.cpp +++ b/src/hotspot/cpu/x86/vm_version_x86.cpp @@ -1359,16 +1359,16 @@ void VM_Version::get_processor_features() { FLAG_SET_DEFAULT(UseSHA512Intrinsics, false); } - if (supports_evex() && supports_avx512bw()) { - if (FLAG_IS_DEFAULT(UseSHA3Intrinsics)) { - UseSHA3Intrinsics = true; - } + if (UseSHA && supports_evex() && supports_avx512bw()) { + if (FLAG_IS_DEFAULT(UseSHA3Intrinsics)) { + FLAG_SET_DEFAULT(UseSHA3Intrinsics, true); + } } else if (UseSHA3Intrinsics) { - warning("Intrinsics for SHA3-224, SHA3-256, SHA3-384 and SHA3-512 crypto hash functions not available on this CPU."); - FLAG_SET_DEFAULT(UseSHA3Intrinsics, false); + warning("Intrinsics for SHA3-224, SHA3-256, SHA3-384 and SHA3-512 crypto hash functions not available on this CPU."); + FLAG_SET_DEFAULT(UseSHA3Intrinsics, false); } - if (!(UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics)) { + if (!(UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics || UseSHA3Intrinsics)) { FLAG_SET_DEFAULT(UseSHA, false); } diff --git a/test/hotspot/jtreg/compiler/arguments/TestUseSHA3IntrinsicsWithUseSHADisabledOnSupportedCPU.java b/test/hotspot/jtreg/compiler/arguments/TestUseSHA3IntrinsicsWithUseSHADisabledOnSupportedCPU.java new file mode 100644 index 00000000000..2461f1ae92b --- /dev/null +++ b/test/hotspot/jtreg/compiler/arguments/TestUseSHA3IntrinsicsWithUseSHADisabledOnSupportedCPU.java @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * 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 8375443 + * @summary Verify that UseSHA3Intrinsics is properly disabled when UseSHA is disabled + * on supported CPU + * @library /test/lib / + * @requires vm.flagless + + * + * @build jdk.test.whitebox.WhiteBox + * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI + * compiler.arguments.TestUseSHA3IntrinsicsWithUseSHADisabledOnSupportedCPU + */ + +package compiler.arguments; + +import compiler.testlibrary.sha.predicate.IntrinsicPredicates; +import jdk.test.lib.cli.CommandLineOptionTest; +import jdk.test.lib.process.ExitCode; +import jtreg.SkippedException; + +public class TestUseSHA3IntrinsicsWithUseSHADisabledOnSupportedCPU { + private static final String OPTION_NAME = "UseSHA3Intrinsics"; + private static final String MASTER_OPTION = "UseSHA"; + private static final String WARNING_MESSAGE = + "Intrinsics for SHA3-224, SHA3-256, SHA3-384 and SHA3-512 crypto hash functions not available on this CPU\\."; + private static final String UNLOCK_DIAGNOSTIC = "-XX:+UnlockDiagnosticVMOptions"; + + public static void main(String[] args) throws Throwable { + if (!IntrinsicPredicates.isSHA3IntrinsicAvailable().getAsBoolean()) { + throw new SkippedException("Skipping... SHA3 intrinsics are not available on this platform."); + } + + // Verify that UseSHA3Intrinsics can be explicitly enabled when UseSHA is enabled (default) + testExplicitEnableWithUseSHAEnabled(); + + // Verify that UseSHA3Intrinsics is forced to false when UseSHA is disabled, + // even if explicitly set to true + testForcedDisableWhenUseSHADisabled(); + + // Verify that a warning is printed when trying to enable UseSHA3Intrinsics + // while UseSHA is disabled + testWarningWhenEnablingWithUseSHADisabled(); + + // Verify that UseSHA3Intrinsics can be explicitly disabled even when UseSHA is enabled + testExplicitDisableWithUseSHAEnabled(); + } + + private static void testExplicitEnableWithUseSHAEnabled() throws Throwable { + // Verify the option value is true when explicitly enabled (with UseSHA enabled by default) + CommandLineOptionTest.verifyOptionValueForSameVM( + OPTION_NAME, + "true", + "UseSHA3Intrinsics should be enabled when explicitly set to true with UseSHA enabled", + UNLOCK_DIAGNOSTIC, + CommandLineOptionTest.prepareBooleanFlag(OPTION_NAME, true) + ); + + // Verify no warning is printed when enabling UseSHA3Intrinsics with UseSHA enabled + CommandLineOptionTest.verifySameJVMStartup( + null, // No specific output expected + new String[] { WARNING_MESSAGE }, // Warning should not appear + "No warning should be printed when enabling UseSHA3Intrinsics with UseSHA enabled", + "UseSHA3Intrinsics should be enabled without warnings when UseSHA is enabled", + ExitCode.OK, + UNLOCK_DIAGNOSTIC, + CommandLineOptionTest.prepareBooleanFlag(OPTION_NAME, true) + ); + } + + private static void testForcedDisableWhenUseSHADisabled() throws Throwable { + // When -XX:-UseSHA is set, UseSHA3Intrinsics should be forced to false + // even if +UseSHA3Intrinsics is explicitly passed + CommandLineOptionTest.verifyOptionValueForSameVM( + OPTION_NAME, + "false", + String.format("UseSHA3Intrinsics should be forced to false when %s is set, " + + "even if explicitly enabled", + CommandLineOptionTest.prepareBooleanFlag(MASTER_OPTION, false)), + UNLOCK_DIAGNOSTIC, + CommandLineOptionTest.prepareBooleanFlag(OPTION_NAME, true), + CommandLineOptionTest.prepareBooleanFlag(MASTER_OPTION, false) + ); + } + + private static void testWarningWhenEnablingWithUseSHADisabled() throws Throwable { + // A warning should be printed when trying to enable UseSHA3Intrinsics with -UseSHA + CommandLineOptionTest.verifySameJVMStartup( + new String[] { WARNING_MESSAGE }, // Warning should appear + null, // No unexpected output + "JVM should start successfully", + String.format("A warning should be printed when trying to enable %s while %s is disabled", + OPTION_NAME, + MASTER_OPTION), + ExitCode.OK, + UNLOCK_DIAGNOSTIC, + CommandLineOptionTest.prepareBooleanFlag(MASTER_OPTION, false), + CommandLineOptionTest.prepareBooleanFlag(OPTION_NAME, true) + ); + } + + private static void testExplicitDisableWithUseSHAEnabled() throws Throwable { + // Verify that UseSHA3Intrinsics can be explicitly disabled even when UseSHA is enabled + CommandLineOptionTest.verifyOptionValueForSameVM( + OPTION_NAME, + "false", + "UseSHA3Intrinsics should be disabled when explicitly set to false", + UNLOCK_DIAGNOSTIC, + CommandLineOptionTest.prepareBooleanFlag(MASTER_OPTION, true), + CommandLineOptionTest.prepareBooleanFlag(OPTION_NAME, false) + ); + + // Verify no warning is printed when explicitly disabling UseSHA3Intrinsics + CommandLineOptionTest.verifySameJVMStartup( + null, // No specific output expected + new String[] { WARNING_MESSAGE }, // Warning should not appear + "No warning should be printed when explicitly disabling UseSHA3Intrinsics", + "UseSHA3Intrinsics should be disabled without warnings", + ExitCode.OK, + UNLOCK_DIAGNOSTIC, + CommandLineOptionTest.prepareBooleanFlag(MASTER_OPTION, true), + CommandLineOptionTest.prepareBooleanFlag(OPTION_NAME, false) + ); + } +} diff --git a/test/hotspot/jtreg/compiler/arguments/TestUseSHA3IntrinsicsWithUseSHADisabledOnUnsupportedCPU.java b/test/hotspot/jtreg/compiler/arguments/TestUseSHA3IntrinsicsWithUseSHADisabledOnUnsupportedCPU.java new file mode 100644 index 00000000000..067bc723b5c --- /dev/null +++ b/test/hotspot/jtreg/compiler/arguments/TestUseSHA3IntrinsicsWithUseSHADisabledOnUnsupportedCPU.java @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * 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 8375443 + * @summary Verify that UseSHA3Intrinsics is properly disabled with warnings + * on unsupported CPU. + * @library /test/lib / + * @requires vm.flagless + * + * @build jdk.test.whitebox.WhiteBox + * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI + * compiler.arguments.TestUseSHA3IntrinsicsWithUseSHADisabledOnUnsupportedCPU + */ + +package compiler.arguments; + +import compiler.testlibrary.sha.predicate.IntrinsicPredicates; +import jdk.test.lib.cli.CommandLineOptionTest; +import jdk.test.lib.process.ExitCode; +import jtreg.SkippedException; + +public class TestUseSHA3IntrinsicsWithUseSHADisabledOnUnsupportedCPU { + private static final String OPTION_NAME = "UseSHA3Intrinsics"; + private static final String MASTER_OPTION = "UseSHA"; + private static final String WARNING_MESSAGE = + "Intrinsics for SHA3-224, SHA3-256, SHA3-384 and SHA3-512 crypto hash functions not available on this CPU\\."; + private static final String UNLOCK_DIAGNOSTIC = "-XX:+UnlockDiagnosticVMOptions"; + + public static void main(String[] args) throws Throwable { + if (IntrinsicPredicates.isSHA3IntrinsicAvailable().getAsBoolean()) { + throw new SkippedException("Skipping... SHA3 intrinsics are available on this platform."); + } + + // Verify that UseSHA3Intrinsics remains false when UseSHA is enabled + // but CPU doesn't support the instructions + testRemainsDisabledWithUseSHAEnabled(); + + // Verify that explicitly disabling UseSHA3Intrinsics works without warnings + testExplicitDisableWithoutWarning(); + + // Verify behavior with both -XX:-UseSHA and +XX:+UseSHA3Intrinsics + testWithUseSHADisabled(); + } + + private static void testRemainsDisabledWithUseSHAEnabled() throws Throwable { + // Even with +UseSHA, UseSHA3Intrinsics should remain false on unsupported CPU + CommandLineOptionTest.verifyOptionValueForSameVM( + OPTION_NAME, + "false", + "UseSHA3Intrinsics should remain false even when UseSHA is enabled on unsupported CPU", + UNLOCK_DIAGNOSTIC, + CommandLineOptionTest.prepareBooleanFlag(MASTER_OPTION, true) + ); + + // Trying to enable both should still produce a warning + CommandLineOptionTest.verifySameJVMStartup( + new String[] { WARNING_MESSAGE }, + null, + "JVM should start with a warning", + "Warning should be printed even when UseSHA is explicitly enabled", + ExitCode.OK, + UNLOCK_DIAGNOSTIC, + CommandLineOptionTest.prepareBooleanFlag(MASTER_OPTION, true), + CommandLineOptionTest.prepareBooleanFlag(OPTION_NAME, true) + ); + } + + private static void testExplicitDisableWithoutWarning() throws Throwable { + // Explicitly disabling should not produce any warnings + CommandLineOptionTest.verifySameJVMStartup( + null, // No specific output expected + new String[] { WARNING_MESSAGE }, // Warning should NOT appear + "JVM should start without warnings", + "No warning should be printed when explicitly disabling UseSHA3Intrinsics", + ExitCode.OK, + UNLOCK_DIAGNOSTIC, + CommandLineOptionTest.prepareBooleanFlag(OPTION_NAME, false) + ); + + // Verify the flag value is false + CommandLineOptionTest.verifyOptionValueForSameVM( + OPTION_NAME, + "false", + "UseSHA3Intrinsics should be false when explicitly disabled", + UNLOCK_DIAGNOSTIC, + CommandLineOptionTest.prepareBooleanFlag(OPTION_NAME, false) + ); + } + + private static void testWithUseSHADisabled() throws Throwable { + // When UseSHA is disabled, UseSHA3Intrinsics should also be disabled + // and a warning should be printed + CommandLineOptionTest.verifySameJVMStartup( + new String[] { WARNING_MESSAGE }, + null, + "JVM should start with a warning", + String.format("Warning should be printed when trying to enable %s while %s is disabled on unsupported CPU", + OPTION_NAME, + MASTER_OPTION), + ExitCode.OK, + UNLOCK_DIAGNOSTIC, + CommandLineOptionTest.prepareBooleanFlag(MASTER_OPTION, false), + CommandLineOptionTest.prepareBooleanFlag(OPTION_NAME, true) + ); + + // Verify the flag is forced to false + CommandLineOptionTest.verifyOptionValueForSameVM( + OPTION_NAME, + "false", + String.format("UseSHA3Intrinsics should be false when %s is disabled on unsupported CPU", + MASTER_OPTION), + UNLOCK_DIAGNOSTIC, + CommandLineOptionTest.prepareBooleanFlag(MASTER_OPTION, false), + CommandLineOptionTest.prepareBooleanFlag(OPTION_NAME, true) + ); + + // Test that with both flags disabled, no warning appears + CommandLineOptionTest.verifySameJVMStartup( + null, + new String[] { WARNING_MESSAGE }, + "JVM should start without warnings", + "No warning when both UseSHA and UseSHA3Intrinsics are disabled", + ExitCode.OK, + UNLOCK_DIAGNOSTIC, + CommandLineOptionTest.prepareBooleanFlag(MASTER_OPTION, false), + CommandLineOptionTest.prepareBooleanFlag(OPTION_NAME, false) + ); + } +} From a7bf468a8fd86bf2845acef8aea1462f865c8182 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Mon, 9 Feb 2026 09:44:28 +0000 Subject: [PATCH 021/120] 8377165: G1: Introduce common G1 GC Mark to collect scoped objects Reviewed-by: iwalulya, ayang --- src/hotspot/share/gc/g1/g1CollectedHeap.cpp | 38 +++++++++++++-------- src/hotspot/share/gc/g1/g1FullCollector.cpp | 2 +- src/hotspot/share/gc/g1/g1FullCollector.hpp | 14 +------- src/hotspot/share/gc/g1/g1FullGCScope.cpp | 7 ++-- src/hotspot/share/gc/g1/g1FullGCScope.hpp | 9 ++--- 5 files changed, 31 insertions(+), 39 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp index 9424a804bd8..8fc2c7c9941 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp @@ -138,6 +138,26 @@ void G1RegionMappingChangedListener::on_commit(uint start_idx, size_t num_region reset_from_card_cache(start_idx, num_regions); } +// Collects commonly used scoped objects that are related to initial setup. +class G1GCMark : StackObj { + ResourceMark _rm; + IsSTWGCActiveMark _active_gc_mark; + GCIdMark _gc_id_mark; + SvcGCMarker _sgcm; + GCTraceCPUTime _tcpu; + +public: + G1GCMark(GCTracer* tracer, bool is_full_gc) : + _rm(), + _active_gc_mark(), + _gc_id_mark(), + _sgcm(is_full_gc ? SvcGCMarker::FULL : SvcGCMarker::MINOR), + _tcpu(tracer) { + + assert_at_safepoint_on_vm_thread(); + } +}; + void G1CollectedHeap::run_batch_task(G1BatchedTask* cl) { uint num_workers = MAX2(1u, MIN2(cl->num_workers_estimate(), workers()->active_workers())); cl->set_max_workers(num_workers); @@ -914,12 +934,11 @@ void G1CollectedHeap::verify_after_full_collection() { void G1CollectedHeap::do_full_collection(size_t allocation_word_size, bool clear_all_soft_refs, bool do_maximal_compaction) { - assert_at_safepoint_on_vm_thread(); - - G1FullGCMark gc_mark; + G1FullGCTracer tracer; + G1GCMark gc_mark(&tracer, true /* is_full_gc */); GCTraceTime(Info, gc) tm("Pause Full", nullptr, gc_cause(), true); - G1FullCollector collector(this, clear_all_soft_refs, do_maximal_compaction, gc_mark.tracer()); + G1FullCollector collector(this, clear_all_soft_refs, do_maximal_compaction, &tracer); collector.prepare_collection(); collector.collect(); collector.complete_collection(allocation_word_size); @@ -2714,16 +2733,7 @@ void G1CollectedHeap::flush_region_pin_cache() { } void G1CollectedHeap::do_collection_pause_at_safepoint(size_t allocation_word_size) { - assert_at_safepoint_on_vm_thread(); - assert(!is_stw_gc_active(), "collection is not reentrant"); - - ResourceMark rm; - - IsSTWGCActiveMark active_gc_mark; - GCIdMark gc_id_mark; - SvcGCMarker sgcm(SvcGCMarker::MINOR); - - GCTraceCPUTime tcpu(_gc_tracer_stw); + G1GCMark gcm(_gc_tracer_stw, false /* is_full_gc */); _bytes_used_during_gc = 0; diff --git a/src/hotspot/share/gc/g1/g1FullCollector.cpp b/src/hotspot/share/gc/g1/g1FullCollector.cpp index 06db5f612a1..b6388c2f722 100644 --- a/src/hotspot/share/gc/g1/g1FullCollector.cpp +++ b/src/hotspot/share/gc/g1/g1FullCollector.cpp @@ -110,7 +110,7 @@ uint G1FullCollector::calc_active_workers() { G1FullCollector::G1FullCollector(G1CollectedHeap* heap, bool clear_soft_refs, bool do_maximal_compaction, - G1FullGCTracer* tracer) : + GCTracer* tracer) : _heap(heap), _scope(heap->monitoring_support(), clear_soft_refs, do_maximal_compaction, tracer), _num_workers(calc_active_workers()), diff --git a/src/hotspot/share/gc/g1/g1FullCollector.hpp b/src/hotspot/share/gc/g1/g1FullCollector.hpp index 7e455b07013..605556a2ba6 100644 --- a/src/hotspot/share/gc/g1/g1FullCollector.hpp +++ b/src/hotspot/share/gc/g1/g1FullCollector.hpp @@ -58,18 +58,6 @@ public: } }; -// Full GC Mark that holds GC id and CPU time trace. Needs to be separate -// from the G1FullCollector and G1FullGCScope to allow the Full GC logging -// to have the same structure as the Young GC logging. -class G1FullGCMark : StackObj { - GCIdMark _gc_id; - G1FullGCTracer _tracer; - GCTraceCPUTime _cpu_time; -public: - G1FullGCMark() : _gc_id(), _tracer(), _cpu_time(&_tracer) { } - G1FullGCTracer* tracer() { return &_tracer; } -}; - // The G1FullCollector holds data associated with the current Full GC. class G1FullCollector : StackObj { G1CollectedHeap* _heap; @@ -102,7 +90,7 @@ public: G1FullCollector(G1CollectedHeap* heap, bool clear_soft_refs, bool do_maximal_compaction, - G1FullGCTracer* tracer); + GCTracer* tracer); ~G1FullCollector(); void prepare_collection(); diff --git a/src/hotspot/share/gc/g1/g1FullGCScope.cpp b/src/hotspot/share/gc/g1/g1FullGCScope.cpp index 083b77b44b7..cb4ebe423ff 100644 --- a/src/hotspot/share/gc/g1/g1FullGCScope.cpp +++ b/src/hotspot/share/gc/g1/g1FullGCScope.cpp @@ -38,14 +38,11 @@ G1FullGCJFRTracerMark::~G1FullGCJFRTracerMark() { G1FullGCScope::G1FullGCScope(G1MonitoringSupport* monitoring_support, bool clear_soft, bool do_maximal_compaction, - G1FullGCTracer* tracer) : - _rm(), + GCTracer* tracer) : _should_clear_soft_refs(clear_soft), _do_maximal_compaction(do_maximal_compaction), - _svc_marker(SvcGCMarker::FULL), _timer(), _tracer(tracer), - _active(), _tracer_mark(&_timer, _tracer), _monitoring_scope(monitoring_support), _heap_printer(G1CollectedHeap::heap()), @@ -57,7 +54,7 @@ STWGCTimer* G1FullGCScope::timer() { return &_timer; } -G1FullGCTracer* G1FullGCScope::tracer() { +GCTracer* G1FullGCScope::tracer() { return _tracer; } diff --git a/src/hotspot/share/gc/g1/g1FullGCScope.hpp b/src/hotspot/share/gc/g1/g1FullGCScope.hpp index 278a00cedbd..fc9d5a71f92 100644 --- a/src/hotspot/share/gc/g1/g1FullGCScope.hpp +++ b/src/hotspot/share/gc/g1/g1FullGCScope.hpp @@ -46,13 +46,10 @@ public: // Class used to group scoped objects used in the Full GC together. class G1FullGCScope : public StackObj { - ResourceMark _rm; bool _should_clear_soft_refs; bool _do_maximal_compaction; - SvcGCMarker _svc_marker; STWGCTimer _timer; - G1FullGCTracer* _tracer; - IsSTWGCActiveMark _active; + GCTracer* _tracer; G1FullGCJFRTracerMark _tracer_mark; G1FullGCMonitoringScope _monitoring_scope; G1HeapPrinterMark _heap_printer; @@ -62,13 +59,13 @@ public: G1FullGCScope(G1MonitoringSupport* monitoring_support, bool clear_soft, bool do_maximal_compaction, - G1FullGCTracer* tracer); + GCTracer* tracer); bool should_clear_soft_refs() const { return _should_clear_soft_refs; } bool do_maximal_compaction() { return _do_maximal_compaction; } STWGCTimer* timer(); - G1FullGCTracer* tracer(); + GCTracer* tracer(); size_t region_compaction_threshold() const; }; From 07f78779e099d2dead74a05acf84ac4c457293b5 Mon Sep 17 00:00:00 2001 From: Guanqiang Han Date: Mon, 9 Feb 2026 09:47:45 +0000 Subject: [PATCH 022/120] 8376491: ZGC: crash in __memset_evex_unaligned_erms when initializing heap using high values for -XX:ConcGCThreads Reviewed-by: aboldtch, stefank --- src/hotspot/share/gc/z/zUtils.inline.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hotspot/share/gc/z/zUtils.inline.hpp b/src/hotspot/share/gc/z/zUtils.inline.hpp index b83f42d18e6..a221a925498 100644 --- a/src/hotspot/share/gc/z/zUtils.inline.hpp +++ b/src/hotspot/share/gc/z/zUtils.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * 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,6 +37,9 @@ inline uintptr_t ZUtils::alloc_aligned_unfreeable(size_t alignment, size_t size) { const size_t padded_size = size + (alignment - 1); void* const addr = os::malloc(padded_size, mtGC); + if (addr == nullptr) { + vm_exit_out_of_memory(padded_size, OOM_MALLOC_ERROR, "ZGC alloc_aligned_unfreeable malloc failed"); + } void* const aligned_addr = align_up(addr, alignment); memset(aligned_addr, 0, size); From b12367e19695a15a83ba85b58b4c22dce69d7075 Mon Sep 17 00:00:00 2001 From: Afshin Zafari Date: Mon, 9 Feb 2026 10:32:53 +0000 Subject: [PATCH 023/120] 8365381: [asan] exclude tests under ASAN build which rely on vm signal handling Reviewed-by: dholmes, syan --- .../AccessZeroNKlassHitsProtectionZone.java | 10 +++++++++- .../ErrorHandling/MachCodeFramesInErrorFile.java | 4 +++- .../jtreg/runtime/ErrorHandling/ResourceMarkTest.java | 4 +++- .../runtime/ErrorHandling/SecondaryErrorTest.java | 6 +++++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/AccessZeroNKlassHitsProtectionZone.java b/test/hotspot/jtreg/runtime/ErrorHandling/AccessZeroNKlassHitsProtectionZone.java index a9d957bac18..61d017d2264 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/AccessZeroNKlassHitsProtectionZone.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/AccessZeroNKlassHitsProtectionZone.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2025, Red Hat, Inc. - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. * 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 @@ * @library /test/lib * @requires vm.bits == 64 & vm.debug == true & vm.flagless * @requires os.family != "aix" + * @comment This test relies on crashing which conflicts with ASAN checks + * @requires !vm.asan * @modules java.base/jdk.internal.misc * java.management * @build jdk.test.whitebox.WhiteBox @@ -40,6 +42,8 @@ * @summary Test that dereferencing a Klass that is the result of a decode(0) crashes accessing the nKlass guard zone * @requires vm.cds & vm.bits == 64 & vm.debug == true & vm.flagless * @requires os.family != "aix" + * @comment This test relies on crashing which conflicts with ASAN checks + * @requires !vm.asan * @library /test/lib * @modules java.base/jdk.internal.misc * java.management @@ -53,6 +57,8 @@ * @summary Test that dereferencing a Klass that is the result of a decode(0) crashes accessing the nKlass guard zone * @requires vm.bits == 64 & vm.debug == true & vm.flagless * @requires os.family != "aix" + * @comment This test relies on crashing which conflicts with ASAN checks + * @requires !vm.asan * @library /test/lib * @modules java.base/jdk.internal.misc * java.management @@ -66,6 +72,8 @@ * @summary Test that dereferencing a Klass that is the result of a decode(0) crashes accessing the nKlass guard zone * @requires vm.cds & vm.bits == 64 & vm.debug == true & vm.flagless * @requires os.family != "aix" + * @comment This test relies on crashing which conflicts with ASAN checks + * @requires !vm.asan * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/MachCodeFramesInErrorFile.java b/test/hotspot/jtreg/runtime/ErrorHandling/MachCodeFramesInErrorFile.java index 74cedae5f1a..ba36d5810d8 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/MachCodeFramesInErrorFile.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/MachCodeFramesInErrorFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2026, Oracle and/or its affiliates. All rights reserved. * 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 @@ * @requires vm.flagless * @requires vm.compiler2.enabled * @requires test.thread.factory == null + * @comment This test relies on crashing which conflicts with ASAN checks + * @requires !vm.asan * @summary Test that abstract machine code is dumped for the top frames in a hs-err log * @library /test/lib * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/ResourceMarkTest.java b/test/hotspot/jtreg/runtime/ErrorHandling/ResourceMarkTest.java index 5bbc4cfac00..583ed894035 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/ResourceMarkTest.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/ResourceMarkTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2026, Oracle and/or its affiliates. All rights reserved. * 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,6 +29,8 @@ * @library /test/lib * @requires vm.flagless * @requires vm.debug + * @comment ASAN grabs SIGFPE earlier than vm signal handler + * @requires !vm.asan * @requires os.family != "windows" * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/SecondaryErrorTest.java b/test/hotspot/jtreg/runtime/ErrorHandling/SecondaryErrorTest.java index 5b28e2a1d8b..f7facaab186 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/SecondaryErrorTest.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/SecondaryErrorTest.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2014, 2024 SAP SE. All rights reserved. - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2026, Oracle and/or its affiliates. All rights reserved. * 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,6 +29,8 @@ * @library /test/lib * @requires vm.flagless * @requires vm.debug + * @comment ASAN grabs SIGFPE earlier than vm signal handler + * @requires !vm.asan * @requires os.family != "windows" * @modules java.base/jdk.internal.misc * java.management @@ -41,6 +43,8 @@ * @library /test/lib * @requires vm.flagless * @requires vm.debug + * @comment ASAN grabs SIGFPE earlier than vm signal handler + * @requires !vm.asan * @requires os.family != "windows" * @modules java.base/jdk.internal.misc * java.management From d10ddb820316a053c58a61ba706af7548d089acf Mon Sep 17 00:00:00 2001 From: Albert Mingkun Yang Date: Mon, 9 Feb 2026 10:52:09 +0000 Subject: [PATCH 024/120] 8377352: Parallel: Incorrect capacity in GC overhead log Reviewed-by: tschatzl, kbarrett --- src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp b/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp index 0d8a3166f79..0f55de90a8a 100644 --- a/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp +++ b/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp @@ -438,7 +438,7 @@ bool ParallelScavengeHeap::check_gc_overhead_limit() { log_debug(gc)("GC Overhead Limit: GC Time %f Free Space Young %f Old %f Counter %zu", (100 - _size_policy->mutator_time_percent()), percent_of(_young_gen->free_in_bytes(), _young_gen->capacity_in_bytes()), - percent_of(_old_gen->free_in_bytes(), _young_gen->capacity_in_bytes()), + percent_of(_old_gen->free_in_bytes(), _old_gen->capacity_in_bytes()), _gc_overhead_counter); if (little_mutator_time && little_free_space) { From a5765a916a03471cd771c870e1c0e5eab7a08bf1 Mon Sep 17 00:00:00 2001 From: Anjian Wen Date: Mon, 9 Feb 2026 11:50:40 +0000 Subject: [PATCH 025/120] 8377225: RISC-V: Improve receiver type profiling reliability Reviewed-by: shade, fjiang, fyang --- .../cpu/riscv/c1_LIRAssembler_riscv.cpp | 68 ++------ .../cpu/riscv/c1_LIRAssembler_riscv.hpp | 5 +- src/hotspot/cpu/riscv/interp_masm_riscv.cpp | 159 +----------------- src/hotspot/cpu/riscv/interp_masm_riscv.hpp | 11 +- .../cpu/riscv/macroAssembler_riscv.cpp | 154 +++++++++++++++++ .../cpu/riscv/macroAssembler_riscv.hpp | 2 + src/hotspot/cpu/riscv/templateTable_riscv.cpp | 4 +- 7 files changed, 176 insertions(+), 227 deletions(-) diff --git a/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.cpp b/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.cpp index e77a2067e89..63e2fd015d7 100644 --- a/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.cpp @@ -1041,31 +1041,10 @@ void LIR_Assembler::emit_alloc_array(LIR_OpAllocArray* op) { __ bind(*op->stub()->continuation()); } -void LIR_Assembler::type_profile_helper(Register mdo, ciMethodData *md, ciProfileData *data, - Register recv, Label* update_done) { - for (uint i = 0; i < ReceiverTypeData::row_limit(); i++) { - Label next_test; - // See if the receiver is receiver[n]. - __ ld(t1, Address(mdo, md->byte_offset_of_slot(data, ReceiverTypeData::receiver_offset(i)))); - __ bne(recv, t1, next_test); - Address data_addr(mdo, md->byte_offset_of_slot(data, ReceiverTypeData::receiver_count_offset(i))); - __ increment(data_addr, DataLayout::counter_increment); - __ j(*update_done); - __ bind(next_test); - } - - // Didn't find receiver; find next empty slot and fill it in - for (uint i = 0; i < ReceiverTypeData::row_limit(); i++) { - Label next_test; - Address recv_addr(mdo, md->byte_offset_of_slot(data, ReceiverTypeData::receiver_offset(i))); - __ ld(t1, recv_addr); - __ bnez(t1, next_test); - __ sd(recv, recv_addr); - __ mv(t1, DataLayout::counter_increment); - __ sd(t1, Address(mdo, md->byte_offset_of_slot(data, ReceiverTypeData::receiver_count_offset(i)))); - __ j(*update_done); - __ bind(next_test); - } +void LIR_Assembler::type_profile_helper(Register mdo, ciMethodData *md, + ciProfileData *data, Register recv) { + int mdp_offset = md->byte_offset_of_slot(data, in_ByteSize(0)); + __ profile_receiver_type(recv, mdo, mdp_offset); } void LIR_Assembler::data_check(LIR_OpTypeCheck *op, ciMethodData **md, ciProfileData **data) { @@ -1139,14 +1118,9 @@ void LIR_Assembler::profile_object(ciMethodData* md, ciProfileData* data, Regist __ j(*obj_is_null); __ bind(not_null); - Label update_done; Register recv = k_RInfo; __ load_klass(recv, obj); - type_profile_helper(mdo, md, data, recv, &update_done); - Address counter_addr(mdo, md->byte_offset_of_slot(data, CounterData::count_offset())); - __ increment(counter_addr, DataLayout::counter_increment); - - __ bind(update_done); + type_profile_helper(mdo, md, data, recv); } void LIR_Assembler::typecheck_loaded(LIR_OpTypeCheck *op, ciKlass* k, Register k_RInfo) { @@ -1554,11 +1528,8 @@ void LIR_Assembler::emit_profile_call(LIR_OpProfileCall* op) { // We know the type that will be seen at this call site; we can // statically update the MethodData* rather than needing to do // dynamic tests on the receiver type - // NOTE: we should probably put a lock around this search to - // avoid collisions by concurrent compilations ciVirtualCallData* vc_data = (ciVirtualCallData*) data; - uint i; - for (i = 0; i < VirtualCallData::row_limit(); i++) { + for (uint i = 0; i < VirtualCallData::row_limit(); i++) { ciKlass* receiver = vc_data->receiver(i); if (known_klass->equals(receiver)) { Address data_addr(mdo, md->byte_offset_of_slot(data, VirtualCallData::receiver_count_offset(i))); @@ -1566,32 +1537,13 @@ void LIR_Assembler::emit_profile_call(LIR_OpProfileCall* op) { return; } } - - // Receiver type not found in profile data; select an empty slot - // Note that this is less efficient than it should be because it - // always does a write to the receiver part of the - // VirtualCallData rather than just the first time - for (i = 0; i < VirtualCallData::row_limit(); i++) { - ciKlass* receiver = vc_data->receiver(i); - if (receiver == nullptr) { - Address recv_addr(mdo, md->byte_offset_of_slot(data, VirtualCallData::receiver_offset(i))); - __ mov_metadata(t1, known_klass->constant_encoding()); - __ sd(t1, recv_addr); - Address data_addr(mdo, md->byte_offset_of_slot(data, VirtualCallData::receiver_count_offset(i))); - __ increment(data_addr, DataLayout::counter_increment); - return; - } - } + // Receiver type is not found in profile data. + // Fall back to runtime helper to handle the rest at runtime. + __ mov_metadata(recv, known_klass->constant_encoding()); } else { __ load_klass(recv, recv); - Label update_done; - type_profile_helper(mdo, md, data, recv, &update_done); - // Receiver did not match any saved receiver and there is no empty row for it. - // Increment total counter to indicate polymorphic case. - __ increment(counter_addr, DataLayout::counter_increment); - - __ bind(update_done); } + type_profile_helper(mdo, md, data, recv); } else { // Static call __ increment(counter_addr, DataLayout::counter_increment); diff --git a/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.hpp b/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.hpp index 1e466e90d37..90b6b3ee4f4 100644 --- a/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.hpp +++ b/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.hpp @@ -54,9 +54,8 @@ private: Address stack_slot_address(int index, uint shift, int adjust = 0); // Record the type of the receiver in ReceiverTypeData - void type_profile_helper(Register mdo, - ciMethodData *md, ciProfileData *data, - Register recv, Label* update_done); + void type_profile_helper(Register mdo, ciMethodData *md, + ciProfileData *data, Register recv); void casw(Register addr, Register newval, Register cmpval); void caswu(Register addr, Register newval, Register cmpval); diff --git a/src/hotspot/cpu/riscv/interp_masm_riscv.cpp b/src/hotspot/cpu/riscv/interp_masm_riscv.cpp index 189c7c93d07..744590bec2b 100644 --- a/src/hotspot/cpu/riscv/interp_masm_riscv.cpp +++ b/src/hotspot/cpu/riscv/interp_masm_riscv.cpp @@ -237,15 +237,14 @@ void InterpreterMacroAssembler::load_resolved_klass_at_offset( // Rsub_klass: subklass // // Kills: -// x12, x15 +// x12 void InterpreterMacroAssembler::gen_subtype_check(Register Rsub_klass, Label& ok_is_subtype) { assert(Rsub_klass != x10, "x10 holds superklass"); assert(Rsub_klass != x12, "x12 holds 2ndary super array length"); - assert(Rsub_klass != x15, "x15 holds 2ndary super array scan ptr"); // Profile the not-null value's klass. - profile_typecheck(x12, Rsub_klass, x15); // blows x12, reloads x15 + profile_typecheck(x12, Rsub_klass); // blows x12 // Do the check. check_klass_subtype(Rsub_klass, x10, x12, ok_is_subtype); // blows x12 @@ -1042,7 +1041,6 @@ void InterpreterMacroAssembler::profile_final_call(Register mdp) { void InterpreterMacroAssembler::profile_virtual_call(Register receiver, Register mdp, - Register reg2, bool receiver_can_be_null) { if (ProfileInterpreter) { Label profile_continue; @@ -1060,7 +1058,7 @@ void InterpreterMacroAssembler::profile_virtual_call(Register receiver, } // Record the receiver type. - record_klass_in_profile(receiver, mdp, reg2); + profile_receiver_type(receiver, mdp, 0); bind(skip_receiver_profile); // The method data pointer needs to be updated to reflect the new target. @@ -1072,153 +1070,6 @@ void InterpreterMacroAssembler::profile_virtual_call(Register receiver, } } -// This routine creates a state machine for updating the multi-row -// type profile at a virtual call site (or other type-sensitive bytecode). -// The machine visits each row (of receiver/count) until the receiver type -// is found, or until it runs out of rows. At the same time, it remembers -// the location of the first empty row. (An empty row records null for its -// receiver, and can be allocated for a newly-observed receiver type.) -// Because there are two degrees of freedom in the state, a simple linear -// search will not work; it must be a decision tree. Hence this helper -// function is recursive, to generate the required tree structured code. -// It's the interpreter, so we are trading off code space for speed. -// See below for example code. -void InterpreterMacroAssembler::record_klass_in_profile_helper( - Register receiver, Register mdp, - Register reg2, Label& done) { - if (TypeProfileWidth == 0) { - increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset())); - } else { - record_item_in_profile_helper(receiver, mdp, reg2, 0, done, TypeProfileWidth, - &VirtualCallData::receiver_offset, &VirtualCallData::receiver_count_offset); - } -} - -void InterpreterMacroAssembler::record_item_in_profile_helper(Register item, Register mdp, - Register reg2, int start_row, Label& done, int total_rows, - OffsetFunction item_offset_fn, OffsetFunction item_count_offset_fn) { - int last_row = total_rows - 1; - assert(start_row <= last_row, "must be work left to do"); - // Test this row for both the item and for null. - // Take any of three different outcomes: - // 1. found item => increment count and goto done - // 2. found null => keep looking for case 1, maybe allocate this cell - // 3. found something else => keep looking for cases 1 and 2 - // Case 3 is handled by a recursive call. - for (int row = start_row; row <= last_row; row++) { - Label next_test; - bool test_for_null_also = (row == start_row); - - // See if the item is item[n]. - int item_offset = in_bytes(item_offset_fn(row)); - test_mdp_data_at(mdp, item_offset, item, - (test_for_null_also ? reg2 : noreg), - next_test); - // (Reg2 now contains the item from the CallData.) - - // The item is item[n]. Increment count[n]. - int count_offset = in_bytes(item_count_offset_fn(row)); - increment_mdp_data_at(mdp, count_offset); - j(done); - bind(next_test); - - if (test_for_null_also) { - Label found_null; - // Failed the equality check on item[n]... Test for null. - if (start_row == last_row) { - // The only thing left to do is handle the null case. - beqz(reg2, found_null); - // Item did not match any saved item and there is no empty row for it. - // Increment total counter to indicate polymorphic case. - increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset())); - j(done); - bind(found_null); - break; - } - // Since null is rare, make it be the branch-taken case. - beqz(reg2, found_null); - - // Put all the "Case 3" tests here. - record_item_in_profile_helper(item, mdp, reg2, start_row + 1, done, total_rows, - item_offset_fn, item_count_offset_fn); - - // Found a null. Keep searching for a matching item, - // but remember that this is an empty (unused) slot. - bind(found_null); - } - } - - // In the fall-through case, we found no matching item, but we - // observed the item[start_row] is null. - // Fill in the item field and increment the count. - int item_offset = in_bytes(item_offset_fn(start_row)); - set_mdp_data_at(mdp, item_offset, item); - int count_offset = in_bytes(item_count_offset_fn(start_row)); - mv(reg2, DataLayout::counter_increment); - set_mdp_data_at(mdp, count_offset, reg2); - if (start_row > 0) { - j(done); - } -} - -// Example state machine code for three profile rows: -// # main copy of decision tree, rooted at row[1] -// if (row[0].rec == rec) then [ -// row[0].incr() -// goto done -// ] -// if (row[0].rec != nullptr) then [ -// # inner copy of decision tree, rooted at row[1] -// if (row[1].rec == rec) then [ -// row[1].incr() -// goto done -// ] -// if (row[1].rec != nullptr) then [ -// # degenerate decision tree, rooted at row[2] -// if (row[2].rec == rec) then [ -// row[2].incr() -// goto done -// ] -// if (row[2].rec != nullptr) then [ -// count.incr() -// goto done -// ] # overflow -// row[2].init(rec) -// goto done -// ] else [ -// # remember row[1] is empty -// if (row[2].rec == rec) then [ -// row[2].incr() -// goto done -// ] -// row[1].init(rec) -// goto done -// ] -// else [ -// # remember row[0] is empty -// if (row[1].rec == rec) then [ -// row[1].incr() -// goto done -// ] -// if (row[2].rec == rec) then [ -// row[2].incr() -// goto done -// ] -// row[0].init(rec) -// goto done -// ] -// done: - -void InterpreterMacroAssembler::record_klass_in_profile(Register receiver, - Register mdp, Register reg2) { - assert(ProfileInterpreter, "must be profiling"); - Label done; - - record_klass_in_profile_helper(receiver, mdp, reg2, done); - - bind(done); -} - void InterpreterMacroAssembler::profile_ret(Register return_bci, Register mdp) { if (ProfileInterpreter) { Label profile_continue; @@ -1274,7 +1125,7 @@ void InterpreterMacroAssembler::profile_null_seen(Register mdp) { } } -void InterpreterMacroAssembler::profile_typecheck(Register mdp, Register klass, Register reg2) { +void InterpreterMacroAssembler::profile_typecheck(Register mdp, Register klass) { if (ProfileInterpreter) { Label profile_continue; @@ -1287,7 +1138,7 @@ void InterpreterMacroAssembler::profile_typecheck(Register mdp, Register klass, mdp_delta = in_bytes(VirtualCallData::virtual_call_data_size()); // Record the object type. - record_klass_in_profile(klass, mdp, reg2); + profile_receiver_type(klass, mdp, 0); } update_mdp_by_constant(mdp, mdp_delta); diff --git a/src/hotspot/cpu/riscv/interp_masm_riscv.hpp b/src/hotspot/cpu/riscv/interp_masm_riscv.hpp index a9df09d656a..59cc76b022f 100644 --- a/src/hotspot/cpu/riscv/interp_masm_riscv.hpp +++ b/src/hotspot/cpu/riscv/interp_masm_riscv.hpp @@ -262,14 +262,6 @@ class InterpreterMacroAssembler: public MacroAssembler { Register test_value_out, Label& not_equal_continue); - void record_klass_in_profile(Register receiver, Register mdp, - Register reg2); - void record_klass_in_profile_helper(Register receiver, Register mdp, - Register reg2, Label& done); - void record_item_in_profile_helper(Register item, Register mdp, - Register reg2, int start_row, Label& done, int total_rows, - OffsetFunction item_offset_fn, OffsetFunction item_count_offset_fn); - void update_mdp_by_offset(Register mdp_in, int offset_of_offset); void update_mdp_by_offset(Register mdp_in, Register reg, int offset_of_disp); void update_mdp_by_constant(Register mdp_in, int constant); @@ -283,11 +275,10 @@ class InterpreterMacroAssembler: public MacroAssembler { void profile_call(Register mdp); void profile_final_call(Register mdp); void profile_virtual_call(Register receiver, Register mdp, - Register t1, bool receiver_can_be_null = false); void profile_ret(Register return_bci, Register mdp); void profile_null_seen(Register mdp); - void profile_typecheck(Register mdp, Register klass, Register temp); + void profile_typecheck(Register mdp, Register klass); void profile_typecheck_failed(Register mdp); void profile_switch_default(Register mdp); void profile_switch_case(Register index_in_scratch, Register mdp, diff --git a/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp b/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp index fb30f64e9ed..4f5e7afc166 100644 --- a/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp @@ -543,6 +543,160 @@ void MacroAssembler::_verify_oop(Register reg, const char* s, const char* file, BLOCK_COMMENT("} verify_oop"); } +// Handle the receiver type profile update given the "recv" klass. +// +// Normally updates the ReceiverData (RD) that starts at "mdp" + "mdp_offset". +// If there are no matching or claimable receiver entries in RD, updates +// the polymorphic counter. +// +// This code expected to run by either the interpreter or JIT-ed code, without +// extra synchronization. For safety, receiver cells are claimed atomically, which +// avoids grossly misrepresenting the profiles under concurrent updates. For speed, +// counter updates are not atomic. +// +void MacroAssembler::profile_receiver_type(Register recv, Register mdp, int mdp_offset) { + assert_different_registers(recv, mdp, t0, t1); + + int base_receiver_offset = in_bytes(ReceiverTypeData::receiver_offset(0)); + int end_receiver_offset = in_bytes(ReceiverTypeData::receiver_offset(ReceiverTypeData::row_limit())); + int poly_count_offset = in_bytes(CounterData::count_offset()); + int receiver_step = in_bytes(ReceiverTypeData::receiver_offset(1)) - base_receiver_offset; + int receiver_to_count_step = in_bytes(ReceiverTypeData::receiver_count_offset(0)) - base_receiver_offset; + + // Adjust for MDP offsets. Slots are pointer-sized, so is the global offset. + base_receiver_offset += mdp_offset; + end_receiver_offset += mdp_offset; + poly_count_offset += mdp_offset; + +#ifdef ASSERT + // We are about to walk the MDO slots without asking for offsets. + // Check that our math hits all the right spots. + for (uint c = 0; c < ReceiverTypeData::row_limit(); c++) { + int real_recv_offset = mdp_offset + in_bytes(ReceiverTypeData::receiver_offset(c)); + int real_count_offset = mdp_offset + in_bytes(ReceiverTypeData::receiver_count_offset(c)); + int offset = base_receiver_offset + receiver_step*c; + int count_offset = offset + receiver_to_count_step; + assert(offset == real_recv_offset, "receiver slot math"); + assert(count_offset == real_count_offset, "receiver count math"); + } + int real_poly_count_offset = mdp_offset + in_bytes(CounterData::count_offset()); + assert(poly_count_offset == real_poly_count_offset, "poly counter math"); +#endif + + // Corner case: no profile table. Increment poly counter and exit. + if (ReceiverTypeData::row_limit() == 0) { + increment(Address(mdp, poly_count_offset), DataLayout::counter_increment); + return; + } + + Register offset = t1; + + Label L_loop_search_receiver, L_loop_search_empty; + Label L_restart, L_found_recv, L_found_empty, L_polymorphic, L_count_update; + + // The code here recognizes three major cases: + // A. Fastest: receiver found in the table + // B. Fast: no receiver in the table, and the table is full + // C. Slow: no receiver in the table, free slots in the table + // + // The case A performance is most important, as perfectly-behaved code would end up + // there, especially with larger TypeProfileWidth. The case B performance is + // important as well, this is where bulk of code would land for normally megamorphic + // cases. The case C performance is not essential, its job is to deal with installation + // races, we optimize for code density instead. Case C needs to make sure that receiver + // rows are only claimed once. This makes sure we never overwrite a row for another + // receiver and never duplicate the receivers in the list, making profile type-accurate. + // + // It is very tempting to handle these cases in a single loop, and claim the first slot + // without checking the rest of the table. But, profiling code should tolerate free slots + // in the table, as class unloading can clear them. After such cleanup, the receiver + // we need might be _after_ the free slot. Therefore, we need to let at least full scan + // to complete, before trying to install new slots. Splitting the code in several tight + // loops also helpfully optimizes for cases A and B. + // + // This code is effectively: + // + // restart: + // // Fastest: receiver is already installed + // for (i = 0; i < receiver_count(); i++) { + // if (receiver(i) == recv) goto found_recv(i); + // } + // + // // Fast: no receiver, but profile is full + // for (i = 0; i < receiver_count(); i++) { + // if (receiver(i) == null) goto found_null(i); + // } + // goto polymorphic + // + // // Slow: try to install receiver + // found_null(i): + // CAS(&receiver(i), null, recv); + // goto restart + // + // polymorphic: + // count++; + // return + // + // found_recv(i): + // *receiver_count(i)++ + // + + bind(L_restart); + + // Fastest: receiver is already installed + mv(offset, base_receiver_offset); + bind(L_loop_search_receiver); + add(t0, mdp, offset); + ld(t0, Address(t0)); + beq(recv, t0, L_found_recv); + add(offset, offset, receiver_step); + sub(t0, offset, end_receiver_offset); + bnez(t0, L_loop_search_receiver); + + // Fast: no receiver, but profile is full + mv(offset, base_receiver_offset); + bind(L_loop_search_empty); + add(t0, mdp, offset); + ld(t0, Address(t0)); + beqz(t0, L_found_empty); + add(offset, offset, receiver_step); + sub(t0, offset, end_receiver_offset); + bnez(t0, L_loop_search_empty); + j(L_polymorphic); + + // Slow: try to install receiver + bind(L_found_empty); + + // Atomically swing receiver slot: null -> recv. + // + // The update uses CAS, which clobbers t0. Therefore, t1 + // is used to hold the destination address. This is safe because the + // offset is no longer needed after the address is computed. + add(t1, mdp, offset); + weak_cmpxchg(/*addr*/ t1, /*expected*/ zr, /*new*/ recv, Assembler::int64, + /*acquire*/ Assembler::relaxed, /*release*/ Assembler::relaxed, /*result*/ t0); + + // CAS success means the slot now has the receiver we want. CAS failure means + // something had claimed the slot concurrently: it can be the same receiver we want, + // or something else. Since this is a slow path, we can optimize for code density, + // and just restart the search from the beginning. + j(L_restart); + + // Counter updates: + // Increment polymorphic counter instead of receiver slot. + bind(L_polymorphic); + mv(offset, poly_count_offset); + j(L_count_update); + + // Found a receiver, convert its slot offset to corresponding count offset. + bind(L_found_recv); + add(offset, offset, receiver_to_count_step); + + bind(L_count_update); + add(t1, mdp, offset); + increment(Address(t1), DataLayout::counter_increment); +} + void MacroAssembler::_verify_oop_addr(Address addr, const char* s, const char* file, int line) { if (!VerifyOops) { return; diff --git a/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp b/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp index 3b021388fa5..f5e985c28a2 100644 --- a/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp +++ b/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp @@ -390,6 +390,8 @@ class MacroAssembler: public Assembler { Address argument_address(RegisterOrConstant arg_slot, int extra_slot_offset = 0); + void profile_receiver_type(Register recv, Register mdp, int mdp_offset); + // only if +VerifyOops void _verify_oop(Register reg, const char* s, const char* file, int line); void _verify_oop_addr(Address addr, const char* s, const char* file, int line); diff --git a/src/hotspot/cpu/riscv/templateTable_riscv.cpp b/src/hotspot/cpu/riscv/templateTable_riscv.cpp index 0fb529d1683..5cc725e3af4 100644 --- a/src/hotspot/cpu/riscv/templateTable_riscv.cpp +++ b/src/hotspot/cpu/riscv/templateTable_riscv.cpp @@ -3279,7 +3279,7 @@ void TemplateTable::invokevirtual_helper(Register index, __ load_klass(x10, recv); // profile this call - __ profile_virtual_call(x10, xlocals, x13); + __ profile_virtual_call(x10, xlocals); // get target Method & entry point __ lookup_virtual_method(x10, index, method); @@ -3406,7 +3406,7 @@ void TemplateTable::invokeinterface(int byte_no) { /*return_method=*/false); // profile this call - __ profile_virtual_call(x13, x30, x9); + __ profile_virtual_call(x13, x30); // Get declaring interface class from method, and itable index __ load_method_holder(x10, xmethod); From 47b2e994b083f1c53f51fae605a192a6a44f2483 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Mon, 9 Feb 2026 14:47:34 +0000 Subject: [PATCH 026/120] 8376199: Convert CodeCacheUnloadingTask to use Atomic Reviewed-by: iwalulya, ayang --- src/hotspot/share/gc/shared/parallelCleaning.cpp | 8 ++++---- src/hotspot/share/gc/shared/parallelCleaning.hpp | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/hotspot/share/gc/shared/parallelCleaning.cpp b/src/hotspot/share/gc/shared/parallelCleaning.cpp index e302085d0cc..1a0d536f3b3 100644 --- a/src/hotspot/share/gc/shared/parallelCleaning.cpp +++ b/src/hotspot/share/gc/shared/parallelCleaning.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,7 +39,7 @@ CodeCacheUnloadingTask::CodeCacheUnloadingTask(bool unloading_occurred) : if(iter.next()) { _first_nmethod = iter.method(); } - _claimed_nmethod = _first_nmethod; + _claimed_nmethod.store_relaxed(_first_nmethod); } CodeCacheUnloadingTask::~CodeCacheUnloadingTask() { @@ -53,7 +53,7 @@ void CodeCacheUnloadingTask::claim_nmethods(nmethod** claimed_nmethods, int *num do { *num_claimed_nmethods = 0; - first = _claimed_nmethod; + first = _claimed_nmethod.load_relaxed(); last = NMethodIterator(NMethodIterator::all, first); if (first != nullptr) { @@ -67,7 +67,7 @@ void CodeCacheUnloadingTask::claim_nmethods(nmethod** claimed_nmethods, int *num } } - } while (AtomicAccess::cmpxchg(&_claimed_nmethod, first, last.method()) != first); + } while (!_claimed_nmethod.compare_set(first, last.method())); } void CodeCacheUnloadingTask::work(uint worker_id) { diff --git a/src/hotspot/share/gc/shared/parallelCleaning.hpp b/src/hotspot/share/gc/shared/parallelCleaning.hpp index ed76c4c9df9..0f5cb78bf55 100644 --- a/src/hotspot/share/gc/shared/parallelCleaning.hpp +++ b/src/hotspot/share/gc/shared/parallelCleaning.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * 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,6 +29,7 @@ #include "code/codeCache.hpp" #include "gc/shared/oopStorageParState.hpp" #include "gc/shared/workerThread.hpp" +#include "runtime/atomic.hpp" class CodeCacheUnloadingTask { @@ -36,7 +37,7 @@ class CodeCacheUnloadingTask { // Variables used to claim nmethods. nmethod* _first_nmethod; - nmethod* volatile _claimed_nmethod; + Atomic _claimed_nmethod; public: CodeCacheUnloadingTask(bool unloading_occurred); From f81bea29a3595195d747068adea2a427cf26385e Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Mon, 9 Feb 2026 14:47:55 +0000 Subject: [PATCH 027/120] 8376351: Parallel: Convert ParallelScavengeHeap to use Atomic Reviewed-by: iwalulya, ayang --- src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp b/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp index 0f55de90a8a..f49419595e1 100644 --- a/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp +++ b/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2026, Oracle and/or its affiliates. All rights reserved. * 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,6 +48,7 @@ #include "memory/reservedSpace.hpp" #include "memory/universe.hpp" #include "oops/oop.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/cpuTimeCounters.hpp" #include "runtime/globals_extension.hpp" #include "runtime/handles.inline.hpp" @@ -594,7 +595,7 @@ void ParallelScavengeHeap::object_iterate(ObjectClosure* cl) { // these spaces. // The old space is divided into fixed-size blocks. class HeapBlockClaimer : public StackObj { - size_t _claimed_index; + Atomic _claimed_index; public: static const size_t InvalidIndex = SIZE_MAX; @@ -606,7 +607,7 @@ public: // Claim the block and get the block index. size_t claim_and_get_block() { size_t block_index; - block_index = AtomicAccess::fetch_then_add(&_claimed_index, 1u); + block_index = _claimed_index.fetch_then_add(1u); PSOldGen* old_gen = ParallelScavengeHeap::heap()->old_gen(); size_t num_claims = old_gen->num_iterable_blocks() + NumNonOldGenClaims; From 2a8badf5a6c956536fc0b4d55992f213409808c2 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Mon, 9 Feb 2026 14:50:26 +0000 Subject: [PATCH 028/120] 8376356: Parallel: Convert PSCardTable to use Atomic Reviewed-by: iwalulya, ayang --- src/hotspot/share/gc/parallel/psCardTable.cpp | 6 +++--- src/hotspot/share/gc/parallel/psCardTable.hpp | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/hotspot/share/gc/parallel/psCardTable.cpp b/src/hotspot/share/gc/parallel/psCardTable.cpp index fcd0dd67a45..6429766309a 100644 --- a/src/hotspot/share/gc/parallel/psCardTable.cpp +++ b/src/hotspot/share/gc/parallel/psCardTable.cpp @@ -108,7 +108,7 @@ void PSCardTable::scan_obj_with_limit(PSPromotionManager* pm, } void PSCardTable::pre_scavenge(uint active_workers) { - _preprocessing_active_workers = active_workers; + _preprocessing_active_workers.store_relaxed(active_workers); } // The "shadow" table is a copy of the card table entries of the current stripe. @@ -382,9 +382,9 @@ void PSCardTable::scavenge_contents_parallel(ObjectStartArray* start_array, preprocess_card_table_parallel(object_start, old_gen_bottom, old_gen_top, stripe_index, n_stripes); // Sync with other workers. - AtomicAccess::dec(&_preprocessing_active_workers); + _preprocessing_active_workers.sub_then_fetch(1); SpinYield spin_yield; - while (AtomicAccess::load_acquire(&_preprocessing_active_workers) > 0) { + while (_preprocessing_active_workers.load_acquire() > 0) { spin_yield.wait(); } diff --git a/src/hotspot/share/gc/parallel/psCardTable.hpp b/src/hotspot/share/gc/parallel/psCardTable.hpp index 70c32d23b7f..033933bcbf1 100644 --- a/src/hotspot/share/gc/parallel/psCardTable.hpp +++ b/src/hotspot/share/gc/parallel/psCardTable.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,7 @@ #include "gc/shared/cardTable.hpp" #include "oops/oop.hpp" +#include "runtime/atomic.hpp" class MutableSpace; class ObjectStartArray; @@ -37,7 +38,7 @@ class PSCardTable: public CardTable { static constexpr size_t num_cards_in_stripe = 128; static_assert(num_cards_in_stripe >= 1, "progress"); - volatile int _preprocessing_active_workers; + Atomic _preprocessing_active_workers; bool is_dirty(CardValue* card) { return !is_clean(card); From 36758b0839a5ad92af556fc06cbfd207d61a0950 Mon Sep 17 00:00:00 2001 From: Chris Plummer Date: Mon, 9 Feb 2026 15:49:53 +0000 Subject: [PATCH 029/120] 8377435: Problem list serviceability/sa/TestJhsdbJstackMixedCore.java Reviewed-by: dholmes, ysuenaga --- test/hotspot/jtreg/ProblemList.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index 3e4814180f6..147d1ce2d78 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -140,6 +140,7 @@ serviceability/sa/TestJmapCore.java 8318754 macosx-aarch64 serviceability/sa/TestJmapCoreMetaspace.java 8318754 macosx-aarch64 serviceability/sa/ClhsdbThreadContext.java 8356704 windows-x64 +serviceability/sa/TestJhsdbJstackMixedCore.java 8377395 linux-x64 serviceability/jvmti/stress/StackTrace/NotSuspended/GetStackTraceNotSuspendedStressTest.java 8315980 linux-all,windows-x64 From 3065aa48c9d72bb0c4e2e14a866ec7d9b5515b35 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Mon, 9 Feb 2026 17:26:32 +0000 Subject: [PATCH 030/120] 8376627: Remove AppContext from javax/swing/plaf/metal classes Reviewed-by: serb, psadhukhan --- .../javax/swing/plaf/metal/MetalBumps.java | 17 +- .../javax/swing/plaf/metal/MetalButtonUI.java | 14 +- .../swing/plaf/metal/MetalCheckBoxUI.java | 15 +- .../swing/plaf/metal/MetalLookAndFeel.java | 18 +- .../swing/plaf/metal/MetalRadioButtonUI.java | 14 +- .../swing/plaf/metal/MetalToggleButtonUI.java | 14 +- .../plaf/metal/MetalBumps/Test6657026.java | 240 ------------------ .../MetalInternalFrameUI/Test6657026.java | 61 ----- .../plaf/metal/MetalSliderUI/Test6657026.java | 67 ----- 9 files changed, 24 insertions(+), 436 deletions(-) delete mode 100644 test/jdk/javax/swing/plaf/metal/MetalBumps/Test6657026.java delete mode 100644 test/jdk/javax/swing/plaf/metal/MetalInternalFrameUI/Test6657026.java delete mode 100644 test/jdk/javax/swing/plaf/metal/MetalSliderUI/Test6657026.java diff --git a/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalBumps.java b/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalBumps.java index dddcde10636..65030716d49 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalBumps.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalBumps.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2026, Oracle and/or its affiliates. All rights reserved. * 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 @@ import java.awt.image.*; import javax.swing.*; import java.util.ArrayList; import java.util.List; -import sun.awt.AppContext; /** * Implements the bumps used throughout the Metal Look and Feel. @@ -50,7 +49,7 @@ class MetalBumps implements Icon { protected Color shadowColor; protected Color backColor; - private static final Object METAL_BUMPS = new Object(); + private static final List bumpsList = new ArrayList(); protected BumpBuffer buffer; /** @@ -66,20 +65,14 @@ class MetalBumps implements Icon { private static BumpBuffer createBuffer(GraphicsConfiguration gc, Color topColor, Color shadowColor, Color backColor) { - AppContext context = AppContext.getAppContext(); - @SuppressWarnings("unchecked") - List buffers = (List) context.get(METAL_BUMPS); - if (buffers == null) { - buffers = new ArrayList(); - context.put(METAL_BUMPS, buffers); - } - for (BumpBuffer buffer : buffers) { + + for (BumpBuffer buffer : bumpsList) { if (buffer.hasSameConfiguration(gc, topColor, shadowColor, backColor)) { return buffer; } } BumpBuffer buffer = new BumpBuffer(gc, topColor, shadowColor, backColor); - buffers.add(buffer); + bumpsList.add(buffer); return buffer; } diff --git a/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalButtonUI.java b/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalButtonUI.java index c940b4dcead..92b7c3b58f9 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalButtonUI.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalButtonUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,6 @@ package javax.swing.plaf.metal; import sun.swing.SwingUtilities2; -import sun.awt.AppContext; import javax.swing.*; import javax.swing.border.*; @@ -69,7 +68,7 @@ public class MetalButtonUI extends BasicButtonUI { */ protected Color disabledTextColor; - private static final Object METAL_BUTTON_UI_KEY = new Object(); + private static final ComponentUI UI = new MetalButtonUI(); // ******************************** // Create PLAF @@ -87,14 +86,7 @@ public class MetalButtonUI extends BasicButtonUI { * @return an instance of {@code MetalButtonUI} */ public static ComponentUI createUI(JComponent c) { - AppContext appContext = AppContext.getAppContext(); - MetalButtonUI metalButtonUI = - (MetalButtonUI) appContext.get(METAL_BUTTON_UI_KEY); - if (metalButtonUI == null) { - metalButtonUI = new MetalButtonUI(); - appContext.put(METAL_BUTTON_UI_KEY, metalButtonUI); - } - return metalButtonUI; + return UI; } // ******************************** diff --git a/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalCheckBoxUI.java b/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalCheckBoxUI.java index 558f1987e4d..4809de43a8f 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalCheckBoxUI.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalCheckBoxUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,6 @@ package javax.swing.plaf.metal; -import sun.awt.AppContext; - import javax.swing.*; import javax.swing.plaf.basic.BasicCheckBoxUI; @@ -57,7 +55,7 @@ public class MetalCheckBoxUI extends MetalRadioButtonUI { // of BasicCheckBoxUI because we want to pick up all the // painting changes made in MetalRadioButtonUI. - private static final Object METAL_CHECK_BOX_UI_KEY = new Object(); + private static final ComponentUI UI = new MetalCheckBoxUI(); private static final String propertyPrefix = "CheckBox" + "."; @@ -79,14 +77,7 @@ public class MetalCheckBoxUI extends MetalRadioButtonUI { * @return a new instance of {@code MetalCheckBoxUI} */ public static ComponentUI createUI(JComponent b) { - AppContext appContext = AppContext.getAppContext(); - MetalCheckBoxUI checkboxUI = - (MetalCheckBoxUI) appContext.get(METAL_CHECK_BOX_UI_KEY); - if (checkboxUI == null) { - checkboxUI = new MetalCheckBoxUI(); - appContext.put(METAL_CHECK_BOX_UI_KEY, checkboxUI); - } - return checkboxUI; + return UI; } public String getPropertyPrefix() { diff --git a/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java b/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java index 7b9a23aec5d..7c56c681423 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,7 +61,6 @@ import javax.swing.plaf.UIResource; import javax.swing.plaf.basic.BasicLookAndFeel; import javax.swing.text.DefaultEditorKit; -import sun.awt.AppContext; import sun.awt.OSInfo; import sun.awt.SunToolkit; import sun.swing.DefaultLayoutStyle; @@ -1600,6 +1599,8 @@ public class MetalLookAndFeel extends BasicLookAndFeel super.provideErrorFeedback(component); } + private static MetalTheme currentMetalTheme; + /** * Set the theme used by MetalLookAndFeel. *

@@ -1629,7 +1630,7 @@ public class MetalLookAndFeel extends BasicLookAndFeel if (theme == null) { throw new NullPointerException("Can't have null theme"); } - AppContext.getAppContext().put( "currentMetalTheme", theme ); + currentMetalTheme = theme; } /** @@ -1641,15 +1642,10 @@ public class MetalLookAndFeel extends BasicLookAndFeel * @since 1.5 */ public static MetalTheme getCurrentTheme() { - MetalTheme currentTheme; - AppContext context = AppContext.getAppContext(); - currentTheme = (MetalTheme) context.get( "currentMetalTheme" ); + MetalTheme currentTheme = currentMetalTheme; if (currentTheme == null) { - // This will happen in two cases: - // . When MetalLookAndFeel is first being initialized. - // . When a new AppContext has been created that hasn't - // triggered UIManager to load a LAF. Rather than invoke - // a method on the UIManager, which would trigger the loading + // This will happen when MetalLookAndFeel is first being initialized. + // Rather than invoke a method on the UIManager, which would trigger the loading // of a potentially different LAF, we directly set the // Theme here. if (useHighContrastTheme()) { diff --git a/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalRadioButtonUI.java b/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalRadioButtonUI.java index 712046737eb..ddbd7bcc9cb 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalRadioButtonUI.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalRadioButtonUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,6 @@ package javax.swing.plaf.metal; import sun.swing.SwingUtilities2; -import sun.awt.AppContext; import java.awt.*; import java.awt.event.*; @@ -55,7 +54,7 @@ import javax.swing.text.View; */ public class MetalRadioButtonUI extends BasicRadioButtonUI { - private static final Object METAL_RADIO_BUTTON_UI_KEY = new Object(); + private static final ComponentUI UI = new MetalRadioButtonUI(); /** * The color of the focused radio button. @@ -90,14 +89,7 @@ public class MetalRadioButtonUI extends BasicRadioButtonUI { * @return an instance of {@code MetalRadioButtonUI} */ public static ComponentUI createUI(JComponent c) { - AppContext appContext = AppContext.getAppContext(); - MetalRadioButtonUI metalRadioButtonUI = - (MetalRadioButtonUI) appContext.get(METAL_RADIO_BUTTON_UI_KEY); - if (metalRadioButtonUI == null) { - metalRadioButtonUI = new MetalRadioButtonUI(); - appContext.put(METAL_RADIO_BUTTON_UI_KEY, metalRadioButtonUI); - } - return metalRadioButtonUI; + return UI; } // ******************************** diff --git a/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalToggleButtonUI.java b/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalToggleButtonUI.java index 088a54ba6b2..9c944388c4a 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalToggleButtonUI.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalToggleButtonUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,6 @@ package javax.swing.plaf.metal; import sun.swing.SwingUtilities2; -import sun.awt.AppContext; import java.awt.*; import java.awt.event.*; @@ -57,7 +56,7 @@ import java.io.Serializable; */ public class MetalToggleButtonUI extends BasicToggleButtonUI { - private static final Object METAL_TOGGLE_BUTTON_UI_KEY = new Object(); + private static final ComponentUI UI = new MetalToggleButtonUI(); /** * The color of a focused toggle button. @@ -92,14 +91,7 @@ public class MetalToggleButtonUI extends BasicToggleButtonUI { * @return the {@code MetalToggleButtonUI}. */ public static ComponentUI createUI(JComponent b) { - AppContext appContext = AppContext.getAppContext(); - MetalToggleButtonUI metalToggleButtonUI = - (MetalToggleButtonUI) appContext.get(METAL_TOGGLE_BUTTON_UI_KEY); - if (metalToggleButtonUI == null) { - metalToggleButtonUI = new MetalToggleButtonUI(); - appContext.put(METAL_TOGGLE_BUTTON_UI_KEY, metalToggleButtonUI); - } - return metalToggleButtonUI; + return UI; } // ******************************** diff --git a/test/jdk/javax/swing/plaf/metal/MetalBumps/Test6657026.java b/test/jdk/javax/swing/plaf/metal/MetalBumps/Test6657026.java deleted file mode 100644 index b5737479325..00000000000 --- a/test/jdk/javax/swing/plaf/metal/MetalBumps/Test6657026.java +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 6657026 - * @summary Tests shared MetalBumps in different application contexts - * @author Sergey Malenkov - * @modules java.desktop/sun.awt - */ - -import java.awt.Color; -import java.awt.Component; -import java.awt.Font; -import java.awt.FontMetrics; -import java.awt.Graphics; -import java.awt.Image; -import java.awt.Rectangle; -import java.awt.Shape; -import java.awt.image.BufferedImage; -import java.awt.image.ImageObserver; -import java.text.AttributedCharacterIterator; - -import javax.swing.JToolBar; -import javax.swing.plaf.metal.MetalBorders.ToolBarBorder; - -import sun.awt.SunToolkit; - -public class Test6657026 extends ToolBarBorder implements Runnable { - - public static void main(String[] args) throws Exception { - new Test6657026().test(); - - ThreadGroup group = new ThreadGroup("$$$"); - Thread thread = new Thread(group, new Test6657026()); - thread.start(); - thread.join(); - } - - public void run() { - SunToolkit.createNewAppContext(); - test(); - } - - private void test() { - MyGraphics mg = new MyGraphics(); - ToolBarBorder border = new ToolBarBorder(); - border.paintBorder(mg.component, mg, 0, 0, 10, 10); - if (mg.image != null) { - boolean failed = true; - int value = mg.image.getRGB(0, 0); - for (int x = 0; x < mg.image.getWidth(); x++) { - for (int y = 0; y < mg.image.getHeight(); y++) { - int current = mg.image.getRGB(x, y); - if (current != value) { - mg.image.setRGB(x, y, value); - failed = false; - } - - } - } - if (failed) { - throw new Error("shared metal bumps"); - } - } - } - - private static class MyGraphics extends Graphics { - - private final Component component = new JToolBar() {}; - private BufferedImage image; - - public Graphics create() { - return null; // TODO: check - } - - public void translate(int x, int y) { - // TODO: check - } - - public Color getColor() { - return null; // TODO: check - } - - public void setColor(Color color) { - // TODO: check - } - - public void setPaintMode() { - // TODO: check - } - - public void setXORMode(Color c1) { - // TODO: check - } - - public Font getFont() { - return null; // TODO: check - } - - public void setFont(Font font) { - // TODO: check - } - - public FontMetrics getFontMetrics(Font font) { - return null; // TODO: check - } - - public Rectangle getClipBounds() { - return null; // TODO: check - } - - public void clipRect(int x, int y, int width, int height) { - // TODO: check - } - - public void setClip(int x, int y, int width, int height) { - // TODO: check - } - - public Shape getClip() { - return null; // TODO: check - } - - public void setClip(Shape clip) { - // TODO: check - } - - public void copyArea(int x, int y, int width, int height, int dx, int dy) { - // TODO: check - } - - public void drawLine(int x1, int y1, int x2, int y2) { - // TODO: check - } - - public void fillRect(int x, int y, int width, int height) { - // TODO: check - } - - public void clearRect(int x, int y, int width, int height) { - // TODO: check - } - - public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) { - // TODO: check - } - - public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) { - // TODO: check - } - - public void drawOval(int x, int y, int width, int height) { - // TODO: check - } - - public void fillOval(int x, int y, int width, int height) { - // TODO: check - } - - public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) { - // TODO: check - } - - public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) { - // TODO: check - } - - public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints) { - // TODO: check - } - - public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints) { - // TODO: check - } - - public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints) { - // TODO: check - } - - public void drawString(String str, int x, int y) { - // TODO: check - } - - public void drawString(AttributedCharacterIterator iterator, int x, int y) { - // TODO: check - } - - public boolean drawImage(Image img, int x, int y, ImageObserver observer) { - return false; // TODO: check - } - - public boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer) { - return false; // TODO: check - } - - public boolean drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer) { - return false; // TODO: check - } - - public boolean drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer) { - return false; // TODO: check - } - - public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer) { - if (img instanceof BufferedImage) { - this.image = (BufferedImage) img; - } - return false; // TODO: check - } - - public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer) { - return false; // TODO: check - } - - public void dispose() { - // TODO: check - } - } -} diff --git a/test/jdk/javax/swing/plaf/metal/MetalInternalFrameUI/Test6657026.java b/test/jdk/javax/swing/plaf/metal/MetalInternalFrameUI/Test6657026.java deleted file mode 100644 index 158c743375c..00000000000 --- a/test/jdk/javax/swing/plaf/metal/MetalInternalFrameUI/Test6657026.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 6657026 - * @summary Tests shared MetalInternalFrameUI in different application contexts - * @author Sergey Malenkov - * @modules java.desktop/sun.awt - */ - -import sun.awt.SunToolkit; - -import javax.swing.JInternalFrame; -import javax.swing.JPanel; -import javax.swing.UIManager; -import javax.swing.plaf.metal.MetalInternalFrameUI; -import javax.swing.plaf.metal.MetalLookAndFeel; - -public class Test6657026 extends MetalInternalFrameUI implements Runnable { - - public static void main(String[] args) throws Exception { - UIManager.setLookAndFeel(new MetalLookAndFeel()); - - ThreadGroup group = new ThreadGroup("$$$"); - Thread thread = new Thread(group, new Test6657026()); - thread.start(); - thread.join(); - - new JInternalFrame().setContentPane(new JPanel()); - } - - public Test6657026() { - super(null); - } - - public void run() { - SunToolkit.createNewAppContext(); - IS_PALETTE = JInternalFrame.CONTENT_PANE_PROPERTY; - } -} diff --git a/test/jdk/javax/swing/plaf/metal/MetalSliderUI/Test6657026.java b/test/jdk/javax/swing/plaf/metal/MetalSliderUI/Test6657026.java deleted file mode 100644 index b8ea5e2bd07..00000000000 --- a/test/jdk/javax/swing/plaf/metal/MetalSliderUI/Test6657026.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 6657026 7077259 - * @summary Tests shared MetalSliderUI in different application contexts - * @author Sergey Malenkov - * @modules java.desktop/sun.awt - * @run main/othervm -Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel Test6657026 - */ - -import javax.swing.JSlider; -import javax.swing.UIManager; -import javax.swing.plaf.metal.MetalLookAndFeel; -import javax.swing.plaf.metal.MetalSliderUI; -import sun.awt.SunToolkit; - -public class Test6657026 extends MetalSliderUI implements Runnable { - - public static void main(String[] args) throws Exception { - JSlider slider = new JSlider(); - test(slider); - - ThreadGroup group = new ThreadGroup("$$$"); - Thread thread = new Thread(group, new Test6657026()); - thread.start(); - thread.join(); - - test(slider); - } - - public void run() { - SunToolkit.createNewAppContext(); - JSlider slider = new JSlider(); - test(slider); - tickLength = -10000; - } - - private static void test(JSlider slider) { - MetalSliderUI ui = (MetalSliderUI) slider.getUI(); - int actual = ui.getTickLength(); - if (actual != 11) { - throw new Error(actual + ", but expected 11"); - } - } -} From 3871b8899df79fa85619975bd1c7f59792a839d1 Mon Sep 17 00:00:00 2001 From: Damon Nguyen Date: Mon, 9 Feb 2026 17:43:07 +0000 Subject: [PATCH 031/120] 8375065: Update LCMS to 2.18 Reviewed-by: prr, serb, jdv --- src/java.desktop/share/legal/lcms.md | 4 +- .../share/native/liblcms/cmsalpha.c | 4 +- .../share/native/liblcms/cmscam02.c | 41 +++++++++-------- .../share/native/liblcms/cmscgats.c | 13 ++++-- .../share/native/liblcms/cmscnvrt.c | 2 +- .../share/native/liblcms/cmserr.c | 2 +- .../share/native/liblcms/cmsgamma.c | 3 +- .../share/native/liblcms/cmsgmt.c | 2 +- .../share/native/liblcms/cmshalf.c | 2 +- .../share/native/liblcms/cmsintrp.c | 10 ++-- .../share/native/liblcms/cmsio0.c | 12 +++-- .../share/native/liblcms/cmsio1.c | 10 +++- .../share/native/liblcms/cmslut.c | 2 +- .../share/native/liblcms/cmsmd5.c | 2 +- .../share/native/liblcms/cmsmtrx.c | 2 +- .../share/native/liblcms/cmsnamed.c | 16 +++---- .../share/native/liblcms/cmsopt.c | 16 +++++-- .../share/native/liblcms/cmspack.c | 2 +- .../share/native/liblcms/cmspcs.c | 2 +- .../share/native/liblcms/cmsplugin.c | 4 +- .../share/native/liblcms/cmsps2.c | 2 +- .../share/native/liblcms/cmssamp.c | 13 ++++-- src/java.desktop/share/native/liblcms/cmssm.c | 2 +- .../share/native/liblcms/cmstypes.c | 40 +++++++++------- .../share/native/liblcms/cmsvirt.c | 46 +++++++++++-------- .../share/native/liblcms/cmswtpnt.c | 2 +- .../share/native/liblcms/cmsxform.c | 9 +++- src/java.desktop/share/native/liblcms/lcms2.h | 6 +-- .../share/native/liblcms/lcms2_internal.h | 2 +- .../share/native/liblcms/lcms2_plugin.h | 2 +- 30 files changed, 167 insertions(+), 108 deletions(-) diff --git a/src/java.desktop/share/legal/lcms.md b/src/java.desktop/share/legal/lcms.md index d3bd7d84c8b..20a22ea4db5 100644 --- a/src/java.desktop/share/legal/lcms.md +++ b/src/java.desktop/share/legal/lcms.md @@ -1,11 +1,11 @@ -## Little Color Management System (LCMS) v2.17 +## Little Color Management System (LCMS) v2.18 ### LCMS License

 
 MIT License
 
-Copyright (C) 1998-2025 Marti Maria Saguer
+Copyright (C) 1998-2026 Marti Maria Saguer
 
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmsalpha.c b/src/java.desktop/share/native/liblcms/cmsalpha.c
index 2e50b65be24..bcedbde938e 100644
--- a/src/java.desktop/share/native/liblcms/cmsalpha.c
+++ b/src/java.desktop/share/native/liblcms/cmsalpha.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -406,7 +406,7 @@ int FormatterPos(cmsUInt32Number frm)
 static
 cmsFormatterAlphaFn _cmsGetFormatterAlpha(cmsContext id, cmsUInt32Number in, cmsUInt32Number out)
 {
-static cmsFormatterAlphaFn FormattersAlpha[6][6] = {
+static const cmsFormatterAlphaFn FormattersAlpha[6][6] = {
 
        /* from 8 */  { copy8,       from8to16,   from8to16SE,   from8toHLF,   from8toFLT,    from8toDBL    },
        /* from 16*/  { from16to8,   copy16,      from16to16,    from16toHLF,  from16toFLT,   from16toDBL   },
diff --git a/src/java.desktop/share/native/liblcms/cmscam02.c b/src/java.desktop/share/native/liblcms/cmscam02.c
index 45ef4eef970..168ef597032 100644
--- a/src/java.desktop/share/native/liblcms/cmscam02.c
+++ b/src/java.desktop/share/native/liblcms/cmscam02.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -285,27 +285,32 @@ CAM02COLOR InverseCorrelates(CAM02COLOR clr, cmsCIECAM02* pMod)
            (clr.J / 100.0),
            (1.0 / (pMod->c * pMod->z)));
 
-    p1 = e / t;
     p2 = (clr.A / pMod->Nbb) + 0.305;
-    p3 = 21.0 / 20.0;
 
-    hr = clr.h * d2r;
-
-    if (fabs(sin(hr)) >= fabs(cos(hr))) {
-        p4 = p1 / sin(hr);
-        clr.b = (p2 * (2.0 + p3) * (460.0 / 1403.0)) /
-            (p4 + (2.0 + p3) * (220.0 / 1403.0) *
-            (cos(hr) / sin(hr)) - (27.0 / 1403.0) +
-            p3 * (6300.0 / 1403.0));
-        clr.a = clr.b * (cos(hr) / sin(hr));
+    if ( t <= 0.0 ) {     // special case from spec notes, avoid divide by zero
+        clr.a = clr.b = 0.0;
     }
     else {
-        p5 = p1 / cos(hr);
-        clr.a = (p2 * (2.0 + p3) * (460.0 / 1403.0)) /
-            (p5 + (2.0 + p3) * (220.0 / 1403.0) -
-            ((27.0 / 1403.0) - p3 * (6300.0 / 1403.0)) *
-            (sin(hr) / cos(hr)));
-        clr.b = clr.a * (sin(hr) / cos(hr));
+        hr = clr.h * d2r;
+        p1 = e / t;
+        p3 = 21.0 / 20.0;
+
+        if (fabs(sin(hr)) >= fabs(cos(hr))) {
+            p4 = p1 / sin(hr);
+            clr.b = (p2 * (2.0 + p3) * (460.0 / 1403.0)) /
+                (p4 + (2.0 + p3) * (220.0 / 1403.0) *
+                (cos(hr) / sin(hr)) - (27.0 / 1403.0) +
+                p3 * (6300.0 / 1403.0));
+            clr.a = clr.b * (cos(hr) / sin(hr));
+        }
+        else {
+            p5 = p1 / cos(hr);
+            clr.a = (p2 * (2.0 + p3) * (460.0 / 1403.0)) /
+                (p5 + (2.0 + p3) * (220.0 / 1403.0) -
+                ((27.0 / 1403.0) - p3 * (6300.0 / 1403.0)) *
+                (sin(hr) / cos(hr)));
+            clr.b = clr.a * (sin(hr) / cos(hr));
+        }
     }
 
     clr.RGBpa[0] = ((460.0 / 1403.0) * p2) +
diff --git a/src/java.desktop/share/native/liblcms/cmscgats.c b/src/java.desktop/share/native/liblcms/cmscgats.c
index 3e62d064c3f..e8a75c7355f 100644
--- a/src/java.desktop/share/native/liblcms/cmscgats.c
+++ b/src/java.desktop/share/native/liblcms/cmscgats.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -295,7 +295,7 @@ typedef struct {
         WRITEMODE as;      // How is supposed to be written
     } PROPERTY;
 
-static PROPERTY PredefinedProperties[] = {
+static const PROPERTY PredefinedProperties[] = {
 
         {"NUMBER_OF_FIELDS", WRITE_UNCOOKED},    // Required - NUMBER OF FIELDS
         {"NUMBER_OF_SETS",   WRITE_UNCOOKED},    // Required - NUMBER OF SETS
@@ -458,7 +458,7 @@ cmsBool StringAppend(string* s, char c)
         new_ptr = (char*) AllocChunk(s->it8, s->max);
         if (new_ptr == NULL) return FALSE;
 
-        if (new_ptr != NULL && s->begin != NULL)
+        if (s->begin != NULL)
             memcpy(new_ptr, s->begin, s->len);
 
         s->begin = new_ptr;
@@ -899,6 +899,11 @@ void InSymbol(cmsIT8* it8)
                     sign = -1;
                     NextCh(it8);
                 }
+                else
+                    if (it8->ch == '+') {
+                        sign = +1;
+                        NextCh(it8);
+                    }
 
                 it8->inum = 0;
                 it8->sy   = SINUM;
@@ -3206,7 +3211,7 @@ cmsBool ParseCube(cmsIT8* cube, cmsStage** Shaper, cmsStage** CLUT, char title[]
 
                 int nodes = lut_size * lut_size * lut_size;
 
-                cmsFloat32Number* lut_table = _cmsMalloc(cube->ContextID, nodes * 3 * sizeof(cmsFloat32Number));
+                cmsFloat32Number* lut_table = (cmsFloat32Number*) _cmsMalloc(cube->ContextID, nodes * 3 * sizeof(cmsFloat32Number));
                 if (lut_table == NULL) return FALSE;
 
                 for (i = 0; i < nodes; i++) {
diff --git a/src/java.desktop/share/native/liblcms/cmscnvrt.c b/src/java.desktop/share/native/liblcms/cmscnvrt.c
index 9f8619cb9da..c66dbcbebad 100644
--- a/src/java.desktop/share/native/liblcms/cmscnvrt.c
+++ b/src/java.desktop/share/native/liblcms/cmscnvrt.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmserr.c b/src/java.desktop/share/native/liblcms/cmserr.c
index d421c550d32..877beb9ca6a 100644
--- a/src/java.desktop/share/native/liblcms/cmserr.c
+++ b/src/java.desktop/share/native/liblcms/cmserr.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmsgamma.c b/src/java.desktop/share/native/liblcms/cmsgamma.c
index 773858b0c1f..bace6ab02e2 100644
--- a/src/java.desktop/share/native/liblcms/cmsgamma.c
+++ b/src/java.desktop/share/native/liblcms/cmsgamma.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -1187,6 +1187,7 @@ cmsBool smooth2(cmsContext ContextID, cmsFloat32Number w[], cmsFloat32Number y[]
     cmsFloat32Number *c, *d, *e;
     cmsBool st;
 
+    if (m < 4 || lambda < MATRIX_DET_TOLERANCE) return FALSE;
 
     c = (cmsFloat32Number*) _cmsCalloc(ContextID, MAX_NODES_IN_CURVE, sizeof(cmsFloat32Number));
     d = (cmsFloat32Number*) _cmsCalloc(ContextID, MAX_NODES_IN_CURVE, sizeof(cmsFloat32Number));
diff --git a/src/java.desktop/share/native/liblcms/cmsgmt.c b/src/java.desktop/share/native/liblcms/cmsgmt.c
index 03ac70202a5..1b023dcc299 100644
--- a/src/java.desktop/share/native/liblcms/cmsgmt.c
+++ b/src/java.desktop/share/native/liblcms/cmsgmt.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmshalf.c b/src/java.desktop/share/native/liblcms/cmshalf.c
index 7e5f7a3c7e0..e1fb1d55488 100644
--- a/src/java.desktop/share/native/liblcms/cmshalf.c
+++ b/src/java.desktop/share/native/liblcms/cmshalf.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmsintrp.c b/src/java.desktop/share/native/liblcms/cmsintrp.c
index 43c47429c3c..23e59a229a9 100644
--- a/src/java.desktop/share/native/liblcms/cmsintrp.c
+++ b/src/java.desktop/share/native/liblcms/cmsintrp.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -984,9 +984,9 @@ void Eval4Inputs(CMSREGISTER const cmsUInt16Number Input[],
                                 c1 = c2 = c3 = 0;
                             }
 
-        Rest = c1 * rx + c2 * ry + c3 * rz;
+        Rest = c1 * rx + c2 * ry + c3 * rz + 0x8001;
 
-        Tmp1[OutChan] = (cmsUInt16Number)(c0 + ROUND_FIXED_TO_INT(_cmsToFixedDomain(Rest)));
+        Tmp1[OutChan] = (cmsUInt16Number)c0 + ((Rest + (Rest >> 16)) >> 16);
     }
 
 
@@ -1048,9 +1048,9 @@ void Eval4Inputs(CMSREGISTER const cmsUInt16Number Input[],
                                 c1 = c2 = c3 = 0;
                             }
 
-        Rest = c1 * rx + c2 * ry + c3 * rz;
+        Rest = c1 * rx + c2 * ry + c3 * rz + 0x8001;
 
-        Tmp2[OutChan] = (cmsUInt16Number) (c0 + ROUND_FIXED_TO_INT(_cmsToFixedDomain(Rest)));
+        Tmp2[OutChan] = (cmsUInt16Number) c0 + ((Rest + (Rest >> 16)) >> 16);
     }
 
 
diff --git a/src/java.desktop/share/native/liblcms/cmsio0.c b/src/java.desktop/share/native/liblcms/cmsio0.c
index 5258b7939d2..5a4f09af5bc 100644
--- a/src/java.desktop/share/native/liblcms/cmsio0.c
+++ b/src/java.desktop/share/native/liblcms/cmsio0.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -685,6 +685,7 @@ void _cmsDeleteTagByPos(_cmsICCPROFILE* Icc, int i)
         // Free previous version
         if (Icc ->TagSaveAsRaw[i]) {
             _cmsFree(Icc ->ContextID, Icc ->TagPtrs[i]);
+            Icc->TagSaveAsRaw[i] = FALSE;
         }
         else {
             cmsTagTypeHandler* TypeHandler = Icc ->TagTypeHandlers[i];
@@ -1605,6 +1606,8 @@ void freeOneTag(_cmsICCPROFILE* Icc, cmsUInt32Number i)
         else
             _cmsFree(Icc->ContextID, Icc->TagPtrs[i]);
     }
+
+    Icc->TagPtrs[i] = NULL;
 }
 
 // Closes a profile freeing any involved resources
@@ -1847,8 +1850,11 @@ cmsBool CMSEXPORT cmsWriteTag(cmsHPROFILE hProfile, cmsTagSignature sig, const v
 
     if (!_cmsNewTag(Icc, sig, &i)) goto Error;
 
-    // This is not raw
-    Icc ->TagSaveAsRaw[i] = FALSE;
+    // This cannot be RAW
+    if (Icc->TagSaveAsRaw[i]) {
+        cmsSignalError(Icc->ContextID, cmsERROR_ALREADY_DEFINED, "Tag  '%x' was already saved as RAW", sig);
+        goto Error;
+    }
 
     // This is not a link
     Icc ->TagLinked[i] = (cmsTagSignature) 0;
diff --git a/src/java.desktop/share/native/liblcms/cmsio1.c b/src/java.desktop/share/native/liblcms/cmsio1.c
index 48772c7cbde..463f1192c2a 100644
--- a/src/java.desktop/share/native/liblcms/cmsio1.c
+++ b/src/java.desktop/share/native/liblcms/cmsio1.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -1012,7 +1012,13 @@ const cmsMLU* GetInfo(cmsHPROFILE hProfile, cmsInfoType Info)
     switch (Info) {
 
     case cmsInfoDescription:
-        sig = cmsSigProfileDescriptionTag;
+        /**
+        * Add for MacOS, which uses propiertary tags for description
+        */
+        if (cmsIsTag(hProfile, cmsSigProfileDescriptionMLTag))
+            sig = cmsSigProfileDescriptionMLTag;
+        else
+            sig = cmsSigProfileDescriptionTag;
         break;
 
     case cmsInfoManufacturer:
diff --git a/src/java.desktop/share/native/liblcms/cmslut.c b/src/java.desktop/share/native/liblcms/cmslut.c
index 3cf4e8cac5a..28220eae667 100644
--- a/src/java.desktop/share/native/liblcms/cmslut.c
+++ b/src/java.desktop/share/native/liblcms/cmslut.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmsmd5.c b/src/java.desktop/share/native/liblcms/cmsmd5.c
index d9b9a4e5260..f18300ebace 100644
--- a/src/java.desktop/share/native/liblcms/cmsmd5.c
+++ b/src/java.desktop/share/native/liblcms/cmsmd5.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmsmtrx.c b/src/java.desktop/share/native/liblcms/cmsmtrx.c
index 841da662a10..1db000752e3 100644
--- a/src/java.desktop/share/native/liblcms/cmsmtrx.c
+++ b/src/java.desktop/share/native/liblcms/cmsmtrx.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmsnamed.c b/src/java.desktop/share/native/liblcms/cmsnamed.c
index 451bfe9f34d..acdaabc3ec2 100644
--- a/src/java.desktop/share/native/liblcms/cmsnamed.c
+++ b/src/java.desktop/share/native/liblcms/cmsnamed.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -303,7 +303,7 @@ cmsUInt32Number encodeUTF8(char* out, const wchar_t* in, cmsUInt32Number max_wch
     cmsUInt32Number size = 0;
     cmsUInt32Number len_w = 0;
 
-    while (*in && len_w < max_wchars)
+    while (len_w < max_wchars && *in)
     {
         if (*in >= 0xd800 && *in <= 0xdbff)
             codepoint = ((*in - 0xd800) << 10) + 0x10000;
@@ -1071,17 +1071,17 @@ cmsSEQ* CMSEXPORT cmsDupProfileSequenceDescription(const cmsSEQ* pseq)
     if (pseq == NULL)
         return NULL;
 
-    NewSeq = (cmsSEQ*) _cmsMalloc(pseq -> ContextID, sizeof(cmsSEQ));
+    NewSeq = (cmsSEQ*)_cmsMallocZero(pseq->ContextID, sizeof(cmsSEQ));
     if (NewSeq == NULL) return NULL;
 
+    NewSeq->ContextID = pseq->ContextID;
 
-    NewSeq -> seq      = (cmsPSEQDESC*) _cmsCalloc(pseq ->ContextID, pseq ->n, sizeof(cmsPSEQDESC));
-    if (NewSeq ->seq == NULL) goto Error;
+    NewSeq->seq = (cmsPSEQDESC*)_cmsCalloc(pseq->ContextID, pseq->n, sizeof(cmsPSEQDESC));
+    if (NewSeq->seq == NULL) goto Error;
 
-    NewSeq -> ContextID = pseq ->ContextID;
-    NewSeq -> n        = pseq ->n;
+    NewSeq->n = pseq->n;
 
-    for (i=0; i < pseq->n; i++) {
+    for (i = 0; i < pseq->n; i++) {
 
         memmove(&NewSeq ->seq[i].attributes, &pseq ->seq[i].attributes, sizeof(cmsUInt64Number));
 
diff --git a/src/java.desktop/share/native/liblcms/cmsopt.c b/src/java.desktop/share/native/liblcms/cmsopt.c
index 767008e68c5..9e71426a332 100644
--- a/src/java.desktop/share/native/liblcms/cmsopt.c
+++ b/src/java.desktop/share/native/liblcms/cmsopt.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -698,11 +698,16 @@ cmsBool OptimizeByResampling(cmsPipeline** Lut, cmsUInt32Number Intent, cmsUInt3
     if (ColorSpace == (cmsColorSpaceSignature)0 ||
         OutputColorSpace == (cmsColorSpaceSignature)0) return FALSE;
 
-    nGridPoints = _cmsReasonableGridpointsByColorspace(ColorSpace, *dwFlags);
-
     // For empty LUTs, 2 points are enough
     if (cmsPipelineStageCount(*Lut) == 0)
         nGridPoints = 2;
+    else
+    {
+        nGridPoints = _cmsReasonableGridpointsByColorspace(ColorSpace, *dwFlags);
+
+        // Lab16 as input cannot be optimized by a CLUT due to centering issues, thanks to Mike Chaney for discovering this.
+        if (!(*dwFlags & cmsFLAGS_FORCE_CLUT) && (ColorSpace == cmsSigLabData) && (T_BYTES(*InputFormat) == 2)) return FALSE;
+    }
 
     Src = *Lut;
 
@@ -813,6 +818,11 @@ Error:
             Dest ->OutputChannels,
             DataSetOut);
 
+        if (p16 == NULL) {
+            cmsPipelineFree(Dest);
+            return FALSE;
+        }
+
         _cmsPipelineSetOptimizationParameters(Dest, PrelinEval16, (void*) p16, PrelinOpt16free, Prelin16dup);
     }
 
diff --git a/src/java.desktop/share/native/liblcms/cmspack.c b/src/java.desktop/share/native/liblcms/cmspack.c
index d430e73051d..b740567af3b 100644
--- a/src/java.desktop/share/native/liblcms/cmspack.c
+++ b/src/java.desktop/share/native/liblcms/cmspack.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmspcs.c b/src/java.desktop/share/native/liblcms/cmspcs.c
index 5f1b1f0d8e6..8c33057721e 100644
--- a/src/java.desktop/share/native/liblcms/cmspcs.c
+++ b/src/java.desktop/share/native/liblcms/cmspcs.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmsplugin.c b/src/java.desktop/share/native/liblcms/cmsplugin.c
index aaad39f52b0..a943c9f4dd9 100644
--- a/src/java.desktop/share/native/liblcms/cmsplugin.c
+++ b/src/java.desktop/share/native/liblcms/cmsplugin.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -522,7 +522,7 @@ cmsBool CMSEXPORT _cmsIOPrintf(cmsIOHANDLER* io, const char* frm, ...)
     va_start(args, frm);
 
     len = vsnprintf((char*) Buffer, 2047, frm, args);
-    if (len < 0) {
+    if (len < 0 || len >= 2047) {
         va_end(args);
         return FALSE;   // Truncated, which is a fatal error for us
     }
diff --git a/src/java.desktop/share/native/liblcms/cmsps2.c b/src/java.desktop/share/native/liblcms/cmsps2.c
index 476817e9c1a..80f7c8084ae 100644
--- a/src/java.desktop/share/native/liblcms/cmsps2.c
+++ b/src/java.desktop/share/native/liblcms/cmsps2.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmssamp.c b/src/java.desktop/share/native/liblcms/cmssamp.c
index ca5c4a9d693..c54a0d4ea72 100644
--- a/src/java.desktop/share/native/liblcms/cmssamp.c
+++ b/src/java.desktop/share/native/liblcms/cmssamp.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -152,9 +152,12 @@ cmsBool  BlackPointAsDarkerColorant(cmsHPROFILE    hInput,
     // Convert black to Lab
     cmsDoTransform(xform, Black, &Lab, 1);
 
-    // Force it to be neutral, check for inconsistencies
-    Lab.a = Lab.b = 0;
-    if (Lab.L > 50 || Lab.L < 0) Lab.L = 0;
+    if (Lab.L > 95)
+        Lab.L = 0;  // for synthetical negative profiles
+    else if (Lab.L < 0)
+        Lab.L = 0;
+    else if (Lab.L > 50)
+        Lab.L = 50;
 
     // Free the resources
     cmsDeleteTransform(xform);
@@ -352,7 +355,7 @@ cmsFloat64Number RootOfLeastSquaresFitQuadraticCurve(int n, cmsFloat64Number x[]
     if (fabs(a) < 1.0E-10) {
 
         if (fabs(b) < 1.0E-10) return 0;
-        return cmsmin(0, cmsmax(50, -c/b ));
+        return cmsmax(0, cmsmin(50, -c/b ));
     }
     else {
 
diff --git a/src/java.desktop/share/native/liblcms/cmssm.c b/src/java.desktop/share/native/liblcms/cmssm.c
index e2a810a2669..b79cd85488b 100644
--- a/src/java.desktop/share/native/liblcms/cmssm.c
+++ b/src/java.desktop/share/native/liblcms/cmssm.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmstypes.c b/src/java.desktop/share/native/liblcms/cmstypes.c
index 22514f88226..eab74940cd0 100644
--- a/src/java.desktop/share/native/liblcms/cmstypes.c
+++ b/src/java.desktop/share/native/liblcms/cmstypes.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -4786,7 +4786,6 @@ cmsBool ReadMPEElem(struct _cms_typehandler_struct* self,
 
     return TRUE;
 
-    cmsUNUSED_PARAMETER(SizeOfTag);
     cmsUNUSED_PARAMETER(n);
 }
 
@@ -4894,9 +4893,11 @@ cmsBool Type_MPE_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, v
                  goto Error;
         }
 
+         Before = io ->Tell(io);
+
         if (!_cmsWriteUInt32Number(io, ElementSig)) goto Error;
         if (!_cmsWriteUInt32Number(io, 0)) goto Error;
-        Before = io ->Tell(io);
+
         if (!TypeHandler ->WritePtr(self, io, Elem, 1)) goto Error;
         if (!_cmsWriteAlignment(io)) goto Error;
 
@@ -5645,9 +5646,7 @@ void* Type_VideoSignal_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER*
 {
     cmsVideoSignalType* cicp = NULL;
 
-    if (SizeOfTag != 8) return NULL;
-
-    if (!_cmsReadUInt32Number(io, NULL)) return NULL;
+    if (SizeOfTag != 4) return NULL;
 
     cicp = (cmsVideoSignalType*)_cmsCalloc(self->ContextID, 1, sizeof(cmsVideoSignalType));
     if (cicp == NULL) return NULL;
@@ -5671,7 +5670,6 @@ cmsBool Type_VideoSignal_Write(struct _cms_typehandler_struct* self, cmsIOHANDLE
 {
     cmsVideoSignalType* cicp = (cmsVideoSignalType*)Ptr;
 
-    if (!_cmsWriteUInt32Number(io, 0)) return FALSE;
     if (!_cmsWriteUInt8Number(io, cicp->ColourPrimaries)) return FALSE;
     if (!_cmsWriteUInt8Number(io, cicp->TransferCharacteristics)) return FALSE;
     if (!_cmsWriteUInt8Number(io, cicp->MatrixCoefficients)) return FALSE;
@@ -5744,11 +5742,11 @@ void Type_MHC2_Free(struct _cms_typehandler_struct* self, void* Ptr)
 
 void* Type_MHC2_Dup(struct _cms_typehandler_struct* self, const void* Ptr, cmsUInt32Number n)
 {
-    cmsMHC2Type* mhc2 = _cmsDupMem(self->ContextID, Ptr, sizeof(cmsMHC2Type));
+    cmsMHC2Type* mhc2 = (cmsMHC2Type*)_cmsDupMem(self->ContextID, Ptr, sizeof(cmsMHC2Type));
 
-    mhc2->RedCurve = _cmsDupMem(self->ContextID,   mhc2->RedCurve, mhc2->CurveEntries*sizeof(cmsFloat64Number));
-    mhc2->GreenCurve = _cmsDupMem(self->ContextID, mhc2->GreenCurve, mhc2->CurveEntries * sizeof(cmsFloat64Number));
-    mhc2->BlueCurve = _cmsDupMem(self->ContextID,  mhc2->BlueCurve, mhc2->CurveEntries * sizeof(cmsFloat64Number));
+    mhc2->RedCurve = (cmsFloat64Number*) _cmsDupMem(self->ContextID,   mhc2->RedCurve, mhc2->CurveEntries*sizeof(cmsFloat64Number));
+    mhc2->GreenCurve = (cmsFloat64Number*) _cmsDupMem(self->ContextID, mhc2->GreenCurve, mhc2->CurveEntries * sizeof(cmsFloat64Number));
+    mhc2->BlueCurve = (cmsFloat64Number*) _cmsDupMem(self->ContextID,  mhc2->BlueCurve, mhc2->CurveEntries * sizeof(cmsFloat64Number));
 
     if (mhc2->RedCurve == NULL ||
         mhc2->GreenCurve == NULL ||
@@ -5786,7 +5784,6 @@ cmsBool Type_MHC2_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io,
     cmsUInt32Number MatrixOffset;
     cmsUInt32Number OffsetRedTable, OffsetGreenTable, OffsetBlueTable;
 
-    if (!_cmsWriteUInt32Number(io, 0)) return FALSE;
     if (!_cmsWriteUInt32Number(io, mhc2->CurveEntries)) return FALSE;
 
     if (!_cmsWrite15Fixed16Number(io, mhc2->MinLuminance)) return FALSE;
@@ -5811,10 +5808,20 @@ cmsBool Type_MHC2_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io,
     }
 
     OffsetRedTable = io->Tell(io) - BaseOffset;
+
+    if(!_cmsWriteUInt32Number(io, cmsSigS15Fixed16ArrayType)) return FALSE;
+    if(!_cmsWriteUInt32Number(io, 0)) return FALSE;
+
     if (!WriteDoubles(io, mhc2->CurveEntries, mhc2->RedCurve)) return FALSE;
+
     OffsetGreenTable = io->Tell(io) - BaseOffset;
+    if (!_cmsWriteUInt32Number(io, cmsSigS15Fixed16ArrayType)) return FALSE;
+    if (!_cmsWriteUInt32Number(io, 0)) return FALSE;
     if (!WriteDoubles(io, mhc2->CurveEntries, mhc2->GreenCurve)) return FALSE;
+
     OffsetBlueTable = io->Tell(io) - BaseOffset;
+    if (!_cmsWriteUInt32Number(io, cmsSigS15Fixed16ArrayType)) return FALSE;
+    if (!_cmsWriteUInt32Number(io, 0)) return FALSE;
     if (!WriteDoubles(io, mhc2->CurveEntries, mhc2->BlueCurve)) return FALSE;
 
     if (!io->Seek(io, TablesOffsetPos)) return FALSE;
@@ -5858,8 +5865,6 @@ void* Type_MHC2_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cms
     cmsUInt32Number MatrixOffset;
     cmsUInt32Number OffsetRedTable, OffsetGreenTable, OffsetBlueTable;
 
-    if (!_cmsReadUInt32Number(io, NULL)) return NULL;
-
     mhc2 = (cmsMHC2Type*)_cmsCalloc(self->ContextID, 1, sizeof(cmsMHC2Type));
     if (mhc2 == NULL) return NULL;
 
@@ -5890,9 +5895,10 @@ void* Type_MHC2_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cms
         if (!ReadDoublesAt(io, BaseOffset + MatrixOffset, 3*4, &mhc2->XYZ2XYZmatrix[0][0])) goto Error;
     }
 
-    if (!ReadDoublesAt(io, BaseOffset + OffsetRedTable, mhc2->CurveEntries, mhc2->RedCurve)) goto Error;
-    if (!ReadDoublesAt(io, BaseOffset + OffsetGreenTable, mhc2->CurveEntries, mhc2->GreenCurve)) goto Error;
-    if (!ReadDoublesAt(io, BaseOffset + OffsetBlueTable, mhc2->CurveEntries, mhc2->BlueCurve)) goto Error;
+    // Skip sf32 tag and filler (8bytes)
+    if (!ReadDoublesAt(io, BaseOffset + OffsetRedTable + 8, mhc2->CurveEntries, mhc2->RedCurve)) goto Error;
+    if (!ReadDoublesAt(io, BaseOffset + OffsetGreenTable + 8, mhc2->CurveEntries, mhc2->GreenCurve)) goto Error;
+    if (!ReadDoublesAt(io, BaseOffset + OffsetBlueTable + 8, mhc2->CurveEntries, mhc2->BlueCurve)) goto Error;
 
     // Success
     *nItems = 1;
diff --git a/src/java.desktop/share/native/liblcms/cmsvirt.c b/src/java.desktop/share/native/liblcms/cmsvirt.c
index 1ef86dae054..0dfc6e947a5 100644
--- a/src/java.desktop/share/native/liblcms/cmsvirt.c
+++ b/src/java.desktop/share/native/liblcms/cmsvirt.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -400,7 +400,7 @@ int InkLimitingSampler(CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUI
     SumCMY   = (cmsFloat64Number) In[0]  + In[1] + In[2];
     SumCMYK  = SumCMY + In[3];
 
-    if (SumCMYK > InkLimit) {
+    if (SumCMYK > InkLimit && SumCMY > 0) {
 
         Ratio = 1 - ((SumCMYK - InkLimit) / SumCMY);
         if (Ratio < 0)
@@ -513,16 +513,20 @@ cmsHPROFILE CMSEXPORT cmsCreateLab2ProfileTHR(cmsContext ContextID, const cmsCIE
     cmsSetColorSpace(hProfile,  cmsSigLabData);
     cmsSetPCS(hProfile,         cmsSigLabData);
 
-    if (!SetTextTags(hProfile, L"Lab identity built-in")) return NULL;
+    if (!SetTextTags(hProfile, L"Lab identity built-in"))
+        goto Error;
 
     // An identity LUT is all we need
     LUT = cmsPipelineAlloc(ContextID, 3, 3);
-    if (LUT == NULL) goto Error;
+    if (LUT == NULL)
+        goto Error;
 
     if (!cmsPipelineInsertStage(LUT, cmsAT_BEGIN, _cmsStageAllocIdentityCLut(ContextID, 3)))
         goto Error;
 
-    if (!cmsWriteTag(hProfile, cmsSigAToB0Tag, LUT)) goto Error;
+    if (!cmsWriteTag(hProfile, cmsSigAToB0Tag, LUT))
+        goto Error;
+
     cmsPipelineFree(LUT);
 
     return hProfile;
@@ -550,8 +554,14 @@ cmsHPROFILE CMSEXPORT cmsCreateLab4ProfileTHR(cmsContext ContextID, const cmsCIE
 {
     cmsHPROFILE hProfile;
     cmsPipeline* LUT = NULL;
+    cmsCIEXYZ xyz;
 
-    hProfile = cmsCreateRGBProfileTHR(ContextID, WhitePoint == NULL ? cmsD50_xyY() : WhitePoint, NULL, NULL);
+    if (WhitePoint == NULL)
+        xyz = *cmsD50_XYZ();
+    else
+        cmsxyY2XYZ(&xyz, WhitePoint);
+
+    hProfile = cmsCreateRGBProfileTHR(ContextID, NULL, NULL, NULL);
     if (hProfile == NULL) return NULL;
 
     cmsSetProfileVersion(hProfile, 4.4);
@@ -560,6 +570,7 @@ cmsHPROFILE CMSEXPORT cmsCreateLab4ProfileTHR(cmsContext ContextID, const cmsCIE
     cmsSetColorSpace(hProfile,  cmsSigLabData);
     cmsSetPCS(hProfile,         cmsSigLabData);
 
+    if (!cmsWriteTag(hProfile, cmsSigMediaWhitePointTag, &xyz)) goto Error;
     if (!SetTextTags(hProfile, L"Lab identity built-in")) goto Error;
 
     // An empty LUTs is all we need
@@ -929,25 +940,24 @@ cmsHPROFILE CMSEXPORT cmsCreateBCHSWabstractProfileTHR(cmsContext ContextID,
 
     for (i=0; i < MAX_INPUT_DIMENSIONS; i++) Dimensions[i] = nLUTPoints;
     CLUT = cmsStageAllocCLut16bitGranular(ContextID, Dimensions, 3, 3, NULL);
-    if (CLUT == NULL) goto Error;
-
-
-    if (!cmsStageSampleCLut16bit(CLUT, bchswSampler, (void*) &bchsw, 0)) {
-
-        // Shouldn't reach here
+    if (CLUT == NULL)
         goto Error;
-    }
 
-    if (!cmsPipelineInsertStage(Pipeline, cmsAT_END, CLUT)) {
+    if (!cmsStageSampleCLut16bit(CLUT, bchswSampler, (void*) &bchsw, 0))
+        goto Error;
+
+    if (!cmsPipelineInsertStage(Pipeline, cmsAT_END, CLUT))
         goto Error;
-    }
 
     // Create tags
-    if (!SetTextTags(hICC, L"BCHS built-in")) return NULL;
+    if (!SetTextTags(hICC, L"BCHS built-in"))
+        goto Error;
 
-    cmsWriteTag(hICC, cmsSigMediaWhitePointTag, (void*) cmsD50_XYZ());
+    if (!cmsWriteTag(hICC, cmsSigMediaWhitePointTag, (void*)cmsD50_XYZ()))
+        goto Error;
 
-    cmsWriteTag(hICC, cmsSigAToB0Tag, (void*) Pipeline);
+    if (!cmsWriteTag(hICC, cmsSigAToB0Tag, (void*)Pipeline))
+        goto Error;
 
     // Pipeline is already on virtual profile
     cmsPipelineFree(Pipeline);
diff --git a/src/java.desktop/share/native/liblcms/cmswtpnt.c b/src/java.desktop/share/native/liblcms/cmswtpnt.c
index ebba2cd6a97..f6337765c0c 100644
--- a/src/java.desktop/share/native/liblcms/cmswtpnt.c
+++ b/src/java.desktop/share/native/liblcms/cmswtpnt.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmsxform.c b/src/java.desktop/share/native/liblcms/cmsxform.c
index 1eb3eecbf18..b5dd302b973 100644
--- a/src/java.desktop/share/native/liblcms/cmsxform.c
+++ b/src/java.desktop/share/native/liblcms/cmsxform.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -1101,6 +1101,8 @@ cmsBool  IsProperColorSpace(cmsColorSpaceSignature Check, cmsUInt32Number dwForm
     int Space1 = (int) T_COLORSPACE(dwFormat);
     int Space2 = _cmsLCMScolorSpace(Check);
 
+    if (dwFormat == 0) return TRUE; // Bypass used by linkicc
+
     if (Space1 == PT_ANY) return (T_CHANNELS(dwFormat) == cmsChannelsOf(Check));
     if (Space1 == Space2) return TRUE;
 
@@ -1183,6 +1185,11 @@ cmsHTRANSFORM CMSEXPORT cmsCreateExtendedTransform(cmsContext ContextID,
         if (hGamutProfile == NULL) dwFlags &= ~cmsFLAGS_GAMUTCHECK;
     }
 
+    if ((dwFlags & cmsFLAGS_GAMUTCHECK) && (nGamutPCSposition <= 0 || nGamutPCSposition >= nProfiles - 1)) {
+        cmsSignalError(ContextID, cmsERROR_RANGE, "Wrong gamut PCS position '%d'", nGamutPCSposition);
+        return NULL;
+    }
+
     // On floating point transforms, inhibit cache
     if (_cmsFormatterIsFloat(InputFormat) || _cmsFormatterIsFloat(OutputFormat))
         dwFlags |= cmsFLAGS_NOCACHE;
diff --git a/src/java.desktop/share/native/liblcms/lcms2.h b/src/java.desktop/share/native/liblcms/lcms2.h
index 5ba09661308..17a52384721 100644
--- a/src/java.desktop/share/native/liblcms/lcms2.h
+++ b/src/java.desktop/share/native/liblcms/lcms2.h
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2025 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -52,7 +52,7 @@
 //
 //---------------------------------------------------------------------------------
 //
-// Version 2.17
+// Version 2.18
 //
 
 #ifndef _lcms2_H
@@ -116,7 +116,7 @@ extern "C" {
 #endif
 
 // Version/release
-#define LCMS_VERSION        2170
+#define LCMS_VERSION        2180
 
 // I will give the chance of redefining basic types for compilers that are not fully C99 compliant
 #ifndef CMS_BASIC_TYPES_ALREADY_DEFINED
diff --git a/src/java.desktop/share/native/liblcms/lcms2_internal.h b/src/java.desktop/share/native/liblcms/lcms2_internal.h
index d14c0dd823e..6bfe67e5350 100644
--- a/src/java.desktop/share/native/liblcms/lcms2_internal.h
+++ b/src/java.desktop/share/native/liblcms/lcms2_internal.h
@@ -30,7 +30,7 @@
 
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/lcms2_plugin.h b/src/java.desktop/share/native/liblcms/lcms2_plugin.h
index bdfc76f6bf5..85de9bc56d5 100644
--- a/src/java.desktop/share/native/liblcms/lcms2_plugin.h
+++ b/src/java.desktop/share/native/liblcms/lcms2_plugin.h
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2024 Marti Maria Saguer
+//  Copyright (c) 1998-2026 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),

From 161aa5d52865295059f9506b2ba4ffc4b98324de Mon Sep 17 00:00:00 2001
From: Mohamed Issa 
Date: Mon, 9 Feb 2026 19:14:46 +0000
Subject: [PATCH 032/120] 8371955: Support AVX10 floating point comparison
 instructions

Reviewed-by: epeter, sviswanathan, sparasa
---
 src/hotspot/cpu/x86/assembler_x86.cpp         |  40 +-
 src/hotspot/cpu/x86/assembler_x86.hpp         |   6 +-
 src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp |  25 +-
 src/hotspot/cpu/x86/macroAssembler_x86.cpp    |  22 +
 src/hotspot/cpu/x86/macroAssembler_x86.hpp    |  10 +-
 src/hotspot/cpu/x86/x86.ad                    | 387 +++++++++------
 .../compiler/c2/irTests/CMoveLConstants.java  |  35 +-
 .../compiler/lib/ir_framework/IRNode.java     |   5 +
 .../test/ApplicableIRRulesPrinter.java        |   2 +
 .../openjdk/bench/java/lang/FPComparison.java | 444 ++++++++++++++++--
 10 files changed, 774 insertions(+), 202 deletions(-)

diff --git a/src/hotspot/cpu/x86/assembler_x86.cpp b/src/hotspot/cpu/x86/assembler_x86.cpp
index cbc5c6988d4..3c8defe62d9 100644
--- a/src/hotspot/cpu/x86/assembler_x86.cpp
+++ b/src/hotspot/cpu/x86/assembler_x86.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -7320,6 +7320,25 @@ void Assembler::ucomisd(XMMRegister dst, XMMRegister src) {
   emit_int16(0x2E, (0xC0 | encode));
 }
 
+void Assembler::vucomxsd(XMMRegister dst, Address src) {
+  assert(VM_Version::supports_avx10_2(), "");
+  InstructionMark im(this);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
+  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit);
+  attributes.set_is_evex_instruction();
+  vex_prefix(src, 0, dst->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
+  emit_int8(0x2E);
+  emit_operand(dst, src, 0);
+}
+
+void Assembler::vucomxsd(XMMRegister dst, XMMRegister src) {
+  assert(VM_Version::supports_avx10_2(), "");
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
+  attributes.set_is_evex_instruction();
+  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes);
+  emit_int16(0x2E, (0xC0 | encode));
+}
+
 void Assembler::ucomiss(XMMRegister dst, Address src) {
   InstructionMark im(this);
   InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
@@ -7335,6 +7354,25 @@ void Assembler::ucomiss(XMMRegister dst, XMMRegister src) {
   emit_int16(0x2E, (0xC0 | encode));
 }
 
+void Assembler::vucomxss(XMMRegister dst, Address src) {
+  assert(VM_Version::supports_avx10_2(), "");
+  InstructionMark im(this);
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
+  attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_32bit);
+  attributes.set_is_evex_instruction();
+  vex_prefix(src, 0, dst->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
+  emit_int8(0x2E);
+  emit_operand(dst, src, 0);
+}
+
+void Assembler::vucomxss(XMMRegister dst, XMMRegister src) {
+  assert(VM_Version::supports_avx10_2(), "");
+  InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);
+  attributes.set_is_evex_instruction();
+  int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes);
+  emit_int16(0x2E, (0xC0 | encode));
+}
+
 void Assembler::xabort(int8_t imm8) {
   emit_int24((unsigned char)0xC6, (unsigned char)0xF8, (imm8 & 0xFF));
 }
diff --git a/src/hotspot/cpu/x86/assembler_x86.hpp b/src/hotspot/cpu/x86/assembler_x86.hpp
index 26c57fc2d80..97854f712cf 100644
--- a/src/hotspot/cpu/x86/assembler_x86.hpp
+++ b/src/hotspot/cpu/x86/assembler_x86.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2331,10 +2331,14 @@ private:
   // Unordered Compare Scalar Double-Precision Floating-Point Values and set EFLAGS
   void ucomisd(XMMRegister dst, Address src);
   void ucomisd(XMMRegister dst, XMMRegister src);
+  void vucomxsd(XMMRegister dst, Address src);
+  void vucomxsd(XMMRegister dst, XMMRegister src);
 
   // Unordered Compare Scalar Single-Precision Floating-Point Values and set EFLAGS
   void ucomiss(XMMRegister dst, Address src);
   void ucomiss(XMMRegister dst, XMMRegister src);
+  void vucomxss(XMMRegister dst, Address src);
+  void vucomxss(XMMRegister dst, XMMRegister src);
 
   void xabort(int8_t imm8);
 
diff --git a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp
index 8fc3d18abb1..c65b439604b 100644
--- a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp
+++ b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1046,17 +1046,28 @@ void C2_MacroAssembler::signum_fp(int opcode, XMMRegister dst, XMMRegister zero,
 
   Label DONE_LABEL;
 
+  // Handle special cases +0.0/-0.0 and NaN, if argument is +0.0/-0.0 or NaN, return argument
+  // If AVX10.2 (or newer) floating point comparison instructions used, SF=1 for equal and unordered cases
+  // If other floating point comparison instructions used, ZF=1 for equal and unordered cases
   if (opcode == Op_SignumF) {
-    ucomiss(dst, zero);
-    jcc(Assembler::equal, DONE_LABEL);    // handle special case +0.0/-0.0, if argument is +0.0/-0.0, return argument
-    jcc(Assembler::parity, DONE_LABEL);   // handle special case NaN, if argument NaN, return NaN
+    if (VM_Version::supports_avx10_2()) {
+      vucomxss(dst, zero);
+      jcc(Assembler::negative, DONE_LABEL);
+    } else {
+      ucomiss(dst, zero);
+      jcc(Assembler::equal, DONE_LABEL);
+    }
     movflt(dst, one);
     jcc(Assembler::above, DONE_LABEL);
     xorps(dst, ExternalAddress(StubRoutines::x86::vector_float_sign_flip()), noreg);
   } else if (opcode == Op_SignumD) {
-    ucomisd(dst, zero);
-    jcc(Assembler::equal, DONE_LABEL);    // handle special case +0.0/-0.0, if argument is +0.0/-0.0, return argument
-    jcc(Assembler::parity, DONE_LABEL);   // handle special case NaN, if argument NaN, return NaN
+    if (VM_Version::supports_avx10_2()) {
+      vucomxsd(dst, zero);
+      jcc(Assembler::negative, DONE_LABEL);
+    } else {
+      ucomisd(dst, zero);
+      jcc(Assembler::equal, DONE_LABEL);
+    }
     movdbl(dst, one);
     jcc(Assembler::above, DONE_LABEL);
     xorpd(dst, ExternalAddress(StubRoutines::x86::vector_double_sign_flip()), noreg);
diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.cpp b/src/hotspot/cpu/x86/macroAssembler_x86.cpp
index b88f510401a..d4d3ec85bcf 100644
--- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp
+++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp
@@ -2656,6 +2656,17 @@ void MacroAssembler::ucomisd(XMMRegister dst, AddressLiteral src, Register rscra
   }
 }
 
+void MacroAssembler::vucomxsd(XMMRegister dst, AddressLiteral src, Register rscratch) {
+  assert(rscratch != noreg || always_reachable(src), "missing");
+
+  if (reachable(src)) {
+    Assembler::vucomxsd(dst, as_Address(src));
+  } else {
+    lea(rscratch, src);
+    Assembler::vucomxsd(dst, Address(rscratch, 0));
+  }
+}
+
 void MacroAssembler::ucomiss(XMMRegister dst, AddressLiteral src, Register rscratch) {
   assert(rscratch != noreg || always_reachable(src), "missing");
 
@@ -2667,6 +2678,17 @@ void MacroAssembler::ucomiss(XMMRegister dst, AddressLiteral src, Register rscra
   }
 }
 
+void MacroAssembler::vucomxss(XMMRegister dst, AddressLiteral src, Register rscratch) {
+  assert(rscratch != noreg || always_reachable(src), "missing");
+
+  if (reachable(src)) {
+    Assembler::vucomxss(dst, as_Address(src));
+  } else {
+    lea(rscratch, src);
+    Assembler::vucomxss(dst, Address(rscratch, 0));
+  }
+}
+
 void MacroAssembler::xorpd(XMMRegister dst, AddressLiteral src, Register rscratch) {
   assert(rscratch != noreg || always_reachable(src), "missing");
 
diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.hpp b/src/hotspot/cpu/x86/macroAssembler_x86.hpp
index 93e3529ac1e..eb23199ca63 100644
--- a/src/hotspot/cpu/x86/macroAssembler_x86.hpp
+++ b/src/hotspot/cpu/x86/macroAssembler_x86.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1313,10 +1313,18 @@ public:
   void ucomiss(XMMRegister dst, Address        src) { Assembler::ucomiss(dst, src); }
   void ucomiss(XMMRegister dst, AddressLiteral src, Register rscratch = noreg);
 
+  void vucomxss(XMMRegister dst, XMMRegister    src) { Assembler::vucomxss(dst, src); }
+  void vucomxss(XMMRegister dst, Address        src) { Assembler::vucomxss(dst, src); }
+  void vucomxss(XMMRegister dst, AddressLiteral src, Register rscratch = noreg);
+
   void ucomisd(XMMRegister dst, XMMRegister    src) { Assembler::ucomisd(dst, src); }
   void ucomisd(XMMRegister dst, Address        src) { Assembler::ucomisd(dst, src); }
   void ucomisd(XMMRegister dst, AddressLiteral src, Register rscratch = noreg);
 
+  void vucomxsd(XMMRegister dst, XMMRegister    src) { Assembler::vucomxsd(dst, src); }
+  void vucomxsd(XMMRegister dst, Address        src) { Assembler::vucomxsd(dst, src); }
+  void vucomxsd(XMMRegister dst, AddressLiteral src, Register rscratch = noreg);
+
   // Bitwise Logical XOR of Packed Double-Precision Floating-Point Values
   void xorpd(XMMRegister dst, XMMRegister    src);
   void xorpd(XMMRegister dst, Address        src) { Assembler::xorpd(dst, src); }
diff --git a/src/hotspot/cpu/x86/x86.ad b/src/hotspot/cpu/x86/x86.ad
index 93b306c37d6..aed54fe93d4 100644
--- a/src/hotspot/cpu/x86/x86.ad
+++ b/src/hotspot/cpu/x86/x86.ad
@@ -1699,9 +1699,10 @@ static void emit_cmpfp_fixup(MacroAssembler* masm) {
 }
 
 static void emit_cmpfp3(MacroAssembler* masm, Register dst) {
+  // If any floating point comparison instruction is used, unordered case always triggers jump
+  // for below condition, CF=1 is true when at least one input is NaN
   Label done;
   __ movl(dst, -1);
-  __ jcc(Assembler::parity, done);
   __ jcc(Assembler::below, done);
   __ setcc(Assembler::notEqual, dst);
   __ bind(done);
@@ -5529,12 +5530,21 @@ operand rFlagsRegU()
 operand rFlagsRegUCF() %{
   constraint(ALLOC_IN_RC(int_flags));
   match(RegFlags);
-  predicate(false);
+  predicate(!UseAPX || !VM_Version::supports_avx10_2());
 
   format %{ "RFLAGS_U_CF" %}
   interface(REG_INTER);
 %}
 
+operand rFlagsRegUCFE() %{
+  constraint(ALLOC_IN_RC(int_flags));
+  match(RegFlags);
+  predicate(UseAPX && VM_Version::supports_avx10_2());
+
+  format %{ "RFLAGS_U_CFE" %}
+  interface(REG_INTER);
+%}
+
 // Float register operands
 operand regF() %{
    constraint(ALLOC_IN_RC(float_reg));
@@ -6027,10 +6037,10 @@ operand cmpOp()
   interface(COND_INTER) %{
     equal(0x4, "e");
     not_equal(0x5, "ne");
-    less(0xC, "l");
-    greater_equal(0xD, "ge");
-    less_equal(0xE, "le");
-    greater(0xF, "g");
+    less(0xc, "l");
+    greater_equal(0xd, "ge");
+    less_equal(0xe, "le");
+    greater(0xf, "g");
     overflow(0x0, "o");
     no_overflow(0x1, "no");
   %}
@@ -6062,11 +6072,12 @@ operand cmpOpU()
 // don't need to use cmpOpUCF2 for eq/ne
 operand cmpOpUCF() %{
   match(Bool);
-  predicate(n->as_Bool()->_test._test == BoolTest::lt ||
-            n->as_Bool()->_test._test == BoolTest::ge ||
-            n->as_Bool()->_test._test == BoolTest::le ||
-            n->as_Bool()->_test._test == BoolTest::gt ||
-            n->in(1)->in(1) == n->in(1)->in(2));
+  predicate((!UseAPX || !VM_Version::supports_avx10_2()) &&
+            (n->as_Bool()->_test._test == BoolTest::lt ||
+             n->as_Bool()->_test._test == BoolTest::ge ||
+             n->as_Bool()->_test._test == BoolTest::le ||
+             n->as_Bool()->_test._test == BoolTest::gt ||
+             n->in(1)->in(1) == n->in(1)->in(2)));
   format %{ "" %}
   interface(COND_INTER) %{
     equal(0xb, "np");
@@ -6084,7 +6095,8 @@ operand cmpOpUCF() %{
 // Floating comparisons that can be fixed up with extra conditional jumps
 operand cmpOpUCF2() %{
   match(Bool);
-  predicate((n->as_Bool()->_test._test == BoolTest::ne ||
+  predicate((!UseAPX || !VM_Version::supports_avx10_2()) &&
+            (n->as_Bool()->_test._test == BoolTest::ne ||
              n->as_Bool()->_test._test == BoolTest::eq) &&
             n->in(1)->in(1) != n->in(1)->in(2));
   format %{ "" %}
@@ -6100,6 +6112,37 @@ operand cmpOpUCF2() %{
   %}
 %}
 
+
+// Floating point comparisons that set condition flags to test more directly,
+// Unsigned tests are used for G (>) and GE (>=) conditions while signed tests
+// are used for L (<) and LE (<=) conditions. It's important to convert these
+// latter conditions to ones that use unsigned tests before passing into an
+// instruction because the preceding comparison might be based on a three way
+// comparison (CmpF3 or CmpD3) that also assigns unordered outcomes to -1.
+operand cmpOpUCFE()
+%{
+  match(Bool);
+  predicate((UseAPX && VM_Version::supports_avx10_2()) &&
+            (n->as_Bool()->_test._test == BoolTest::ne ||
+             n->as_Bool()->_test._test == BoolTest::eq ||
+             n->as_Bool()->_test._test == BoolTest::lt ||
+             n->as_Bool()->_test._test == BoolTest::ge ||
+             n->as_Bool()->_test._test == BoolTest::le ||
+             n->as_Bool()->_test._test == BoolTest::gt));
+
+  format %{ "" %}
+  interface(COND_INTER) %{
+    equal(0x4, "e");
+    not_equal(0x5, "ne");
+    less(0x2, "b");
+    greater_equal(0x3, "ae");
+    less_equal(0x6, "be");
+    greater(0x7, "a");
+    overflow(0x0, "o");
+    no_overflow(0x1, "no");
+  %}
+%}
+
 // Operands for bound floating pointer register arguments
 operand rxmm0() %{
   constraint(ALLOC_IN_RC(xmm0_reg));
@@ -9116,20 +9159,34 @@ instruct cmovI_imm_01UCF(rRegI dst, immI_1 src, rFlagsRegUCF cr, cmpOpUCF cop)
   ins_pipe(ialu_reg);
 %}
 
+instruct cmovI_imm_01UCFE(rRegI dst, immI_1 src, rFlagsRegUCFE cr, cmpOpUCFE cop)
+%{
+  predicate(n->in(2)->in(2)->is_Con() && n->in(2)->in(2)->get_int() == 0);
+  match(Set dst (CMoveI (Binary cop cr) (Binary src dst)));
+
+  ins_cost(100); // XXX
+  format %{ "setbn$cop $dst\t# signed, unsigned, int" %}
+  ins_encode %{
+    Assembler::Condition cond = (Assembler::Condition)($cop$$cmpcode);
+    __ setb(MacroAssembler::negate_condition(cond), $dst$$Register);
+  %}
+  ins_pipe(ialu_reg);
+%}
+
 instruct cmovI_regUCF(cmpOpUCF cop, rFlagsRegUCF cr, rRegI dst, rRegI src) %{
-  predicate(!UseAPX);
   match(Set dst (CMoveI (Binary cop cr) (Binary dst src)));
+
   ins_cost(200);
   expand %{
     cmovI_regU(cop, cr, dst, src);
   %}
 %}
 
-instruct cmovI_regUCF_ndd(rRegI dst, cmpOpUCF cop, rFlagsRegUCF cr, rRegI src1, rRegI src2) %{
-  predicate(UseAPX);
+instruct cmovI_regUCFE_ndd(rRegI dst, cmpOpUCFE cop, rFlagsRegUCFE cr, rRegI src1, rRegI src2) %{
   match(Set dst (CMoveI (Binary cop cr) (Binary src1 src2)));
+
   ins_cost(200);
-  format %{ "ecmovl$cop $dst, $src1, $src2\t# unsigned, int ndd" %}
+  format %{ "ecmovl$cop $dst, $src1, $src2\t# signed, unsigned, int ndd" %}
   ins_encode %{
     __ ecmovl((Assembler::Condition)($cop$$cmpcode), $dst$$Register, $src1$$Register, $src2$$Register);
   %}
@@ -9137,7 +9194,7 @@ instruct cmovI_regUCF_ndd(rRegI dst, cmpOpUCF cop, rFlagsRegUCF cr, rRegI src1,
 %}
 
 instruct cmovI_regUCF2_ne(cmpOpUCF2 cop, rFlagsRegUCF cr, rRegI dst, rRegI src) %{
-  predicate(!UseAPX && n->in(1)->in(1)->as_Bool()->_test._test == BoolTest::ne);
+  predicate(n->in(1)->in(1)->as_Bool()->_test._test == BoolTest::ne);
   match(Set dst (CMoveI (Binary cop cr) (Binary dst src)));
 
   ins_cost(200); // XXX
@@ -9150,25 +9207,10 @@ instruct cmovI_regUCF2_ne(cmpOpUCF2 cop, rFlagsRegUCF cr, rRegI dst, rRegI src)
   ins_pipe(pipe_cmov_reg);
 %}
 
-instruct cmovI_regUCF2_ne_ndd(cmpOpUCF2 cop, rFlagsRegUCF cr, rRegI dst, rRegI src1, rRegI src2) %{
-  predicate(UseAPX && n->in(1)->in(1)->as_Bool()->_test._test == BoolTest::ne);
-  match(Set dst (CMoveI (Binary cop cr) (Binary src1 src2)));
-  effect(TEMP dst);
-
-  ins_cost(200);
-  format %{ "ecmovpl  $dst, $src1, $src2\n\t"
-            "cmovnel  $dst, $src2" %}
-  ins_encode %{
-    __ ecmovl(Assembler::parity, $dst$$Register, $src1$$Register, $src2$$Register);
-    __ cmovl(Assembler::notEqual, $dst$$Register, $src2$$Register);
-  %}
-  ins_pipe(pipe_cmov_reg);
-%}
-
 // Since (x == y) == !(x != y), we can flip the sense of the test by flipping the
 // inputs of the CMove
 instruct cmovI_regUCF2_eq(cmpOpUCF2 cop, rFlagsRegUCF cr, rRegI dst, rRegI src) %{
-  predicate(!UseAPX && n->in(1)->in(1)->as_Bool()->_test._test == BoolTest::eq);
+  predicate(n->in(1)->in(1)->as_Bool()->_test._test == BoolTest::eq);
   match(Set dst (CMoveI (Binary cop cr) (Binary src dst)));
   effect(TEMP dst);
 
@@ -9182,23 +9224,6 @@ instruct cmovI_regUCF2_eq(cmpOpUCF2 cop, rFlagsRegUCF cr, rRegI dst, rRegI src)
   ins_pipe(pipe_cmov_reg);
 %}
 
-// We need this special handling for only eq / neq comparison since NaN == NaN is false,
-// and parity flag bit is set if any of the operand is a NaN.
-instruct cmovI_regUCF2_eq_ndd(cmpOpUCF2 cop, rFlagsRegUCF cr, rRegI dst, rRegI src1, rRegI src2) %{
-  predicate(UseAPX && n->in(1)->in(1)->as_Bool()->_test._test == BoolTest::eq);
-  match(Set dst (CMoveI (Binary cop cr) (Binary src2 src1)));
-  effect(TEMP dst);
-
-  ins_cost(200);
-  format %{ "ecmovpl  $dst, $src1, $src2\n\t"
-            "cmovnel  $dst, $src2" %}
-  ins_encode %{
-    __ ecmovl(Assembler::parity, $dst$$Register, $src1$$Register, $src2$$Register);
-    __ cmovl(Assembler::notEqual, $dst$$Register, $src2$$Register);
-  %}
-  ins_pipe(pipe_cmov_reg);
-%}
-
 // Conditional move
 instruct cmovI_mem(cmpOp cop, rFlagsReg cr, rRegI dst, memory src) %{
   predicate(!UseAPX);
@@ -9241,8 +9266,8 @@ instruct cmovI_memU(cmpOpU cop, rFlagsRegU cr, rRegI dst, memory src)
 %}
 
 instruct cmovI_memUCF(cmpOpUCF cop, rFlagsRegUCF cr, rRegI dst, memory src) %{
-  predicate(!UseAPX);
   match(Set dst (CMoveI (Binary cop cr) (Binary dst (LoadI src))));
+
   ins_cost(250);
   expand %{
     cmovI_memU(cop, cr, dst, src);
@@ -9262,12 +9287,12 @@ instruct cmovI_rReg_rReg_memU_ndd(rRegI dst, cmpOpU cop, rFlagsRegU cr, rRegI sr
   ins_pipe(pipe_cmov_mem);
 %}
 
-instruct cmovI_rReg_rReg_memUCF_ndd(rRegI dst, cmpOpUCF cop, rFlagsRegUCF cr, rRegI src1, memory src2)
+instruct cmovI_rReg_rReg_memUCFE_ndd(rRegI dst, cmpOpUCFE cop, rFlagsRegUCFE cr, rRegI src1, memory src2)
 %{
-  predicate(UseAPX);
   match(Set dst (CMoveI (Binary cop cr) (Binary src1 (LoadI src2))));
+
   ins_cost(250);
-  format %{ "ecmovl$cop $dst, $src1, $src2\t# unsigned, int ndd" %}
+  format %{ "ecmovl$cop $dst, $src1, $src2\t# signed, unsigned, int ndd" %}
   ins_encode %{
     __ ecmovl((Assembler::Condition)($cop$$cmpcode), $dst$$Register, $src1$$Register, $src2$$Address);
   %}
@@ -9317,8 +9342,8 @@ instruct cmovN_regU(cmpOpU cop, rFlagsRegU cr, rRegN dst, rRegN src)
 %}
 
 instruct cmovN_regUCF(cmpOpUCF cop, rFlagsRegUCF cr, rRegN dst, rRegN src) %{
-  predicate(!UseAPX);
   match(Set dst (CMoveN (Binary cop cr) (Binary dst src)));
+
   ins_cost(200);
   expand %{
     cmovN_regU(cop, cr, dst, src);
@@ -9339,11 +9364,11 @@ instruct cmovN_regU_ndd(rRegN dst, cmpOpU cop, rFlagsRegU cr, rRegN src1, rRegN
   ins_pipe(pipe_cmov_reg);
 %}
 
-instruct cmovN_regUCF_ndd(rRegN dst, cmpOpUCF cop, rFlagsRegUCF cr, rRegN src1, rRegN src2) %{
-  predicate(UseAPX);
+instruct cmovN_regUCFE_ndd(rRegN dst, cmpOpUCFE cop, rFlagsRegUCFE cr, rRegN src1, rRegN src2) %{
   match(Set dst (CMoveN (Binary cop cr) (Binary src1 src2)));
+
   ins_cost(200);
-  format %{ "ecmovl$cop $dst, $src1, $src2\t# unsigned, compressed ptr ndd" %}
+  format %{ "ecmovl$cop $dst, $src1, $src2\t# signed, unsigned, compressed ptr ndd" %}
   ins_encode %{
     __ ecmovl((Assembler::Condition)($cop$$cmpcode), $dst$$Register, $src1$$Register, $src2$$Register);
   %}
@@ -9437,19 +9462,19 @@ instruct cmovP_regU_ndd(rRegP dst, cmpOpU cop, rFlagsRegU cr, rRegP src1, rRegP
 %}
 
 instruct cmovP_regUCF(cmpOpUCF cop, rFlagsRegUCF cr, rRegP dst, rRegP src) %{
-  predicate(!UseAPX);
   match(Set dst (CMoveP (Binary cop cr) (Binary dst src)));
+
   ins_cost(200);
   expand %{
     cmovP_regU(cop, cr, dst, src);
   %}
 %}
 
-instruct cmovP_regUCF_ndd(rRegP dst, cmpOpUCF cop, rFlagsRegUCF cr, rRegP src1, rRegP src2) %{
-  predicate(UseAPX);
+instruct cmovP_regUCFE_ndd(rRegP dst, cmpOpUCFE cop, rFlagsRegUCFE cr, rRegP src1, rRegP src2) %{
   match(Set dst (CMoveP (Binary cop cr) (Binary src1 src2)));
+
   ins_cost(200);
-  format %{ "ecmovq$cop $dst, $src1, $src2\t# unsigned, ptr ndd" %}
+  format %{ "ecmovq$cop $dst, $src1, $src2\t# signed, unsigned, ptr ndd" %}
   ins_encode %{
     __ ecmovq((Assembler::Condition)($cop$$cmpcode), $dst$$Register, $src1$$Register, $src2$$Register);
   %}
@@ -9457,7 +9482,7 @@ instruct cmovP_regUCF_ndd(rRegP dst, cmpOpUCF cop, rFlagsRegUCF cr, rRegP src1,
 %}
 
 instruct cmovP_regUCF2_ne(cmpOpUCF2 cop, rFlagsRegUCF cr, rRegP dst, rRegP src) %{
-  predicate(!UseAPX && n->in(1)->in(1)->as_Bool()->_test._test == BoolTest::ne);
+  predicate(n->in(1)->in(1)->as_Bool()->_test._test == BoolTest::ne);
   match(Set dst (CMoveP (Binary cop cr) (Binary dst src)));
 
   ins_cost(200); // XXX
@@ -9470,25 +9495,10 @@ instruct cmovP_regUCF2_ne(cmpOpUCF2 cop, rFlagsRegUCF cr, rRegP dst, rRegP src)
   ins_pipe(pipe_cmov_reg);
 %}
 
-instruct cmovP_regUCF2_ne_ndd(cmpOpUCF2 cop, rFlagsRegUCF cr, rRegP dst, rRegP src1, rRegP src2) %{
-  predicate(UseAPX && n->in(1)->in(1)->as_Bool()->_test._test == BoolTest::ne);
-  match(Set dst (CMoveP (Binary cop cr) (Binary src1 src2)));
-  effect(TEMP dst);
-
-  ins_cost(200);
-  format %{ "ecmovpq  $dst, $src1, $src2\n\t"
-            "cmovneq  $dst, $src2" %}
-  ins_encode %{
-    __ ecmovq(Assembler::parity, $dst$$Register, $src1$$Register, $src2$$Register);
-    __ cmovq(Assembler::notEqual, $dst$$Register, $src2$$Register);
-  %}
-  ins_pipe(pipe_cmov_reg);
-%}
-
 // Since (x == y) == !(x != y), we can flip the sense of the test by flipping the
 // inputs of the CMove
 instruct cmovP_regUCF2_eq(cmpOpUCF2 cop, rFlagsRegUCF cr, rRegP dst, rRegP src) %{
-  predicate(!UseAPX && n->in(1)->in(1)->as_Bool()->_test._test == BoolTest::eq);
+  predicate(n->in(1)->in(1)->as_Bool()->_test._test == BoolTest::eq);
   match(Set dst (CMoveP (Binary cop cr) (Binary src dst)));
 
   ins_cost(200); // XXX
@@ -9501,21 +9511,6 @@ instruct cmovP_regUCF2_eq(cmpOpUCF2 cop, rFlagsRegUCF cr, rRegP dst, rRegP src)
   ins_pipe(pipe_cmov_reg);
 %}
 
-instruct cmovP_regUCF2_eq_ndd(cmpOpUCF2 cop, rFlagsRegUCF cr, rRegP dst, rRegP src1, rRegP src2) %{
-  predicate(UseAPX && n->in(1)->in(1)->as_Bool()->_test._test == BoolTest::eq);
-  match(Set dst (CMoveP (Binary cop cr) (Binary src2 src1)));
-  effect(TEMP dst);
-
-  ins_cost(200);
-  format %{ "ecmovpq  $dst, $src1, $src2\n\t"
-            "cmovneq  $dst, $src2" %}
-  ins_encode %{
-    __ ecmovq(Assembler::parity, $dst$$Register, $src1$$Register, $src2$$Register);
-    __ cmovq(Assembler::notEqual, $dst$$Register, $src2$$Register);
-  %}
-  ins_pipe(pipe_cmov_reg);
-%}
-
 instruct cmovL_imm_01(rRegL dst, immL1 src, rFlagsReg cr, cmpOp cop)
 %{
   predicate(n->in(2)->in(2)->is_Con() && n->in(2)->in(2)->get_long() == 0);
@@ -9636,21 +9631,35 @@ instruct cmovL_imm_01UCF(rRegL dst, immL1 src, rFlagsRegUCF cr, cmpOpUCF cop)
   ins_pipe(ialu_reg);
 %}
 
+instruct cmovL_imm_01UCFE(rRegL dst, immL1 src, rFlagsRegUCFE cr, cmpOpUCFE cop)
+%{
+  predicate(n->in(2)->in(2)->is_Con() && n->in(2)->in(2)->get_long() == 0);
+  match(Set dst (CMoveL (Binary cop cr) (Binary src dst)));
+
+  ins_cost(100); // XXX
+  format %{ "setbn$cop $dst\t# signed, unsigned, long" %}
+  ins_encode %{
+    Assembler::Condition cond = (Assembler::Condition)($cop$$cmpcode);
+    __ setb(MacroAssembler::negate_condition(cond), $dst$$Register);
+  %}
+  ins_pipe(ialu_reg);
+%}
+
 instruct cmovL_regUCF(cmpOpUCF cop, rFlagsRegUCF cr, rRegL dst, rRegL src) %{
-  predicate(!UseAPX);
   match(Set dst (CMoveL (Binary cop cr) (Binary dst src)));
+
   ins_cost(200);
   expand %{
     cmovL_regU(cop, cr, dst, src);
   %}
 %}
 
-instruct cmovL_regUCF_ndd(rRegL dst, cmpOpUCF cop, rFlagsRegUCF cr, rRegL src1, rRegL src2)
+instruct cmovL_regUCFE_ndd(rRegL dst, cmpOpUCFE cop, rFlagsRegUCFE cr, rRegL src1, rRegL src2)
 %{
-  predicate(UseAPX);
   match(Set dst (CMoveL (Binary cop cr) (Binary src1 src2)));
+
   ins_cost(200);
-  format %{ "ecmovq$cop $dst, $src1, $src2\t# unsigned, long ndd" %}
+  format %{ "ecmovq$cop $dst, $src1, $src2\t# signed, unsigned, long ndd" %}
   ins_encode %{
     __ ecmovq((Assembler::Condition)($cop$$cmpcode), $dst$$Register, $src1$$Register, $src2$$Register);
   %}
@@ -9658,7 +9667,7 @@ instruct cmovL_regUCF_ndd(rRegL dst, cmpOpUCF cop, rFlagsRegUCF cr, rRegL src1,
 %}
 
 instruct cmovL_regUCF2_ne(cmpOpUCF2 cop, rFlagsRegUCF cr, rRegL dst, rRegL src) %{
-  predicate(!UseAPX && n->in(1)->in(1)->as_Bool()->_test._test == BoolTest::ne);
+  predicate(n->in(1)->in(1)->as_Bool()->_test._test == BoolTest::ne);
   match(Set dst (CMoveL (Binary cop cr) (Binary dst src)));
 
   ins_cost(200); // XXX
@@ -9671,25 +9680,10 @@ instruct cmovL_regUCF2_ne(cmpOpUCF2 cop, rFlagsRegUCF cr, rRegL dst, rRegL src)
   ins_pipe(pipe_cmov_reg);
 %}
 
-instruct cmovL_regUCF2_ne_ndd(cmpOpUCF2 cop, rFlagsRegUCF cr, rRegL dst, rRegL src1, rRegL src2) %{
-  predicate(UseAPX && n->in(1)->in(1)->as_Bool()->_test._test == BoolTest::ne);
-  match(Set dst (CMoveL (Binary cop cr) (Binary src1 src2)));
-  effect(TEMP dst);
-
-  ins_cost(200);
-  format %{ "ecmovpq  $dst, $src1, $src2\n\t"
-            "cmovneq  $dst, $src2" %}
-  ins_encode %{
-    __ ecmovq(Assembler::parity, $dst$$Register, $src1$$Register, $src2$$Register);
-    __ cmovq(Assembler::notEqual, $dst$$Register, $src2$$Register);
-  %}
-  ins_pipe(pipe_cmov_reg);
-%}
-
 // Since (x == y) == !(x != y), we can flip the sense of the test by flipping the
 // inputs of the CMove
 instruct cmovL_regUCF2_eq(cmpOpUCF2 cop, rFlagsRegUCF cr, rRegL dst, rRegL src) %{
-  predicate(!UseAPX && n->in(1)->in(1)->as_Bool()->_test._test == BoolTest::eq);
+  predicate(n->in(1)->in(1)->as_Bool()->_test._test == BoolTest::eq);
   match(Set dst (CMoveL (Binary cop cr) (Binary src dst)));
 
   ins_cost(200); // XXX
@@ -9702,21 +9696,6 @@ instruct cmovL_regUCF2_eq(cmpOpUCF2 cop, rFlagsRegUCF cr, rRegL dst, rRegL src)
   ins_pipe(pipe_cmov_reg);
 %}
 
-instruct cmovL_regUCF2_eq_ndd(cmpOpUCF2 cop, rFlagsRegUCF cr, rRegL dst, rRegL src1, rRegL src2) %{
-  predicate(UseAPX && n->in(1)->in(1)->as_Bool()->_test._test == BoolTest::eq);
-  match(Set dst (CMoveL (Binary cop cr) (Binary src2 src1)));
-  effect(TEMP dst);
-
-  ins_cost(200);
-  format %{ "ecmovpq  $dst, $src1, $src2\n\t"
-            "cmovneq $dst, $src2" %}
-  ins_encode %{
-    __ ecmovq(Assembler::parity, $dst$$Register, $src1$$Register, $src2$$Register);
-    __ cmovq(Assembler::notEqual, $dst$$Register, $src2$$Register);
-  %}
-  ins_pipe(pipe_cmov_reg);
-%}
-
 instruct cmovL_memU(cmpOpU cop, rFlagsRegU cr, rRegL dst, memory src)
 %{
   predicate(!UseAPX);
@@ -9731,8 +9710,8 @@ instruct cmovL_memU(cmpOpU cop, rFlagsRegU cr, rRegL dst, memory src)
 %}
 
 instruct cmovL_memUCF(cmpOpUCF cop, rFlagsRegUCF cr, rRegL dst, memory src) %{
-  predicate(!UseAPX);
   match(Set dst (CMoveL (Binary cop cr) (Binary dst (LoadL src))));
+
   ins_cost(200);
   expand %{
     cmovL_memU(cop, cr, dst, src);
@@ -9752,12 +9731,12 @@ instruct cmovL_rReg_rReg_memU_ndd(rRegL dst, cmpOpU cop, rFlagsRegU cr, rRegL sr
   ins_pipe(pipe_cmov_mem);
 %}
 
-instruct cmovL_rReg_rReg_memUCF_ndd(rRegL dst, cmpOpUCF cop, rFlagsRegUCF cr, rRegL src1, memory src2)
+instruct cmovL_rReg_rReg_memUCFE_ndd(rRegL dst, cmpOpUCFE cop, rFlagsRegUCFE cr, rRegL src1, memory src2)
 %{
-  predicate(UseAPX);
   match(Set dst (CMoveL (Binary cop cr) (Binary src1 (LoadL src2))));
+
   ins_cost(200);
-  format %{ "ecmovq$cop $dst, $src1, $src2\t# unsigned, long ndd" %}
+  format %{ "ecmovq$cop $dst, $src1, $src2\t# signed, unsigned, long ndd" %}
   ins_encode %{
     __ ecmovq((Assembler::Condition)($cop$$cmpcode), $dst$$Register, $src1$$Register, $src2$$Address);
   %}
@@ -9802,12 +9781,31 @@ instruct cmovF_regU(cmpOpU cop, rFlagsRegU cr, regF dst, regF src)
 
 instruct cmovF_regUCF(cmpOpUCF cop, rFlagsRegUCF cr, regF dst, regF src) %{
   match(Set dst (CMoveF (Binary cop cr) (Binary dst src)));
+
   ins_cost(200);
   expand %{
     cmovF_regU(cop, cr, dst, src);
   %}
 %}
 
+instruct cmovF_regUCFE(cmpOpUCFE cop, rFlagsRegUCFE cr, regF dst, regF src)
+%{
+  match(Set dst (CMoveF (Binary cop cr) (Binary dst src)));
+
+  ins_cost(200); // XXX
+  format %{ "jn$cop    skip\t# signed, unsigned cmove float\n\t"
+            "movss     $dst, $src\n"
+    "skip:" %}
+  ins_encode %{
+    Label Lskip;
+    // Invert sense of branch from sense of CMOV
+    __ jccb((Assembler::Condition)($cop$$cmpcode^1), Lskip);
+    __ movflt($dst$$XMMRegister, $src$$XMMRegister);
+    __ bind(Lskip);
+  %}
+  ins_pipe(pipe_slow);
+%}
+
 instruct cmovD_reg(cmpOp cop, rFlagsReg cr, regD dst, regD src)
 %{
   match(Set dst (CMoveD (Binary cop cr) (Binary dst src)));
@@ -9846,12 +9844,31 @@ instruct cmovD_regU(cmpOpU cop, rFlagsRegU cr, regD dst, regD src)
 
 instruct cmovD_regUCF(cmpOpUCF cop, rFlagsRegUCF cr, regD dst, regD src) %{
   match(Set dst (CMoveD (Binary cop cr) (Binary dst src)));
+
   ins_cost(200);
   expand %{
     cmovD_regU(cop, cr, dst, src);
   %}
 %}
 
+instruct cmovD_regUCFE(cmpOpUCFE cop, rFlagsRegUCFE cr, regD dst, regD src)
+%{
+  match(Set dst (CMoveD (Binary cop cr) (Binary dst src)));
+
+  ins_cost(200); // XXX
+  format %{ "jn$cop    skip\t# signed, unsigned cmove double\n\t"
+            "movsd     $dst, $src\n"
+    "skip:" %}
+  ins_encode %{
+    Label Lskip;
+    // Invert sense of branch from sense of CMOV
+    __ jccb((Assembler::Condition)($cop$$cmpcode^1), Lskip);
+    __ movdbl($dst$$XMMRegister, $src$$XMMRegister);
+    __ bind(Lskip);
+  %}
+  ins_pipe(pipe_slow);
+%}
+
 //----------Arithmetic Instructions--------------------------------------------
 //----------Addition Instructions----------------------------------------------
 
@@ -14319,7 +14336,7 @@ instruct cmpF_cc_reg(rFlagsRegU cr, regF src1, regF src2)
   ins_pipe(pipe_slow);
 %}
 
-instruct cmpF_cc_reg_CF(rFlagsRegUCF cr, regF src1, regF src2) %{
+instruct cmpF_cc_regCF(rFlagsRegUCF cr, regF src1, regF src2) %{
   match(Set cr (CmpF src1 src2));
 
   ins_cost(100);
@@ -14330,6 +14347,17 @@ instruct cmpF_cc_reg_CF(rFlagsRegUCF cr, regF src1, regF src2) %{
   ins_pipe(pipe_slow);
 %}
 
+instruct cmpF_cc_regCFE(rFlagsRegUCFE cr, regF src1, regF src2) %{
+  match(Set cr (CmpF src1 src2));
+
+  ins_cost(100);
+  format %{ "vucomxss $src1, $src2" %}
+  ins_encode %{
+    __ vucomxss($src1$$XMMRegister, $src2$$XMMRegister);
+  %}
+  ins_pipe(pipe_slow);
+%}
+
 instruct cmpF_cc_memCF(rFlagsRegUCF cr, regF src1, memory src2) %{
   match(Set cr (CmpF src1 (LoadF src2)));
 
@@ -14341,8 +14369,20 @@ instruct cmpF_cc_memCF(rFlagsRegUCF cr, regF src1, memory src2) %{
   ins_pipe(pipe_slow);
 %}
 
+instruct cmpF_cc_memCFE(rFlagsRegUCFE cr, regF src1, memory src2) %{
+  match(Set cr (CmpF src1 (LoadF src2)));
+
+  ins_cost(100);
+  format %{ "vucomxss $src1, $src2" %}
+  ins_encode %{
+    __ vucomxss($src1$$XMMRegister, $src2$$Address);
+  %}
+  ins_pipe(pipe_slow);
+%}
+
 instruct cmpF_cc_immCF(rFlagsRegUCF cr, regF src, immF con) %{
   match(Set cr (CmpF src con));
+
   ins_cost(100);
   format %{ "ucomiss $src, [$constantaddress]\t# load from constant table: float=$con" %}
   ins_encode %{
@@ -14351,6 +14391,17 @@ instruct cmpF_cc_immCF(rFlagsRegUCF cr, regF src, immF con) %{
   ins_pipe(pipe_slow);
 %}
 
+instruct cmpF_cc_immCFE(rFlagsRegUCFE cr, regF src, immF con) %{
+  match(Set cr (CmpF src con));
+
+  ins_cost(100);
+  format %{ "vucomxss $src, [$constantaddress]\t# load from constant table: float=$con" %}
+  ins_encode %{
+    __ vucomxss($src$$XMMRegister, $constantaddress($con));
+  %}
+  ins_pipe(pipe_slow);
+%}
+
 // Really expensive, avoid
 instruct cmpD_cc_reg(rFlagsRegU cr, regD src1, regD src2)
 %{
@@ -14370,7 +14421,7 @@ instruct cmpD_cc_reg(rFlagsRegU cr, regD src1, regD src2)
   ins_pipe(pipe_slow);
 %}
 
-instruct cmpD_cc_reg_CF(rFlagsRegUCF cr, regD src1, regD src2) %{
+instruct cmpD_cc_regCF(rFlagsRegUCF cr, regD src1, regD src2) %{
   match(Set cr (CmpD src1 src2));
 
   ins_cost(100);
@@ -14381,6 +14432,17 @@ instruct cmpD_cc_reg_CF(rFlagsRegUCF cr, regD src1, regD src2) %{
   ins_pipe(pipe_slow);
 %}
 
+instruct cmpD_cc_regCFE(rFlagsRegUCFE cr, regD src1, regD src2) %{
+  match(Set cr (CmpD src1 src2));
+
+  ins_cost(100);
+  format %{ "vucomxsd $src1, $src2 test" %}
+  ins_encode %{
+    __ vucomxsd($src1$$XMMRegister, $src2$$XMMRegister);
+  %}
+  ins_pipe(pipe_slow);
+%}
+
 instruct cmpD_cc_memCF(rFlagsRegUCF cr, regD src1, memory src2) %{
   match(Set cr (CmpD src1 (LoadD src2)));
 
@@ -14392,6 +14454,17 @@ instruct cmpD_cc_memCF(rFlagsRegUCF cr, regD src1, memory src2) %{
   ins_pipe(pipe_slow);
 %}
 
+instruct cmpD_cc_memCFE(rFlagsRegUCFE cr, regD src1, memory src2) %{
+  match(Set cr (CmpD src1 (LoadD src2)));
+
+  ins_cost(100);
+  format %{ "vucomxsd $src1, $src2" %}
+  ins_encode %{
+    __ vucomxsd($src1$$XMMRegister, $src2$$Address);
+  %}
+  ins_pipe(pipe_slow);
+%}
+
 instruct cmpD_cc_immCF(rFlagsRegUCF cr, regD src, immD con) %{
   match(Set cr (CmpD src con));
   ins_cost(100);
@@ -14402,6 +14475,17 @@ instruct cmpD_cc_immCF(rFlagsRegUCF cr, regD src, immD con) %{
   ins_pipe(pipe_slow);
 %}
 
+instruct cmpD_cc_immCFE(rFlagsRegUCFE cr, regD src, immD con) %{
+  match(Set cr (CmpD src con));
+
+  ins_cost(100);
+  format %{ "vucomxsd $src, [$constantaddress]\t# load from constant table: double=$con" %}
+  ins_encode %{
+    __ vucomxsd($src$$XMMRegister, $constantaddress($con));
+  %}
+  ins_pipe(pipe_slow);
+%}
+
 // Compare into -1,0,1
 instruct cmpF_reg(rRegI dst, regF src1, regF src2, rFlagsReg cr)
 %{
@@ -16808,6 +16892,21 @@ instruct jmpConUCF2(cmpOpUCF2 cop, rFlagsRegUCF cmp, label labl) %{
   ins_pipe(pipe_jcc);
 %}
 
+// Jump Direct Conditional - using signed and unsigned comparison
+instruct jmpConUCFE(cmpOpUCFE cop, rFlagsRegUCFE cmp, label labl) %{
+  match(If cop cmp);
+  effect(USE labl);
+
+  ins_cost(200);
+  format %{ "j$cop,su   $labl" %}
+  size(6);
+  ins_encode %{
+    Label* L = $labl$$label;
+    __ jcc((Assembler::Condition)($cop$$cmpcode), *L, false); // Always long jump
+  %}
+  ins_pipe(pipe_jcc);
+%}
+
 // ============================================================================
 // The 2nd slow-half of a subtype check.  Scan the subklass's 2ndary
 // superklass array for an instance of the superklass.  Set a hidden
@@ -17026,6 +17125,22 @@ instruct jmpConUCF2_short(cmpOpUCF2 cop, rFlagsRegUCF cmp, label labl) %{
   ins_short_branch(1);
 %}
 
+// Jump Direct Conditional - using signed and unsigned comparison
+instruct jmpConUCFE_short(cmpOpUCFE cop, rFlagsRegUCFE cmp, label labl) %{
+  match(If cop cmp);
+  effect(USE labl);
+
+  ins_cost(300);
+  format %{ "j$cop,sus  $labl" %}
+  size(2);
+  ins_encode %{
+    Label* L = $labl$$label;
+    __ jccb((Assembler::Condition)($cop$$cmpcode), *L);
+  %}
+  ins_pipe(pipe_jcc);
+  ins_short_branch(1);
+%}
+
 // ============================================================================
 // inlined locking and unlocking
 
diff --git a/test/hotspot/jtreg/compiler/c2/irTests/CMoveLConstants.java b/test/hotspot/jtreg/compiler/c2/irTests/CMoveLConstants.java
index e62e1adc8d0..cf86764aecc 100644
--- a/test/hotspot/jtreg/compiler/c2/irTests/CMoveLConstants.java
+++ b/test/hotspot/jtreg/compiler/c2/irTests/CMoveLConstants.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2024, 2026, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,31 +39,56 @@ public class CMoveLConstants {
     }
 
     @Test
-    @IR(applyIfPlatform = {"x64", "true"}, counts = {IRNode.X86_CMOVEL_IMM01, "1"}, phase = CompilePhase.FINAL_CODE)
+    @IR(counts = {IRNode.X86_CMOVEL_IMM01, "1"},
+        applyIfPlatform = {"x64", "true"},
+        phase = CompilePhase.FINAL_CODE)
     public static long testSigned(int a, int b) {
         return a > b ? 1L : 0L;
     }
 
     @Test
-    @IR(applyIfPlatform = {"x64", "true"}, counts = {IRNode.X86_CMOVEL_IMM01U, "1"}, phase = CompilePhase.FINAL_CODE)
+    @IR(counts = {IRNode.X86_CMOVEL_IMM01U, "1"},
+        applyIfPlatform = {"x64", "true"},
+        phase = CompilePhase.FINAL_CODE)
     public static long testUnsigned(int a, int b) {
         return Integer.compareUnsigned(a, b) > 0 ? 1L : 0L;
     }
 
     @Test
-    @IR(applyIfPlatform = {"x64", "true"}, counts = {IRNode.X86_CMOVEL_IMM01UCF, "1"}, phase = CompilePhase.FINAL_CODE)
+    @IR(counts = {IRNode.X86_CMOVEL_IMM01UCF, "1"},
+        applyIfPlatform = {"x64", "true"},
+        applyIfCPUFeatureOr = {"apx_f", "false", "avx10_2", "false"},
+        phase = CompilePhase.FINAL_CODE)
+    @IR(counts = {IRNode.X86_CMOVEL_IMM01UCFE, "1"},
+        applyIfPlatform = {"x64", "true"},
+        applyIfCPUFeatureAnd = {"apx_f", "true", "avx10_2", "true"},
+        phase = CompilePhase.FINAL_CODE)
     public static long testFloat(float a, float b) {
         return a > b ? 1L : 0L;
     }
 
+    @Test
+    @IR(counts = {IRNode.X86_CMOVEL_IMM01UCF, "1"},
+        applyIfPlatform = {"x64", "true"},
+        applyIfCPUFeatureOr = {"apx_f", "false", "avx10_2", "false"},
+        phase = CompilePhase.FINAL_CODE)
+    @IR(counts = {IRNode.X86_CMOVEL_IMM01UCFE, "1"},
+        applyIfPlatform = {"x64", "true"},
+        applyIfCPUFeatureAnd = {"apx_f", "true", "avx10_2", "true"},
+        phase = CompilePhase.FINAL_CODE)
+    public static long testDouble(double a, double b) {
+        return a > b ? 1L : 0L;
+    }
+
     @DontCompile
     public void assertResults(int a, int b) {
         Asserts.assertEQ(a > b ? 1L : 0L, testSigned(a, b));
         Asserts.assertEQ(Integer.compareUnsigned(a, b) > 0 ? 1L : 0L, testUnsigned(a, b));
         Asserts.assertEQ((float) a > (float) b ? 1L : 0L, testFloat(a, b));
+        Asserts.assertEQ((double) a > (double) b ? 1L : 0L, testDouble(a, b));
     }
 
-    @Run(test = {"testSigned", "testUnsigned", "testFloat"})
+    @Run(test = {"testSigned", "testUnsigned", "testFloat", "testDouble"})
     public void runMethod() {
         assertResults(10, 20);
         assertResults(20, 10);
diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java b/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java
index 43cae5aa6c7..f488e930710 100644
--- a/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java
+++ b/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java
@@ -3090,6 +3090,11 @@ public class IRNode {
         machOnlyNameRegex(X86_CMOVEL_IMM01UCF, "cmovL_imm_01UCF");
     }
 
+    public static final String X86_CMOVEL_IMM01UCFE = PREFIX + "X86_CMOVEL_IMM01UCFE" + POSTFIX;
+    static {
+        machOnlyNameRegex(X86_CMOVEL_IMM01UCFE, "cmovL_imm_01UCFE");
+    }
+
     public static final String MOD_F = PREFIX + "MOD_F" + POSTFIX;
     static {
         String regex = START + "ModF" + MID + END;
diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/test/ApplicableIRRulesPrinter.java b/test/hotspot/jtreg/compiler/lib/ir_framework/test/ApplicableIRRulesPrinter.java
index 4fa1f8f3fe5..7a868c172dd 100644
--- a/test/hotspot/jtreg/compiler/lib/ir_framework/test/ApplicableIRRulesPrinter.java
+++ b/test/hotspot/jtreg/compiler/lib/ir_framework/test/ApplicableIRRulesPrinter.java
@@ -110,6 +110,8 @@ public class ApplicableIRRulesPrinter {
         "avx512_vbmi2",
         "avx10_2",
         "bmi2",
+        // Intel APX
+        "apx_f",
         // AArch64
         "sha3",
         "asimd",
diff --git a/test/micro/org/openjdk/bench/java/lang/FPComparison.java b/test/micro/org/openjdk/bench/java/lang/FPComparison.java
index e6b2ab2d39a..63cbb6db911 100644
--- a/test/micro/org/openjdk/bench/java/lang/FPComparison.java
+++ b/test/micro/org/openjdk/bench/java/lang/FPComparison.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2026, Oracle and/or its affiliates. All rights reserved.
  * 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,7 @@ import java.util.random.RandomGenerator;
 @OutputTimeUnit(TimeUnit.NANOSECONDS)
 @State(Scope.Thread)
 @Warmup(iterations = 5, time = 1)
-@Measurement(iterations = 5, time = 1)
+@Measurement(iterations = 5, time = 5)
 @Fork(3)
 public class FPComparison {
     static final int INVOCATIONS = 1024;
@@ -75,331 +75,673 @@ public class FPComparison {
         }
     }
 
+    @CompilerControl(CompilerControl.Mode.DONT_INLINE)
+    static int callI() {
+        return 1;
+    }
+
     @Benchmark
-    public void isNanFloat() {
+    public void cMoveIsNanFloat() {
         for (int i = 0; i < INVOCATIONS; i++) {
             res[i] = Float.isNaN(f1[i]) ? 1 : 2;
         }
     }
 
     @Benchmark
-    public void isNanDouble() {
+    public void cMoveIsNanDouble() {
         for (int i = 0; i < INVOCATIONS; i++) {
             res[i] = Double.isNaN(d1[i]) ? 1 : 2;
         }
     }
 
     @Benchmark
-    public void isInfiniteFloat() {
+    public void cMoveIsInfiniteFloat() {
         for (int i = 0; i < INVOCATIONS; i++) {
             res[i] = Float.isInfinite(f1[i]) ? 1 : 2;
         }
     }
 
     @Benchmark
-    public void isInfiniteDouble() {
+    public void cMoveIsInfiniteDouble() {
         for (int i = 0; i < INVOCATIONS; i++) {
             res[i] = Double.isInfinite(d1[i]) ? 1 : 2;
         }
     }
 
     @Benchmark
-    public void isFiniteFloat() {
+    public void cMoveIsFiniteFloat() {
         for (int i = 0; i < INVOCATIONS; i++) {
             res[i] = Float.isFinite(f1[i]) ? 1 : 2;
         }
     }
 
     @Benchmark
-    public void isFiniteDouble() {
+    public void cMoveIsFiniteDouble() {
         for (int i = 0; i < INVOCATIONS; i++) {
             res[i] = Double.isFinite(d1[i]) ? 1 : 2;
         }
     }
 
     @Benchmark
-    public void equalFloat() {
+    public void cMoveEqualFloat() {
         for (int i = 0; i < INVOCATIONS; i++) {
             res[i] = (f1[i] == f2[i]) ? 1 : 2;
         }
     }
 
     @Benchmark
-    public void equalDouble() {
+    public void cMoveEqualDouble() {
         for (int i = 0; i < INVOCATIONS; i++) {
             res[i] = (d1[i] == d2[i]) ? 1 : 2;
         }
     }
 
     @Benchmark
-    public void lessFloat() {
+    public void cMoveLessFloat() {
         for (int i = 0; i < INVOCATIONS; i++) {
             res[i] = (f1[i] < f2[i]) ? 1 : 2;
         }
     }
 
     @Benchmark
-    public void lessDouble() {
+    public void cMoveLessDouble() {
         for (int i = 0; i < INVOCATIONS; i++) {
             res[i] = (d1[i] < d2[i]) ? 1 : 2;
         }
     }
 
     @Benchmark
-    public void lessEqualFloat() {
+    public void cMoveLessEqualFloat() {
         for (int i = 0; i < INVOCATIONS; i++) {
             res[i] = (f1[i] <= f2[i]) ? 1 : 2;
         }
     }
 
     @Benchmark
-    public void lessEqualDouble() {
+    public void cMoveLessEqualDouble() {
         for (int i = 0; i < INVOCATIONS; i++) {
             res[i] = (d1[i] <= d2[i]) ? 1 : 2;
         }
     }
 
     @Benchmark
-    public void greaterFloat() {
+    public void cMoveGreaterFloat() {
         for (int i = 0; i < INVOCATIONS; i++) {
             res[i] = (f1[i] > f2[i]) ? 1 : 2;
         }
     }
 
     @Benchmark
-    public void greaterDouble() {
+    public void cMoveGreaterDouble() {
         for (int i = 0; i < INVOCATIONS; i++) {
             res[i] = (d1[i] > d2[i]) ? 1 : 2;
         }
     }
 
     @Benchmark
-    public void greaterEqualFloat() {
+    public void cMoveGreaterEqualFloat() {
         for (int i = 0; i < INVOCATIONS; i++) {
             res[i] = (f1[i] >= f2[i]) ? 1 : 2;
         }
     }
 
     @Benchmark
-    public void greaterEqualDouble() {
+    public void cMoveGreaterEqualDouble() {
         for (int i = 0; i < INVOCATIONS; i++) {
             res[i] = (d1[i] >= d2[i]) ? 1 : 2;
         }
     }
 
-    // --------- result: long ---------
+    @Benchmark
+    public void branchIsNanFloat() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            res[i] = Float.isNaN(f1[i]) ? callI() : 2;
+        }
+    }
 
     @Benchmark
-    public void equalFloatResLong() {
+    public void branchIsNanDouble() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            res[i] = Double.isNaN(d1[i]) ? callI() : 2;
+        }
+    }
+
+    @Benchmark
+    public void branchIsInfiniteFloat() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            res[i] = Float.isInfinite(f1[i]) ? callI() : 2;
+        }
+    }
+
+    @Benchmark
+    public void branchIsInfiniteDouble() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            res[i] = Double.isInfinite(d1[i]) ? callI() : 2;
+        }
+    }
+
+    @Benchmark
+    public void branchIsFiniteFloat() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            res[i] = Float.isFinite(f1[i]) ? callI() : 2;
+        }
+    }
+
+    @Benchmark
+    public void branchIsFiniteDouble() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            res[i] = Double.isFinite(d1[i]) ? callI() : 2;
+        }
+    }
+
+    @Benchmark
+    public void branchEqualFloat() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            res[i] = (f1[i] == f2[i]) ? callI() : 2;
+        }
+    }
+
+    @Benchmark
+    public void branchEqualDouble() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            res[i] = (d1[i] == d2[i]) ? callI() : 2;
+        }
+    }
+
+    @Benchmark
+    public void branchLessFloat() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            res[i] = (f1[i] < f2[i]) ? callI() : 2;
+        }
+    }
+
+    @Benchmark
+    public void branchLessDouble() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            res[i] = (d1[i] < d2[i]) ? callI() : 2;
+        }
+    }
+
+    @Benchmark
+    public void branchLessEqualFloat() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            res[i] = (f1[i] <= f2[i]) ? callI() : 2;
+        }
+    }
+
+    @Benchmark
+    public void branchLessEqualDouble() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            res[i] = (d1[i] <= d2[i]) ? callI() : 2;
+        }
+    }
+
+    @Benchmark
+    public void branchGreaterFloat() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            res[i] = (f1[i] > f2[i]) ? callI() : 2;
+        }
+    }
+
+    @Benchmark
+    public void branchGreaterDouble() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            res[i] = (d1[i] > d2[i]) ? callI() : 2;
+        }
+    }
+
+    @Benchmark
+    public void branchGreaterEqualFloat() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            res[i] = (f1[i] >= f2[i]) ? callI() : 2;
+        }
+    }
+
+    @Benchmark
+    public void branchGreaterEqualDouble() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            res[i] = (d1[i] >= d2[i]) ? callI() : 2;
+        }
+    }
+
+    // --------- result: long ---------
+
+    @CompilerControl(CompilerControl.Mode.DONT_INLINE)
+    static long callL() {
+        return Long.MAX_VALUE;
+    }
+
+    @Benchmark
+    public void cMoveEqualFloatResLong() {
         for (int i = 0; i < INVOCATIONS; i++) {
             resLong[i] = (f1[i] == f2[i]) ? Long.MAX_VALUE : Long.MIN_VALUE;
         }
     }
 
     @Benchmark
-    public void equalDoubleResLong() {
+    public void cMoveEqualDoubleResLong() {
         for (int i = 0; i < INVOCATIONS; i++) {
             resLong[i] = (d1[i] == d2[i]) ? Long.MAX_VALUE : Long.MIN_VALUE;
         }
     }
 
     @Benchmark
-    public void lessFloatResLong() {
+    public void cMoveLessFloatResLong() {
         for (int i = 0; i < INVOCATIONS; i++) {
             resLong[i] = (f1[i] < f2[i]) ? Long.MAX_VALUE : Long.MIN_VALUE;
         }
     }
 
     @Benchmark
-    public void lessDoubleResLong() {
+    public void cMoveLessDoubleResLong() {
         for (int i = 0; i < INVOCATIONS; i++) {
             resLong[i] = (d1[i] < d2[i]) ? Long.MAX_VALUE : Long.MIN_VALUE;
         }
     }
 
     @Benchmark
-    public void lessEqualFloatResLong() {
+    public void cMoveLessEqualFloatResLong() {
         for (int i = 0; i < INVOCATIONS; i++) {
             resLong[i] = (f1[i] <= f2[i]) ? Long.MAX_VALUE : Long.MIN_VALUE;
         }
     }
 
     @Benchmark
-    public void lessEqualDoubleResLong() {
+    public void cMoveLessEqualDoubleResLong() {
         for (int i = 0; i < INVOCATIONS; i++) {
             resLong[i] = (d1[i] <= d2[i]) ? Long.MAX_VALUE : Long.MIN_VALUE;
         }
     }
 
     @Benchmark
-    public void greaterFloatResLong() {
+    public void cMoveGreaterFloatResLong() {
         for (int i = 0; i < INVOCATIONS; i++) {
             resLong[i] = (f1[i] > f2[i]) ? Long.MAX_VALUE : Long.MIN_VALUE;
         }
     }
 
     @Benchmark
-    public void greaterDoubleResLong() {
+    public void cMoveGreaterDoubleResLong() {
         for (int i = 0; i < INVOCATIONS; i++) {
             resLong[i] = (d1[i] > d2[i]) ? Long.MAX_VALUE : Long.MIN_VALUE;
         }
     }
 
     @Benchmark
-    public void greaterEqualFloatResLong() {
+    public void cMoveGreaterEqualFloatResLong() {
         for (int i = 0; i < INVOCATIONS; i++) {
             resLong[i] = (f1[i] >= f2[i]) ? Long.MAX_VALUE : Long.MIN_VALUE;
         }
     }
 
     @Benchmark
-    public void greaterEqualDoubleResLong() {
+    public void cMoveGreaterEqualDoubleResLong() {
         for (int i = 0; i < INVOCATIONS; i++) {
             resLong[i] = (d1[i] >= d2[i]) ? Long.MAX_VALUE : Long.MIN_VALUE;
         }
     }
 
-    // --------- result: float ---------
+    @Benchmark
+    public void branchEqualFloatResLong() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            resLong[i] = (f1[i] == f2[i]) ? callL() : Long.MIN_VALUE;
+        }
+    }
 
     @Benchmark
-    public void equalFloatResFloat() {
+    public void branchEqualDoubleResLong() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            resLong[i] = (d1[i] == d2[i]) ? callL() : Long.MIN_VALUE;
+        }
+    }
+
+    @Benchmark
+    public void branchLessFloatResLong() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            resLong[i] = (f1[i] < f2[i]) ? callL() : Long.MIN_VALUE;
+        }
+    }
+
+    @Benchmark
+    public void branchLessDoubleResLong() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            resLong[i] = (d1[i] < d2[i]) ? callL() : Long.MIN_VALUE;
+        }
+    }
+
+    @Benchmark
+    public void branchLessEqualFloatResLong() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            resLong[i] = (f1[i] <= f2[i]) ? callL() : Long.MIN_VALUE;
+        }
+    }
+
+    @Benchmark
+    public void branchLessEqualDoubleResLong() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            resLong[i] = (d1[i] <= d2[i]) ? callL() : Long.MIN_VALUE;
+        }
+    }
+
+    @Benchmark
+    public void branchGreaterFloatResLong() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            resLong[i] = (f1[i] > f2[i]) ? callL() : Long.MIN_VALUE;
+        }
+    }
+
+    @Benchmark
+    public void branchGreaterDoubleResLong() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            resLong[i] = (d1[i] > d2[i]) ? callL() : Long.MIN_VALUE;
+        }
+    }
+
+    @Benchmark
+    public void branchGreaterEqualFloatResLong() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            resLong[i] = (f1[i] >= f2[i]) ? callL() : Long.MIN_VALUE;
+        }
+    }
+
+    @Benchmark
+    public void branchGreaterEqualDoubleResLong() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            resLong[i] = (d1[i] >= d2[i]) ? callL() : Long.MIN_VALUE;
+        }
+    }
+
+    // --------- result: float ---------
+
+    @CompilerControl(CompilerControl.Mode.DONT_INLINE)
+    static float callF() {
+        return 0.1f;
+    }
+
+    @Benchmark
+    public void cMoveEqualFloatResFloat() {
         for (int i = 0; i < INVOCATIONS; i++) {
             resFloat[i] = (f1[i] == f2[i]) ? 0.1f : 0.2f;
         }
     }
 
     @Benchmark
-    public void equalDoubleResFloat() {
+    public void cMoveEqualDoubleResFloat() {
         for (int i = 0; i < INVOCATIONS; i++) {
             resFloat[i] = (d1[i] == d2[i]) ? 0.1f : 0.2f;
         }
     }
 
     @Benchmark
-    public void lessFloatResFloat() {
+    public void cMoveLessFloatResFloat() {
         for (int i = 0; i < INVOCATIONS; i++) {
             resFloat[i] = (f1[i] < f2[i]) ? 0.1f : 0.2f;
         }
     }
 
     @Benchmark
-    public void lessDoubleResFloat() {
+    public void cMoveLessDoubleResFloat() {
         for (int i = 0; i < INVOCATIONS; i++) {
             resFloat[i] = (d1[i] < d2[i]) ? 0.1f : 0.2f;
         }
     }
 
     @Benchmark
-    public void lessEqualFloatResFloat() {
+    public void cMoveLessEqualFloatResFloat() {
         for (int i = 0; i < INVOCATIONS; i++) {
             resFloat[i] = (f1[i] <= f2[i]) ? 0.1f : 0.2f;
         }
     }
 
     @Benchmark
-    public void lessEqualDoubleResFloat() {
+    public void cMoveLessEqualDoubleResFloat() {
         for (int i = 0; i < INVOCATIONS; i++) {
             resFloat[i] = (d1[i] <= d2[i]) ? 0.1f : 0.2f;
         }
     }
 
     @Benchmark
-    public void greaterFloatResFloat() {
+    public void cMoveGreaterFloatResFloat() {
         for (int i = 0; i < INVOCATIONS; i++) {
             resFloat[i] = (f1[i] > f2[i]) ? 0.1f : 0.2f;
         }
     }
 
     @Benchmark
-    public void greaterDoubleResFloat() {
+    public void cMoveGreaterDoubleResFloat() {
         for (int i = 0; i < INVOCATIONS; i++) {
             resFloat[i] = (d1[i] > d2[i]) ? 0.1f : 0.2f;
         }
     }
 
     @Benchmark
-    public void greaterEqualFloatResFloat() {
+    public void cMoveGreaterEqualFloatResFloat() {
         for (int i = 0; i < INVOCATIONS; i++) {
             resFloat[i] = (f1[i] >= f2[i]) ? 0.1f : 0.2f;
         }
     }
 
     @Benchmark
-    public void greaterEqualDoubleResFloat() {
+    public void cMoveGreaterEqualDoubleResFloat() {
         for (int i = 0; i < INVOCATIONS; i++) {
             resFloat[i] = (d1[i] >= d2[i]) ? 0.1f : 0.2f;
         }
     }
 
-    // --------- result: double ---------
+    @Benchmark
+    public void branchEqualFloatResFloat() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            resFloat[i] = (f1[i] == f2[i]) ? callF() : 0.2f;
+        }
+    }
 
     @Benchmark
-    public void equalFloatResDouble() {
+    public void branchEqualDoubleResFloat() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            resFloat[i] = (d1[i] == d2[i]) ? callF() : 0.2f;
+        }
+    }
+
+    @Benchmark
+    public void branchLessFloatResFloat() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            resFloat[i] = (f1[i] < f2[i]) ? callF() : 0.2f;
+        }
+    }
+
+    @Benchmark
+    public void branchLessDoubleResFloat() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            resFloat[i] = (d1[i] < d2[i]) ? callF() : 0.2f;
+        }
+    }
+
+    @Benchmark
+    public void branchLessEqualFloatResFloat() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            resFloat[i] = (f1[i] <= f2[i]) ? callF() : 0.2f;
+        }
+    }
+
+    @Benchmark
+    public void branchLessEqualDoubleResFloat() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            resFloat[i] = (d1[i] <= d2[i]) ? callF() : 0.2f;
+        }
+    }
+
+    @Benchmark
+    public void branchGreaterFloatResFloat() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            resFloat[i] = (f1[i] > f2[i]) ? callF() : 0.2f;
+        }
+    }
+
+    @Benchmark
+    public void branchGreaterDoubleResFloat() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            resFloat[i] = (d1[i] > d2[i]) ? callF() : 0.2f;
+        }
+    }
+
+    @Benchmark
+    public void branchGreaterEqualFloatResFloat() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            resFloat[i] = (f1[i] >= f2[i]) ? callF() : 0.2f;
+        }
+    }
+
+    @Benchmark
+    public void branchGreaterEqualDoubleResFloat() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            resFloat[i] = (d1[i] >= d2[i]) ? callF() : 0.2f;
+        }
+    }
+
+    // --------- result: double ---------
+
+    @CompilerControl(CompilerControl.Mode.DONT_INLINE)
+    static double callD() {
+        return 0.1;
+    }
+
+    @Benchmark
+    public void cMoveEqualFloatResDouble() {
         for (int i = 0; i < INVOCATIONS; i++) {
             resDouble[i] = (f1[i] == f2[i]) ? 0.1 : 0.2;
         }
     }
 
     @Benchmark
-    public void equalDoubleResDouble() {
+    public void cMoveEqualDoubleResDouble() {
         for (int i = 0; i < INVOCATIONS; i++) {
             resDouble[i] = (d1[i] == d2[i]) ? 0.1 : 0.2;
         }
     }
 
     @Benchmark
-    public void lessFloatResDouble() {
+    public void cMoveLessFloatResDouble() {
         for (int i = 0; i < INVOCATIONS; i++) {
             resDouble[i] = (f1[i] < f2[i]) ? 0.1 : 0.2;
         }
     }
 
     @Benchmark
-    public void lessDoubleResDouble() {
+    public void cMoveLessDoubleResDouble() {
         for (int i = 0; i < INVOCATIONS; i++) {
             resDouble[i] = (d1[i] < d2[i]) ? 0.1 : 0.2;
         }
     }
 
     @Benchmark
-    public void lessEqualFloatResDouble() {
+    public void cMoveLessEqualFloatResDouble() {
         for (int i = 0; i < INVOCATIONS; i++) {
             resDouble[i] = (f1[i] <= f2[i]) ? 0.1 : 0.2;
         }
     }
 
     @Benchmark
-    public void lessEqualDoubleResDouble() {
+    public void cMoveLessEqualDoubleResDouble() {
         for (int i = 0; i < INVOCATIONS; i++) {
             resDouble[i] = (d1[i] <= d2[i]) ? 0.1 : 0.2;
         }
     }
 
     @Benchmark
-    public void greaterFloatResDouble() {
+    public void cMoveGreaterFloatResDouble() {
         for (int i = 0; i < INVOCATIONS; i++) {
             resDouble[i] = (f1[i] > f2[i]) ? 0.1 : 0.2;
         }
     }
 
     @Benchmark
-    public void greaterDoubleResDouble() {
+    public void cMoveGreaterDoubleResDouble() {
         for (int i = 0; i < INVOCATIONS; i++) {
             resDouble[i] = (d1[i] > d2[i]) ? 0.1 : 0.2;
         }
     }
 
     @Benchmark
-    public void greaterEqualFloatResDouble() {
+    public void cMoveGreaterEqualFloatResDouble() {
         for (int i = 0; i < INVOCATIONS; i++) {
             resDouble[i] = (f1[i] >= f2[i]) ? 0.1 : 0.2;
         }
     }
 
     @Benchmark
-    public void greaterEqualDoubleResDouble() {
+    public void cMoveGreaterEqualDoubleResDouble() {
         for (int i = 0; i < INVOCATIONS; i++) {
             resDouble[i] = (d1[i] >= d2[i]) ? 0.1 : 0.2;
         }
     }
+
+    @Benchmark
+    public void branchEqualFloatResDouble() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            resDouble[i] = (f1[i] == f2[i]) ? callD() : 0.2;
+        }
+    }
+
+    @Benchmark
+    public void branchEqualDoubleResDouble() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            resDouble[i] = (d1[i] == d2[i]) ? callD() : 0.2;
+        }
+    }
+
+    @Benchmark
+    public void branchLessFloatResDouble() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            resDouble[i] = (f1[i] < f2[i]) ? callD() : 0.2;
+        }
+    }
+
+    @Benchmark
+    public void branchLessDoubleResDouble() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            resDouble[i] = (d1[i] < d2[i]) ? callD() : 0.2;
+        }
+    }
+
+    @Benchmark
+    public void branchLessEqualFloatResDouble() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            resDouble[i] = (f1[i] <= f2[i]) ? callD() : 0.2;
+        }
+    }
+
+    @Benchmark
+    public void branchLessEqualDoubleResDouble() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            resDouble[i] = (d1[i] <= d2[i]) ? callD() : 0.2;
+        }
+    }
+
+    @Benchmark
+    public void branchGreaterFloatResDouble() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            resDouble[i] = (f1[i] > f2[i]) ? callD() : 0.2;
+        }
+    }
+
+    @Benchmark
+    public void branchGreaterDoubleResDouble() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            resDouble[i] = (d1[i] > d2[i]) ? callD() : 0.2;
+        }
+    }
+
+    @Benchmark
+    public void branchGreaterEqualFloatResDouble() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            resDouble[i] = (f1[i] >= f2[i]) ? callD() : 0.2;
+        }
+    }
+
+    @Benchmark
+    public void branchGreaterEqualDoubleResDouble() {
+        for (int i = 0; i < INVOCATIONS; i++) {
+            resDouble[i] = (d1[i] >= d2[i]) ? callD() : 0.2;
+        }
+    }
 }

From 57eb9c79b050224c6bf402ebe7d18afff1f5ce09 Mon Sep 17 00:00:00 2001
From: Ben Taylor 
Date: Mon, 9 Feb 2026 20:00:51 +0000
Subject: [PATCH 033/120] 8377043: Shenandoah: Convert ShenandoahHeapRegion
 related code to use Atomic

Reviewed-by: xpeng, cslucas, kdnilsen, wkemper
---
 .../gc/shenandoah/shenandoahHeapRegion.cpp    | 15 +++++----
 .../gc/shenandoah/shenandoahHeapRegion.hpp    | 11 ++++---
 .../shenandoahHeapRegion.inline.hpp           | 13 ++++----
 .../gc/shenandoah/vmStructs_shenandoah.hpp    | 31 ++++++++++---------
 4 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp
index 6bb8382de0a..b0c13df6c4f 100644
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp
@@ -43,7 +43,6 @@
 #include "memory/resourceArea.hpp"
 #include "memory/universe.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomicAccess.hpp"
 #include "runtime/globals_extension.hpp"
 #include "runtime/java.hpp"
 #include "runtime/mutexLocker.hpp"
@@ -384,7 +383,7 @@ size_t ShenandoahHeapRegion::get_plab_allocs() const {
 
 void ShenandoahHeapRegion::set_live_data(size_t s) {
   assert(Thread::current()->is_VM_thread(), "by VM thread");
-  _live_data = (s >> LogHeapWordSize);
+  _live_data.store_relaxed(s >> LogHeapWordSize);
 }
 
 void ShenandoahHeapRegion::print_on(outputStream* st) const {
@@ -435,7 +434,7 @@ void ShenandoahHeapRegion::print_on(outputStream* st) const {
   st->print("|TAMS " SHR_PTR_FORMAT,
             p2i(ShenandoahHeap::heap()->marking_context()->top_at_mark_start(const_cast(this))));
   st->print("|UWM " SHR_PTR_FORMAT,
-            p2i(_update_watermark));
+            p2i(_update_watermark.load_relaxed()));
   st->print("|U %5zu%1s", byte_size_in_proper_unit(used()),                proper_unit_for_byte_size(used()));
   st->print("|T %5zu%1s", byte_size_in_proper_unit(get_tlab_allocs()),     proper_unit_for_byte_size(get_tlab_allocs()));
   st->print("|G %5zu%1s", byte_size_in_proper_unit(get_gclab_allocs()),    proper_unit_for_byte_size(get_gclab_allocs()));
@@ -839,20 +838,20 @@ void ShenandoahHeapRegion::set_state(RegionState to) {
     evt.set_to(to);
     evt.commit();
   }
-  AtomicAccess::store(&_state, to);
+  _state.store_relaxed(to);
 }
 
 void ShenandoahHeapRegion::record_pin() {
-  AtomicAccess::add(&_critical_pins, (size_t)1);
+  _critical_pins.add_then_fetch((size_t)1);
 }
 
 void ShenandoahHeapRegion::record_unpin() {
   assert(pin_count() > 0, "Region %zu should have non-zero pins", index());
-  AtomicAccess::sub(&_critical_pins, (size_t)1);
+  _critical_pins.sub_then_fetch((size_t)1);
 }
 
 size_t ShenandoahHeapRegion::pin_count() const {
-  return AtomicAccess::load(&_critical_pins);
+  return _critical_pins.load_relaxed();
 }
 
 void ShenandoahHeapRegion::set_affiliation(ShenandoahAffiliation new_affiliation) {
@@ -864,7 +863,7 @@ void ShenandoahHeapRegion::set_affiliation(ShenandoahAffiliation new_affiliation
     log_debug(gc)("Setting affiliation of Region %zu from %s to %s, top: " PTR_FORMAT ", TAMS: " PTR_FORMAT
                   ", watermark: " PTR_FORMAT ", top_bitmap: " PTR_FORMAT,
                   index(), shenandoah_affiliation_name(region_affiliation), shenandoah_affiliation_name(new_affiliation),
-                  p2i(top()), p2i(ctx->top_at_mark_start(this)), p2i(_update_watermark), p2i(ctx->top_bitmap(this)));
+                  p2i(top()), p2i(ctx->top_at_mark_start(this)), p2i(_update_watermark.load_relaxed()), p2i(ctx->top_bitmap(this)));
   }
 
 #ifdef ASSERT
diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.hpp b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.hpp
index 9da2816e2c9..3a0ac042f57 100644
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.hpp
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.hpp
@@ -34,6 +34,7 @@
 #include "gc/shenandoah/shenandoahAsserts.hpp"
 #include "gc/shenandoah/shenandoahHeap.hpp"
 #include "gc/shenandoah/shenandoahPadding.hpp"
+#include "runtime/atomic.hpp"
 #include "utilities/sizes.hpp"
 
 class VMStructs;
@@ -217,7 +218,7 @@ public:
   bool is_alloc_allowed()          const { auto cur_state = state(); return is_empty_state(cur_state) || cur_state == _regular || cur_state == _pinned; }
   bool is_stw_move_allowed()       const { auto cur_state = state(); return cur_state == _regular || cur_state == _cset || (ShenandoahHumongousMoves && cur_state == _humongous_start); }
 
-  RegionState state()              const { return AtomicAccess::load(&_state); }
+  RegionState state()              const { return _state.load_relaxed(); }
   int  state_ordinal()             const { return region_state_to_ordinal(state()); }
 
   void record_pin();
@@ -247,7 +248,7 @@ private:
   HeapWord* _top_before_promoted;
 
   // Seldom updated fields
-  volatile RegionState _state;
+  Atomic _state;
   HeapWord* _coalesce_and_fill_boundary; // for old regions not selected as collection set candidates.
 
   // Frequently updated fields
@@ -257,12 +258,12 @@ private:
   size_t _gclab_allocs;
   size_t _plab_allocs;
 
-  volatile size_t _live_data;
-  volatile size_t _critical_pins;
+  Atomic _live_data;
+  Atomic _critical_pins;
 
   size_t _mixed_candidate_garbage_words;
 
-  HeapWord* volatile _update_watermark;
+  Atomic _update_watermark;
 
   uint _age;
   bool _promoted_in_place;
diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.inline.hpp b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.inline.hpp
index be982433885..39b7c732703 100644
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.inline.hpp
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.inline.hpp
@@ -32,7 +32,6 @@
 #include "gc/shenandoah/shenandoahGenerationalHeap.hpp"
 #include "gc/shenandoah/shenandoahHeap.inline.hpp"
 #include "gc/shenandoah/shenandoahOldGeneration.hpp"
-#include "runtime/atomicAccess.hpp"
 
 HeapWord* ShenandoahHeapRegion::allocate_aligned(size_t size, ShenandoahAllocRequest &req, size_t alignment_in_bytes) {
   shenandoah_assert_heaplocked_or_safepoint();
@@ -147,16 +146,16 @@ inline void ShenandoahHeapRegion::increase_live_data_gc_words(size_t s) {
 }
 
 inline void ShenandoahHeapRegion::internal_increase_live_data(size_t s) {
-  AtomicAccess::add(&_live_data, s, memory_order_relaxed);
+  _live_data.add_then_fetch(s, memory_order_relaxed);
 }
 
 inline void ShenandoahHeapRegion::clear_live_data() {
-  AtomicAccess::store(&_live_data, (size_t)0);
+  _live_data.store_relaxed((size_t)0);
   _promoted_in_place = false;
 }
 
 inline size_t ShenandoahHeapRegion::get_live_data_words() const {
-  return AtomicAccess::load(&_live_data);
+  return _live_data.load_relaxed();
 }
 
 inline size_t ShenandoahHeapRegion::get_live_data_bytes() const {
@@ -205,21 +204,21 @@ inline size_t ShenandoahHeapRegion::garbage_before_padded_for_promote() const {
 }
 
 inline HeapWord* ShenandoahHeapRegion::get_update_watermark() const {
-  HeapWord* watermark = AtomicAccess::load_acquire(&_update_watermark);
+  HeapWord* watermark = _update_watermark.load_acquire();
   assert(bottom() <= watermark && watermark <= top(), "within bounds");
   return watermark;
 }
 
 inline void ShenandoahHeapRegion::set_update_watermark(HeapWord* w) {
   assert(bottom() <= w && w <= top(), "within bounds");
-  AtomicAccess::release_store(&_update_watermark, w);
+  _update_watermark.release_store(w);
 }
 
 // Fast version that avoids synchronization, only to be used at safepoints.
 inline void ShenandoahHeapRegion::set_update_watermark_at_safepoint(HeapWord* w) {
   assert(bottom() <= w && w <= top(), "within bounds");
   assert(SafepointSynchronize::is_at_safepoint(), "Should be at Shenandoah safepoint");
-  _update_watermark = w;
+  _update_watermark.store_relaxed(w);
 }
 
 inline ShenandoahAffiliation ShenandoahHeapRegion::affiliation() const {
diff --git a/src/hotspot/share/gc/shenandoah/vmStructs_shenandoah.hpp b/src/hotspot/share/gc/shenandoah/vmStructs_shenandoah.hpp
index 3968575d089..e5e2b14a3a1 100644
--- a/src/hotspot/share/gc/shenandoah/vmStructs_shenandoah.hpp
+++ b/src/hotspot/share/gc/shenandoah/vmStructs_shenandoah.hpp
@@ -29,21 +29,22 @@
 #include "gc/shenandoah/shenandoahHeap.hpp"
 #include "gc/shenandoah/shenandoahHeapRegion.hpp"
 #include "gc/shenandoah/shenandoahMonitoringSupport.hpp"
+#include "runtime/atomic.hpp"
 
-#define VM_STRUCTS_SHENANDOAH(nonstatic_field, volatile_nonstatic_field, static_field)                \
-  nonstatic_field(ShenandoahHeap, _num_regions,                    size_t)                            \
-  nonstatic_field(ShenandoahHeap, _regions,                        ShenandoahHeapRegion**)            \
-  nonstatic_field(ShenandoahHeap, _log_min_obj_alignment_in_bytes, int)                               \
-  nonstatic_field(ShenandoahHeap, _free_set,                       ShenandoahFreeSet*)                \
-  volatile_nonstatic_field(ShenandoahHeap, _committed,             size_t)                            \
-  static_field(ShenandoahHeapRegion, RegionSizeBytes,              size_t)                            \
-  static_field(ShenandoahHeapRegion, RegionSizeBytesShift,         size_t)                            \
-  volatile_nonstatic_field(ShenandoahHeapRegion, _state,           ShenandoahHeapRegion::RegionState) \
-  nonstatic_field(ShenandoahHeapRegion, _index,                    size_t const)                      \
-  nonstatic_field(ShenandoahHeapRegion, _bottom,                   HeapWord* const)                   \
-  nonstatic_field(ShenandoahHeapRegion, _top,                      HeapWord*)                         \
-  nonstatic_field(ShenandoahHeapRegion, _end,                      HeapWord* const)                   \
-  nonstatic_field(ShenandoahFreeSet, _total_global_used,           size_t)                            \
+#define VM_STRUCTS_SHENANDOAH(nonstatic_field, volatile_nonstatic_field, static_field)                        \
+  nonstatic_field(ShenandoahHeap, _num_regions,                    size_t)                                    \
+  nonstatic_field(ShenandoahHeap, _regions,                        ShenandoahHeapRegion**)                    \
+  nonstatic_field(ShenandoahHeap, _log_min_obj_alignment_in_bytes, int)                                       \
+  nonstatic_field(ShenandoahHeap, _free_set,                       ShenandoahFreeSet*)                        \
+  volatile_nonstatic_field(ShenandoahHeap, _committed,             size_t)                                    \
+  static_field(ShenandoahHeapRegion, RegionSizeBytes,              size_t)                                    \
+  static_field(ShenandoahHeapRegion, RegionSizeBytesShift,         size_t)                                    \
+  nonstatic_field(ShenandoahHeapRegion, _state,                    Atomic) \
+  nonstatic_field(ShenandoahHeapRegion, _index,                    size_t const)                              \
+  nonstatic_field(ShenandoahHeapRegion, _bottom,                   HeapWord* const)                           \
+  nonstatic_field(ShenandoahHeapRegion, _top,                      HeapWord*)                                 \
+  nonstatic_field(ShenandoahHeapRegion, _end,                      HeapWord* const)                           \
+  nonstatic_field(ShenandoahFreeSet, _total_global_used,           size_t)                                    \
 
 #define VM_INT_CONSTANTS_SHENANDOAH(declare_constant, declare_constant_with_value) \
   declare_constant(ShenandoahHeapRegion::_empty_uncommitted)                       \
@@ -65,7 +66,7 @@
   declare_toplevel_type(ShenandoahHeapRegion)                                 \
   declare_toplevel_type(ShenandoahHeap*)                                      \
   declare_toplevel_type(ShenandoahHeapRegion*)                                \
-  declare_toplevel_type(ShenandoahHeapRegion::RegionState)                    \
+  declare_toplevel_type(Atomic)            \
   declare_toplevel_type(ShenandoahFreeSet)                                    \
   declare_toplevel_type(ShenandoahFreeSet*)                                   \
 

From f9ded7f88cce75151cec32d1ef1f9662ea10431a Mon Sep 17 00:00:00 2001
From: Sergey Bylokhov 
Date: Mon, 9 Feb 2026 21:07:51 +0000
Subject: [PATCH 034/120] 6441373: Editing JTable is not Serializable

Reviewed-by: psadhukhan
---
 .../share/classes/javax/swing/JTable.java     |   5 +
 .../swing/JTable/JTableSerialization.java     | 169 ++++++++++++++++++
 2 files changed, 174 insertions(+)
 create mode 100644 test/jdk/javax/swing/JTable/JTableSerialization.java

diff --git a/src/java.desktop/share/classes/javax/swing/JTable.java b/src/java.desktop/share/classes/javax/swing/JTable.java
index f5c914135d1..fa8110d1517 100644
--- a/src/java.desktop/share/classes/javax/swing/JTable.java
+++ b/src/java.desktop/share/classes/javax/swing/JTable.java
@@ -6021,6 +6021,8 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
 
         surrendersFocusOnKeystroke = f.get("surrendersFocusOnKeystroke", false);
         editorRemover = (PropertyChangeListener) f.get("editorRemover", null);
+        editingColumn = -1;
+        editingRow = -1;
         columnSelectionAdjusting = f.get("columnSelectionAdjusting", false);
         rowSelectionAdjusting = f.get("rowSelectionAdjusting", false);
         printError = (Throwable) f.get("printError", null);
@@ -6053,6 +6055,9 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
      * do any Swing-specific pre-serialization configuration.
      */
     void compWriteObjectNotify() {
+        if (isEditing() && !getCellEditor().stopCellEditing()) {
+            getCellEditor().cancelCellEditing();
+        }
         super.compWriteObjectNotify();
         // If ToolTipText != null, then the tooltip has already been
         // unregistered by JComponent.compWriteObjectNotify()
diff --git a/test/jdk/javax/swing/JTable/JTableSerialization.java b/test/jdk/javax/swing/JTable/JTableSerialization.java
new file mode 100644
index 00000000000..29d8837bb26
--- /dev/null
+++ b/test/jdk/javax/swing/JTable/JTableSerialization.java
@@ -0,0 +1,169 @@
+/*
+ * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
+ * 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.Component;
+import java.awt.EventQueue;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import javax.swing.JLabel;
+import javax.swing.JTable;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+
+import static javax.swing.UIManager.getInstalledLookAndFeels;
+
+/**
+ * @test
+ * @bug 6441373
+ * @summary Checks that editing/non-editing JTable is serializable
+ * @run main/timeout=260/othervm -Xmx32m JTableSerialization
+ */
+public final class JTableSerialization {
+
+    private static JTable table;
+    private static final int ROW = 1;
+    private static final int COLUMN = 1;
+    private static final String SOME_TEST_LABEL = "Some TEST label";
+    private static final String TEST_EDIT_VALUE = "Test EDIT value";
+
+    public static void main(String[] argv) throws Exception {
+        for (UIManager.LookAndFeelInfo laf : getInstalledLookAndFeels()) {
+            AtomicBoolean go = new AtomicBoolean(false);
+            EventQueue.invokeAndWait(() -> go.set(tryLookAndFeel(laf)));
+            if (!go.get()) {
+                continue;
+            }
+            for (boolean editing : new boolean[]{true, false}) {
+                EventQueue.invokeAndWait(JTableSerialization::init);
+                long endtime = System.nanoTime() + TimeUnit.SECONDS.toNanos(20);
+                while (System.nanoTime() < endtime) {
+                    // need to jump to/from EDT to flush all pending events
+                    EventQueue.invokeAndWait(() -> test(editing));
+                }
+                EventQueue.invokeAndWait(JTableSerialization::validate);
+            }
+        }
+    }
+
+    private static void init() {
+        JLabel label = new JLabel(SOME_TEST_LABEL);
+        table = new JTable(2, 2);
+        table.add(label);
+        table.setValueAt(TEST_EDIT_VALUE, ROW, COLUMN);
+        checkNonEditingState(table);
+    }
+
+    private static void test(boolean editing) {
+        if (editing) {
+            table.editCellAt(ROW, COLUMN);
+            checkEditingState(table);
+        }
+        table = copyTable(table);
+        checkNonEditingState(table);
+    }
+
+    private static void validate() {
+        Object value = table.getValueAt(ROW, COLUMN);
+        if (!value.equals(TEST_EDIT_VALUE)) {
+            throw new RuntimeException("Wrong value: " + value);
+        }
+        for (Component component : table.getComponents()) {
+            if (component instanceof JLabel) {
+                if (((JLabel) component).getText().equals(SOME_TEST_LABEL)) {
+                    return;
+                }
+            }
+        }
+        throw new RuntimeException("JLabel is not found");
+    }
+
+
+    private static void checkNonEditingState(JTable jt) {
+        if (jt.isEditing()) {
+            throw new RuntimeException("Should not be editing");
+        }
+        if (jt.getEditorComponent() != null) {
+            throw new RuntimeException("Editor should be null");
+        }
+        int row = jt.getEditingRow();
+        if (row != -1) {
+            throw new RuntimeException("Expected row -1 but was: " + row);
+        }
+        int column = jt.getEditingColumn();
+        if (column != -1) {
+            throw new RuntimeException("Expected column -1 but was: " + column);
+        }
+    }
+
+    private static void checkEditingState(JTable jt) {
+        if (!jt.isEditing()) {
+            throw new RuntimeException("Should be editing");
+        }
+        if (jt.getEditorComponent() == null) {
+            throw new RuntimeException("Editor should not be null");
+        }
+        if (jt.getEditingRow() != ROW) {
+            throw new RuntimeException("Row should be: " + ROW);
+        }
+        if (jt.getEditingColumn() != COLUMN) {
+            throw new RuntimeException("Column should be: " + COLUMN);
+        }
+    }
+
+    private static JTable copyTable(JTable jt) {
+        try {
+            byte[] bdata;
+            try (var baos = new ByteArrayOutputStream();
+                 var oos = new ObjectOutputStream(baos))
+            {
+                oos.writeObject(jt);
+                bdata = baos.toByteArray();
+            }
+            try (var bais = new ByteArrayInputStream(bdata);
+                 var ois = new ObjectInputStream(bais))
+            {
+                return (JTable) ois.readObject();
+            }
+        } catch (IOException | ClassNotFoundException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    private static boolean tryLookAndFeel(UIManager.LookAndFeelInfo laf) {
+        try {
+            UIManager.setLookAndFeel(laf.getClassName());
+            System.out.println("LookAndFeel: " + laf.getClassName());
+            return true;
+        } catch (UnsupportedLookAndFeelException ignored) {
+            return false;
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+}

From 87df1bbbe28f2009adda6ca13d0d7e2766c48c88 Mon Sep 17 00:00:00 2001
From: Alexey Semenyuk 
Date: Tue, 10 Feb 2026 03:59:44 +0000
Subject: [PATCH 035/120] 8377513: jpackage: fix Win8365790Test test

Reviewed-by: almatvee
---
 .../jpackage/windows/Win8365790Test.java      | 27 +++++++++++++------
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/test/jdk/tools/jpackage/windows/Win8365790Test.java b/test/jdk/tools/jpackage/windows/Win8365790Test.java
index 6376a16cecc..5a690ea0146 100644
--- a/test/jdk/tools/jpackage/windows/Win8365790Test.java
+++ b/test/jdk/tools/jpackage/windows/Win8365790Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@ import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.time.Duration;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.Executors;
 import jdk.jpackage.test.AdditionalLauncher;
 import jdk.jpackage.test.Annotations.Test;
 import jdk.jpackage.test.CfgFile;
@@ -101,13 +103,18 @@ public class Win8365790Test {
 
     private static String runLauncher(JPackageCommand cmd, String launcherName, Path traceFile, Path outputFile) throws IOException {
         // Launch the specified launcher and send Ctrl+C signal to it.
-        Thread.ofVirtual().start(() -> {
-            configureAndExecute(0, Executor.of("powershell", "-NonInteractive", "-NoLogo", "-NoProfile", "-ExecutionPolicy", "Unrestricted")
-                    .addArgument("-File").addArgument(TEST_PS1)
-                    .addArguments("-TimeoutSeconds", Long.toString(Duration.ofSeconds(5).getSeconds()))
-                    .addArgument("-Executable").addArgument(cmd.appLauncherPath(launcherName))
-                    .dumpOutput());
-        });
+
+        var state = TKit.state();
+
+        var future = CompletableFuture.runAsync(() -> {
+            TKit.withState(() -> {
+                configureAndExecute(0, Executor.of("powershell", "-NonInteractive", "-NoLogo", "-NoProfile", "-ExecutionPolicy", "Unrestricted")
+                        .addArgument("-File").addArgument(TEST_PS1)
+                        .addArguments("-TimeoutSeconds", Long.toString(Duration.ofSeconds(5).getSeconds()))
+                        .addArgument("-Executable").addArgument(cmd.appLauncherPath(launcherName))
+                        .dumpOutput());
+            }, state);
+        }, Executors.newVirtualThreadPerTaskExecutor());
 
         TKit.waitForFileCreated(traceFile, Duration.ofSeconds(20), Duration.ofSeconds(2));
 
@@ -118,6 +125,10 @@ public class Win8365790Test {
         }
 
         TKit.assertFileExists(outputFile);
+
+        // Call join() on the future to make the test fail if the future execution resulted in a throw.
+        future.join();
+
         return Files.readString(outputFile);
     }
 

From 996ca4b44bff2f782b775ee7ca496544e5982774 Mon Sep 17 00:00:00 2001
From: Alan Bateman 
Date: Tue, 10 Feb 2026 06:16:10 +0000
Subject: [PATCH 036/120] 8377411:
 java/lang/Thread/virtual/stress/ParkAfterTimedPark.java only testing pinned
 case

Reviewed-by: vklang
---
 .../jdk/java/lang/Thread/virtual/stress/ParkAfterTimedPark.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/jdk/java/lang/Thread/virtual/stress/ParkAfterTimedPark.java b/test/jdk/java/lang/Thread/virtual/stress/ParkAfterTimedPark.java
index 1b173271a79..7dd0ac6e5a2 100644
--- a/test/jdk/java/lang/Thread/virtual/stress/ParkAfterTimedPark.java
+++ b/test/jdk/java/lang/Thread/virtual/stress/ParkAfterTimedPark.java
@@ -53,7 +53,7 @@ public class ParkAfterTimedPark {
         for (int i = 1; i <= iterations; i++) {
             System.out.println(Instant.now() + " => " + i + " of " + iterations);
             for (int timeout = 1; timeout <= 10; timeout++) {
-                test(timeout, true);
+                test(timeout, pinned);
             }
         }
     }

From b8088941c8f1ef803bd0592b945d3e1ab5c15bee Mon Sep 17 00:00:00 2001
From: Varada M 
Date: Tue, 10 Feb 2026 07:28:04 +0000
Subject: [PATCH 037/120] 8377355: VectorAPI source generation broken after
 JDK-8371187

Reviewed-by: liach, jbhateja
---
 .../classes/jdk/incubator/vector/ByteVector.java |  1 -
 .../jdk/incubator/vector/X-Vector.java.template  | 16 ++++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java
index 64d8e3a8252..36609807774 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java
@@ -4105,7 +4105,6 @@ public abstract class ByteVector extends AbstractVector {
         return this;
     }
 
-    /*package-private*/
     @Override
     @ForceInline
     final
diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template
index 03883cf3e8a..48d6ed762be 100644
--- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template
+++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template
@@ -5393,6 +5393,22 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
         return this;
     }
 
+    @Override
+    @ForceInline
+    final
+    $abstractvectortype$ swapIfNeeded(AbstractSpecies srcSpecies) {
+#if[byte]
+        return this;
+#else[byte]
+        int subLanesPerSrc = subLanesToSwap(srcSpecies);
+        if (subLanesPerSrc < 0) {
+            return this;
+        }
+        VectorShuffle<$Boxtype$> shuffle = normalizeSubLanesForSpecies(this.vspecies(), subLanesPerSrc);
+        return ($abstractvectortype$) this.rearrange(shuffle);
+#end[byte]
+    }
+
     static final int ARRAY_SHIFT =
         31 - Integer.numberOfLeadingZeros(Unsafe.ARRAY_$TYPE$_INDEX_SCALE);
     static final long ARRAY_BASE =

From 2c9c2f514be0928d15a0642058b98d73c494572f Mon Sep 17 00:00:00 2001
From: Thomas Schatzl 
Date: Tue, 10 Feb 2026 08:27:39 +0000
Subject: [PATCH 038/120] 8376353: Parallel: Convert PSParallelCompact classes
 to use Atomic

Reviewed-by: iwalulya, ayang
---
 .../share/gc/parallel/psParallelCompact.cpp   | 34 ++++++-----
 .../share/gc/parallel/psParallelCompact.hpp   | 60 +++++++++----------
 2 files changed, 50 insertions(+), 44 deletions(-)

diff --git a/src/hotspot/share/gc/parallel/psParallelCompact.cpp b/src/hotspot/share/gc/parallel/psParallelCompact.cpp
index bab72296d4c..4c6ea01e45f 100644
--- a/src/hotspot/share/gc/parallel/psParallelCompact.cpp
+++ b/src/hotspot/share/gc/parallel/psParallelCompact.cpp
@@ -30,6 +30,7 @@
 #include "code/codeCache.hpp"
 #include "code/nmethod.hpp"
 #include "compiler/oopMap.hpp"
+#include "cppstdlib/new.hpp"
 #include "gc/parallel/objectStartArray.inline.hpp"
 #include "gc/parallel/parallelArguments.hpp"
 #include "gc/parallel/parallelScavengeHeap.inline.hpp"
@@ -135,8 +136,8 @@ bool ParallelCompactData::RegionData::is_clear() {
          (_source_region == 0) &&
          (_partial_obj_addr == nullptr) &&
          (_partial_obj_size == 0) &&
-         (_dc_and_los == 0) &&
-         (_shadow_state == 0);
+         (dc_and_los() == 0) &&
+         (shadow_state() == 0);
 }
 
 #ifdef ASSERT
@@ -145,8 +146,8 @@ void ParallelCompactData::RegionData::verify_clear() {
   assert(_source_region == 0, "inv");
   assert(_partial_obj_addr == nullptr, "inv");
   assert(_partial_obj_size == 0, "inv");
-  assert(_dc_and_los == 0, "inv");
-  assert(_shadow_state == 0, "inv");
+  assert(dc_and_los() == 0, "inv");
+  assert(shadow_state() == 0, "inv");
 }
 #endif
 
@@ -296,7 +297,9 @@ void ParallelCompactData::clear_range(size_t beg_region, size_t end_region) {
   assert(end_region <= _region_count, "end_region out of range");
 
   const size_t region_cnt = end_region - beg_region;
-  memset(_region_data + beg_region, 0, region_cnt * sizeof(RegionData));
+  for (size_t i = beg_region; i < end_region; i++) {
+    ::new (&_region_data[i]) RegionData{};
+  }
 }
 
 // The total live words on src_region would overflow the target space, so find
@@ -1294,7 +1297,7 @@ void PSParallelCompact::marking_phase(ParallelOldTracer *gc_tracer) {
 }
 
 template
-void PSParallelCompact::adjust_in_space_helper(SpaceId id, volatile uint* claim_counter, Func&& on_stripe) {
+void PSParallelCompact::adjust_in_space_helper(SpaceId id, Atomic* claim_counter, Func&& on_stripe) {
   MutableSpace* sp = PSParallelCompact::space(id);
   HeapWord* const bottom = sp->bottom();
   HeapWord* const top = sp->top();
@@ -1307,7 +1310,7 @@ void PSParallelCompact::adjust_in_space_helper(SpaceId id, volatile uint* claim_
   const size_t stripe_size = num_regions_per_stripe * region_size;
 
   while (true) {
-    uint counter = AtomicAccess::fetch_then_add(claim_counter, num_regions_per_stripe);
+    uint counter = claim_counter->fetch_then_add(num_regions_per_stripe);
     HeapWord* cur_stripe = bottom + counter * region_size;
     if (cur_stripe >= top) {
       break;
@@ -1317,7 +1320,7 @@ void PSParallelCompact::adjust_in_space_helper(SpaceId id, volatile uint* claim_
   }
 }
 
-void PSParallelCompact::adjust_in_old_space(volatile uint* claim_counter) {
+void PSParallelCompact::adjust_in_old_space(Atomic* claim_counter) {
   // Regions in old-space shouldn't be split.
   assert(!_space_info[old_space_id].split_info().is_valid(), "inv");
 
@@ -1348,7 +1351,7 @@ void PSParallelCompact::adjust_in_old_space(volatile uint* claim_counter) {
   });
 }
 
-void PSParallelCompact::adjust_in_young_space(SpaceId id, volatile uint* claim_counter) {
+void PSParallelCompact::adjust_in_young_space(SpaceId id, Atomic* claim_counter) {
   adjust_in_space_helper(id, claim_counter, [](HeapWord* stripe_start, HeapWord* stripe_end) {
     HeapWord* obj_start = stripe_start;
     while (obj_start < stripe_end) {
@@ -1362,7 +1365,7 @@ void PSParallelCompact::adjust_in_young_space(SpaceId id, volatile uint* claim_c
   });
 }
 
-void PSParallelCompact::adjust_pointers_in_spaces(uint worker_id, volatile uint* claim_counters) {
+void PSParallelCompact::adjust_pointers_in_spaces(uint worker_id, Atomic* claim_counters) {
   auto start_time = Ticks::now();
   adjust_in_old_space(&claim_counters[0]);
   for (uint id = eden_space_id; id < last_space_id; ++id) {
@@ -1376,12 +1379,12 @@ class PSAdjustTask final : public WorkerTask {
   WeakProcessor::Task                        _weak_proc_task;
   OopStorageSetStrongParState  _oop_storage_iter;
   uint                                       _nworkers;
-  volatile bool                              _code_cache_claimed;
-  volatile uint _claim_counters[PSParallelCompact::last_space_id] = {};
+  Atomic                               _code_cache_claimed;
+  Atomic _claim_counters[PSParallelCompact::last_space_id];
 
   bool try_claim_code_cache_task() {
-    return AtomicAccess::load(&_code_cache_claimed) == false
-        && AtomicAccess::cmpxchg(&_code_cache_claimed, false, true) == false;
+    return _code_cache_claimed.load_relaxed() == false
+        && _code_cache_claimed.compare_set(false, true);
   }
 
 public:
@@ -1393,6 +1396,9 @@ public:
     _nworkers(nworkers),
     _code_cache_claimed(false) {
 
+    for (unsigned int i = PSParallelCompact::old_space_id; i < PSParallelCompact::last_space_id; ++i) {
+      ::new (&_claim_counters[i]) Atomic{};
+    }
     ClassLoaderDataGraph::verify_claimed_marks_cleared(ClassLoaderData::_claim_stw_fullgc_adjust);
   }
 
diff --git a/src/hotspot/share/gc/parallel/psParallelCompact.hpp b/src/hotspot/share/gc/parallel/psParallelCompact.hpp
index 4ac9395d727..f5ab041fa97 100644
--- a/src/hotspot/share/gc/parallel/psParallelCompact.hpp
+++ b/src/hotspot/share/gc/parallel/psParallelCompact.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2026, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,7 @@
 #include "gc/shared/referenceProcessor.hpp"
 #include "gc/shared/taskTerminator.hpp"
 #include "oops/oop.hpp"
-#include "runtime/atomicAccess.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/orderAccess.hpp"
 
 class ParallelScavengeHeap;
@@ -236,7 +236,7 @@ public:
     // in this region (words).  This does not include the partial object
     // extending onto the region (if any), or the part of an object that extends
     // onto the next region (if any).
-    size_t live_obj_size() const { return _dc_and_los & los_mask; }
+    size_t live_obj_size() const { return dc_and_los() & los_mask; }
 
     // Total live data that lies within the region (words).
     size_t data_size() const { return partial_obj_size() + live_obj_size(); }
@@ -268,9 +268,9 @@ public:
     // Minor subtlety:  claimed() returns true if the region is marked
     // completed(), which is desirable since a region must be claimed before it
     // can be completed.
-    bool available() const { return _dc_and_los < dc_one; }
-    bool claimed()   const { return _dc_and_los >= dc_claimed; }
-    bool completed() const { return _dc_and_los >= dc_completed; }
+    bool available() const { return dc_and_los() < dc_one; }
+    bool claimed()   const { return dc_and_los() >= dc_claimed; }
+    bool completed() const { return dc_and_los() >= dc_completed; }
 
     // These are not atomic.
     void set_destination(HeapWord* addr)       { _destination = addr; }
@@ -315,7 +315,7 @@ public:
     // Return to the normal path here
     inline void shadow_to_normal();
 
-    int shadow_state() { return _shadow_state; }
+    int shadow_state() { return _shadow_state.load_relaxed(); }
 
     bool is_clear();
 
@@ -339,9 +339,10 @@ public:
     size_t               _source_region;
     HeapWord*            _partial_obj_addr;
     region_sz_t          _partial_obj_size;
-    region_sz_t volatile _dc_and_los;
-    int         volatile _shadow_state;
+    Atomic  _dc_and_los;
+    Atomic          _shadow_state;
 
+    region_sz_t dc_and_los() const { return _dc_and_los.load_relaxed(); }
 #ifdef ASSERT
    public:
     uint                 _pushed;   // 0 until region is pushed onto a stack
@@ -411,7 +412,7 @@ private:
 inline uint
 ParallelCompactData::RegionData::destination_count_raw() const
 {
-  return _dc_and_los & dc_mask;
+  return dc_and_los() & dc_mask;
 }
 
 inline uint
@@ -425,26 +426,26 @@ ParallelCompactData::RegionData::set_destination_count(uint count)
 {
   assert(count <= (dc_completed >> dc_shift), "count too large");
   const region_sz_t live_sz = (region_sz_t) live_obj_size();
-  _dc_and_los = (count << dc_shift) | live_sz;
+  _dc_and_los.store_relaxed((count << dc_shift) | live_sz);
 }
 
 inline void ParallelCompactData::RegionData::set_live_obj_size(size_t words)
 {
   assert(words <= los_mask, "would overflow");
-  _dc_and_los = destination_count_raw() | (region_sz_t)words;
+  _dc_and_los.store_relaxed(destination_count_raw() | (region_sz_t)words);
 }
 
 inline void ParallelCompactData::RegionData::decrement_destination_count()
 {
-  assert(_dc_and_los < dc_claimed, "already claimed");
-  assert(_dc_and_los >= dc_one, "count would go negative");
-  AtomicAccess::add(&_dc_and_los, dc_mask);
+  assert(dc_and_los() < dc_claimed, "already claimed");
+  assert(dc_and_los() >= dc_one, "count would go negative");
+  _dc_and_los.add_then_fetch(dc_mask);
 }
 
 inline void ParallelCompactData::RegionData::set_completed()
 {
   assert(claimed(), "must be claimed first");
-  _dc_and_los = dc_completed | (region_sz_t) live_obj_size();
+  _dc_and_los.store_relaxed(dc_completed | (region_sz_t) live_obj_size());
 }
 
 // MT-unsafe claiming of a region.  Should only be used during single threaded
@@ -452,7 +453,7 @@ inline void ParallelCompactData::RegionData::set_completed()
 inline bool ParallelCompactData::RegionData::claim_unsafe()
 {
   if (available()) {
-    _dc_and_los |= dc_claimed;
+    _dc_and_los.store_relaxed(dc_and_los() | dc_claimed);
     return true;
   }
   return false;
@@ -461,36 +462,35 @@ inline bool ParallelCompactData::RegionData::claim_unsafe()
 inline void ParallelCompactData::RegionData::add_live_obj(size_t words)
 {
   assert(words <= (size_t)los_mask - live_obj_size(), "overflow");
-  AtomicAccess::add(&_dc_and_los, static_cast(words));
+  _dc_and_los.add_then_fetch(static_cast(words));
 }
 
 inline bool ParallelCompactData::RegionData::claim()
 {
   const region_sz_t los = static_cast(live_obj_size());
-  const region_sz_t old = AtomicAccess::cmpxchg(&_dc_and_los, los, dc_claimed | los);
-  return old == los;
+  return _dc_and_los.compare_set(los, dc_claimed | los);
 }
 
 inline bool ParallelCompactData::RegionData::mark_normal() {
-  return AtomicAccess::cmpxchg(&_shadow_state, UnusedRegion, NormalRegion) == UnusedRegion;
+  return _shadow_state.compare_set(UnusedRegion, NormalRegion);
 }
 
 inline bool ParallelCompactData::RegionData::mark_shadow() {
-  if (_shadow_state != UnusedRegion) return false;
-  return AtomicAccess::cmpxchg(&_shadow_state, UnusedRegion, ShadowRegion) == UnusedRegion;
+  if (shadow_state() != UnusedRegion) return false;
+  return _shadow_state.compare_set(UnusedRegion, ShadowRegion);
 }
 
 inline void ParallelCompactData::RegionData::mark_filled() {
-  int old = AtomicAccess::cmpxchg(&_shadow_state, ShadowRegion, FilledShadow);
+  int old = _shadow_state.compare_exchange(ShadowRegion, FilledShadow);
   assert(old == ShadowRegion, "Fail to mark the region as filled");
 }
 
 inline bool ParallelCompactData::RegionData::mark_copied() {
-  return AtomicAccess::cmpxchg(&_shadow_state, FilledShadow, CopiedShadow) == FilledShadow;
+  return _shadow_state.compare_set(FilledShadow, CopiedShadow);
 }
 
 void ParallelCompactData::RegionData::shadow_to_normal() {
-  int old = AtomicAccess::cmpxchg(&_shadow_state, ShadowRegion, NormalRegion);
+  int old = _shadow_state.compare_exchange(ShadowRegion, NormalRegion);
   assert(old == ShadowRegion, "Fail to mark the region as finish");
 }
 
@@ -764,13 +764,13 @@ public:
   static bool invoke(bool clear_all_soft_refs, bool should_do_max_compaction);
 
   template
-  static void adjust_in_space_helper(SpaceId id, volatile uint* claim_counter, Func&& on_stripe);
+  static void adjust_in_space_helper(SpaceId id, Atomic* claim_counter, Func&& on_stripe);
 
-  static void adjust_in_old_space(volatile uint* claim_counter);
+  static void adjust_in_old_space(Atomic* claim_counter);
 
-  static void adjust_in_young_space(SpaceId id, volatile uint* claim_counter);
+  static void adjust_in_young_space(SpaceId id, Atomic* claim_counter);
 
-  static void adjust_pointers_in_spaces(uint worker_id, volatile uint* claim_counter);
+  static void adjust_pointers_in_spaces(uint worker_id, Atomic* claim_counter);
 
   static void post_initialize();
   // Perform initialization for PSParallelCompact that requires

From f124f86f4304fbb62aabdef8f2d480d197aaa1b3 Mon Sep 17 00:00:00 2001
From: Thomas Schatzl 
Date: Tue, 10 Feb 2026 08:30:40 +0000
Subject: [PATCH 039/120] 8376666: Convert G1BlockOffsetTable to use Atomic

Reviewed-by: iwalulya, ayang
---
 .../share/gc/g1/g1BlockOffsetTable.cpp        | 48 +++++++++----------
 .../share/gc/g1/g1BlockOffsetTable.hpp        | 25 +++++-----
 .../share/gc/g1/g1BlockOffsetTable.inline.hpp | 15 +++---
 3 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp b/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp
index 4653f96980d..c695ad977fe 100644
--- a/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp
+++ b/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2026, Oracle and/or its affiliates. All rights reserved.
  * 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,26 +40,26 @@ G1BlockOffsetTable::G1BlockOffsetTable(MemRegion heap, G1RegionToSpaceMapper* st
 
   MemRegion bot_reserved = storage->reserved();
 
-  _offset_base = ((uint8_t*)bot_reserved.start() - (uintptr_t(_reserved.start()) >> CardTable::card_shift()));
+  _offset_base = ((Atomic*)bot_reserved.start() - (uintptr_t(_reserved.start()) >> CardTable::card_shift()));
 
   log_trace(gc, bot)("G1BlockOffsetTable::G1BlockOffsetTable: ");
   log_trace(gc, bot)("    rs.base(): " PTR_FORMAT "  rs.size(): %zu  rs end(): " PTR_FORMAT,
                      p2i(bot_reserved.start()), bot_reserved.byte_size(), p2i(bot_reserved.end()));
 }
 
-void G1BlockOffsetTable::set_offset_array(uint8_t* addr, uint8_t offset) {
+void G1BlockOffsetTable::set_offset_array(Atomic* addr, uint8_t offset) {
   check_address(addr, "Block offset table address out of range");
-  AtomicAccess::store(addr, offset);
+  addr->store_relaxed(offset);
 }
 
-void G1BlockOffsetTable::set_offset_array(uint8_t* addr, HeapWord* high, HeapWord* low) {
+void G1BlockOffsetTable::set_offset_array(Atomic* addr, HeapWord* high, HeapWord* low) {
   assert(high >= low, "addresses out of order");
   size_t offset = pointer_delta(high, low);
   check_offset(offset, "offset too large");
   set_offset_array(addr, (uint8_t)offset);
 }
 
-void G1BlockOffsetTable::set_offset_array(uint8_t* left, uint8_t* right, uint8_t offset) {
+void G1BlockOffsetTable::set_offset_array(Atomic* left, Atomic* right, uint8_t offset) {
   check_address(right, "Right block offset table address out of range");
   assert(left <= right, "indexes out of order");
   size_t num_cards = right - left + 1;
@@ -67,9 +67,9 @@ void G1BlockOffsetTable::set_offset_array(uint8_t* left, uint8_t* right, uint8_t
 }
 
 #ifdef ASSERT
-void G1BlockOffsetTable::check_address(uint8_t* addr, const char* msg) const {
-  uint8_t* start_addr = const_cast(_offset_base + (uintptr_t(_reserved.start()) >> CardTable::card_shift()));
-  uint8_t* end_addr = const_cast(_offset_base + (uintptr_t(_reserved.end()) >> CardTable::card_shift()));
+void G1BlockOffsetTable::check_address(Atomic* addr, const char* msg) const {
+  Atomic* start_addr = const_cast*>(_offset_base + (uintptr_t(_reserved.start()) >> CardTable::card_shift()));
+  Atomic* end_addr = const_cast*>(_offset_base + (uintptr_t(_reserved.end()) >> CardTable::card_shift()));
   assert(addr >= start_addr && addr <= end_addr,
          "%s - offset address: " PTR_FORMAT ", start address: " PTR_FORMAT ", end address: " PTR_FORMAT,
          msg, (p2i(addr)), (p2i(start_addr)), (p2i(end_addr)));
@@ -113,17 +113,17 @@ void G1BlockOffsetTable::check_address(uint8_t* addr, const char* msg) const {
 //      Move back N (e.g., 8) entries and repeat with the
 //        value of the new entry
 //
-void G1BlockOffsetTable::set_remainder_to_point_to_start_incl(uint8_t* start_card, uint8_t* end_card) {
+void G1BlockOffsetTable::set_remainder_to_point_to_start_incl(Atomic* start_card, Atomic* end_card) {
   assert(start_card <= end_card, "precondition");
   assert(offset_array(start_card-1) < CardTable::card_size_in_words(),
          "Offset card has an unexpected value");
-  uint8_t* start_card_for_region = start_card;
+  Atomic* start_card_for_region = start_card;
   uint8_t offset = UINT8_MAX;
   for (uint i = 0; i < BOTConstants::N_powers; i++) {
     // -1 so that the card with the actual offset is counted.  Another -1
     // so that the reach ends in this region and not at the start
     // of the next.
-    uint8_t* reach = start_card - 1 + (BOTConstants::power_to_cards_back(i+1) - 1);
+    Atomic* reach = start_card - 1 + (BOTConstants::power_to_cards_back(i+1) - 1);
     offset = CardTable::card_size_in_words() + i;
     if (reach >= end_card) {
       set_offset_array(start_card_for_region, end_card, offset);
@@ -141,12 +141,12 @@ void G1BlockOffsetTable::set_remainder_to_point_to_start_incl(uint8_t* start_car
 // The card-interval [start_card, end_card] is a closed interval; this
 // is an expensive check -- use with care and only under protection of
 // suitable flag.
-void G1BlockOffsetTable::check_all_cards(uint8_t* start_card, uint8_t* end_card) const {
+void G1BlockOffsetTable::check_all_cards(Atomic* start_card, Atomic* end_card) const {
   if (end_card < start_card) {
     return;
   }
   guarantee(offset_array(start_card) == CardTable::card_size_in_words(), "Wrong value in second card");
-  for (uint8_t* c = start_card + 1; c <= end_card; c++ /* yeah! */) {
+  for (Atomic* c = start_card + 1; c <= end_card; c++ /* yeah! */) {
     uint8_t entry = offset_array(c);
     if ((unsigned)(c - start_card) > BOTConstants::power_to_cards_back(1)) {
       guarantee(entry > CardTable::card_size_in_words(),
@@ -157,7 +157,7 @@ void G1BlockOffsetTable::check_all_cards(uint8_t* start_card, uint8_t* end_card)
                 (uint)entry, (uint)offset_array(c), CardTable::card_size_in_words());
     }
     size_t backskip = BOTConstants::entry_to_cards_back(entry);
-    uint8_t* landing_card = c - backskip;
+    Atomic* landing_card = c - backskip;
     guarantee(landing_card >= (start_card - 1), "Inv");
     if (landing_card >= start_card) {
       guarantee(offset_array(landing_card) <= entry,
@@ -188,7 +188,7 @@ void G1BlockOffsetTable::check_all_cards(uint8_t* start_card, uint8_t* end_card)
 //
 void G1BlockOffsetTable::update_for_block_work(HeapWord* blk_start, HeapWord* blk_end) {
   HeapWord* const cur_card_boundary = align_up_by_card_size(blk_start);
-  uint8_t* const offset_card = entry_for_addr(cur_card_boundary);
+  Atomic* const offset_card = entry_for_addr(cur_card_boundary);
 
   assert(blk_start != nullptr && blk_end > blk_start,
          "phantom block");
@@ -209,7 +209,7 @@ void G1BlockOffsetTable::update_for_block_work(HeapWord* blk_start, HeapWord* bl
   // We need to now mark the subsequent cards that this block spans.
 
   // Index of card on which the block ends.
-  uint8_t* end_card = entry_for_addr(blk_end - 1);
+  Atomic* end_card = entry_for_addr(blk_end - 1);
 
   // Are there more cards left to be updated?
   if (offset_card + 1 <= end_card) {
@@ -224,7 +224,7 @@ void G1BlockOffsetTable::update_for_block_work(HeapWord* blk_start, HeapWord* bl
 
   // The offset can be 0 if the block starts on a boundary.  That
   // is checked by an assertion above.
-  uint8_t* previous_card = entry_for_addr(blk_start);
+  Atomic* previous_card = entry_for_addr(blk_start);
   HeapWord* boundary = addr_for_entry(previous_card);
   assert((offset_array(offset_card) == 0 && blk_start == boundary) ||
          (offset_array(offset_card) > 0 && offset_array(offset_card) < CardTable::card_size_in_words()),
@@ -240,7 +240,7 @@ void G1BlockOffsetTable::update_for_block_work(HeapWord* blk_start, HeapWord* bl
 }
 
 #ifdef ASSERT
-void G1BlockOffsetTable::verify_offset(uint8_t* card_index, uint8_t upper_boundary) const {
+void G1BlockOffsetTable::verify_offset(Atomic* card_index, uint8_t upper_boundary) const {
   assert(offset_array(card_index) <= upper_boundary,
          "Offset %u should not be larger than upper boundary %u.",
          (uint) offset_array(card_index),
@@ -250,19 +250,19 @@ void G1BlockOffsetTable::verify_offset(uint8_t* card_index, uint8_t upper_bounda
 void G1BlockOffsetTable::verify_for_block(HeapWord* blk_start, HeapWord* blk_end) const {
   assert(is_crossing_card_boundary(blk_start, blk_end), "precondition");
 
-  uint8_t* start_card = entry_for_addr(align_up_by_card_size(blk_start));
-  uint8_t* end_card = entry_for_addr(blk_end - 1);
+  Atomic* start_card = entry_for_addr(align_up_by_card_size(blk_start));
+  Atomic* end_card = entry_for_addr(blk_end - 1);
   // Check cards in [start_card, end_card]
   verify_offset(start_card, CardTable::card_size_in_words());
 
-  for (uint8_t* current_card = start_card + 1; current_card <= end_card; ++current_card) {
+  for (Atomic* current_card = start_card + 1; current_card <= end_card; ++current_card) {
     assert(offset_array(current_card) > 0,
            "Offset %u is not larger than 0.",
            (uint) offset_array(current_card));
     verify_offset(current_card, (uint8_t) (CardTable::card_size_in_words() + BOTConstants::N_powers - 1));
 
-    uint8_t* prev  = current_card - 1;
-    uint8_t* value = current_card;
+    Atomic* prev  = current_card - 1;
+    Atomic* value = current_card;
     if (offset_array(prev) != offset_array(value)) {
       assert(offset_array(value) >= offset_array(prev), "monotonic");
       size_t n_cards_back = BOTConstants::entry_to_cards_back(offset_array(value));
diff --git a/src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp b/src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp
index 3b97efc4f0f..89c68ce96d2 100644
--- a/src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp
+++ b/src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2026, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +29,7 @@
 #include "gc/shared/blockOffsetTable.hpp"
 #include "gc/shared/cardTable.hpp"
 #include "memory/memRegion.hpp"
+#include "runtime/atomic.hpp"
 #include "utilities/globalDefinitions.hpp"
 
 // This implementation of "G1BlockOffsetTable" divides the covered region
@@ -41,7 +42,7 @@ private:
   MemRegion _reserved;
 
   // Biased array-start of BOT array for fast BOT entry translation
-  volatile uint8_t* _offset_base;
+  Atomic* _offset_base;
 
   void check_offset(size_t offset, const char* msg) const {
     assert(offset < CardTable::card_size_in_words(),
@@ -51,32 +52,32 @@ private:
 
   // Bounds checking accessors:
   // For performance these have to devolve to array accesses in product builds.
-  inline uint8_t offset_array(uint8_t* addr) const;
+  inline uint8_t offset_array(Atomic* addr) const;
 
-  inline void set_offset_array(uint8_t* addr, uint8_t offset);
+  inline void set_offset_array(Atomic* addr, uint8_t offset);
 
-  inline void set_offset_array(uint8_t* addr, HeapWord* high, HeapWord* low);
+  inline void set_offset_array(Atomic* addr, HeapWord* high, HeapWord* low);
 
-  inline void set_offset_array(uint8_t* left, uint8_t* right, uint8_t offset);
+  inline void set_offset_array(Atomic* left, Atomic* right, uint8_t offset);
 
   // Mapping from address to object start array entry
-  inline uint8_t* entry_for_addr(const void* const p) const;
+  inline Atomic* entry_for_addr(const void* const p) const;
 
   // Mapping from object start array entry to address of first word
-  inline HeapWord* addr_for_entry(const uint8_t* const p) const;
+  inline HeapWord* addr_for_entry(const Atomic* const p) const;
 
-  void check_address(uint8_t* addr, const char* msg) const NOT_DEBUG_RETURN;
+  void check_address(Atomic* addr, const char* msg) const NOT_DEBUG_RETURN;
 
   // Sets the entries corresponding to the cards starting at "start" and ending
   // at "end" to point back to the card before "start"; [start, end]
-  void set_remainder_to_point_to_start_incl(uint8_t* start, uint8_t* end);
+  void set_remainder_to_point_to_start_incl(Atomic* start, Atomic* end);
 
   // Update BOT entries corresponding to the mem range [blk_start, blk_end).
   void update_for_block_work(HeapWord* blk_start, HeapWord* blk_end);
 
-  void check_all_cards(uint8_t* left_card, uint8_t* right_card) const NOT_DEBUG_RETURN;
+  void check_all_cards(Atomic* left_card, Atomic* right_card) const NOT_DEBUG_RETURN;
 
-  void verify_offset(uint8_t* card_index, uint8_t upper) const NOT_DEBUG_RETURN;
+  void verify_offset(Atomic* card_index, uint8_t upper) const NOT_DEBUG_RETURN;
   void verify_for_block(HeapWord* blk_start, HeapWord* blk_end) const NOT_DEBUG_RETURN;
 
   static HeapWord* align_up_by_card_size(HeapWord* const addr) {
diff --git a/src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp b/src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp
index 900e9516c1a..0d809b65526 100644
--- a/src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp
+++ b/src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2026, Oracle and/or its affiliates. All rights reserved.
  * 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,12 +31,11 @@
 #include "gc/shared/cardTable.hpp"
 #include "gc/shared/memset_with_concurrent_readers.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/atomicAccess.hpp"
 
 inline HeapWord* G1BlockOffsetTable::block_start_reaching_into_card(const void* addr) const {
   assert(_reserved.contains(addr), "invalid address");
 
-  uint8_t* entry = entry_for_addr(addr);
+  Atomic* entry = entry_for_addr(addr);
   uint8_t offset = offset_array(entry);
   while (offset >= CardTable::card_size_in_words()) {
     // The excess of the offset from N_words indicates a power of Base
@@ -50,19 +49,19 @@ inline HeapWord* G1BlockOffsetTable::block_start_reaching_into_card(const void*
   return q - offset;
 }
 
-uint8_t G1BlockOffsetTable::offset_array(uint8_t* addr) const {
+uint8_t G1BlockOffsetTable::offset_array(Atomic* addr) const {
   check_address(addr, "Block offset table address out of range");
-  return AtomicAccess::load(addr);
+  return addr->load_relaxed();
 }
 
-inline uint8_t* G1BlockOffsetTable::entry_for_addr(const void* const p) const {
+inline Atomic* G1BlockOffsetTable::entry_for_addr(const void* const p) const {
   assert(_reserved.contains(p),
          "out of bounds access to block offset table");
-  uint8_t* result = const_cast(&_offset_base[uintptr_t(p) >> CardTable::card_shift()]);
+  Atomic* result = const_cast*>(&_offset_base[uintptr_t(p) >> CardTable::card_shift()]);
   return result;
 }
 
-inline HeapWord* G1BlockOffsetTable::addr_for_entry(const uint8_t* const p) const {
+inline HeapWord* G1BlockOffsetTable::addr_for_entry(const Atomic* const p) const {
   // _offset_base can be "negative", so can't use pointer_delta().
   size_t delta = p - _offset_base;
   HeapWord* result = (HeapWord*) (delta << CardTable::card_shift());

From fef06c04e74f509905e2229b0e2d1682aa5d3852 Mon Sep 17 00:00:00 2001
From: Thomas Schatzl 
Date: Tue, 10 Feb 2026 08:31:13 +0000
Subject: [PATCH 040/120] 8376328: Convert PLABStats to use Atomic

Reviewed-by: iwalulya, ayang
---
 src/hotspot/share/gc/g1/g1EvacStats.cpp     | 12 ++++-----
 src/hotspot/share/gc/shared/plab.hpp        | 27 +++++++++++----------
 src/hotspot/share/gc/shared/plab.inline.hpp | 11 ++++-----
 3 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/src/hotspot/share/gc/g1/g1EvacStats.cpp b/src/hotspot/share/gc/g1/g1EvacStats.cpp
index 1d54b184e64..d93f63383c4 100644
--- a/src/hotspot/share/gc/g1/g1EvacStats.cpp
+++ b/src/hotspot/share/gc/g1/g1EvacStats.cpp
@@ -48,11 +48,11 @@ void G1EvacStats::log_plab_allocation() {
                       "used: %zuB, "
                       "undo waste: %zuB, ",
                       _description,
-                      _allocated * HeapWordSize,
-                      _wasted * HeapWordSize,
-                      _unused * HeapWordSize,
+                      allocated() * HeapWordSize,
+                      wasted() * HeapWordSize,
+                      unused() * HeapWordSize,
                       used() * HeapWordSize,
-                      _undo_wasted * HeapWordSize);
+                      undo_wasted() * HeapWordSize);
   log_debug(gc, plab)("%s other allocation: "
                       "region end waste: %zuB, "
                       "regions filled: %u, "
@@ -157,13 +157,13 @@ void G1EvacStats::adjust_desired_plab_size() {
     assert(is_object_aligned(max_size()) && min_size() <= max_size(),
            "PLAB clipping computation may be incorrect");
 
-    assert(_allocated != 0 || _unused == 0,
+    assert(allocated() != 0 || unused() == 0,
            "Inconsistency in PLAB stats: "
            "_allocated: %zu, "
            "_wasted: %zu, "
            "_unused: %zu, "
            "_undo_wasted: %zu",
-           _allocated, _wasted, _unused, _undo_wasted);
+           allocated(), wasted(), unused(), undo_wasted());
 
     size_t plab_size = compute_desired_plab_size();
     // Take historical weighted average
diff --git a/src/hotspot/share/gc/shared/plab.hpp b/src/hotspot/share/gc/shared/plab.hpp
index 2eebdeeadb4..5200f022633 100644
--- a/src/hotspot/share/gc/shared/plab.hpp
+++ b/src/hotspot/share/gc/shared/plab.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2026, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
 
 #include "gc/shared/collectedHeap.hpp"
 #include "memory/allocation.hpp"
+#include "runtime/atomic.hpp"
 #include "utilities/globalDefinitions.hpp"
 
 // Forward declarations.
@@ -149,16 +150,16 @@ class PLABStats : public CHeapObj {
 protected:
   const char* _description;   // Identifying string.
 
-  size_t _allocated;          // Total allocated
-  size_t _wasted;             // of which wasted (internal fragmentation)
-  size_t _undo_wasted;        // of which wasted on undo (is not used for calculation of PLAB size)
-  size_t _unused;             // Unused in last buffer
+  Atomic _allocated;          // Total allocated
+  Atomic _wasted;             // of which wasted (internal fragmentation)
+  Atomic _undo_wasted;        // of which wasted on undo (is not used for calculation of PLAB size)
+  Atomic _unused;             // Unused in last buffer
 
   virtual void reset() {
-    _allocated   = 0;
-    _wasted      = 0;
-    _undo_wasted = 0;
-    _unused      = 0;
+    _allocated.store_relaxed(0);
+    _wasted.store_relaxed(0);
+    _undo_wasted.store_relaxed(0);
+    _unused.store_relaxed(0);
   }
 
 public:
@@ -172,11 +173,11 @@ public:
 
   virtual ~PLABStats() { }
 
-  size_t allocated() const { return _allocated; }
-  size_t wasted() const { return _wasted; }
-  size_t unused() const { return _unused; }
+  size_t allocated() const { return _allocated.load_relaxed(); }
+  size_t wasted() const { return _wasted.load_relaxed(); }
+  size_t undo_wasted() const { return _undo_wasted.load_relaxed(); }
+  size_t unused() const { return _unused.load_relaxed(); }
   size_t used() const { return allocated() - (wasted() + unused()); }
-  size_t undo_wasted() const { return _undo_wasted; }
 
   static size_t min_size() {
     return PLAB::min_size();
diff --git a/src/hotspot/share/gc/shared/plab.inline.hpp b/src/hotspot/share/gc/shared/plab.inline.hpp
index 020738352d3..5f3e9c91e26 100644
--- a/src/hotspot/share/gc/shared/plab.inline.hpp
+++ b/src/hotspot/share/gc/shared/plab.inline.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2026, Oracle and/or its affiliates. All rights reserved.
  * 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,22 +29,21 @@
 
 #include "gc/shared/collectedHeap.inline.hpp"
 #include "memory/allocation.inline.hpp"
-#include "runtime/atomicAccess.hpp"
 
 void PLABStats::add_allocated(size_t v) {
-  AtomicAccess::add(&_allocated, v);
+  _allocated.add_then_fetch(v);
 }
 
 void PLABStats::add_unused(size_t v) {
-  AtomicAccess::add(&_unused, v);
+  _unused.add_then_fetch(v);
 }
 
 void PLABStats::add_wasted(size_t v) {
-  AtomicAccess::add(&_wasted, v);
+  _wasted.add_then_fetch(v);
 }
 
 void PLABStats::add_undo_wasted(size_t v) {
-  AtomicAccess::add(&_undo_wasted, v);
+  _undo_wasted.add_then_fetch(v);
 }
 
 #endif // SHARE_GC_SHARED_PLAB_INLINE_HPP

From ea90214ce90c916dd5145c09de6960f038843326 Mon Sep 17 00:00:00 2001
From: Volkan Yazici 
Date: Tue, 10 Feb 2026 09:01:28 +0000
Subject: [PATCH 041/120] 8375352:
 java/net/httpclient/ConnectTimeoutWithProxy*.java tests fail on EC2

Reviewed-by: dfuchs
---
 .../httpclient/AbstractConnectTimeout.java    | 258 ------------
 .../ConnectTimeoutNoProxyAsync.java           |  47 ---
 .../httpclient/ConnectTimeoutNoProxySync.java |  48 ---
 .../net/httpclient/ConnectTimeoutTest.java    | 370 ++++++++++++++++++
 .../ConnectTimeoutWithProxyAsync.java         |  47 ---
 .../ConnectTimeoutWithProxySync.java          |  48 ---
 6 files changed, 370 insertions(+), 448 deletions(-)
 delete mode 100644 test/jdk/java/net/httpclient/AbstractConnectTimeout.java
 delete mode 100644 test/jdk/java/net/httpclient/ConnectTimeoutNoProxyAsync.java
 delete mode 100644 test/jdk/java/net/httpclient/ConnectTimeoutNoProxySync.java
 create mode 100644 test/jdk/java/net/httpclient/ConnectTimeoutTest.java
 delete mode 100644 test/jdk/java/net/httpclient/ConnectTimeoutWithProxyAsync.java
 delete mode 100644 test/jdk/java/net/httpclient/ConnectTimeoutWithProxySync.java

diff --git a/test/jdk/java/net/httpclient/AbstractConnectTimeout.java b/test/jdk/java/net/httpclient/AbstractConnectTimeout.java
deleted file mode 100644
index 2c490919181..00000000000
--- a/test/jdk/java/net/httpclient/AbstractConnectTimeout.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
- * 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.net.ConnectException;
-import java.net.InetSocketAddress;
-import java.net.NoRouteToHostException;
-import java.net.ProxySelector;
-import java.net.URI;
-import java.net.http.HttpClient;
-import java.net.http.HttpClient.Version;
-import java.net.http.HttpConnectTimeoutException;
-import java.net.http.HttpRequest;
-import java.net.http.HttpRequest.BodyPublishers;
-import java.net.http.HttpResponse;
-import java.net.http.HttpResponse.BodyHandlers;
-import java.nio.channels.UnresolvedAddressException;
-import java.time.Duration;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.concurrent.CompletionException;
-import org.testng.annotations.DataProvider;
-import static java.lang.System.out;
-import static java.net.http.HttpClient.Builder.NO_PROXY;
-import static java.net.http.HttpClient.Version.HTTP_1_1;
-import static java.net.http.HttpClient.Version.HTTP_2;
-import static java.time.Duration.*;
-import static java.util.concurrent.TimeUnit.NANOSECONDS;
-import static org.testng.Assert.fail;
-
-public abstract class AbstractConnectTimeout {
-
-    static final Duration NO_DURATION = null;
-
-    static List> TIMEOUTS = List.of(
-                    // connectTimeout   HttpRequest timeout
-            Arrays.asList( NO_DURATION,   ofMillis(100) ),
-            Arrays.asList( NO_DURATION,   ofNanos(1)    ),
-
-            Arrays.asList( ofMillis(100), NO_DURATION   ),
-            Arrays.asList( ofNanos(1),    NO_DURATION   ),
-
-            Arrays.asList( ofMillis(100), ofMinutes(1)  ),
-            Arrays.asList( ofNanos(1),    ofMinutes(1)  )
-    );
-
-    static final List METHODS = List.of("GET", "POST");
-    static final List VERSIONS = List.of(HTTP_2, HTTP_1_1);
-    static final List SCHEMES = List.of("https", "http");
-
-    @DataProvider(name = "variants")
-    public Object[][] variants() {
-        List l = new ArrayList<>();
-        for (List timeouts : TIMEOUTS) {
-           Duration connectTimeout = timeouts.get(0);
-           Duration requestTimeout = timeouts.get(1);
-           for (String method: METHODS) {
-            for (String scheme : SCHEMES) {
-             for (Version requestVersion : VERSIONS) {
-              l.add(new Object[] {requestVersion, scheme, method, connectTimeout, requestTimeout});
-        }}}}
-        return l.stream().toArray(Object[][]::new);
-    }
-
-    static final ProxySelector EXAMPLE_DOT_COM_PROXY = ProxySelector.of(
-            InetSocketAddress.createUnresolved("example.com", 8080));
-
-    //@Test(dataProvider = "variants")
-    protected void timeoutNoProxySync(Version requestVersion,
-                                      String scheme,
-                                      String method,
-                                      Duration connectTimeout,
-                                      Duration requestTimeout)
-        throws Exception
-    {
-        timeoutSync(requestVersion, scheme, method, connectTimeout, requestTimeout, NO_PROXY);
-    }
-
-    //@Test(dataProvider = "variants")
-    protected void timeoutWithProxySync(Version requestVersion,
-                                        String scheme,
-                                        String method,
-                                        Duration connectTimeout,
-                                        Duration requestTimeout)
-        throws Exception
-    {
-        timeoutSync(requestVersion, scheme, method, connectTimeout, requestTimeout, EXAMPLE_DOT_COM_PROXY);
-    }
-
-    private void timeoutSync(Version requestVersion,
-                             String scheme,
-                             String method,
-                             Duration connectTimeout,
-                             Duration requestTimeout,
-                             ProxySelector proxy)
-        throws Exception
-    {
-        out.printf("%ntimeoutSync(requestVersion=%s, scheme=%s, method=%s,"
-                   + " connectTimeout=%s, requestTimeout=%s, proxy=%s)%n",
-                   requestVersion, scheme, method, connectTimeout, requestTimeout, proxy);
-
-        HttpClient client = newClient(connectTimeout, proxy);
-        HttpRequest request = newRequest(scheme, requestVersion, method, requestTimeout);
-
-        for (int i = 0; i < 2; i++) {
-            out.printf("iteration %d%n", i);
-            long startTime = System.nanoTime();
-            try {
-                HttpResponse resp = client.send(request, BodyHandlers.ofString());
-                printResponse(resp);
-                fail("Unexpected response: " + resp);
-            } catch (HttpConnectTimeoutException expected) { // blocking thread-specific exception
-                long elapsedTime = NANOSECONDS.toMillis(System.nanoTime() - startTime);
-                out.printf("Client: received in %d millis%n", elapsedTime);
-                assertExceptionTypeAndCause(expected.getCause());
-            } catch (ConnectException e) {
-                long elapsedTime = NANOSECONDS.toMillis(System.nanoTime() - startTime);
-                out.printf("Client: received in %d millis%n", elapsedTime);
-                Throwable t = e.getCause().getCause();  // blocking thread-specific exception
-                if (!isAcceptableCause(t)) { // tolerate only NRTHE or UAE
-                    e.printStackTrace(out);
-                    fail("Unexpected exception:" + e);
-                } else {
-                    out.printf("Caught ConnectException with "
-                            + " cause: %s - skipping%n", t.getCause());
-                }
-            }
-        }
-    }
-
-    //@Test(dataProvider = "variants")
-    protected void timeoutNoProxyAsync(Version requestVersion,
-                                       String scheme,
-                                       String method,
-                                       Duration connectTimeout,
-                                       Duration requestTimeout) {
-        timeoutAsync(requestVersion, scheme, method, connectTimeout, requestTimeout, NO_PROXY);
-    }
-
-    //@Test(dataProvider = "variants")
-    protected void timeoutWithProxyAsync(Version requestVersion,
-                                         String scheme,
-                                         String method,
-                                         Duration connectTimeout,
-                                         Duration requestTimeout) {
-        timeoutAsync(requestVersion, scheme, method, connectTimeout, requestTimeout, EXAMPLE_DOT_COM_PROXY);
-    }
-
-    private void timeoutAsync(Version requestVersion,
-                              String scheme,
-                              String method,
-                              Duration connectTimeout,
-                              Duration requestTimeout,
-                              ProxySelector proxy) {
-        out.printf("%ntimeoutAsync(requestVersion=%s, scheme=%s, method=%s, "
-                   + "connectTimeout=%s, requestTimeout=%s, proxy=%s)%n",
-                   requestVersion, scheme, method, connectTimeout, requestTimeout, proxy);
-
-        HttpClient client = newClient(connectTimeout, proxy);
-        HttpRequest request = newRequest(scheme, requestVersion, method, requestTimeout);
-        for (int i = 0; i < 2; i++) {
-            out.printf("iteration %d%n", i);
-            long startTime = System.nanoTime();
-            try {
-                HttpResponse resp = client.sendAsync(request, BodyHandlers.ofString()).join();
-                printResponse(resp);
-                fail("Unexpected response: " + resp);
-            } catch (CompletionException e) {
-                long elapsedTime = NANOSECONDS.toMillis(System.nanoTime() - startTime);
-                out.printf("Client: received in %d millis%n", elapsedTime);
-                Throwable t = e.getCause();
-                if (t instanceof ConnectException && isAcceptableCause(t.getCause())) {
-                    // tolerate only NRTHE and UAE
-                    out.printf("Caught ConnectException with "
-                            + "cause: %s - skipping%n", t.getCause());
-                } else {
-                    assertExceptionTypeAndCause(t);
-                }
-            }
-        }
-    }
-
-    static boolean isAcceptableCause(Throwable cause) {
-        if (cause instanceof NoRouteToHostException) return true;
-        if (cause instanceof UnresolvedAddressException) return true;
-        return false;
-    }
-
-    static HttpClient newClient(Duration connectTimeout, ProxySelector proxy) {
-        HttpClient.Builder builder = HttpClient.newBuilder().proxy(proxy);
-        if (connectTimeout != NO_DURATION)
-            builder.connectTimeout(connectTimeout);
-        return builder.build();
-    }
-
-    static HttpRequest newRequest(String scheme,
-                                  Version reqVersion,
-                                  String method,
-                                  Duration requestTimeout) {
-        // Resolvable address. Most tested environments just ignore the TCP SYN,
-        // or occasionally return ICMP no route to host
-        URI uri = URI.create(scheme +"://example.com:81/");
-        HttpRequest.Builder reqBuilder = HttpRequest.newBuilder(uri);
-        reqBuilder = reqBuilder.version(reqVersion);
-        switch (method) {
-            case "GET"   : reqBuilder.GET();                         break;
-            case "POST"  : reqBuilder.POST(BodyPublishers.noBody()); break;
-            default: throw new AssertionError("Unknown method:" + method);
-        }
-        if (requestTimeout != NO_DURATION)
-            reqBuilder.timeout(requestTimeout);
-        return reqBuilder.build();
-    }
-
-    static void assertExceptionTypeAndCause(Throwable t) {
-        if (!(t instanceof HttpConnectTimeoutException)) {
-            t.printStackTrace(out);
-            fail("Expected HttpConnectTimeoutException, got:" + t);
-        }
-        Throwable connEx = t.getCause();
-        if (!(connEx instanceof ConnectException)) {
-            t.printStackTrace(out);
-            fail("Expected ConnectException cause in:" + connEx);
-        }
-        out.printf("Caught expected HttpConnectTimeoutException with ConnectException"
-                + " cause: %n%s%n%s%n", t, connEx);
-        final String EXPECTED_MESSAGE = "HTTP connect timed out"; // impl dependent
-        if (!connEx.getMessage().equals(EXPECTED_MESSAGE))
-            fail("Expected: \"" + EXPECTED_MESSAGE + "\", got: \"" + connEx.getMessage() + "\"");
-
-    }
-
-    static void printResponse(HttpResponse response) {
-        out.println("Unexpected response: " + response);
-        out.println("Headers: " + response.headers());
-        out.println("Body: " + response.body());
-    }
-}
diff --git a/test/jdk/java/net/httpclient/ConnectTimeoutNoProxyAsync.java b/test/jdk/java/net/httpclient/ConnectTimeoutNoProxyAsync.java
deleted file mode 100644
index ace12cd0295..00000000000
--- a/test/jdk/java/net/httpclient/ConnectTimeoutNoProxyAsync.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.net.http.HttpClient.Version;
-import java.time.Duration;
-import org.testng.annotations.Test;
-
-/*
- * @test
- * @summary Tests for connection related timeouts
- * @bug 8208391
- * @run testng/othervm ConnectTimeoutNoProxyAsync
- */
-
-public class ConnectTimeoutNoProxyAsync extends AbstractConnectTimeout {
-
-    @Test(dataProvider = "variants")
-    @Override
-    public void timeoutNoProxyAsync(Version requestVersion,
-                                    String scheme,
-                                    String method,
-                                    Duration connectTimeout,
-                                    Duration requestduration)
-    {
-        super.timeoutNoProxyAsync(requestVersion, scheme, method, connectTimeout, requestduration);
-    }
-}
diff --git a/test/jdk/java/net/httpclient/ConnectTimeoutNoProxySync.java b/test/jdk/java/net/httpclient/ConnectTimeoutNoProxySync.java
deleted file mode 100644
index f30dea6deea..00000000000
--- a/test/jdk/java/net/httpclient/ConnectTimeoutNoProxySync.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.net.http.HttpClient.Version;
-import java.time.Duration;
-import org.testng.annotations.Test;
-
-/*
- * @test
- * @summary Tests for connection related timeouts
- * @bug 8208391
- * @run testng/othervm ConnectTimeoutNoProxySync
- */
-
-public class ConnectTimeoutNoProxySync extends AbstractConnectTimeout {
-
-    @Test(dataProvider = "variants")
-    @Override
-    public void timeoutNoProxySync(Version requestVersion,
-                                   String scheme,
-                                   String method,
-                                   Duration connectTimeout,
-                                   Duration requestTimeout)
-        throws Exception
-    {
-        super.timeoutNoProxySync(requestVersion, scheme, method, connectTimeout, requestTimeout);
-    }
-}
diff --git a/test/jdk/java/net/httpclient/ConnectTimeoutTest.java b/test/jdk/java/net/httpclient/ConnectTimeoutTest.java
new file mode 100644
index 00000000000..c837071ae7c
--- /dev/null
+++ b/test/jdk/java/net/httpclient/ConnectTimeoutTest.java
@@ -0,0 +1,370 @@
+/*
+ * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import jdk.test.lib.Utils;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import java.io.IOException;
+import java.io.PrintStream;
+import java.net.ConnectException;
+import java.net.InetAddress;
+import java.net.Proxy;
+import java.net.ProxySelector;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.SocketAddress;
+import java.net.SocketTimeoutException;
+import java.net.URI;
+import java.net.http.HttpClient;
+import java.net.http.HttpClient.Version;
+import java.net.http.HttpConnectTimeoutException;
+import java.net.http.HttpRequest;
+import java.net.http.HttpRequest.BodyPublishers;
+import java.net.http.HttpResponse;
+import java.net.http.HttpResponse.BodyHandlers;
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.CompletionException;
+import java.util.stream.Stream;
+
+import static java.lang.Boolean.parseBoolean;
+import static java.net.http.HttpClient.Builder.NO_PROXY;
+import static java.net.http.HttpClient.Version.HTTP_1_1;
+import static java.net.http.HttpClient.Version.HTTP_2;
+import static java.time.Duration.*;
+import static java.util.concurrent.TimeUnit.NANOSECONDS;
+import static org.junit.jupiter.api.Assertions.fail;
+
+/*
+ * @test id=sync
+ * @bug 8208391 8375352
+ * @summary Verifies behavior on `connect()` timeouts
+ * @requires os.family != "windows"
+ * @library /test/lib
+ * @run junit/othervm ${test.main.class}
+ */
+
+/*
+ * @test id=sync-proxy
+ * @bug 8208391 8375352
+ * @summary Verifies behavior on `connect()` timeouts
+ * @requires os.family != "windows"
+ * @library /test/lib
+ * @run junit/othervm -Dtest.proxy=true ${test.main.class}
+ */
+
+/*
+ * @test id=async
+ * @bug 8208391 8375352
+ * @summary Verifies behavior on `connect()` timeouts
+ * @requires os.family != "windows"
+ * @library /test/lib
+ * @run junit/othervm -Dtest.async=true ${test.main.class}
+ */
+
+/*
+ * @test id=async-proxy
+ * @bug 8208391 8375352
+ * @summary Verifies behavior on `connect()` timeouts
+ * @requires os.family != "windows"
+ * @library /test/lib
+ * @run junit/othervm -Dtest.async=true -Dtest.proxy=true ${test.main.class}
+ */
+
+class ConnectTimeoutTest {
+
+    // This test verifies the `HttpClient` behavior on `connect()` failures.
+    //
+    // Earlier, the test was trying to connect `example.com:8080` to trigger a `connect()` failure.
+    // This worked, until it doesn't — `example.com:8080` started responding in certain test environments.
+    //
+    // Now we create a `ServerSocket` and exhaust all its "SYN backlog" and "Accept queue".
+    // The expectation is that the platform socket in this state will block on `connect()`.
+    // Well... It doesn't on Windows, whereas it does on Linux and macOS.
+    // Windows doesn't block and immediately responds with `java.net.ConnectException: Connection refused: connect`.
+    // Neither it is deterministic how many connections are needed to exhaust a socket admission queue.
+    // Hence, we took the following decisions:
+    //
+    // 1. Skip this test on Windows
+    // 2. Exhaust server socket admission queue by going into a loop
+
+    private static final PrintStream LOGGER = System.out;
+
+    private static final int BACKLOG = 1;
+
+    /**
+     * A {@link ServerSocket} whose admission will be blocked by exhausting all its "SYN backlog" and "Accept queue".
+     */
+    private static final ServerSocket SERVER_SOCKET = createServerSocket();
+
+    /**
+     * Client sockets exhausting the admission to {@link #SERVER_SOCKET}.
+     */
+    private static final List CLIENT_SOCKETS = createClientSocketsExhaustingServerSocketAdmission();
+
+    private static ServerSocket createServerSocket() {
+        try {
+            LOGGER.println("Creating server socket");
+            return new ServerSocket(0, BACKLOG, InetAddress.getLoopbackAddress());
+        } catch (Exception exception) {
+            throw new RuntimeException(exception);
+        }
+    }
+
+    private static List createClientSocketsExhaustingServerSocketAdmission() {
+        List sockets = new ArrayList<>();
+        int maxSocketCount = BACKLOG   // To fill up the backlog
+                + 512;                 // Giving some slack, should be enough to exhaust the admission queue.
+        int connectTimeout = Math.toIntExact(Math.addExact(500, Utils.adjustTimeout(500)));
+        int socketIndex = 0;
+        for (; socketIndex < maxSocketCount; socketIndex++) {
+            try {
+                LOGGER.printf(
+                        "Creating client socket %s/%s to exhaust the server socket admission%n",
+                        (socketIndex + 1), maxSocketCount);
+                Socket socket = new Socket();
+                socket.connect(SERVER_SOCKET.getLocalSocketAddress(), connectTimeout);
+                sockets.add(socket);
+            } catch (ConnectException | SocketTimeoutException exception) {
+                LOGGER.printf(
+                        "Received expected `%s` while creating client socket %s/%s%n",
+                        exception.getClass().getName(), (socketIndex + 1), maxSocketCount);
+                return sockets;
+            } catch (IOException ioe) {
+                String message = String.format(
+                        "Received unexpected exception while creating client socket %s/%s",
+                        (socketIndex + 1), maxSocketCount);
+                closeSockets(SERVER_SOCKET, sockets);
+                throw new RuntimeException(message, ioe);
+            }
+        }
+        String message = String.format(
+                "Connected %s sockets, but still could not exhaust the socket admission",
+                maxSocketCount);
+        closeSockets(SERVER_SOCKET, sockets);
+        throw new RuntimeException(message);
+    }
+
+    @AfterAll
+    public static void closeSockets() {
+        closeSockets(SERVER_SOCKET, CLIENT_SOCKETS);
+    }
+
+    private static void closeSockets(ServerSocket serverSocket, List clientSockets) {
+        Throwable[] throwable = {null};
+        Stream.concat(clientSockets.stream(), Stream.of(serverSocket)).forEach(closeable -> {
+            try {
+                closeable.close();
+            } catch (Exception exception) {
+                if (throwable[0] == null) {
+                    throwable[0] = exception;
+                } else {
+                    throwable[0].addSuppressed(exception);
+                }
+            }
+        });
+        if (throwable[0] != null) {
+            throwable[0].printStackTrace(System.out);
+        }
+    }
+
+    /**
+     * {@link ProxySelector} always pointing to {@link #SERVER_SOCKET}.
+     */
+    private static final ProxySelector PROXY_SELECTOR = new ProxySelector() {
+
+        private static final List PROXIES =
+                List.of(new Proxy(Proxy.Type.HTTP, SERVER_SOCKET.getLocalSocketAddress()));
+
+        @Override
+        public List select(URI uri) {
+            return PROXIES;
+        }
+
+        @Override
+        public void connectFailed(URI uri, SocketAddress sa, IOException ioe) {
+            // Do nothing
+        }
+
+    };
+
+    private static final Duration NO_DURATION = null;
+
+    private static List> TIMEOUTS = List.of(
+                    // connectTimeout   HttpRequest timeout
+            Arrays.asList( NO_DURATION,   ofMillis(100) ),
+            Arrays.asList( NO_DURATION,   ofNanos(1)    ),
+
+            Arrays.asList( ofMillis(100), NO_DURATION   ),
+            Arrays.asList( ofNanos(1),    NO_DURATION   ),
+
+            Arrays.asList( ofMillis(100), ofMinutes(1)  ),
+            Arrays.asList( ofNanos(1),    ofMinutes(1)  )
+    );
+
+    private static final List METHODS = List.of("GET", "POST");
+    private static final List VERSIONS = List.of(HTTP_2, HTTP_1_1);
+    private static final List SCHEMES = List.of("https", "http");
+
+    static Object[][] variants() {
+        List l = new ArrayList<>();
+        for (List timeouts : TIMEOUTS) {
+           Duration connectTimeout = timeouts.get(0);
+           Duration requestTimeout = timeouts.get(1);
+           for (String method: METHODS) {
+            for (String scheme : SCHEMES) {
+             for (Version requestVersion : VERSIONS) {
+              l.add(new Object[] {requestVersion, scheme, method, connectTimeout, requestTimeout});
+        }}}}
+        return l.stream().toArray(Object[][]::new);
+    }
+
+    @ParameterizedTest
+    @MethodSource("variants")
+    void test(
+            Version requestVersion,
+            String scheme,
+            String method,
+            Duration connectTimeout,
+            Duration requestTimeout)
+            throws Exception {
+        ProxySelector proxySelector = parseBoolean(System.getProperty("test.proxy")) ? PROXY_SELECTOR : NO_PROXY;
+        boolean async = parseBoolean(System.getProperty("test.async"));
+        if (async) {
+            timeoutAsync(requestVersion, scheme, method, connectTimeout, requestTimeout, proxySelector);
+        } else {
+            timeoutSync(requestVersion, scheme, method, connectTimeout, requestTimeout, proxySelector);
+        }
+    }
+
+    private void timeoutSync(Version requestVersion,
+                             String scheme,
+                             String method,
+                             Duration connectTimeout,
+                             Duration requestTimeout,
+                             ProxySelector proxy)
+        throws Exception
+    {
+        HttpClient client = newClient(connectTimeout, proxy);
+        HttpRequest request = newRequest(scheme, requestVersion, method, requestTimeout);
+
+        for (int i = 0; i < 2; i++) {
+            LOGGER.printf("iteration %d%n", i);
+            long startTime = System.nanoTime();
+            try {
+                HttpResponse resp = client.send(request, BodyHandlers.ofString());
+                printResponse(resp);
+                fail("Unexpected response: " + resp);
+            } catch (HttpConnectTimeoutException expected) { // blocking thread-specific exception
+                long elapsedTime = NANOSECONDS.toMillis(System.nanoTime() - startTime);
+                LOGGER.printf("Client: received in %d millis%n", elapsedTime);
+                assertExceptionTypeAndCause(expected.getCause());
+            } catch (ConnectException e) {
+                long elapsedTime = NANOSECONDS.toMillis(System.nanoTime() - startTime);
+                LOGGER.printf("Client: received in %d millis%n", elapsedTime);
+                Throwable t = e.getCause().getCause();  // blocking thread-specific exception
+                e.printStackTrace(LOGGER);
+                fail("Unexpected exception:" + e);
+            }
+        }
+    }
+
+    private void timeoutAsync(Version requestVersion,
+                              String scheme,
+                              String method,
+                              Duration connectTimeout,
+                              Duration requestTimeout,
+                              ProxySelector proxy) {
+        HttpClient client = newClient(connectTimeout, proxy);
+        HttpRequest request = newRequest(scheme, requestVersion, method, requestTimeout);
+        for (int i = 0; i < 2; i++) {
+            LOGGER.printf("iteration %d%n", i);
+            long startTime = System.nanoTime();
+            try {
+                HttpResponse resp = client.sendAsync(request, BodyHandlers.ofString()).join();
+                printResponse(resp);
+                fail("Unexpected response: " + resp);
+            } catch (CompletionException e) {
+                long elapsedTime = NANOSECONDS.toMillis(System.nanoTime() - startTime);
+                LOGGER.printf("Client: received in %d millis%n", elapsedTime);
+                Throwable t = e.getCause();
+                assertExceptionTypeAndCause(t);
+            }
+        }
+    }
+
+    private static HttpClient newClient(Duration connectTimeout, ProxySelector proxy) {
+        HttpClient.Builder builder = HttpClient.newBuilder().proxy(proxy);
+        if (connectTimeout != NO_DURATION)
+            builder.connectTimeout(connectTimeout);
+        return builder.build();
+    }
+
+    private static HttpRequest newRequest(String scheme,
+                                  Version reqVersion,
+                                  String method,
+                                  Duration requestTimeout) {
+        String hostAddress = SERVER_SOCKET.getInetAddress().getHostAddress();
+        int hostPort = SERVER_SOCKET.getLocalPort();
+        URI uri = URI.create(scheme + "://" + hostAddress + ':' + hostPort);
+        HttpRequest.Builder reqBuilder = HttpRequest.newBuilder(uri);
+        reqBuilder = reqBuilder.version(reqVersion);
+        switch (method) {
+            case "GET"   : reqBuilder.GET();                         break;
+            case "POST"  : reqBuilder.POST(BodyPublishers.noBody()); break;
+            default: throw new AssertionError("Unknown method:" + method);
+        }
+        if (requestTimeout != NO_DURATION)
+            reqBuilder.timeout(requestTimeout);
+        return reqBuilder.build();
+    }
+
+    private static void assertExceptionTypeAndCause(Throwable t) {
+        if (!(t instanceof HttpConnectTimeoutException)) {
+            t.printStackTrace(LOGGER);
+            fail("Expected HttpConnectTimeoutException, got:" + t);
+        }
+        Throwable connEx = t.getCause();
+        if (!(connEx instanceof ConnectException)) {
+            t.printStackTrace(LOGGER);
+            fail("Expected ConnectException cause in:" + connEx);
+        }
+        LOGGER.printf("Caught expected HttpConnectTimeoutException with ConnectException"
+                + " cause: %n%s%n%s%n", t, connEx);
+        final String EXPECTED_MESSAGE = "HTTP connect timed out"; // impl dependent
+        if (!connEx.getMessage().equals(EXPECTED_MESSAGE))
+            fail("Expected: \"" + EXPECTED_MESSAGE + "\", got: \"" + connEx.getMessage() + "\"");
+
+    }
+
+    private static void printResponse(HttpResponse response) {
+        LOGGER.println("Unexpected response: " + response);
+        LOGGER.println("Headers: " + response.headers());
+        LOGGER.println("Body: " + response.body());
+    }
+
+}
diff --git a/test/jdk/java/net/httpclient/ConnectTimeoutWithProxyAsync.java b/test/jdk/java/net/httpclient/ConnectTimeoutWithProxyAsync.java
deleted file mode 100644
index a6e0c22c15a..00000000000
--- a/test/jdk/java/net/httpclient/ConnectTimeoutWithProxyAsync.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.net.http.HttpClient.Version;
-import java.time.Duration;
-import org.testng.annotations.Test;
-
-/*
- * @test
- * @summary Tests for connection related timeouts
- * @bug 8208391
- * @run testng/othervm ConnectTimeoutWithProxyAsync
- */
-
-public class ConnectTimeoutWithProxyAsync extends AbstractConnectTimeout {
-
-    @Test(dataProvider = "variants")
-    @Override
-    public void timeoutWithProxyAsync(Version requestVersion,
-                                      String scheme,
-                                      String method,
-                                      Duration connectTimeout,
-                                      Duration requestTimeout)
-    {
-        super.timeoutWithProxyAsync(requestVersion, scheme, method, connectTimeout, requestTimeout);
-    }
-}
diff --git a/test/jdk/java/net/httpclient/ConnectTimeoutWithProxySync.java b/test/jdk/java/net/httpclient/ConnectTimeoutWithProxySync.java
deleted file mode 100644
index a61fdc48bcf..00000000000
--- a/test/jdk/java/net/httpclient/ConnectTimeoutWithProxySync.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.net.http.HttpClient.Version;
-import java.time.Duration;
-import org.testng.annotations.Test;
-
-/*
- * @test
- * @summary Tests for connection related timeouts
- * @bug 8208391
- * @run testng/othervm ConnectTimeoutWithProxySync
- */
-
-public class ConnectTimeoutWithProxySync extends AbstractConnectTimeout {
-
-    @Test(dataProvider = "variants")
-    @Override
-    public void timeoutWithProxySync(Version requestVersion,
-                                     String scheme,
-                                     String method,
-                                     Duration connectTimeout,
-                                     Duration requestTimeout)
-        throws Exception
-    {
-        super.timeoutWithProxySync(requestVersion, scheme, method, connectTimeout, requestTimeout);
-    }
-}

From 665dc490c2a1bcaa1fa1cf6f0ea2396ce4b31863 Mon Sep 17 00:00:00 2001
From: Liam Miller-Cushon 
Date: Tue, 10 Feb 2026 09:08:54 +0000
Subject: [PATCH 042/120] 8208752: Calling a deserialized Lambda might fail
 with ClassCastException 8374654: Inconsistent handling of lambda
 deserialization for Object method references on interfaces

Reviewed-by: vromero, jlahoda
---
 .../com/sun/tools/javac/code/Types.java       | 10 ++-
 .../sun/tools/javac/comp/LambdaToMethod.java  | 41 +++++----
 .../tools/javac/resources/compiler.properties |  5 +-
 .../LambdaSerializedClassCastException.java   | 63 ++++++++++++++
 .../LambdaSerializedClassCastException.out    |  2 +
 ...bleObjectMethodReferencesOnInterfaces.java | 84 +++++++++++++++++++
 ...ableObjectMethodReferencesOnInterfaces.out |  4 +
 .../lambda/SerializableObjectMethods.out      |  4 +-
 8 files changed, 188 insertions(+), 25 deletions(-)
 create mode 100644 test/langtools/tools/javac/lambda/LambdaSerializedClassCastException.java
 create mode 100644 test/langtools/tools/javac/lambda/LambdaSerializedClassCastException.out
 create mode 100644 test/langtools/tools/javac/lambda/SerializableObjectMethodReferencesOnInterfaces.java
 create mode 100644 test/langtools/tools/javac/lambda/SerializableObjectMethodReferencesOnInterfaces.out

diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
index 3f3eb1f9623..539b1470a75 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
@@ -2858,13 +2858,17 @@ public class Types {
             hasSameArgs(t, erasure(s)) || hasSameArgs(erasure(t), s);
     }
 
-    public boolean overridesObjectMethod(TypeSymbol origin, Symbol msym) {
+    public Symbol overriddenObjectMethod(TypeSymbol origin, Symbol msym) {
         for (Symbol sym : syms.objectType.tsym.members().getSymbolsByName(msym.name)) {
             if (msym.overrides(sym, origin, Types.this, true)) {
-                return true;
+                return sym;
             }
         }
-        return false;
+        return null;
+    }
+
+    public boolean overridesObjectMethod(TypeSymbol origin, Symbol msym) {
+        return overriddenObjectMethod(origin, msym) != null;
     }
 
     /**
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
index 7d0c5192039..40628709dfe 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
@@ -701,22 +701,24 @@ public class LambdaToMethod extends TreeTranslator {
                 rs.resolveConstructor(null, attrEnv, ctype, TreeInfo.types(args), List.nil()));
     }
 
-    private void addDeserializationCase(MethodHandleSymbol refSym, Type targetType, MethodSymbol samSym,
+    private void addDeserializationCase(MethodHandleSymbol refSym, Type targetType, MethodSymbol samSym, Type samType,
                                         DiagnosticPosition pos, List staticArgs, MethodType indyType) {
         String functionalInterfaceClass = classSig(targetType);
         String functionalInterfaceMethodName = samSym.getSimpleName().toString();
         String functionalInterfaceMethodSignature = typeSig(types.erasure(samSym.type));
-        Symbol baseMethod = refSym.baseSymbol();
-        Symbol origMethod = baseMethod.baseSymbol();
-        if (baseMethod != origMethod && origMethod.owner == syms.objectType.tsym) {
-            //the implementation method is a java.lang.Object method transferred to an
-            //interface that does not declare it. Runtime will refer to this method as to
-            //a java.lang.Object method, so do the same:
-            refSym = ((MethodSymbol) origMethod).asHandle();
+        if (refSym.enclClass().isInterface()) {
+            Symbol baseMethod = types.overriddenObjectMethod(refSym.enclClass(), refSym);
+            if (baseMethod != null) {
+                // The implementation method is a java.lang.Object method, runtime will resolve this method to
+                // a java.lang.Object method, so do the same.
+                // This case can be removed if JDK-8172817 is fixed.
+                refSym = ((MethodSymbol) baseMethod).asHandle();
+            }
         }
         String implClass = classSig(types.erasure(refSym.owner.type));
         String implMethodName = refSym.getQualifiedName().toString();
         String implMethodSignature = typeSig(types.erasure(refSym.type));
+        String instantiatedMethodType = typeSig(types.erasure(samType));
 
         int implMethodKind = refSym.referenceKind();
         JCExpression kindTest = eqTest(syms.intType, deserGetter("getImplMethodKind", syms.intType),
@@ -730,13 +732,14 @@ public class LambdaToMethod extends TreeTranslator {
             ++i;
         }
         JCStatement stmt = make.If(
-                deserTest(deserTest(deserTest(deserTest(deserTest(
-                                                        kindTest,
-                                                        "getFunctionalInterfaceClass", functionalInterfaceClass),
-                                                "getFunctionalInterfaceMethodName", functionalInterfaceMethodName),
-                                        "getFunctionalInterfaceMethodSignature", functionalInterfaceMethodSignature),
-                                "getImplClass", implClass),
-                        "getImplMethodSignature", implMethodSignature),
+                deserTest(deserTest(deserTest(deserTest(deserTest(deserTest(
+                                                                kindTest,
+                                                                "getFunctionalInterfaceClass", functionalInterfaceClass),
+                                                        "getFunctionalInterfaceMethodName", functionalInterfaceMethodName),
+                                                "getFunctionalInterfaceMethodSignature", functionalInterfaceMethodSignature),
+                                        "getImplClass", implClass),
+                                "getImplMethodSignature", implMethodSignature),
+                        "getInstantiatedMethodType", instantiatedMethodType),
                 make.Return(makeIndyCall(
                         pos,
                         syms.lambdaMetafactory,
@@ -756,7 +759,8 @@ public class LambdaToMethod extends TreeTranslator {
                     implMethodKind,
                     implClass,
                     implMethodName,
-                    implMethodSignature));
+                    implMethodSignature,
+                    instantiatedMethodType));
         }
         stmts.append(stmt);
     }
@@ -818,10 +822,11 @@ public class LambdaToMethod extends TreeTranslator {
                                                  List indy_args) {
         //determine the static bsm args
         MethodSymbol samSym = (MethodSymbol) types.findDescriptorSymbol(tree.target.tsym);
+        MethodType samType = typeToMethodType(tree.getDescriptorType(types));
         List staticArgs = List.of(
                 typeToMethodType(samSym.type),
                 refSym.asHandle(),
-                typeToMethodType(tree.getDescriptorType(types)));
+                samType);
 
         //computed indy arg types
         ListBuffer indy_args_types = new ListBuffer<>();
@@ -885,7 +890,7 @@ public class LambdaToMethod extends TreeTranslator {
                 int prevPos = make.pos;
                 try {
                     make.at(kInfo.clazz);
-                    addDeserializationCase(refSym, tree.type, samSym,
+                    addDeserializationCase(refSym, tree.type, samSym, samType,
                             tree, staticArgs, indyType);
                 } finally {
                     make.at(prevPos);
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties
index bb81916becb..915d7f8a8d8 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties
@@ -1721,7 +1721,7 @@ compiler.note.mref.stat.1=\
     alternate metafactory = {0}\n\
     bridge method = {1}
 
-# 0: string, 1: string, 2: string, 3: number, 4: string, 5: string, 6: string
+# 0: string, 1: string, 2: string, 3: number, 4: string, 5: string, 6: string, 7: string
 compiler.note.lambda.deserialization.stat=\
     Generating lambda deserialization\n\
     functionalInterfaceClass: {0}\n\
@@ -1730,7 +1730,8 @@ compiler.note.lambda.deserialization.stat=\
     implMethodKind: {3}\n\
     implClass: {4}\n\
     implMethodName: {5}\n\
-    implMethodSignature: {6}
+    implMethodSignature: {6}\n\
+    instantiatedMethodType: {7}
 
 compiler.note.note=\
     Note:\u0020
diff --git a/test/langtools/tools/javac/lambda/LambdaSerializedClassCastException.java b/test/langtools/tools/javac/lambda/LambdaSerializedClassCastException.java
new file mode 100644
index 00000000000..f63f4b64e79
--- /dev/null
+++ b/test/langtools/tools/javac/lambda/LambdaSerializedClassCastException.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2024, Alphabet LLC. All rights reserved.
+ * 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 8208752
+ * @summary NPE generating serializedLambdaName for nested lambda
+ * @compile/ref=LambdaSerializedClassCastException.out -XDrawDiagnostics --debug=dumpLambdaDeserializationStats LambdaSerializedClassCastException.java
+ * @run main LambdaSerializedClassCastException
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.function.Function;
+
+public class LambdaSerializedClassCastException {
+
+    public static void main(String[] args) throws Exception {
+
+        Function lambda1 =
+                (Function & Serializable) Object::toString;
+        Function lambda2 =
+                (Function & Serializable) Object::toString;
+
+        Function deserial = serialDeserial(lambda2);
+        deserial.apply(new Object());
+    }
+
+    @SuppressWarnings("unchecked")
+    static  T serialDeserial(T object) throws Exception {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (ObjectOutputStream oos = new ObjectOutputStream(baos)) {
+            oos.writeObject(object);
+        }
+        try (ObjectInputStream ois =
+                new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()))) {
+            return (T) ois.readObject();
+        }
+    }
+}
diff --git a/test/langtools/tools/javac/lambda/LambdaSerializedClassCastException.out b/test/langtools/tools/javac/lambda/LambdaSerializedClassCastException.out
new file mode 100644
index 00000000000..4ad61e5e00e
--- /dev/null
+++ b/test/langtools/tools/javac/lambda/LambdaSerializedClassCastException.out
@@ -0,0 +1,2 @@
+LambdaSerializedClassCastException.java:44:59: compiler.note.lambda.deserialization.stat: java/util/function/Function, apply, (Ljava/lang/Object;)Ljava/lang/Object;, 5, java/lang/Object, toString, ()Ljava/lang/String;, (Ljava/lang/String;)Ljava/lang/String;
+LambdaSerializedClassCastException.java:46:59: compiler.note.lambda.deserialization.stat: java/util/function/Function, apply, (Ljava/lang/Object;)Ljava/lang/Object;, 5, java/lang/Object, toString, ()Ljava/lang/String;, (Ljava/lang/Object;)Ljava/lang/String;
diff --git a/test/langtools/tools/javac/lambda/SerializableObjectMethodReferencesOnInterfaces.java b/test/langtools/tools/javac/lambda/SerializableObjectMethodReferencesOnInterfaces.java
new file mode 100644
index 00000000000..18d732fb0dd
--- /dev/null
+++ b/test/langtools/tools/javac/lambda/SerializableObjectMethodReferencesOnInterfaces.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2026, Google LLC and/or its affiliates. All rights reserved.
+ * 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 8374654 8208752
+ * @summary test lambda deserialization for Object method references on interfaces
+ * @compile/ref=SerializableObjectMethodReferencesOnInterfaces.out -XDrawDiagnostics --debug=dumpLambdaDeserializationStats SerializableObjectMethodReferencesOnInterfaces.java
+ * @run main SerializableObjectMethodReferencesOnInterfaces
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+
+public class SerializableObjectMethodReferencesOnInterfaces {
+
+    public static void main(String[] args) throws Exception {
+        new Test().run();
+    }
+
+    static class Test {
+        interface I1 extends Serializable {}
+
+        interface I2 extends I1 {
+            @Override
+            public int hashCode();
+        }
+
+        interface F extends Serializable {
+            R apply(T t);
+        }
+
+        enum E {
+            ONE
+        }
+
+        void run() throws Exception {
+            F f1 = I1::hashCode;
+            F f2 = I2::hashCode;
+            F f3 = E::hashCode;
+            F f4 = Object::hashCode;
+
+            serialDeserial(f1).apply(new I1() {});
+            serialDeserial(f2).apply(new I2() {});
+            serialDeserial(f3).apply(E.ONE);
+            serialDeserial(f4).apply(new Object());
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    static  T serialDeserial(T object) throws Exception {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (ObjectOutputStream oos = new ObjectOutputStream(baos)) {
+            oos.writeObject(object);
+        }
+        try (ObjectInputStream ois =
+                new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()))) {
+            return (T) ois.readObject();
+        }
+    }
+}
diff --git a/test/langtools/tools/javac/lambda/SerializableObjectMethodReferencesOnInterfaces.out b/test/langtools/tools/javac/lambda/SerializableObjectMethodReferencesOnInterfaces.out
new file mode 100644
index 00000000000..657235aa6fe
--- /dev/null
+++ b/test/langtools/tools/javac/lambda/SerializableObjectMethodReferencesOnInterfaces.out
@@ -0,0 +1,4 @@
+SerializableObjectMethodReferencesOnInterfaces.java:61:33: compiler.note.lambda.deserialization.stat: SerializableObjectMethodReferencesOnInterfaces$Test$F, apply, (Ljava/lang/Object;)Ljava/lang/Object;, 5, java/lang/Object, hashCode, ()I, (LSerializableObjectMethodReferencesOnInterfaces$Test$I1;)Ljava/lang/Integer;
+SerializableObjectMethodReferencesOnInterfaces.java:62:33: compiler.note.lambda.deserialization.stat: SerializableObjectMethodReferencesOnInterfaces$Test$F, apply, (Ljava/lang/Object;)Ljava/lang/Object;, 5, java/lang/Object, hashCode, ()I, (LSerializableObjectMethodReferencesOnInterfaces$Test$I2;)Ljava/lang/Integer;
+SerializableObjectMethodReferencesOnInterfaces.java:63:32: compiler.note.lambda.deserialization.stat: SerializableObjectMethodReferencesOnInterfaces$Test$F, apply, (Ljava/lang/Object;)Ljava/lang/Object;, 5, java/lang/Enum, hashCode, ()I, (LSerializableObjectMethodReferencesOnInterfaces$Test$E;)Ljava/lang/Integer;
+SerializableObjectMethodReferencesOnInterfaces.java:64:37: compiler.note.lambda.deserialization.stat: SerializableObjectMethodReferencesOnInterfaces$Test$F, apply, (Ljava/lang/Object;)Ljava/lang/Object;, 5, java/lang/Object, hashCode, ()I, (Ljava/lang/Object;)Ljava/lang/Integer;
diff --git a/test/langtools/tools/javac/lambda/SerializableObjectMethods.out b/test/langtools/tools/javac/lambda/SerializableObjectMethods.out
index d03cc145794..56caaabc6de 100644
--- a/test/langtools/tools/javac/lambda/SerializableObjectMethods.out
+++ b/test/langtools/tools/javac/lambda/SerializableObjectMethods.out
@@ -1,4 +1,4 @@
-SerializableObjectMethods.java:59:35: compiler.note.lambda.deserialization.stat: SerializableObjectMethods$F, apply, (Ljava/lang/Object;)Ljava/lang/Object;, 5, java/lang/Object, hashCode, ()I
-SerializableObjectMethods.java:60:35: compiler.note.lambda.deserialization.stat: SerializableObjectMethods$F, apply, (Ljava/lang/Object;)Ljava/lang/Object;, 9, SerializableObjectMethods$I2, hashCode, ()I
+SerializableObjectMethods.java:59:35: compiler.note.lambda.deserialization.stat: SerializableObjectMethods$F, apply, (Ljava/lang/Object;)Ljava/lang/Object;, 5, java/lang/Object, hashCode, ()I, (LSerializableObjectMethods$I1;)Ljava/lang/Integer;
+SerializableObjectMethods.java:60:35: compiler.note.lambda.deserialization.stat: SerializableObjectMethods$F, apply, (Ljava/lang/Object;)Ljava/lang/Object;, 5, java/lang/Object, hashCode, ()I, (LSerializableObjectMethods$I2;)Ljava/lang/Integer;
 - compiler.note.unchecked.filename: SerializableObjectMethods.java
 - compiler.note.unchecked.recompile

From bd2a3b80625e49b77d9500e793276e26bb7d8028 Mon Sep 17 00:00:00 2001
From: Ramkumar Sunderbabu 
Date: Tue, 10 Feb 2026 09:28:46 +0000
Subject: [PATCH 043/120] 8373040: Mark
 compiler/codecache/CodeCacheSegmentSizeTest.java as flagless

Reviewed-by: syan, chagedorn
---
 .../jtreg/compiler/codecache/CodeCacheSegmentSizeTest.java     | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/test/hotspot/jtreg/compiler/codecache/CodeCacheSegmentSizeTest.java b/test/hotspot/jtreg/compiler/codecache/CodeCacheSegmentSizeTest.java
index 5531bdd1517..b6d051fcd06 100644
--- a/test/hotspot/jtreg/compiler/codecache/CodeCacheSegmentSizeTest.java
+++ b/test/hotspot/jtreg/compiler/codecache/CodeCacheSegmentSizeTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2025 IBM Corporation. All rights reserved.
+ * Copyright (c) 2025, 2026, IBM Corporation. All rights reserved.
  * 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 @@
  *          - fails gracefully for invalid value
  *          - succeeds for valid value
  * @library /test/lib
+ * @requires vm.flagless
  * @run driver CodeCacheSegmentSizeTest
  */
 

From bfb6de5b2b5870d4bd964e5aab791ef88270c5a4 Mon Sep 17 00:00:00 2001
From: Afshin Zafari 
Date: Tue, 10 Feb 2026 10:07:39 +0000
Subject: [PATCH 044/120] 8377429: Warning as error in asan build in
 test_nmt_cornercases.cpp on Linux

Reviewed-by: dholmes, syan
---
 test/hotspot/gtest/nmt/test_nmt_cornercases.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/test/hotspot/gtest/nmt/test_nmt_cornercases.cpp b/test/hotspot/gtest/nmt/test_nmt_cornercases.cpp
index 24ab9888521..e0a452b1831 100644
--- a/test/hotspot/gtest/nmt/test_nmt_cornercases.cpp
+++ b/test/hotspot/gtest/nmt/test_nmt_cornercases.cpp
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2022, 2023 SAP SE. All rights reserved.
- * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2026, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +31,9 @@
 #include "testutils.hpp"
 #include "unittest.hpp"
 
+// ASAN complains about allocating very large sizes
+#if !INCLUDE_ASAN
+
 // Check NMT header for integrity, as well as expected type and size.
 static void check_expected_malloc_header(const void* payload, MemTag mem_tag, size_t size) {
   const MallocHeader* hdr = MallocHeader::resolve_checked(payload);
@@ -38,9 +41,6 @@ static void check_expected_malloc_header(const void* payload, MemTag mem_tag, si
   EXPECT_EQ(hdr->mem_tag(), mem_tag);
 }
 
-// ASAN complains about allocating very large sizes
-#if !INCLUDE_ASAN
-
 // Check that a malloc with an overflowing size is rejected.
 TEST_VM(NMT, malloc_failure1) {
   void* p = os::malloc(SIZE_MAX, mtTest);

From 264fdc5b4ed5f4e35168048533196e670c3dda6c Mon Sep 17 00:00:00 2001
From: Mikhail Yankelevich 
Date: Tue, 10 Feb 2026 12:18:03 +0000
Subject: [PATCH 045/120] 8374808: Add new methods to KeyStore and KeyStoreSpi
 that return the creation date as an Instant instead of Date

Reviewed-by: weijun
---
 .../classes/apple/security/KeychainStore.java | 47 +++++++++----
 .../com/sun/crypto/provider/JceKeyStore.java  | 67 ++++++++++++-------
 .../share/classes/java/security/KeyStore.java | 32 ++++++++-
 .../classes/java/security/KeyStoreSpi.java    | 26 ++++++-
 .../sun/security/pkcs12/PKCS12KeyStore.java   | 58 +++++++++++-----
 .../sun/security/provider/DomainKeyStore.java | 27 ++++++--
 .../sun/security/provider/JavaKeyStore.java   | 48 +++++++++----
 .../security/KeyStore/TestKeyStoreBasic.java  | 31 ++++++++-
 .../security/provider/KeyStore/DKSTest.java   | 44 ++++++++----
 9 files changed, 291 insertions(+), 89 deletions(-)

diff --git a/src/java.base/macosx/classes/apple/security/KeychainStore.java b/src/java.base/macosx/classes/apple/security/KeychainStore.java
index 6f70fccbb24..63dfc39afe1 100644
--- a/src/java.base/macosx/classes/apple/security/KeychainStore.java
+++ b/src/java.base/macosx/classes/apple/security/KeychainStore.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2026, Oracle and/or its affiliates. All rights reserved.
  * 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.security.*;
 import java.security.cert.*;
 import java.security.cert.Certificate;
 import java.security.spec.*;
+import java.time.Instant;
+import java.time.temporal.ChronoUnit;
 import java.util.*;
 
 import javax.crypto.*;
@@ -114,7 +116,7 @@ abstract sealed class KeychainStore extends KeyStoreSpi {
     // SecCertificateRef.  When we delete the key we have to delete all of the corresponding
     // native objects.
     static class KeyEntry {
-        Date date; // the creation date of this entry
+        Instant date; // the creation instant of this entry
         byte[] protectedPrivKey;
         char[] password;
         long keyRef;  // SecKeyRef for this key
@@ -124,7 +126,7 @@ abstract sealed class KeychainStore extends KeyStoreSpi {
 
     // Trusted certificates
     static class TrustedCertEntry {
-        Date date; // the creation date of this entry
+        Instant date; // the creation instant of this entry
 
         Certificate cert;
         long certRef;  // SecCertificateRef for this key
@@ -405,13 +407,32 @@ abstract sealed class KeychainStore extends KeyStoreSpi {
      * not exist
      */
     public Date engineGetCreationDate(String alias) {
-        Object entry = entries.get(alias.toLowerCase(Locale.ROOT));
+        final Instant instant = this.engineGetCreationInstant(alias);
+        if (instant == null) {
+            return null;
+        }
+        return Date.from(instant);
+    }
+
+    /**
+     * Returns the instant that the entry identified by the given alias was
+     * created.
+     *
+     * @param alias the alias name
+     *
+     * @return the instant that the entry identified by the given alias
+     * was created, or {@code null} if the given alias does not exist
+     *
+     * @since 27
+     */
+    public Instant engineGetCreationInstant(String alias) {
+        final Object entry = entries.get(alias.toLowerCase(Locale.ROOT));
 
         if (entry != null) {
-            if (entry instanceof TrustedCertEntry) {
-                return new Date(((TrustedCertEntry)entry).date.getTime());
+            if (entry instanceof TrustedCertEntry trustedCertEntry) {
+                return trustedCertEntry.date;
             } else {
-                return new Date(((KeyEntry)entry).date.getTime());
+                return ((KeyEntry)entry).date;
             }
         } else {
             return null;
@@ -447,7 +468,7 @@ abstract sealed class KeychainStore extends KeyStoreSpi {
         synchronized(entries) {
             try {
                 KeyEntry entry = new KeyEntry();
-                entry.date = new Date();
+                entry.date = Instant.now().truncatedTo(ChronoUnit.MILLIS);
 
                 if (key instanceof PrivateKey) {
                     if ((key.getFormat().equals("PKCS#8")) ||
@@ -525,7 +546,7 @@ abstract sealed class KeychainStore extends KeyStoreSpi {
                                             + "EncryptedPrivateKeyInfo");
             }
 
-            entry.date = new Date();
+            entry.date = Instant.now().truncatedTo(ChronoUnit.MILLIS);
 
             if ((chain != null) &&
                 (chain.length != 0)) {
@@ -927,9 +948,9 @@ abstract sealed class KeychainStore extends KeyStoreSpi {
 
             // Make a creation date.
             if (creationDate != 0)
-                tce.date = new Date(creationDate);
+                tce.date = Instant.ofEpochMilli(creationDate);
             else
-                tce.date = new Date();
+                tce.date = Instant.now().truncatedTo(ChronoUnit.MILLIS);
 
             entries.put(alias.toLowerCase(Locale.ROOT), tce);
         } catch (Exception e) {
@@ -952,9 +973,9 @@ abstract sealed class KeychainStore extends KeyStoreSpi {
 
         // Make a creation date.
         if (creationDate != 0)
-            ke.date = new Date(creationDate);
+            ke.date = Instant.ofEpochMilli(creationDate);
         else
-            ke.date = new Date();
+            ke.date = Instant.now().truncatedTo(ChronoUnit.MILLIS);
 
         // Next, create X.509 Certificate objects from the raw data.  This is complicated
         // because a certificate's public key may be too long for Java's default encryption strength.
diff --git a/src/java.base/share/classes/com/sun/crypto/provider/JceKeyStore.java b/src/java.base/share/classes/com/sun/crypto/provider/JceKeyStore.java
index ad98653b9c2..1e45a4e6a20 100644
--- a/src/java.base/share/classes/com/sun/crypto/provider/JceKeyStore.java
+++ b/src/java.base/share/classes/com/sun/crypto/provider/JceKeyStore.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2026, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +29,8 @@ import sun.security.util.Debug;
 import sun.security.util.IOUtils;
 
 import java.io.*;
+import java.time.Instant;
+import java.time.temporal.ChronoUnit;
 import java.util.*;
 import java.security.DigestInputStream;
 import java.security.DigestOutputStream;
@@ -70,14 +72,14 @@ public final class JceKeyStore extends KeyStoreSpi {
 
     // Private key and supporting certificate chain
     private static final class PrivateKeyEntry {
-        Date date; // the creation date of this entry
+        Instant date; // the creation date of this entry
         byte[] protectedKey;
         Certificate[] chain;
     }
 
     // Secret key
     private static final class SecretKeyEntry {
-        Date date; // the creation date of this entry
+        Instant date; // the creation date of this entry
         SealedObject sealedKey;
 
         // Maximum possible length of sealedKey. Used to detect malicious
@@ -89,7 +91,7 @@ public final class JceKeyStore extends KeyStoreSpi {
 
     // Trusted certificate
     private static final class TrustedCertEntry {
-        Date date; // the creation date of this entry
+        Instant date; // the creation date of this entry
         Certificate cert;
     }
 
@@ -213,23 +215,38 @@ public final class JceKeyStore extends KeyStoreSpi {
      * not exist
      */
     public Date engineGetCreationDate(String alias) {
-        Date date = null;
+        final Instant instant = this.engineGetCreationInstant(alias);
+        if (instant == null) {
+            return null;
+        }
+        return Date.from(instant);
+    }
 
-        Object entry = entries.get(alias.toLowerCase(Locale.ENGLISH));
+    /**
+     * Returns the instant that the entry identified by the given alias was
+     * created.
+     *
+     * @param alias the alias name
+     *
+     * @return the instant that the entry identified by the given alias
+     * was created, or {@code null} if the given alias does not exist
+     *
+     * @since 27
+     */
+    public Instant engineGetCreationInstant(String alias) {
+        final Object entry = entries.get(alias.toLowerCase(Locale.ENGLISH));
 
         if (entry != null) {
-            // We have to create a new instance of java.util.Date because
-            // dates are not immutable
             if (entry instanceof TrustedCertEntry) {
-                date = new Date(((TrustedCertEntry)entry).date.getTime());
+                return ((TrustedCertEntry)entry).date;
             } else if (entry instanceof PrivateKeyEntry) {
-                date = new Date(((PrivateKeyEntry)entry).date.getTime());
+                return ((PrivateKeyEntry)entry).date;
             } else {
-                date = new Date(((SecretKeyEntry)entry).date.getTime());
+                return ((SecretKeyEntry)entry).date;
             }
+        } else {
+            return null;
         }
-
-        return date;
     }
 
     /**
@@ -264,7 +281,7 @@ public final class JceKeyStore extends KeyStoreSpi {
 
                 if (key instanceof PrivateKey) {
                     PrivateKeyEntry entry = new PrivateKeyEntry();
-                    entry.date = new Date();
+                    entry.date = Instant.now().truncatedTo(ChronoUnit.MILLIS);
 
                     // protect the private key
                     entry.protectedKey = keyProtector.protect((PrivateKey)key);
@@ -282,7 +299,7 @@ public final class JceKeyStore extends KeyStoreSpi {
 
                 } else {
                     SecretKeyEntry entry = new SecretKeyEntry();
-                    entry.date = new Date();
+                    entry.date = Instant.now().truncatedTo(ChronoUnit.MILLIS);
 
                     // seal and store the key
                     entry.sealedKey = keyProtector.seal(key);
@@ -325,7 +342,7 @@ public final class JceKeyStore extends KeyStoreSpi {
             // We assume it's a private key, because there is no standard
             // (ASN.1) encoding format for wrapped secret keys
             PrivateKeyEntry entry = new PrivateKeyEntry();
-            entry.date = new Date();
+            entry.date = Instant.now().truncatedTo(ChronoUnit.MILLIS);
 
             entry.protectedKey = key.clone();
             if ((chain != null) &&
@@ -370,7 +387,7 @@ public final class JceKeyStore extends KeyStoreSpi {
 
             TrustedCertEntry trustedCertEntry = new TrustedCertEntry();
             trustedCertEntry.cert = cert;
-            trustedCertEntry.date = new Date();
+            trustedCertEntry.date = Instant.now().truncatedTo(ChronoUnit.MILLIS);
             entries.put(alias.toLowerCase(Locale.ENGLISH), trustedCertEntry);
         }
     }
@@ -588,7 +605,7 @@ public final class JceKeyStore extends KeyStoreSpi {
                         dos.writeUTF(alias);
 
                         // write the (entry creation) date
-                        dos.writeLong(pentry.date.getTime());
+                        dos.writeLong(pentry.date.toEpochMilli());
 
                         // write the protected private key
                         dos.writeInt(pentry.protectedKey.length);
@@ -618,7 +635,9 @@ public final class JceKeyStore extends KeyStoreSpi {
                         dos.writeUTF(alias);
 
                         // write the (entry creation) date
-                        dos.writeLong(((TrustedCertEntry)entry).date.getTime());
+                        dos.writeLong(
+                                ((TrustedCertEntry)entry).date.toEpochMilli()
+                        );
 
                         // write the trusted certificate
                         encoded = ((TrustedCertEntry)entry).cert.getEncoded();
@@ -635,7 +654,9 @@ public final class JceKeyStore extends KeyStoreSpi {
                         dos.writeUTF(alias);
 
                         // write the (entry creation) date
-                        dos.writeLong(((SecretKeyEntry)entry).date.getTime());
+                        dos.writeLong(
+                                ((SecretKeyEntry)entry).date.toEpochMilli()
+                        );
 
                         // write the sealed key
                         oos = new ObjectOutputStream(dos);
@@ -753,7 +774,7 @@ public final class JceKeyStore extends KeyStoreSpi {
                         alias = dis.readUTF();
 
                         // read the (entry creation) date
-                        entry.date = new Date(dis.readLong());
+                        entry.date = Instant.ofEpochMilli(dis.readLong());
 
                         // read the private key
                         entry.protectedKey = IOUtils.readExactlyNBytes(dis, dis.readInt());
@@ -798,7 +819,7 @@ public final class JceKeyStore extends KeyStoreSpi {
                         alias = dis.readUTF();
 
                         // read the (entry creation) date
-                        entry.date = new Date(dis.readLong());
+                        entry.date = Instant.ofEpochMilli(dis.readLong());
 
                         // read the trusted certificate
                         if (xVersion == 2) {
@@ -832,7 +853,7 @@ public final class JceKeyStore extends KeyStoreSpi {
                         alias = dis.readUTF();
 
                         // read the (entry creation) date
-                        entry.date = new Date(dis.readLong());
+                        entry.date = Instant.ofEpochMilli(dis.readLong());
 
                         // read the sealed key
                         try {
diff --git a/src/java.base/share/classes/java/security/KeyStore.java b/src/java.base/share/classes/java/security/KeyStore.java
index 8f3d4ba29fd..83414082cab 100644
--- a/src/java.base/share/classes/java/security/KeyStore.java
+++ b/src/java.base/share/classes/java/security/KeyStore.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
  * 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,7 @@ import java.security.cert.Certificate;
 import java.security.cert.X509Certificate;
 import java.security.cert.CertificateException;
 import java.security.spec.AlgorithmParameterSpec;
+import java.time.Instant;
 import java.util.*;
 import javax.crypto.SecretKey;
 
@@ -1182,6 +1183,9 @@ public class KeyStore {
 
     /**
      * Returns the creation date of the entry identified by the given alias.
+     * 

+ * It is recommended to use the {@link #getCreationInstant(String)} + * method instead. * * @param alias the alias name * @@ -1200,6 +1204,32 @@ public class KeyStore { return keyStoreSpi.engineGetCreationDate(alias); } + + /** + * Returns the instant that the entry identified by the given alias was + * created. + * + * @param alias the alias name + * + * @return the instant that the entry identified by the given alias + * was created, or {@code null} if the given alias does not exist + * + * @throws KeyStoreException if the keystore has not been initialized + * (loaded) + * + * @since 27 + */ + public final Instant getCreationInstant(String alias) + throws KeyStoreException + { + if (!initialized) { + throw new KeyStoreException("Uninitialized keystore"); + } + return keyStoreSpi.engineGetCreationInstant(alias); + } + + + /** * Assigns the given key to the given alias, protecting it with the given * password. diff --git a/src/java.base/share/classes/java/security/KeyStoreSpi.java b/src/java.base/share/classes/java/security/KeyStoreSpi.java index 0b0aa8adf19..5c60f44e4e9 100644 --- a/src/java.base/share/classes/java/security/KeyStoreSpi.java +++ b/src/java.base/share/classes/java/security/KeyStoreSpi.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2026, Oracle and/or its affiliates. All rights reserved. * 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 @@ package java.security; import java.io.*; +import java.time.Instant; import java.util.*; import java.security.KeyStore.*; @@ -127,6 +128,29 @@ public abstract class KeyStoreSpi { */ public abstract Date engineGetCreationDate(String alias); + /** + * Returns the instant that the entry identified by the given alias was + * created. + * + * @apiNote Subclasses should override this method to directly return an + * instant. + * + * @implSpec + * The default implementation calls {@code engineGetCreationDate(alias)} + * and returns the output as an {@code Instant} value. + * + * @param alias the alias name + * + * @return the instant that the entry identified by the given alias + * was created, or {@code null} if the given alias does not exist + * + * @since 27 + */ + public Instant engineGetCreationInstant(String alias) { + final Date date = engineGetCreationDate(alias); + return date == null ? null : date.toInstant(); + } + /** * Assigns the given key to the given alias, protecting it with the given * password. diff --git a/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java b/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java index f85ba0f9c4b..33e8406a7f6 100644 --- a/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java +++ b/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,6 +35,8 @@ import java.security.spec.AlgorithmParameterSpec; import java.security.spec.InvalidParameterSpecException; import java.security.spec.KeySpec; import java.security.spec.PKCS8EncodedKeySpec; +import java.time.Instant; +import java.time.temporal.ChronoUnit; import java.util.*; import javax.crypto.Cipher; import javax.crypto.SecretKey; @@ -179,7 +181,7 @@ public final class PKCS12KeyStore extends KeyStoreSpi { // A keystore entry and associated attributes private static class Entry { - Date date; // the creation date of this entry + Instant date; // the creation date of this entry String alias; byte[] keyId; Set attributes; @@ -212,7 +214,7 @@ public final class PKCS12KeyStore extends KeyStoreSpi { CertEntry(X509Certificate cert, byte[] keyId, String alias, ObjectIdentifier[] trustedKeyUsage, Set attributes) { - this.date = new Date(); + this.date = Instant.now().truncatedTo(ChronoUnit.MILLIS); this.cert = cert; this.keyId = keyId; this.alias = alias; @@ -541,9 +543,28 @@ public final class PKCS12KeyStore extends KeyStoreSpi { * not exist */ public Date engineGetCreationDate(String alias) { - Entry entry = entries.get(alias.toLowerCase(Locale.ENGLISH)); + final Instant instant = this.engineGetCreationInstant(alias); + if (instant == null) { + return null; + } + return Date.from(instant); + } + + /** + * Returns the instant that the entry identified by the given alias was + * created. + * + * @param alias the alias name + * + * @return the instant that the entry identified by the given alias + * was created, or {@code null} if the given alias does not exist + * + * @since 27 + */ + public Instant engineGetCreationInstant(String alias) { + final Entry entry = entries.get(alias.toLowerCase(Locale.ENGLISH)); if (entry != null) { - return new Date(entry.date.getTime()); + return entry.date; } else { return null; } @@ -606,7 +627,7 @@ public final class PKCS12KeyStore extends KeyStoreSpi { checkX509Certs(chain); PrivateKeyEntry keyEntry = new PrivateKeyEntry(); - keyEntry.date = new Date(); + keyEntry.date = Instant.now().truncatedTo(ChronoUnit.MILLIS); if ((key.getFormat().equals("PKCS#8")) || (key.getFormat().equals("PKCS8"))) { @@ -651,7 +672,7 @@ public final class PKCS12KeyStore extends KeyStoreSpi { } else if (key instanceof SecretKey) { SecretKeyEntry keyEntry = new SecretKeyEntry(); - keyEntry.date = new Date(); + keyEntry.date = Instant.now().truncatedTo(ChronoUnit.MILLIS); // Encode secret key in a PKCS#8 DerOutputStream secretKeyInfo = new DerOutputStream(); @@ -690,7 +711,7 @@ public final class PKCS12KeyStore extends KeyStoreSpi { entry.attributes.addAll(attributes); } // set the keyId to current date - entry.keyId = ("Time " + (entry.date).getTime()).getBytes(UTF_8); + entry.keyId = ("Time " + entry.date.toEpochMilli()).getBytes(UTF_8); // set the alias entry.alias = alias.toLowerCase(Locale.ENGLISH); // add the entry @@ -745,7 +766,7 @@ public final class PKCS12KeyStore extends KeyStoreSpi { } PrivateKeyEntry entry = new PrivateKeyEntry(); - entry.date = new Date(); + entry.date = Instant.now().truncatedTo(ChronoUnit.MILLIS); if (debug != null) { debug.println("Setting a protected private key at alias '" + @@ -753,7 +774,7 @@ public final class PKCS12KeyStore extends KeyStoreSpi { } // set the keyId to current date - entry.keyId = ("Time " + (entry.date).getTime()).getBytes(UTF_8); + entry.keyId = ("Time " + entry.date.toEpochMilli()).getBytes(UTF_8); // set the alias entry.alias = alias.toLowerCase(Locale.ENGLISH); @@ -2411,21 +2432,22 @@ public final class PKCS12KeyStore extends KeyStoreSpi { } } entry.keyId = keyId; - // restore date if it exists + // restore instant if it exists String keyIdStr = new String(keyId, UTF_8); - Date date = null; + Instant instant = null; if (keyIdStr.startsWith("Time ")) { try { - date = new Date( - Long.parseLong(keyIdStr.substring(5))); + instant = Instant.ofEpochMilli( + Long.parseLong(keyIdStr.substring(5)) + ); } catch (Exception e) { - // date has been initialized to null + // instant has been initialized to null } } - if (date == null) { - date = new Date(); + if (instant == null) { + instant = Instant.now().truncatedTo(ChronoUnit.MILLIS); } - entry.date = date; + entry.date = instant; if (bagItem instanceof PrivateKeyEntry) { keyList.add(entry); diff --git a/src/java.base/share/classes/sun/security/provider/DomainKeyStore.java b/src/java.base/share/classes/sun/security/provider/DomainKeyStore.java index 342df6c5eeb..163454b55fc 100644 --- a/src/java.base/share/classes/sun/security/provider/DomainKeyStore.java +++ b/src/java.base/share/classes/sun/security/provider/DomainKeyStore.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2026, Oracle and/or its affiliates. All rights reserved. * 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,7 @@ import java.net.*; import java.security.*; import java.security.cert.Certificate; import java.security.cert.CertificateException; +import java.time.Instant; import java.util.*; import static java.nio.charset.StandardCharsets.UTF_8; @@ -214,16 +215,32 @@ abstract class DomainKeyStore extends KeyStoreSpi { * not exist */ public Date engineGetCreationDate(String alias) { + final Instant instant = this.engineGetCreationInstant(alias); + return (instant == null) ? null : Date.from(instant); + } + + /** + * Returns the instant that the entry identified by the given alias was + * created. + * + * @param alias the alias name + * + * @return the instant that the entry identified by the given alias + * was created, or {@code null} if the given alias does not exist + * + * @since 27 + */ + public Instant engineGetCreationInstant(String alias) { AbstractMap.SimpleEntry> pair = getKeystoresForReading(alias); - Date date = null; + Instant instant = null; try { String entryAlias = pair.getKey(); for (KeyStore keystore : pair.getValue()) { - date = keystore.getCreationDate(entryAlias); - if (date != null) { + instant = keystore.getCreationInstant(entryAlias); + if (instant != null) { break; } } @@ -231,7 +248,7 @@ abstract class DomainKeyStore extends KeyStoreSpi { throw new IllegalStateException(e); } - return date; + return instant; } @Override diff --git a/src/java.base/share/classes/sun/security/provider/JavaKeyStore.java b/src/java.base/share/classes/sun/security/provider/JavaKeyStore.java index 73ca0c6bf16..f014c2ecbc0 100644 --- a/src/java.base/share/classes/sun/security/provider/JavaKeyStore.java +++ b/src/java.base/share/classes/sun/security/provider/JavaKeyStore.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * 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.security.*; import java.security.cert.Certificate; import java.security.cert.CertificateFactory; import java.security.cert.CertificateException; +import java.time.Instant; +import java.time.temporal.ChronoUnit; import java.util.*; import static java.nio.charset.StandardCharsets.UTF_8; @@ -100,14 +102,14 @@ public abstract sealed class JavaKeyStore extends KeyStoreSpi { // Private keys and their supporting certificate chains private static class KeyEntry { - Date date; // the creation date of this entry + Instant date; // the creation date of this entry byte[] protectedPrivKey; Certificate[] chain; } // Trusted certificates private static class TrustedCertEntry { - Date date; // the creation date of this entry + Instant date; // the creation date of this entry Certificate cert; } @@ -236,13 +238,31 @@ public abstract sealed class JavaKeyStore extends KeyStoreSpi { * not exist */ public Date engineGetCreationDate(String alias) { - Object entry = entries.get(convertAlias(alias)); + final Instant instant = this.engineGetCreationInstant(alias); + return instant == null ? null : Date.from(instant); + } + + + + /** + * Returns the instant that the entry identified by the given alias was + * created. + * + * @param alias the alias name + * + * @return the instant that the entry identified by the given alias + * was created, or {@code null} if the given alias does not exist + * + * @since 27 + */ + public Instant engineGetCreationInstant(String alias) { + final Object entry = entries.get(convertAlias(alias)); if (entry != null) { if (entry instanceof TrustedCertEntry) { - return new Date(((TrustedCertEntry)entry).date.getTime()); + return ((TrustedCertEntry)entry).date; } else { - return new Date(((KeyEntry)entry).date.getTime()); + return((KeyEntry)entry).date; } } else { return null; @@ -287,7 +307,7 @@ public abstract sealed class JavaKeyStore extends KeyStoreSpi { try { synchronized(entries) { KeyEntry entry = new KeyEntry(); - entry.date = new Date(); + entry.date = Instant.now().truncatedTo(ChronoUnit.MILLIS); // Protect the encoding of the key passwordBytes = convertToBytes(password); @@ -350,7 +370,7 @@ public abstract sealed class JavaKeyStore extends KeyStoreSpi { } KeyEntry entry = new KeyEntry(); - entry.date = new Date(); + entry.date = Instant.now().truncatedTo(ChronoUnit.MILLIS); entry.protectedPrivKey = key.clone(); if ((chain != null) && @@ -391,7 +411,7 @@ public abstract sealed class JavaKeyStore extends KeyStoreSpi { TrustedCertEntry trustedCertEntry = new TrustedCertEntry(); trustedCertEntry.cert = cert; - trustedCertEntry.date = new Date(); + trustedCertEntry.date = Instant.now().truncatedTo(ChronoUnit.MILLIS); entries.put(convertAlias(alias), trustedCertEntry); } } @@ -579,7 +599,7 @@ public abstract sealed class JavaKeyStore extends KeyStoreSpi { dos.writeUTF(alias); // Write the (entry creation) date - dos.writeLong(((KeyEntry)entry).date.getTime()); + dos.writeLong(((KeyEntry)entry).date.toEpochMilli()); // Write the protected private key dos.writeInt(((KeyEntry)entry).protectedPrivKey.length); @@ -608,7 +628,9 @@ public abstract sealed class JavaKeyStore extends KeyStoreSpi { dos.writeUTF(alias); // Write the (entry creation) date - dos.writeLong(((TrustedCertEntry)entry).date.getTime()); + dos.writeLong( + ((TrustedCertEntry)entry).date.toEpochMilli() + ); // Write the trusted certificate encoded = ((TrustedCertEntry)entry).cert.getEncoded(); @@ -707,7 +729,7 @@ public abstract sealed class JavaKeyStore extends KeyStoreSpi { alias = dis.readUTF(); // Read the (entry creation) date - entry.date = new Date(dis.readLong()); + entry.date = Instant.ofEpochMilli(dis.readLong()); // Read the private key entry.protectedPrivKey = @@ -756,7 +778,7 @@ public abstract sealed class JavaKeyStore extends KeyStoreSpi { alias = dis.readUTF(); // Read the (entry creation) date - entry.date = new Date(dis.readLong()); + entry.date = Instant.ofEpochMilli(dis.readLong()); // Read the trusted certificate if (xVersion == 2) { diff --git a/test/jdk/java/security/KeyStore/TestKeyStoreBasic.java b/test/jdk/java/security/KeyStore/TestKeyStoreBasic.java index 8218c9cb48a..e39793cf1b7 100644 --- a/test/jdk/java/security/KeyStore/TestKeyStoreBasic.java +++ b/test/jdk/java/security/KeyStore/TestKeyStoreBasic.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2026, Oracle and/or its affiliates. All rights reserved. * 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,18 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.security.*; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.PEMDecoder; +import java.security.PrivateKey; +import java.security.UnrecoverableKeyException; import java.security.cert.Certificate; import java.security.cert.X509Certificate; +import java.time.Instant; /* * @test - * @bug 8048621 8133090 8167371 8236671 + * @bug 8048621 8133090 8167371 8236671 8374808 * @enablePreview * @summary Test basic operations with keystores (jks, jceks, pkcs12) * @author Yu-Ching Valerie PENG @@ -177,6 +182,8 @@ public class TestKeyStoreBasic { // compare the creation date of the 2 key stores for all aliases compareCreationDate(ks, ks2, numEntries); + compareCreationInstant(ks, ks2, numEntries); + // remove the last entry from the 2nd key store numEntries--; ks2.deleteEntry(ALIAS_HEAD + numEntries); @@ -213,6 +220,7 @@ public class TestKeyStoreBasic { // compare the creation date of the 2 key stores for all aliases compareCreationDate(ks, ks2, numEntries); + compareCreationInstant(ks, ks2, numEntries); // check setEntry/getEntry with a password protection algorithm if ("PKCS12".equalsIgnoreCase(ks.getType())) { @@ -284,6 +292,23 @@ public class TestKeyStoreBasic { } } + // compare the creation instants - true if all the same + private void compareCreationInstant(KeyStore o1, KeyStore o2, int range) + throws KeyStoreException { + String alias; + for (int k = 0; k < range; k++) { + alias = ALIAS_HEAD + k; + final Instant instant1 = o1.getCreationInstant(alias); + final Instant instant2 = o2.getCreationInstant(alias); + if (!(instant1.equals(instant2))) { + throw new RuntimeException("ERROR: entry creation time (" + k + + ") differs Instants {" + + instant1 + " - " + + instant2 + "}"); + } + } + } + // checks if an exception was caused by specified exception class private static boolean causedBy(Exception e, Class klass) { Throwable cause = e; diff --git a/test/jdk/sun/security/provider/KeyStore/DKSTest.java b/test/jdk/sun/security/provider/KeyStore/DKSTest.java index 9c35a1c1dd9..ee655f5a2a6 100644 --- a/test/jdk/sun/security/provider/KeyStore/DKSTest.java +++ b/test/jdk/sun/security/provider/KeyStore/DKSTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2026, Oracle and/or its affiliates. All rights reserved. * 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,30 @@ /* * @test - * @bug 8007755 + * @bug 8007755 8374808 * @library /test/lib * @summary Support the logical grouping of keystores */ -import java.io.*; -import java.net.*; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.net.URI; import java.nio.file.Paths; -import java.security.*; +import java.security.DomainLoadStoreParameter; import java.security.KeyStore; -import java.security.cert.*; +import java.security.UnrecoverableKeyException; import java.security.cert.Certificate; -import java.util.*; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.OutputAnalyzer; @@ -205,17 +216,26 @@ public class DKSTest { new KeyStore.TrustedCertificateEntry(cert), null); } - private static void checkEntries(KeyStore keystore, int expected) + private static void checkEntries(KeyStore keystore, int expectedCount) throws Exception { - int i = 0; + int currCount = 0; for (String alias : Collections.list(keystore.aliases())) { System.out.print("."); - i++; + currCount++; + + // check creation date and instant + if(!keystore.getCreationDate(alias).equals( + Date.from(keystore.getCreationInstant(alias))) + ){ + throw new RuntimeException( + "Creation Date is not the same as Instant timestamp"); + } } System.out.println(); - if (expected != i) { + // Check if current count is expected + if (expectedCount != currCount) { throw new Exception("Error: unexpected entry count in keystore: " + - "loaded=" + i + ", expected=" + expected); + "loaded=" + currCount + ", expected=" + expectedCount); } } From 28f845a670f767f43acfdb1c6de287003c93c53c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joel=20Sikstr=C3=B6m?= Date: Tue, 10 Feb 2026 13:19:40 +0000 Subject: [PATCH 046/120] 8376777: Consistent use of nonstatic instead of non_static in ci files Reviewed-by: chagedorn, aseoane --- src/hotspot/share/ci/ciField.cpp | 4 ++-- src/hotspot/share/ci/ciInstanceKlass.cpp | 6 +++--- src/hotspot/share/ci/ciInstanceKlass.hpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/hotspot/share/ci/ciField.cpp b/src/hotspot/share/ci/ciField.cpp index e0c818f02fc..946fea5346f 100644 --- a/src/hotspot/share/ci/ciField.cpp +++ b/src/hotspot/share/ci/ciField.cpp @@ -213,7 +213,7 @@ ciField::ciField(fieldDescriptor *fd) : "bootstrap classes must not create & cache unshared fields"); } -static bool trust_final_non_static_fields(ciInstanceKlass* holder) { +static bool trust_final_nonstatic_fields(ciInstanceKlass* holder) { if (holder == nullptr) return false; if (holder->trust_final_fields()) { @@ -259,7 +259,7 @@ void ciField::initialize_from(fieldDescriptor* fd) { // An instance field can be constant if it's a final static field or if // it's a final non-static field of a trusted class (classes in // java.lang.invoke and sun.invoke packages and subpackages). - _is_constant = is_stable_field || trust_final_non_static_fields(_holder); + _is_constant = is_stable_field || trust_final_nonstatic_fields(_holder); } } else { // For CallSite objects treat the target field as a compile time constant. diff --git a/src/hotspot/share/ci/ciInstanceKlass.cpp b/src/hotspot/share/ci/ciInstanceKlass.cpp index 33bcabc4566..6243258acd9 100644 --- a/src/hotspot/share/ci/ciInstanceKlass.cpp +++ b/src/hotspot/share/ci/ciInstanceKlass.cpp @@ -392,7 +392,7 @@ bool ciInstanceKlass::contains_field_offset(int offset) { return get_instanceKlass()->contains_field_offset(offset); } -ciField* ciInstanceKlass::get_non_static_field_by_offset(const int field_offset) { +ciField* ciInstanceKlass::get_nonstatic_field_by_offset(const int field_offset) { for (int i = 0, len = nof_nonstatic_fields(); i < len; i++) { ciField* field = _nonstatic_fields->at(i); int field_off = field->offset_in_bytes(); @@ -406,7 +406,7 @@ ciField* ciInstanceKlass::get_non_static_field_by_offset(const int field_offset) // ciInstanceKlass::get_field_by_offset ciField* ciInstanceKlass::get_field_by_offset(int field_offset, bool is_static) { if (!is_static) { - return get_non_static_field_by_offset(field_offset); + return get_nonstatic_field_by_offset(field_offset); } VM_ENTRY_MARK; InstanceKlass* k = get_instanceKlass(); @@ -437,7 +437,7 @@ ciField* ciInstanceKlass::get_field_by_name(ciSymbol* name, ciSymbol* signature, // except this does not require allocating memory for a new ciField BasicType ciInstanceKlass::get_field_type_by_offset(const int field_offset, const bool is_static) { if (!is_static) { - ciField* field = get_non_static_field_by_offset(field_offset); + ciField* field = get_nonstatic_field_by_offset(field_offset); return field != nullptr ? field->layout_type() : T_ILLEGAL; } diff --git a/src/hotspot/share/ci/ciInstanceKlass.hpp b/src/hotspot/share/ci/ciInstanceKlass.hpp index 8ccf1fadfb7..a84c63981c9 100644 --- a/src/hotspot/share/ci/ciInstanceKlass.hpp +++ b/src/hotspot/share/ci/ciInstanceKlass.hpp @@ -83,7 +83,7 @@ private: bool compute_injected_fields_helper(); void compute_transitive_interfaces(); - ciField* get_non_static_field_by_offset(int field_offset); + ciField* get_nonstatic_field_by_offset(int field_offset); protected: ciInstanceKlass(Klass* k); From ef345e78797026b946aa5d91d5f6101ef3ad30bf Mon Sep 17 00:00:00 2001 From: Daniel Fuchs Date: Tue, 10 Feb 2026 14:23:23 +0000 Subject: [PATCH 047/120] 8377457: java/util/logging/ParentLoggersTest.java failed intermittently Reviewed-by: alanb, jpai --- .../share/classes/java/util/logging/Logger.java | 9 +++++---- test/jdk/java/util/logging/ParentLoggersTest.java | 11 ++++++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/java.logging/share/classes/java/util/logging/Logger.java b/src/java.logging/share/classes/java/util/logging/Logger.java index f40e419c2ca..dce0f69fa96 100644 --- a/src/java.logging/share/classes/java/util/logging/Logger.java +++ b/src/java.logging/share/classes/java/util/logging/Logger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2358,8 +2358,9 @@ public class Logger { synchronized (treeLock) { - // Remove ourself from any previous parent. + // Remove ourselves from any previous parent. LogManager.LoggerWeakRef ref = null; + Logger parent = this.parent; if (parent != null) { // assert parent.kids != null; for (Iterator iter = parent.kids.iterator(); iter.hasNext(); ) { @@ -2372,11 +2373,11 @@ public class Logger { ref = null; } } - // We have now removed ourself from our parents' kids. + // We have now removed ourselves from our parents' kids. } // Set our new parent. - parent = newParent; + this.parent = parent = newParent; if (parent.kids == null) { parent.kids = new ArrayList<>(2); } diff --git a/test/jdk/java/util/logging/ParentLoggersTest.java b/test/jdk/java/util/logging/ParentLoggersTest.java index 9150675c017..8aae7e95d74 100644 --- a/test/jdk/java/util/logging/ParentLoggersTest.java +++ b/test/jdk/java/util/logging/ParentLoggersTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 6498300 + * @bug 6498300 8377457 * * @summary regression: parent loggers are not properly registered * @author ss45998 @@ -77,6 +77,8 @@ public class ParentLoggersTest { initialLoggerNames.add(logger); } } + System.out.println("# default loggers are: " + defaultLoggers); + System.out.println("# initial loggers are: " + initialLoggerNames); String tstSrc = System.getProperty(TST_SRC_PROP); File fname = new File(tstSrc, LM_PROP_FNAME); @@ -131,7 +133,10 @@ public class ParentLoggersTest { } } - System.out.println(returnedLoggerNames); + System.out.println("# Created loggers are: " + + createdLoggers.stream().map(Logger::getName).toList()); + System.out.println("# Expected loggers are: " + expectedLoggerNames); + System.out.println("# Returned loggers are: " + returnedLoggerNames); return checkNames(expectedLoggerNames, returnedLoggerNames, failMsg); } From d97ea5a8cdd6cb033e7849515425880e9132b3f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Jeli=C5=84ski?= Date: Tue, 10 Feb 2026 14:48:52 +0000 Subject: [PATCH 048/120] 8377549: [BACKOUT] Need to keep leading zeros in TlsPremasterSecret of TLS1.3 DHKeyAgreement Reviewed-by: mullan --- .../share/classes/sun/security/ssl/KAKeyDerivation.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/java.base/share/classes/sun/security/ssl/KAKeyDerivation.java b/src/java.base/share/classes/sun/security/ssl/KAKeyDerivation.java index af62faf4706..39e82b50435 100644 --- a/src/java.base/share/classes/sun/security/ssl/KAKeyDerivation.java +++ b/src/java.base/share/classes/sun/security/ssl/KAKeyDerivation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -214,13 +214,13 @@ public class KAKeyDerivation implements SSLKeyDerivation { var decapsulator = kem.newDecapsulator(localPrivateKey); sharedSecret = decapsulator.decapsulate( keyshare, 0, decapsulator.secretSize(), - "Generic"); + "TlsPremasterSecret"); } else { // Using traditional DH-style Key Agreement KeyAgreement ka = KeyAgreement.getInstance(algorithmName); ka.init(localPrivateKey); ka.doPhase(peerPublicKey, true); - sharedSecret = ka.generateSecret("Generic"); + sharedSecret = ka.generateSecret("TlsPremasterSecret"); } return deriveHandshakeSecret(type, sharedSecret); From 43b2d2bddf8d7c308c8d2782456cb3ab3a33993e Mon Sep 17 00:00:00 2001 From: Anton Artemov Date: Tue, 10 Feb 2026 16:41:42 +0000 Subject: [PATCH 049/120] 8375285: Port fdlibm asinh to Java Reviewed-by: darcy, rgiulietti --- .../share/classes/java/lang/FdLibm.java | 55 ++- .../share/classes/java/lang/Math.java | 31 +- .../share/classes/java/lang/StrictMath.java | 30 +- test/jdk/java/lang/Math/HyperbolicTests.java | 346 +++++++++++++++++- .../java/lang/StrictMath/ExhaustingTests.java | 4 +- .../java/lang/StrictMath/FdlibmTranslit.java | 46 ++- .../java/lang/StrictMath/HyperbolicTests.java | 87 ++++- 7 files changed, 586 insertions(+), 13 deletions(-) diff --git a/src/java.base/share/classes/java/lang/FdLibm.java b/src/java.base/share/classes/java/lang/FdLibm.java index 73e1da46af4..78090be2b05 100644 --- a/src/java.base/share/classes/java/lang/FdLibm.java +++ b/src/java.base/share/classes/java/lang/FdLibm.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -3508,4 +3508,57 @@ final class FdLibm { return iz; } } + + /** + * Return the Inverse Hyperbolic Sine of x + * + * Method : + * + * + * asinh(x) is defined so that asinh(sinh(alpha)) = alpha, -∞ < alpha < ∞ + * and sinh(asinh(x)) = x, -∞ < x < ∞ + * It can be written as asinh(x) = sign(x) * ln(|x| + sqrt(x^2 + 1)), -∞ < x < ∞ + * 1. Replace x by |x| as the function is odd. + * 2. + * asinh(x) := x, if 1+x^2 = 1, + * := sign(x)*(log(x)+ln2)) for large |x|, else + * := sign(x)*log(2|x|+1/(|x|+sqrt(x*x+1))) if|x|>2, else + * := sign(x)*log1p(|x| + x^2/(1 + sqrt(1+x^2))) + * + * + * + * Special cases: + * only asinh(±0)=±0 is exact for finite x. + * asinh(NaN) is NaN + * asinh(±∞) is ±∞ + */ + static final class Asinh { + private static final double ln2 = 6.93147180559945286227e-01; + private static final double huge = 1.0e300; + + static double compute(double x) { + double t, w; + int hx, ix; + hx = __HI(x); + ix = hx & 0x7fff_ffff; + if (ix >= 0x7ff0_0000) { + return x + x; // x is inf or NaN + } + if (ix < 0x3e30_0000) { // |x| < 2**-28 + if (huge + x > 1.0) { + return x; // return x inexact except 0 + } + } + if (ix > 0x41b0_0000) { // |x| > 2**28 + w = Log.compute(Math.abs(x)) + ln2; + } else if (ix > 0x4000_0000) { // 2**28 > |x| > 2.0 + t = Math.abs(x); + w = Log.compute(2.0 * t + 1.0 / (Sqrt.compute(x * x + 1.0) + t)); + } else { // 2.0 > |x| > 2**-28 + t = x * x; + w = Log1p.compute(Math.abs(x) + t / (1.0 + Sqrt.compute(1.0 + t))); + } + return hx > 0 ? w : -w; + } + } } diff --git a/src/java.base/share/classes/java/lang/Math.java b/src/java.base/share/classes/java/lang/Math.java index 55659bed57b..7add99f9325 100644 --- a/src/java.base/share/classes/java/lang/Math.java +++ b/src/java.base/share/classes/java/lang/Math.java @@ -108,8 +108,8 @@ import static java.lang.Double.*; * sin}, {@link cos cos}, {@link tan tan}, {@link asin asin}, {@link * acos acos}, {@link atan atan}, {@link exp exp}, {@link expm1 * expm1}, {@link log log}, {@link log10 log10}, {@link log1p log1p}, - * {@link sinh sinh}, {@link cosh cosh}, {@link tanh tanh}, {@link - * hypot hypot}, and {@link pow pow}. (The {@link sqrt sqrt} + * {@link sinh sinh}, {@link cosh cosh}, {@link tanh tanh}, {@link asinh asinh}, + * {@link hypot hypot}, and {@link pow pow}. (The {@link sqrt sqrt} * operation is a required part of IEEE 754 from a different section * of the standard.) The special case behavior of the recommended * operations generally follows the guidance of the IEEE 754 @@ -2758,6 +2758,33 @@ public final class Math { return StrictMath.tanh(x); } + /** + * Returns the inverse hyperbolic sine of a {@code double} value. + * The inverse hyperbolic sine of x is defined to be the function such that + * asinh({@linkplain Math#sinh sinh(x)}) = x for any x. + * Note that both domain and range of the exact asinh are unrestricted. + *

Special cases: + *

    + * + *
  • If the argument is zero, then the result is a zero with the + * same sign as the argument. + * + *
  • If the argument is infinity, then the result is + * infinity with the same sign as the argument. + * + *
  • If the argument is NaN, then the result is NaN. + * + * + *
+ *

The computed result must be within 2.5 ulps of the exact result. + * @param x The number whose inverse hyperbolic sine is to be returned. + * @return The inverse hyperbolic sine of {@code x}. + * @since 27 + */ + public static double asinh(double x) { + return StrictMath.asinh(x); + } + /** * Returns sqrt(x2 +y2) * without intermediate overflow or underflow. diff --git a/src/java.base/share/classes/java/lang/StrictMath.java b/src/java.base/share/classes/java/lang/StrictMath.java index 499fce73aee..9540c4b05b4 100644 --- a/src/java.base/share/classes/java/lang/StrictMath.java +++ b/src/java.base/share/classes/java/lang/StrictMath.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -76,7 +76,8 @@ import jdk.internal.vm.annotation.IntrinsicCandidate; * {@code exp}, {@code log}, {@code log10}, * {@code cbrt}, {@code atan2}, {@code pow}, * {@code sinh}, {@code cosh}, {@code tanh}, - * {@code hypot}, {@code expm1}, and {@code log1p}. + * {@code asinh}, {@code hypot}, {@code expm1}, + * and {@code log1p}. * *

* The platform uses signed two's complement integer arithmetic with @@ -2170,6 +2171,31 @@ public final class StrictMath { return FdLibm.Tanh.compute(x); } + /** + * Returns the inverse hyperbolic sine of a {@code double} value. + * The inverse hyperbolic sine of x is defined to be the function such that + * asinh({@linkplain Math#sinh sinh(x)}) = x for any x. + * Note that both domain and range of the exact asinh are unrestricted. + *

Special cases: + *

    + * + *
  • If the argument is zero, then the result is a zero with the + * same sign as the argument. + * + *
  • If the argument is infinity, then the result is + * infinity with the same sign as the argument. + * + *
  • If the argument is NaN, then the result is NaN. + * + *
+ * @param x The number whose inverse hyperbolic sine is to be returned. + * @return The inverse hyperbolic sine of {@code x}. + * @since 27 + */ + public static double asinh(double x) { + return FdLibm.Asinh.compute(x); + } + /** * Returns sqrt(x2 +y2) * without intermediate overflow or underflow. diff --git a/test/jdk/java/lang/Math/HyperbolicTests.java b/test/jdk/java/lang/Math/HyperbolicTests.java index 4534396ee06..6f4fad94f6b 100644 --- a/test/jdk/java/lang/Math/HyperbolicTests.java +++ b/test/jdk/java/lang/Math/HyperbolicTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved. * 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 @@ * @build Tests * @build HyperbolicTests * @run main HyperbolicTests - * @summary Tests for {Math, StrictMath}.{sinh, cosh, tanh} + * @summary Tests for {Math, StrictMath}.{sinh, cosh, tanh, asinh} */ import static java.lang.Double.longBitsToDouble; @@ -43,6 +43,7 @@ public class HyperbolicTests { failures += testSinh(); failures += testCosh(); failures += testTanh(); + failures += testAsinh(); if (failures > 0) { System.err.println("Testing the hyperbolic functions incurred " @@ -1390,4 +1391,345 @@ public class HyperbolicTests { failures += Tests.testUlpDiffWithAbsBound("StrictMath.tanh", -input, StrictMath::tanh, -expected, ulps, 1.0); return failures; } + + /** + * Test accuracy of {Math, StrictMath}.asinh. The specified + * accuracy is 2.5 ulps. + * + * The defintion of asinh(x) is + * + * asinh(sinh(x)) = x + * + * Can be also written as + * + * asinh(x) = ln(x + sqrt(x*x + 1)) + * + * The series expansion of asinh(x) = + * + * x - x^3/6 + 3x^5/40 - 15x^7/336 + ... + * + * Therefore, + * + * 1. For small values of x, asinh(x) ~= x. + * + * Additionally, asinh is an odd function; asinh(-x) = -asinh(x). + * + */ + static int testAsinh() { + int failures = 0; + /* + * Array elements below generated using a quad asinh + * implementation. Rounded to a double, the quad result + * *should* be correctly rounded, unless we are quite unlucky. + * Assuming the quad value is a correctly rounded double, the + * allowed error is 3.0 ulps instead of 2.5 since the quad + * value rounded to double can have its own 1/2 ulp error. + */ + double [][] testCases = { + // x asinh(x) + {+8.08576586004706676646947016706690192e+00 , +2.78705446940175084037519072068240843e+00 }, + {+5.71198448718283557923314219806343317e+00 , +2.44328951112537869179362382769224610e+00 }, + {+5.13969133196956207143557548988610506e+00 , +2.33947242588811531576718987896918712e+00 }, + {+2.95996078504353032911922127823345363e+00 , +1.80570832446450945675615676944433187e+00 }, + {+4.16200980791957864113328469102270901e+00 , +2.13327472868053919998765640756092875e+00 }, + {+3.69545071772785460595400763850193471e+00 , +2.01807302682646291458685219028816252e+00 }, + {+1.37724078256330018099617973348358646e+00 , +1.12468193910119796648577714130477538e+00 }, + {+8.42544369040329677034151245607063174e+00 , +2.82790657643842246518401899587920414e+00 }, + {+3.91229039061375782893037467147223651e+00 , +2.07321736531667549827684130235156669e+00 }, + {+5.73782778462038400846267904853448272e+00 , +2.44773637486997939825874893068408245e+00 }, + {+4.99855755102017340618658636230975389e+00 , +2.31215541451092776291779112133540281e+00 }, + {+8.10100320171622989562365546589717269e+00 , +2.78892295229049846951081695322303143e+00 }, + {+6.40711498894297992734436775208450854e+00 , +2.55659134739804960225496541857063844e+00 }, + {+4.25639664782793492037171745323576033e+00 , +2.15509221067754853744881157535735520e+00 }, + {+2.65061122655180847473843641637358814e+00 , +1.70175906719364776650786532519668576e+00 }, + {+3.14233404262031967846269253641366959e+00 , +1.86252059324271515969573278167449533e+00 }, + {+9.13083295141416328988270834088325500e+00 , +2.90778930976529177537743330080053959e+00 }, + {+9.34996922888940673601609887555241585e+00 , +2.93136773795688457445658002134152253e+00 }, + {+9.35132773574746245515143527882173657e+00 , +2.93151219897178112284587212807769745e+00 }, + {+1.47453686867873412502660812606336549e+00 , +1.18055530917929730380021873702412893e+00 }, + {+2.93708318858647077220780374773312360e+00 , +1.79836038745797816082436481350298220e+00 }, + {+4.09105467685985679793247982161119580e+00 , +2.11656320434131763040467250984368994e+00 }, + {+4.65121160775030162426446622703224421e+00 , +2.24163561547669988062740649953739512e+00 }, + {+8.83128600332669755346159945474937558e+00 , +2.87463799399744068863572725409458990e+00 }, + {+1.66240543263013162977870251779677346e+00 , +1.28160121300334421559587040333022048e+00 }, + {+4.58372145493984728403802364482544363e+00 , +2.22735027800562207352532152241704895e+00 }, + {+8.50271775332108248335316602606326342e+00 , +2.83697322459569158510957272430255446e+00 }, + {+8.82962635800362249938189052045345306e+00 , +2.87445124207064977822740131999732509e+00 }, + {+8.84552264926561093716372852213680744e+00 , +2.87623855339831018046947582541398439e+00 }, + {+3.12516324361785047258877057174686342e+00 , +1.85730059825198435603813107760370448e+00 }, + {+8.26480987017928114823916985187679529e+00 , +2.80879391905067271939218423695889677e+00 }, + {+9.68117403887023186825899756513535976e+00 , +2.96598712423961990106836581021055404e+00 }, + {+3.05372997660021550103692788979969919e+00 , +1.83530180662998049991392377010746750e+00 }, + {+4.40157829954937795946534606628119946e+00 , +2.18777148553475610871290743261274356e+00 }, + {+6.88055177977352627749496605247259140e+00 , +2.62708540897893209827881652490154282e+00 }, + {+5.98475681846005524988640900119207799e+00 , +2.48927078678959642161006322827411013e+00 }, + {+8.92994029487849694248779996996745467e+00 , +2.88567728733406656162446662917506943e+00 }, + {+3.12419716639021327608816136489622295e+00 , +1.85700613402604977963039277274730202e+00 }, + {+7.51161063055123179310612613335251808e+00 , +2.71399864345854847918135863803957037e+00 }, + {+1.17944590788822001314883891609497368e+00 , +1.00274792631001937429660854217557106e+00 }, + {+1.36421200272156672994583459512796253e+00 , +1.11700316010328101318941761315262905e+00 }, + {+6.88888479910741580169997178018093109e+00 , +2.62828320452398770553274423944254222e+00 }, + {+3.64699814082431839068476620013825595e+00 , +2.00533888971591775569462526134655508e+00 }, + {+1.41057156993997545590957543026888743e+00 , +1.14411132290221221244416446367286189e+00 }, + {+6.14945472638136703125155690941028297e+00 , +2.51605697935151660544323868421618014e+00 }, + {+6.02996213994895136067952989833429456e+00 , +2.49669366977555745163814756818745494e+00 }, + {+9.65271660518461160904735152143985033e+00 , +2.96305895992701909105343212587439308e+00 }, + {+3.48339981002946785793028539046645164e+00 , +1.96115002199047863383320140967526859e+00 }, + {+6.07995920803143352628694628947414458e+00 , +2.50484056235894688250578712446408489e+00 }, + {+6.00204567486939666309808671940118074e+00 , +2.49211610375224051369293822349155577e+00 }, + {+1.38833519546032624347731143643613905e+00 , +1.13118326188543957732445742827584178e+00 }, + {+4.52480967383013776839106867555528879e+00 , +2.21471559269073802833304398595496088e+00 }, + {+6.11810275538071746126433936296962202e+00 , +2.51101220932060589427300910397289711e+00 }, + {+7.50648056792778461954185331705957651e+00 , +2.71332143777867740825109248925661428e+00 }, + {+4.89658239129396388733539424720220268e+00 , +2.29195213807282224382341089459270833e+00 }, + {+2.79265817118974496446881516931171063e-02 , +2.79229530231546570990366385479747555e-02 }, + {+9.69315108025863381158160336781293154e+00 , +2.96721697176250274577477693915618144e+00 }, + {+7.83910637998812109827895255875773728e+00 , +2.75631566551255789285879320458504177e+00 }, + {+2.76576984498692324265789466153364629e+00 , +1.74165321687466923031477628544545184e+00 }, + {+4.99754435738235347486124737770296633e+00 , +2.31195663638515281361584735869808938e+00 }, + {+4.88922334987356776991873630322515965e+00 , +2.29047857490944287858591282873426921e+00 }, + {+2.78689754339832429508305722265504301e+00 , +1.74881289991707628903792141369254180e+00 }, + {+7.20931795462930935514123120810836554e+00 , +2.67329726418547732793921189411944602e+00 }, + {+8.33063517511005890980868571205064654e+00 , +2.81666990685356361031034871477442414e+00 }, + {+3.61188437237348836106320959515869617e+00 , +1.99601167970722876532263572785839092e+00 }, + {+5.32263649620131218398455530405044556e+00 , +2.37382580077770566473979021057511520e+00 }, + {+8.00366962656528002639788610395044088e+00 , +2.77692733912554343763823757722995583e+00 }, + {+4.59751681469834139193153532687574625e+00 , +2.23028654083102682106197643909523811e+00 }, + {+8.20253764279967612083055428229272366e+00 , +2.80128593985583624900402694440723735e+00 }, + {+8.81590969774593169461240904638543725e+00 , +2.87290644386803298326256037256286587e+00 }, + {+9.00323408655057377814046049024909735e+00 , +2.89380106762776953348709842638973283e+00 }, + {+7.21533058010746941590696224011480808e+00 , +2.67412302459536699184126235350224069e+00 }, + {+8.23695914498319758934030687669292092e+00 , +2.80544295419888555964661400747277886e+00 }, + {+9.66912482942344198022510681767016649e+00 , +2.96474834621717039972248353595994898e+00 }, + {+3.17602315814959101913927952409721911e+00 , +1.87268737666193382172385150977422494e+00 }, + {+6.90930101488594594627556944033131003e+00 , +2.63121186253032074408677485367709385e+00 }, + {+6.52386312488162189993090578354895115e+00 , +2.57443674633460769002260368508028529e+00 }, + {+8.33701897902340283152966549096163362e-01 , +7.58769250678348128717944053061372995e-01 }, + {+1.84073794668312284983358040335588157e+00 , +1.37005541332928719568137972151743439e+00 }, + {+3.74278586498477183752697783347684890e+00 , +2.03036413719335448282150464654423886e+00 }, + {+1.24005876679504356552286026271758601e+00 , +1.04136768247874493368196676622778561e+00 }, + {+5.46039591734140294931876269401982427e+00 , +2.39894972726732001224686289699275119e+00 }, + {+2.05576175637293001585703677847050130e+00 , +1.46829835554351749799178251325101620e+00 }, + {+8.14075272140118322283797169802710414e+00 , +2.79378100004325258561034629239868920e+00 }, + {+1.83236824312878154863426516385516152e+00 , +1.36605297794115641494849841805273118e+00 }, + {+3.75374287549383511830569659650791436e+00 , +2.03318857169224539730556063537088565e+00 }, + {+6.43073501869452779367009043198777363e-01 , +6.05407648939611618428355730173212664e-01 }, + {+3.48621711345758855671306264412123710e+00 , +1.96192711264291527976588288592889484e+00 }, + {+3.91549582965699016767757711932063103e+00 , +2.07401086477835132988304884524188567e+00 }, + {+8.71307615958979297943187702912837267e+00 , +2.86124897639861530832907097356321837e+00 }, + {+9.25125528837059185605085076531395316e+00 , +2.92081476128803069384228991876733421e+00 }, + {+1.39894257949993688905365729624463711e-01 , +1.39441932379308919610017101598940231e-01 }, + {+2.13018467023163493578863381117116660e+00 , +1.50038473636497909802939352641033551e+00 }, + {+9.11338663647286573166184098226949573e+00 , +2.90588816775704749530976417485641794e+00 }, + {+2.13672753800762960096903952944558114e+00 , +1.50316162138023144213989303271149548e+00 }, + {+1.84662954052762628975870029535144567e+00 , +1.37286438673796624203424974151164008e+00 }, + {+2.27538767726088808629469895095098764e+00 , +1.56042056675324794384613128836997008e+00 }, + {+2.25459809157452584216230206948239356e+00 , +1.55202382694053013875493092338973536e+00 }, + {+6.43951067826539436111943359719589353e+00 , +2.56157478187883218395455558699771338e+00 }, + {+2.38928979360439708301555583602748811e+00 , +1.60531075239512338397498990117642106e+00 } + }; + + + for (double [] testCase : testCases) { + failures += testAsinhCaseWithUlpDiff(testCase[0], + testCase[1], + 3.0); + } + + + + for (double nan : Tests.NaNs) { + failures += testAsinhCaseWithUlpDiff(nan, NaNd, 0); + } + + + + double [][] specialTestCases = { + {0.0, 0.0}, + {-0.0, -0.0}, + {Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY}, + {Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY} + }; + + + + for (double [] specialTestCase : specialTestCases) { + failures += testAsinhCaseWithUlpDiff(specialTestCase[0], + specialTestCase[1], + 0.0); + } + + + + // For powers of 2 less than 2^(-27), the second and + // subsequent terms of the Taylor series expansion will get + // rounded away since |n-n^3| > 53, the binary precision of a + // double significand. + + for (int i = DoubleConsts.MIN_SUB_EXPONENT; i < -27; i++) { + double d = Math.scalb(2.0, i); + + // Result and expected are the same. + failures += testAsinhCaseWithUlpDiff(d, d, 3.0); + } + + failures += testAsinhAdditionalTests(); + + return failures; + } + + /** + * Test accuracy of {Math, StrictMath}.asinh using quad precision + * asinh implementation as the reference. There are additional tests. + * The specified accuracy is 2.5 ulps. + * + */ + static int testAsinhAdditionalTests() { + int failures = 0; + /* + * Array elements below are generated using a quad precision asinh + * implementation (libquadmath). Rounded to a double, the quad result + * *should* be correctly rounded, unless we are quite unlucky. + * Assuming the quad value is a correctly rounded double, the + * allowed error is 3.0 ulps instead of 2.5 since the quad + * value rounded to double can have its own 1/2 ulp error. + */ + double[][] testCases = { + // x asinh(x) + {+9.29888520047217510822168407003118773e-03 , +9.29875119439016991620829879950089510e-03 }, + {+8.99606577522583765460506555200481671e-03 , +8.99594443891109052619951669093253709e-03 }, + {+1.14699795207729403345719987328266143e-03 , +1.14699770057820289010729363443748979e-03 }, + {-7.40424146583510897623447988280531717e-03 , -7.40417381397284073003520743847398090e-03 }, + {+5.49488608694304568602628791040842771e-03 , +5.49485843542812296005405619611903743e-03 }, + {-2.52116366329231764847884633695684897e-03 , -2.52116099243538701654807174519941378e-03 }, + {+8.06768422999586641564118139058336965e-03 , +8.06759671495411237747532966838824601e-03 }, + {+9.88178277836134454081840061689945287e-03 , +9.88162196002118907735979091611455166e-03 }, + {-9.74812907680771244256501262270830921e-03 , -9.74797469575697378811862965186905034e-03 }, + {+1.28957646989550853144912423431378556e-03 , +1.28957611246655855199674391222106077e-03 }, + {-3.58837408582282288427300898092653370e-03 , -3.58836638496033900344918006245058062e-03 }, + {+4.13062959563161372078532451723731356e-03 , +4.13061784951867272487598247250853139e-03 }, + {-2.51244549635140212301420703511212196e-03 , -2.51244285310613342444371438470610248e-03 }, + {+9.68636675928437156091188597883956390e-03 , +9.68621529398750501339156647788267837e-03 }, + {-5.46432162869262862125996349504930549e-03 , -5.46429443603366704988023092426655825e-03 }, + {-1.83386276898741575058782160567716346e-03 , -1.83386174109279550088776833959567103e-03 }, + {+4.29194713096967862819841599275605404e-03 , +4.29193395422167505495925421977757693e-03 }, + {-9.98345193989031744197237827620483586e-03 , -9.98328610669592860197569944928865818e-03 }, + {-2.77682511858849418590056146172173612e-03 , -2.77682155002991423153566829770018797e-03 }, + {-9.27080565792574341765774903478813940e-03 , -9.27067286211199059124030266083673465e-03 }, + {+2.13343832085455265001883162767626345e-03 , +2.13343670244611127381061946915639278e-03 }, + {+1.86531796573603282640707590189776965e-03 , +1.86531688403638317794548160776476123e-03 }, + {+7.59089952706850680519412577496041195e-03 , +7.59082662879913430594165031269929038e-03 }, + {-7.23221864571126256404642873576449347e-03 , -7.23215560034534649276205014022842148e-03 }, + {-4.85379569260787659124023463164121495e-03 , -4.85377663411205855718020189862812411e-03 }, + {+2.06427745583616026325834980070794700e-03 , +2.06427598977487382238201754110142048e-03 }, + {-9.05864273164906988466960058303811820e-03 , -9.05851884568408865775918913306811448e-03 }, + {+8.14126659074132334736884075709895114e-03 , +8.14117665926450847350600785486541236e-03 }, + {-1.18703607276676031956341716977476608e-03 , -1.18703579400048976745061906381442506e-03 }, + {-3.72556727069004237073990282169688726e-03 , -3.72555865235713390047416035972567655e-03 }, + {+3.20078632768614965153908258344017668e-03 , +3.20078086235102579132641956617880741e-03 }, + {-3.64652695868728470018904630478573381e-03 , -3.64651887732759812624780495337361570e-03 }, + {-4.37271109890237635181575726051050879e-03 , -4.37269716421058504020032749615645348e-03 }, + {-4.53954699201700607319454050525564526e-03 , -4.53953140071906668014572342681250395e-03 }, + {-7.71410922638161335174178390161614516e-03 , -7.71403272056205844933819193169521112e-03 }, + {-4.14748385016995048391041933655287721e-03 , -4.14747195968688563991362285984749351e-03 }, + {+2.16239643776180469336711809091866598e-03 , +2.16239475255273602474341490749538226e-03 }, + {+1.70867505939914857138184345330955693e-04 , +1.70867505108481996929933792720554316e-04 }, + {+4.45468038573873341412490134416657384e-03 , +4.45466565262570403928813346774794963e-03 }, + {+5.02848450175214997659445259614585666e-04 , +5.02848428983795534702560585886961806e-04 }, + {+3.27121347478520618778929929248988628e-03 , +3.27120764069260936386068328808026876e-03 }, + {-3.02035237923277844612757192521712568e-03 , -3.02034778704318937598236175985252813e-03 }, + {+1.83493544153568409471599665039320826e-03 , +1.83493441183628601773262459027151432e-03 }, + {-3.57742891707456961425393160425301176e-03 , -3.57742128646403200576149317708586166e-03 }, + {+4.07461518018882584701856330866576172e-04 , +4.07461506744091232910512108590665082e-04 }, + {+8.93213245095503781401102827430804609e-03 , +8.93201368317984717551252673740071605e-03 }, + {+4.83633433470810093768310622408534982e-03 , +4.83631548115857258701091393657125083e-03 }, + {+4.41941080408745669283465673515820527e-03 , +4.41939641815384450220145838057678415e-03 }, + {-7.40905574125878471636319488879962591e-03 , -7.40898795735011644277922058251845971e-03 }, + {+5.86417821400006013254913028731607483e-03 , +5.86414460438723375893640532030031887e-03 }, + {+6.40143962390532852979596611930901418e-04 , +6.40143918670384118303282950462728667e-04 }, + {-6.62414482978957927516994175221043406e-03 , -6.62409638694556116425732364897473820e-03 }, + {+2.32034013904017406837443360245742952e-03 , +2.32033805693503550464566970496041304e-03 }, + {-1.70037238711657177903102677873903303e-03 , -1.70037156774608724006177273975196346e-03 }, + {-2.41007559448008345376335270771051000e-03 , -2.41007326134647811152942503146226815e-03 }, + {-4.88371906557288470301925187300184916e-03 , -4.88369965241849364892773140816442366e-03 }, + {+5.45353417327115556900718473798406194e-03 , +5.45350714134116714399404074418610335e-03 }, + {+1.82127472834406854695910027430727496e-03 , +1.82127372147155402291508536733347481e-03 }, + {+3.08464771244317328968698177504847990e-03 , +3.08464282070047297125571891308421168e-03 }, + {+8.64099586698139320029010690404902562e-03 , +8.64088833799551442516038310825829002e-03 }, + {+5.55586600363066999974659410099775414e-03 , +5.55583742127587993316327594170344732e-03 }, + {+8.72688321697448303460031837630594964e-03 , +8.72677244972821936872995155020997092e-03 }, + {+8.67310115846320860144569309113649069e-03 , +8.67299242648623772707657889109267822e-03 }, + {-6.14210531791088872044515056813906995e-03 , -6.14206669961072319996743834488437463e-03 }, + {+8.88625749891074935560286718327915878e-03 , +8.88614055166480866111859091126682642e-03 }, + {-1.43504119833010382323301712403917918e-03 , -1.43504070579016156191011766070535043e-03 }, + {+8.88630021979499445938799340183322784e-04 , +8.88629905026452701546356648558325925e-04 }, + {+3.93780142608554303840229238176107174e-03 , +3.93779124938125782164719425287579139e-03 }, + {+5.97434710953371854447180311353804427e-03 , +5.97431156988517485964304752157241804e-03 }, + {-7.98875566707221360096546902695990866e-03 , -7.98867069549231529699110336543851522e-03 }, + {-7.35260998042218307663153709086145682e-03 , -7.35254373394740372183361138755444401e-03 }, + {-1.21452151194481779150624589647122775e-03 , -1.21452121336249242914680975845323467e-03 }, + {+4.98481949753720385287714123023761204e-04 , +4.98481929109570105039386663388380124e-04 }, + {+4.91985816350236880578616904813316069e-03 , +4.91983831618717601288972307767102048e-03 }, + {+7.68796449908712258014542584305672790e-03 , +7.68788876850302034489862036714171394e-03 }, + {-1.49188964399755812084702455422302592e-03 , -1.49188909057301843050666760106824645e-03 }, + {-6.73163270527497858974896871586679481e-03 , -6.73158186579155909561057079482268382e-03 }, + {+8.73326787816911150053034162965559517e-03 , +8.73315686763575988088834491175495305e-03 }, + {+7.81885100909627574206073319373899722e-03 , +7.81877134445315065535398733750043537e-03 }, + {+5.17883696377165365920536288513176260e-03 , +5.17881381434573686588090532152532759e-03 }, + {+5.94443020139156542980263253639350296e-03 , +5.94439519296920978949883610708856872e-03 }, + {+6.20408692607689153664107806207539397e-03 , +6.20404712683039987243003869674263039e-03 }, + {-4.13924636982772493898341537033047643e-03 , -4.13923455005213957426577773895357676e-03 }, + {-3.71140287747976152510354097557865316e-03 , -3.71139435707241790669973810798603847e-03 }, + {-8.37941685260259506995428324671593145e-03 , -8.37931879609631048090526043629803007e-03 }, + {+8.48517293301665094518160259440264781e-03 , +8.48507111684271940482025173385456325e-03 }, + {+8.52827781082153742187035305732933921e-03 , +8.52817443510010657036791986083451790e-03 }, + {-4.07416024108964158756407414330169559e-03 , -4.07414897015777394146227881635448891e-03 }, + {+4.33240979016216026797891913702187594e-03 , +4.33239623721743479728849041379241354e-03 }, + {-4.89052581083683143847729013486969052e-04 , -4.89052561589036445343259711601066150e-04 }, + {-9.62974650385375885441874288517283276e-05 , -9.62974648897066185792218187524452666e-05 }, + {-9.26529020589744040092838872624270152e-04 , -9.26528888025725086174151901318195528e-04 }, + {+1.39965317129459553002757132844635635e-03 , +1.39965271430147299997462291249440004e-03 }, + {-7.12079193844885119379917171045235591e-03 , -7.12073176239158986696262840488189056e-03 }, + {-3.62621830991397085114380516301935131e-03 , -3.62621036282602413990843595245483708e-03 }, + {-7.11170226471406416446363607519742800e-03 , -7.11164231880305326913177834599584014e-03 }, + {-1.07788116725225993630665755063091638e-04 , -1.07788116516507275261580974984359313e-04 }, + {-2.51343271020868386927960003163207148e-03 , -2.51343006384636979438035563375611134e-03 }, + {-9.70989675056706420808172453007500735e-03 , -9.70974417880563379443605277365308469e-03 }, + {+7.17488567146307328059595675995296915e-03 , +7.17482411358449384368065167506580475e-03 } + }; + + for (int i = 0; i < testCases.length; i++) { + double[] testCase = testCases[i]; + failures += testAsinhCaseWithUlpDiff(testCase[0], + testCase[1], + 3.0); + } + + return failures; + } + + public static int testAsinhCaseWithTolerance(double input, + double expected, + double tolerance) { + int failures = 0; + failures += Tests.testTolerance("Math.asinh", input, Math::asinh, expected, tolerance); + failures += Tests.testTolerance("Math.asinh", -input, Math::asinh, -expected, tolerance); + + failures += Tests.testTolerance("StrictMath.asinh", input, StrictMath::asinh, expected, tolerance); + failures += Tests.testTolerance("StrictMath.asinh", -input, StrictMath::asinh, -expected, tolerance); + return failures; + } + + public static int testAsinhCaseWithUlpDiff(double input, + double expected, + double ulps) { + int failures = 0; + + failures += Tests.testUlpDiffWithAbsBound("Math.asinh", input, Math::asinh, expected, ulps, Double.POSITIVE_INFINITY); + failures += Tests.testUlpDiffWithAbsBound("Math.asinh", -input, Math::asinh, -expected, ulps, Double.NEGATIVE_INFINITY); + + failures += Tests.testUlpDiffWithAbsBound("StrictMath.asinh", input, StrictMath::asinh, expected, ulps, Double.POSITIVE_INFINITY); + failures += Tests.testUlpDiffWithAbsBound("StrictMath.asinh", -input, StrictMath::asinh, -expected, ulps, Double.NEGATIVE_INFINITY); + return failures; + } } diff --git a/test/jdk/java/lang/StrictMath/ExhaustingTests.java b/test/jdk/java/lang/StrictMath/ExhaustingTests.java index 0351caff70c..143227c4cc3 100644 --- a/test/jdk/java/lang/StrictMath/ExhaustingTests.java +++ b/test/jdk/java/lang/StrictMath/ExhaustingTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -91,6 +91,8 @@ public class ExhaustingTests { new UnaryTestCase("asin", FdlibmTranslit::asin, StrictMath::asin, DEFAULT_SHIFT), new UnaryTestCase("acos", FdlibmTranslit::acos, StrictMath::acos, DEFAULT_SHIFT), new UnaryTestCase("atan", FdlibmTranslit::atan, StrictMath::atan, DEFAULT_SHIFT), + + new UnaryTestCase("asinh", FdlibmTranslit::asinh, StrictMath::asinh, DEFAULT_SHIFT), }; for (var testCase : testCases) { diff --git a/test/jdk/java/lang/StrictMath/FdlibmTranslit.java b/test/jdk/java/lang/StrictMath/FdlibmTranslit.java index f38ca68569b..3001fed911f 100644 --- a/test/jdk/java/lang/StrictMath/FdlibmTranslit.java +++ b/test/jdk/java/lang/StrictMath/FdlibmTranslit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -140,6 +140,10 @@ public class FdlibmTranslit { return Tanh.compute(x); } + public static double asinh(double x) { + return Asinh.compute(x); + } + public static double IEEEremainder(double f1, double f2) { return IEEEremainder.compute(f1, f2); } @@ -2752,4 +2756,44 @@ public class FdlibmTranslit { return x; /* exact output */ } } + + /* + * Return the Inverse Hyperbolic Sine of x + * + * Method : + * + * Based on + * asinh(x) = sign(x) * log [ |x| + sqrt(x*x+1) ] + * we have + * asinh(x) := x if 1+x*x=1, + * := sign(x)*(log(x)+ln2)) for large |x|, else + * := sign(x)*log(2|x|+1/(|x|+sqrt(x*x+1))) if|x|>2, else + * := sign(x)*log1p(|x| + x^2/(1 + sqrt(1+x^2))) + */ + private static final class Asinh { + private static final double one = 1.0; + private static final double ln2 = 6.93147180559945286227e-01; + private static final double huge = 1.0e300; + + static double compute(double x) { + double t,w; + int hx,ix; + hx = __HI(x); + ix = hx&0x7fffffff; + if(ix>=0x7ff00000) return x+x; /* x is inf or NaN */ + if(ix< 0x3e300000) { /* |x|<2**-28 */ + if(huge+x>one) return x; /* return x inexact except 0 */ + } + if(ix>0x41b00000) { /* |x| > 2**28 */ + w = log(Math.abs(x))+ln2; + } else if (ix>0x40000000) { /* 2**28 > |x| > 2.0 */ + t = Math.abs(x); + w = log(2.0*t+one/(sqrt(x*x+one)+t)); + } else { /* 2.0 > |x| > 2**-28 */ + t = x*x; + w =log1p(Math.abs(x)+t/(one+sqrt(one+t))); + } + if(hx>0) return w; else return -w; + } + } } diff --git a/test/jdk/java/lang/StrictMath/HyperbolicTests.java b/test/jdk/java/lang/StrictMath/HyperbolicTests.java index 1f570ce9efd..6dbf3cd90ee 100644 --- a/test/jdk/java/lang/StrictMath/HyperbolicTests.java +++ b/test/jdk/java/lang/StrictMath/HyperbolicTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved. * 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.DoubleUnaryOperator; /* * @test - * @bug 4851625 8301444 + * @bug 4851625 8301444 8331354 * @key randomness * @library /test/lib * @build jdk.test.lib.RandomFactory @@ -34,7 +34,7 @@ import java.util.function.DoubleUnaryOperator; * @build FdlibmTranslit * @build HyperbolicTests * @run main HyperbolicTests - * @summary Tests for StrictMath.{sinh, cosh, tanh} + * @summary Tests for StrictMath.{sinh, cosh, tanh, asinh} */ /** @@ -64,6 +64,7 @@ public class HyperbolicTests { failures += testSinh(); failures += testCosh(); failures += testTanh(); + failures += testAsinh(); if (failures > 0) { System.err.println("Testing the hyperbolics incurred " @@ -78,7 +79,8 @@ public class HyperbolicTests { private static enum HyperbolicTest { SINH(HyperbolicTests::testSinhCase, FdlibmTranslit::sinh), COSH(HyperbolicTests::testCoshCase, FdlibmTranslit::cosh), - TANH(HyperbolicTests::testTanhCase, FdlibmTranslit::tanh); + TANH(HyperbolicTests::testTanhCase, FdlibmTranslit::tanh), + ASINH(HyperbolicTests::testAsinhCase, FdlibmTranslit::asinh); private DoubleDoubleToInt testCase; private DoubleUnaryOperator transliteration; @@ -253,6 +255,11 @@ public class HyperbolicTests { StrictMath::tanh, expected); } + private static int testAsinhCase(double input, double expected) { + return Tests.test("StrictMath.asinh(double)", input, + StrictMath::asinh, expected); + } + private static int testSinh() { int failures = 0; double [][] testCases = { @@ -484,4 +491,76 @@ public class HyperbolicTests { return failures; } + + private static int testAsinh() { + int failures = 0; + double [][] testCases = { + {0x1.5798ee2308c36p-27, 0x1.5798ee2308c35p-27}, + {0x1.ffffffffffffep-26, 0x1.ffffffffffffdp-26}, + {0x1.ffffffffffffep-25, 0x1.ffffffffffff9p-25}, + {0x1.ad7f29abcaf47p-24, 0x1.ad7f29abcaf3bp-24}, + {0x1.ad7f29abcaf48p-24, 0x1.ad7f29abcaf3cp-24}, + {0x1.ffffffffffffep-24, 0x1.fffffffffffe9p-24}, + {0x1.ffffffffffffep-23, 0x1.fffffffffffa9p-23}, + {0x1.ffffffffffffep-22, 0x1.ffffffffffea9p-22}, + {0x1.ffffffffffffep-21, 0x1.ffffffffffaa9p-21}, + {0x1.0c6f7a0b5ed8dp-20, 0x1.0c6f7a0b5ea7ap-20}, + {0x1.ffffffffffffep-20, 0x1.fffffffffeaa9p-20}, + {0x1.ffffffffffffep-19, 0x1.fffffffffaaa9p-19}, + {0x1.fffffffffffffp-18, 0x1.ffffffffeaaa9p-18}, + {0x1p-17, 0x1.ffffffffeaaabp-18}, + {0x1.4f8b588e368edp-17, 0x1.4f8b588e1e89ep-17}, + {0x1.fffffffffffffp-17, 0x1.ffffffffaaaa9p-17}, + {0x1.fffffffffffffp-16, 0x1.fffffffeaaaa9p-16}, + {0x1p-15, 0x1.fffffffeaaaabp-16}, + {0x1.fffffffffe5ddp-15, 0x1.fffffffaa9087p-15}, + {0x1.fffffffffffffp-15, 0x1.fffffffaaaaa9p-15}, + {0x1.a36e2eb1c432dp-14, 0x1.a36e2ea609cc8p-14}, + {0x1.ffffffffffffep-14, 0x1.ffffffeaaaaa9p-14}, + {0x1p-13, 0x1.ffffffeaaaaabp-14}, + {0x1.ffffffffffd51p-13, 0x1.ffffffaaaa7fdp-13}, + {0x1.fffffffffffffp-13, 0x1.ffffffaaaaaadp-13}, + {0x1.ffffffffffffep-12, 0x1.fffffeaaaaacfp-12}, + {0x1p-11, 0x1.fffffeaaaaad1p-12}, + {0x1.fffffffffff1p-11, 0x1.fffffaaaaac21p-11}, + {0x1p-10, 0x1.fffffaaaaad11p-11}, + {0x1.0624dd2f1a9c6p-10, 0x1.0624da5218b5fp-10}, + {0x1.0624dd2f1a9f8p-10, 0x1.0624da5218b91p-10}, + {0x1.fffffffffffddp-10, 0x1.ffffeaaaad0edp-10}, + {0x1.fffffffffffffp-10, 0x1.ffffeaaaad10fp-10}, + {0x1.ffffffffffffcp-9, 0x1.ffffaaaad110cp-9}, + {0x1.ffffffffffffep-9, 0x1.ffffaaaad110ep-9}, + {0x1.ffffffffffff8p-8, 0x1.fffeaaad110aep-8}, + {0x1.ffffffffffffep-8, 0x1.fffeaaad110b4p-8}, + {0x1.47ae147ae1458p-7, 0x1.47acae9508ae4p-7}, + {0x1.47ae147ae1464p-7, 0x1.47acae9508afp-7}, + {0x1.ffffffffffffep-7, 0x1.fffaaad10fa35p-7}, + {0x1.fffffffffffffp-7, 0x1.fffaaad10fa35p-7}, + {0x1.ffffffffffff9p-6, 0x1.ffeaad10b5b28p-6}, + {0x1.ffffffffffffep-6, 0x1.ffeaad10b5b2bp-6}, + {0x1.ffffffffffff9p-5, 0x1.ffaad0fa4525bp-5}, + {0x1.fffffffffffffp-5, 0x1.ffaad0fa45261p-5}, + {0x1.9999999999996p-4, 0x1.98eb9e7e5fc3ap-4}, + {0x1.9999999999997p-4, 0x1.98eb9e7e5fc3bp-4}, + {0x1.fffffffffffffp-4, 0x1.fead0b6996972p-4}, + {0x1p-3, 0x1.fead0b6996972p-4}, + {0x1.fffffffffffffp-3, 0x1.facfb2399e636p-3}, + {0x1.ffffffffffffcp-2, 0x1.ecc2caec51605p-2}, + {0x1.ffffffffffffep-2, 0x1.ecc2caec51608p-2}, + {0x1.ffffffffffffbp-1, 0x1.c34366179d423p-1}, + {0x1.ffffffffffffep-1, 0x1.c34366179d426p-1}, + {0x1.fffffffffffd3p+0, 0x1.719218313d073p+0}, + {0x1.fffffffffffe1p+0, 0x1.719218313d079p+0}, + {0x1.ffffffffffed8p+1, 0x1.0c1f8a6e80ea4p+1}, + {0x1.fffffffffff92p+1, 0x1.0c1f8a6e80edp+1}, + {0x1.0108b83c4bbc8p-1, 0x1.ee9c256f3947ep-2}, + {-0x1.c41e527b70f43p-3, -0x1.c0863c7dece22p-3}, + }; + + for (double[] testCase: testCases) { + failures += testAsinhCase(testCase[0], testCase[1]); + } + + return failures; + } } From 21d4c6c68fc1199275b3317cd64ae24c8aeca003 Mon Sep 17 00:00:00 2001 From: Naoto Sato Date: Tue, 10 Feb 2026 16:50:17 +0000 Subject: [PATCH 050/120] 8377013: TimeZone.getDefault() returns obsolete id on Windows (Asia/Calcutta) Reviewed-by: jlu --- .../tools/cldrconverter/CLDRConverter.java | 12 ++++++++-- .../cldrconverter/TimeZoneParseHandler.java | 24 +++++++++++++++++-- .../cldrconverter/WinZonesParseHandler.java | 3 ++- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java b/make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java index 55dd6a8d6ad..ab878a4d2a5 100644 --- a/make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java +++ b/make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -293,8 +293,10 @@ public class CLDRConverter { bundleGenerator = new ResourceBundleGenerator(); // Parse data independent of locales - parseSupplemental(); + // parseBCP47() must precede parseSupplemental(). The latter depends + // on IANA alias map, which is produced by the former. parseBCP47(); + parseSupplemental(); // rules maps pluralRules = generateRules(handlerPlurals); @@ -536,6 +538,12 @@ public class CLDRConverter { // canonical tz name map // alias -> primary + // + // Note that CLDR meta zones do not necessarily align with IANA's + // current time zone identifiers. For example, the CLDR "India" + // meta zone maps to "Asia/Calcutta", whereas IANA now uses + // "Asia/Kolkata" for the zone. Accordingly, "canonical" here is + // defined in terms of CLDR's zone mappings. handlerTimeZone.getData().forEach((k, v) -> { String[] ids = ((String)v).split("\\s"); for (int i = 1; i < ids.length; i++) { diff --git a/make/jdk/src/classes/build/tools/cldrconverter/TimeZoneParseHandler.java b/make/jdk/src/classes/build/tools/cldrconverter/TimeZoneParseHandler.java index 66e94e5ca06..8203a9f0b91 100644 --- a/make/jdk/src/classes/build/tools/cldrconverter/TimeZoneParseHandler.java +++ b/make/jdk/src/classes/build/tools/cldrconverter/TimeZoneParseHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2026, Oracle and/or its affiliates. All rights reserved. * 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,9 @@ package build.tools.cldrconverter; import java.io.File; import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; import org.xml.sax.Attributes; import org.xml.sax.InputSource; @@ -40,6 +43,10 @@ import org.xml.sax.SAXException; class TimeZoneParseHandler extends AbstractLDMLHandler { private static final String PREF_PREFIX = "preferred:"; + // CLDR aliases to IANA ids map. The initial capacity is estimated + // from the number of aliases in timezone.xml as of CLDR v48 + private final Map ianaAliasMap = HashMap.newHashMap(32); + @Override public InputSource resolveEntity(String publicID, String systemID) throws IOException, SAXException { // avoid HTTP traffic to unicode.org @@ -61,7 +68,16 @@ class TimeZoneParseHandler extends AbstractLDMLHandler { put(attributes.getValue("name"), PREF_PREFIX + preferred); } } else { - put(attributes.getValue("name"), attributes.getValue("alias")); + var alias = attributes.getValue("alias"); + var iana = attributes.getValue("iana"); + if (iana != null) { + for (var a : alias.split("\\s+")) { + if (!a.equals(iana)) { + ianaAliasMap.put(a, iana); + } + } + } + put(attributes.getValue("name"), alias); } } break; @@ -80,4 +96,8 @@ class TimeZoneParseHandler extends AbstractLDMLHandler { .forEach(e -> map.put(e.getKey(), map.get(e.getValue().toString().substring(PREF_PREFIX.length())))); } + + Map getIanaAliasMap() { + return ianaAliasMap; + } } diff --git a/make/jdk/src/classes/build/tools/cldrconverter/WinZonesParseHandler.java b/make/jdk/src/classes/build/tools/cldrconverter/WinZonesParseHandler.java index a584358f0cb..343e143b6ad 100644 --- a/make/jdk/src/classes/build/tools/cldrconverter/WinZonesParseHandler.java +++ b/make/jdk/src/classes/build/tools/cldrconverter/WinZonesParseHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -56,6 +56,7 @@ class WinZonesParseHandler extends AbstractLDMLHandler { String zoneName = attributes.getValue("other"); String territory = attributes.getValue("territory"); String javatz = attributes.getValue("type").replaceFirst("\\s.*", ""); + javatz = CLDRConverter.handlerTimeZone.getIanaAliasMap().getOrDefault(javatz, javatz); put(zoneName + ":" + territory, javatz); pushIgnoredContainer(qName); break; From 7bc2475962efb690c11a8bfcaa25ab184475fb13 Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Tue, 10 Feb 2026 17:07:56 +0000 Subject: [PATCH 051/120] 8377096: Refactor AOTMapLogger::OopDataIterator implementations Reviewed-by: eosterlund, kvn --- src/hotspot/share/cds/aotMapLogger.cpp | 6 +- src/hotspot/share/cds/aotMapLogger.hpp | 10 +- src/hotspot/share/cds/aotMappedHeap.cpp | 49 +++++ src/hotspot/share/cds/aotMappedHeap.hpp | 168 ++++++++++++++++++ src/hotspot/share/cds/aotMappedHeapLoader.cpp | 102 +++-------- src/hotspot/share/cds/aotMappedHeapLoader.hpp | 14 +- src/hotspot/share/cds/aotMappedHeapWriter.cpp | 100 ++--------- src/hotspot/share/cds/aotMappedHeapWriter.hpp | 12 +- src/hotspot/share/cds/aotMetaspace.cpp | 12 +- src/hotspot/share/cds/aotMetaspace.hpp | 10 +- src/hotspot/share/cds/aotStreamedHeap.cpp | 55 ++++++ src/hotspot/share/cds/aotStreamedHeap.hpp | 147 +++++++++++++++ .../share/cds/aotStreamedHeapLoader.cpp | 49 +---- .../share/cds/aotStreamedHeapWriter.cpp | 57 +----- .../share/cds/aotStreamedHeapWriter.hpp | 10 +- src/hotspot/share/cds/archiveBuilder.cpp | 6 +- src/hotspot/share/cds/archiveBuilder.hpp | 12 +- src/hotspot/share/cds/filemap.cpp | 10 +- src/hotspot/share/cds/filemap.hpp | 28 +-- src/hotspot/share/cds/heapShared.cpp | 51 +----- src/hotspot/share/cds/heapShared.hpp | 125 +------------ 21 files changed, 539 insertions(+), 494 deletions(-) create mode 100644 src/hotspot/share/cds/aotMappedHeap.cpp create mode 100644 src/hotspot/share/cds/aotMappedHeap.hpp create mode 100644 src/hotspot/share/cds/aotStreamedHeap.cpp create mode 100644 src/hotspot/share/cds/aotStreamedHeap.hpp diff --git a/src/hotspot/share/cds/aotMapLogger.cpp b/src/hotspot/share/cds/aotMapLogger.cpp index 5e4e0956824..fa769aee1bf 100644 --- a/src/hotspot/share/cds/aotMapLogger.cpp +++ b/src/hotspot/share/cds/aotMapLogger.cpp @@ -88,7 +88,7 @@ void AOTMapLogger::ergo_initialize() { } void AOTMapLogger::dumptime_log(ArchiveBuilder* builder, FileMapInfo* mapinfo, - ArchiveMappedHeapInfo* mapped_heap_info, ArchiveStreamedHeapInfo* streamed_heap_info, + AOTMappedHeapInfo* mapped_heap_info, AOTStreamedHeapInfo* streamed_heap_info, char* bitmap, size_t bitmap_size_in_bytes) { _is_runtime_logging = false; _buffer_to_requested_delta = ArchiveBuilder::current()->buffer_to_requested_delta(); @@ -823,7 +823,7 @@ public: } }; // AOTMapLogger::ArchivedFieldPrinter -void AOTMapLogger::dumptime_log_mapped_heap_region(ArchiveMappedHeapInfo* heap_info) { +void AOTMapLogger::dumptime_log_mapped_heap_region(AOTMappedHeapInfo* heap_info) { MemRegion r = heap_info->buffer_region(); address buffer_start = address(r.start()); // start of the current oop inside the buffer address buffer_end = address(r.end()); @@ -835,7 +835,7 @@ void AOTMapLogger::dumptime_log_mapped_heap_region(ArchiveMappedHeapInfo* heap_i log_archived_objects(AOTMappedHeapWriter::oop_iterator(heap_info)); } -void AOTMapLogger::dumptime_log_streamed_heap_region(ArchiveStreamedHeapInfo* heap_info) { +void AOTMapLogger::dumptime_log_streamed_heap_region(AOTStreamedHeapInfo* heap_info) { MemRegion r = heap_info->buffer_region(); address buffer_start = address(r.start()); // start of the current oop inside the buffer address buffer_end = address(r.end()); diff --git a/src/hotspot/share/cds/aotMapLogger.hpp b/src/hotspot/share/cds/aotMapLogger.hpp index bf7ce0028b9..f495ed97f40 100644 --- a/src/hotspot/share/cds/aotMapLogger.hpp +++ b/src/hotspot/share/cds/aotMapLogger.hpp @@ -33,8 +33,8 @@ #include "utilities/globalDefinitions.hpp" #include "utilities/growableArray.hpp" -class ArchiveMappedHeapInfo; -class ArchiveStreamedHeapInfo; +class AOTMappedHeapInfo; +class AOTStreamedHeapInfo; class CompileTrainingData; class DumpRegion; class FileMapInfo; @@ -157,8 +157,8 @@ private: #if INCLUDE_CDS_JAVA_HEAP - static void dumptime_log_mapped_heap_region(ArchiveMappedHeapInfo* mapped_heap_info); - static void dumptime_log_streamed_heap_region(ArchiveStreamedHeapInfo* streamed_heap_info); + static void dumptime_log_mapped_heap_region(AOTMappedHeapInfo* mapped_heap_info); + static void dumptime_log_streamed_heap_region(AOTStreamedHeapInfo* streamed_heap_info); static void runtime_log_heap_region(FileMapInfo* mapinfo); static void print_oop_info_cr(outputStream* st, FakeOop fake_oop, bool print_location = true); @@ -173,7 +173,7 @@ public: static bool is_logging_at_bootstrap() { return _is_logging_at_bootstrap; } static void dumptime_log(ArchiveBuilder* builder, FileMapInfo* mapinfo, - ArchiveMappedHeapInfo* mapped_heap_info, ArchiveStreamedHeapInfo* streamed_heap_info, + AOTMappedHeapInfo* mapped_heap_info, AOTStreamedHeapInfo* streamed_heap_info, char* bitmap, size_t bitmap_size_in_bytes); static void runtime_log(FileMapInfo* static_mapinfo, FileMapInfo* dynamic_mapinfo); }; diff --git a/src/hotspot/share/cds/aotMappedHeap.cpp b/src/hotspot/share/cds/aotMappedHeap.cpp new file mode 100644 index 00000000000..ba24c43eea1 --- /dev/null +++ b/src/hotspot/share/cds/aotMappedHeap.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * 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 "cds/aotMappedHeap.hpp" + +// Anything that goes in the header must be thoroughly purged from uninitialized memory +// as it will be written to disk. Therefore, the constructors memset the memory to 0. +// This is not the prettiest thing, but we need to know every byte is initialized, +// including potential padding between fields. + +AOTMappedHeapHeader::AOTMappedHeapHeader(size_t ptrmap_start_pos, + size_t oopmap_start_pos, + HeapRootSegments root_segments) { + memset((char*)this, 0, sizeof(*this)); + _ptrmap_start_pos = ptrmap_start_pos; + _oopmap_start_pos = oopmap_start_pos; + _root_segments = root_segments; +} + +AOTMappedHeapHeader::AOTMappedHeapHeader() { + memset((char*)this, 0, sizeof(*this)); +} + +AOTMappedHeapHeader AOTMappedHeapInfo::create_header() { + return AOTMappedHeapHeader{_ptrmap_start_pos, + _oopmap_start_pos, + _root_segments}; +} diff --git a/src/hotspot/share/cds/aotMappedHeap.hpp b/src/hotspot/share/cds/aotMappedHeap.hpp new file mode 100644 index 00000000000..307451b24d4 --- /dev/null +++ b/src/hotspot/share/cds/aotMappedHeap.hpp @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * 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_CDS_AOTMAPPEDHEAP_HPP +#define SHARE_CDS_AOTMAPPEDHEAP_HPP + +#include "cds/aotMapLogger.hpp" +#include "utilities/growableArray.hpp" +#include "utilities/macros.hpp" + +class AOTMappedHeapHeader { + size_t _ptrmap_start_pos; // The first bit in the ptrmap corresponds to this position in the heap. + size_t _oopmap_start_pos; // The first bit in the oopmap corresponds to this position in the heap. + HeapRootSegments _root_segments; // Heap root segments info + +public: + AOTMappedHeapHeader(); + AOTMappedHeapHeader(size_t ptrmap_start_pos, + size_t oopmap_start_pos, + HeapRootSegments root_segments); + + size_t ptrmap_start_pos() const { return _ptrmap_start_pos; } + size_t oopmap_start_pos() const { return _oopmap_start_pos; } + HeapRootSegments root_segments() const { return _root_segments; } + + // This class is trivially copyable and assignable. + AOTMappedHeapHeader(const AOTMappedHeapHeader&) = default; + AOTMappedHeapHeader& operator=(const AOTMappedHeapHeader&) = default; +}; + +class AOTMappedHeapInfo { + MemRegion _buffer_region; // Contains the archived objects to be written into the CDS archive. + CHeapBitMap _oopmap; + CHeapBitMap _ptrmap; + HeapRootSegments _root_segments; + size_t _oopmap_start_pos; // How many zeros were removed from the beginning of the bit map? + size_t _ptrmap_start_pos; // How many zeros were removed from the beginning of the bit map? + +public: + AOTMappedHeapInfo() : + _buffer_region(), + _oopmap(128, mtClassShared), + _ptrmap(128, mtClassShared), + _root_segments(), + _oopmap_start_pos(), + _ptrmap_start_pos() {} + bool is_used() { return !_buffer_region.is_empty(); } + + MemRegion buffer_region() { return _buffer_region; } + void set_buffer_region(MemRegion r) { _buffer_region = r; } + + char* buffer_start() { return (char*)_buffer_region.start(); } + size_t buffer_byte_size() { return _buffer_region.byte_size(); } + + CHeapBitMap* oopmap() { return &_oopmap; } + CHeapBitMap* ptrmap() { return &_ptrmap; } + + void set_oopmap_start_pos(size_t start_pos) { _oopmap_start_pos = start_pos; } + void set_ptrmap_start_pos(size_t start_pos) { _ptrmap_start_pos = start_pos; } + + void set_root_segments(HeapRootSegments segments) { _root_segments = segments; }; + HeapRootSegments root_segments() { return _root_segments; } + + AOTMappedHeapHeader create_header(); +}; + +#if INCLUDE_CDS_JAVA_HEAP +class AOTMappedHeapOopIterator : public AOTMapLogger::OopDataIterator { +protected: + address _current; + address _next; + + address _buffer_start; + address _buffer_end; + uint64_t _buffer_start_narrow_oop; + intptr_t _buffer_to_requested_delta; + int _requested_shift; + + size_t _num_root_segments; + size_t _num_obj_arrays_logged; + +public: + AOTMappedHeapOopIterator(address buffer_start, + address buffer_end, + address requested_base, + address requested_start, + int requested_shift, + size_t num_root_segments) + : _current(nullptr), + _next(buffer_start), + _buffer_start(buffer_start), + _buffer_end(buffer_end), + _requested_shift(requested_shift), + _num_root_segments(num_root_segments), + _num_obj_arrays_logged(0) { + _buffer_to_requested_delta = requested_start - buffer_start; + _buffer_start_narrow_oop = 0xdeadbeed; + if (UseCompressedOops) { + _buffer_start_narrow_oop = (uint64_t)(pointer_delta(requested_start, requested_base, 1)) >> requested_shift; + assert(_buffer_start_narrow_oop < 0xffffffff, "sanity"); + } + } + + virtual AOTMapLogger::OopData capture(address buffered_addr) = 0; + + bool has_next() override { + return _next < _buffer_end; + } + + AOTMapLogger::OopData next() override { + _current = _next; + AOTMapLogger::OopData result = capture(_current); + if (result._klass->is_objArray_klass()) { + result._is_root_segment = _num_obj_arrays_logged++ < _num_root_segments; + } + _next = _current + result._size * BytesPerWord; + return result; + } + + AOTMapLogger::OopData obj_at(narrowOop* addr) override { + uint64_t n = (uint64_t)(*addr); + if (n == 0) { + return null_data(); + } else { + precond(n >= _buffer_start_narrow_oop); + address buffer_addr = _buffer_start + ((n - _buffer_start_narrow_oop) << _requested_shift); + return capture(buffer_addr); + } + } + + AOTMapLogger::OopData obj_at(oop* addr) override { + address requested_value = cast_from_oop
(*addr); + if (requested_value == nullptr) { + return null_data(); + } else { + address buffer_addr = requested_value - _buffer_to_requested_delta; + return capture(buffer_addr); + } + } + + GrowableArrayCHeap* roots() override { + return new GrowableArrayCHeap(); + } +}; +#endif // INCLUDE_CDS_JAVA_HEAP + +#endif // SHARE_CDS_AOTMAPPEDHEAP_HPP diff --git a/src/hotspot/share/cds/aotMappedHeapLoader.cpp b/src/hotspot/share/cds/aotMappedHeapLoader.cpp index 210867be70c..7a201d8297f 100644 --- a/src/hotspot/share/cds/aotMappedHeapLoader.cpp +++ b/src/hotspot/share/cds/aotMappedHeapLoader.cpp @@ -23,6 +23,7 @@ */ #include "cds/aotLogging.hpp" +#include "cds/aotMappedHeap.hpp" #include "cds/aotMappedHeapLoader.inline.hpp" #include "cds/aotMappedHeapWriter.hpp" #include "cds/aotMetaspace.hpp" @@ -221,7 +222,7 @@ void AOTMappedHeapLoader::patch_embedded_pointers(FileMapInfo* info, // the heap object may be loaded at a different address at run time. This structure is used // to translate the dump time addresses for all objects in FileMapInfo::space_at(region_index) // to their runtime addresses. -struct LoadedArchiveHeapRegion { +struct AOTMappedHeapRegion { int _region_index; // index for FileMapInfo::space_at(index) size_t _region_size; // number of bytes in this region uintptr_t _dumptime_base; // The dump-time (decoded) address of the first object in this region @@ -232,7 +233,7 @@ struct LoadedArchiveHeapRegion { } }; -void AOTMappedHeapLoader::init_loaded_heap_relocation(LoadedArchiveHeapRegion* loaded_region) { +void AOTMappedHeapLoader::init_loaded_heap_relocation(AOTMappedHeapRegion* loaded_region) { _dumptime_base = loaded_region->_dumptime_base; _dumptime_top = loaded_region->top(); _runtime_offset = loaded_region->_runtime_offset; @@ -249,7 +250,7 @@ class AOTMappedHeapLoader::PatchLoadedRegionPointers: public BitMapClosure { uintptr_t _top; public: - PatchLoadedRegionPointers(narrowOop* start, LoadedArchiveHeapRegion* loaded_region) + PatchLoadedRegionPointers(narrowOop* start, AOTMappedHeapRegion* loaded_region) : _start(start), _offset(loaded_region->_runtime_offset), _base(loaded_region->_dumptime_base), @@ -270,7 +271,7 @@ class AOTMappedHeapLoader::PatchLoadedRegionPointers: public BitMapClosure { } }; -bool AOTMappedHeapLoader::init_loaded_region(FileMapInfo* mapinfo, LoadedArchiveHeapRegion* loaded_region, +bool AOTMappedHeapLoader::init_loaded_region(FileMapInfo* mapinfo, AOTMappedHeapRegion* loaded_region, MemRegion& archive_space) { size_t total_bytes = 0; FileMapRegion* r = mapinfo->region_at(AOTMetaspace::hp); @@ -301,7 +302,7 @@ bool AOTMappedHeapLoader::init_loaded_region(FileMapInfo* mapinfo, LoadedArchive return true; } -bool AOTMappedHeapLoader::load_heap_region_impl(FileMapInfo* mapinfo, LoadedArchiveHeapRegion* loaded_region, +bool AOTMappedHeapLoader::load_heap_region_impl(FileMapInfo* mapinfo, AOTMappedHeapRegion* loaded_region, uintptr_t load_address) { uintptr_t bitmap_base = (uintptr_t)mapinfo->map_bitmap_region(); if (bitmap_base == 0) { @@ -340,7 +341,7 @@ bool AOTMappedHeapLoader::load_heap_region(FileMapInfo* mapinfo) { assert(can_load(), "loaded heap for must be supported"); init_narrow_oop_decoding(mapinfo->narrow_oop_base(), mapinfo->narrow_oop_shift()); - LoadedArchiveHeapRegion loaded_region; + AOTMappedHeapRegion loaded_region; memset(&loaded_region, 0, sizeof(loaded_region)); MemRegion archive_space; @@ -733,40 +734,22 @@ void AOTMappedHeapLoader::dealloc_heap_region(FileMapInfo* info) { } AOTMapLogger::OopDataIterator* AOTMappedHeapLoader::oop_iterator(FileMapInfo* info, address buffer_start, address buffer_end) { - class MappedLoaderOopIterator : public AOTMapLogger::OopDataIterator { - private: - address _current; - address _next; - - address _buffer_start; - address _buffer_end; - uint64_t _buffer_start_narrow_oop; - intptr_t _buffer_to_requested_delta; - int _requested_shift; - - size_t _num_root_segments; - size_t _num_obj_arrays_logged; - + class MappedLoaderOopIterator : public AOTMappedHeapOopIterator { public: MappedLoaderOopIterator(address buffer_start, address buffer_end, - uint64_t buffer_start_narrow_oop, - intptr_t buffer_to_requested_delta, + address requested_base, + address requested_start, int requested_shift, - size_t num_root_segments) - : _current(nullptr), - _next(buffer_start), - _buffer_start(buffer_start), - _buffer_end(buffer_end), - _buffer_start_narrow_oop(buffer_start_narrow_oop), - _buffer_to_requested_delta(buffer_to_requested_delta), - _requested_shift(requested_shift), - _num_root_segments(num_root_segments), - _num_obj_arrays_logged(0) { - } + size_t num_root_segments) : + AOTMappedHeapOopIterator(buffer_start, + buffer_end, + requested_base, + requested_start, + requested_shift, + num_root_segments) {} - - AOTMapLogger::OopData capture(address buffered_addr) { + AOTMapLogger::OopData capture(address buffered_addr) override { oopDesc* raw_oop = (oopDesc*)buffered_addr; size_t size = raw_oop->size(); address requested_addr = buffered_addr + _buffer_to_requested_delta; @@ -784,62 +767,17 @@ AOTMapLogger::OopDataIterator* AOTMappedHeapLoader::oop_iterator(FileMapInfo* in size, false }; } - - bool has_next() override { - return _next < _buffer_end; - } - - AOTMapLogger::OopData next() override { - _current = _next; - AOTMapLogger::OopData result = capture(_current); - if (result._klass->is_objArray_klass()) { - result._is_root_segment = _num_obj_arrays_logged++ < _num_root_segments; - } - _next = _current + result._size * BytesPerWord; - return result; - } - - AOTMapLogger::OopData obj_at(narrowOop* addr) override { - uint64_t n = (uint64_t)(*addr); - if (n == 0) { - return null_data(); - } else { - precond(n >= _buffer_start_narrow_oop); - address buffer_addr = _buffer_start + ((n - _buffer_start_narrow_oop) << _requested_shift); - return capture(buffer_addr); - } - } - - AOTMapLogger::OopData obj_at(oop* addr) override { - address requested_value = cast_from_oop
(*addr); - if (requested_value == nullptr) { - return null_data(); - } else { - address buffer_addr = requested_value - _buffer_to_requested_delta; - return capture(buffer_addr); - } - } - - GrowableArrayCHeap* roots() override { - return new GrowableArrayCHeap(); - } }; FileMapRegion* r = info->region_at(AOTMetaspace::hp); address requested_base = UseCompressedOops ? (address)info->narrow_oop_base() : heap_region_requested_address(info); address requested_start = requested_base + r->mapping_offset(); int requested_shift = info->narrow_oop_shift(); - intptr_t buffer_to_requested_delta = requested_start - buffer_start; - uint64_t buffer_start_narrow_oop = 0xdeadbeed; - if (UseCompressedOops) { - buffer_start_narrow_oop = (uint64_t)(pointer_delta(requested_start, requested_base, 1)) >> requested_shift; - assert(buffer_start_narrow_oop < 0xffffffff, "sanity"); - } return new MappedLoaderOopIterator(buffer_start, buffer_end, - buffer_start_narrow_oop, - buffer_to_requested_delta, + requested_base, + requested_start, requested_shift, info->mapped_heap()->root_segments().count()); } diff --git a/src/hotspot/share/cds/aotMappedHeapLoader.hpp b/src/hotspot/share/cds/aotMappedHeapLoader.hpp index d344d7b0b0a..7c5ca1b1f9e 100644 --- a/src/hotspot/share/cds/aotMappedHeapLoader.hpp +++ b/src/hotspot/share/cds/aotMappedHeapLoader.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * 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,8 +37,8 @@ #include "utilities/growableArray.hpp" #include "utilities/macros.hpp" +struct AOTMappedHeapRegion; class FileMapInfo; -struct LoadedArchiveHeapRegion; class AOTMappedHeapLoader : AllStatic { friend class AOTMapLogger; @@ -93,7 +93,7 @@ public: // function instead. inline static oop decode_from_archive(narrowOop v) NOT_CDS_JAVA_HEAP_RETURN_(nullptr); - // More efficient version, but works only when ArchiveHeap is mapped. + // More efficient version, but works only when is_mapped() inline static oop decode_from_mapped_archive(narrowOop v) NOT_CDS_JAVA_HEAP_RETURN_(nullptr); static void patch_compressed_embedded_pointers(BitMapView bm, @@ -113,7 +113,7 @@ private: static bool _is_loaded; // Support for loaded archived heap. These are cached values from - // LoadedArchiveHeapRegion's. + // AOTMappedHeapRegion's. static uintptr_t _dumptime_base; static uintptr_t _dumptime_top; static intx _runtime_offset; @@ -141,10 +141,10 @@ private: static bool _heap_pointers_need_patching; static void init_narrow_oop_decoding(address base, int shift); - static bool init_loaded_region(FileMapInfo* mapinfo, LoadedArchiveHeapRegion* loaded_region, + static bool init_loaded_region(FileMapInfo* mapinfo, AOTMappedHeapRegion* loaded_region, MemRegion& archive_space); - static bool load_heap_region_impl(FileMapInfo* mapinfo, LoadedArchiveHeapRegion* loaded_region, uintptr_t buffer); - static void init_loaded_heap_relocation(LoadedArchiveHeapRegion* reloc_info); + static bool load_heap_region_impl(FileMapInfo* mapinfo, AOTMappedHeapRegion* loaded_region, uintptr_t buffer); + static void init_loaded_heap_relocation(AOTMappedHeapRegion* reloc_info); static void patch_native_pointers(); static void finish_loaded_heap(); static void verify_loaded_heap(); diff --git a/src/hotspot/share/cds/aotMappedHeapWriter.cpp b/src/hotspot/share/cds/aotMappedHeapWriter.cpp index e73b980614a..64c0e3c40e8 100644 --- a/src/hotspot/share/cds/aotMappedHeapWriter.cpp +++ b/src/hotspot/share/cds/aotMappedHeapWriter.cpp @@ -22,7 +22,7 @@ * */ -#include "cds/aotMappedHeapLoader.hpp" +#include "cds/aotMappedHeap.hpp" #include "cds/aotMappedHeapWriter.hpp" #include "cds/aotReferenceObjSupport.hpp" #include "cds/cdsConfig.hpp" @@ -151,7 +151,7 @@ void AOTMappedHeapWriter::add_source_obj(oop src_obj) { } void AOTMappedHeapWriter::write(GrowableArrayCHeap* roots, - ArchiveMappedHeapInfo* heap_info) { + AOTMappedHeapInfo* heap_info) { assert(CDSConfig::is_dumping_heap(), "sanity"); allocate_buffer(); copy_source_objs_to_buffer(roots); @@ -598,7 +598,7 @@ size_t AOTMappedHeapWriter::copy_one_source_obj_to_buffer(oop src_obj) { // // So we just hard code it to NOCOOPS_REQUESTED_BASE. // -void AOTMappedHeapWriter::set_requested_address_range(ArchiveMappedHeapInfo* info) { +void AOTMappedHeapWriter::set_requested_address_range(AOTMappedHeapInfo* info) { assert(!info->is_used(), "only set once"); size_t heap_region_byte_size = _buffer_used; @@ -792,7 +792,7 @@ static void log_bitmap_usage(const char* which, BitMap* bitmap, size_t total_bit // Update all oop fields embedded in the buffered objects void AOTMappedHeapWriter::relocate_embedded_oops(GrowableArrayCHeap* roots, - ArchiveMappedHeapInfo* heap_info) { + AOTMappedHeapInfo* heap_info) { size_t oopmap_unit = (UseCompressedOops ? sizeof(narrowOop) : sizeof(oop)); size_t heap_region_byte_size = _buffer_used; heap_info->oopmap()->resize(heap_region_byte_size / oopmap_unit); @@ -862,7 +862,7 @@ void AOTMappedHeapWriter::mark_native_pointers(oop orig_obj) { }); } -void AOTMappedHeapWriter::compute_ptrmap(ArchiveMappedHeapInfo* heap_info) { +void AOTMappedHeapWriter::compute_ptrmap(AOTMappedHeapInfo* heap_info) { int num_non_null_ptrs = 0; Metadata** bottom = (Metadata**) _requested_bottom; Metadata** top = (Metadata**) _requested_top; // exclusive @@ -909,40 +909,23 @@ void AOTMappedHeapWriter::compute_ptrmap(ArchiveMappedHeapInfo* heap_info) { num_non_null_ptrs, size_t(heap_info->ptrmap()->size())); } -AOTMapLogger::OopDataIterator* AOTMappedHeapWriter::oop_iterator(ArchiveMappedHeapInfo* heap_info) { - class MappedWriterOopIterator : public AOTMapLogger::OopDataIterator { - private: - address _current; - address _next; - - address _buffer_start; - address _buffer_end; - uint64_t _buffer_start_narrow_oop; - intptr_t _buffer_to_requested_delta; - int _requested_shift; - - size_t _num_root_segments; - size_t _num_obj_arrays_logged; - +AOTMapLogger::OopDataIterator* AOTMappedHeapWriter::oop_iterator(AOTMappedHeapInfo* heap_info) { + class MappedWriterOopIterator : public AOTMappedHeapOopIterator { public: MappedWriterOopIterator(address buffer_start, address buffer_end, - uint64_t buffer_start_narrow_oop, - intptr_t buffer_to_requested_delta, + address requested_base, + address requested_start, int requested_shift, - size_t num_root_segments) - : _current(nullptr), - _next(buffer_start), - _buffer_start(buffer_start), - _buffer_end(buffer_end), - _buffer_start_narrow_oop(buffer_start_narrow_oop), - _buffer_to_requested_delta(buffer_to_requested_delta), - _requested_shift(requested_shift), - _num_root_segments(num_root_segments), - _num_obj_arrays_logged(0) { - } + size_t num_root_segments) : + AOTMappedHeapOopIterator(buffer_start, + buffer_end, + requested_base, + requested_start, + requested_shift, + num_root_segments) {} - AOTMapLogger::OopData capture(address buffered_addr) { + AOTMapLogger::OopData capture(address buffered_addr) override { oopDesc* raw_oop = (oopDesc*)buffered_addr; size_t size = size_of_buffered_oop(buffered_addr); address requested_addr = buffered_addr_to_requested_addr(buffered_addr); @@ -960,45 +943,6 @@ AOTMapLogger::OopDataIterator* AOTMappedHeapWriter::oop_iterator(ArchiveMappedHe size, false }; } - - bool has_next() override { - return _next < _buffer_end; - } - - AOTMapLogger::OopData next() override { - _current = _next; - AOTMapLogger::OopData result = capture(_current); - if (result._klass->is_objArray_klass()) { - result._is_root_segment = _num_obj_arrays_logged++ < _num_root_segments; - } - _next = _current + result._size * BytesPerWord; - return result; - } - - AOTMapLogger::OopData obj_at(narrowOop* addr) override { - uint64_t n = (uint64_t)(*addr); - if (n == 0) { - return null_data(); - } else { - precond(n >= _buffer_start_narrow_oop); - address buffer_addr = _buffer_start + ((n - _buffer_start_narrow_oop) << _requested_shift); - return capture(buffer_addr); - } - } - - AOTMapLogger::OopData obj_at(oop* addr) override { - address requested_value = cast_from_oop
(*addr); - if (requested_value == nullptr) { - return null_data(); - } else { - address buffer_addr = requested_value - _buffer_to_requested_delta; - return capture(buffer_addr); - } - } - - GrowableArrayCHeap* roots() override { - return new GrowableArrayCHeap(); - } }; MemRegion r = heap_info->buffer_region(); @@ -1008,17 +952,11 @@ AOTMapLogger::OopDataIterator* AOTMappedHeapWriter::oop_iterator(ArchiveMappedHe address requested_base = UseCompressedOops ? AOTMappedHeapWriter::narrow_oop_base() : (address)AOTMappedHeapWriter::NOCOOPS_REQUESTED_BASE; address requested_start = UseCompressedOops ? AOTMappedHeapWriter::buffered_addr_to_requested_addr(buffer_start) : requested_base; int requested_shift = AOTMappedHeapWriter::narrow_oop_shift(); - intptr_t buffer_to_requested_delta = requested_start - buffer_start; - uint64_t buffer_start_narrow_oop = 0xdeadbeed; - if (UseCompressedOops) { - buffer_start_narrow_oop = (uint64_t)(pointer_delta(requested_start, requested_base, 1)) >> requested_shift; - assert(buffer_start_narrow_oop < 0xffffffff, "sanity"); - } return new MappedWriterOopIterator(buffer_start, buffer_end, - buffer_start_narrow_oop, - buffer_to_requested_delta, + requested_base, + requested_start, requested_shift, heap_info->root_segments().count()); } diff --git a/src/hotspot/share/cds/aotMappedHeapWriter.hpp b/src/hotspot/share/cds/aotMappedHeapWriter.hpp index eafd38ac8bb..7481e7922a0 100644 --- a/src/hotspot/share/cds/aotMappedHeapWriter.hpp +++ b/src/hotspot/share/cds/aotMappedHeapWriter.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -196,10 +196,10 @@ private: static int filler_array_length(size_t fill_bytes); static HeapWord* init_filler_array_at_buffer_top(int array_length, size_t fill_bytes); - static void set_requested_address_range(ArchiveMappedHeapInfo* info); + static void set_requested_address_range(AOTMappedHeapInfo* info); static void mark_native_pointers(oop orig_obj); - static void relocate_embedded_oops(GrowableArrayCHeap* roots, ArchiveMappedHeapInfo* info); - static void compute_ptrmap(ArchiveMappedHeapInfo *info); + static void relocate_embedded_oops(GrowableArrayCHeap* roots, AOTMappedHeapInfo* info); + static void compute_ptrmap(AOTMappedHeapInfo *info); static bool is_in_requested_range(oop o); static oop requested_obj_from_buffer_offset(size_t offset); @@ -229,7 +229,7 @@ public: static bool is_string_too_large_to_archive(oop string); static bool is_dumped_interned_string(oop o); static void add_to_dumped_interned_strings(oop string); - static void write(GrowableArrayCHeap*, ArchiveMappedHeapInfo* heap_info); + static void write(GrowableArrayCHeap*, AOTMappedHeapInfo* heap_info); static address requested_address(); // requested address of the lowest achived heap object static size_t get_filler_size_at(address buffered_addr); @@ -240,7 +240,7 @@ public: static Klass* real_klass_of_buffered_oop(address buffered_addr); static size_t size_of_buffered_oop(address buffered_addr); - static AOTMapLogger::OopDataIterator* oop_iterator(ArchiveMappedHeapInfo* heap_info); + static AOTMapLogger::OopDataIterator* oop_iterator(AOTMappedHeapInfo* heap_info); }; #endif // INCLUDE_CDS_JAVA_HEAP #endif // SHARE_CDS_AOTMAPPEDHEAPWRITER_HPP diff --git a/src/hotspot/share/cds/aotMetaspace.cpp b/src/hotspot/share/cds/aotMetaspace.cpp index 894a35183ca..8bb8387f1ab 100644 --- a/src/hotspot/share/cds/aotMetaspace.cpp +++ b/src/hotspot/share/cds/aotMetaspace.cpp @@ -661,8 +661,8 @@ void AOTMetaspace::rewrite_bytecodes_and_calculate_fingerprints(Thread* thread, class VM_PopulateDumpSharedSpace : public VM_Operation { private: - ArchiveMappedHeapInfo _mapped_heap_info; - ArchiveStreamedHeapInfo _streamed_heap_info; + AOTMappedHeapInfo _mapped_heap_info; + AOTStreamedHeapInfo _streamed_heap_info; FileMapInfo* _map_info; StaticArchiveBuilder& _builder; @@ -682,8 +682,8 @@ public: bool skip_operation() const { return false; } VMOp_Type type() const { return VMOp_PopulateDumpSharedSpace; } - ArchiveMappedHeapInfo* mapped_heap_info() { return &_mapped_heap_info; } - ArchiveStreamedHeapInfo* streamed_heap_info() { return &_streamed_heap_info; } + AOTMappedHeapInfo* mapped_heap_info() { return &_mapped_heap_info; } + AOTStreamedHeapInfo* streamed_heap_info() { return &_streamed_heap_info; } void doit(); // outline because gdb sucks bool allow_nested_vm_operations() const { return true; } }; // class VM_PopulateDumpSharedSpace @@ -1212,8 +1212,8 @@ void AOTMetaspace::dump_static_archive_impl(StaticArchiveBuilder& builder, TRAPS bool AOTMetaspace::write_static_archive(ArchiveBuilder* builder, FileMapInfo* map_info, - ArchiveMappedHeapInfo* mapped_heap_info, - ArchiveStreamedHeapInfo* streamed_heap_info) { + AOTMappedHeapInfo* mapped_heap_info, + AOTStreamedHeapInfo* streamed_heap_info) { // relocate the data so that it can be mapped to AOTMetaspace::requested_base_address() // without runtime relocation. builder->relocate_to_requested(); diff --git a/src/hotspot/share/cds/aotMetaspace.hpp b/src/hotspot/share/cds/aotMetaspace.hpp index ab78787288f..4607a936abe 100644 --- a/src/hotspot/share/cds/aotMetaspace.hpp +++ b/src/hotspot/share/cds/aotMetaspace.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2026, Oracle and/or its affiliates. All rights reserved. * 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,8 +33,8 @@ #include "utilities/macros.hpp" class ArchiveBuilder; -class ArchiveMappedHeapInfo; -class ArchiveStreamedHeapInfo; +class AOTMappedHeapInfo; +class AOTStreamedHeapInfo; class FileMapInfo; class Method; class outputStream; @@ -192,8 +192,8 @@ private: static void open_output_mapinfo(); static bool write_static_archive(ArchiveBuilder* builder, FileMapInfo* map_info, - ArchiveMappedHeapInfo* mapped_heap_info, - ArchiveStreamedHeapInfo* streamed_heap_info); + AOTMappedHeapInfo* mapped_heap_info, + AOTStreamedHeapInfo* streamed_heap_info); static FileMapInfo* open_static_archive(); static FileMapInfo* open_dynamic_archive(); // use_requested_addr: If true (default), attempt to map at the address the diff --git a/src/hotspot/share/cds/aotStreamedHeap.cpp b/src/hotspot/share/cds/aotStreamedHeap.cpp new file mode 100644 index 00000000000..3378924bf32 --- /dev/null +++ b/src/hotspot/share/cds/aotStreamedHeap.cpp @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * 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 "cds/aotStreamedHeap.hpp" + +// Anything that goes in the header must be thoroughly purged from uninitialized memory +// as it will be written to disk. Therefore, the constructors memset the memory to 0. +// This is not the prettiest thing, but we need to know every byte is initialized, +// including potential padding between fields. + +AOTStreamedHeapHeader::AOTStreamedHeapHeader(size_t forwarding_offset, + size_t roots_offset, + size_t num_roots, + size_t root_highest_object_index_table_offset, + size_t num_archived_objects) { + memset((char*)this, 0, sizeof(*this)); + _forwarding_offset = forwarding_offset; + _roots_offset = roots_offset; + _num_roots = num_roots; + _root_highest_object_index_table_offset = root_highest_object_index_table_offset; + _num_archived_objects = num_archived_objects; +} + +AOTStreamedHeapHeader::AOTStreamedHeapHeader() { + memset((char*)this, 0, sizeof(*this)); +} + +AOTStreamedHeapHeader AOTStreamedHeapInfo::create_header() { + return AOTStreamedHeapHeader{_forwarding_offset, + _roots_offset, + _num_roots, + _root_highest_object_index_table_offset, + _num_archived_objects}; +} diff --git a/src/hotspot/share/cds/aotStreamedHeap.hpp b/src/hotspot/share/cds/aotStreamedHeap.hpp new file mode 100644 index 00000000000..f06b1bcb4c6 --- /dev/null +++ b/src/hotspot/share/cds/aotStreamedHeap.hpp @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * 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_CDS_AOTSTREAMEDHEAP_HPP +#define SHARE_CDS_AOTSTREAMEDHEAP_HPP + +#include "cds/aotMapLogger.hpp" +#include "utilities/growableArray.hpp" +#include "utilities/macros.hpp" + +class AOTStreamedHeapHeader { + size_t _forwarding_offset; // Offset of forwarding information in the heap region. + size_t _roots_offset; // Start position for the roots + size_t _root_highest_object_index_table_offset; // Offset of root dfs depth information + size_t _num_roots; // Number of embedded roots + size_t _num_archived_objects; // The number of archived heap objects + +public: + AOTStreamedHeapHeader(); + AOTStreamedHeapHeader(size_t forwarding_offset, + size_t roots_offset, + size_t num_roots, + size_t root_highest_object_index_table_offset, + size_t num_archived_objects); + + size_t forwarding_offset() const { return _forwarding_offset; } + size_t roots_offset() const { return _roots_offset; } + size_t num_roots() const { return _num_roots; } + size_t root_highest_object_index_table_offset() const { return _root_highest_object_index_table_offset; } + size_t num_archived_objects() const { return _num_archived_objects; } + + // This class is trivially copyable and assignable. + AOTStreamedHeapHeader(const AOTStreamedHeapHeader&) = default; + AOTStreamedHeapHeader& operator=(const AOTStreamedHeapHeader&) = default; +}; + +class AOTStreamedHeapInfo { + MemRegion _buffer_region; // Contains the archived objects to be written into the CDS archive. + CHeapBitMap _oopmap; + size_t _roots_offset; // Offset of the HeapShared::roots() object, from the bottom + // of the archived heap objects, in bytes. + size_t _num_roots; + + size_t _forwarding_offset; // Offset of forwarding information from the bottom + size_t _root_highest_object_index_table_offset; // Offset to root dfs depth information + size_t _num_archived_objects; // The number of archived objects written into the CDS archive. + +public: + AOTStreamedHeapInfo() + : _buffer_region(), + _oopmap(128, mtClassShared), + _roots_offset(), + _forwarding_offset(), + _root_highest_object_index_table_offset(), + _num_archived_objects() {} + + bool is_used() { return !_buffer_region.is_empty(); } + + void set_buffer_region(MemRegion r) { _buffer_region = r; } + MemRegion buffer_region() { return _buffer_region; } + char* buffer_start() { return (char*)_buffer_region.start(); } + size_t buffer_byte_size() { return _buffer_region.byte_size(); } + + CHeapBitMap* oopmap() { return &_oopmap; } + void set_roots_offset(size_t n) { _roots_offset = n; } + size_t roots_offset() { return _roots_offset; } + void set_num_roots(size_t n) { _num_roots = n; } + size_t num_roots() { return _num_roots; } + void set_forwarding_offset(size_t n) { _forwarding_offset = n; } + void set_root_highest_object_index_table_offset(size_t n) { _root_highest_object_index_table_offset = n; } + void set_num_archived_objects(size_t n) { _num_archived_objects = n; } + size_t num_archived_objects() { return _num_archived_objects; } + + AOTStreamedHeapHeader create_header(); +}; + +#if INCLUDE_CDS_JAVA_HEAP +class AOTStreamedHeapOopIterator : public AOTMapLogger::OopDataIterator { +protected: + int _current; + int _next; + address _buffer_start; + int _num_archived_objects; + +public: + AOTStreamedHeapOopIterator(address buffer_start, + int num_archived_objects) + : _current(0), + _next(1), + _buffer_start(buffer_start), + _num_archived_objects(num_archived_objects) {} + + virtual AOTMapLogger::OopData capture(int dfs_index) = 0; + + bool has_next() override { + return _next <= _num_archived_objects; + } + + AOTMapLogger::OopData next() override { + _current = _next; + AOTMapLogger::OopData result = capture(_current); + _next = _current + 1; + return result; + } + + AOTMapLogger::OopData obj_at(narrowOop* addr) override { + int dfs_index = (int)(*addr); + if (dfs_index == 0) { + return null_data(); + } else { + return capture(dfs_index); + } + } + + AOTMapLogger::OopData obj_at(oop* addr) override { + int dfs_index = (int)cast_from_oop(*addr); + if (dfs_index == 0) { + return null_data(); + } else { + return capture(dfs_index); + } + } +}; +#endif // INCLUDE_CDS_JAVA_HEAP + +#endif // SHARE_CDS_AOTSTREAMEDHEAP_HPP diff --git a/src/hotspot/share/cds/aotStreamedHeapLoader.cpp b/src/hotspot/share/cds/aotStreamedHeapLoader.cpp index 6719f9bf898..39f735543cd 100644 --- a/src/hotspot/share/cds/aotStreamedHeapLoader.cpp +++ b/src/hotspot/share/cds/aotStreamedHeapLoader.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1102,25 +1102,13 @@ void AOTStreamedHeapLoader::finish_initialization(FileMapInfo* static_mapinfo) { } AOTMapLogger::OopDataIterator* AOTStreamedHeapLoader::oop_iterator(FileMapInfo* info, address buffer_start, address buffer_end) { - class StreamedLoaderOopIterator : public AOTMapLogger::OopDataIterator { - private: - int _current; - int _next; - - address _buffer_start; - - int _num_archived_objects; - + class StreamedLoaderOopIterator : public AOTStreamedHeapOopIterator { public: StreamedLoaderOopIterator(address buffer_start, int num_archived_objects) - : _current(0), - _next(1), - _buffer_start(buffer_start), - _num_archived_objects(num_archived_objects) { - } + : AOTStreamedHeapOopIterator(buffer_start, num_archived_objects) {} - AOTMapLogger::OopData capture(int dfs_index) { + AOTMapLogger::OopData capture(int dfs_index) override { size_t buffered_offset = buffer_offset_for_object_index(dfs_index); address buffered_addr = _buffer_start + buffered_offset; oopDesc* raw_oop = (oopDesc*)buffered_addr; @@ -1142,35 +1130,6 @@ AOTMapLogger::OopDataIterator* AOTStreamedHeapLoader::oop_iterator(FileMapInfo* false }; } - bool has_next() override { - return _next <= _num_archived_objects; - } - - AOTMapLogger::OopData next() override { - _current = _next; - AOTMapLogger::OopData result = capture(_current); - _next = _current + 1; - return result; - } - - AOTMapLogger::OopData obj_at(narrowOop* addr) override { - int dfs_index = (int)(*addr); - if (dfs_index == 0) { - return null_data(); - } else { - return capture(dfs_index); - } - } - - AOTMapLogger::OopData obj_at(oop* addr) override { - int dfs_index = (int)cast_from_oop(*addr); - if (dfs_index == 0) { - return null_data(); - } else { - return capture(dfs_index); - } - } - GrowableArrayCHeap* roots() override { GrowableArrayCHeap* result = new GrowableArrayCHeap(); diff --git a/src/hotspot/share/cds/aotStreamedHeapWriter.cpp b/src/hotspot/share/cds/aotStreamedHeapWriter.cpp index 16acebc7d8d..f52532b2f2a 100644 --- a/src/hotspot/share/cds/aotStreamedHeapWriter.cpp +++ b/src/hotspot/share/cds/aotStreamedHeapWriter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -163,7 +163,7 @@ void AOTStreamedHeapWriter::order_source_objs(GrowableArrayCHeap* roots, - ArchiveStreamedHeapInfo* heap_info) { + AOTStreamedHeapInfo* heap_info) { assert(CDSConfig::is_dumping_heap(), "sanity"); allocate_buffer(); order_source_objs(roots); @@ -453,7 +453,7 @@ static void log_bitmap_usage(const char* which, BitMap* bitmap, size_t total_bit } // Update all oop fields embedded in the buffered objects -void AOTStreamedHeapWriter::map_embedded_oops(ArchiveStreamedHeapInfo* heap_info) { +void AOTStreamedHeapWriter::map_embedded_oops(AOTStreamedHeapInfo* heap_info) { size_t oopmap_unit = (UseCompressedOops ? sizeof(narrowOop) : sizeof(oop)); size_t heap_region_byte_size = _buffer_used; heap_info->oopmap()->resize(heap_region_byte_size / oopmap_unit); @@ -497,7 +497,7 @@ oop AOTStreamedHeapWriter::buffered_addr_to_source_obj(address buffered_addr) { return buffered_offset_to_source_obj(buffered_address_to_offset(buffered_addr)); } -void AOTStreamedHeapWriter::populate_archive_heap_info(ArchiveStreamedHeapInfo* info) { +void AOTStreamedHeapWriter::populate_archive_heap_info(AOTStreamedHeapInfo* info) { assert(!info->is_used(), "only set once"); size_t heap_region_byte_size = _buffer_used; @@ -512,15 +512,9 @@ void AOTStreamedHeapWriter::populate_archive_heap_info(ArchiveStreamedHeapInfo* info->set_num_archived_objects((size_t)_source_objs->length()); } -AOTMapLogger::OopDataIterator* AOTStreamedHeapWriter::oop_iterator(ArchiveStreamedHeapInfo* heap_info) { - class StreamedWriterOopIterator : public AOTMapLogger::OopDataIterator { +AOTMapLogger::OopDataIterator* AOTStreamedHeapWriter::oop_iterator(AOTStreamedHeapInfo* heap_info) { + class StreamedWriterOopIterator : public AOTStreamedHeapOopIterator { private: - int _current; - int _next; - - address _buffer_start; - - int _num_archived_objects; int _num_archived_roots; int* _roots; @@ -529,15 +523,11 @@ AOTMapLogger::OopDataIterator* AOTStreamedHeapWriter::oop_iterator(ArchiveStream int num_archived_objects, int num_archived_roots, int* roots) - : _current(0), - _next(1), - _buffer_start(buffer_start), - _num_archived_objects(num_archived_objects), + : AOTStreamedHeapOopIterator(buffer_start, num_archived_objects), _num_archived_roots(num_archived_roots), - _roots(roots) { - } + _roots(roots) {} - AOTMapLogger::OopData capture(int dfs_index) { + AOTMapLogger::OopData capture(int dfs_index) override { size_t buffered_offset = _dfs_to_archive_object_table[dfs_index]; address buffered_addr = _buffer_start + buffered_offset; oop src_obj = AOTStreamedHeapWriter::buffered_offset_to_source_obj(buffered_offset); @@ -561,35 +551,6 @@ AOTMapLogger::OopDataIterator* AOTStreamedHeapWriter::oop_iterator(ArchiveStream false }; } - bool has_next() override { - return _next <= _num_archived_objects; - } - - AOTMapLogger::OopData next() override { - _current = _next; - AOTMapLogger::OopData result = capture(_current); - _next = _current + 1; - return result; - } - - AOTMapLogger::OopData obj_at(narrowOop* addr) override { - int dfs_index = (int)(*addr); - if (dfs_index == 0) { - return null_data(); - } else { - return capture(dfs_index); - } - } - - AOTMapLogger::OopData obj_at(oop* addr) override { - int dfs_index = (int)cast_from_oop(*addr); - if (dfs_index == 0) { - return null_data(); - } else { - return capture(dfs_index); - } - } - GrowableArrayCHeap* roots() override { GrowableArrayCHeap* result = new GrowableArrayCHeap(); diff --git a/src/hotspot/share/cds/aotStreamedHeapWriter.hpp b/src/hotspot/share/cds/aotStreamedHeapWriter.hpp index bde82f8ce29..ab5aec0327b 100644 --- a/src/hotspot/share/cds/aotStreamedHeapWriter.hpp +++ b/src/hotspot/share/cds/aotStreamedHeapWriter.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -117,7 +117,7 @@ class AOTStreamedHeapWriter : AllStatic { static void copy_forwarding_to_buffer(); static void copy_roots_max_dfs_to_buffer(int roots_length); - static void map_embedded_oops(ArchiveStreamedHeapInfo* info); + static void map_embedded_oops(AOTStreamedHeapInfo* info); static bool is_in_requested_range(oop o); static oop requested_obj_from_buffer_offset(size_t offset); @@ -131,14 +131,14 @@ class AOTStreamedHeapWriter : AllStatic { static void update_header_for_buffered_addr(address buffered_addr, oop src_obj, Klass* src_klass); - static void populate_archive_heap_info(ArchiveStreamedHeapInfo* info); + static void populate_archive_heap_info(AOTStreamedHeapInfo* info); public: static void init() NOT_CDS_JAVA_HEAP_RETURN; static void delete_tables_with_raw_oops(); static void add_source_obj(oop src_obj); - static void write(GrowableArrayCHeap*, ArchiveStreamedHeapInfo* heap_info); + static void write(GrowableArrayCHeap*, AOTStreamedHeapInfo* heap_info); static address buffered_heap_roots_addr() { return offset_to_buffered_address
(_roots_offset); } @@ -156,7 +156,7 @@ public: static oop buffered_offset_to_source_obj(size_t buffered_offset); static oop buffered_addr_to_source_obj(address buffered_addr); - static AOTMapLogger::OopDataIterator* oop_iterator(ArchiveStreamedHeapInfo* heap_info); + static AOTMapLogger::OopDataIterator* oop_iterator(AOTStreamedHeapInfo* heap_info); }; #endif // INCLUDE_CDS_JAVA_HEAP #endif // SHARE_CDS_AOTSTREAMEDHEAPWRITER_HPP diff --git a/src/hotspot/share/cds/archiveBuilder.cpp b/src/hotspot/share/cds/archiveBuilder.cpp index 9161980c4be..e65bd3985ac 100644 --- a/src/hotspot/share/cds/archiveBuilder.cpp +++ b/src/hotspot/share/cds/archiveBuilder.cpp @@ -1154,7 +1154,7 @@ void ArchiveBuilder::print_stats() { _alloc_stats.print_stats(int(_ro_region.used()), int(_rw_region.used())); } -void ArchiveBuilder::write_archive(FileMapInfo* mapinfo, ArchiveMappedHeapInfo* mapped_heap_info, ArchiveStreamedHeapInfo* streamed_heap_info) { +void ArchiveBuilder::write_archive(FileMapInfo* mapinfo, AOTMappedHeapInfo* mapped_heap_info, AOTStreamedHeapInfo* streamed_heap_info) { // Make sure NUM_CDS_REGIONS (exported in cds.h) agrees with // AOTMetaspace::n_regions (internal to hotspot). assert(NUM_CDS_REGIONS == AOTMetaspace::n_regions, "sanity"); @@ -1213,8 +1213,8 @@ void ArchiveBuilder::count_relocated_pointer(bool tagged, bool nulled) { } void ArchiveBuilder::print_region_stats(FileMapInfo *mapinfo, - ArchiveMappedHeapInfo* mapped_heap_info, - ArchiveStreamedHeapInfo* streamed_heap_info) { + AOTMappedHeapInfo* mapped_heap_info, + AOTStreamedHeapInfo* streamed_heap_info) { // Print statistics of all the regions const size_t bitmap_used = mapinfo->region_at(AOTMetaspace::bm)->used(); const size_t bitmap_reserved = mapinfo->region_at(AOTMetaspace::bm)->used_aligned(); diff --git a/src/hotspot/share/cds/archiveBuilder.hpp b/src/hotspot/share/cds/archiveBuilder.hpp index 9de6c02edc5..2284dbf70f8 100644 --- a/src/hotspot/share/cds/archiveBuilder.hpp +++ b/src/hotspot/share/cds/archiveBuilder.hpp @@ -39,8 +39,8 @@ #include "utilities/hashTable.hpp" #include "utilities/resizableHashTable.hpp" -class ArchiveMappedHeapInfo; -class ArchiveStreamedHeapInfo; +class AOTMappedHeapInfo; +class AOTStreamedHeapInfo; class CHeapBitMap; class FileMapInfo; class Klass; @@ -247,8 +247,8 @@ private: } _relocated_ptr_info; void print_region_stats(FileMapInfo *map_info, - ArchiveMappedHeapInfo* mapped_heap_info, - ArchiveStreamedHeapInfo* streamed_heap_info); + AOTMappedHeapInfo* mapped_heap_info, + AOTStreamedHeapInfo* streamed_heap_info); void print_bitmap_region_stats(size_t size, size_t total_size); void print_heap_region_stats(char* start, size_t size, size_t total_size); @@ -438,8 +438,8 @@ public: void make_training_data_shareable(); void relocate_to_requested(); void write_archive(FileMapInfo* mapinfo, - ArchiveMappedHeapInfo* mapped_heap_info, - ArchiveStreamedHeapInfo* streamed_heap_info); + AOTMappedHeapInfo* mapped_heap_info, + AOTStreamedHeapInfo* streamed_heap_info); void write_region(FileMapInfo* mapinfo, int region_idx, DumpRegion* dump_region, bool read_only, bool allow_exec); diff --git a/src/hotspot/share/cds/filemap.cpp b/src/hotspot/share/cds/filemap.cpp index 0eeb96bb269..7cd736885ad 100644 --- a/src/hotspot/share/cds/filemap.cpp +++ b/src/hotspot/share/cds/filemap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -974,8 +974,8 @@ size_t FileMapInfo::remove_bitmap_zeros(CHeapBitMap* map) { char* FileMapInfo::write_bitmap_region(CHeapBitMap* rw_ptrmap, CHeapBitMap* ro_ptrmap, - ArchiveMappedHeapInfo* mapped_heap_info, - ArchiveStreamedHeapInfo* streamed_heap_info, + AOTMappedHeapInfo* mapped_heap_info, + AOTStreamedHeapInfo* streamed_heap_info, size_t &size_in_bytes) { size_t removed_rw_leading_zeros = remove_bitmap_zeros(rw_ptrmap); size_t removed_ro_leading_zeros = remove_bitmap_zeros(ro_ptrmap); @@ -1035,7 +1035,7 @@ char* FileMapInfo::write_bitmap_region(CHeapBitMap* rw_ptrmap, } #if INCLUDE_CDS_JAVA_HEAP -size_t FileMapInfo::write_mapped_heap_region(ArchiveMappedHeapInfo* heap_info) { +size_t FileMapInfo::write_mapped_heap_region(AOTMappedHeapInfo* heap_info) { char* buffer_start = heap_info->buffer_start(); size_t buffer_size = heap_info->buffer_byte_size(); write_region(AOTMetaspace::hp, buffer_start, buffer_size, false, false); @@ -1043,7 +1043,7 @@ size_t FileMapInfo::write_mapped_heap_region(ArchiveMappedHeapInfo* heap_info) { return buffer_size; } -size_t FileMapInfo::write_streamed_heap_region(ArchiveStreamedHeapInfo* heap_info) { +size_t FileMapInfo::write_streamed_heap_region(AOTStreamedHeapInfo* heap_info) { char* buffer_start = heap_info->buffer_start(); size_t buffer_size = heap_info->buffer_byte_size(); write_region(AOTMetaspace::hp, buffer_start, buffer_size, true, false); diff --git a/src/hotspot/share/cds/filemap.hpp b/src/hotspot/share/cds/filemap.hpp index fbd3c8e1681..ec7b58a6d19 100644 --- a/src/hotspot/share/cds/filemap.hpp +++ b/src/hotspot/share/cds/filemap.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,9 @@ #ifndef SHARE_CDS_FILEMAP_HPP #define SHARE_CDS_FILEMAP_HPP +#include "cds/aotMappedHeap.hpp" #include "cds/aotMetaspace.hpp" +#include "cds/aotStreamedHeap.hpp" #include "cds/archiveUtils.hpp" #include "cds/heapShared.hpp" #include "include/cds.h" @@ -144,8 +146,8 @@ private: size_t _rw_ptrmap_start_pos; // The first bit in the ptrmap corresponds to this position in the rw region size_t _ro_ptrmap_start_pos; // The first bit in the ptrmap corresponds to this position in the ro region - ArchiveMappedHeapHeader _mapped_heap_header; - ArchiveStreamedHeapHeader _streamed_heap_header; + AOTMappedHeapHeader _mapped_heap_header; + AOTStreamedHeapHeader _streamed_heap_header; // The following are parameters that affect MethodData layout. u1 _compiler_type; @@ -209,11 +211,11 @@ public: size_t ro_ptrmap_start_pos() const { return _ro_ptrmap_start_pos; } // Heap archiving - const ArchiveMappedHeapHeader* mapped_heap() const { return &_mapped_heap_header; } - const ArchiveStreamedHeapHeader* streamed_heap() const { return &_streamed_heap_header; } + const AOTMappedHeapHeader* mapped_heap() const { return &_mapped_heap_header; } + const AOTStreamedHeapHeader* streamed_heap() const { return &_streamed_heap_header; } - void set_streamed_heap_header(ArchiveStreamedHeapHeader header) { _streamed_heap_header = header; } - void set_mapped_heap_header(ArchiveMappedHeapHeader header) { _mapped_heap_header = header; } + void set_streamed_heap_header(AOTStreamedHeapHeader header) { _streamed_heap_header = header; } + void set_mapped_heap_header(AOTMappedHeapHeader header) { _mapped_heap_header = header; } void set_has_platform_or_app_classes(bool v) { _has_platform_or_app_classes = v; } void set_cloned_vtables(char* p) { set_as_offset(p, &_cloned_vtables_offset); } @@ -309,8 +311,8 @@ public: uintx max_heap_size() const { return header()->max_heap_size(); } size_t core_region_alignment() const { return header()->core_region_alignment(); } - const ArchiveMappedHeapHeader* mapped_heap() const { return header()->mapped_heap(); } - const ArchiveStreamedHeapHeader* streamed_heap() const { return header()->streamed_heap(); } + const AOTMappedHeapHeader* mapped_heap() const { return header()->mapped_heap(); } + const AOTStreamedHeapHeader* streamed_heap() const { return header()->streamed_heap(); } bool object_streaming_mode() const { return header()->object_streaming_mode(); } CompressedOops::Mode narrow_oop_mode() const { return header()->narrow_oop_mode(); } @@ -372,11 +374,11 @@ public: size_t remove_bitmap_zeros(CHeapBitMap* map); char* write_bitmap_region(CHeapBitMap* rw_ptrmap, CHeapBitMap* ro_ptrmap, - ArchiveMappedHeapInfo* mapped_heap_info, - ArchiveStreamedHeapInfo* streamed_heap_info, + AOTMappedHeapInfo* mapped_heap_info, + AOTStreamedHeapInfo* streamed_heap_info, size_t &size_in_bytes); - size_t write_mapped_heap_region(ArchiveMappedHeapInfo* heap_info) NOT_CDS_JAVA_HEAP_RETURN_(0); - size_t write_streamed_heap_region(ArchiveStreamedHeapInfo* heap_info) NOT_CDS_JAVA_HEAP_RETURN_(0); + size_t write_mapped_heap_region(AOTMappedHeapInfo* heap_info) NOT_CDS_JAVA_HEAP_RETURN_(0); + size_t write_streamed_heap_region(AOTStreamedHeapInfo* heap_info) NOT_CDS_JAVA_HEAP_RETURN_(0); void write_bytes(const void* buffer, size_t count); void write_bytes_aligned(const void* buffer, size_t count); size_t read_bytes(void* buffer, size_t count); diff --git a/src/hotspot/share/cds/heapShared.cpp b/src/hotspot/share/cds/heapShared.cpp index 143f9147853..69a098c67b3 100644 --- a/src/hotspot/share/cds/heapShared.cpp +++ b/src/hotspot/share/cds/heapShared.cpp @@ -95,55 +95,6 @@ struct ArchivableStaticFieldInfo { } }; -// Anything that goes in the header must be thoroughly purged from uninitialized memory -// as it will be written to disk. Therefore, the constructors memset the memory to 0. -// This is not the prettiest thing, but we need to know every byte is initialized, -// including potential padding between fields. - -ArchiveMappedHeapHeader::ArchiveMappedHeapHeader(size_t ptrmap_start_pos, - size_t oopmap_start_pos, - HeapRootSegments root_segments) { - memset((char*)this, 0, sizeof(*this)); - _ptrmap_start_pos = ptrmap_start_pos; - _oopmap_start_pos = oopmap_start_pos; - _root_segments = root_segments; -} - -ArchiveMappedHeapHeader::ArchiveMappedHeapHeader() { - memset((char*)this, 0, sizeof(*this)); -} - -ArchiveMappedHeapHeader ArchiveMappedHeapInfo::create_header() { - return ArchiveMappedHeapHeader{_ptrmap_start_pos, - _oopmap_start_pos, - _root_segments}; -} - -ArchiveStreamedHeapHeader::ArchiveStreamedHeapHeader(size_t forwarding_offset, - size_t roots_offset, - size_t num_roots, - size_t root_highest_object_index_table_offset, - size_t num_archived_objects) { - memset((char*)this, 0, sizeof(*this)); - _forwarding_offset = forwarding_offset; - _roots_offset = roots_offset; - _num_roots = num_roots; - _root_highest_object_index_table_offset = root_highest_object_index_table_offset; - _num_archived_objects = num_archived_objects; -} - -ArchiveStreamedHeapHeader::ArchiveStreamedHeapHeader() { - memset((char*)this, 0, sizeof(*this)); -} - -ArchiveStreamedHeapHeader ArchiveStreamedHeapInfo::create_header() { - return ArchiveStreamedHeapHeader{_forwarding_offset, - _roots_offset, - _num_roots, - _root_highest_object_index_table_offset, - _num_archived_objects}; -} - HeapArchiveMode HeapShared::_heap_load_mode = HeapArchiveMode::_uninitialized; HeapArchiveMode HeapShared::_heap_write_mode = HeapArchiveMode::_uninitialized; @@ -892,7 +843,7 @@ void HeapShared::end_scanning_for_oops() { delete_seen_objects_table(); } -void HeapShared::write_heap(ArchiveMappedHeapInfo* mapped_heap_info, ArchiveStreamedHeapInfo* streamed_heap_info) { +void HeapShared::write_heap(AOTMappedHeapInfo* mapped_heap_info, AOTStreamedHeapInfo* streamed_heap_info) { { NoSafepointVerifier nsv; CDSHeapVerifier::verify(); diff --git a/src/hotspot/share/cds/heapShared.hpp b/src/hotspot/share/cds/heapShared.hpp index 3c7068e96ab..ba17ddda267 100644 --- a/src/hotspot/share/cds/heapShared.hpp +++ b/src/hotspot/share/cds/heapShared.hpp @@ -142,129 +142,6 @@ enum class HeapArchiveMode { _streaming }; -class ArchiveMappedHeapHeader { - size_t _ptrmap_start_pos; // The first bit in the ptrmap corresponds to this position in the heap. - size_t _oopmap_start_pos; // The first bit in the oopmap corresponds to this position in the heap. - HeapRootSegments _root_segments; // Heap root segments info - -public: - ArchiveMappedHeapHeader(); - ArchiveMappedHeapHeader(size_t ptrmap_start_pos, - size_t oopmap_start_pos, - HeapRootSegments root_segments); - - size_t ptrmap_start_pos() const { return _ptrmap_start_pos; } - size_t oopmap_start_pos() const { return _oopmap_start_pos; } - HeapRootSegments root_segments() const { return _root_segments; } - - // This class is trivially copyable and assignable. - ArchiveMappedHeapHeader(const ArchiveMappedHeapHeader&) = default; - ArchiveMappedHeapHeader& operator=(const ArchiveMappedHeapHeader&) = default; -}; - - -class ArchiveStreamedHeapHeader { - size_t _forwarding_offset; // Offset of forwarding information in the heap region. - size_t _roots_offset; // Start position for the roots - size_t _root_highest_object_index_table_offset; // Offset of root dfs depth information - size_t _num_roots; // Number of embedded roots - size_t _num_archived_objects; // The number of archived heap objects - -public: - ArchiveStreamedHeapHeader(); - ArchiveStreamedHeapHeader(size_t forwarding_offset, - size_t roots_offset, - size_t num_roots, - size_t root_highest_object_index_table_offset, - size_t num_archived_objects); - - size_t forwarding_offset() const { return _forwarding_offset; } - size_t roots_offset() const { return _roots_offset; } - size_t num_roots() const { return _num_roots; } - size_t root_highest_object_index_table_offset() const { return _root_highest_object_index_table_offset; } - size_t num_archived_objects() const { return _num_archived_objects; } - - // This class is trivially copyable and assignable. - ArchiveStreamedHeapHeader(const ArchiveStreamedHeapHeader&) = default; - ArchiveStreamedHeapHeader& operator=(const ArchiveStreamedHeapHeader&) = default; -}; - -class ArchiveMappedHeapInfo { - MemRegion _buffer_region; // Contains the archived objects to be written into the CDS archive. - CHeapBitMap _oopmap; - CHeapBitMap _ptrmap; - HeapRootSegments _root_segments; - size_t _oopmap_start_pos; // How many zeros were removed from the beginning of the bit map? - size_t _ptrmap_start_pos; // How many zeros were removed from the beginning of the bit map? - -public: - ArchiveMappedHeapInfo() : - _buffer_region(), - _oopmap(128, mtClassShared), - _ptrmap(128, mtClassShared), - _root_segments(), - _oopmap_start_pos(), - _ptrmap_start_pos() {} - bool is_used() { return !_buffer_region.is_empty(); } - - MemRegion buffer_region() { return _buffer_region; } - void set_buffer_region(MemRegion r) { _buffer_region = r; } - - char* buffer_start() { return (char*)_buffer_region.start(); } - size_t buffer_byte_size() { return _buffer_region.byte_size(); } - - CHeapBitMap* oopmap() { return &_oopmap; } - CHeapBitMap* ptrmap() { return &_ptrmap; } - - void set_oopmap_start_pos(size_t start_pos) { _oopmap_start_pos = start_pos; } - void set_ptrmap_start_pos(size_t start_pos) { _ptrmap_start_pos = start_pos; } - - void set_root_segments(HeapRootSegments segments) { _root_segments = segments; }; - HeapRootSegments root_segments() { return _root_segments; } - - ArchiveMappedHeapHeader create_header(); -}; - -class ArchiveStreamedHeapInfo { - MemRegion _buffer_region; // Contains the archived objects to be written into the CDS archive. - CHeapBitMap _oopmap; - size_t _roots_offset; // Offset of the HeapShared::roots() object, from the bottom - // of the archived heap objects, in bytes. - size_t _num_roots; - - size_t _forwarding_offset; // Offset of forwarding information from the bottom - size_t _root_highest_object_index_table_offset; // Offset to root dfs depth information - size_t _num_archived_objects; // The number of archived objects written into the CDS archive. - -public: - ArchiveStreamedHeapInfo() - : _buffer_region(), - _oopmap(128, mtClassShared), - _roots_offset(), - _forwarding_offset(), - _root_highest_object_index_table_offset(), - _num_archived_objects() {} - - bool is_used() { return !_buffer_region.is_empty(); } - - void set_buffer_region(MemRegion r) { _buffer_region = r; } - MemRegion buffer_region() { return _buffer_region; } - char* buffer_start() { return (char*)_buffer_region.start(); } - size_t buffer_byte_size() { return _buffer_region.byte_size(); } - - CHeapBitMap* oopmap() { return &_oopmap; } - void set_roots_offset(size_t n) { _roots_offset = n; } - size_t roots_offset() { return _roots_offset; } - void set_num_roots(size_t n) { _num_roots = n; } - size_t num_roots() { return _num_roots; } - void set_forwarding_offset(size_t n) { _forwarding_offset = n; } - void set_root_highest_object_index_table_offset(size_t n) { _root_highest_object_index_table_offset = n; } - void set_num_archived_objects(size_t n) { _num_archived_objects = n; } - size_t num_archived_objects() { return _num_archived_objects; } - - ArchiveStreamedHeapHeader create_header(); -}; - class HeapShared: AllStatic { friend class VerifySharedOopClosure; @@ -575,7 +452,7 @@ private: public: static void finish_materialize_objects() NOT_CDS_JAVA_HEAP_RETURN; - static void write_heap(ArchiveMappedHeapInfo* mapped_heap_info, ArchiveStreamedHeapInfo* streamed_heap_info) NOT_CDS_JAVA_HEAP_RETURN; + static void write_heap(AOTMappedHeapInfo* mapped_heap_info, AOTStreamedHeapInfo* streamed_heap_info) NOT_CDS_JAVA_HEAP_RETURN; static objArrayOop scratch_resolved_references(ConstantPool* src); static void add_scratch_resolved_references(ConstantPool* src, objArrayOop dest) NOT_CDS_JAVA_HEAP_RETURN; static void init_dumping() NOT_CDS_JAVA_HEAP_RETURN; From 3de6dbab14e950c1725a48686478e4155c8d93c7 Mon Sep 17 00:00:00 2001 From: Damon Nguyen Date: Wed, 11 Feb 2026 00:55:17 +0000 Subject: [PATCH 052/120] 8377183: Impossible or redundant condition in AwtFrame::_NotifyModalBlocked of awt_Frame.cpp:1635 Reviewed-by: serb, prr --- src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp b/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp index e679eb88dd2..19a38bcaa2d 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp +++ b/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1632,7 +1632,7 @@ void AwtFrame::_NotifyModalBlocked(void *param) } } - if ((f != NULL) && ::IsWindow(f->GetHWnd())) + if (::IsWindow(f->GetHWnd())) { // get an HWND of the toplevel window this embedded frame is within HWND fHWnd = f->GetHWnd(); From 4e3033f2122d773c173b0bb50120099589adcf3c Mon Sep 17 00:00:00 2001 From: Kim Barrett Date: Wed, 11 Feb 2026 00:59:20 +0000 Subject: [PATCH 053/120] 8332189: Enable -Wzero-as-null-pointer-constant for gcc/clang Reviewed-by: azafari, dholmes, erikj --- doc/hotspot-style.html | 5 ++-- doc/hotspot-style.md | 3 +-- make/autoconf/flags-cflags.m4 | 47 +++++++++++++++++++---------------- 3 files changed, 28 insertions(+), 27 deletions(-) diff --git a/doc/hotspot-style.html b/doc/hotspot-style.html index 362245cd00a..c7126622c7d 100644 --- a/doc/hotspot-style.html +++ b/doc/hotspot-style.html @@ -965,9 +965,8 @@ rather than NULL. See the paper for reasons to avoid NULL.

Don't use (constant expression or literal) 0 for pointers. Note that C++14 removed non-literal 0 constants from null pointer -constants, though some compilers continue to treat them as such. -For historical reasons there may be lingering uses of 0 as a -pointer.

+constants, though some compilers continue to treat them as +such.

<atomic>

Do not use facilities provided by the <atomic> header ( Date: Wed, 11 Feb 2026 01:12:06 +0000 Subject: [PATCH 054/120] 8377368: [REDO] Mixed jstack cannot find function in vDSO Reviewed-by: cjplummer, kevinw --- .../linux/native/libsaproc/libproc_impl.h | 5 +- .../linux/native/libsaproc/ps_core.c | 74 ++++++++++++-- .../sa/LingeredAppWithVDSOCall.java | 61 ++++++++++++ .../TestJhsdbJstackMixedWithVDSOCallCore.java | 96 +++++++++++++++++++ test/lib/jdk/test/lib/apps/LingeredApp.java | 16 +++- 5 files changed, 241 insertions(+), 11 deletions(-) create mode 100644 test/hotspot/jtreg/serviceability/sa/LingeredAppWithVDSOCall.java create mode 100644 test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixedWithVDSOCallCore.java diff --git a/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.h b/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.h index 42a6212510c..262e99f4a64 100644 --- a/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.h +++ b/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -95,6 +95,9 @@ struct core_data { // part of the class sharing workaround int classes_jsa_fd; // file descriptor of class share archive uintptr_t dynamic_addr; // address of dynamic section of a.out + uintptr_t vdso_addr; // address of vDSO + off64_t vdso_offset; // offset of vDSO in core + size_t vdso_size; // size of vDSO uintptr_t ld_base_addr; // base address of ld.so size_t num_maps; // number of maps. map_info* maps; // maps in a linked list diff --git a/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c b/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c index 899d42152d1..6a991b18c10 100644 --- a/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c +++ b/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved. * 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,14 @@ #include #include #include +#include #include #include #include #include #include +#include +#include #include "libproc_impl.h" #include "ps_core_common.h" #include "proc_service.h" @@ -285,6 +288,8 @@ static bool core_handle_note(struct ps_prochandle* ph, ELF_PHDR* note_phdr) { // We will adjust it in read_exec_segments(). ph->core->dynamic_addr = auxv->a_un.a_val; break; + } else if (auxv->a_type == AT_SYSINFO_EHDR) { + ph->core->vdso_addr = auxv->a_un.a_val; } auxv++; } @@ -350,6 +355,10 @@ static bool read_core_segments(struct ps_prochandle* ph, ELF_EHDR* core_ehdr) { print_error("failed to add map info\n"); goto err; } + if (core_php->p_vaddr == ph->core->vdso_addr) { + ph->core->vdso_offset = core_php->p_offset; + ph->core->vdso_size = core_php->p_memsz; + } } break; } @@ -413,10 +422,18 @@ static bool read_lib_segments(struct ps_prochandle* ph, int lib_fd, ELF_EHDR* li if (target_vaddr > existing_map->vaddr) { lib_memsz += target_vaddr - existing_map->vaddr; } + uint64_t aligned_lib_memsz = ROUNDUP(lib_memsz, page_size); + size_t aligned_segment_sz = ROUNDUP(lib_php->p_memsz, page_size); + if (target_vaddr == ph->core->vdso_addr) { + // We can overwrite with entire vDSO because vDSO on memory is + // entire ELF binary. + aligned_lib_memsz = ROUNDUP(existing_map->memsz, page_size); + aligned_segment_sz = aligned_lib_memsz; + } if ((existing_map->memsz != page_size) && (existing_map->fd != lib_fd) && - (ROUNDUP(existing_map->memsz, page_size) != ROUNDUP(lib_memsz, page_size))) { + (ROUNDUP(existing_map->memsz, page_size) != aligned_lib_memsz)) { print_error("address conflict @ 0x%lx (existing map size = %ld, size = %ld, flags = %d)\n", target_vaddr, existing_map->memsz, lib_php->p_memsz, lib_php->p_flags); @@ -425,11 +442,11 @@ static bool read_lib_segments(struct ps_prochandle* ph, int lib_fd, ELF_EHDR* li /* replace PT_LOAD segment with library segment */ print_debug("overwrote with new address mapping (memsz %ld -> %ld)\n", - existing_map->memsz, ROUNDUP(lib_php->p_memsz, page_size)); + existing_map->memsz, aligned_segment_sz); existing_map->fd = lib_fd; existing_map->offset = lib_php->p_offset; - existing_map->memsz = ROUNDUP(lib_php->p_memsz, page_size); + existing_map->memsz = aligned_segment_sz; } } @@ -593,6 +610,44 @@ static uintptr_t calc_prelinked_load_address(struct ps_prochandle* ph, int lib_f return load_addr; } +// Check for vDSO binary in kernel directory (/lib/modules//vdso), +// rewrite the given lib_name string if found. +// Otherwise copy vDSO memory in coredump to temporal file generated by tmpfile(). +// Returns FD for vDSO (should be closed by caller), or -1 on error. +static int handle_vdso(struct ps_prochandle* ph, char* lib_name, size_t lib_name_len) { + int lib_fd; + struct utsname uts; + uname(&uts); + + // Check vDSO binary first (for referring debuginfo if possible). + char *vdso_path = (char*)malloc(lib_name_len); + snprintf(vdso_path, lib_name_len, "/lib/modules/%s/vdso/vdso64.so", uts.release); + lib_fd = pathmap_open(vdso_path); + if (lib_fd != -1) { + print_debug("replace vDSO: %s -> %s\n", lib_name, vdso_path); + strncpy(lib_name, vdso_path, lib_name_len); + } else { + // Copy vDSO memory segment from core to temporal memory + // if vDSO binary is not available. + FILE* tmpf = tmpfile(); + if (tmpf == NULL) { + print_debug("can't create tmpfile for vDSO (%d)\n", errno); + lib_fd = -1; + } else { + lib_fd = fileno(tmpf); + off64_t ofs = ph->core->vdso_offset; + if (sendfile64(lib_fd, ph->core->core_fd, &ofs, ph->core->vdso_size) == -1) { + print_debug("can't copy vDSO (%d)\n", errno); + fclose(tmpf); + lib_fd = -1; + } + } + } + + free(vdso_path); + return lib_fd; +} + // read shared library info from runtime linker's data structures. // This work is done by librtlb_db in Solaris static bool read_shared_lib_info(struct ps_prochandle* ph) { @@ -687,9 +742,14 @@ static bool read_shared_lib_info(struct ps_prochandle* ph) { // it will fail later. } - if (lib_name[0] != '\0') { - // ignore empty lib names - lib_fd = pathmap_open(lib_name); + if (lib_name[0] != '\0') { // ignore empty lib names + // We can use lib_base_diff to compare with vdso_addr + // because base address of vDSO should be 0. + if (lib_base_diff == ph->core->vdso_addr) { + lib_fd = handle_vdso(ph, lib_name, sizeof(lib_name)); + } else { + lib_fd = pathmap_open(lib_name); + } if (lib_fd < 0) { print_debug("can't open shared object %s\n", lib_name); diff --git a/test/hotspot/jtreg/serviceability/sa/LingeredAppWithVDSOCall.java b/test/hotspot/jtreg/serviceability/sa/LingeredAppWithVDSOCall.java new file mode 100644 index 00000000000..d893ddf6f89 --- /dev/null +++ b/test/hotspot/jtreg/serviceability/sa/LingeredAppWithVDSOCall.java @@ -0,0 +1,61 @@ + +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2026, NTT DATA + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.lang.invoke.MethodHandle; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; +import java.lang.foreign.ValueLayout; + +import jdk.test.lib.Asserts; +import jdk.test.lib.apps.LingeredApp; + + +public class LingeredAppWithVDSOCall extends LingeredApp { + + private static final MethodHandle gettimeofday; + + static { + var desc = FunctionDescriptor.of(ValueLayout.JAVA_INT, // return + ValueLayout.JAVA_LONG, // tv + ValueLayout.JAVA_LONG); // tz + var linker = Linker.nativeLinker(); + var gettimeofdayPtr = linker.defaultLookup().findOrThrow("gettimeofday"); + gettimeofday = linker.downcallHandle(gettimeofdayPtr, desc); + } + + private static void crashAtGettimeofday(long tvAddr, long tzAddr) { + try { + gettimeofday.invoke(tvAddr, tzAddr); + } catch (Throwable t) { + throw new RuntimeException(t); + } + Asserts.fail("gettimeofday() didn't crash"); + } + + public static void main(String[] args) { + setCrasher(() -> crashAtGettimeofday(100L, 200L)); + LingeredApp.main(args); + } +} diff --git a/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixedWithVDSOCallCore.java b/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixedWithVDSOCallCore.java new file mode 100644 index 00000000000..84da46e272f --- /dev/null +++ b/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixedWithVDSOCallCore.java @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2026, NTT DATA + * 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.nio.file.Path; + +import jtreg.SkippedException; + +import jdk.test.lib.JDKToolFinder; +import jdk.test.lib.JDKToolLauncher; +import jdk.test.lib.Platform; +import jdk.test.lib.SA.SATestUtils; +import jdk.test.lib.Utils; +import jdk.test.lib.apps.LingeredApp; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.util.CoreUtils; + +/** + * @test + * @bug 8376269 + * @requires (os.family == "linux") & (vm.hasSA) + * @requires os.arch == "amd64" + * @library /test/lib + * @run driver TestJhsdbJstackMixedWithVDSOCallCore + */ +public class TestJhsdbJstackMixedWithVDSOCallCore { + + private static void runJstackMixed(String coreFileName) throws Exception { + JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jhsdb"); + launcher.addVMArgs(Utils.getTestJavaOpts()); + launcher.addToolArg("jstack"); + launcher.addToolArg("--mixed"); + launcher.addToolArg("--exe"); + launcher.addToolArg(JDKToolFinder.getTestJDKTool("java")); + launcher.addToolArg("--core"); + launcher.addToolArg(coreFileName); + + ProcessBuilder pb = SATestUtils.createProcessBuilder(launcher); + Process jhsdb = pb.start(); + OutputAnalyzer out = new OutputAnalyzer(jhsdb); + + jhsdb.waitFor(); + + System.out.println(out.getStdout()); + System.err.println(out.getStderr()); + + out.shouldContain("vdso_gettimeofday"); + } + + private static void checkVDSODebugInfo() { + var kernelVersion = System.getProperty("os.version"); + var vdso = Path.of("/lib", "modules", kernelVersion, "vdso", "vdso64.so"); + if (SATestUtils.getDebugInfo(vdso.toString()) == null) { + // Skip this test if debuginfo of vDSO not found because internal + // function of gettimeofday() would not be exported, and vDSO + // binary might be stripped. + throw new SkippedException("vDSO debuginfo not found (" + vdso.toString() + ")"); + } + } + + public static void main(String... args) throws Throwable { + if (Platform.isMusl()) { + throw new SkippedException("This test does not work on musl libc."); + } + checkVDSODebugInfo(); + + var app = new LingeredAppWithVDSOCall(); + app.setForceCrash(true); + LingeredApp.startApp(app, CoreUtils.getAlwaysPretouchArg(true)); + app.waitAppTerminate(); + + String crashOutput = app.getOutput().getStdout(); + String coreFileName = CoreUtils.getCoreFileLocation(crashOutput, app.getPid()); + runJstackMixed(coreFileName); + } +} diff --git a/test/lib/jdk/test/lib/apps/LingeredApp.java b/test/lib/jdk/test/lib/apps/LingeredApp.java index 13008e68c54..38ad9ae5b0e 100644 --- a/test/lib/jdk/test/lib/apps/LingeredApp.java +++ b/test/lib/jdk/test/lib/apps/LingeredApp.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -122,6 +122,12 @@ public class LingeredApp { this.forceCrash = forceCrash; } + private static Runnable crasher; + + public static void setCrasher(Runnable runnable) { + crasher = runnable; + } + native private static int crash(); /** @@ -628,8 +634,12 @@ public class LingeredApp { synchronized(steadyStateObj) { startSteadyStateThread(steadyStateObj); if (forceCrash) { - System.loadLibrary("LingeredApp"); // location of native crash() method - crash(); + if (crasher == null) { + System.loadLibrary("LingeredApp"); // location of native crash() method + crash(); + } else { + crasher.run(); + } } while (Files.exists(path)) { // Touch the lock to indicate our readiness From 8455b668104f97bc152985299a7814646c9fb1fd Mon Sep 17 00:00:00 2001 From: Ben Taylor Date: Wed, 11 Feb 2026 01:39:13 +0000 Subject: [PATCH 055/120] 8377200: Shenandoah: Convert shenandoahSharedVariables and related code to use Atomic Reviewed-by: wkemper, xpeng --- .../shenandoah/shenandoahSharedVariables.hpp | 78 ++++++++----------- 1 file changed, 32 insertions(+), 46 deletions(-) diff --git a/src/hotspot/share/gc/shenandoah/shenandoahSharedVariables.hpp b/src/hotspot/share/gc/shenandoah/shenandoahSharedVariables.hpp index 12c01ad5c90..e23187a5d3f 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahSharedVariables.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahSharedVariables.hpp @@ -27,7 +27,7 @@ #include "gc/shenandoah/shenandoahPadding.hpp" #include "memory/allocation.hpp" -#include "runtime/atomicAccess.hpp" +#include "runtime/atomic.hpp" typedef int32_t ShenandoahSharedValue; typedef struct ShenandoahSharedFlag { @@ -37,7 +37,7 @@ typedef struct ShenandoahSharedFlag { }; shenandoah_padding(0); - volatile ShenandoahSharedValue value; + Atomic value; shenandoah_padding(1); ShenandoahSharedFlag() { @@ -45,19 +45,19 @@ typedef struct ShenandoahSharedFlag { } void set() { - AtomicAccess::release_store_fence(&value, (ShenandoahSharedValue)SET); + value.release_store_fence((ShenandoahSharedValue)SET); } void unset() { - AtomicAccess::release_store_fence(&value, (ShenandoahSharedValue)UNSET); + value.release_store_fence((ShenandoahSharedValue)UNSET); } bool is_set() const { - return AtomicAccess::load_acquire(&value) == SET; + return value.load_acquire() == SET; } bool is_unset() const { - return AtomicAccess::load_acquire(&value) == UNSET; + return value.load_acquire() == UNSET; } void set_cond(bool val) { @@ -72,7 +72,7 @@ typedef struct ShenandoahSharedFlag { if (is_set()) { return false; } - ShenandoahSharedValue old = AtomicAccess::cmpxchg(&value, (ShenandoahSharedValue)UNSET, (ShenandoahSharedValue)SET); + ShenandoahSharedValue old = value.compare_exchange((ShenandoahSharedValue)UNSET, (ShenandoahSharedValue)SET); return old == UNSET; // success } @@ -80,17 +80,13 @@ typedef struct ShenandoahSharedFlag { if (!is_set()) { return false; } - ShenandoahSharedValue old = AtomicAccess::cmpxchg(&value, (ShenandoahSharedValue)SET, (ShenandoahSharedValue)UNSET); + ShenandoahSharedValue old = value.compare_exchange((ShenandoahSharedValue)SET, (ShenandoahSharedValue)UNSET); return old == SET; // success } - volatile ShenandoahSharedValue* addr_of() { - return &value; - } - private: volatile ShenandoahSharedValue* operator&() { - fatal("Use addr_of() instead"); + fatal("Not supported"); return nullptr; } @@ -105,7 +101,7 @@ private: typedef struct ShenandoahSharedBitmap { shenandoah_padding(0); - volatile ShenandoahSharedValue value; + Atomic value; shenandoah_padding(1); ShenandoahSharedBitmap() { @@ -116,7 +112,7 @@ typedef struct ShenandoahSharedBitmap { assert (mask < (sizeof(ShenandoahSharedValue) * CHAR_MAX), "sanity"); ShenandoahSharedValue mask_val = (ShenandoahSharedValue) mask; while (true) { - ShenandoahSharedValue ov = AtomicAccess::load_acquire(&value); + ShenandoahSharedValue ov = value.load_acquire(); // We require all bits of mask_val to be set if ((ov & mask_val) == mask_val) { // already set @@ -124,7 +120,7 @@ typedef struct ShenandoahSharedBitmap { } ShenandoahSharedValue nv = ov | mask_val; - if (AtomicAccess::cmpxchg(&value, ov, nv) == ov) { + if (value.compare_exchange(ov, nv) == ov) { // successfully set: if value returned from cmpxchg equals ov, then nv has overwritten value. return; } @@ -135,14 +131,14 @@ typedef struct ShenandoahSharedBitmap { assert (mask < (sizeof(ShenandoahSharedValue) * CHAR_MAX), "sanity"); ShenandoahSharedValue mask_val = (ShenandoahSharedValue) mask; while (true) { - ShenandoahSharedValue ov = AtomicAccess::load_acquire(&value); + ShenandoahSharedValue ov = value.load_acquire(); if ((ov & mask_val) == 0) { // already unset return; } ShenandoahSharedValue nv = ov & ~mask_val; - if (AtomicAccess::cmpxchg(&value, ov, nv) == ov) { + if (value.compare_exchange(ov, nv) == ov) { // successfully unset return; } @@ -150,7 +146,7 @@ typedef struct ShenandoahSharedBitmap { } void clear() { - AtomicAccess::release_store_fence(&value, (ShenandoahSharedValue)0); + value.release_store_fence((ShenandoahSharedValue)0); } // Returns true iff any bit set in mask is set in this.value. @@ -161,18 +157,18 @@ typedef struct ShenandoahSharedBitmap { // Returns true iff all bits set in mask are set in this.value. bool is_set_exactly(uint mask) const { assert (mask < (sizeof(ShenandoahSharedValue) * CHAR_MAX), "sanity"); - uint uvalue = AtomicAccess::load_acquire(&value); + uint uvalue = value.load_acquire(); return (uvalue & mask) == mask; } // Returns true iff all bits set in mask are unset in this.value. bool is_unset(uint mask) const { assert (mask < (sizeof(ShenandoahSharedValue) * CHAR_MAX), "sanity"); - return (AtomicAccess::load_acquire(&value) & (ShenandoahSharedValue) mask) == 0; + return (value.load_acquire() & (ShenandoahSharedValue) mask) == 0; } bool is_clear() const { - return (AtomicAccess::load_acquire(&value)) == 0; + return (value.load_acquire()) == 0; } void set_cond(uint mask, bool val) { @@ -183,17 +179,13 @@ typedef struct ShenandoahSharedBitmap { } } - volatile ShenandoahSharedValue* addr_of() { - return &value; - } - ShenandoahSharedValue raw_value() const { - return value; + return value.load_relaxed(); } private: volatile ShenandoahSharedValue* operator&() { - fatal("Use addr_of() instead"); + fatal("Not supported"); return nullptr; } @@ -210,42 +202,36 @@ template struct ShenandoahSharedEnumFlag { typedef uint32_t EnumValueType; shenandoah_padding(0); - volatile EnumValueType value; + Atomic value; shenandoah_padding(1); - ShenandoahSharedEnumFlag() { - value = 0; - } + ShenandoahSharedEnumFlag() : value(0) {} void set(T v) { assert (v >= 0, "sanity"); assert (v < (sizeof(EnumValueType) * CHAR_MAX), "sanity"); - AtomicAccess::release_store_fence(&value, (EnumValueType)v); + value.release_store_fence((EnumValueType)v); } T get() const { - return (T)AtomicAccess::load_acquire(&value); + return (T)value.load_acquire(); } T cmpxchg(T new_value, T expected) { assert (new_value >= 0, "sanity"); assert (new_value < (sizeof(EnumValueType) * CHAR_MAX), "sanity"); - return (T)AtomicAccess::cmpxchg(&value, (EnumValueType)expected, (EnumValueType)new_value); + return (T)value.compare_exchange((EnumValueType)expected, (EnumValueType)new_value); } T xchg(T new_value) { assert (new_value >= 0, "sanity"); assert (new_value < (sizeof(EnumValueType) * CHAR_MAX), "sanity"); - return (T)AtomicAccess::xchg(&value, (EnumValueType)new_value); - } - - volatile EnumValueType* addr_of() { - return &value; + return (T)value.exchange((EnumValueType)new_value); } private: volatile T* operator&() { - fatal("Use addr_of() instead"); + fatal("Not supported"); return nullptr; } @@ -260,7 +246,7 @@ private: typedef struct ShenandoahSharedSemaphore { shenandoah_padding(0); - volatile ShenandoahSharedValue value; + Atomic value; shenandoah_padding(1); static uint max_tokens() { @@ -269,17 +255,17 @@ typedef struct ShenandoahSharedSemaphore { ShenandoahSharedSemaphore(uint tokens) { assert(tokens <= max_tokens(), "sanity"); - AtomicAccess::release_store_fence(&value, (ShenandoahSharedValue)tokens); + value.release_store_fence((ShenandoahSharedValue)tokens); } bool try_acquire() { while (true) { - ShenandoahSharedValue ov = AtomicAccess::load_acquire(&value); + ShenandoahSharedValue ov = value.load_acquire(); if (ov == 0) { return false; } ShenandoahSharedValue nv = ov - 1; - if (AtomicAccess::cmpxchg(&value, ov, nv) == ov) { + if (value.compare_exchange(ov, nv) == ov) { // successfully set return true; } @@ -287,7 +273,7 @@ typedef struct ShenandoahSharedSemaphore { } void claim_all() { - AtomicAccess::release_store_fence(&value, (ShenandoahSharedValue)0); + value.release_store_fence((ShenandoahSharedValue)0); } } ShenandoahSharedSemaphore; From f835073f75251c37acce1b5d87e2caf9d748bd75 Mon Sep 17 00:00:00 2001 From: Kim Barrett Date: Wed, 11 Feb 2026 01:52:55 +0000 Subject: [PATCH 056/120] 8377626: The macOS build is broken after JDK-8332189 Reviewed-by: dholmes --- src/hotspot/share/runtime/javaThread.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/share/runtime/javaThread.cpp b/src/hotspot/share/runtime/javaThread.cpp index a891e333d4c..77a567d4a09 100644 --- a/src/hotspot/share/runtime/javaThread.cpp +++ b/src/hotspot/share/runtime/javaThread.cpp @@ -514,7 +514,7 @@ JavaThread::JavaThread(MemTag mem_tag) : #ifdef MACOS_AARCH64 _cur_wx_enable(nullptr), - _cur_wx_mode(0), + _cur_wx_mode(nullptr), #endif _lock_stack(this), From e516800b3e78e21d68460827ddced9225c3a2247 Mon Sep 17 00:00:00 2001 From: Jaikiran Pai Date: Wed, 11 Feb 2026 02:02:10 +0000 Subject: [PATCH 057/120] 8219203: Use StringBuilder instead of StringBuffer in com.sun.jndi.dns.ResourceRecord Reviewed-by: alanb, aefimov, rriggs, bpb, lancea --- .../classes/com/sun/jndi/dns/ResourceRecord.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/ResourceRecord.java b/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/ResourceRecord.java index e0b8dce556e..a2b927cdaa0 100644 --- a/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/ResourceRecord.java +++ b/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/ResourceRecord.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ import java.nio.charset.StandardCharsets; * The string format is based on the master file representation in * RFC 1035. * - * @author Scott Seligman */ @@ -484,11 +483,11 @@ public class ResourceRecord { pos += 2; int preference = getUShort(pos); pos += 2; - StringBuffer flags = new StringBuffer(); + StringBuilder flags = new StringBuilder(); pos += decodeCharString(pos, flags); - StringBuffer services = new StringBuffer(); + StringBuilder services = new StringBuilder(); pos += decodeCharString(pos, services); - StringBuffer regexp = new StringBuffer(rdlen); + StringBuilder regexp = new StringBuilder(rdlen); pos += decodeCharString(pos, regexp); DnsName replacement = decodeName(pos); @@ -501,7 +500,7 @@ public class ResourceRecord { * The rdata consists of one or more s. */ private String decodeTxt(int pos) { - StringBuffer buf = new StringBuffer(rdlen); + StringBuilder buf = new StringBuilder(rdlen); int end = pos + rdlen; while (pos < end) { pos += decodeCharString(pos, buf); @@ -517,7 +516,7 @@ public class ResourceRecord { * The rdata consists of two s. */ private String decodeHinfo(int pos) { - StringBuffer buf = new StringBuffer(rdlen); + StringBuilder buf = new StringBuilder(rdlen); pos += decodeCharString(pos, buf); buf.append(' '); pos += decodeCharString(pos, buf); @@ -532,7 +531,7 @@ public class ResourceRecord { * Returns the size of the encoded string, including the initial * length octet. */ - private int decodeCharString(int pos, StringBuffer buf) { + private int decodeCharString(int pos, StringBuilder buf) { int start = buf.length(); // starting index of this string int len = getUByte(pos++); // encoded string length boolean quoted = (len == 0); // quote string if empty From 3a588e5bede4752f320f4b17f6086c9927616959 Mon Sep 17 00:00:00 2001 From: Jaikiran Pai Date: Wed, 11 Feb 2026 02:11:56 +0000 Subject: [PATCH 058/120] 8377338: URLJarFile$URLJarFileEntry need not clone the arrays returned by getCertificates() and getCodeSigners() Reviewed-by: mullan --- .../sun/net/www/protocol/jar/URLJarFile.java | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/java.base/share/classes/sun/net/www/protocol/jar/URLJarFile.java b/src/java.base/share/classes/sun/net/www/protocol/jar/URLJarFile.java index d30d18df9d6..45738550f59 100644 --- a/src/java.base/share/classes/sun/net/www/protocol/jar/URLJarFile.java +++ b/src/java.base/share/classes/sun/net/www/protocol/jar/URLJarFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,8 +34,6 @@ import java.util.*; import java.util.jar.*; import java.util.zip.ZipFile; import java.util.zip.ZipEntry; -import java.security.CodeSigner; -import java.security.cert.Certificate; import sun.net.www.ParseUtil; /* URL jar file is a common JarFile subtype used for JarURLConnection */ @@ -165,13 +163,12 @@ public class URLJarFile extends JarFile { } private class URLJarFileEntry extends JarEntry { - private final JarEntry je; URLJarFileEntry(JarEntry je) { super(je); - this.je = je; } + @Override public Attributes getAttributes() throws IOException { if (URLJarFile.this.isSuperMan()) { Map e = URLJarFile.this.superEntries; @@ -183,16 +180,6 @@ public class URLJarFile extends JarFile { } return null; } - - public java.security.cert.Certificate[] getCertificates() { - Certificate[] certs = je.getCertificates(); - return certs == null? null: certs.clone(); - } - - public CodeSigner[] getCodeSigners() { - CodeSigner[] csg = je.getCodeSigners(); - return csg == null? null: csg.clone(); - } } public interface URLJarFileCloseController { From a87da5173f14d503664067713ab229e2e4fb6108 Mon Sep 17 00:00:00 2001 From: Alexey Semenyuk Date: Wed, 11 Feb 2026 02:29:39 +0000 Subject: [PATCH 059/120] 8377514: jpackage: support passing multiple exceptions to the top-level error handler Reviewed-by: almatvee --- .../AppImageSigningConfigBuilder.java | 28 +- .../internal/MacApplicationBuilder.java | 2 +- .../jdk/jpackage/internal/MacFromOptions.java | 103 +++-- .../internal/MacPkgPackageBuilder.java | 4 +- .../internal/SigningIdentityBuilder.java | 36 +- .../resources/MacResources.properties | 2 +- .../jdk/jpackage/internal/cli/Main.java | 27 +- .../internal/util/function/ExceptionBox.java | 39 +- .../jdk/jpackage/internal/cli/MainTest.java | 359 ++++++++++++------ .../util/function/ExceptionBoxTest.java | 91 ++++- .../tools/jpackage/macosx/MacSignTest.java | 259 +++++++++---- 11 files changed, 657 insertions(+), 293 deletions(-) diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/AppImageSigningConfigBuilder.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/AppImageSigningConfigBuilder.java index 6fc7fe004c2..962c821c20f 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/AppImageSigningConfigBuilder.java +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/AppImageSigningConfigBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,24 +61,26 @@ final class AppImageSigningConfigBuilder { return this; } - Optional create() { - return signingIdentityBuilder.create().map(cfg -> { - final var validatedEntitlements = validatedEntitlements(); - return new AppImageSigningConfig.Stub( - Objects.requireNonNull(cfg.identity()), - Objects.requireNonNull(signingIdentifierPrefix), - validatedEntitlements, - cfg.keychain().map(Keychain::name), - Optional.ofNullable(entitlementsResourceName).orElse("entitlements.plist") - ); - }); + AppImageSigningConfig create() { + + var cfg = signingIdentityBuilder.create(); + + var validatedEntitlements = validatedEntitlements(); + + return new AppImageSigningConfig.Stub( + Objects.requireNonNull(cfg.identity()), + Objects.requireNonNull(signingIdentifierPrefix), + validatedEntitlements, + cfg.keychain().map(Keychain::name), + Optional.ofNullable(entitlementsResourceName).orElse("entitlements.plist") + ); } private Optional validatedEntitlements() { return Optional.ofNullable(entitlements); } - private SigningIdentityBuilder signingIdentityBuilder; + private final SigningIdentityBuilder signingIdentityBuilder; private Path entitlements; private String entitlementsResourceName; private String signingIdentifierPrefix; diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacApplicationBuilder.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacApplicationBuilder.java index 2023b425da9..a73a6152f6d 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacApplicationBuilder.java +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacApplicationBuilder.java @@ -191,7 +191,7 @@ final class MacApplicationBuilder { } private Optional createSigningConfig() { - return Optional.ofNullable(signingBuilder).flatMap(AppImageSigningConfigBuilder::create); + return Optional.ofNullable(signingBuilder).map(AppImageSigningConfigBuilder::create); } private String validatedBundleName() { diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacFromOptions.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacFromOptions.java index f3c1765210f..0598e6bc2a9 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacFromOptions.java +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacFromOptions.java @@ -57,7 +57,7 @@ import java.util.List; import java.util.Objects; import java.util.Optional; import jdk.jpackage.internal.ApplicationBuilder.MainLauncherStartupInfo; -import jdk.jpackage.internal.SigningIdentityBuilder.ExpiredCertificateException; +import jdk.jpackage.internal.SigningIdentityBuilder.SigningConfigException; import jdk.jpackage.internal.SigningIdentityBuilder.StandardCertificateSelector; import jdk.jpackage.internal.cli.OptionValue; import jdk.jpackage.internal.cli.Options; @@ -75,8 +75,8 @@ import jdk.jpackage.internal.model.MacPkgPackage; import jdk.jpackage.internal.model.PackageType; import jdk.jpackage.internal.model.RuntimeLayout; import jdk.jpackage.internal.util.MacBundle; -import jdk.jpackage.internal.util.Result; import jdk.jpackage.internal.util.RootedPath; +import jdk.jpackage.internal.util.Slot; import jdk.jpackage.internal.util.function.ExceptionBox; @@ -118,21 +118,9 @@ final class MacFromOptions { final boolean sign = MAC_SIGN.findIn(options).orElse(false); final boolean appStore = MAC_APP_STORE.findIn(options).orElse(false); - final var appResult = Result.of(() -> createMacApplicationInternal(options)); + final Optional pkgSigningIdentityBuilder; - final Optional pkgBuilder; - if (appResult.hasValue()) { - final var superPkgBuilder = createMacPackageBuilder(options, appResult.orElseThrow(), MAC_PKG); - pkgBuilder = Optional.of(new MacPkgPackageBuilder(superPkgBuilder)); - } else { - // Failed to create an app. Is it because of the expired certificate? - rethrowIfNotExpiredCertificateException(appResult); - // Yes, the certificate for signing the app image has expired. - // Keep going, try to create a signing config for the package. - pkgBuilder = Optional.empty(); - } - - if (sign) { + if (sign && (MAC_INSTALLER_SIGN_IDENTITY.containsIn(options) || MAC_SIGNING_KEY_NAME.containsIn(options))) { final var signingIdentityBuilder = createSigningIdentityBuilder(options); MAC_INSTALLER_SIGN_IDENTITY.ifPresentIn(options, signingIdentityBuilder::signingIdentity); MAC_SIGNING_KEY_NAME.findIn(options).ifPresent(userName -> { @@ -146,34 +134,43 @@ final class MacFromOptions { signingIdentityBuilder.certificateSelector(StandardCertificateSelector.create(userName, domain)); }); - if (pkgBuilder.isPresent()) { - pkgBuilder.orElseThrow().signingBuilder(signingIdentityBuilder); - } else { - // - // The certificate for signing the app image has expired. Can not create a - // package because there is no app. - // Try to create a signing config for the package and see if the certificate for - // signing the package is also expired. - // - - final var expiredAppCertException = appResult.firstError().orElseThrow(); - - final var pkgSignConfigResult = Result.of(signingIdentityBuilder::create); - try { - rethrowIfNotExpiredCertificateException(pkgSignConfigResult); - // The certificate for the package signing config is also expired! - } catch (RuntimeException ex) { - // Some error occurred trying to configure the signing config for the package. - // Ignore it, bail out with the first error. - throw toUnchecked(expiredAppCertException); - } - - Log.error(pkgSignConfigResult.firstError().orElseThrow().getMessage()); - throw toUnchecked(expiredAppCertException); - } + pkgSigningIdentityBuilder = Optional.of(signingIdentityBuilder); + } else { + pkgSigningIdentityBuilder = Optional.empty(); } - return pkgBuilder.orElseThrow().create(); + ApplicationWithDetails app = null; + try { + app = createMacApplicationInternal(options); + } catch (RuntimeException appEx) { + rethrowIfNotSigningConfigException(appEx); + try { + pkgSigningIdentityBuilder.ifPresent(SigningIdentityBuilder::create); + } catch (RuntimeException pkgEx) { + + if (Objects.equals(appEx.getMessage(), pkgEx.getMessage())) { + // Don't report the same error twice. + throw appEx; + } + + // Use suppressed exceptions to communicate multiple exceptions to the caller. + // The top-level error handling code assumes there is a causal connection + // between the exception and its suppressed exceptions. + // Based on this assumption and following the principle "Present cause before consequence", + // it will report the suppressed exceptions before reporting the caught exception. + pkgEx.addSuppressed(appEx); + throw pkgEx; + } + + throw appEx; + } + + final var superPkgBuilder = createMacPackageBuilder(options, app, MAC_PKG); + final var pkgBuilder = new MacPkgPackageBuilder(superPkgBuilder); + + pkgSigningIdentityBuilder.ifPresent(pkgBuilder::signingBuilder); + + return pkgBuilder.create(); } private record ApplicationWithDetails(MacApplication app, Optional externalApp) { @@ -247,7 +244,7 @@ final class MacFromOptions { appBuilder.appStore(appStore); - if (sign) { + if (sign && (MAC_APP_IMAGE_SIGN_IDENTITY.containsIn(options) || MAC_SIGNING_KEY_NAME.containsIn(options))) { final var signingIdentityBuilder = createSigningIdentityBuilder(options); MAC_APP_IMAGE_SIGN_IDENTITY.ifPresentIn(options, signingIdentityBuilder::signingIdentity); MAC_SIGNING_KEY_NAME.findIn(options).ifPresent(userName -> { @@ -298,20 +295,18 @@ final class MacFromOptions { return builder; } - private static void rethrowIfNotExpiredCertificateException(Result result) { - final var ex = result.firstError().orElseThrow(); + private static void rethrowIfNotSigningConfigException(Exception ex) { + var signingConfigExceptionFound = Slot.createEmpty(); - if (ex instanceof ExpiredCertificateException) { - return; - } - - if (ex instanceof ExceptionBox box) { - if (box.getCause() instanceof Exception cause) { - rethrowIfNotExpiredCertificateException(Result.ofError(cause)); + ExceptionBox.visitUnboxedExceptionsRecursively(ex, visited -> { + if (visited instanceof SigningConfigException) { + signingConfigExceptionFound.set(true); } - } + }); - throw toUnchecked(ex); + if (!signingConfigExceptionFound.find().orElse(false)) { + throw toUnchecked(ex); + } } private static SigningIdentityBuilder createSigningIdentityBuilder(Options options) { diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgPackageBuilder.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgPackageBuilder.java index b81340354e1..0a5cc09596f 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgPackageBuilder.java +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgPackageBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. * 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 @@ final class MacPkgPackageBuilder { } private Optional createSigningConfig() { - return Optional.ofNullable(signingBuilder).flatMap(SigningIdentityBuilder::create).map(cfg -> { + return Optional.ofNullable(signingBuilder).map(SigningIdentityBuilder::create).map(cfg -> { return new PkgSigningConfig.Stub(cfg.identity(), cfg.keychain().map(Keychain::name)); }); } diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/SigningIdentityBuilder.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/SigningIdentityBuilder.java index 0f753c07569..892601eb363 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/SigningIdentityBuilder.java +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/SigningIdentityBuilder.java @@ -39,23 +39,18 @@ import javax.naming.ldap.LdapName; import javax.naming.ldap.Rdn; import javax.security.auth.x500.X500Principal; import jdk.jpackage.internal.MacCertificateUtils.CertificateHash; -import jdk.jpackage.internal.model.ConfigException; import jdk.jpackage.internal.model.JPackageException; import jdk.jpackage.internal.model.SigningIdentity; final class SigningIdentityBuilder { - static class SigningConfigException extends ConfigException { - SigningConfigException(ConfigException ex) { - super(ex.getMessage(), ex.getAdvice(), ex.getCause()); + static class SigningConfigException extends JPackageException { + public SigningConfigException(String msg) { + super(msg); } - private static final long serialVersionUID = 1L; - } - - static class ExpiredCertificateException extends SigningConfigException { - ExpiredCertificateException(ConfigException ex) { - super(ex); + public SigningConfigException(String msg, Throwable cause) { + super(msg, cause); } private static final long serialVersionUID = 1L; @@ -83,11 +78,12 @@ final class SigningIdentityBuilder { return this; } - Optional create() { - if (signingIdentity == null && certificateSelector == null) { - return Optional.empty(); + SigningConfig create() { + if (Objects.isNull(certificateSelector) == Objects.isNull(signingIdentity)) { + // Either the signing certificate selector or the signing certificate must be configured. + throw new IllegalStateException(); } else { - return Optional.of(new SigningConfig(validatedSigningIdentity(), validatedKeychain())); + return new SigningConfig(validatedSigningIdentity(), validatedKeychain()); } } @@ -133,8 +129,9 @@ final class SigningIdentityBuilder { try { cert.checkValidity(); - } catch (CertificateExpiredException|CertificateNotYetValidException ex) { - throw new ExpiredCertificateException(I18N.buildConfigException("error.certificate.expired", findSubjectCNs(cert).getFirst()).create()); + } catch (CertificateExpiredException | CertificateNotYetValidException ex) { + throw new SigningConfigException(I18N.format( + "error.certificate.outside-validity-period", findSubjectCNs(cert).getFirst()), ex); } final var signingIdentityHash = CertificateHash.of(cert); @@ -148,7 +145,7 @@ final class SigningIdentityBuilder { Objects.requireNonNull(keychain); switch (certs.size()) { case 0 -> { - throw new JPackageException(I18N.format("error.cert.not.found", + throw new SigningConfigException(I18N.format("error.cert.not.found", certificateSelector.signingIdentities().getFirst(), keychain.map(Keychain::name).orElse(""))); } @@ -156,10 +153,9 @@ final class SigningIdentityBuilder { return certs.getFirst(); } default -> { - throw I18N.buildConfigException("error.multiple.certs.found", + throw new SigningConfigException(I18N.format("error.multiple.certs.found", certificateSelector.signingIdentities().getFirst(), - keychain.map(Keychain::name).orElse("") - ).create(); + keychain.map(Keychain::name).orElse(""))); } } } diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources.properties b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources.properties index e1b154c5933..e43cadc5782 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources.properties +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources.properties @@ -24,7 +24,7 @@ # # error.invalid-cfbundle-version.advice=Set a compatible 'app-version' value. Valid versions are one to three integers separated by dots. -error.certificate.expired=Certificate expired {0} +error.certificate.outside-validity-period=The certificate "{0}" is outside its validity period error.cert.not.found=No certificate found matching [{0}] using keychain [{1}] error.multiple.certs.found=Multiple certificates matching name [{0}] found in keychain [{1}] error.app-image.mac-sign.required=--mac-sign option is required with predefined application image and with type [app-image] diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/Main.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/Main.java index 73b4850344b..d40895a7da6 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/Main.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/Main.java @@ -37,6 +37,7 @@ import java.io.PrintWriter; import java.io.StringReader; import java.io.UncheckedIOException; import java.nio.file.NoSuchFileException; +import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Objects; @@ -239,17 +240,21 @@ public final class Main { } void reportError(Throwable t) { - if (t instanceof ConfigException cfgEx) { - printError(cfgEx, Optional.ofNullable(cfgEx.getAdvice())); - } else if (t instanceof ExceptionBox ex) { - reportError(ex.getCause()); - } else if (t instanceof UncheckedIOException ex) { - reportError(ex.getCause()); - } else if (t instanceof UnexpectedResultException ex) { - printExternalCommandError(ex); - } else { - printError(t, Optional.empty()); - } + + var unfoldedExceptions = new ArrayList(); + ExceptionBox.visitUnboxedExceptionsRecursively(t, unfoldedExceptions::add); + + unfoldedExceptions.forEach(ex -> { + if (ex instanceof ConfigException cfgEx) { + printError(cfgEx, Optional.ofNullable(cfgEx.getAdvice())); + } else if (ex instanceof UncheckedIOException) { + printError(ex.getCause(), Optional.empty()); + } else if (ex instanceof UnexpectedResultException urex) { + printExternalCommandError(urex); + } else { + printError(ex, Optional.empty()); + } + }); } private void printExternalCommandError(UnexpectedResultException ex) { diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ExceptionBox.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ExceptionBox.java index 40503469873..0c2963f7397 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ExceptionBox.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ExceptionBox.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2026, Oracle and/or its affiliates. All rights reserved. * 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,9 @@ package jdk.jpackage.internal.util.function; import java.lang.reflect.InvocationTargetException; +import java.util.Objects; +import java.util.function.Consumer; +import java.util.stream.Stream; public class ExceptionBox extends RuntimeException { @@ -74,6 +77,40 @@ public class ExceptionBox extends RuntimeException { } } + /** + * Unboxes the specified throwable and its suppressed throwables recursively. + *

+ * Calls {@link #unbox(Throwable)} on the specified throwable and nested + * suppressed throwables, passing the result to the {@code visitor}. + *

+ * Throwables will be traversed in the "cause before consequence" order. E.g.: + * say exception "A" suppresses exceptions "B" and "C", and "B" suppresses "D". + * The traverse order will be "D", "B", "C", "A". + *

+ * If the method encounters cyclic suppressed throwables, it will fall into an + * infinite recursion loop, eventually causing a {@code StackOverflowError}. + *

+ * If the specified throwable or any of its nested suppressed throwables are of + * type {@link Error}, the method will keep notifying the {@code visitor} until + * it hits the first such throwable. When it happens, the method will throw this + * throwable. + * + * @param t the exception to visit + * @param visitor the callback to apply to every subsequently visited exception + */ + public static void visitUnboxedExceptionsRecursively(Throwable t, Consumer visitor) { + Objects.requireNonNull(t); + Objects.requireNonNull(visitor); + + var ex = unbox(t); + + Stream.of(ex.getSuppressed()).forEach(suppressed -> { + visitUnboxedExceptionsRecursively(suppressed, visitor); + }); + + visitor.accept(ex); + } + public static Error reachedUnreachable() { return new AssertionError("Reached unreachable!"); } diff --git a/test/jdk/tools/jpackage/junit/share/jdk.jpackage/jdk/jpackage/internal/cli/MainTest.java b/test/jdk/tools/jpackage/junit/share/jdk.jpackage/jdk/jpackage/internal/cli/MainTest.java index 46de970a829..239ce0d0ce9 100644 --- a/test/jdk/tools/jpackage/junit/share/jdk.jpackage/jdk/jpackage/internal/cli/MainTest.java +++ b/test/jdk/tools/jpackage/junit/share/jdk.jpackage/jdk/jpackage/internal/cli/MainTest.java @@ -38,11 +38,12 @@ import java.nio.file.Path; import java.util.ArrayList; import java.util.Collection; import java.util.List; -import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.function.BiFunction; +import java.util.function.Consumer; import java.util.function.Function; +import java.util.function.Supplier; import java.util.function.UnaryOperator; import java.util.spi.ToolProvider; import java.util.stream.Collectors; @@ -53,9 +54,11 @@ import jdk.jpackage.internal.MockUtils; import jdk.jpackage.internal.model.ConfigException; import jdk.jpackage.internal.model.ExecutableAttributesWithCapturedOutput; import jdk.jpackage.internal.model.JPackageException; +import jdk.jpackage.internal.model.SelfContainedException; import jdk.jpackage.internal.util.CommandOutputControl; import jdk.jpackage.internal.util.CommandOutputControl.UnexpectedExitCodeException; import jdk.jpackage.internal.util.CommandOutputControl.UnexpectedResultException; +import jdk.jpackage.internal.util.IdentityWrapper; import jdk.jpackage.internal.util.function.ExceptionBox; import jdk.jpackage.test.Annotations; import jdk.jpackage.test.JPackageCommand; @@ -181,112 +184,157 @@ public class MainTest extends JUnitAdapter { ).map(TestSpec.Builder::create).toList(); } - private static List test_ErrorReporter() { - var data = new ArrayList(); - + var testCases = new ArrayList(); for (var verbose : List.of(true, false)) { - for (var makeCause : List.>of( - ex -> ex, - // UncheckedIOException - ex -> { - if (ex instanceof IOException ioex) { - return new UncheckedIOException(ioex); - } else { - return null; - } - }, - // ExceptionBox - ex -> { - var rex = ExceptionBox.toUnchecked(ex); - if (rex != ex) { - return rex; - } else { - return null; - } - } - )) { - for (var expect : List.of( - Map.entry(new IOException("I/O error"), true), - Map.entry(new NullPointerException(), true), - Map.entry(new JPackageException("Kaput!"), false), - Map.entry(new ConfigException("It is broken", "Fix it!"), false), - Map.entry(new ConfigException("It is broken. No advice how to fix it", (String)null), false), - Map.entry(new Utils.ParseException("Malformed command line"), false), - Map.entry(new StandardOption.AddLauncherIllegalArgumentException("Malformed value of --add-launcher option"), false) - )) { - var cause = makeCause.apply(expect.getKey()); - if (cause == null) { - continue; - } - - var expectedOutput = new ArrayList(); - if (expect.getValue()) { - // An alien exception. - expectedOutput.add(ExceptionFormatter.STACK_TRACE); - expectedOutput.add(ExceptionFormatter.TO_STRING); - } else { - if (verbose) { - expectedOutput.add(ExceptionFormatter.STACK_TRACE); - } - if (expect.getKey() instanceof ConfigException cex) { - if (cex.getAdvice() != null) { - expectedOutput.add(ExceptionFormatter.MESSAGE_WITH_ADVICE); - } else { - expectedOutput.add(ExceptionFormatter.GET_MESSAGE); - } - } else { - expectedOutput.add(ExceptionFormatter.GET_MESSAGE); - } - } - - data.add(new ErrorReporterTestSpec(cause, expect.getKey(), verbose, expectedOutput)); - } - } - - var execAttrs = new CommandOutputControl.ProcessAttributes(Optional.of(12345L), List.of("foo", "--bar")); - for (var makeCause : List.>of( - ex -> ex, - ExceptionBox::toUnchecked - )) { - - for (var expect : List.of( - Map.entry( - augmentResultWithOutput( - CommandOutputControl.Result.build().exitCode(135).execAttrs(execAttrs).create(), - "The quick brown fox\njumps over the lazy dog" - ).unexpected("Kaput!"), - ExceptionFormatter.FAILED_COMMAND_UNEXPECTED_OUTPUT_MESSAGE - ), - Map.entry( - new UnexpectedExitCodeException(augmentResultWithOutput( - CommandOutputControl.Result.build().exitCode(135).create(), - "The quick brown fox\njumps" - )), - ExceptionFormatter.FAILED_COMMAND_UNEXPECTED_EXIT_CODE_MESSAGE - ), - Map.entry( - augmentResultWithOutput( - CommandOutputControl.Result.build().create(), - "The quick brown fox\njumps" - ).unexpected("Timed out!"), - ExceptionFormatter.FAILED_COMMAND_TIMEDOUT_MESSAGE - ) - )) { - var cause = makeCause.apply(expect.getKey()); - var expectedOutput = new ArrayList(); - if (verbose) { - expectedOutput.add(ExceptionFormatter.STACK_TRACE); - } - expectedOutput.add(expect.getValue()); - expectedOutput.add(ExceptionFormatter.FAILED_COMMAND_OUTPUT); - data.add(new ErrorReporterTestSpec(cause, expect.getKey(), verbose, expectedOutput)); - } - } - + test_ErrorReporter_Exception(verbose, testCases::add); + test_ErrorReporter_UnexpectedResultException(verbose, testCases::add); + test_ErrorReporter_suppressedExceptions(verbose, testCases::add); } - return data; + return testCases; + } + + private static void test_ErrorReporter_Exception(boolean verbose, Consumer sink) { + + for (var makeCause : List.>of( + ex -> ex, + // UncheckedIOException + ex -> { + if (ex instanceof IOException ioex) { + return new UncheckedIOException(ioex); + } else { + return null; + } + }, + // ExceptionBox + ex -> { + var rex = ExceptionBox.toUnchecked(ex); + if (rex != ex) { + return rex; + } else { + return null; + } + } + )) { + for (var expect : List.of( + new IOException("I/O error"), + new NullPointerException(), + new JPackageException("Kaput!"), + new ConfigException("It is broken", "Fix it!"), + new ConfigException("It is broken. No advice how to fix it", (String)null), + new Utils.ParseException("Malformed command line"), + new StandardOption.AddLauncherIllegalArgumentException("Malformed value of --add-launcher option") + )) { + var cause = makeCause.apply(expect); + if (cause == null) { + continue; + } + + var expectedOutput = new ArrayList(); + ErrorReporterTestSpec.expectExceptionFormatters(expect, verbose, expectedOutput::add); + sink.accept(ErrorReporterTestSpec.create(cause, expect, verbose, expectedOutput)); + } + } + } + + private static void test_ErrorReporter_UnexpectedResultException(boolean verbose, Consumer sink) { + + var execAttrs = new CommandOutputControl.ProcessAttributes(Optional.of(12345L), List.of("foo", "--bar")); + + for (var makeCause : List.>of( + ex -> ex, + ExceptionBox::toUnchecked + )) { + + for (var expect : List.of( + augmentResultWithOutput( + CommandOutputControl.Result.build().exitCode(135).execAttrs(execAttrs).create(), + "The quick brown fox\njumps over the lazy dog" + ).unexpected("Kaput!"), + new UnexpectedExitCodeException(augmentResultWithOutput( + CommandOutputControl.Result.build().exitCode(135).create(), + "The quick brown fox\njumps" + )), + augmentResultWithOutput( + CommandOutputControl.Result.build().create(), + "The quick brown fox\njumps" + ).unexpected("Timed out!") + )) { + var cause = makeCause.apply(expect); + var expectedOutput = new ArrayList(); + ErrorReporterTestSpec.expectExceptionFormatters(expect, verbose, expectedOutput::add); + sink.accept(ErrorReporterTestSpec.create(cause, expect, verbose, expectedOutput)); + } + } + } + + private static Exception suppressException(Exception main, Exception suppressed) { + Objects.requireNonNull(main); + Objects.requireNonNull(suppressed); + + try (var autoCloseable = new AutoCloseable() { + + @Override + public void close() throws Exception { + throw suppressed; + }}) { + + throw main; + } catch (Exception ex) { + return ex; + } + } + + private static void test_ErrorReporter_suppressedExceptions(boolean verbose, Consumer sink) { + + var execAttrs = new CommandOutputControl.ProcessAttributes(Optional.of(567L), List.of("foo", "--bar")); + + Supplier createUnexpectedResultException = () -> { + return augmentResultWithOutput( + CommandOutputControl.Result.build().exitCode(7).execAttrs(execAttrs).create(), + "The quick brown fox\njumps over the lazy dog" + ).unexpected("Alas"); + }; + + for (var makeCause : List.>of( + ex -> ex, + ex -> { + var rex = ExceptionBox.toUnchecked(ex); + if (rex != ex) { + return rex; + } else { + return null; + } + } + )) { + + for (var exceptions : List.of( + List.of(new JPackageException("Kaput!"), new JPackageException("Suppressed kaput")), + List.of(new Exception("Kaput!"), new JPackageException("Suppressed kaput")), + List.of(new Exception("Kaput!"), new Exception("Suppressed kaput")), + List.of(new Exception("Kaput!"), ExceptionBox.toUnchecked(new Exception("Suppressed kaput"))), + List.of(createUnexpectedResultException.get(), new Exception("Suppressed kaput")), + List.of(new Exception("Alas!"), createUnexpectedResultException.get()), + List.of(new JPackageException("Alas!"), createUnexpectedResultException.get()) + )) { + var main = exceptions.getFirst(); + var suppressed = exceptions.getLast(); + + var cause = makeCause.apply(suppressException(main, suppressed)); + + if (cause == null) { + continue; + } + + var expectedOutput = new ArrayList(); + + ErrorReporterTestSpec.expectOutputFragments(ExceptionBox.unbox(suppressed), verbose, expectedOutput::add); + ErrorReporterTestSpec.expectOutputFragments(main, verbose, expectedOutput::add); + + sink.accept(new ErrorReporterTestSpec(cause, verbose, expectedOutput)); + } + } } @@ -452,6 +500,19 @@ public class MainTest extends JUnitAdapter { } + private record FormattedException(ExceptionFormatter formatter, Exception exception) { + + FormattedException { + Objects.requireNonNull(formatter); + Objects.requireNonNull(exception); + } + + String format() { + return formatter.format(exception); + } + } + + private enum ExceptionFormatter { GET_MESSAGE(errorMessage(Exception::getMessage)), MESSAGE_WITH_ADVICE(ex -> { @@ -497,6 +558,10 @@ public class MainTest extends JUnitAdapter { return formatter.apply(v); } + FormattedException bind(Exception v) { + return new FormattedException(this, v); + } + private static Function errorMessage(Function formatter) { Objects.requireNonNull(formatter); return ex -> { @@ -545,29 +610,99 @@ public class MainTest extends JUnitAdapter { } - record ErrorReporterTestSpec(Exception cause, Exception expect, boolean verbose, List expectOutput) { + record ErrorReporterTestSpec(Exception cause, boolean verbose, List expectOutput) { ErrorReporterTestSpec { Objects.requireNonNull(cause); - Objects.requireNonNull(expect); Objects.requireNonNull(expectOutput); + if (expectOutput.isEmpty()) { + throw new IllegalArgumentException(); + } } - ErrorReporterTestSpec(Exception cause, boolean verbose, List expectOutput) { - this(cause, cause, verbose, expectOutput); + static ErrorReporterTestSpec create( + Exception cause, boolean verbose, List expectOutput) { + return create(cause, cause, verbose, expectOutput); + } + + static ErrorReporterTestSpec create( + Exception cause, Exception expect, boolean verbose, List expectOutput) { + Objects.requireNonNull(cause); + Objects.requireNonNull(expect); + return new ErrorReporterTestSpec(cause, verbose, expectOutput.stream().map(formatter -> { + return new FormattedException(formatter, expect); + }).toList()); + } + + static void expectExceptionFormatters(Exception ex, boolean verbose, Consumer sink) { + Objects.requireNonNull(ex); + Objects.requireNonNull(sink); + + final var isSelfContained = (ex.getClass().getAnnotation(SelfContainedException.class) != null); + + if (verbose || !(isSelfContained || ex instanceof UnexpectedResultException)) { + sink.accept(ExceptionFormatter.STACK_TRACE); + } + + switch (ex) { + case ConfigException cex -> { + if (cex.getAdvice() != null) { + sink.accept(ExceptionFormatter.MESSAGE_WITH_ADVICE); + } else { + sink.accept(ExceptionFormatter.GET_MESSAGE); + } + } + case UnexpectedResultException urex -> { + if (urex instanceof UnexpectedExitCodeException) { + sink.accept(ExceptionFormatter.FAILED_COMMAND_UNEXPECTED_EXIT_CODE_MESSAGE); + } else if (urex.getResult().exitCode().isPresent()) { + sink.accept(ExceptionFormatter.FAILED_COMMAND_UNEXPECTED_OUTPUT_MESSAGE); + } else { + sink.accept(ExceptionFormatter.FAILED_COMMAND_TIMEDOUT_MESSAGE); + } + sink.accept(ExceptionFormatter.FAILED_COMMAND_OUTPUT); + } + default -> { + if (isSelfContained) { + sink.accept(ExceptionFormatter.GET_MESSAGE); + } else { + sink.accept(ExceptionFormatter.TO_STRING); + } + } + } + } + + static void expectOutputFragments(Exception ex, boolean verbose, Consumer sink) { + Objects.requireNonNull(sink); + expectExceptionFormatters(ex, verbose, formatter -> { + sink.accept(formatter.bind(ex)); + }); } @Override public String toString() { var tokens = new ArrayList(); - if (cause == expect) { + var expect = expectOutput.stream() + .map(FormattedException::exception) + .map(IdentityWrapper::new) + .distinct() + .toList(); + + if (expect.size() == 1 && expect.getFirst().value() == cause) { tokens.add(cause.toString()); } else { - tokens.add(String.format("[%s] => [%s]", cause, expect)); + tokens.add(String.format("[%s] => %s", cause, expect.stream().map(IdentityWrapper::value).toList())); } - tokens.add(expectOutput.stream().map(Enum::name).collect(Collectors.joining("+"))); + if (expect.size() == 1) { + tokens.add(expectOutput.stream().map(FormattedException::formatter).map(Enum::name).collect(Collectors.joining("+"))); + } else { + tokens.add(expectOutput.stream().map(fragment -> { + var idx = expect.indexOf(IdentityWrapper.wrapIdentity(fragment.exception())); + return String.format("%s@%d", fragment.formatter(), idx); + }).collect(Collectors.joining("+"))); + } if (verbose) { tokens.add("verbose"); @@ -587,9 +722,7 @@ public class MainTest extends JUnitAdapter { }, verbose).reportError(cause); } - var expected = expectOutput.stream().map(formatter -> { - return formatter.format(expect); - }).collect(Collectors.joining("")); + var expected = expectOutput.stream().map(FormattedException::format).collect(Collectors.joining("")); assertEquals(expected, sink.toString()); } diff --git a/test/jdk/tools/jpackage/junit/share/jdk.jpackage/jdk/jpackage/internal/util/function/ExceptionBoxTest.java b/test/jdk/tools/jpackage/junit/share/jdk.jpackage/jdk/jpackage/internal/util/function/ExceptionBoxTest.java index c3ef239b02d..d7a6f0e714d 100644 --- a/test/jdk/tools/jpackage/junit/share/jdk.jpackage/jdk/jpackage/internal/util/function/ExceptionBoxTest.java +++ b/test/jdk/tools/jpackage/junit/share/jdk.jpackage/jdk/jpackage/internal/util/function/ExceptionBoxTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. * 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,13 +31,19 @@ import static org.junit.jupiter.api.Assertions.assertThrowsExactly; import java.io.IOException; import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; import java.util.Objects; import java.util.concurrent.atomic.AtomicReference; import java.util.function.UnaryOperator; +import jdk.jpackage.internal.util.IdentityWrapper; import jdk.jpackage.internal.util.Slot; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.EnumSource; +import org.junit.jupiter.params.provider.MethodSource; public class ExceptionBoxTest { @@ -190,6 +196,16 @@ public class ExceptionBoxTest { } } + @ParameterizedTest + @MethodSource + void test_visitUnboxedExceptionsRecursively(Throwable t, List expect) { + var actual = new ArrayList(); + ExceptionBox.visitUnboxedExceptionsRecursively(t, actual::add); + assertEquals( + expect.stream().map(IdentityWrapper::new).toList(), + actual.stream().map(IdentityWrapper::new).toList()); + } + public enum InvocationTargetExceptionType { CHECKED("throwIOException", t -> { return t.getCause(); @@ -224,13 +240,74 @@ public class ExceptionBoxTest { throw new Error("Kaput!"); } - private static void assertToUnchecked(Exception cause, boolean asis) { - Class expectedType; - if (asis) { - expectedType = cause.getClass(); - } else { - expectedType = ExceptionBox.class; + private static Collection test_visitUnboxedExceptionsRecursively() { + + var testCases = new ArrayList(); + + testCases.addAll(test_visitUnboxedExceptionsRecursively_example()); + + var t = new Exception("A"); + for (var box : List.>of( + ex -> ex, + ExceptionBox::toUnchecked, + InvocationTargetException::new + )) { + testCases.add(Arguments.of(box.apply(t), List.of(t))); } + + // The cause is not traversed. + var exWithCause = new Exception("B", t); + testCases.add(Arguments.of(exWithCause, List.of(exWithCause))); + + var exWithSuppressed = new Exception("C"); + exWithSuppressed.addSuppressed(t); + exWithSuppressed.addSuppressed(ExceptionBox.toUnchecked(t)); + exWithSuppressed.addSuppressed(exWithCause); + exWithSuppressed.addSuppressed(new InvocationTargetException(exWithCause)); + var exWithSuppressedExpect = List.of(t, t, exWithCause, exWithCause, exWithSuppressed); + testCases.add(Arguments.of(exWithSuppressed, exWithSuppressedExpect)); + + for (var box : List.>of( + ExceptionBox::toUnchecked, + InvocationTargetException::new + )) { + // Suppressed exceptions added to ExceptionBox and InvocationTargetException are omitted. + var exWithSuppressedBoxed = box.apply(exWithSuppressed); + exWithSuppressedBoxed.addSuppressed(exWithSuppressed); + testCases.add(Arguments.of(exWithSuppressedBoxed, exWithSuppressedExpect)); + } + + var exWithSuppressed2 = new Exception("D"); + exWithSuppressed2.addSuppressed(t); + exWithSuppressed2.addSuppressed(exWithSuppressed); + exWithSuppressed2.addSuppressed(ExceptionBox.toUnchecked(exWithSuppressed)); + + var exWithSuppressed2Expect = new ArrayList(); + exWithSuppressed2Expect.add(t); + exWithSuppressed2Expect.addAll(exWithSuppressedExpect); + exWithSuppressed2Expect.addAll(exWithSuppressedExpect); + exWithSuppressed2Expect.add(exWithSuppressed2); + testCases.add(Arguments.of(exWithSuppressed2, exWithSuppressed2Expect)); + + return testCases; + } + + private static Collection test_visitUnboxedExceptionsRecursively_example() { + + var a = new Exception("A"); + var b = new Exception("B"); + var c = new Exception("C"); + var d = new Exception("D"); + + a.addSuppressed(b); + a.addSuppressed(c); + + b.addSuppressed(d); + + return List.of(Arguments.of(a, List.of(d, b, c, a))); + } + + private static void assertToUnchecked(Exception cause, boolean asis) { var unchecked = ExceptionBox.toUnchecked(cause); if (asis) { assertSame(cause, unchecked); diff --git a/test/jdk/tools/jpackage/macosx/MacSignTest.java b/test/jdk/tools/jpackage/macosx/MacSignTest.java index 0be494ea469..e558b671478 100644 --- a/test/jdk/tools/jpackage/macosx/MacSignTest.java +++ b/test/jdk/tools/jpackage/macosx/MacSignTest.java @@ -22,22 +22,23 @@ */ import static jdk.jpackage.test.MacHelper.SignKeyOption.Type.SIGN_KEY_IDENTITY; -import static jdk.jpackage.test.MacHelper.SignKeyOption.Type.SIGN_KEY_IDENTITY_APP_IMAGE; import static jdk.jpackage.test.MacHelper.SignKeyOption.Type.SIGN_KEY_USER_FULL_NAME; import static jdk.jpackage.test.MacHelper.SignKeyOption.Type.SIGN_KEY_USER_SHORT_NAME; import java.io.IOException; import java.nio.file.Files; import java.util.Collection; +import java.util.Comparator; import java.util.List; +import java.util.Objects; import java.util.function.Function; import java.util.function.Predicate; import java.util.regex.Pattern; import java.util.stream.Stream; +import jdk.jpackage.internal.util.function.ExceptionBox; import jdk.jpackage.test.Annotations.Parameter; import jdk.jpackage.test.Annotations.ParameterSupplier; import jdk.jpackage.test.Annotations.Test; -import jdk.jpackage.test.CannedFormattedString; import jdk.jpackage.test.FailedCommandErrorValidator; import jdk.jpackage.test.JPackageCommand; import jdk.jpackage.test.JPackageStringBundle; @@ -47,7 +48,6 @@ import jdk.jpackage.test.MacHelper.ResolvableCertificateRequest; import jdk.jpackage.test.MacHelper.SignKeyOption; import jdk.jpackage.test.MacHelper.SignKeyOptionWithKeychain; import jdk.jpackage.test.MacSign; -import jdk.jpackage.test.MacSign.CertificateType; import jdk.jpackage.test.MacSignVerify; import jdk.jpackage.test.PackageType; import jdk.jpackage.test.TKit; @@ -94,11 +94,7 @@ public class MacSignTest { SigningBase.StandardCertificateRequest.CODESIGN, keychain); - new FailedCommandErrorValidator(Pattern.compile(String.format( - "/usr/bin/codesign -s %s -vvvv --timestamp --options runtime --prefix \\S+ --keychain %s --entitlements \\S+ \\S+", - Pattern.quote(String.format("'%s'", signingKeyOption.certRequest().name())), - Pattern.quote(keychain.name()) - ))).exitCode(1).createGroup().mutate(group::add); + buildSignCommandErrorValidator(signingKeyOption).createGroup().mutate(group::add); MacSign.withKeychain(_ -> { @@ -107,7 +103,7 @@ public class MacSignTest { // This is not a fatal error, just a warning. // To make jpackage fail, specify bad additional content. JPackageCommand.helloAppImage() - .ignoreDefaultVerbose(true) + .mutate(MacSignTest::init) .validateOutput(group.create()) .addArguments("--app-content", appContent) .mutate(signingKeyOption::addTo) @@ -136,11 +132,9 @@ public class MacSignTest { MacSign.withKeychain(keychain -> { // Build a matcher for jpackage's failed command output. - var errorValidator = new FailedCommandErrorValidator(Pattern.compile(String.format( - "/usr/bin/codesign -s %s -vvvv --timestamp --options runtime --prefix \\S+ --keychain %s", - Pattern.quote(String.format("'%s'", signingKeyOption.certRequest().name())), - Pattern.quote(keychain.name()) - ))).exitCode(1).output(String.format("%s: no identity found", signingKeyOption.certRequest().name())).createGroup(); + var errorValidator = buildSignCommandErrorValidator(signingKeyOption, keychain) + .output(String.format("%s: no identity found", signingKeyOption.certRequest().name())) + .createGroup(); JPackageCommand.helloAppImage() .setFakeRuntime() @@ -157,9 +151,12 @@ public class MacSignTest { @Parameter({"IMAGE", "EXPIRED_SIGNING_KEY_USER_NAME"}) @Parameter({"MAC_DMG", "EXPIRED_SIGNING_KEY_USER_NAME"}) @Parameter({"MAC_PKG", "EXPIRED_SIGNING_KEY_USER_NAME", "EXPIRED_SIGNING_KEY_USER_NAME_PKG"}) + @Parameter({"MAC_PKG", "EXPIRED_SIGNING_KEY_USER_NAME_PKG", "EXPIRED_SIGNING_KEY_USER_NAME"}) @Parameter({"IMAGE", "EXPIRED_SIGN_IDENTITY"}) @Parameter({"MAC_DMG", "EXPIRED_SIGN_IDENTITY"}) + + // Test that jpackage doesn't print duplicated error messages. @Parameter({"MAC_PKG", "EXPIRED_SIGN_IDENTITY"}) @Parameter({"IMAGE", "EXPIRED_CODESIGN_SIGN_IDENTITY"}) @@ -168,16 +165,41 @@ public class MacSignTest { @Parameter({"MAC_PKG", "GOOD_CODESIGN_SIGN_IDENTITY", "EXPIRED_PKG_SIGN_IDENTITY"}) @Parameter({"MAC_PKG", "EXPIRED_CODESIGN_SIGN_IDENTITY", "GOOD_PKG_SIGN_IDENTITY"}) - public static void testExpiredCertificate(PackageType type, SignOption... options) { + public static void testExpiredCertificate(PackageType type, SignOption... optionIds) { + + var options = Stream.of(optionIds).map(SignOption::option).toList(); + + var badOptions = options.stream().filter(option -> { + return option.certRequest().expired(); + }).toList(); MacSign.withKeychain(keychain -> { + final var cmd = MacHelper.useKeychain(JPackageCommand.helloAppImage(), keychain) - .ignoreDefaultVerbose(true) - .addArguments(Stream.of(options).map(SignOption::args).flatMap(List::stream).toList()) + .mutate(MacSignTest::init) + .addArguments(options.stream().map(SignKeyOption::asCmdlineArgs).flatMap(List::stream).toList()) .setPackageType(type); - SignOption.configureOutputValidation(cmd, Stream.of(options).filter(SignOption::expired).toList(), opt -> { - return JPackageStringBundle.MAIN.cannedFormattedString("error.certificate.expired", opt.identityName()); + configureOutputValidation(cmd, expectFailures(badOptions), opt -> { + if (!opt.passThrough().orElse(false)) { + return expectConfigurationError("error.certificate.outside-validity-period", opt.certRequest().name()); + } else { + var builder = buildSignCommandErrorValidator(opt, keychain); + switch (opt.optionName().orElseThrow()) { + case KEY_IDENTITY_APP_IMAGE, KEY_USER_NAME -> { + builder.output(String.format("%s: no identity found", opt.certRequest().name())); + } + case KEY_IDENTITY_INSTALLER -> { + var regexp = Pattern.compile(String.format( + "^productbuild: error: Cannot write product to \\S+ \\(Could not find appropriate signing identity for “%s” in keychain at “%s”\\.\\)", + Pattern.quote(opt.certRequest().name()), + Pattern.quote(keychain.name()) + )); + builder.validators(TKit.assertTextStream(regexp)); + } + } + return builder.createGroup(); + } }).execute(1); }, MacSign.Keychain.UsageBuilder::addToSearchList, SigningBase.StandardKeychain.EXPIRED.keychain()); } @@ -185,30 +207,60 @@ public class MacSignTest { @Test @Parameter({"IMAGE", "GOOD_SIGNING_KEY_USER_NAME"}) @Parameter({"MAC_DMG", "GOOD_SIGNING_KEY_USER_NAME"}) + @Parameter({"MAC_PKG", "GOOD_SIGNING_KEY_USER_NAME", "GOOD_SIGNING_KEY_USER_NAME_PKG"}) @Parameter({"MAC_PKG", "GOOD_SIGNING_KEY_USER_NAME_PKG", "GOOD_SIGNING_KEY_USER_NAME"}) @Parameter({"IMAGE", "GOOD_CODESIGN_SIGN_IDENTITY"}) @Parameter({"MAC_PKG", "GOOD_CODESIGN_SIGN_IDENTITY", "GOOD_PKG_SIGN_IDENTITY"}) @Parameter({"MAC_PKG", "GOOD_PKG_SIGN_IDENTITY"}) - public static void testMultipleCertificates(PackageType type, SignOption... options) { + public static void testMultipleCertificates(PackageType type, SignOption... optionIds) { + + var options = Stream.of(optionIds).map(SignOption::option).toList(); MacSign.withKeychain(keychain -> { + final var cmd = MacHelper.useKeychain(JPackageCommand.helloAppImage(), keychain) - .ignoreDefaultVerbose(true) - .addArguments(Stream.of(options).map(SignOption::args).flatMap(List::stream).toList()) + .mutate(MacSignTest::init) + .addArguments(options.stream().map(SignKeyOption::asCmdlineArgs).flatMap(List::stream).toList()) .setPackageType(type); - Predicate filter = opt -> { - if (type == PackageType.MAC_PKG && options.length > 1) { - // Only the first error will be reported and it should always be - // for the app image signing, not for the PKG signing. - return opt.identityType() == CertificateType.CODE_SIGN; - } else { - return true; - } - }; + if (List.of(optionIds).equals(List.of(SignOption.GOOD_PKG_SIGN_IDENTITY))) { + /** + * Normally, if multiple signing identities share the same name, signing should + * fail. However, in pass-through signing, when jpackage passes signing + * identities without validation to signing commands, signing a .pkg installer + * with a name matching two signing identities succeeds. + */ + var group = TKit.TextStreamVerifier.group(); - SignOption.configureOutputValidation(cmd, Stream.of(options).filter(filter).toList(), opt -> { - return JPackageStringBundle.MAIN.cannedFormattedString("error.multiple.certs.found", opt.identityName(), keychain.name()); + group.add(TKit.assertTextStream(JPackageStringBundle.MAIN.cannedFormattedString( + "warning.unsigned.app.image", "pkg").getValue())); + + cmd.validateOutput(group.create().andThen(TKit.assertEndOfTextStream())); + + cmd.execute(); + return; + } + + configureOutputValidation(cmd, expectFailures(options), opt -> { + if (!opt.passThrough().orElse(false)) { + return expectConfigurationError("error.multiple.certs.found", opt.certRequest().name(), keychain.name()); + } else { + var builder = buildSignCommandErrorValidator(opt, keychain); + switch (opt.optionName().orElseThrow()) { + case KEY_IDENTITY_APP_IMAGE, KEY_USER_NAME -> { + builder.output(String.format("%s: ambiguous", opt.certRequest().name())); + } + case KEY_IDENTITY_INSTALLER -> { + var regexp = Pattern.compile(String.format( + "^productbuild: error: Cannot write product to \\S+ \\(Could not find appropriate signing identity for “%s” in keychain at “%s”\\.\\)", + Pattern.quote(opt.certRequest().name()), + Pattern.quote(keychain.name()) + )); + builder.validators(TKit.assertTextStream(regexp)); + } + } + return builder.createGroup(); + } }).execute(1); }, MacSign.Keychain.UsageBuilder::addToSearchList, SigningBase.StandardKeychain.DUPLICATE.keychain()); } @@ -262,7 +314,7 @@ public class MacSignTest { GOOD_SIGNING_KEY_USER_NAME(SIGN_KEY_USER_SHORT_NAME, SigningBase.StandardCertificateRequest.CODESIGN), GOOD_SIGNING_KEY_USER_NAME_PKG(SIGN_KEY_USER_SHORT_NAME, SigningBase.StandardCertificateRequest.PKG), GOOD_CODESIGN_SIGN_IDENTITY(SIGN_KEY_IDENTITY, SigningBase.StandardCertificateRequest.CODESIGN), - GOOD_PKG_SIGN_IDENTITY(SIGN_KEY_IDENTITY_APP_IMAGE, SigningBase.StandardCertificateRequest.PKG); + GOOD_PKG_SIGN_IDENTITY(SIGN_KEY_IDENTITY, SigningBase.StandardCertificateRequest.PKG); SignOption(SignKeyOption.Type optionType, NamedCertificateRequestSupplier certRequestSupplier) { this.option = new SignKeyOption(optionType, new ResolvableCertificateRequest(certRequestSupplier.certRequest(), _ -> { @@ -270,44 +322,111 @@ public class MacSignTest { }, certRequestSupplier.name())); } - boolean passThrough() { - return option.type().mapOptionName(option.certRequest().type()).orElseThrow().passThrough(); - } - - boolean expired() { - return option.certRequest().expired(); - } - - String identityName() { - return option.certRequest().name(); - } - - CertificateType identityType() { - return option.certRequest().type(); - } - - List args() { - return option.asCmdlineArgs(); - } - - static JPackageCommand configureOutputValidation(JPackageCommand cmd, List options, - Function conv) { - options.stream().filter(SignOption::passThrough) - .map(conv) - .map(CannedFormattedString::getValue) - .map(TKit::assertTextStream) - .map(TKit.TextStreamVerifier::negate) - .forEach(cmd::validateOutput); - - options.stream().filter(Predicate.not(SignOption::passThrough)) - .map(conv) - .map(CannedFormattedString::getValue) - .map(TKit::assertTextStream) - .forEach(cmd::validateOutput); - - return cmd; + SignKeyOption option() { + return option; } private final SignKeyOption option; } + + private static JPackageCommand configureOutputValidation(JPackageCommand cmd, Stream options, + Function conv) { + + // Validate jpackage's output matches expected output. + + var outputValidator = options.sorted(Comparator.comparing(option -> { + return option.certRequest().type(); + })).map(conv).reduce( + TKit.TextStreamVerifier.group(), + TKit.TextStreamVerifier.Group::add, + TKit.TextStreamVerifier.Group::add).tryCreate().map(consumer -> { + return consumer.andThen(TKit.assertEndOfTextStream()); + }).orElseGet(TKit::assertEndOfTextStream); + + cmd.validateOutput(outputValidator); + + return cmd; + } + + private static Stream expectFailures(Collection options) { + + if (!options.stream().map(option -> { + return option.passThrough().orElse(false); + }).distinct().reduce((x, y) -> { + throw new IllegalArgumentException(); + }).get()) { + // No pass-through signing options. + // This means jpackage will validate them at the configuration phase and report all detected errors. + return options.stream(); + } + + // Pass-through signing options. + // jpackage will not validate them and will report only one error at the packaging phase. + + Function> filterType = type -> { + return option -> { + return option.certRequest().type() == type; + }; + }; + + var appImageSignOption = options.stream() + .filter(filterType.apply(MacSign.CertificateType.CODE_SIGN)).findFirst(); + var pkgSignOption = options.stream() + .filter(filterType.apply(MacSign.CertificateType.INSTALLER)).findFirst(); + + if (appImageSignOption.isPresent() && pkgSignOption.isPresent()) { + return options.stream().filter(option -> { + return appImageSignOption.get() == option; + }); + } else { + return options.stream(); + } + } + + private static TKit.TextStreamVerifier.Group expectConfigurationError(String key, Object ... args) { + var str = JPackageStringBundle.MAIN.cannedFormattedString(key, args); + str = JPackageCommand.makeError(str); + return TKit.TextStreamVerifier.group().add(TKit.assertTextStream(str.getValue()).predicate(String::equals)); + } + + private static FailedCommandErrorValidator buildSignCommandErrorValidator(SignKeyOptionWithKeychain option) { + return buildSignCommandErrorValidator(option.signKeyOption(), option.keychain()); + } + + private static FailedCommandErrorValidator buildSignCommandErrorValidator(SignKeyOption option, MacSign.ResolvedKeychain keychain) { + + Objects.requireNonNull(option); + Objects.requireNonNull(keychain); + + String cmdlinePatternFormat; + String signIdentity; + + switch (option.optionName().orElseThrow()) { + case KEY_IDENTITY_APP_IMAGE, KEY_USER_NAME -> { + cmdlinePatternFormat = "^/usr/bin/codesign -s %s -vvvv --timestamp --options runtime --prefix \\S+ --keychain %s"; + if (option.passThrough().orElse(false)) { + signIdentity = String.format("'%s'", option.asCmdlineArgs().getLast()); + } else { + signIdentity = MacSign.CertificateHash.of(option.certRequest().cert()).toString(); + } + } + case KEY_IDENTITY_INSTALLER -> { + cmdlinePatternFormat = "^/usr/bin/productbuild --resources \\S+ --sign %s --keychain %s"; + signIdentity = String.format("'%s'", option.asCmdlineArgs().getLast()); + } + default -> { + throw ExceptionBox.reachedUnreachable(); + } + } + + return new FailedCommandErrorValidator(Pattern.compile(String.format( + cmdlinePatternFormat, + Pattern.quote(signIdentity), + Pattern.quote(keychain.name()) + ))).exitCode(1); + } + + private static void init(JPackageCommand cmd) { + cmd.setFakeRuntime().ignoreDefaultVerbose(true); + } } From 56afb460a0055206a1deb1260f6440de9d437acb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Maillard?= Date: Wed, 11 Feb 2026 08:27:48 +0000 Subject: [PATCH 060/120] 8375038: C2: Enforce that Ideal() returns the root of the subgraph if any change was made by checking the node hash Reviewed-by: qamai, mchevalier --- src/hotspot/share/opto/c2_globals.hpp | 6 ++++-- src/hotspot/share/opto/cfgnode.cpp | 9 +++++---- src/hotspot/share/opto/intrinsicnode.cpp | 6 +++--- src/hotspot/share/opto/node.cpp | 12 ++++++++---- src/hotspot/share/opto/phaseX.cpp | 14 +++++++++++++- src/hotspot/share/opto/phaseX.hpp | 6 +++++- .../runtime/flags/jvmFlagConstraintsCompiler.cpp | 4 ++-- .../jtreg/compiler/c2/TestVerifyIterativeGVN.java | 4 ++-- 8 files changed, 42 insertions(+), 19 deletions(-) diff --git a/src/hotspot/share/opto/c2_globals.hpp b/src/hotspot/share/opto/c2_globals.hpp index f470049bf7e..1662f808286 100644 --- a/src/hotspot/share/opto/c2_globals.hpp +++ b/src/hotspot/share/opto/c2_globals.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -694,7 +694,9 @@ "Print progress during Iterative Global Value Numbering") \ \ develop(uint, VerifyIterativeGVN, 0, \ - "Verify Iterative Global Value Numbering =EDCBA, with:" \ + "Verify Iterative Global Value Numbering =FEDCBA, with:" \ + " F: verify Node::Ideal does not return nullptr if the node" \ + "hash has changed" \ " E: verify node specific invariants" \ " D: verify Node::Identity did not miss opportunities" \ " C: verify Node::Ideal did not miss opportunities" \ diff --git a/src/hotspot/share/opto/cfgnode.cpp b/src/hotspot/share/opto/cfgnode.cpp index efa0b55e2c2..c65bc391792 100644 --- a/src/hotspot/share/opto/cfgnode.cpp +++ b/src/hotspot/share/opto/cfgnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2243,7 +2243,7 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) { PhaseIterGVN* igvn = phase->is_IterGVN(); if (wait_for_cast_input_igvn(igvn)) { igvn->_worklist.push(this); - return nullptr; + return progress; } uncasted = true; uin = unique_input(phase, true); @@ -2320,6 +2320,7 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) { PhaseIterGVN* igvn = phase->is_IterGVN(); for (uint i = 1; i < req(); i++) { set_req_X(i, cast, igvn); + progress = this; } uin = cast; } @@ -2338,7 +2339,7 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) { #endif // Identity may not return the expected uin, if it has to wait for the region, in irreducible case assert(ident == uin || ident->is_top() || must_wait_for_region_in_irreducible_loop(phase), "Identity must clean this up"); - return nullptr; + return progress; } Node* opt = nullptr; @@ -2529,7 +2530,7 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) { // Phi references itself through all other inputs then splitting the // Phi through memory merges would create dead loop at later stage. if (ii == top) { - return nullptr; // Delay optimization until graph is cleaned. + return progress; // Delay optimization until graph is cleaned. } if (ii->is_MergeMem()) { MergeMemNode* n = ii->as_MergeMem(); diff --git a/src/hotspot/share/opto/intrinsicnode.cpp b/src/hotspot/share/opto/intrinsicnode.cpp index 1397d31af53..c3e003ad8d3 100644 --- a/src/hotspot/share/opto/intrinsicnode.cpp +++ b/src/hotspot/share/opto/intrinsicnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,8 +46,8 @@ Node* StrIntrinsicNode::Ideal(PhaseGVN* phase, bool can_reshape) { if (in(0) && in(0)->is_top()) return nullptr; if (can_reshape) { - Node* mem = phase->transform(in(MemNode::Memory)); - // If transformed to a MergeMem, get the desired slice + Node* mem = in(MemNode::Memory); + // If mem input is a MergeMem, get the desired slice uint alias_idx = phase->C->get_alias_index(adr_type()); mem = mem->is_MergeMem() ? mem->as_MergeMem()->memory_at(alias_idx) : mem; if (mem != in(MemNode::Memory)) { diff --git a/src/hotspot/share/opto/node.cpp b/src/hotspot/share/opto/node.cpp index 832727a424e..cb5795a1250 100644 --- a/src/hotspot/share/opto/node.cpp +++ b/src/hotspot/share/opto/node.cpp @@ -1151,15 +1151,19 @@ const Type* Node::Value(PhaseGVN* phase) const { // 'Idealize' the graph rooted at this Node. // // In order to be efficient and flexible there are some subtle invariants -// these Ideal calls need to hold. Running with '-XX:VerifyIterativeGVN=1' checks -// these invariants, although its too slow to have on by default. If you are -// hacking an Ideal call, be sure to test with '-XX:VerifyIterativeGVN=1' +// these Ideal calls need to hold. Some of the flag bits for '-XX:VerifyIterativeGVN' +// can help with validating these invariants, although they are too slow to have on by default: +// - '-XX:VerifyIterativeGVN=1' checks the def-use info +// - '-XX:VerifyIterativeGVN=100000' checks the return value +// If you are hacking an Ideal call, be sure to use these. // // The Ideal call almost arbitrarily reshape the graph rooted at the 'this' // pointer. If ANY change is made, it must return the root of the reshaped // graph - even if the root is the same Node. Example: swapping the inputs // to an AddINode gives the same answer and same root, but you still have to -// return the 'this' pointer instead of null. +// return the 'this' pointer instead of null. If the node was already dead +// before the Ideal call, this rule does not apply, and it is fine to return +// nullptr even if modifications were made. // // You cannot return an OLD Node, except for the 'this' pointer. Use the // Identity call to return an old Node; basically if Identity can find diff --git a/src/hotspot/share/opto/phaseX.cpp b/src/hotspot/share/opto/phaseX.cpp index ce24c46590d..d2b2904b545 100644 --- a/src/hotspot/share/opto/phaseX.cpp +++ b/src/hotspot/share/opto/phaseX.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2167,9 +2167,15 @@ Node *PhaseIterGVN::transform_old(Node* n) { DEBUG_ONLY(dead_loop_check(k);) DEBUG_ONLY(bool is_new = (k->outcnt() == 0);) C->remove_modified_node(k); +#ifndef PRODUCT + uint hash_before = is_verify_Ideal_return() ? k->hash() : 0; +#endif Node* i = apply_ideal(k, /*can_reshape=*/true); assert(i != k || is_new || i->outcnt() > 0, "don't return dead nodes"); #ifndef PRODUCT + if (is_verify_Ideal_return()) { + assert(k->outcnt() == 0 || i != nullptr || hash_before == k->hash(), "hash changed after Ideal returned nullptr for %s", k->Name()); + } verify_step(k); #endif @@ -2193,9 +2199,15 @@ Node *PhaseIterGVN::transform_old(Node* n) { // Try idealizing again DEBUG_ONLY(is_new = (k->outcnt() == 0);) C->remove_modified_node(k); +#ifndef PRODUCT + uint hash_before = is_verify_Ideal_return() ? k->hash() : 0; +#endif i = apply_ideal(k, /*can_reshape=*/true); assert(i != k || is_new || (i->outcnt() > 0), "don't return dead nodes"); #ifndef PRODUCT + if (is_verify_Ideal_return()) { + assert(k->outcnt() == 0 || i != nullptr || hash_before == k->hash(), "hash changed after Ideal returned nullptr for %s", k->Name()); + } verify_step(k); #endif DEBUG_ONLY(loop_count++;) diff --git a/src/hotspot/share/opto/phaseX.hpp b/src/hotspot/share/opto/phaseX.hpp index ce02f456c00..cc0d47bd634 100644 --- a/src/hotspot/share/opto/phaseX.hpp +++ b/src/hotspot/share/opto/phaseX.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -627,6 +627,10 @@ public: // '-XX:VerifyIterativeGVN=10000' return ((VerifyIterativeGVN % 100000) / 10000) == 1; } + static bool is_verify_Ideal_return() { + // '-XX:VerifyIterativeGVN=100000' + return ((VerifyIterativeGVN % 1000000) / 100000) == 1; + } protected: // Sub-quadratic implementation of '-XX:VerifyIterativeGVN=1' (Use-Def verification). julong _verify_counter; diff --git a/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.cpp b/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.cpp index 63d3424b3ed..47a02184d29 100644 --- a/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.cpp +++ b/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -306,7 +306,7 @@ JVMFlag::Error TypeProfileLevelConstraintFunc(uint value, bool verbose) { } JVMFlag::Error VerifyIterativeGVNConstraintFunc(uint value, bool verbose) { - const int max_modes = 5; + const int max_modes = 6; uint original_value = value; for (int i = 0; i < max_modes; i++) { if (value % 10 > 1) { diff --git a/test/hotspot/jtreg/compiler/c2/TestVerifyIterativeGVN.java b/test/hotspot/jtreg/compiler/c2/TestVerifyIterativeGVN.java index 4b6215b25bd..39bb8b0a0ad 100644 --- a/test/hotspot/jtreg/compiler/c2/TestVerifyIterativeGVN.java +++ b/test/hotspot/jtreg/compiler/c2/TestVerifyIterativeGVN.java @@ -25,9 +25,9 @@ * @test * @bug 8238756 8351889 * @requires vm.debug == true & vm.flavor == "server" - * @summary Run with -Xcomp to test -XX:VerifyIterativeGVN=11111 in debug builds. + * @summary Run with -Xcomp to test -XX:VerifyIterativeGVN=111111 in debug builds. * - * @run main/othervm/timeout=300 -Xcomp -XX:VerifyIterativeGVN=11111 compiler.c2.TestVerifyIterativeGVN + * @run main/othervm/timeout=300 -Xcomp -XX:VerifyIterativeGVN=111111 compiler.c2.TestVerifyIterativeGVN */ package compiler.c2; From 1e99cc4880f695c12705d849d41609f176f897bd Mon Sep 17 00:00:00 2001 From: Christian Stein Date: Wed, 11 Feb 2026 09:14:31 +0000 Subject: [PATCH 061/120] 8376355: Update to use jtreg 8.2.1 Reviewed-by: iris, erikj, shade --- make/autoconf/lib-tests.m4 | 4 ++-- make/conf/github-actions.conf | 4 ++-- make/conf/jib-profiles.js | 6 +++--- test/docs/TEST.ROOT | 4 ++-- test/hotspot/jtreg/TEST.ROOT | 4 ++-- test/jaxp/TEST.ROOT | 2 +- test/jdk/TEST.ROOT | 4 ++-- test/langtools/TEST.ROOT | 2 +- test/lib-test/TEST.ROOT | 4 ++-- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/make/autoconf/lib-tests.m4 b/make/autoconf/lib-tests.m4 index 31d48055984..faaf229eacd 100644 --- a/make/autoconf/lib-tests.m4 +++ b/make/autoconf/lib-tests.m4 @@ -1,5 +1,5 @@ # -# Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. # 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 @@ ################################################################################ # Minimum supported versions -JTREG_MINIMUM_VERSION=8.1 +JTREG_MINIMUM_VERSION=8.2.1 GTEST_MINIMUM_VERSION=1.14.0 ################################################################################ diff --git a/make/conf/github-actions.conf b/make/conf/github-actions.conf index bd73e909062..ebfc9191535 100644 --- a/make/conf/github-actions.conf +++ b/make/conf/github-actions.conf @@ -1,5 +1,5 @@ # -# Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved. # 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 @@ # Versions and download locations for dependencies used by GitHub Actions (GHA) GTEST_VERSION=1.14.0 -JTREG_VERSION=8.1+1 +JTREG_VERSION=8.2.1+1 LINUX_X64_BOOT_JDK_EXT=tar.gz LINUX_X64_BOOT_JDK_URL=https://download.java.net/java/GA/jdk25/bd75d5f9689641da8e1daabeccb5528b/36/GPL/openjdk-25_linux-x64_bin.tar.gz diff --git a/make/conf/jib-profiles.js b/make/conf/jib-profiles.js index 93aeebc0dd6..76a94b7789e 100644 --- a/make/conf/jib-profiles.js +++ b/make/conf/jib-profiles.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1174,9 +1174,9 @@ var getJibProfilesDependencies = function (input, common) { jtreg: { server: "jpg", product: "jtreg", - version: "8.1", + version: "8.2.1", build_number: "1", - file: "bundles/jtreg-8.1+1.zip", + file: "bundles/jtreg-8.2.1+1.zip", environment_name: "JT_HOME", environment_path: input.get("jtreg", "home_path") + "/bin", configure_args: "--with-jtreg=" + input.get("jtreg", "home_path"), diff --git a/test/docs/TEST.ROOT b/test/docs/TEST.ROOT index 69e66b08b88..9a7e66b631c 100644 --- a/test/docs/TEST.ROOT +++ b/test/docs/TEST.ROOT @@ -1,5 +1,5 @@ # -# Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2024, 2026, Oracle and/or its affiliates. All rights reserved. # 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 @@ groups=TEST.groups # Minimum jtreg version -requiredVersion=8.1+1 +requiredVersion=8.2.1+1 # Use new module options useNewOptions=true diff --git a/test/hotspot/jtreg/TEST.ROOT b/test/hotspot/jtreg/TEST.ROOT index 0fdbdae9bc5..d1c72b9768c 100644 --- a/test/hotspot/jtreg/TEST.ROOT +++ b/test/hotspot/jtreg/TEST.ROOT @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2026, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -107,7 +107,7 @@ requires.properties= \ jdk.static # Minimum jtreg version -requiredVersion=8.1+1 +requiredVersion=8.2.1+1 # Path to libraries in the topmost test directory. This is needed so @library # does not need ../../../ notation to reach them diff --git a/test/jaxp/TEST.ROOT b/test/jaxp/TEST.ROOT index 82504c251c0..aff3b769830 100644 --- a/test/jaxp/TEST.ROOT +++ b/test/jaxp/TEST.ROOT @@ -23,7 +23,7 @@ modules=java.xml groups=TEST.groups # Minimum jtreg version -requiredVersion=8.1+1 +requiredVersion=8.2.1+1 # Path to libraries in the topmost test directory. This is needed so @library # does not need ../../ notation to reach them diff --git a/test/jdk/TEST.ROOT b/test/jdk/TEST.ROOT index f22b316e19a..cc571deab20 100644 --- a/test/jdk/TEST.ROOT +++ b/test/jdk/TEST.ROOT @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2026, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This file identifies the root of the test-suite hierarchy. @@ -123,7 +123,7 @@ requires.properties= \ jdk.static # Minimum jtreg version -requiredVersion=8.1+1 +requiredVersion=8.2.1+1 # Path to libraries in the topmost test directory. This is needed so @library # does not need ../../ notation to reach them diff --git a/test/langtools/TEST.ROOT b/test/langtools/TEST.ROOT index 14636716882..434cf91b0ec 100644 --- a/test/langtools/TEST.ROOT +++ b/test/langtools/TEST.ROOT @@ -15,7 +15,7 @@ keys=intermittent randomness needs-src needs-src-jdk_javadoc groups=TEST.groups # Minimum jtreg version -requiredVersion=8.1+1 +requiredVersion=8.2.1+1 # Use new module options useNewOptions=true diff --git a/test/lib-test/TEST.ROOT b/test/lib-test/TEST.ROOT index ebdf3f1a334..f23d38c1e66 100644 --- a/test/lib-test/TEST.ROOT +++ b/test/lib-test/TEST.ROOT @@ -1,5 +1,5 @@ # -# Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved. # 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 @@ keys=randomness # Minimum jtreg version -requiredVersion=8.1+1 +requiredVersion=8.2.1+1 # Allow querying of various System properties in @requires clauses requires.extraPropDefns = ../jtreg-ext/requires/VMProps.java From 57931dc6b24af2c02206b01bcc417e5607d39371 Mon Sep 17 00:00:00 2001 From: Leo Korinth Date: Wed, 11 Feb 2026 09:14:58 +0000 Subject: [PATCH 062/120] 8377172: Change datatype of CodeEntryAlignment to uint Reviewed-by: ayang, mhaessig --- src/hotspot/cpu/aarch64/globals_aarch64.hpp | 4 ++-- src/hotspot/cpu/arm/globals_arm.hpp | 4 ++-- src/hotspot/cpu/ppc/globals_ppc.hpp | 4 ++-- src/hotspot/cpu/riscv/globals_riscv.hpp | 4 ++-- src/hotspot/cpu/s390/globals_s390.hpp | 4 ++-- src/hotspot/cpu/x86/globals_x86.hpp | 6 ++--- src/hotspot/cpu/x86/macroAssembler_x86.cpp | 2 +- src/hotspot/cpu/zero/globals_zero.hpp | 4 ++-- src/hotspot/share/asm/codeBuffer.cpp | 6 ++--- src/hotspot/share/code/codeCache.cpp | 2 +- src/hotspot/share/interpreter/interpreter.hpp | 4 ++-- .../share/jvmci/jvmciCompilerToVMInit.cpp | 11 +++++----- src/hotspot/share/opto/constantTable.cpp | 4 ++-- .../flags/jvmFlagConstraintsCompiler.cpp | 22 +++++++++---------- .../flags/jvmFlagConstraintsCompiler.hpp | 4 ++-- src/hotspot/share/runtime/globals.hpp | 5 +++-- 16 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/hotspot/cpu/aarch64/globals_aarch64.hpp b/src/hotspot/cpu/aarch64/globals_aarch64.hpp index 8e520314c8b..a59e83c4b69 100644 --- a/src/hotspot/cpu/aarch64/globals_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/globals_aarch64.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2019, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -39,7 +39,7 @@ define_pd_global(bool, UncommonNullCast, true); // Uncommon-trap nulls define_pd_global(bool, DelayCompilerStubsGeneration, COMPILER2_OR_JVMCI); define_pd_global(size_t, CodeCacheSegmentSize, 64); -define_pd_global(intx, CodeEntryAlignment, 64); +define_pd_global(uint, CodeEntryAlignment, 64); define_pd_global(intx, OptoLoopAlignment, 16); #define DEFAULT_STACK_YELLOW_PAGES (2) diff --git a/src/hotspot/cpu/arm/globals_arm.hpp b/src/hotspot/cpu/arm/globals_arm.hpp index 363a9a2c25c..c568ea04122 100644 --- a/src/hotspot/cpu/arm/globals_arm.hpp +++ b/src/hotspot/cpu/arm/globals_arm.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2026, Oracle and/or its affiliates. All rights reserved. * 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 @@ define_pd_global(bool, TrapBasedNullChecks, false); // Not needed define_pd_global(bool, DelayCompilerStubsGeneration, false); // No need - only few compiler's stubs define_pd_global(size_t, CodeCacheSegmentSize, 64); -define_pd_global(intx, CodeEntryAlignment, 16); +define_pd_global(uint, CodeEntryAlignment, 16); define_pd_global(intx, OptoLoopAlignment, 16); #define DEFAULT_STACK_YELLOW_PAGES (2) diff --git a/src/hotspot/cpu/ppc/globals_ppc.hpp b/src/hotspot/cpu/ppc/globals_ppc.hpp index 41a8e821ada..927a8cc2be3 100644 --- a/src/hotspot/cpu/ppc/globals_ppc.hpp +++ b/src/hotspot/cpu/ppc/globals_ppc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2026, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -60,7 +60,7 @@ define_pd_global(bool, VMContinuations, true); // Use large code-entry alignment. define_pd_global(size_t, CodeCacheSegmentSize, 128); -define_pd_global(intx, CodeEntryAlignment, 64); +define_pd_global(uint, CodeEntryAlignment, 64); define_pd_global(intx, OptoLoopAlignment, 16); define_pd_global(intx, InlineSmallCode, 1500); diff --git a/src/hotspot/cpu/riscv/globals_riscv.hpp b/src/hotspot/cpu/riscv/globals_riscv.hpp index 390ed2daeb9..21b119266e2 100644 --- a/src/hotspot/cpu/riscv/globals_riscv.hpp +++ b/src/hotspot/cpu/riscv/globals_riscv.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2023, Huawei Technologies Co., Ltd. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -39,7 +39,7 @@ define_pd_global(bool, UncommonNullCast, true); // Uncommon-trap nulls define_pd_global(bool, DelayCompilerStubsGeneration, COMPILER2_OR_JVMCI); define_pd_global(size_t, CodeCacheSegmentSize, 64 COMPILER1_AND_COMPILER2_PRESENT(+64)); // Tiered compilation has large code-entry alignment. -define_pd_global(intx, CodeEntryAlignment, 64); +define_pd_global(uint, CodeEntryAlignment, 64); define_pd_global(intx, OptoLoopAlignment, 16); #define DEFAULT_STACK_YELLOW_PAGES (2) diff --git a/src/hotspot/cpu/s390/globals_s390.hpp b/src/hotspot/cpu/s390/globals_s390.hpp index 07987ea3469..d110443adf8 100644 --- a/src/hotspot/cpu/s390/globals_s390.hpp +++ b/src/hotspot/cpu/s390/globals_s390.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, 2018 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -43,7 +43,7 @@ define_pd_global(size_t, CodeCacheSegmentSize, 256); // Ideally, this is 256 (cache line size). This keeps code end data // on separate lines. But we reduced it to 64 since 256 increased // code size significantly by padding nops between IVC and second UEP. -define_pd_global(intx, CodeEntryAlignment, 64); +define_pd_global(uint, CodeEntryAlignment, 64); define_pd_global(intx, OptoLoopAlignment, 2); define_pd_global(intx, InlineSmallCode, 2000); diff --git a/src/hotspot/cpu/x86/globals_x86.hpp b/src/hotspot/cpu/x86/globals_x86.hpp index 103e22d0185..4f5b6d31e75 100644 --- a/src/hotspot/cpu/x86/globals_x86.hpp +++ b/src/hotspot/cpu/x86/globals_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. * 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,9 +46,9 @@ define_pd_global(size_t, CodeCacheSegmentSize, 64 COMPILER1_AND_COMPILER2_PRES // the uep and the vep doesn't get real alignment but just slops on by // only assured that the entry instruction meets the 5 byte size requirement. #if COMPILER2_OR_JVMCI -define_pd_global(intx, CodeEntryAlignment, 32); +define_pd_global(uint, CodeEntryAlignment, 32); #else -define_pd_global(intx, CodeEntryAlignment, 16); +define_pd_global(uint, CodeEntryAlignment, 16); #endif // COMPILER2_OR_JVMCI define_pd_global(intx, OptoLoopAlignment, 16); define_pd_global(intx, InlineSmallCode, 1000); diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.cpp b/src/hotspot/cpu/x86/macroAssembler_x86.cpp index d4d3ec85bcf..83169df3456 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp @@ -765,7 +765,7 @@ void MacroAssembler::align32() { void MacroAssembler::align(uint modulus) { // 8273459: Ensure alignment is possible with current segment alignment - assert(modulus <= (uintx)CodeEntryAlignment, "Alignment must be <= CodeEntryAlignment"); + assert(modulus <= CodeEntryAlignment, "Alignment must be <= CodeEntryAlignment"); align(modulus, offset()); } diff --git a/src/hotspot/cpu/zero/globals_zero.hpp b/src/hotspot/cpu/zero/globals_zero.hpp index 6b6c6ea983c..6dc7d81275c 100644 --- a/src/hotspot/cpu/zero/globals_zero.hpp +++ b/src/hotspot/cpu/zero/globals_zero.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -39,7 +39,7 @@ define_pd_global(bool, UncommonNullCast, true); define_pd_global(bool, DelayCompilerStubsGeneration, false); // Don't have compiler's stubs define_pd_global(size_t, CodeCacheSegmentSize, 64 COMPILER1_AND_COMPILER2_PRESENT(+64)); // Tiered compilation has large code-entry alignment. -define_pd_global(intx, CodeEntryAlignment, 32); +define_pd_global(uint, CodeEntryAlignment, 32); define_pd_global(intx, OptoLoopAlignment, 16); define_pd_global(intx, InlineSmallCode, 1000); diff --git a/src/hotspot/share/asm/codeBuffer.cpp b/src/hotspot/share/asm/codeBuffer.cpp index d94f52c18f6..ba525588f32 100644 --- a/src/hotspot/share/asm/codeBuffer.cpp +++ b/src/hotspot/share/asm/codeBuffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -468,9 +468,7 @@ void CodeBuffer::compute_final_layout(CodeBuffer* dest) const { assert(!_finalize_stubs, "non-finalized stubs"); { - // not sure why this is here, but why not... - int alignSize = MAX2((intx) sizeof(jdouble), CodeEntryAlignment); - assert( (dest->_total_start - _insts.start()) % alignSize == 0, "copy must preserve alignment"); + assert( (dest->_total_start - _insts.start()) % CodeEntryAlignment == 0, "copy must preserve alignment"); } const CodeSection* prev_cs = nullptr; diff --git a/src/hotspot/share/code/codeCache.cpp b/src/hotspot/share/code/codeCache.cpp index 481eb51bd5c..2a0256cc316 100644 --- a/src/hotspot/share/code/codeCache.cpp +++ b/src/hotspot/share/code/codeCache.cpp @@ -1139,7 +1139,7 @@ size_t CodeCache::freelists_length() { void icache_init(); void CodeCache::initialize() { - assert(CodeCacheSegmentSize >= (size_t)CodeEntryAlignment, "CodeCacheSegmentSize must be large enough to align entry points"); + assert(CodeCacheSegmentSize >= CodeEntryAlignment, "CodeCacheSegmentSize must be large enough to align entry points"); #ifdef COMPILER2 assert(CodeCacheSegmentSize >= (size_t)OptoLoopAlignment, "CodeCacheSegmentSize must be large enough to align inner loops"); #endif diff --git a/src/hotspot/share/interpreter/interpreter.hpp b/src/hotspot/share/interpreter/interpreter.hpp index 576146b344e..f7d42fcb4da 100644 --- a/src/hotspot/share/interpreter/interpreter.hpp +++ b/src/hotspot/share/interpreter/interpreter.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -59,7 +59,7 @@ class InterpreterCodelet: public Stub { // General info/converters int size() const { return _size; } static int alignment() { return HeapWordSize; } - static int code_alignment() { return CodeEntryAlignment; } + static uint code_alignment() { return CodeEntryAlignment; } // Code info address code_begin() const { return align_up((address)this + sizeof(InterpreterCodelet), code_alignment()); } diff --git a/src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp b/src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp index 3e9d8c97b88..6214f6a2746 100644 --- a/src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp +++ b/src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -355,7 +355,7 @@ JVMCIObjectArray CompilerToVM::initialize_intrinsics(JVMCI_TRAPS) { return vmIntrinsics; } -#define PREDEFINED_CONFIG_FLAGS(do_bool_flag, do_int_flag, do_size_t_flag, do_intx_flag, do_uintx_flag) \ +#define PREDEFINED_CONFIG_FLAGS(do_bool_flag, do_uint_flag, do_int_flag, do_size_t_flag, do_intx_flag, do_uintx_flag) \ do_int_flag(AllocateInstancePrefetchLines) \ do_int_flag(AllocatePrefetchDistance) \ do_intx_flag(AllocatePrefetchInstr) \ @@ -367,7 +367,7 @@ JVMCIObjectArray CompilerToVM::initialize_intrinsics(JVMCI_TRAPS) { do_bool_flag(CITime) \ do_bool_flag(CITimeEach) \ do_size_t_flag(CodeCacheSegmentSize) \ - do_intx_flag(CodeEntryAlignment) \ + do_uint_flag(CodeEntryAlignment) \ do_int_flag(ContendedPaddingWidth) \ do_bool_flag(DontCompileHugeMethods) \ do_bool_flag(EagerJVMCI) \ @@ -554,16 +554,17 @@ jobjectArray readConfiguration0(JNIEnv *env, JVMCI_TRAPS) { JVMCIENV->put_object_at(vmFlags, i++, vmFlagObj); \ } #define ADD_BOOL_FLAG(name) ADD_FLAG(bool, name, BOXED_BOOLEAN) +#define ADD_UINT_FLAG(name) ADD_FLAG(uint, name, BOXED_LONG) #define ADD_INT_FLAG(name) ADD_FLAG(int, name, BOXED_LONG) #define ADD_SIZE_T_FLAG(name) ADD_FLAG(size_t, name, BOXED_LONG) #define ADD_INTX_FLAG(name) ADD_FLAG(intx, name, BOXED_LONG) #define ADD_UINTX_FLAG(name) ADD_FLAG(uintx, name, BOXED_LONG) - len = 0 + PREDEFINED_CONFIG_FLAGS(COUNT_FLAG, COUNT_FLAG, COUNT_FLAG, COUNT_FLAG, COUNT_FLAG); + len = 0 + PREDEFINED_CONFIG_FLAGS(COUNT_FLAG, COUNT_FLAG, COUNT_FLAG, COUNT_FLAG, COUNT_FLAG, COUNT_FLAG); JVMCIObjectArray vmFlags = JVMCIENV->new_VMFlag_array(len, JVMCI_CHECK_NULL); int i = 0; JVMCIObject value; - PREDEFINED_CONFIG_FLAGS(ADD_BOOL_FLAG, ADD_INT_FLAG, ADD_SIZE_T_FLAG, ADD_INTX_FLAG, ADD_UINTX_FLAG) + PREDEFINED_CONFIG_FLAGS(ADD_BOOL_FLAG, ADD_UINT_FLAG, ADD_INT_FLAG, ADD_SIZE_T_FLAG, ADD_INTX_FLAG, ADD_UINTX_FLAG) JVMCIObjectArray vmIntrinsics = CompilerToVM::initialize_intrinsics(JVMCI_CHECK_NULL); diff --git a/src/hotspot/share/opto/constantTable.cpp b/src/hotspot/share/opto/constantTable.cpp index aba71e45e1c..ae4ac336d93 100644 --- a/src/hotspot/share/opto/constantTable.cpp +++ b/src/hotspot/share/opto/constantTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -158,7 +158,7 @@ void ConstantTable::calculate_offsets_and_size() { // Align size up to the next section start (which is insts; see // CodeBuffer::align_at_start). assert(_size == -1, "already set?"); - _size = align_up(offset, (int)CodeEntryAlignment); + _size = align_up(offset, CodeEntryAlignment); } bool ConstantTable::emit(C2_MacroAssembler* masm) const { diff --git a/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.cpp b/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.cpp index 47a02184d29..444ce321759 100644 --- a/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.cpp +++ b/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.cpp @@ -163,10 +163,10 @@ JVMFlag::Error CodeCacheSegmentSizeConstraintFunc(size_t value, bool verbose) { return JVMFlag::VIOLATES_CONSTRAINT; } - if (CodeCacheSegmentSize < (size_t)CodeEntryAlignment) { + if (CodeCacheSegmentSize < CodeEntryAlignment) { JVMFlag::printError(verbose, "CodeCacheSegmentSize (%zu) must be " - "larger than or equal to CodeEntryAlignment (%zd) " + "larger than or equal to CodeEntryAlignment (%u) " "to align entry points\n", CodeCacheSegmentSize, CodeEntryAlignment); return JVMFlag::VIOLATES_CONSTRAINT; @@ -194,25 +194,25 @@ JVMFlag::Error CodeCacheSegmentSizeConstraintFunc(size_t value, bool verbose) { return JVMFlag::SUCCESS; } -JVMFlag::Error CodeEntryAlignmentConstraintFunc(intx value, bool verbose) { +JVMFlag::Error CodeEntryAlignmentConstraintFunc(uint value, bool verbose) { if (!is_power_of_2(value)) { JVMFlag::printError(verbose, - "CodeEntryAlignment (%zd) must be " + "CodeEntryAlignment (%u) must be " "a power of two\n", CodeEntryAlignment); return JVMFlag::VIOLATES_CONSTRAINT; } if (CodeEntryAlignment < 16) { JVMFlag::printError(verbose, - "CodeEntryAlignment (%zd) must be " + "CodeEntryAlignment (%u) must be " "greater than or equal to %d\n", CodeEntryAlignment, 16); return JVMFlag::VIOLATES_CONSTRAINT; } - if ((size_t)CodeEntryAlignment > CodeCacheSegmentSize) { + if (CodeEntryAlignment > CodeCacheSegmentSize) { JVMFlag::printError(verbose, - "CodeEntryAlignment (%zd) must be " + "CodeEntryAlignment (%u) must be " "less than or equal to CodeCacheSegmentSize (%zu) " "to align entry points\n", CodeEntryAlignment, CodeCacheSegmentSize); @@ -241,10 +241,10 @@ JVMFlag::Error OptoLoopAlignmentConstraintFunc(intx value, bool verbose) { return JVMFlag::VIOLATES_CONSTRAINT; } - if (OptoLoopAlignment > CodeEntryAlignment) { + if (checked_cast(OptoLoopAlignment) > CodeEntryAlignment) { JVMFlag::printError(verbose, "OptoLoopAlignment (%zd) must be " - "less or equal to CodeEntryAlignment (%zd)\n", + "less or equal to CodeEntryAlignment (%u)\n", value, CodeEntryAlignment); return JVMFlag::VIOLATES_CONSTRAINT; } @@ -339,10 +339,10 @@ JVMFlag::Error InitArrayShortSizeConstraintFunc(intx value, bool verbose) { #ifdef COMPILER2 JVMFlag::Error InteriorEntryAlignmentConstraintFunc(intx value, bool verbose) { - if (InteriorEntryAlignment > CodeEntryAlignment) { + if (checked_cast(InteriorEntryAlignment) > CodeEntryAlignment) { JVMFlag::printError(verbose, "InteriorEntryAlignment (%zd) must be " - "less than or equal to CodeEntryAlignment (%zd)\n", + "less than or equal to CodeEntryAlignment (%u)\n", InteriorEntryAlignment, CodeEntryAlignment); return JVMFlag::VIOLATES_CONSTRAINT; } diff --git a/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.hpp b/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.hpp index 4544ad706fd..cf785800cfc 100644 --- a/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.hpp +++ b/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,7 +41,7 @@ f(intx, CompileThresholdConstraintFunc) \ f(intx, OnStackReplacePercentageConstraintFunc) \ f(size_t, CodeCacheSegmentSizeConstraintFunc) \ - f(intx, CodeEntryAlignmentConstraintFunc) \ + f(uint, CodeEntryAlignmentConstraintFunc) \ f(intx, OptoLoopAlignmentConstraintFunc) \ f(uintx, ArraycopyDstPrefetchDistanceConstraintFunc) \ f(uintx, ArraycopySrcPrefetchDistanceConstraintFunc) \ diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp index 6a2bbc9c648..6d4b9908e1c 100644 --- a/src/hotspot/share/runtime/globals.hpp +++ b/src/hotspot/share/runtime/globals.hpp @@ -1508,8 +1508,9 @@ const int ObjectAlignmentInBytes = 8; range(1, 1024) \ constraint(CodeCacheSegmentSizeConstraintFunc, AfterErgo) \ \ - product_pd(intx, CodeEntryAlignment, EXPERIMENTAL, \ - "Code entry alignment for generated code (in bytes)") \ + product_pd(uint, CodeEntryAlignment, EXPERIMENTAL, \ + "Code entry alignment for generated code" \ + " (in bytes, power of two)") \ constraint(CodeEntryAlignmentConstraintFunc, AfterErgo) \ \ product_pd(intx, OptoLoopAlignment, \ From 9026f49dd238d16240687c4627e42c5dbee08773 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Wed, 11 Feb 2026 09:23:52 +0000 Subject: [PATCH 063/120] 8377446: Improve parameter naming in pointer_delta() Reviewed-by: ayang, chagedorn --- src/hotspot/share/adlc/adlArena.cpp | 6 ++--- .../share/utilities/globalDefinitions.hpp | 23 ++++++++++--------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/hotspot/share/adlc/adlArena.cpp b/src/hotspot/share/adlc/adlArena.cpp index ebd1f74911d..e3ae60e91a9 100644 --- a/src/hotspot/share/adlc/adlArena.cpp +++ b/src/hotspot/share/adlc/adlArena.cpp @@ -136,9 +136,9 @@ void *AdlArena::Acalloc( size_t items, size_t x ) { } //------------------------------realloc---------------------------------------- -static size_t pointer_delta(const void *left, const void *right) { - assert(left >= right, "pointer delta underflow"); - return (uintptr_t)left - (uintptr_t)right; +static size_t pointer_delta(const void* high, const void* low) { + assert(high >= low, "pointer delta underflow"); + return (uintptr_t)high - (uintptr_t)low; } // Reallocate storage in AdlArena. diff --git a/src/hotspot/share/utilities/globalDefinitions.hpp b/src/hotspot/share/utilities/globalDefinitions.hpp index 54602297759..ea4f6f99ae6 100644 --- a/src/hotspot/share/utilities/globalDefinitions.hpp +++ b/src/hotspot/share/utilities/globalDefinitions.hpp @@ -433,7 +433,8 @@ typedef unsigned char u_char; typedef u_char* address; typedef const u_char* const_address; -// Pointer subtraction. +// Pointer subtraction, calculating high - low. Asserts on underflow. +// // The idea here is to avoid ptrdiff_t, which is signed and so doesn't have // the range we might need to find differences from one end of the heap // to the other. @@ -444,28 +445,28 @@ typedef const u_char* const_address; // 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 volatile void* left, - const volatile void* right, +inline size_t pointer_delta(const volatile void* high, + const volatile void* low, size_t element_size) { - assert(left >= right, "avoid underflow - left: " PTR_FORMAT " right: " PTR_FORMAT, p2i(left), p2i(right)); - return (((uintptr_t) left) - ((uintptr_t) right)) / element_size; + assert(high >= low, "avoid underflow - high address: " PTR_FORMAT " low address: " PTR_FORMAT, p2i(high), p2i(low)); + return (((uintptr_t) high) - ((uintptr_t) low)) / 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)); +inline size_t pointer_delta(const HeapWord* high, const HeapWord* low) { + return pointer_delta(high, low, sizeof(HeapWord)); } // A version specialized for MetaWord*'s. -inline size_t pointer_delta(const MetaWord* left, const MetaWord* right) { - return pointer_delta(left, right, sizeof(MetaWord)); +inline size_t pointer_delta(const MetaWord* high, const MetaWord* low) { + return pointer_delta(high, low, sizeof(MetaWord)); } // pointer_delta_as_int is called to do pointer subtraction for nearby pointers that // returns a non-negative int, usually used as a size of a code buffer range. // This scales to sizeof(T). template -inline int pointer_delta_as_int(const volatile T* left, const volatile T* right) { - size_t delta = pointer_delta(left, right, sizeof(T)); +inline int pointer_delta_as_int(const volatile T* high, const volatile T* low) { + size_t delta = pointer_delta(high, low, sizeof(T)); assert(delta <= size_t(INT_MAX), "pointer delta out of range: %zu", delta); return static_cast(delta); } From e34291d8e11164ab3b6d0f6a3e8819bc29b32124 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Wed, 11 Feb 2026 09:24:18 +0000 Subject: [PATCH 064/120] 8377442: More fixes to ThreadLocalAllocBuffer after JDK-8377179 Reviewed-by: ayang, kbarrett, iwalulya --- src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp | 9 ++++++--- src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp | 8 +++++--- src/hotspot/share/runtime/thread.cpp | 2 +- src/hotspot/share/runtime/thread.hpp | 3 ++- src/hotspot/share/runtime/thread.inline.hpp | 2 +- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp index e86881d3523..d99544c0573 100644 --- a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp +++ b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp @@ -459,13 +459,16 @@ size_t ThreadLocalAllocBuffer::end_reserve() { } size_t ThreadLocalAllocBuffer::estimated_used_bytes() const { + // Data races due to unsynchronized access like the following reads to _start + // and _top are undefined behavior. Atomic would not provide any additional + // guarantees, so use AtomicAccess directly. HeapWord* start = AtomicAccess::load(&_start); HeapWord* top = AtomicAccess::load(&_top); - // There has been a race when retrieving _top and _start. Return 0. - if (_top < _start) { + // If there has been a race when retrieving _top and _start, return 0. + if (top < start) { return 0; } - size_t used_bytes = pointer_delta(_top, _start, 1); + size_t used_bytes = pointer_delta(top, start, 1); // Comparing diff with the maximum allowed size will ensure that we don't add // the used bytes from a semi-initialized TLAB ending up with implausible values. // In this case also just return 0. diff --git a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp index a50e7c9533c..61caac7ec51 100644 --- a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp +++ b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp @@ -32,8 +32,10 @@ class ThreadLocalAllocStats; -// ThreadLocalAllocBuffer: a descriptor for thread-local storage used by -// the threads for allocation. It is thread-private at any time. +// ThreadLocalAllocBuffer is a descriptor for thread-local storage used by +// mutator threads for local/private allocation. As a TLAB is thread-private, +// there is no concurrent/parallel access to its memory or its members, +// other than by estimated_used_bytes(). // // Heap sampling is performed via the end and allocation_end // fields. @@ -123,7 +125,7 @@ public: // Due to races with concurrent allocations and/or resetting the TLAB the return // value may be inconsistent with any other metrics (e.g. total allocated // bytes), and may just incorrectly return 0. - // Intented fo external inspection only where accuracy is not 100% required. + // Intended for external inspection only where accuracy is not 100% required. size_t estimated_used_bytes() const; // Allocate size HeapWords. The memory is NOT initialized to zero. diff --git a/src/hotspot/share/runtime/thread.cpp b/src/hotspot/share/runtime/thread.cpp index 355dc70ae39..f27d355f56e 100644 --- a/src/hotspot/share/runtime/thread.cpp +++ b/src/hotspot/share/runtime/thread.cpp @@ -485,7 +485,7 @@ void Thread::print_on(outputStream* st, bool print_extended_info) const { (double)_statistical_info.getElapsedTime() / 1000.0 ); if (is_Java_thread() && (PrintExtendedThreadInfo || print_extended_info)) { - size_t allocated_bytes = (size_t) const_cast(this)->cooked_allocated_bytes(); + size_t allocated_bytes = checked_cast(cooked_allocated_bytes()); st->print("allocated=%zu%s ", byte_size_in_proper_unit(allocated_bytes), proper_unit_for_byte_size(allocated_bytes) diff --git a/src/hotspot/share/runtime/thread.hpp b/src/hotspot/share/runtime/thread.hpp index dc09d4c68c2..0225fa808cb 100644 --- a/src/hotspot/share/runtime/thread.hpp +++ b/src/hotspot/share/runtime/thread.hpp @@ -405,13 +405,14 @@ class Thread: public ThreadShadow { // Thread-Local Allocation Buffer (TLAB) support ThreadLocalAllocBuffer& tlab() { return _tlab; } + const ThreadLocalAllocBuffer& tlab() const { return _tlab; } void initialize_tlab(); void retire_tlab(ThreadLocalAllocStats* stats = nullptr); void fill_tlab(HeapWord* start, size_t pre_reserved, size_t new_size); jlong allocated_bytes() { return _allocated_bytes; } void incr_allocated_bytes(jlong size) { _allocated_bytes += size; } - inline jlong cooked_allocated_bytes(); + inline jlong cooked_allocated_bytes() const; ThreadHeapSampler& heap_sampler() { return _heap_sampler; } diff --git a/src/hotspot/share/runtime/thread.inline.hpp b/src/hotspot/share/runtime/thread.inline.hpp index b194f5e2a7f..d2ac34c3e46 100644 --- a/src/hotspot/share/runtime/thread.inline.hpp +++ b/src/hotspot/share/runtime/thread.inline.hpp @@ -36,7 +36,7 @@ #include "runtime/os.hpp" #endif -inline jlong Thread::cooked_allocated_bytes() { +inline jlong Thread::cooked_allocated_bytes() const { jlong allocated_bytes = AtomicAccess::load_acquire(&_allocated_bytes); size_t used_bytes = 0; if (UseTLAB) { From 1bce8e47383cb1f89d7325ce6645f4bb195f91ba Mon Sep 17 00:00:00 2001 From: Afshin Zafari Date: Wed, 11 Feb 2026 09:30:55 +0000 Subject: [PATCH 065/120] 8366957: Amalloc may return null despite contrary AllocFailType Reviewed-by: jsjolen, dholmes, kbarrett --- src/hotspot/share/memory/arena.cpp | 5 ++++- test/hotspot/gtest/nmt/test_nmt_malloclimit.cpp | 14 +++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/hotspot/share/memory/arena.cpp b/src/hotspot/share/memory/arena.cpp index 2de3f837c00..75cd909b028 100644 --- a/src/hotspot/share/memory/arena.cpp +++ b/src/hotspot/share/memory/arena.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2026, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2019, 2023 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -330,6 +330,9 @@ void* Arena::grow(size_t x, AllocFailType alloc_failmode) { size_t len = MAX2(ARENA_ALIGN(x), (size_t) Chunk::size); if (MemTracker::check_exceeds_limit(x, _mem_tag)) { + if (alloc_failmode == AllocFailStrategy::EXIT_OOM) { + vm_exit_out_of_memory(x, OOM_MALLOC_ERROR, "MallocLimit in Arena::grow"); + } return nullptr; } diff --git a/test/hotspot/gtest/nmt/test_nmt_malloclimit.cpp b/test/hotspot/gtest/nmt/test_nmt_malloclimit.cpp index da357285148..48da390e06f 100644 --- a/test/hotspot/gtest/nmt/test_nmt_malloclimit.cpp +++ b/test/hotspot/gtest/nmt/test_nmt_malloclimit.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2023 SAP SE. All rights reserved. - * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved. * 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,6 +23,7 @@ */ #include "memory/allocation.hpp" +#include "memory/arena.hpp" #include "nmt/mallocLimit.hpp" #include "nmt/memTracker.hpp" #include "nmt/nmtCommon.hpp" @@ -155,3 +156,14 @@ TEST_VM_FATAL_ERROR_MSG(NMT, MallocLimitDeathTestOnStrDup, ".*MallocLimit: reach char* p = os::strdup("0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", mtTest); } } + +TEST_VM_FATAL_ERROR_MSG(NMT, MallocLimitDeathTestOnArenaGrow, ".*MallocLimit in Arena::grow.*") { + // We fake the correct assert if NMT is off to make the test pass (there is no way to execute a death test conditionally) + if (!MemTracker::enabled()) { + fatal("Fake message please ignore: MallocLimit in Arena::grow"); + } + // the real test + MallocLimitHandler::initialize("test:10m:oom"); + Arena ar(mtTest); + ar.Amalloc(10 * M, AllocFailStrategy::EXIT_OOM); +} From 6a5eb26dcf9e9dcf16e80b7c46f16a236a893aef Mon Sep 17 00:00:00 2001 From: Jaikiran Pai Date: Wed, 11 Feb 2026 11:03:03 +0000 Subject: [PATCH 066/120] 8377656: JUnit test java/util/zip/ZipFile/ZipFileInputStreamSkipTest.java uses private methods for BeforeAll/AfterAll Reviewed-by: cstein, alanb --- .../jdk/java/util/zip/ZipFile/ZipFileInputStreamSkipTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/jdk/java/util/zip/ZipFile/ZipFileInputStreamSkipTest.java b/test/jdk/java/util/zip/ZipFile/ZipFileInputStreamSkipTest.java index 131f7a5c51c..1b7b93785af 100644 --- a/test/jdk/java/util/zip/ZipFile/ZipFileInputStreamSkipTest.java +++ b/test/jdk/java/util/zip/ZipFile/ZipFileInputStreamSkipTest.java @@ -69,7 +69,7 @@ public class ZipFileInputStreamSkipTest { * @throws IOException If an error occurs creating the Zip Files */ @BeforeAll - private static void createZip() throws IOException { + static void createZip() throws IOException { Entry e0 = Entry.of("Entry-0", ZipEntry.STORED, "Tennis Pro"); Entry e1 = Entry.of("Entry-1", ZipEntry.STORED, "United States Tennis Association"); @@ -98,7 +98,7 @@ public class ZipFileInputStreamSkipTest { * @throws IOException If an error occurs during cleanup */ @AfterAll - private static void cleanUp() throws IOException { + static void cleanUp() throws IOException { Files.deleteIfExists(STORED_ZIPFILE); Files.deleteIfExists(DEFLATED_ZIPFILE); } From 0097db564319b6b0f50507f8c9598f124588e5f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Sj=C3=B6len?= Date: Wed, 11 Feb 2026 11:25:24 +0000 Subject: [PATCH 067/120] 8364655: Loading class with nested annotations causes stack overflow in VM Reviewed-by: dholmes, fbredberg --- .../share/classfile/classFileParser.cpp | 21 +++-- .../runtime/ClassFile/NestedAnnotations.java | 77 +++++++++++++++++++ 2 files changed, 91 insertions(+), 7 deletions(-) create mode 100644 test/hotspot/jtreg/runtime/ClassFile/NestedAnnotations.java diff --git a/src/hotspot/share/classfile/classFileParser.cpp b/src/hotspot/share/classfile/classFileParser.cpp index 817d0c64d11..c1f00cbe536 100644 --- a/src/hotspot/share/classfile/classFileParser.cpp +++ b/src/hotspot/share/classfile/classFileParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1017,7 +1017,8 @@ public: }; -static int skip_annotation_value(const u1*, int, int); // fwd decl +static int skip_annotation_value(const u1* buffer, int limit, int index, int recursion_depth); // fwd decl +static const int max_recursion_depth = 5; // Safely increment index by val if does not pass limit #define SAFE_ADD(index, limit, val) \ @@ -1025,23 +1026,29 @@ if (index >= limit - val) return limit; \ index += val; // Skip an annotation. Return >=limit if there is any problem. -static int skip_annotation(const u1* buffer, int limit, int index) { +static int skip_annotation(const u1* buffer, int limit, int index, int recursion_depth = 0) { assert(buffer != nullptr, "invariant"); + if (recursion_depth > max_recursion_depth) { + return limit; + } // annotation := atype:u2 do(nmem:u2) {member:u2 value} // value := switch (tag:u1) { ... } SAFE_ADD(index, limit, 4); // skip atype and read nmem int nmem = Bytes::get_Java_u2((address)buffer + index - 2); while (--nmem >= 0 && index < limit) { SAFE_ADD(index, limit, 2); // skip member - index = skip_annotation_value(buffer, limit, index); + index = skip_annotation_value(buffer, limit, index, recursion_depth + 1); } return index; } // Skip an annotation value. Return >=limit if there is any problem. -static int skip_annotation_value(const u1* buffer, int limit, int index) { +static int skip_annotation_value(const u1* buffer, int limit, int index, int recursion_depth) { assert(buffer != nullptr, "invariant"); + if (recursion_depth > max_recursion_depth) { + return limit; + } // value := switch (tag:u1) { // case B, C, I, S, Z, D, F, J, c: con:u2; // case e: e_class:u2 e_name:u2; @@ -1073,12 +1080,12 @@ static int skip_annotation_value(const u1* buffer, int limit, int index) { SAFE_ADD(index, limit, 2); // read nval int nval = Bytes::get_Java_u2((address)buffer + index - 2); while (--nval >= 0 && index < limit) { - index = skip_annotation_value(buffer, limit, index); + index = skip_annotation_value(buffer, limit, index, recursion_depth + 1); } } break; case '@': - index = skip_annotation(buffer, limit, index); + index = skip_annotation(buffer, limit, index, recursion_depth + 1); break; default: return limit; // bad tag byte diff --git a/test/hotspot/jtreg/runtime/ClassFile/NestedAnnotations.java b/test/hotspot/jtreg/runtime/ClassFile/NestedAnnotations.java new file mode 100644 index 00000000000..e523c2ed736 --- /dev/null +++ b/test/hotspot/jtreg/runtime/ClassFile/NestedAnnotations.java @@ -0,0 +1,77 @@ + /* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * 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 NestedAnnotations + * @summary The JVM handles nested annotations + * @bug 8364655 + * @requires vm.flagless + * @library /test/lib + * @library /testlibrary/asm + * @modules java.base/jdk.internal.misc + * java.desktop + * java.management + * @run driver NestedAnnotations + */ + +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; + +import org.objectweb.asm.AnnotationVisitor; +import org.objectweb.asm.ClassWriter; + +import java.lang.invoke.MethodHandles; +import java.util.ArrayList; + +import static org.objectweb.asm.Opcodes.*; + +public class NestedAnnotations { + static void test() throws Exception { + var cw = new ClassWriter(0); + cw.visit(V17, 0, "Annotations", null, "java/lang/Object", null); + final int number_of_annotations = 65535; + var av = cw.visitAnnotation("LTest;", true); + var stack = new ArrayList(number_of_annotations + 1); + stack.add(av); + for (int i = 0; i < number_of_annotations; i++) { + stack.add(av = av.visitAnnotation("value", "LTest;")); + } + for (int i = number_of_annotations; i != 0;) { + stack.get(--i).visitEnd(); + } + + cw.visitEnd(); + // Does not matter whether the class is hidden, used for simplicity's sake. + MethodHandles.lookup().defineHiddenClass(cw.toByteArray(), true); + } + + public static void main(String[] args) throws Exception { + if (args.length == 1 && args[0].equals("testIt")) { + test(); + } else { + OutputAnalyzer oa = ProcessTools.executeTestJava("NestedAnnotations", "testIt"); + oa.shouldHaveExitValue(0); + } + } +} + From a532e509ed60f6e8bfd66cdc6973f4d9042bb056 Mon Sep 17 00:00:00 2001 From: Yasumasa Suenaga Date: Wed, 11 Feb 2026 12:04:19 +0000 Subject: [PATCH 068/120] 8377395: serviceability/sa/TestJhsdbJstackMixedCore.java fails due to NPE because "because "this.cfa" is null" Reviewed-by: cjplummer, kevinw --- .../linux/native/libsaproc/libproc_impl.c | 7 +++---- test/hotspot/jtreg/ProblemList.txt | 1 - .../jtreg/serviceability/sa/TestJhsdbJstackMixedCore.java | 4 ++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.c b/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.c index 74563aa0d6c..e2681be73fe 100644 --- a/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.c +++ b/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -187,9 +187,8 @@ static bool fill_addr_info(lib_info* lib) { lib->exec_end = (uintptr_t)-1L; for (ph = phbuf, cnt = 0; cnt < ehdr.e_phnum; cnt++, ph++) { if (ph->p_type == PT_LOAD) { - uintptr_t unaligned_start = lib->base + ph->p_vaddr; - uintptr_t aligned_start = align_down(unaligned_start, ph->p_align); - uintptr_t aligned_end = align_up(unaligned_start + ph->p_memsz, ph->p_align); + uintptr_t aligned_start = lib->base + align_down(ph->p_vaddr, ph->p_align); + uintptr_t aligned_end = aligned_start + align_up(ph->p_memsz, ph->p_align); if ((lib->end == (uintptr_t)-1L) || (lib->end < aligned_end)) { lib->end = aligned_end; } diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index 147d1ce2d78..3e4814180f6 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -140,7 +140,6 @@ serviceability/sa/TestJmapCore.java 8318754 macosx-aarch64 serviceability/sa/TestJmapCoreMetaspace.java 8318754 macosx-aarch64 serviceability/sa/ClhsdbThreadContext.java 8356704 windows-x64 -serviceability/sa/TestJhsdbJstackMixedCore.java 8377395 linux-x64 serviceability/jvmti/stress/StackTrace/NotSuspended/GetStackTraceNotSuspendedStressTest.java 8315980 linux-all,windows-x64 diff --git a/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixedCore.java b/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixedCore.java index d781e8c5c09..84a62eb65e5 100644 --- a/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixedCore.java +++ b/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixedCore.java @@ -37,7 +37,7 @@ import jtreg.SkippedException; /** * @test - * @bug 8374482 8376264 8376284 + * @bug 8374482 8376264 8376284 8377395 * @requires (os.family == "linux") & (vm.hasSA) * @requires os.arch == "amd64" * @library /test/lib @@ -66,7 +66,7 @@ public class TestJhsdbJstackMixedCore { out.shouldContain("__restore_rt "); out.shouldContain("Java_jdk_test_lib_apps_LingeredApp_crash"); - out.shouldContain("* jdk.test.lib.apps.LingeredApp.crash()"); + out.shouldContain("jdk.test.lib.apps.LingeredApp.crash()"); } public static void main(String... args) throws Throwable { From a8a88d79927b8c4704f5b7aa3948f13812fd87c3 Mon Sep 17 00:00:00 2001 From: Yasumasa Suenaga Date: Wed, 11 Feb 2026 14:11:51 +0000 Subject: [PATCH 069/120] 8374469: Mixed jstack does not work on Windows Reviewed-by: cjplummer, kevinw --- .../debugger/windbg/WindbgCDebugger.java | 28 +++++- .../debugger/windbg/WindbgDebugger.java | 6 +- .../debugger/windbg/WindbgDebuggerLocal.java | 9 +- .../windows/amd64/WindowsAMD64CFrame.java | 87 ++++++++++++++----- .../windows/native/libsaproc/sawindbg.cpp | 39 ++++++++- .../sa/TestJhsdbJstackMixed.java | 11 ++- 6 files changed, 150 insertions(+), 30 deletions(-) diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgCDebugger.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgCDebugger.java index 64bdb8c1c72..04f374de80e 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgCDebugger.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgCDebugger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2026, Oracle and/or its affiliates. All rights reserved. * 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,7 @@ import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.debugger.cdbg.*; import sun.jvm.hotspot.debugger.amd64.*; import sun.jvm.hotspot.debugger.windows.amd64.*; +import sun.jvm.hotspot.runtime.*; import sun.jvm.hotspot.utilities.AddressOps; class WindbgCDebugger implements CDebugger { @@ -66,14 +67,35 @@ class WindbgCDebugger implements CDebugger { return null; } + private JavaThread mapThreadProxyToJavaThread(ThreadProxy thread) { + var threads = VM.getVM().getThreads(); + for (int i = 0; i < threads.getNumberOfThreads(); i++) { + var jt = threads.getJavaThreadAt(i); + if (thread.equals(jt.getThreadProxy())) { + return jt; + } + } + + // not found + return null; + } + public CFrame topFrameForThread(ThreadProxy thread) throws DebuggerException { if (dbg.getCPU().equals("amd64")) { AMD64ThreadContext context = (AMD64ThreadContext) thread.getContext(); + + // rbp is not needed null check because it could be used as GPR by compiler (cl.exe) option. Address rbp = context.getRegisterAsAddress(AMD64ThreadContext.RBP); - if (rbp == null) return null; + + Address rsp = context.getRegisterAsAddress(AMD64ThreadContext.RSP); + if (rsp == null) return null; Address pc = context.getRegisterAsAddress(AMD64ThreadContext.RIP); if (pc == null) return null; - return new WindowsAMD64CFrame(dbg, rbp, pc); + + // get JavaThread as the owner from ThreadProxy + JavaThread ownerThread = mapThreadProxyToJavaThread(thread); + + return new WindowsAMD64CFrame(dbg, ownerThread, rsp, rbp, pc); } else { // unsupported CPU! return null; diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebugger.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebugger.java index 46edb2f55b2..82dc28515d3 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebugger.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebugger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -85,4 +85,8 @@ public interface WindbgDebugger extends JVMDebugger { // public ThreadProxy getThreadForIdentifierAddress(Address addr); public int getAddressSize(); + + public static record SenderRegs(Address nextSP, Address nextFP, Address nextPC) {}; + + public SenderRegs getSenderRegs(Address sp, Address fp, Address pc); } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java index 9ed05b31319..4864b94fd86 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -229,6 +229,12 @@ public class WindbgDebuggerLocal extends DebuggerBase implements WindbgDebugger return lookupByAddress0(address); } + public synchronized SenderRegs getSenderRegs(Address sp, Address fp, Address pc) { + // sp and pc should not be null, but fp might be null because it could be used as GPR. + long[] rawSenderRegs = getSenderRegs0(sp.asLongValue(), fp == null ? 0L : fp.asLongValue(), pc.asLongValue()); + return rawSenderRegs == null ? null : new SenderRegs(newAddress(rawSenderRegs[0]), newAddress(rawSenderRegs[1]), newAddress(rawSenderRegs[2])); + } + /** From the Debugger interface */ public MachineDescription getMachineDescription() { return machDesc; @@ -644,6 +650,7 @@ public class WindbgDebuggerLocal extends DebuggerBase implements WindbgDebugger private native String consoleExecuteCommand0(String cmd); private native long lookupByName0(String objName, String symName); private native ClosestSymbol lookupByAddress0(long address); + private native long[] getSenderRegs0(long sp, long fp, long pc); // helper called lookupByAddress0 private ClosestSymbol createClosestSymbol(String symbol, long diff) { diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windows/amd64/WindowsAMD64CFrame.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windows/amd64/WindowsAMD64CFrame.java index 69ad04da51b..b004a84fff4 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windows/amd64/WindowsAMD64CFrame.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windows/amd64/WindowsAMD64CFrame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved. * 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,43 +29,74 @@ import sun.jvm.hotspot.debugger.amd64.*; import sun.jvm.hotspot.debugger.cdbg.*; import sun.jvm.hotspot.debugger.cdbg.basic.*; import sun.jvm.hotspot.debugger.windbg.*; +import sun.jvm.hotspot.runtime.*; +import sun.jvm.hotspot.runtime.amd64.*; public class WindowsAMD64CFrame extends BasicCFrame { + private JavaThread ownerThread; + private Address rsp; private Address rbp; private Address pc; - private static final int ADDRESS_SIZE = 8; - /** Constructor for topmost frame */ - public WindowsAMD64CFrame(WindbgDebugger dbg, Address rbp, Address pc) { + public WindowsAMD64CFrame(WindbgDebugger dbg, JavaThread ownerThread, Address rsp, Address rbp, Address pc) { super(dbg.getCDebugger()); + this.ownerThread = ownerThread; + this.rsp = rsp; this.rbp = rbp; this.pc = pc; this.dbg = dbg; } + @Override public CFrame sender(ThreadProxy thread) { - AMD64ThreadContext context = (AMD64ThreadContext) thread.getContext(); - Address rsp = context.getRegisterAsAddress(AMD64ThreadContext.RSP); + return sender(thread, null, null, null); + } - if ( (rbp == null) || rbp.lessThan(rsp) ) { - return null; - } + @Override + public CFrame sender(ThreadProxy th, Address nextSP, Address nextFP, Address nextPC) { + if (nextSP == null && nextPC == null) { + // GetStackTrace() by Windows Debug API would unwind frame with given SP, FP, and PC. + // However it would not work for dynamic generated code like CodeBlob because + // HotSpot would not register unwind info like RtlAddFunctionTable(). + // Thus SA should check whether current PC is in CodeCache at first when nextPC is null. + var cb = VM.getVM().getCodeCache().findBlob(pc); + if (cb != null) { + if (cb.getFrameSize() > 0) { + nextSP = rsp.addOffsetTo(cb.getFrameSize()); + nextPC = nextSP.getAddressAt(-1 * VM.getVM().getAddressSize()); - // Check alignment of rbp - if ( dbg.getAddressValue(rbp) % ADDRESS_SIZE != 0) { + // Set nextFP to null when PreserveFramePointer is disabled because We could not find out + // frame pointer of sender frame - it might be omitted. + nextFP = VM.getVM().getCommandLineBooleanFlag("PreserveFramePointer") ? rsp.getAddressAt(0) : null; + } else { + // Use Frame (AMD64Frame) to access slots on stack. + var frame = toFrame(); + nextSP = frame.getSenderSP(); + nextPC = frame.getSenderPC(); + nextFP = frame.getLink(); + } + return new WindowsAMD64CFrame(dbg, ownerThread, nextSP, nextFP, nextPC); + } + + WindbgDebugger.SenderRegs senderRegs = dbg.getSenderRegs(rsp, rbp, pc); + if (senderRegs == null) { return null; - } + } - Address nextRBP = rbp.getAddressAt( 0 * ADDRESS_SIZE); - if (nextRBP == null || nextRBP.lessThanOrEqual(rbp)) { - return null; + if (senderRegs.nextSP() == null || senderRegs.nextSP().lessThanOrEqual(rsp)) { + return null; + } + nextSP = senderRegs.nextSP(); + + if (senderRegs.nextPC() == null) { + return null; + } + nextPC = senderRegs.nextPC(); + + nextFP = senderRegs.nextFP(); } - Address nextPC = rbp.getAddressAt( 1 * ADDRESS_SIZE); - if (nextPC == null) { - return null; - } - return new WindowsAMD64CFrame(dbg, nextRBP, nextPC); + return new WindowsAMD64CFrame(dbg, ownerThread, nextSP, nextFP, nextPC); } public Address pc() { @@ -76,5 +107,21 @@ public class WindowsAMD64CFrame extends BasicCFrame { return rbp; } + @Override + public Frame toFrame() { + // Find the top of JavaVFrame related to this CFrame. The Windows GetStackTrace DbgHelp API + // cannot get FP for java frames. + for (JavaVFrame vf = ownerThread.getLastJavaVFrameDbg(); vf != null; vf = vf.javaSender()) { + Frame f = vf.getFrame(); + if (f.getSP().equals(rsp) && f.getPC().equals(pc)) { + return f; + } else if (f.getSP().greaterThanOrEqual(rsp)) { + return f; + } + } + + return new AMD64Frame(rsp, localVariableBase(), pc); + } + private WindbgDebugger dbg; } diff --git a/src/jdk.hotspot.agent/windows/native/libsaproc/sawindbg.cpp b/src/jdk.hotspot.agent/windows/native/libsaproc/sawindbg.cpp index f2994c0d827..0c16400bf3b 100644 --- a/src/jdk.hotspot.agent/windows/native/libsaproc/sawindbg.cpp +++ b/src/jdk.hotspot.agent/windows/native/libsaproc/sawindbg.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -906,3 +906,40 @@ JNIEXPORT jobject JNICALL Java_sun_jvm_hotspot_debugger_windbg_WindbgDebuggerLoc CHECK_EXCEPTION_(0); return res; } + +/* + * Class: sun_jvm_hotspot_debugger_windbg_WindbgDebuggerLocal + * Method: getSenderRegs0 + * Signature: (JJJ)[J + */ +JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debugger_windbg_WindbgDebuggerLocal_getSenderRegs0 + (JNIEnv *env, jobject obj, jlong sp, jlong fp, jlong pc) { + IDebugControl* ptrIDebugControl = (IDebugControl*)env->GetLongField(obj, ptrIDebugControl_ID); + CHECK_EXCEPTION_(nullptr); + + // GetStackTrace() returns call frames from specified fp, sp, and pc. + // The top of frame would point current frame, hence we refer 2nd frame + // as a sender and get registers from it. + DEBUG_STACK_FRAME frames[2]; + ULONG filled; + HRESULT dbg_result = ptrIDebugControl->GetStackTrace(fp, sp, pc, frames, 2, &filled); + if (dbg_result != S_OK || filled != 2) { + return nullptr; + } + + jlongArray result = env->NewLongArray(3); + CHECK_EXCEPTION_(nullptr); + if (result == nullptr) { + return nullptr; + } + + jlong regs[] = { + static_cast(frames[1].StackOffset), + static_cast(frames[1].FrameOffset), + static_cast(frames[1].InstructionOffset) + }; + env->SetLongArrayRegion(result, 0, 3, regs); + CHECK_EXCEPTION_(nullptr); + + return result; +} diff --git a/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixed.java b/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixed.java index b02d3f3aef3..42ff12e519d 100644 --- a/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixed.java +++ b/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixed.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * 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,8 +35,8 @@ import jdk.test.lib.process.OutputAnalyzer; /** * @test * @key randomness - * @bug 8208091 - * @requires (os.family == "linux") & (vm.hasSA) + * @bug 8208091 8374469 + * @requires (os.family == "linux" | os.family == "windows") & (vm.hasSA) * @requires (os.arch != "riscv64" | !(vm.cpu.features ~= ".*qemu.*")) * @library /test/lib * @run driver TestJhsdbJstackMixed @@ -50,8 +50,11 @@ public class TestJhsdbJstackMixed { private static final Pattern LINE_PATTERN = Pattern .compile(LINE_MATCHER_STR); private static final String HEX_STR_PATTERN = "0x([a-fA-F0-9]+)"; - private static final String FIB_SPLIT_PATTERN = NATIVE_FUNCTION_NAME + + // On windows the native symbol will be prefixed with "NoFramePointer!" + private static final String FIB_SPLIT_PATTERN = "(NoFramePointer!)?" + NATIVE_FUNCTION_NAME + "\\s+\\+"; + private static final Pattern HEX_PATTERN = Pattern.compile(HEX_STR_PATTERN); private static final int ADDRESS_ALIGNMENT_X86 = 4; From b3fc013b4f8171c8ee735d6fdcad696ae6e431ee Mon Sep 17 00:00:00 2001 From: Albert Mingkun Yang Date: Wed, 11 Feb 2026 14:24:13 +0000 Subject: [PATCH 070/120] 8377143: Parallel: Remove special treatment in JstatGcCapacityResults.java Reviewed-by: kevinw, tschatzl --- .../jstat/utils/JstatGcCapacityResults.java | 36 +++---------------- 1 file changed, 5 insertions(+), 31 deletions(-) diff --git a/test/hotspot/jtreg/serviceability/tmtools/jstat/utils/JstatGcCapacityResults.java b/test/hotspot/jtreg/serviceability/tmtools/jstat/utils/JstatGcCapacityResults.java index cee7bebbd50..9f5355bcdbc 100644 --- a/test/hotspot/jtreg/serviceability/tmtools/jstat/utils/JstatGcCapacityResults.java +++ b/test/hotspot/jtreg/serviceability/tmtools/jstat/utils/JstatGcCapacityResults.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -88,18 +88,11 @@ public class JstatGcCapacityResults extends JstatResults { assertThat(EC <= NGC, "EC > NGC (eden space capacity > new generation capacity)"); // Verify relative size of NGC and S0C + S1C + EC. - // The rule depends on if the tenured GC is parallel or not. - // For parallell GC: NGC >= S0C + S1C + EC - // For non-parallell GC: NGC == S0C + S1C + EC - boolean isTenuredParallelGC = isTenuredParallelGC(); + // NGC == S0C + S1C + EC String errMsg = String.format( - "NGC %s (S0C + S1C + EC) (NGC = %.1f, S0C = %.1f, S1C = %.1f, EC = %.1f, (S0C + S1C + EC) = %.1f)", - isTenuredParallelGC ? "<" : "!=", NGC, S0C, S1C, EC, S0C + S1C + EC); - if (isTenuredParallelGC) { - assertThat(NGC >= S0C + S1C + EC, errMsg); - } else { - assertThat(checkFloatIsSum(NGC, S0C, S1C, EC), errMsg); - } + "NGC != (S0C + S1C + EC) (NGC = %.1f, S0C = %.1f, S1C = %.1f, EC = %.1f, (S0C + S1C + EC) = %.1f)", + NGC, S0C, S1C, EC, S0C + S1C + EC); + assertThat(checkFloatIsSum(NGC, S0C, S1C, EC), errMsg); // Check Old Gen consistency float OGCMN = getFloatValue("OGCMN"); @@ -121,23 +114,4 @@ public class JstatGcCapacityResults extends JstatResults { assertThat(MC >= MCMN, "MC < MCMN (generation capacity < min generation capacity)"); assertThat(MC <= MCMX, "MGC > MCMX (generation capacity > max generation capacity)"); } - - /** - * Check if the tenured generation are currently using a parallel GC. - */ - protected static boolean isTenuredParallelGC() { - // Currently the only parallel GC for the tenured generation is PS MarkSweep. - List parallelGCs = Arrays.asList(new String[] { "PS MarkSweep"}); - try { - List beans = ManagementFactory.getGarbageCollectorMXBeans(); - for (GarbageCollectorMXBean bean : beans) { - if (parallelGCs.contains(bean.getName())) { - return true; - } - } - } catch (Exception e) { - e.printStackTrace(); - } - return false; - } } From b98899b441222ce9cd6a2a74e86193c091e088e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eirik=20Bj=C3=B8rsn=C3=B8s?= Date: Wed, 11 Feb 2026 16:43:36 +0000 Subject: [PATCH 071/120] 8377461: Add ZipFile test for incorrect number of entries reported in ENDTOT Reviewed-by: lancea --- .../util/zip/ZipFile/IncorrectEndTot.java | 117 ++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 test/jdk/java/util/zip/ZipFile/IncorrectEndTot.java diff --git a/test/jdk/java/util/zip/ZipFile/IncorrectEndTot.java b/test/jdk/java/util/zip/ZipFile/IncorrectEndTot.java new file mode 100644 index 00000000000..0b6fc4a35fd --- /dev/null +++ b/test/jdk/java/util/zip/ZipFile/IncorrectEndTot.java @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* @test + * @summary Verify that ZipFile::size reports the actual number of entries + * even with an incorrect ENDTOT field + * @run junit IncorrectEndTot + */ + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.file.Files; +import java.util.Collections; +import java.util.stream.Stream; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; +import java.util.zip.ZipOutputStream; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class IncorrectEndTot { + + // File to use for this test + File file = new File("incorrect-end-centot.zip"); + + // Return scenarios for correct and incorrect ENDTOT fields + public static Stream scenarios() { + return Stream.of( + Arguments.of(10, 10), // CEN agrees with ENDTOT + Arguments.of(10, 11), // CEN has one less than ENDTOT + Arguments.of(11, 10), // CEN has one more than ENDTOT + Arguments.of(0, 0), // Empty ZIP, correct ENDTOT + Arguments.of(0, 10) // Empty ZIP, incorrect ENDTOT + ); + } + + /** + * Delete the file used by this test + */ + @AfterEach + public void cleanup() { + file.delete(); + } + + /** + * Verify that ZipFile::size reports the actual number of CEN records, + * regardless of the ENDTOT field. + * + * @param actual number of entries in the ZIP file + * @param reported number reported in ENDTOT + * @throws IOException if an unexpected error occurs + */ + @ParameterizedTest + @MethodSource("scenarios") + public void shouldCountActualEntries(int actual, int reported) throws IOException { + createZip(file, actual, reported); + try (ZipFile zf = new ZipFile(file)) { + assertEquals(actual, zf.size()); + assertEquals(actual, Collections.list(zf.entries()).size()); + assertEquals(actual, zf.stream().count()); + } + } + + /** + * Create a ZIP file with a number of entries, possibly reporting an incorrect number in + * the ENDTOT field + * @param file the file to write to + * @param numEntries the number of entries to generate + * @param reported the number of entries to report in the END header's ENDTOT field + * @throws IOException + */ + private static void createZip(File file, int numEntries, int reported) throws IOException { + // Create a ZIP + ByteArrayOutputStream out = new ByteArrayOutputStream(); + try (ZipOutputStream zo = new ZipOutputStream(out)) { + for (int i = 0; i < numEntries; i++) { + zo.putNextEntry(new ZipEntry("entry_" + i)); + } + } + byte[] bytes = out.toByteArray(); + + // Update the ENDTOT field to report a possibly incorrect number + ByteBuffer buf = ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN); + buf.putShort(bytes.length - ZipFile.ENDHDR + ZipFile.ENDTOT, (short) reported); + + // Write to disk + Files.write(file.toPath(), bytes); + } +} From 708970a1a6f9c05f21d15918066a07d7f896a04a Mon Sep 17 00:00:00 2001 From: Ben Taylor Date: Wed, 11 Feb 2026 16:58:21 +0000 Subject: [PATCH 072/120] 8377045: Shenandoah: Convert ShenandoahLock related code to use Atomic Reviewed-by: wkemper, xpeng --- .../share/gc/shenandoah/shenandoahLock.cpp | 13 +++++----- .../share/gc/shenandoah/shenandoahLock.hpp | 25 ++++++++++--------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/hotspot/share/gc/shenandoah/shenandoahLock.cpp b/src/hotspot/share/gc/shenandoah/shenandoahLock.cpp index 7a3b33f5fd0..7eec0b9af64 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahLock.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahLock.cpp @@ -24,7 +24,6 @@ #include "gc/shenandoah/shenandoahLock.hpp" -#include "runtime/atomicAccess.hpp" #include "runtime/interfaceSupport.inline.hpp" #include "runtime/javaThread.hpp" #include "runtime/os.hpp" @@ -46,8 +45,8 @@ void ShenandoahLock::contended_lock_internal(JavaThread* java_thread) { int ctr = os::is_MP() ? 0xFF : 0; int yields = 0; // Apply TTAS to avoid more expensive CAS calls if the lock is still held by other thread. - while (AtomicAccess::load(&_state) == locked || - AtomicAccess::cmpxchg(&_state, unlocked, locked) != unlocked) { + while (_state.load_relaxed() == locked || + _state.compare_exchange(unlocked, locked) != unlocked) { if (ctr > 0 && !SafepointSynchronize::is_synchronizing()) { // Lightly contended, spin a little if no safepoint is pending. SpinPause(); @@ -113,11 +112,11 @@ ShenandoahReentrantLock::~ShenandoahReentrantLock() { void ShenandoahReentrantLock::lock() { Thread* const thread = Thread::current(); - Thread* const owner = AtomicAccess::load(&_owner); + Thread* const owner = _owner.load_relaxed(); if (owner != thread) { ShenandoahSimpleLock::lock(); - AtomicAccess::store(&_owner, thread); + _owner.store_relaxed(thread); } _count++; @@ -130,13 +129,13 @@ void ShenandoahReentrantLock::unlock() { _count--; if (_count == 0) { - AtomicAccess::store(&_owner, (Thread*)nullptr); + _owner.store_relaxed((Thread*)nullptr); ShenandoahSimpleLock::unlock(); } } bool ShenandoahReentrantLock::owned_by_self() const { Thread* const thread = Thread::current(); - Thread* const owner = AtomicAccess::load(&_owner); + Thread* const owner = _owner.load_relaxed(); return owner == thread; } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahLock.hpp b/src/hotspot/share/gc/shenandoah/shenandoahLock.hpp index fbdf4971354..2e44810cd5d 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahLock.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahLock.hpp @@ -27,6 +27,7 @@ #include "gc/shenandoah/shenandoahPadding.hpp" #include "memory/allocation.hpp" +#include "runtime/atomic.hpp" #include "runtime/javaThread.hpp" #include "runtime/safepoint.hpp" @@ -35,9 +36,9 @@ private: enum LockState { unlocked = 0, locked = 1 }; shenandoah_padding(0); - volatile LockState _state; + Atomic _state; shenandoah_padding(1); - Thread* volatile _owner; + Atomic _owner; shenandoah_padding(2); template @@ -48,33 +49,33 @@ public: ShenandoahLock() : _state(unlocked), _owner(nullptr) {}; void lock(bool allow_block_for_safepoint) { - assert(AtomicAccess::load(&_owner) != Thread::current(), "reentrant locking attempt, would deadlock"); + assert(_owner.load_relaxed() != Thread::current(), "reentrant locking attempt, would deadlock"); if ((allow_block_for_safepoint && SafepointSynchronize::is_synchronizing()) || - (AtomicAccess::cmpxchg(&_state, unlocked, locked) != unlocked)) { + (_state.compare_exchange(unlocked, locked) != unlocked)) { // 1. Java thread, and there is a pending safepoint. Dive into contended locking // immediately without trying anything else, and block. // 2. Fast lock fails, dive into contended lock handling. contended_lock(allow_block_for_safepoint); } - assert(AtomicAccess::load(&_state) == locked, "must be locked"); - assert(AtomicAccess::load(&_owner) == nullptr, "must not be owned"); - DEBUG_ONLY(AtomicAccess::store(&_owner, Thread::current());) + assert(_state.load_relaxed() == locked, "must be locked"); + assert(_owner.load_relaxed() == nullptr, "must not be owned"); + DEBUG_ONLY(_owner.store_relaxed(Thread::current());) } void unlock() { - assert(AtomicAccess::load(&_owner) == Thread::current(), "sanity"); - DEBUG_ONLY(AtomicAccess::store(&_owner, (Thread*)nullptr);) + assert(_owner.load_relaxed() == Thread::current(), "sanity"); + DEBUG_ONLY(_owner.store_relaxed((Thread*)nullptr);) OrderAccess::fence(); - AtomicAccess::store(&_state, unlocked); + _state.store_relaxed(unlocked); } void contended_lock(bool allow_block_for_safepoint); bool owned_by_self() { #ifdef ASSERT - return _state == locked && _owner == Thread::current(); + return _state.load_relaxed() == locked && _owner.load_relaxed() == Thread::current(); #else ShouldNotReachHere(); return false; @@ -111,7 +112,7 @@ public: class ShenandoahReentrantLock : public ShenandoahSimpleLock { private: - Thread* volatile _owner; + Atomic _owner; uint64_t _count; public: From 39a1d1c801a9cbf8d21051a9af7f6279873ae260 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Wed, 11 Feb 2026 19:23:03 +0000 Subject: [PATCH 073/120] 8376998: [macOS] Remove AppContext from AppEventHandler Reviewed-by: serb, dnguyen --- .../com/apple/eawt/_AppEventHandler.java | 58 +++++-------------- .../share/classes/sun/awt/SunToolkit.java | 6 +- 2 files changed, 19 insertions(+), 45 deletions(-) diff --git a/src/java.desktop/macosx/classes/com/apple/eawt/_AppEventHandler.java b/src/java.desktop/macosx/classes/com/apple/eawt/_AppEventHandler.java index d1b747a8f30..418cace016e 100644 --- a/src/java.desktop/macosx/classes/com/apple/eawt/_AppEventHandler.java +++ b/src/java.desktop/macosx/classes/com/apple/eawt/_AppEventHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -59,11 +59,10 @@ import java.io.File; import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; -import java.util.IdentityHashMap; +import java.util.HashSet; import java.util.LinkedList; import java.util.List; -import java.util.Map; -import sun.awt.AppContext; +import java.util.Set; import sun.awt.SunToolkit; final class _AppEventHandler { @@ -480,26 +479,22 @@ final class _AppEventHandler { } abstract static class _AppEventMultiplexor { - private final Map listenerToAppContext = - new IdentityHashMap(); + private final Set listeners = new HashSet(); boolean nativeListenerRegistered; // called from AppKit Thread-0 void dispatch(final _NativeEvent event, final Object... args) { - // grab a local ref to the listeners and its contexts as an array of the map's entries - final ArrayList> localEntries; + // grab a local ref to the listeners as an array + final ArrayList localList; synchronized (this) { - if (listenerToAppContext.size() == 0) { + if (listeners.size() == 0) { return; } - localEntries = new ArrayList>(listenerToAppContext.size()); - localEntries.addAll(listenerToAppContext.entrySet()); + localList = new ArrayList(listeners.size()); + localList.addAll(listeners); } - - for (final Map.Entry e : localEntries) { - final L listener = e.getKey(); - final AppContext listenerContext = e.getValue(); - SunToolkit.invokeLaterOnAppContext(listenerContext, new Runnable() { + for (final L listener : localList) { + SunToolkit.invokeLater(new Runnable() { public void run() { performOnListener(listener, event); } @@ -508,7 +503,7 @@ final class _AppEventHandler { } synchronized void addListener(final L listener) { - setListenerContext(listener, AppContext.getAppContext()); + listeners.add(listener); if (!nativeListenerRegistered) { registerNativeListener(); @@ -517,19 +512,11 @@ final class _AppEventHandler { } synchronized void removeListener(final L listener) { - listenerToAppContext.remove(listener); + listeners.remove(listener); } abstract void performOnListener(L listener, final _NativeEvent event); void registerNativeListener() { } - - private void setListenerContext(L listener, AppContext listenerContext) { - if (listenerContext == null) { - throw new RuntimeException( - "Attempting to add a listener from a thread group without AppContext"); - } - listenerToAppContext.put(listener, AppContext.getAppContext()); - } } abstract static class _BooleanAppEventMultiplexor extends _AppEventMultiplexor { @@ -561,22 +548,19 @@ final class _AppEventHandler { */ abstract static class _AppEventDispatcher { H _handler; - AppContext handlerContext; // called from AppKit Thread-0 void dispatch(final _NativeEvent event) { // grab a local ref to the handler final H localHandler; - final AppContext localHandlerContext; synchronized (_AppEventDispatcher.this) { localHandler = _handler; - localHandlerContext = handlerContext; } if (localHandler == null) { performDefaultAction(event); } else { - SunToolkit.invokeLaterOnAppContext(localHandlerContext, new Runnable() { + SunToolkit.invokeLater(new Runnable() { public void run() { performUsing(localHandler, event); } @@ -586,22 +570,10 @@ final class _AppEventHandler { synchronized void setHandler(final H handler) { this._handler = handler; - - setHandlerContext(AppContext.getAppContext()); - } void performDefaultAction(final _NativeEvent event) { } // by default, do nothing abstract void performUsing(final H handler, final _NativeEvent event); - - protected void setHandlerContext(AppContext ctx) { - if (ctx == null) { - throw new RuntimeException( - "Attempting to set a handler from a thread group without AppContext"); - } - - handlerContext = ctx; - } } abstract static class _QueuingAppEventDispatcher extends _AppEventDispatcher { @@ -624,8 +596,6 @@ final class _AppEventHandler { synchronized void setHandler(final H handler) { this._handler = handler; - setHandlerContext(AppContext.getAppContext()); - // dispatch any events in the queue if (queuedEvents != null) { // grab a local ref to the queue, so the real one can be nulled out diff --git a/src/java.desktop/share/classes/sun/awt/SunToolkit.java b/src/java.desktop/share/classes/sun/awt/SunToolkit.java index 1f92189a62f..51353c7d937 100644 --- a/src/java.desktop/share/classes/sun/awt/SunToolkit.java +++ b/src/java.desktop/share/classes/sun/awt/SunToolkit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -538,6 +538,10 @@ public abstract class SunToolkit extends Toolkit postEvent(targetToAppContext(peerEvent.getSource()), peerEvent); } + public static void invokeLater(Runnable dispatcher) { + invokeLaterOnAppContext(AppContext.getAppContext(), dispatcher); + } + /* * Execute a chunk of code on the Java event handler thread. The * method takes into account provided AppContext and sets From e515c10f3a092955c847c88dcadebb763a807852 Mon Sep 17 00:00:00 2001 From: William Kemper Date: Wed, 11 Feb 2026 20:10:59 +0000 Subject: [PATCH 074/120] 8377396: GenShen: Consolidate and simplify in place region promotions Reviewed-by: shade, kdnilsen --- .../shenandoahGenerationalHeuristics.cpp | 114 +------ .../heuristics/shenandoahOldHeuristics.hpp | 2 +- .../shenandoahGenerationalEvacuationTask.cpp | 199 +---------- .../shenandoahGenerationalEvacuationTask.hpp | 1 + .../shenandoah/shenandoahInPlacePromoter.cpp | 311 ++++++++++++++++++ .../shenandoah/shenandoahInPlacePromoter.hpp | 91 +++++ 6 files changed, 423 insertions(+), 295 deletions(-) create mode 100644 src/hotspot/share/gc/shenandoah/shenandoahInPlacePromoter.cpp create mode 100644 src/hotspot/share/gc/shenandoah/shenandoahInPlacePromoter.hpp diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGenerationalHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGenerationalHeuristics.cpp index 80e6decf57d..029b917deab 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGenerationalHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGenerationalHeuristics.cpp @@ -30,6 +30,7 @@ #include "gc/shenandoah/shenandoahGeneration.hpp" #include "gc/shenandoah/shenandoahGenerationalHeap.inline.hpp" #include "gc/shenandoah/shenandoahHeapRegion.inline.hpp" +#include "gc/shenandoah/shenandoahInPlacePromoter.hpp" #include "gc/shenandoah/shenandoahOldGeneration.hpp" #include "gc/shenandoah/shenandoahTrace.hpp" #include "gc/shenandoah/shenandoahYoungGeneration.hpp" @@ -403,17 +404,9 @@ size_t ShenandoahGenerationalHeuristics::select_aged_regions(const size_t old_pr bool* const candidate_regions_for_promotion_by_copy = heap->collection_set()->preselected_regions(); ShenandoahMarkingContext* const ctx = heap->marking_context(); - const size_t old_garbage_threshold = - (ShenandoahHeapRegion::region_size_bytes() * heap->old_generation()->heuristics()->get_old_garbage_threshold()) / 100; - - const size_t pip_used_threshold = (ShenandoahHeapRegion::region_size_bytes() * ShenandoahGenerationalMinPIPUsage) / 100; - size_t promo_potential = 0; size_t candidates = 0; - // Tracks the padding of space above top in regions eligible for promotion in place - size_t promote_in_place_pad = 0; - // Sort the promotion-eligible regions in order of increasing live-data-bytes so that we can first reclaim regions that require // less evacuation effort. This prioritizes garbage first, expanding the allocation pool early before we reclaim regions that // have more live data. @@ -422,20 +415,7 @@ size_t ShenandoahGenerationalHeuristics::select_aged_regions(const size_t old_pr ResourceMark rm; AgedRegionData* sorted_regions = NEW_RESOURCE_ARRAY(AgedRegionData, num_regions); - ShenandoahFreeSet* freeset = heap->free_set(); - - // Any region that is to be promoted in place needs to be retired from its Collector or Mutator partition. - idx_t pip_low_collector_idx = freeset->max_regions(); - idx_t pip_high_collector_idx = -1; - idx_t pip_low_mutator_idx = freeset->max_regions(); - idx_t pip_high_mutator_idx = -1; - size_t collector_regions_to_pip = 0; - size_t mutator_regions_to_pip = 0; - - size_t pip_mutator_regions = 0; - size_t pip_collector_regions = 0; - size_t pip_mutator_bytes = 0; - size_t pip_collector_bytes = 0; + ShenandoahInPlacePromotionPlanner in_place_promotions(heap); for (idx_t i = 0; i < num_regions; i++) { ShenandoahHeapRegion* const r = heap->get_region(i); @@ -444,77 +424,19 @@ size_t ShenandoahGenerationalHeuristics::select_aged_regions(const size_t old_pr continue; } if (heap->is_tenurable(r)) { - if ((r->garbage() < old_garbage_threshold) && (r->used() > pip_used_threshold)) { + if (in_place_promotions.is_eligible(r)) { // We prefer to promote this region in place because it has a small amount of garbage and a large usage. - HeapWord* tams = ctx->top_at_mark_start(r); - HeapWord* original_top = r->top(); - if (!heap->is_concurrent_old_mark_in_progress() && tams == original_top) { - // No allocations from this region have been made during concurrent mark. It meets all the criteria - // for in-place-promotion. Though we only need the value of top when we fill the end of the region, - // we use this field to indicate that this region should be promoted in place during the evacuation - // phase. - r->save_top_before_promote(); - size_t remnant_bytes = r->free(); - size_t remnant_words = remnant_bytes / HeapWordSize; - assert(ShenandoahHeap::min_fill_size() <= PLAB::min_size(), "Implementation makes invalid assumptions"); - if (remnant_words >= ShenandoahHeap::min_fill_size()) { - ShenandoahHeap::fill_with_object(original_top, remnant_words); - // Fill the remnant memory within this region to assure no allocations prior to promote in place. Otherwise, - // newly allocated objects will not be parsable when promote in place tries to register them. Furthermore, any - // new allocations would not necessarily be eligible for promotion. This addresses both issues. - r->set_top(r->end()); - // The region r is either in the Mutator or Collector partition if remnant_words > heap()->plab_min_size. - // Otherwise, the region is in the NotFree partition. - ShenandoahFreeSetPartitionId p = free_set->membership(i); - if (p == ShenandoahFreeSetPartitionId::Mutator) { - mutator_regions_to_pip++; - if (i < pip_low_mutator_idx) { - pip_low_mutator_idx = i; - } - if (i > pip_high_mutator_idx) { - pip_high_mutator_idx = i; - } - pip_mutator_regions++; - pip_mutator_bytes += remnant_bytes; - } else if (p == ShenandoahFreeSetPartitionId::Collector) { - collector_regions_to_pip++; - if (i < pip_low_collector_idx) { - pip_low_collector_idx = i; - } - if (i > pip_high_collector_idx) { - pip_high_collector_idx = i; - } - pip_collector_regions++; - pip_collector_bytes += remnant_bytes; - } else { - assert((p == ShenandoahFreeSetPartitionId::NotFree) && (remnant_words < heap->plab_min_size()), - "Should be NotFree if not in Collector or Mutator partitions"); - // In this case, the memory is already counted as used and the region has already been retired. There is - // no need for further adjustments to used. Further, the remnant memory for this region will not be - // unallocated or made available to OldCollector after pip. - remnant_bytes = 0; - } - promote_in_place_pad += remnant_bytes; - free_set->prepare_to_promote_in_place(i, remnant_bytes); - } else { - // Since the remnant is so small that this region has already been retired, we don't have to worry about any - // accidental allocations occurring within this region before the region is promoted in place. - - // This region was already not in the Collector or Mutator set, so no need to remove it. - assert(free_set->membership(i) == ShenandoahFreeSetPartitionId::NotFree, "sanity"); - } - } - // Else, we do not promote this region (either in place or by copy) because it has received new allocations. - - // During evacuation, we exclude from promotion regions for which age > tenure threshold, garbage < garbage-threshold, - // used > pip_used_threshold, and get_top_before_promote() != tams + // Note that if this region has been used recently for allocation, it will not be promoted and it will + // not be selected for promotion by evacuation. + in_place_promotions.prepare(r); } else { // Record this promotion-eligible candidate region. After sorting and selecting the best candidates below, // we may still decide to exclude this promotion-eligible region from the current collection set. If this // happens, we will consider this region as part of the anticipated promotion potential for the next GC // pass; see further below. sorted_regions[candidates]._region = r; - sorted_regions[candidates++]._live_data = r->get_live_data_bytes(); + sorted_regions[candidates]._live_data = r->get_live_data_bytes(); + candidates++; } } else { // We only evacuate & promote objects from regular regions whose garbage() is above old-garbage-threshold. @@ -533,7 +455,7 @@ size_t ShenandoahGenerationalHeuristics::select_aged_regions(const size_t old_pr // in the current cycle and we will anticipate that they will be promoted in the next cycle. This will cause // us to reserve more old-gen memory so that these objects can be promoted in the subsequent cycle. if (heap->is_aging_cycle() && heap->age_census()->is_tenurable(r->age() + 1)) { - if (r->garbage() >= old_garbage_threshold) { + if (r->garbage() >= in_place_promotions.old_garbage_threshold()) { promo_potential += r->get_live_data_bytes(); } } @@ -542,21 +464,7 @@ size_t ShenandoahGenerationalHeuristics::select_aged_regions(const size_t old_pr // Subsequent regions may be selected if they have smaller live data. } - if (pip_mutator_regions + pip_collector_regions > 0) { - freeset->account_for_pip_regions(pip_mutator_regions, pip_mutator_bytes, pip_collector_regions, pip_collector_bytes); - } - - // Retire any regions that have been selected for promote in place - if (collector_regions_to_pip > 0) { - freeset->shrink_interval_if_range_modifies_either_boundary(ShenandoahFreeSetPartitionId::Collector, - pip_low_collector_idx, pip_high_collector_idx, - collector_regions_to_pip); - } - if (mutator_regions_to_pip > 0) { - freeset->shrink_interval_if_range_modifies_either_boundary(ShenandoahFreeSetPartitionId::Mutator, - pip_low_mutator_idx, pip_high_mutator_idx, - mutator_regions_to_pip); - } + in_place_promotions.update_free_set(); // Sort in increasing order according to live data bytes. Note that candidates represents the number of regions // that qualify to be promoted by evacuation. @@ -589,8 +497,6 @@ size_t ShenandoahGenerationalHeuristics::select_aged_regions(const size_t old_pr } log_info(gc, ergo)("Promotion potential of aged regions with sufficient garbage: " PROPERFMT, PROPERFMTARGS(promo_potential)); - - heap->old_generation()->set_pad_for_promote_in_place(promote_in_place_pad); heap->old_generation()->set_promotion_potential(promo_potential); return old_consumed; } diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahOldHeuristics.hpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahOldHeuristics.hpp index fc7a35aa6c8..e657ac58ae4 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahOldHeuristics.hpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahOldHeuristics.hpp @@ -128,7 +128,7 @@ private: // The value of command-line argument ShenandoahOldGarbageThreshold represents the percent of garbage that must // be present within an old-generation region before that region is considered a good candidate for inclusion in - // the collection set under normal circumstances. For our purposes, normal circustances are when the memory consumed + // the collection set under normal circumstances. For our purposes, normal circumstances are when the memory consumed // by the old generation is less than 50% of the soft heap capacity. When the old generation grows beyond the 50% // threshold, we dynamically adjust the old garbage threshold, allowing us to invest in packing the old generation // more tightly so that more memory can be made available to the more frequent young GC cycles. This variable diff --git a/src/hotspot/share/gc/shenandoah/shenandoahGenerationalEvacuationTask.cpp b/src/hotspot/share/gc/shenandoah/shenandoahGenerationalEvacuationTask.cpp index c9b956f9c2f..6912750378e 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahGenerationalEvacuationTask.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahGenerationalEvacuationTask.cpp @@ -24,14 +24,11 @@ */ #include "gc/shenandoah/shenandoahAsserts.hpp" -#include "gc/shenandoah/shenandoahFreeSet.hpp" +#include "gc/shenandoah/shenandoahGeneration.hpp" #include "gc/shenandoah/shenandoahGenerationalEvacuationTask.hpp" -#include "gc/shenandoah/shenandoahGenerationalHeap.inline.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" -#include "gc/shenandoah/shenandoahOldGeneration.hpp" -#include "gc/shenandoah/shenandoahScanRemembered.inline.hpp" +#include "gc/shenandoah/shenandoahInPlacePromoter.hpp" #include "gc/shenandoah/shenandoahUtils.hpp" -#include "gc/shenandoah/shenandoahYoungGeneration.hpp" class ShenandoahConcurrentEvacuator : public ObjectClosure { private: @@ -77,10 +74,10 @@ void ShenandoahGenerationalEvacuationTask::work(uint worker_id) { void ShenandoahGenerationalEvacuationTask::do_work() { if (_only_promote_regions) { // No allocations will be made, do not enter oom-during-evac protocol. - assert(ShenandoahHeap::heap()->collection_set()->is_empty(), "Should not have a collection set here"); + assert(_heap->collection_set()->is_empty(), "Should not have a collection set here"); promote_regions(); } else { - assert(!ShenandoahHeap::heap()->collection_set()->is_empty(), "Should have a collection set here"); + assert(!_heap->collection_set()->is_empty(), "Should have a collection set here"); ShenandoahEvacOOMScope oom_evac_scope; evacuate_and_promote_regions(); } @@ -95,16 +92,16 @@ void log_region(const ShenandoahHeapRegion* r, LogStream* ls) { } void ShenandoahGenerationalEvacuationTask::promote_regions() { - ShenandoahHeapRegion* r; LogTarget(Debug, gc) lt; - + ShenandoahInPlacePromoter promoter(_heap); + ShenandoahHeapRegion* r; while ((r = _regions->next()) != nullptr) { if (lt.is_enabled()) { LogStream ls(lt); log_region(r, &ls); } - maybe_promote_region(r); + promoter.maybe_promote_region(r); if (_heap->check_cancelled_gc_and_yield(_concurrent)) { break; @@ -115,6 +112,7 @@ void ShenandoahGenerationalEvacuationTask::promote_regions() { void ShenandoahGenerationalEvacuationTask::evacuate_and_promote_regions() { LogTarget(Debug, gc) lt; ShenandoahConcurrentEvacuator cl(_heap); + ShenandoahInPlacePromoter promoter(_heap); ShenandoahHeapRegion* r; while ((r = _regions->next()) != nullptr) { @@ -127,7 +125,7 @@ void ShenandoahGenerationalEvacuationTask::evacuate_and_promote_regions() { assert(r->has_live(), "Region %zu should have been reclaimed early", r->index()); _heap->marked_object_iterate(r, &cl); } else { - maybe_promote_region(r); + promoter.maybe_promote_region(r); } if (_heap->check_cancelled_gc_and_yield(_concurrent)) { @@ -135,182 +133,3 @@ void ShenandoahGenerationalEvacuationTask::evacuate_and_promote_regions() { } } } - - -void ShenandoahGenerationalEvacuationTask::maybe_promote_region(ShenandoahHeapRegion* r) { - if (r->is_young() && r->is_active() && _heap->is_tenurable(r)) { - if (r->is_humongous_start()) { - // We promote humongous_start regions along with their affiliated continuations during evacuation rather than - // doing this work during a safepoint. We cannot put humongous regions into the collection set because that - // triggers the load-reference barrier (LRB) to copy on reference fetch. - // - // Aged humongous continuation regions are handled with their start region. If an aged regular region has - // more garbage than the old garbage threshold, we'll promote by evacuation. If there is room for evacuation - // in this cycle, the region will be in the collection set. If there is not room, the region will be promoted - // by evacuation in some future GC cycle. - - // We do not promote primitive arrays because there's no performance penalty keeping them in young. When/if they - // become garbage, reclaiming the memory from young is much quicker and more efficient than reclaiming them from old. - oop obj = cast_to_oop(r->bottom()); - if (!obj->is_typeArray()) { - promote_humongous(r); - } - } else if (r->is_regular() && (r->get_top_before_promote() != nullptr)) { - // Likewise, we cannot put promote-in-place regions into the collection set because that would also trigger - // the LRB to copy on reference fetch. - // - // If an aged regular region has received allocations during the current cycle, we do not promote because the - // newly allocated objects do not have appropriate age; this region's age will be reset to zero at end of cycle. - promote_in_place(r); - } - } -} - -// When we promote a region in place, we can continue to use the established marking context to guide subsequent remembered -// set scans of this region's content. The region will be coalesced and filled prior to the next old-gen marking effort. -// We identify the entirety of the region as DIRTY to force the next remembered set scan to identify the "interesting pointers" -// contained herein. -void ShenandoahGenerationalEvacuationTask::promote_in_place(ShenandoahHeapRegion* region) { - assert(!_generation->is_old(), "Sanity check"); - ShenandoahMarkingContext* const marking_context = _heap->young_generation()->complete_marking_context(); - HeapWord* const tams = marking_context->top_at_mark_start(region); - size_t region_size_bytes = ShenandoahHeapRegion::region_size_bytes(); - - { - const size_t old_garbage_threshold = - (region_size_bytes * _heap->old_generation()->heuristics()->get_old_garbage_threshold()) / 100; - assert(!_heap->is_concurrent_old_mark_in_progress(), "Cannot promote in place during old marking"); - assert(region->garbage_before_padded_for_promote() < old_garbage_threshold, - "Region %zu has too much garbage for promotion", region->index()); - assert(region->is_young(), "Only young regions can be promoted"); - assert(region->is_regular(), "Use different service to promote humongous regions"); - assert(_heap->is_tenurable(region), "Only promote regions that are sufficiently aged"); - assert(region->get_top_before_promote() == tams, "Region %zu has been used for allocations before promotion", region->index()); - } - - ShenandoahOldGeneration* const old_gen = _heap->old_generation(); - ShenandoahYoungGeneration* const young_gen = _heap->young_generation(); - - // Rebuild the remembered set information and mark the entire range as DIRTY. We do NOT scan the content of this - // range to determine which cards need to be DIRTY. That would force us to scan the region twice, once now, and - // once during the subsequent remembered set scan. Instead, we blindly (conservatively) mark everything as DIRTY - // now and then sort out the CLEAN pages during the next remembered set scan. - // - // Rebuilding the remembered set consists of clearing all object registrations (reset_object_range()) here, - // then registering every live object and every coalesced range of free objects in the loop that follows. - ShenandoahScanRemembered* const scanner = old_gen->card_scan(); - scanner->reset_object_range(region->bottom(), region->end()); - scanner->mark_range_as_dirty(region->bottom(), region->get_top_before_promote() - region->bottom()); - - HeapWord* obj_addr = region->bottom(); - while (obj_addr < tams) { - oop obj = cast_to_oop(obj_addr); - if (marking_context->is_marked(obj)) { - assert(obj->klass() != nullptr, "klass should not be null"); - // This thread is responsible for registering all objects in this region. No need for lock. - scanner->register_object_without_lock(obj_addr); - obj_addr += obj->size(); - } else { - HeapWord* next_marked_obj = marking_context->get_next_marked_addr(obj_addr, tams); - assert(next_marked_obj <= tams, "next marked object cannot exceed tams"); - size_t fill_size = next_marked_obj - obj_addr; - assert(fill_size >= ShenandoahHeap::min_fill_size(), "previously allocated objects known to be larger than min_size"); - ShenandoahHeap::fill_with_object(obj_addr, fill_size); - scanner->register_object_without_lock(obj_addr); - obj_addr = next_marked_obj; - } - } - // We do not need to scan above TAMS because restored top equals tams - assert(obj_addr == tams, "Expect loop to terminate when obj_addr equals tams"); - - { - ShenandoahHeapLocker locker(_heap->lock()); - - HeapWord* update_watermark = region->get_update_watermark(); - // pip_unpadded is memory too small to be filled above original top - size_t pip_unpadded = (region->end() - region->top()) * HeapWordSize; - assert((region->top() == region->end()) - || (pip_unpadded == (size_t) ((region->end() - region->top()) * HeapWordSize)), "Invariant"); - assert(pip_unpadded < ShenandoahHeap::min_fill_size() * HeapWordSize, "Sanity"); - size_t pip_pad_bytes = (region->top() - region->get_top_before_promote()) * HeapWordSize; - assert((pip_unpadded == 0) || (pip_pad_bytes == 0), "Only one of pip_unpadded and pip_pad_bytes is non-zero"); - - // Now that this region is affiliated with old, we can allow it to receive allocations, though it may not be in the - // is_collector_free range. We'll add it to that range below. - region->restore_top_before_promote(); -#ifdef ASSERT - size_t region_to_be_used_in_old = region->used(); - assert(region_to_be_used_in_old + pip_pad_bytes + pip_unpadded == region_size_bytes, "invariant"); -#endif - - // The update_watermark was likely established while we had the artificially high value of top. Make it sane now. - assert(update_watermark >= region->top(), "original top cannot exceed preserved update_watermark"); - region->set_update_watermark(region->top()); - - // Transfer this region from young to old, increasing promoted_reserve if available space exceeds plab_min_size() - _heap->free_set()->add_promoted_in_place_region_to_old_collector(region); - region->set_affiliation(OLD_GENERATION); - region->set_promoted_in_place(); - } -} - -void ShenandoahGenerationalEvacuationTask::promote_humongous(ShenandoahHeapRegion* region) { - ShenandoahMarkingContext* marking_context = _heap->marking_context(); - oop obj = cast_to_oop(region->bottom()); - assert(_generation->is_mark_complete(), "sanity"); - assert(region->is_young(), "Only young regions can be promoted"); - assert(region->is_humongous_start(), "Should not promote humongous continuation in isolation"); - assert(_heap->is_tenurable(region), "Only promote regions that are sufficiently aged"); - assert(marking_context->is_marked(obj), "promoted humongous object should be alive"); - - const size_t used_bytes = obj->size() * HeapWordSize; - const size_t spanned_regions = ShenandoahHeapRegion::required_regions(used_bytes); - const size_t region_size_bytes = ShenandoahHeapRegion::region_size_bytes(); - const size_t humongous_waste = spanned_regions * region_size_bytes - obj->size() * HeapWordSize; - const size_t index_limit = region->index() + spanned_regions; - - ShenandoahOldGeneration* const old_gen = _heap->old_generation(); - ShenandoahGeneration* const young_gen = _heap->young_generation(); - { - // We need to grab the heap lock in order to avoid a race when changing the affiliations of spanned_regions from - // young to old. - ShenandoahHeapLocker locker(_heap->lock()); - - // We promote humongous objects unconditionally, without checking for availability. We adjust - // usage totals, including humongous waste, after evacuation is done. - log_debug(gc)("promoting humongous region %zu, spanning %zu", region->index(), spanned_regions); - - // For this region and each humongous continuation region spanned by this humongous object, change - // affiliation to OLD_GENERATION and adjust the generation-use tallies. The remnant of memory - // in the last humongous region that is not spanned by obj is currently not used. - for (size_t i = region->index(); i < index_limit; i++) { - ShenandoahHeapRegion* r = _heap->get_region(i); - log_debug(gc)("promoting humongous region %zu, from " PTR_FORMAT " to " PTR_FORMAT, - r->index(), p2i(r->bottom()), p2i(r->top())); - // We mark the entire humongous object's range as dirty after loop terminates, so no need to dirty the range here - r->set_affiliation(OLD_GENERATION); - r->set_promoted_in_place(); - } - - ShenandoahFreeSet* freeset = _heap->free_set(); - freeset->transfer_humongous_regions_from_mutator_to_old_collector(spanned_regions, humongous_waste); - } - - // Since this region may have served previously as OLD, it may hold obsolete object range info. - HeapWord* const humongous_bottom = region->bottom(); - ShenandoahScanRemembered* const scanner = old_gen->card_scan(); - scanner->reset_object_range(humongous_bottom, humongous_bottom + spanned_regions * ShenandoahHeapRegion::region_size_words()); - // Since the humongous region holds only one object, no lock is necessary for this register_object() invocation. - scanner->register_object_without_lock(humongous_bottom); - - if (obj->is_typeArray()) { - // Primitive arrays don't need to be scanned. - log_debug(gc)("Clean cards for promoted humongous object (Region %zu) from " PTR_FORMAT " to " PTR_FORMAT, - region->index(), p2i(humongous_bottom), p2i(humongous_bottom + obj->size())); - scanner->mark_range_as_clean(humongous_bottom, obj->size()); - } else { - log_debug(gc)("Dirty cards for promoted humongous object (Region %zu) from " PTR_FORMAT " to " PTR_FORMAT, - region->index(), p2i(humongous_bottom), p2i(humongous_bottom + obj->size())); - scanner->mark_range_as_dirty(humongous_bottom, obj->size()); - } -} diff --git a/src/hotspot/share/gc/shenandoah/shenandoahGenerationalEvacuationTask.hpp b/src/hotspot/share/gc/shenandoah/shenandoahGenerationalEvacuationTask.hpp index de47184ffff..1ff58b42e8c 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahGenerationalEvacuationTask.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahGenerationalEvacuationTask.hpp @@ -27,6 +27,7 @@ #include "gc/shared/workerThread.hpp" +class ShenandoahGeneration; class ShenandoahGenerationalHeap; class ShenandoahHeapRegion; class ShenandoahRegionIterator; diff --git a/src/hotspot/share/gc/shenandoah/shenandoahInPlacePromoter.cpp b/src/hotspot/share/gc/shenandoah/shenandoahInPlacePromoter.cpp new file mode 100644 index 00000000000..83f4217df83 --- /dev/null +++ b/src/hotspot/share/gc/shenandoah/shenandoahInPlacePromoter.cpp @@ -0,0 +1,311 @@ +/* + * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * 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 "gc/shared/plab.hpp" +#include "gc/shenandoah/shenandoahFreeSet.hpp" +#include "gc/shenandoah/shenandoahGenerationalHeap.inline.hpp" +#include "gc/shenandoah/shenandoahHeap.inline.hpp" +#include "gc/shenandoah/shenandoahHeapRegion.inline.hpp" +#include "gc/shenandoah/shenandoahInPlacePromoter.hpp" +#include "gc/shenandoah/shenandoahMarkingContext.hpp" +#include "gc/shenandoah/shenandoahOldGeneration.hpp" +#include "gc/shenandoah/shenandoahYoungGeneration.hpp" + +ShenandoahInPlacePromotionPlanner::RegionPromotions::RegionPromotions(ShenandoahFreeSet* free_set) + : _low_idx(free_set->max_regions()) + , _high_idx(-1) + , _regions(0) + , _bytes(0) + , _free_set(free_set) +{ +} + +void ShenandoahInPlacePromotionPlanner::RegionPromotions::increment(idx_t region_index, size_t remnant_bytes) { + if (region_index < _low_idx) { + _low_idx = region_index; + } + if (region_index > _high_idx) { + _high_idx = region_index; + } + _regions++; + _bytes += remnant_bytes; +} + +void ShenandoahInPlacePromotionPlanner::RegionPromotions::update_free_set(ShenandoahFreeSetPartitionId partition_id) const { + if (_regions > 0) { + _free_set->shrink_interval_if_range_modifies_either_boundary(partition_id, _low_idx, _high_idx, _regions); + } +} + +ShenandoahInPlacePromotionPlanner::ShenandoahInPlacePromotionPlanner(const ShenandoahGenerationalHeap* heap) + : _old_garbage_threshold(ShenandoahHeapRegion::region_size_bytes() * heap->old_generation()->heuristics()->get_old_garbage_threshold() / 100) + , _pip_used_threshold(ShenandoahHeapRegion::region_size_bytes() * ShenandoahGenerationalMinPIPUsage / 100) + , _heap(heap) + , _free_set(_heap->free_set()) + , _marking_context(_heap->marking_context()) + , _mutator_regions(_free_set) + , _collector_regions(_free_set) + , _pip_padding_bytes(0) +{ +} + +bool ShenandoahInPlacePromotionPlanner::is_eligible(const ShenandoahHeapRegion* region) const { + return region->garbage() < _old_garbage_threshold && region->used() > _pip_used_threshold; +} + +void ShenandoahInPlacePromotionPlanner::prepare(ShenandoahHeapRegion* r) { + HeapWord* tams = _marking_context->top_at_mark_start(r); + HeapWord* original_top = r->top(); + + if (_heap->is_concurrent_mark_in_progress() || tams != original_top) { + // We do not promote this region (either in place or by copy) because it has received new allocations. + // During evacuation, we exclude from promotion regions for which age > tenure threshold, garbage < garbage-threshold, + // used > pip_used_threshold, and get_top_before_promote() != tams. + // TODO: Such a region should have had its age reset to zero when it was used for allocation? + return; + } + + // No allocations from this region have been made during concurrent mark. It meets all the criteria + // for in-place-promotion. Though we only need the value of top when we fill the end of the region, + // we use this field to indicate that this region should be promoted in place during the evacuation + // phase. + r->save_top_before_promote(); + size_t remnant_bytes = r->free(); + size_t remnant_words = remnant_bytes / HeapWordSize; + assert(ShenandoahHeap::min_fill_size() <= PLAB::min_size(), "Implementation makes invalid assumptions"); + if (remnant_words >= ShenandoahHeap::min_fill_size()) { + ShenandoahHeap::fill_with_object(original_top, remnant_words); + // Fill the remnant memory within this region to assure no allocations prior to promote in place. Otherwise, + // newly allocated objects will not be parsable when promote in place tries to register them. Furthermore, any + // new allocations would not necessarily be eligible for promotion. This addresses both issues. + r->set_top(r->end()); + // The region r is either in the Mutator or Collector partition if remnant_words > heap()->plab_min_size. + // Otherwise, the region is in the NotFree partition. + const idx_t i = r->index(); + ShenandoahFreeSetPartitionId p = _free_set->membership(i); + if (p == ShenandoahFreeSetPartitionId::Mutator) { + _mutator_regions.increment(i, remnant_bytes); + } else if (p == ShenandoahFreeSetPartitionId::Collector) { + _collector_regions.increment(i, remnant_bytes); + } else { + assert((p == ShenandoahFreeSetPartitionId::NotFree) && (remnant_words < _heap->plab_min_size()), + "Should be NotFree if not in Collector or Mutator partitions"); + // In this case, the memory is already counted as used and the region has already been retired. There is + // no need for further adjustments to used. Further, the remnant memory for this region will not be + // unallocated or made available to OldCollector after pip. + remnant_bytes = 0; + } + + _pip_padding_bytes += remnant_bytes; + _free_set->prepare_to_promote_in_place(i, remnant_bytes); + } else { + // Since the remnant is so small that this region has already been retired, we don't have to worry about any + // accidental allocations occurring within this region before the region is promoted in place. + + // This region was already not in the Collector or Mutator set, so no need to remove it. + assert(_free_set->membership(r->index()) == ShenandoahFreeSetPartitionId::NotFree, "sanity"); + } +} + +void ShenandoahInPlacePromotionPlanner::update_free_set() const { + _heap->old_generation()->set_pad_for_promote_in_place(_pip_padding_bytes); + + if (_mutator_regions._regions + _collector_regions._regions > 0) { + _free_set->account_for_pip_regions(_mutator_regions._regions, _mutator_regions._bytes, + _collector_regions._regions, _collector_regions._bytes); + } + + // Retire any regions that have been selected for promote in place + _mutator_regions.update_free_set(ShenandoahFreeSetPartitionId::Mutator); + _collector_regions.update_free_set(ShenandoahFreeSetPartitionId::Collector); +} + +void ShenandoahInPlacePromoter::maybe_promote_region(ShenandoahHeapRegion* r) const { + if (r->is_young() && r->is_active() && _heap->is_tenurable(r)) { + if (r->is_humongous_start()) { + // We promote humongous_start regions along with their affiliated continuations during evacuation rather than + // doing this work during a safepoint. We cannot put humongous regions into the collection set because that + // triggers the load-reference barrier (LRB) to copy on reference fetch. + // + // Aged humongous continuation regions are handled with their start region. If an aged regular region has + // more garbage than ShenandoahOldGarbageThreshold, we'll promote by evacuation. If there is room for evacuation + // in this cycle, the region will be in the collection set. If there is no room, the region will be promoted + // by evacuation in some future GC cycle. + + // We do not promote primitive arrays because there's no performance penalty keeping them in young. When/if they + // become garbage, reclaiming the memory from young is much quicker and more efficient than reclaiming them from old. + oop obj = cast_to_oop(r->bottom()); + if (!obj->is_typeArray()) { + promote_humongous(r); + } + } else if (r->is_regular() && (r->get_top_before_promote() != nullptr)) { + // Likewise, we cannot put promote-in-place regions into the collection set because that would also trigger + // the LRB to copy on reference fetch. + // + // If an aged regular region has received allocations during the current cycle, we do not promote because the + // newly allocated objects do not have appropriate age; this region's age will be reset to zero at end of cycle. + promote(r); + } + } +} + +// When we promote a region in place, we can continue to use the established marking context to guide subsequent remembered +// set scans of this region's content. The region will be coalesced and filled prior to the next old-gen marking effort. +// We identify the entirety of the region as DIRTY to force the next remembered set scan to identify the "interesting pointers" +// contained herein. +void ShenandoahInPlacePromoter::promote(ShenandoahHeapRegion* region) const { + + ShenandoahMarkingContext* const marking_context = _heap->young_generation()->complete_marking_context(); + HeapWord* const tams = marking_context->top_at_mark_start(region); + size_t region_size_bytes = ShenandoahHeapRegion::region_size_bytes(); + + { + const size_t old_garbage_threshold = + (region_size_bytes * _heap->old_generation()->heuristics()->get_old_garbage_threshold()) / 100; + assert(!_heap->is_concurrent_old_mark_in_progress(), "Cannot promote in place during old marking"); + assert(region->garbage_before_padded_for_promote() < old_garbage_threshold, + "Region %zu has too much garbage for promotion", region->index()); + assert(region->is_young(), "Only young regions can be promoted"); + assert(region->is_regular(), "Use different service to promote humongous regions"); + assert(_heap->is_tenurable(region), "Only promote regions that are sufficiently aged"); + assert(region->get_top_before_promote() == tams, "Region %zu has been used for allocations before promotion", region->index()); + } + + ShenandoahOldGeneration* const old_gen = _heap->old_generation(); + + // Rebuild the remembered set information and mark the entire range as DIRTY. We do NOT scan the content of this + // range to determine which cards need to be DIRTY. That would force us to scan the region twice, once now, and + // once during the subsequent remembered set scan. Instead, we blindly (conservatively) mark everything as DIRTY + // now and then sort out the CLEAN pages during the next remembered set scan. + // + // Rebuilding the remembered set consists of clearing all object registrations (reset_object_range()) here, + // then registering every live object and every coalesced range of free objects in the loop that follows. + ShenandoahScanRemembered* const scanner = old_gen->card_scan(); + scanner->reset_object_range(region->bottom(), region->end()); + scanner->mark_range_as_dirty(region->bottom(), region->get_top_before_promote() - region->bottom()); + + HeapWord* obj_addr = region->bottom(); + while (obj_addr < tams) { + oop obj = cast_to_oop(obj_addr); + if (marking_context->is_marked(obj)) { + assert(obj->klass() != nullptr, "klass should not be null"); + // This thread is responsible for registering all objects in this region. No need for lock. + scanner->register_object_without_lock(obj_addr); + obj_addr += obj->size(); + } else { + HeapWord* next_marked_obj = marking_context->get_next_marked_addr(obj_addr, tams); + assert(next_marked_obj <= tams, "next marked object cannot exceed tams"); + size_t fill_size = next_marked_obj - obj_addr; + assert(fill_size >= ShenandoahHeap::min_fill_size(), "previously allocated objects known to be larger than min_size"); + ShenandoahHeap::fill_with_object(obj_addr, fill_size); + scanner->register_object_without_lock(obj_addr); + obj_addr = next_marked_obj; + } + } + // We do not need to scan above TAMS because restored top equals tams + assert(obj_addr == tams, "Expect loop to terminate when obj_addr equals tams"); + + + { + ShenandoahHeapLocker locker(_heap->lock()); +#ifdef ASSERT + HeapWord* update_watermark = region->get_update_watermark(); + // pip_unpadded is memory too small to be filled above original top + size_t pip_unpadded = (region->end() - region->top()) * HeapWordSize; + assert((region->top() == region->end()) + || (pip_unpadded == (size_t) ((region->end() - region->top()) * HeapWordSize)), "Invariant"); + assert(pip_unpadded < ShenandoahHeap::min_fill_size() * HeapWordSize, "Sanity"); + size_t pip_pad_bytes = (region->top() - region->get_top_before_promote()) * HeapWordSize; + assert((pip_unpadded == 0) || (pip_pad_bytes == 0), "Only one of pip_unpadded and pip_pad_bytes is non-zero"); +#endif + + // Now that this region is affiliated with old, we can allow it to receive allocations, though it may not be in the + // is_collector_free range. We'll add it to that range below. + region->restore_top_before_promote(); + + assert(region->used() + pip_pad_bytes + pip_unpadded == region_size_bytes, "invariant"); + + // The update_watermark was likely established while we had the artificially high value of top. Make it sane now. + assert(update_watermark >= region->top(), "original top cannot exceed preserved update_watermark"); + region->set_update_watermark(region->top()); + + // Transfer this region from young to old, increasing promoted_reserve if available space exceeds plab_min_size() + _heap->free_set()->add_promoted_in_place_region_to_old_collector(region); + region->set_affiliation(OLD_GENERATION); + region->set_promoted_in_place(); + } +} + +void ShenandoahInPlacePromoter::promote_humongous(ShenandoahHeapRegion* region) const { + oop obj = cast_to_oop(region->bottom()); + + assert(region->is_young(), "Only young regions can be promoted"); + assert(region->is_humongous_start(), "Should not promote humongous continuation in isolation"); + assert(_heap->is_tenurable(region), "Only promote regions that are sufficiently aged"); + assert(_heap->marking_context()->is_marked(obj), "Promoted humongous object should be alive"); + assert(!obj->is_typeArray(), "Don't promote humongous primitives"); + + const size_t used_bytes = obj->size() * HeapWordSize; + const size_t spanned_regions = ShenandoahHeapRegion::required_regions(used_bytes); + const size_t region_size_bytes = ShenandoahHeapRegion::region_size_bytes(); + const size_t humongous_waste = spanned_regions * region_size_bytes - obj->size() * HeapWordSize; + const size_t index_limit = region->index() + spanned_regions; + + ShenandoahOldGeneration* const old_gen = _heap->old_generation(); + { + // We need to grab the heap lock in order to avoid a race when changing the affiliations of spanned_regions from + // young to old. + ShenandoahHeapLocker locker(_heap->lock()); + + // We promote humongous objects unconditionally, without checking for availability. We adjust + // usage totals, including humongous waste, after evacuation is done. + log_debug(gc)("promoting humongous region %zu, spanning %zu", region->index(), spanned_regions); + + // For this region and each humongous continuation region spanned by this humongous object, change + // affiliation to OLD_GENERATION and adjust the generation-use tallies. The remnant of memory + // in the last humongous region that is not spanned by obj is currently not used. + for (size_t i = region->index(); i < index_limit; i++) { + ShenandoahHeapRegion* r = _heap->get_region(i); + log_debug(gc)("promoting humongous region %zu, from " PTR_FORMAT " to " PTR_FORMAT, + r->index(), p2i(r->bottom()), p2i(r->top())); + // We mark the entire humongous object's range as dirty after loop terminates, so no need to dirty the range here + r->set_affiliation(OLD_GENERATION); + r->set_promoted_in_place(); + } + + ShenandoahFreeSet* freeset = _heap->free_set(); + freeset->transfer_humongous_regions_from_mutator_to_old_collector(spanned_regions, humongous_waste); + } + + // Since this region may have served previously as OLD, it may hold obsolete object range info. + HeapWord* const humongous_bottom = region->bottom(); + ShenandoahScanRemembered* const scanner = old_gen->card_scan(); + scanner->reset_object_range(humongous_bottom, humongous_bottom + spanned_regions * ShenandoahHeapRegion::region_size_words()); + // Since the humongous region holds only one object, no lock is necessary for this register_object() invocation. + scanner->register_object_without_lock(humongous_bottom); + + log_debug(gc)("Dirty cards for promoted humongous object (Region %zu) from " PTR_FORMAT " to " PTR_FORMAT, + region->index(), p2i(humongous_bottom), p2i(humongous_bottom + obj->size())); + scanner->mark_range_as_dirty(humongous_bottom, obj->size()); +} diff --git a/src/hotspot/share/gc/shenandoah/shenandoahInPlacePromoter.hpp b/src/hotspot/share/gc/shenandoah/shenandoahInPlacePromoter.hpp new file mode 100644 index 00000000000..939107dd3ac --- /dev/null +++ b/src/hotspot/share/gc/shenandoah/shenandoahInPlacePromoter.hpp @@ -0,0 +1,91 @@ +/* + * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * 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_GC_SHENANDOAH_SHENANDOAHINPLACEPROMOTER_HPP +#define SHARE_GC_SHENANDOAH_SHENANDOAHINPLACEPROMOTER_HPP + +#include "gc/shenandoah/shenandoahSimpleBitMap.hpp" + +class ShenandoahFreeSet; +class ShenandoahMarkingContext; +class ShenandoahGenerationalHeap; +class ShenandoahHeapRegion; + +class ShenandoahInPlacePromotionPlanner { + using idx_t = ShenandoahSimpleBitMap::idx_t; + + struct RegionPromotions { + idx_t _low_idx; + idx_t _high_idx; + size_t _regions; + size_t _bytes; + ShenandoahFreeSet* _free_set; + + explicit RegionPromotions(ShenandoahFreeSet* free_set); + void increment(idx_t region_index, size_t remnant_bytes); + void update_free_set(ShenandoahFreeSetPartitionId partition_id) const; + }; + + const size_t _old_garbage_threshold; + const size_t _pip_used_threshold; + + const ShenandoahGenerationalHeap* _heap; + ShenandoahFreeSet* _free_set; + const ShenandoahMarkingContext* _marking_context; + + // Any region that is to be promoted in place needs to be retired from its Collector or Mutator partition. + RegionPromotions _mutator_regions; + RegionPromotions _collector_regions; + + // Tracks the padding of space above top in regions eligible for promotion in place + size_t _pip_padding_bytes; +public: + explicit ShenandoahInPlacePromotionPlanner(const ShenandoahGenerationalHeap* heap); + + // Returns true if this region has garbage below and usage above the configurable thresholds + bool is_eligible(const ShenandoahHeapRegion* region) const; + + // Prepares the region for promotion by moving top to the end to prevent allocations + void prepare(ShenandoahHeapRegion* region); + + // Notifies the free set of in place promotions + void update_free_set() const; + + size_t old_garbage_threshold() const { return _old_garbage_threshold; } +}; + +class ShenandoahInPlacePromoter { + ShenandoahGenerationalHeap* _heap; +public: + explicit ShenandoahInPlacePromoter(ShenandoahGenerationalHeap* heap) : _heap(heap) {} + + // If the region still meets the criteria for promotion in place, it will be promoted + void maybe_promote_region(ShenandoahHeapRegion* region) const; + +private: + void promote(ShenandoahHeapRegion* region) const; + void promote_humongous(ShenandoahHeapRegion* region) const; +}; + +#endif // SHARE_GC_SHENANDOAH_SHENANDOAHINPLACEPROMOTER_HPP From 0867f9b1b4bfa090cce1403cdbcce56a2e91127c Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Wed, 11 Feb 2026 23:00:50 +0000 Subject: [PATCH 075/120] 8377307: Refactor code for AOT cache pointer compression Reviewed-by: jsjolen, xuelei, asmehra --- .../share/cds/aotCompressedPointers.cpp | 30 ++++ .../share/cds/aotCompressedPointers.hpp | 142 ++++++++++++++++++ src/hotspot/share/cds/aotMetaspace.cpp | 6 +- src/hotspot/share/cds/archiveBuilder.cpp | 20 +-- src/hotspot/share/cds/archiveBuilder.hpp | 43 +----- src/hotspot/share/cds/archiveUtils.cpp | 14 +- src/hotspot/share/cds/archiveUtils.hpp | 56 +------ src/hotspot/share/cds/dynamicArchive.cpp | 9 +- src/hotspot/share/cds/filemap.cpp | 12 +- src/hotspot/share/cds/filemap.hpp | 35 ++--- src/hotspot/share/cds/heapShared.cpp | 4 +- src/hotspot/share/cds/lambdaFormInvokers.cpp | 13 +- src/hotspot/share/cds/lambdaFormInvokers.hpp | 7 +- .../share/cds/lambdaProxyClassDictionary.cpp | 28 ++-- .../share/cds/lambdaProxyClassDictionary.hpp | 57 ++++--- src/hotspot/share/cds/runTimeClassInfo.cpp | 19 +-- src/hotspot/share/cds/runTimeClassInfo.hpp | 27 ++-- .../share/classfile/compactHashtable.hpp | 12 +- src/hotspot/share/classfile/symbolTable.cpp | 3 +- .../classfile/systemDictionaryShared.cpp | 9 +- src/hotspot/share/include/cds.h | 4 +- src/hotspot/share/oops/trainingData.cpp | 6 +- src/hotspot/share/runtime/sharedRuntime.cpp | 7 +- src/hotspot/share/runtime/sharedRuntime.hpp | 2 +- src/hotspot/share/runtime/vmStructs.cpp | 4 +- .../sun/jvm/hotspot/memory/FileMapInfo.java | 8 +- 26 files changed, 343 insertions(+), 234 deletions(-) create mode 100644 src/hotspot/share/cds/aotCompressedPointers.cpp create mode 100644 src/hotspot/share/cds/aotCompressedPointers.hpp diff --git a/src/hotspot/share/cds/aotCompressedPointers.cpp b/src/hotspot/share/cds/aotCompressedPointers.cpp new file mode 100644 index 00000000000..c3efa7a7185 --- /dev/null +++ b/src/hotspot/share/cds/aotCompressedPointers.cpp @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * 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 "cds/aotCompressedPointers.hpp" +#include "cds/archiveBuilder.hpp" + +size_t AOTCompressedPointers::compute_byte_offset(address p) { + return ArchiveBuilder::current()->any_to_offset(p); +} diff --git a/src/hotspot/share/cds/aotCompressedPointers.hpp b/src/hotspot/share/cds/aotCompressedPointers.hpp new file mode 100644 index 00000000000..ead48ef9948 --- /dev/null +++ b/src/hotspot/share/cds/aotCompressedPointers.hpp @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * 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_CDS_AOTCOMPRESSEDPOINTERS_HPP +#define SHARE_CDS_AOTCOMPRESSEDPOINTERS_HPP + +#include "cds/cds_globals.hpp" +#include "memory/allStatic.hpp" +#include "memory/metaspace.hpp" +#include "metaprogramming/enableIf.hpp" +#include "utilities/align.hpp" +#include "utilities/globalDefinitions.hpp" +#include "utilities/macros.hpp" + +class AOTCompressedPointers: public AllStatic { +public: + // For space saving, we can encode the location of metadata objects in the "rw" and "ro" + // regions using a 32-bit offset from the bottom of the mapped AOT metaspace. + // Currently we allow only up to 2GB total size in the rw and ro regions (which are + // contiguous to each other). + enum class narrowPtr : u4; + static constexpr size_t MaxMetadataOffsetBytes = 0x7FFFFFFF; + + // In the future, this could return a different numerical value than + // narrowp if the encoding contains shifts. + inline static size_t get_byte_offset(narrowPtr narrowp) { + return checked_cast(narrowp); + } + + inline static narrowPtr null() { + return static_cast(0); + } + + // Encoding ------ + + // ptr can point to one of the following + // - an object in the ArchiveBuilder's buffer. + // - an object in the currently mapped AOT cache rw/ro regions. + // - an object that has been copied into the ArchiveBuilder's buffer. + template + static narrowPtr encode_not_null(T ptr) { + address p = reinterpret_cast

(ptr); + return encode_byte_offset(compute_byte_offset(p)); + } + + template + static narrowPtr encode(T ptr) { // may be null + if (ptr == nullptr) { + return null(); + } else { + return encode_not_null(ptr); + } + } + + // ptr must be in the currently mapped AOT cache rw/ro regions. + template + static narrowPtr encode_address_in_cache(T ptr) { + assert(Metaspace::in_aot_cache(ptr), "must be"); + address p = reinterpret_cast
(ptr); + address base = reinterpret_cast
(SharedBaseAddress); + return encode_byte_offset(pointer_delta(p, base, 1)); + } + + template + static narrowPtr encode_address_in_cache_or_null(T ptr) { + if (ptr == nullptr) { + return null(); + } else { + return encode_address_in_cache(ptr); + } + } + + // Decoding ----- + + // If base_address is null, decode an address within the mapped aot cache range. + template + static T decode_not_null(narrowPtr narrowp, address base_address = nullptr) { + assert(narrowp != null(), "sanity"); + if (base_address == nullptr) { + T p = reinterpret_cast(reinterpret_cast
(SharedBaseAddress) + get_byte_offset(narrowp)); + assert(Metaspace::in_aot_cache(p), "must be"); + return p; + } else { + // This is usually called before the cache is fully mapped. + return reinterpret_cast(base_address + get_byte_offset(narrowp)); + } + } + + template + static T decode(narrowPtr narrowp, address base_address = nullptr) { // may be null + if (narrowp == null()) { + return nullptr; + } else { + return decode_not_null(narrowp, base_address); + } + } + +private: + static size_t compute_byte_offset(address p); + + static narrowPtr encode_byte_offset(size_t offset) { + assert(offset != 0, "offset 0 is in protection zone"); + precond(offset <= MaxMetadataOffsetBytes); + return checked_cast(offset); + } +}; + +// Type casts -- declared as global functions to save a few keystrokes + +// A simple type cast. No change in numerical value. +inline AOTCompressedPointers::narrowPtr cast_from_u4(u4 narrowp) { + return checked_cast(narrowp); +} + +// A simple type cast. No change in numerical value. +// !!!DO NOT CALL THIS if you want a byte offset!!! +inline u4 cast_to_u4(AOTCompressedPointers::narrowPtr narrowp) { + return checked_cast(narrowp); +} + +#endif // SHARE_CDS_AOTCOMPRESSEDPOINTERS_HPP diff --git a/src/hotspot/share/cds/aotMetaspace.cpp b/src/hotspot/share/cds/aotMetaspace.cpp index 8bb8387f1ab..544eaa07a4d 100644 --- a/src/hotspot/share/cds/aotMetaspace.cpp +++ b/src/hotspot/share/cds/aotMetaspace.cpp @@ -2106,7 +2106,7 @@ MapArchiveResult AOTMetaspace::map_archive(FileMapInfo* mapinfo, char* mapped_ba // Currently, only static archive uses early serialized data. char* buffer = mapinfo->early_serialized_data(); intptr_t* array = (intptr_t*)buffer; - ReadClosure rc(&array, (intptr_t)mapped_base_address); + ReadClosure rc(&array, (address)mapped_base_address); early_serialize(&rc); } @@ -2152,7 +2152,7 @@ void AOTMetaspace::initialize_shared_spaces() { // shared string/symbol tables. char* buffer = static_mapinfo->serialized_data(); intptr_t* array = (intptr_t*)buffer; - ReadClosure rc(&array, (intptr_t)SharedBaseAddress); + ReadClosure rc(&array, (address)SharedBaseAddress); serialize(&rc); // Finish initializing the heap dump mode used in the archive @@ -2164,7 +2164,7 @@ void AOTMetaspace::initialize_shared_spaces() { if (dynamic_mapinfo != nullptr) { intptr_t* buffer = (intptr_t*)dynamic_mapinfo->serialized_data(); - ReadClosure rc(&buffer, (intptr_t)SharedBaseAddress); + ReadClosure rc(&buffer, (address)SharedBaseAddress); DynamicArchive::serialize(&rc); } diff --git a/src/hotspot/share/cds/archiveBuilder.cpp b/src/hotspot/share/cds/archiveBuilder.cpp index e65bd3985ac..cb9459172b3 100644 --- a/src/hotspot/share/cds/archiveBuilder.cpp +++ b/src/hotspot/share/cds/archiveBuilder.cpp @@ -24,6 +24,7 @@ #include "cds/aotArtifactFinder.hpp" #include "cds/aotClassLinker.hpp" +#include "cds/aotCompressedPointers.hpp" #include "cds/aotLogging.hpp" #include "cds/aotMapLogger.hpp" #include "cds/aotMetaspace.hpp" @@ -175,10 +176,10 @@ ArchiveBuilder::ArchiveBuilder() : _mapped_static_archive_bottom(nullptr), _mapped_static_archive_top(nullptr), _buffer_to_requested_delta(0), - _pz_region("pz", MAX_SHARED_DELTA), // protection zone -- used only during dumping; does NOT exist in cds archive. - _rw_region("rw", MAX_SHARED_DELTA), - _ro_region("ro", MAX_SHARED_DELTA), - _ac_region("ac", MAX_SHARED_DELTA), + _pz_region("pz"), // protection zone -- used only during dumping; does NOT exist in cds archive. + _rw_region("rw"), + _ro_region("ro"), + _ac_region("ac"), _ptrmap(mtClassShared), _rw_ptrmap(mtClassShared), _ro_ptrmap(mtClassShared), @@ -990,16 +991,15 @@ void ArchiveBuilder::make_training_data_shareable() { _src_obj_table.iterate_all(clean_td); } -uintx ArchiveBuilder::buffer_to_offset(address p) const { +size_t ArchiveBuilder::buffer_to_offset(address p) const { address requested_p = to_requested(p); - assert(requested_p >= _requested_static_archive_bottom, "must be"); - return requested_p - _requested_static_archive_bottom; + return pointer_delta(requested_p, _requested_static_archive_bottom, 1); } -uintx ArchiveBuilder::any_to_offset(address p) const { +size_t ArchiveBuilder::any_to_offset(address p) const { if (is_in_mapped_static_archive(p)) { assert(CDSConfig::is_dumping_dynamic_archive(), "must be"); - return p - _mapped_static_archive_bottom; + return pointer_delta(p, _mapped_static_archive_bottom, 1); } if (!is_in_buffer_space(p)) { // p must be a "source" address @@ -1008,7 +1008,7 @@ uintx ArchiveBuilder::any_to_offset(address p) const { return buffer_to_offset(p); } -address ArchiveBuilder::offset_to_buffered_address(u4 offset) const { +address ArchiveBuilder::offset_to_buffered_address(size_t offset) const { address requested_addr = _requested_static_archive_bottom + offset; address buffered_addr = requested_addr - _buffer_to_requested_delta; assert(is_in_buffer_space(buffered_addr), "bad offset"); diff --git a/src/hotspot/share/cds/archiveBuilder.hpp b/src/hotspot/share/cds/archiveBuilder.hpp index 2284dbf70f8..b3667ea11b4 100644 --- a/src/hotspot/share/cds/archiveBuilder.hpp +++ b/src/hotspot/share/cds/archiveBuilder.hpp @@ -329,49 +329,22 @@ public: return current()->buffer_to_requested_delta(); } - inline static u4 to_offset_u4(uintx offset) { - guarantee(offset <= MAX_SHARED_DELTA, "must be 32-bit offset " INTPTR_FORMAT, offset); - return (u4)offset; - } - public: - static const uintx MAX_SHARED_DELTA = ArchiveUtils::MAX_SHARED_DELTA;; - // The address p points to an object inside the output buffer. When the archive is mapped // at the requested address, what's the offset of this object from _requested_static_archive_bottom? - uintx buffer_to_offset(address p) const; + size_t buffer_to_offset(address p) const; - // Same as buffer_to_offset, except that the address p points to either (a) an object - // inside the output buffer, or (b), an object in the currently mapped static archive. - uintx any_to_offset(address p) const; + // Same as buffer_to_offset, except that the address p points to one of the following: + // - an object in the ArchiveBuilder's buffer. + // - an object in the currently mapped AOT cache rw/ro regions. + // - an object that has been copied into the ArchiveBuilder's buffer. + size_t any_to_offset(address p) const; // The reverse of buffer_to_offset() - address offset_to_buffered_address(u4 offset) const; + address offset_to_buffered_address(size_t offset) const; template - u4 buffer_to_offset_u4(T p) const { - uintx offset = buffer_to_offset((address)p); - return to_offset_u4(offset); - } - - template - u4 any_to_offset_u4(T p) const { - assert(p != nullptr, "must not be null"); - uintx offset = any_to_offset((address)p); - return to_offset_u4(offset); - } - - template - u4 any_or_null_to_offset_u4(T p) const { - if (p == nullptr) { - return 0; - } else { - return any_to_offset_u4(p); - } - } - - template - T offset_to_buffered(u4 offset) const { + T offset_to_buffered(size_t offset) const { return (T)offset_to_buffered_address(offset); } diff --git a/src/hotspot/share/cds/archiveUtils.cpp b/src/hotspot/share/cds/archiveUtils.cpp index 842668509cf..c13b447bb87 100644 --- a/src/hotspot/share/cds/archiveUtils.cpp +++ b/src/hotspot/share/cds/archiveUtils.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2026, Oracle and/or its affiliates. All rights reserved. * 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 @@ * */ +#include "cds/aotCompressedPointers.hpp" #include "cds/aotLogging.hpp" #include "cds/aotMetaspace.hpp" #include "cds/archiveBuilder.hpp" @@ -201,13 +202,13 @@ char* DumpRegion::expand_top_to(char* newtop) { commit_to(newtop); _top = newtop; - if (_max_delta > 0) { + if (ArchiveBuilder::is_active() && ArchiveBuilder::current()->is_in_buffer_space(_base)) { uintx delta = ArchiveBuilder::current()->buffer_to_offset((address)(newtop-1)); - if (delta > _max_delta) { + if (delta > AOTCompressedPointers::MaxMetadataOffsetBytes) { // This is just a sanity check and should not appear in any real world usage. This // happens only if you allocate more than 2GB of shared objects and would require // millions of shared classes. - aot_log_error(aot)("Out of memory in the CDS archive: Please reduce the number of shared classes."); + aot_log_error(aot)("Out of memory in the %s: Please reduce the number of shared classes.", CDSConfig::type_of_archive_being_written()); AOTMetaspace::unrecoverable_writing_error(); } } @@ -331,9 +332,8 @@ void WriteClosure::do_ptr(void** p) { void ReadClosure::do_ptr(void** p) { assert(*p == nullptr, "initializing previous initialized pointer."); - intptr_t obj = nextPtr(); - assert(obj >= 0, "sanity."); - *p = (obj != 0) ? (void*)(_base_address + obj) : (void*)obj; + u4 narrowp = checked_cast(nextPtr()); + *p = AOTCompressedPointers::decode(cast_from_u4(narrowp), _base_address); } void ReadClosure::do_u4(u4* p) { diff --git a/src/hotspot/share/cds/archiveUtils.hpp b/src/hotspot/share/cds/archiveUtils.hpp index 79d894f0144..e5d1efa5eab 100644 --- a/src/hotspot/share/cds/archiveUtils.hpp +++ b/src/hotspot/share/cds/archiveUtils.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -153,7 +153,6 @@ private: char* _base; char* _top; char* _end; - uintx _max_delta; bool _is_packed; ReservedSpace* _rs; VirtualSpace* _vs; @@ -161,9 +160,9 @@ private: void commit_to(char* newtop); public: - DumpRegion(const char* name, uintx max_delta = 0) + DumpRegion(const char* name) : _name(name), _base(nullptr), _top(nullptr), _end(nullptr), - _max_delta(max_delta), _is_packed(false), + _is_packed(false), _rs(nullptr), _vs(nullptr) {} char* expand_top_to(char* newtop); @@ -237,13 +236,13 @@ public: class ReadClosure : public SerializeClosure { private: intptr_t** _ptr_array; - intptr_t _base_address; + address _base_address; inline intptr_t nextPtr() { return *(*_ptr_array)++; } public: - ReadClosure(intptr_t** ptr_array, intptr_t base_address) : + ReadClosure(intptr_t** ptr_array, address base_address) : _ptr_array(ptr_array), _base_address(base_address) {} void do_ptr(void** p); @@ -260,7 +259,6 @@ class ArchiveUtils { template static Array* archive_ptr_array(GrowableArray* tmp_array); public: - static const uintx MAX_SHARED_DELTA = 0x7FFFFFFF; static void log_to_classlist(BootstrapInfo* bootstrap_specifier, TRAPS) NOT_CDS_RETURN; static bool has_aot_initialized_mirror(InstanceKlass* src_ik); @@ -273,50 +271,6 @@ public: static Array* archive_array(GrowableArray* tmp_array) { return archive_ptr_array(tmp_array); } - - // The following functions translate between a u4 offset and an address in the - // the range of the mapped CDS archive (e.g., Metaspace::in_aot_cache()). - // Since the first 16 bytes in this range are dummy data (see ArchiveBuilder::reserve_buffer()), - // we know that offset 0 never represents a valid object. As a result, an offset of 0 - // is used to encode a nullptr. - // - // Use the "archived_address_or_null" variants if a nullptr may be encoded. - - // offset must represent an object of type T in the mapped shared space. Return - // a direct pointer to this object. - template T static offset_to_archived_address(u4 offset) { - assert(offset != 0, "sanity"); - T p = (T)(SharedBaseAddress + offset); - assert(Metaspace::in_aot_cache(p), "must be"); - return p; - } - - template T static offset_to_archived_address_or_null(u4 offset) { - if (offset == 0) { - return nullptr; - } else { - return offset_to_archived_address(offset); - } - } - - // p must be an archived object. Get its offset from SharedBaseAddress - template static u4 archived_address_to_offset(T p) { - uintx pn = (uintx)p; - uintx base = (uintx)SharedBaseAddress; - assert(Metaspace::in_aot_cache(p), "must be"); - assert(pn > base, "sanity"); // No valid object is stored at 0 offset from SharedBaseAddress - uintx offset = pn - base; - assert(offset <= MAX_SHARED_DELTA, "range check"); - return static_cast(offset); - } - - template static u4 archived_address_or_null_to_offset(T p) { - if (p == nullptr) { - return 0; - } else { - return archived_address_to_offset(p); - } - } }; class HeapRootSegments { diff --git a/src/hotspot/share/cds/dynamicArchive.cpp b/src/hotspot/share/cds/dynamicArchive.cpp index d39cf3775e4..cd6890555d3 100644 --- a/src/hotspot/share/cds/dynamicArchive.cpp +++ b/src/hotspot/share/cds/dynamicArchive.cpp @@ -25,6 +25,7 @@ #include "cds/aotArtifactFinder.hpp" #include "cds/aotClassLinker.hpp" #include "cds/aotClassLocation.hpp" +#include "cds/aotCompressedPointers.hpp" #include "cds/aotLogging.hpp" #include "cds/aotMetaspace.hpp" #include "cds/archiveBuilder.hpp" @@ -75,13 +76,13 @@ public: return 0; } - u4 a_offset = ArchiveBuilder::current()->any_to_offset_u4(a_name); - u4 b_offset = ArchiveBuilder::current()->any_to_offset_u4(b_name); + u4 a_narrowp = cast_to_u4(AOTCompressedPointers::encode_not_null(a_name)); + u4 b_narrowp = cast_to_u4(AOTCompressedPointers::encode_not_null(b_name)); - if (a_offset < b_offset) { + if (a_narrowp < b_narrowp) { return -1; } else { - assert(a_offset > b_offset, "must be"); + assert(a_narrowp > b_narrowp, "must be"); return 1; } } diff --git a/src/hotspot/share/cds/filemap.cpp b/src/hotspot/share/cds/filemap.cpp index 7cd736885ad..a779fcddfcf 100644 --- a/src/hotspot/share/cds/filemap.cpp +++ b/src/hotspot/share/cds/filemap.cpp @@ -298,11 +298,11 @@ void FileMapHeader::print(outputStream* st) { st->print_cr("- compressed_class_ptrs: %d", _compressed_class_ptrs); st->print_cr("- narrow_klass_pointer_bits: %d", _narrow_klass_pointer_bits); st->print_cr("- narrow_klass_shift: %d", _narrow_klass_shift); - st->print_cr("- cloned_vtables_offset: 0x%zx", _cloned_vtables_offset); - st->print_cr("- early_serialized_data_offset: 0x%zx", _early_serialized_data_offset); - st->print_cr("- serialized_data_offset: 0x%zx", _serialized_data_offset); + st->print_cr("- cloned_vtables: %u", cast_to_u4(_cloned_vtables)); + st->print_cr("- early_serialized_data: %u", cast_to_u4(_early_serialized_data)); + st->print_cr("- serialized_data: %u", cast_to_u4(_serialized_data)); st->print_cr("- jvm_ident: %s", _jvm_ident); - st->print_cr("- class_location_config_offset: 0x%zx", _class_location_config_offset); + st->print_cr("- class_location_config: %d", cast_to_u4(_class_location_config)); st->print_cr("- verify_local: %d", _verify_local); st->print_cr("- verify_remote: %d", _verify_remote); st->print_cr("- has_platform_or_app_classes: %d", _has_platform_or_app_classes); @@ -1767,10 +1767,6 @@ void FileMapInfo::print(outputStream* st) const { } } -void FileMapHeader::set_as_offset(char* p, size_t *offset) { - *offset = ArchiveBuilder::current()->any_to_offset((address)p); -} - int FileMapHeader::compute_crc() { char* start = (char*)this; // start computing from the field after _header_size to end of base archive name. diff --git a/src/hotspot/share/cds/filemap.hpp b/src/hotspot/share/cds/filemap.hpp index ec7b58a6d19..56b88df378a 100644 --- a/src/hotspot/share/cds/filemap.hpp +++ b/src/hotspot/share/cds/filemap.hpp @@ -25,6 +25,7 @@ #ifndef SHARE_CDS_FILEMAP_HPP #define SHARE_CDS_FILEMAP_HPP +#include "cds/aotCompressedPointers.hpp" #include "cds/aotMappedHeap.hpp" #include "cds/aotMetaspace.hpp" #include "cds/aotStreamedHeap.hpp" @@ -104,7 +105,7 @@ public: class FileMapHeader: private CDSFileMapHeaderBase { friend class CDSConstants; friend class VMStructs; - + using narrowPtr = AOTCompressedPointers::narrowPtr; private: // The following fields record the states of the VM during dump time. // They are compared with the runtime states to see if the archive @@ -122,16 +123,16 @@ private: bool _compressed_class_ptrs; // save the flag UseCompressedClassPointers int _narrow_klass_pointer_bits; // save number of bits in narrowKlass int _narrow_klass_shift; // save shift width used to pre-compute narrowKlass IDs in archived heap objects - size_t _cloned_vtables_offset; // The address of the first cloned vtable - size_t _early_serialized_data_offset; // Data accessed using {ReadClosure,WriteClosure}::serialize() - size_t _serialized_data_offset; // Data accessed using {ReadClosure,WriteClosure}::serialize() + narrowPtr _cloned_vtables; // The address of the first cloned vtable + narrowPtr _early_serialized_data; // Data accessed using {ReadClosure,WriteClosure}::serialize() + narrowPtr _serialized_data; // Data accessed using {ReadClosure,WriteClosure}::serialize() // The following fields are all sanity checks for whether this archive // will function correctly with this JVM and the bootclasspath it's // invoked with. char _jvm_ident[JVM_IDENT_MAX]; // identifier string of the jvm that created this dump - size_t _class_location_config_offset; + narrowPtr _class_location_config; bool _verify_local; // BytecodeVerificationLocal setting bool _verify_remote; // BytecodeVerificationRemote setting @@ -160,12 +161,8 @@ private: bool _type_profile_casts; int _spec_trap_limit_extra_entries; - template T from_mapped_offset(size_t offset) const { - return (T)(mapped_base_address() + offset); - } - void set_as_offset(char* p, size_t *offset); - template void set_as_offset(T p, size_t *offset) { - set_as_offset((char*)p, offset); + template T decode(narrowPtr narrowp) const { + return AOTCompressedPointers::decode_not_null(narrowp, reinterpret_cast
(mapped_base_address())); } public: @@ -193,9 +190,9 @@ public: bool compact_headers() const { return _compact_headers; } uintx max_heap_size() const { return _max_heap_size; } CompressedOops::Mode narrow_oop_mode() const { return _narrow_oop_mode; } - char* cloned_vtables() const { return from_mapped_offset(_cloned_vtables_offset); } - char* early_serialized_data() const { return from_mapped_offset(_early_serialized_data_offset); } - char* serialized_data() const { return from_mapped_offset(_serialized_data_offset); } + char* cloned_vtables() const { return decode(_cloned_vtables); } + char* early_serialized_data() const { return decode(_early_serialized_data); } + char* serialized_data() const { return decode(_serialized_data); } bool object_streaming_mode() const { return _object_streaming_mode; } const char* jvm_ident() const { return _jvm_ident; } char* requested_base_address() const { return _requested_base_address; } @@ -218,9 +215,9 @@ public: void set_mapped_heap_header(AOTMappedHeapHeader header) { _mapped_heap_header = header; } void set_has_platform_or_app_classes(bool v) { _has_platform_or_app_classes = v; } - void set_cloned_vtables(char* p) { set_as_offset(p, &_cloned_vtables_offset); } - void set_early_serialized_data(char* p) { set_as_offset(p, &_early_serialized_data_offset); } - void set_serialized_data(char* p) { set_as_offset(p, &_serialized_data_offset); } + void set_cloned_vtables(char* p) { _cloned_vtables = AOTCompressedPointers::encode_not_null(p); } + void set_early_serialized_data(char* p) { _early_serialized_data = AOTCompressedPointers::encode_not_null(p); } + void set_serialized_data(char* p) { _serialized_data = AOTCompressedPointers::encode_not_null(p); } void set_mapped_base_address(char* p) { _mapped_base_address = p; } void set_rw_ptrmap_start_pos(size_t n) { _rw_ptrmap_start_pos = n; } void set_ro_ptrmap_start_pos(size_t n) { _ro_ptrmap_start_pos = n; } @@ -228,11 +225,11 @@ public: void copy_base_archive_name(const char* name); void set_class_location_config(AOTClassLocationConfig* table) { - set_as_offset(table, &_class_location_config_offset); + _class_location_config = AOTCompressedPointers::encode_not_null(table); } AOTClassLocationConfig* class_location_config() { - return from_mapped_offset(_class_location_config_offset); + return decode(_class_location_config); } void set_requested_base(char* b) { diff --git a/src/hotspot/share/cds/heapShared.cpp b/src/hotspot/share/cds/heapShared.cpp index 69a098c67b3..c01e6ded25a 100644 --- a/src/hotspot/share/cds/heapShared.cpp +++ b/src/hotspot/share/cds/heapShared.cpp @@ -25,6 +25,7 @@ #include "cds/aotArtifactFinder.hpp" #include "cds/aotClassInitializer.hpp" #include "cds/aotClassLocation.hpp" +#include "cds/aotCompressedPointers.hpp" #include "cds/aotLogging.hpp" #include "cds/aotMappedHeapLoader.hpp" #include "cds/aotMappedHeapWriter.hpp" @@ -1148,8 +1149,7 @@ public: ArchivedKlassSubGraphInfoRecord* record = HeapShared::archive_subgraph_info(&info); Klass* buffered_k = ArchiveBuilder::get_buffered_klass(klass); unsigned int hash = SystemDictionaryShared::hash_for_shared_dictionary((address)buffered_k); - u4 delta = ArchiveBuilder::current()->any_to_offset_u4(record); - _writer->add(hash, delta); + _writer->add(hash, AOTCompressedPointers::encode_not_null(record)); } return true; // keep on iterating } diff --git a/src/hotspot/share/cds/lambdaFormInvokers.cpp b/src/hotspot/share/cds/lambdaFormInvokers.cpp index 19dae28c5b5..3ff5705b79d 100644 --- a/src/hotspot/share/cds/lambdaFormInvokers.cpp +++ b/src/hotspot/share/cds/lambdaFormInvokers.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved. * 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,6 +23,7 @@ */ #include "cds/aotClassFilter.hpp" +#include "cds/aotCompressedPointers.hpp" #include "cds/aotMetaspace.hpp" #include "cds/archiveBuilder.hpp" #include "cds/cdsConfig.hpp" @@ -52,7 +53,7 @@ #include "runtime/mutexLocker.hpp" GrowableArrayCHeap* LambdaFormInvokers::_lambdaform_lines = nullptr; -Array* LambdaFormInvokers::_static_archive_invokers = nullptr; +Array* LambdaFormInvokers::_static_archive_invokers = nullptr; static bool _stop_appending = false; #define NUM_FILTER 4 @@ -252,7 +253,7 @@ void LambdaFormInvokers::dump_static_archive_invokers() { } } if (count > 0) { - _static_archive_invokers = ArchiveBuilder::new_ro_array(count); + _static_archive_invokers = ArchiveBuilder::new_ro_array(count); int index = 0; for (int i = 0; i < len; i++) { char* str = _lambdaform_lines->at(i); @@ -261,7 +262,7 @@ void LambdaFormInvokers::dump_static_archive_invokers() { Array* line = ArchiveBuilder::new_ro_array((int)str_len); strncpy(line->adr_at(0), str, str_len); - _static_archive_invokers->at_put(index, ArchiveBuilder::current()->any_to_offset_u4(line)); + _static_archive_invokers->at_put(index, AOTCompressedPointers::encode_not_null(line)); index++; } } @@ -274,8 +275,8 @@ void LambdaFormInvokers::dump_static_archive_invokers() { void LambdaFormInvokers::read_static_archive_invokers() { if (_static_archive_invokers != nullptr) { for (int i = 0; i < _static_archive_invokers->length(); i++) { - u4 offset = _static_archive_invokers->at(i); - Array* line = ArchiveUtils::offset_to_archived_address*>(offset); + narrowPtr encoded = _static_archive_invokers->at(i); + Array* line = AOTCompressedPointers::decode_not_null*>(encoded); char* str = line->adr_at(0); append(str); } diff --git a/src/hotspot/share/cds/lambdaFormInvokers.hpp b/src/hotspot/share/cds/lambdaFormInvokers.hpp index 583a863a1c2..9b91850f5b1 100644 --- a/src/hotspot/share/cds/lambdaFormInvokers.hpp +++ b/src/hotspot/share/cds/lambdaFormInvokers.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved. * 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,8 @@ #ifndef SHARE_CDS_LAMBDAFORMINVOKERS_HPP #define SHARE_CDS_LAMBDAFORMINVOKERS_HPP + +#include "cds/aotCompressedPointers.hpp" #include "memory/allStatic.hpp" #include "oops/oopHandle.hpp" #include "runtime/handles.hpp" @@ -35,10 +37,11 @@ class Array; class SerializeClosure; class LambdaFormInvokers : public AllStatic { + using narrowPtr = AOTCompressedPointers::narrowPtr; private: static GrowableArrayCHeap* _lambdaform_lines; // For storing LF form lines (LF_RESOLVE only) in read only table. - static Array* _static_archive_invokers; + static Array* _static_archive_invokers; static void regenerate_class(char* name, ClassFileStream& st, TRAPS); public: static void append(char* line); diff --git a/src/hotspot/share/cds/lambdaProxyClassDictionary.cpp b/src/hotspot/share/cds/lambdaProxyClassDictionary.cpp index d091067c116..4d212dbf2c2 100644 --- a/src/hotspot/share/cds/lambdaProxyClassDictionary.cpp +++ b/src/hotspot/share/cds/lambdaProxyClassDictionary.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2026, Oracle and/or its affiliates. All rights reserved. * 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,6 +23,7 @@ */ #include "cds/aotClassFilter.hpp" +#include "cds/aotCompressedPointers.hpp" #include "cds/archiveBuilder.hpp" #include "cds/cdsConfig.hpp" #include "cds/cdsProtectionDomain.hpp" @@ -49,11 +50,11 @@ unsigned int LambdaProxyClassKey::hash() const { } unsigned int RunTimeLambdaProxyClassKey::hash() const { - return primitive_hash(_caller_ik) + - primitive_hash(_invoked_name) + - primitive_hash(_invoked_type) + - primitive_hash(_method_type) + - primitive_hash(_instantiated_method_type); + return primitive_hash(cast_to_u4(_caller_ik)) + + primitive_hash(cast_to_u4(_invoked_name)) + + primitive_hash(cast_to_u4(_invoked_type)) + + primitive_hash(cast_to_u4(_method_type)) + + primitive_hash(cast_to_u4(_instantiated_method_type)); } #ifndef PRODUCT @@ -71,12 +72,12 @@ void LambdaProxyClassKey::print_on(outputStream* st) const { void RunTimeLambdaProxyClassKey::print_on(outputStream* st) const { ResourceMark rm; st->print_cr("LambdaProxyClassKey : " INTPTR_FORMAT " hash: %0x08x", p2i(this), hash()); - st->print_cr("_caller_ik : %d", _caller_ik); - st->print_cr("_instantiated_method_type : %d", _instantiated_method_type); - st->print_cr("_invoked_name : %d", _invoked_name); - st->print_cr("_invoked_type : %d", _invoked_type); - st->print_cr("_member_method : %d", _member_method); - st->print_cr("_method_type : %d", _method_type); + st->print_cr("_caller_ik : %d", cast_to_u4(_caller_ik)); + st->print_cr("_instantiated_method_type : %d", cast_to_u4(_instantiated_method_type)); + st->print_cr("_invoked_name : %d", cast_to_u4(_invoked_name)); + st->print_cr("_invoked_type : %d", cast_to_u4(_invoked_type)); + st->print_cr("_member_method : %d", cast_to_u4(_member_method)); + st->print_cr("_method_type : %d", cast_to_u4(_method_type)); } void RunTimeLambdaProxyClassInfo::print_on(outputStream* st) const { @@ -418,8 +419,7 @@ public: (RunTimeLambdaProxyClassInfo*)ArchiveBuilder::ro_region_alloc(byte_size); runtime_info->init(key, info); unsigned int hash = runtime_info->hash(); - u4 delta = _builder->any_to_offset_u4((void*)runtime_info); - _writer->add(hash, delta); + _writer->add(hash, AOTCompressedPointers::encode_not_null(runtime_info)); return true; } }; diff --git a/src/hotspot/share/cds/lambdaProxyClassDictionary.hpp b/src/hotspot/share/cds/lambdaProxyClassDictionary.hpp index 91e508bfdc5..dfb75532917 100644 --- a/src/hotspot/share/cds/lambdaProxyClassDictionary.hpp +++ b/src/hotspot/share/cds/lambdaProxyClassDictionary.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2026, Oracle and/or its affiliates. All rights reserved. * 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,9 @@ #ifndef SHARE_CDS_LAMBDAPROXYCLASSINFO_HPP #define SHARE_CDS_LAMBDAPROXYCLASSINFO_HPP +#include "cds/aotCompressedPointers.hpp" #include "cds/aotMetaspace.hpp" -#include "cds/archiveBuilder.hpp" +#include "classfile/compactHashtable.hpp" #include "classfile/javaClasses.hpp" #include "memory/metaspaceClosure.hpp" #include "utilities/growableArray.hpp" @@ -132,19 +133,20 @@ public: }; class RunTimeLambdaProxyClassKey { - u4 _caller_ik; - u4 _invoked_name; - u4 _invoked_type; - u4 _method_type; - u4 _member_method; - u4 _instantiated_method_type; + using narrowPtr = AOTCompressedPointers::narrowPtr; + narrowPtr _caller_ik; + narrowPtr _invoked_name; + narrowPtr _invoked_type; + narrowPtr _method_type; + narrowPtr _member_method; + narrowPtr _instantiated_method_type; - RunTimeLambdaProxyClassKey(u4 caller_ik, - u4 invoked_name, - u4 invoked_type, - u4 method_type, - u4 member_method, - u4 instantiated_method_type) : + RunTimeLambdaProxyClassKey(narrowPtr caller_ik, + narrowPtr invoked_name, + narrowPtr invoked_type, + narrowPtr method_type, + narrowPtr member_method, + narrowPtr instantiated_method_type) : _caller_ik(caller_ik), _invoked_name(invoked_name), _invoked_type(invoked_type), @@ -154,15 +156,12 @@ class RunTimeLambdaProxyClassKey { public: static RunTimeLambdaProxyClassKey init_for_dumptime(LambdaProxyClassKey& key) { - assert(ArchiveBuilder::is_active(), "sanity"); - ArchiveBuilder* b = ArchiveBuilder::current(); - - u4 caller_ik = b->any_to_offset_u4(key.caller_ik()); - u4 invoked_name = b->any_to_offset_u4(key.invoked_name()); - u4 invoked_type = b->any_to_offset_u4(key.invoked_type()); - u4 method_type = b->any_to_offset_u4(key.method_type()); - u4 member_method = b->any_or_null_to_offset_u4(key.member_method()); // could be null - u4 instantiated_method_type = b->any_to_offset_u4(key.instantiated_method_type()); + narrowPtr caller_ik = AOTCompressedPointers::encode_not_null(key.caller_ik()); + narrowPtr invoked_name = AOTCompressedPointers::encode_not_null(key.invoked_name()); + narrowPtr invoked_type = AOTCompressedPointers::encode_not_null(key.invoked_type()); + narrowPtr method_type = AOTCompressedPointers::encode_not_null(key.method_type()); + narrowPtr member_method = AOTCompressedPointers::encode(key.member_method()); // could be null + narrowPtr instantiated_method_type = AOTCompressedPointers::encode_not_null(key.instantiated_method_type()); return RunTimeLambdaProxyClassKey(caller_ik, invoked_name, invoked_type, method_type, member_method, instantiated_method_type); @@ -176,12 +175,12 @@ public: Symbol* instantiated_method_type) { // All parameters must be in shared space, or else you'd get an assert in // ArchiveUtils::to_offset(). - return RunTimeLambdaProxyClassKey(ArchiveUtils::archived_address_to_offset(caller_ik), - ArchiveUtils::archived_address_to_offset(invoked_name), - ArchiveUtils::archived_address_to_offset(invoked_type), - ArchiveUtils::archived_address_to_offset(method_type), - ArchiveUtils::archived_address_or_null_to_offset(member_method), // could be null - ArchiveUtils::archived_address_to_offset(instantiated_method_type)); + return RunTimeLambdaProxyClassKey(AOTCompressedPointers::encode_address_in_cache(caller_ik), + AOTCompressedPointers::encode_address_in_cache(invoked_name), + AOTCompressedPointers::encode_address_in_cache(invoked_type), + AOTCompressedPointers::encode_address_in_cache(method_type), + AOTCompressedPointers::encode_address_in_cache_or_null(member_method), // could be null + AOTCompressedPointers::encode_address_in_cache(instantiated_method_type)); } unsigned int hash() const; diff --git a/src/hotspot/share/cds/runTimeClassInfo.cpp b/src/hotspot/share/cds/runTimeClassInfo.cpp index fe940ca6c18..a1f50ab4ffa 100644 --- a/src/hotspot/share/cds/runTimeClassInfo.cpp +++ b/src/hotspot/share/cds/runTimeClassInfo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2026, Oracle and/or its affiliates. All rights reserved. * 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,15 +22,15 @@ * */ +#include "cds/aotCompressedPointers.hpp" #include "cds/archiveBuilder.hpp" #include "cds/dumpTimeClassInfo.hpp" #include "cds/runTimeClassInfo.hpp" #include "classfile/systemDictionaryShared.hpp" void RunTimeClassInfo::init(DumpTimeClassInfo& info) { - ArchiveBuilder* builder = ArchiveBuilder::current(); InstanceKlass* k = info._klass; - _klass_offset = builder->any_to_offset_u4(k); + _klass = AOTCompressedPointers::encode_not_null(k); if (!SystemDictionaryShared::is_builtin(k)) { CrcInfo* c = crc(); @@ -50,8 +50,8 @@ void RunTimeClassInfo::init(DumpTimeClassInfo& info) { RTVerifierConstraint* vf_constraints = verifier_constraints(); char* flags = verifier_constraint_flags(); for (i = 0; i < _num_verifier_constraints; i++) { - vf_constraints[i]._name = builder->any_to_offset_u4(info._verifier_constraints->at(i).name()); - vf_constraints[i]._from_name = builder->any_or_null_to_offset_u4(info._verifier_constraints->at(i).from_name()); + vf_constraints[i]._name = AOTCompressedPointers::encode_not_null(info._verifier_constraints->at(i).name()); + vf_constraints[i]._from_name = AOTCompressedPointers::encode(info._verifier_constraints->at(i).from_name()); } for (i = 0; i < _num_verifier_constraints; i++) { flags[i] = info._verifier_constraint_flags->at(i); @@ -61,14 +61,14 @@ void RunTimeClassInfo::init(DumpTimeClassInfo& info) { if (_num_loader_constraints > 0) { RTLoaderConstraint* ld_constraints = loader_constraints(); for (i = 0; i < _num_loader_constraints; i++) { - ld_constraints[i]._name = builder->any_to_offset_u4(info._loader_constraints->at(i).name()); + ld_constraints[i]._name = AOTCompressedPointers::encode_not_null(info._loader_constraints->at(i).name()); ld_constraints[i]._loader_type1 = info._loader_constraints->at(i).loader_type1(); ld_constraints[i]._loader_type2 = info._loader_constraints->at(i).loader_type2(); } } if (k->is_hidden() && info.nest_host() != nullptr) { - _nest_host_offset = builder->any_to_offset_u4(info.nest_host()); + _nest_host = AOTCompressedPointers::encode_not_null(info.nest_host()); } if (k->has_archived_enum_objs()) { int num = info.num_enum_klass_static_fields(); @@ -83,11 +83,12 @@ void RunTimeClassInfo::init(DumpTimeClassInfo& info) { InstanceKlass* RunTimeClassInfo::klass() const { if (AOTMetaspace::in_aot_cache(this)) { // is inside a mmaped CDS archive. - return ArchiveUtils::offset_to_archived_address(_klass_offset); + return AOTCompressedPointers::decode_not_null(_klass); } else { // is a temporary copy of a RunTimeClassInfo that's being initialized // by the ArchiveBuilder. - return ArchiveBuilder::current()->offset_to_buffered(_klass_offset); + size_t byte_offset = AOTCompressedPointers::get_byte_offset(_klass); + return ArchiveBuilder::current()->offset_to_buffered(byte_offset); } } diff --git a/src/hotspot/share/cds/runTimeClassInfo.hpp b/src/hotspot/share/cds/runTimeClassInfo.hpp index 371924f9065..d63a04698bb 100644 --- a/src/hotspot/share/cds/runTimeClassInfo.hpp +++ b/src/hotspot/share/cds/runTimeClassInfo.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2026, Oracle and/or its affiliates. All rights reserved. * 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 @@ #ifndef SHARE_CDS_RUNTIMECLASSINFO_HPP #define SHARE_CDS_RUNTIMECLASSINFO_HPP +#include "cds/aotCompressedPointers.hpp" #include "cds/aotMetaspace.hpp" #include "cds/archiveBuilder.hpp" #include "cds/archiveUtils.hpp" @@ -41,8 +42,10 @@ class Method; class Symbol; class RunTimeClassInfo { - public: - enum : char { + using narrowPtr = AOTCompressedPointers::narrowPtr; + +public: + enum : char { FROM_FIELD_IS_PROTECTED = 1 << 0, FROM_IS_ARRAY = 1 << 1, FROM_IS_OBJECT = 1 << 2 @@ -56,19 +59,19 @@ class RunTimeClassInfo { // This is different than DumpTimeClassInfo::DTVerifierConstraint. We use // u4 instead of Symbol* to save space on 64-bit CPU. struct RTVerifierConstraint { - u4 _name; - u4 _from_name; - Symbol* name() { return ArchiveUtils::offset_to_archived_address(_name); } + narrowPtr _name; + narrowPtr _from_name; + Symbol* name() { return AOTCompressedPointers::decode_not_null(_name); } Symbol* from_name() { - return (_from_name == 0) ? nullptr : ArchiveUtils::offset_to_archived_address(_from_name); + return AOTCompressedPointers::decode(_from_name); } }; struct RTLoaderConstraint { - u4 _name; + narrowPtr _name; char _loader_type1; char _loader_type2; - Symbol* constraint_name() { return ArchiveUtils::offset_to_archived_address(_name); } + Symbol* constraint_name() { return AOTCompressedPointers::decode_not_null(_name); } }; struct RTEnumKlassStaticFields { int _num; @@ -76,8 +79,8 @@ class RunTimeClassInfo { }; private: - u4 _klass_offset; - u4 _nest_host_offset; + narrowPtr _klass; + narrowPtr _nest_host; int _num_verifier_constraints; int _num_loader_constraints; @@ -185,7 +188,7 @@ public: InstanceKlass* nest_host() { assert(!ArchiveBuilder::is_active(), "not called when dumping archive"); - return ArchiveUtils::offset_to_archived_address_or_null(_nest_host_offset); + return AOTCompressedPointers::decode(_nest_host); // may be null } RTLoaderConstraint* loader_constraints() { diff --git a/src/hotspot/share/classfile/compactHashtable.hpp b/src/hotspot/share/classfile/compactHashtable.hpp index 944fb876521..2fe92be0f6d 100644 --- a/src/hotspot/share/classfile/compactHashtable.hpp +++ b/src/hotspot/share/classfile/compactHashtable.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * 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 @@ #ifndef SHARE_CLASSFILE_COMPACTHASHTABLE_HPP #define SHARE_CLASSFILE_COMPACTHASHTABLE_HPP +#include "cds/aotCompressedPointers.hpp" #include "cds/cds_globals.hpp" #include "oops/array.hpp" #include "oops/symbol.hpp" @@ -123,6 +124,9 @@ public: ~CompactHashtableWriter(); void add(unsigned int hash, u4 encoded_value); + void add(unsigned int hash, AOTCompressedPointers::narrowPtr encoded_value) { + add(hash, cast_to_u4(encoded_value)); + } void dump(SimpleCompactHashtable *cht, const char* table_name); private: @@ -371,11 +375,11 @@ public: // // OffsetCompactHashtable -- This is used to store many types of objects // in the CDS archive. On 64-bit platforms, we save space by using a 32-bit -// offset from the CDS base address. +// narrowPtr from the CDS base address. template -inline V read_value_from_compact_hashtable(address base_address, u4 offset) { - return (V)(base_address + offset); +inline V read_value_from_compact_hashtable(address base_address, u4 narrowp) { + return AOTCompressedPointers::decode_not_null(cast_from_u4(narrowp), base_address); } template < diff --git a/src/hotspot/share/classfile/symbolTable.cpp b/src/hotspot/share/classfile/symbolTable.cpp index c49aa10fa0d..20aa7f0776d 100644 --- a/src/hotspot/share/classfile/symbolTable.cpp +++ b/src/hotspot/share/classfile/symbolTable.cpp @@ -22,6 +22,7 @@ * */ +#include "cds/aotCompressedPointers.hpp" #include "cds/archiveBuilder.hpp" #include "cds/cdsConfig.hpp" #include "cds/dynamicArchive.hpp" @@ -690,7 +691,7 @@ void SymbolTable::copy_shared_symbol_table(GrowableArray* symbols, assert(fixed_hash == hash_symbol((const char*)sym->bytes(), sym->utf8_length(), false), "must not rehash during dumping"); sym->set_permanent(); - writer->add(fixed_hash, builder->buffer_to_offset_u4((address)sym)); + writer->add(fixed_hash, AOTCompressedPointers::encode_not_null(sym)); } } diff --git a/src/hotspot/share/classfile/systemDictionaryShared.cpp b/src/hotspot/share/classfile/systemDictionaryShared.cpp index afc190c36cf..cfb20412ab8 100644 --- a/src/hotspot/share/classfile/systemDictionaryShared.cpp +++ b/src/hotspot/share/classfile/systemDictionaryShared.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2026, Oracle and/or its affiliates. All rights reserved. * 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 @@ #include "cds/aotClassFilter.hpp" #include "cds/aotClassLocation.hpp" +#include "cds/aotCompressedPointers.hpp" #include "cds/aotLogging.hpp" #include "cds/aotMetaspace.hpp" #include "cds/archiveBuilder.hpp" @@ -1282,11 +1283,10 @@ unsigned int SystemDictionaryShared::hash_for_shared_dictionary(address ptr) { class CopySharedClassInfoToArchive : StackObj { CompactHashtableWriter* _writer; bool _is_builtin; - ArchiveBuilder *_builder; public: CopySharedClassInfoToArchive(CompactHashtableWriter* writer, bool is_builtin) - : _writer(writer), _is_builtin(is_builtin), _builder(ArchiveBuilder::current()) {} + : _writer(writer), _is_builtin(is_builtin) {} void do_entry(InstanceKlass* k, DumpTimeClassInfo& info) { if (!info.is_excluded() && info.is_builtin() == _is_builtin) { @@ -1299,11 +1299,10 @@ public: Symbol* name = info._klass->name(); name = ArchiveBuilder::current()->get_buffered_addr(name); hash = SystemDictionaryShared::hash_for_shared_dictionary((address)name); - u4 delta = _builder->buffer_to_offset_u4((address)record); if (_is_builtin && info._klass->is_hidden()) { // skip } else { - _writer->add(hash, delta); + _writer->add(hash, AOTCompressedPointers::encode_not_null(record)); } if (log_is_enabled(Trace, aot, hashtables)) { ResourceMark rm; diff --git a/src/hotspot/share/include/cds.h b/src/hotspot/share/include/cds.h index a7bc896172c..76de42db755 100644 --- a/src/hotspot/share/include/cds.h +++ b/src/hotspot/share/include/cds.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * 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,7 @@ #define CDS_DYNAMIC_ARCHIVE_MAGIC 0xf00baba8 #define CDS_PREIMAGE_ARCHIVE_MAGIC 0xcafea07c #define CDS_GENERIC_HEADER_SUPPORTED_MIN_VERSION 13 -#define CURRENT_CDS_ARCHIVE_VERSION 19 +#define CURRENT_CDS_ARCHIVE_VERSION 20 typedef struct CDSFileMapRegion { int _crc; // CRC checksum of this region. diff --git a/src/hotspot/share/oops/trainingData.cpp b/src/hotspot/share/oops/trainingData.cpp index 1a16fd70e44..f52c22ad38a 100644 --- a/src/hotspot/share/oops/trainingData.cpp +++ b/src/hotspot/share/oops/trainingData.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. * 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 @@ * */ +#include "cds/aotCompressedPointers.hpp" #include "cds/cdsConfig.hpp" #include "ci/ciEnv.hpp" #include "ci/ciMetadata.hpp" @@ -512,8 +513,7 @@ void TrainingData::dump_training_data() { #endif // ASSERT td = ArchiveBuilder::current()->get_buffered_addr(td); uint hash = TrainingData::Key::cds_hash(td->key()); - u4 delta = ArchiveBuilder::current()->buffer_to_offset_u4((address)td); - writer.add(hash, delta); + writer.add(hash, AOTCompressedPointers::encode_not_null(td)); } writer.dump(&_archived_training_data_dictionary_for_dumping, "training data dictionary"); } diff --git a/src/hotspot/share/runtime/sharedRuntime.cpp b/src/hotspot/share/runtime/sharedRuntime.cpp index d426fd31a43..ae3835dd344 100644 --- a/src/hotspot/share/runtime/sharedRuntime.cpp +++ b/src/hotspot/share/runtime/sharedRuntime.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * 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,11 @@ * */ +#include "cds/aotCompressedPointers.hpp" #include "cds/archiveBuilder.hpp" #include "cds/archiveUtils.inline.hpp" #include "classfile/classLoader.hpp" +#include "classfile/compactHashtable.hpp" #include "classfile/javaClasses.inline.hpp" #include "classfile/stringTable.hpp" #include "classfile/vmClasses.hpp" @@ -2933,8 +2935,7 @@ public: assert(buffered_entry != nullptr,"sanity check"); uint hash = fp->compute_hash(); - u4 delta = _builder->buffer_to_offset_u4((address)buffered_entry); - _writer->add(hash, delta); + _writer->add(hash, AOTCompressedPointers::encode_not_null(buffered_entry)); if (lsh.is_enabled()) { address fp_runtime_addr = (address)buffered_fp + ArchiveBuilder::current()->buffer_to_requested_delta(); address entry_runtime_addr = (address)buffered_entry + ArchiveBuilder::current()->buffer_to_requested_delta(); diff --git a/src/hotspot/share/runtime/sharedRuntime.hpp b/src/hotspot/share/runtime/sharedRuntime.hpp index 11bd39c839f..a026a4b7d69 100644 --- a/src/hotspot/share/runtime/sharedRuntime.hpp +++ b/src/hotspot/share/runtime/sharedRuntime.hpp @@ -25,7 +25,6 @@ #ifndef SHARE_RUNTIME_SHAREDRUNTIME_HPP #define SHARE_RUNTIME_SHAREDRUNTIME_HPP -#include "classfile/compactHashtable.hpp" #include "code/codeBlob.hpp" #include "code/vmreg.hpp" #include "interpreter/linkResolver.hpp" @@ -38,6 +37,7 @@ class AdapterHandlerEntry; class AdapterFingerPrint; class MetaspaceClosure; +class SerializeClosure; class vframeStream; // Runtime is the base class for various runtime interfaces diff --git a/src/hotspot/share/runtime/vmStructs.cpp b/src/hotspot/share/runtime/vmStructs.cpp index f65a3441bf4..1bbef8537ff 100644 --- a/src/hotspot/share/runtime/vmStructs.cpp +++ b/src/hotspot/share/runtime/vmStructs.cpp @@ -22,6 +22,7 @@ * */ +#include "cds/aotCompressedPointers.hpp" #include "cds/filemap.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "classfile/javaClasses.hpp" @@ -762,7 +763,7 @@ CDS_ONLY(nonstatic_field(FileMapInfo, _header, FileMapHeader*)) \ CDS_ONLY( static_field(FileMapInfo, _current_info, FileMapInfo*)) \ CDS_ONLY(nonstatic_field(FileMapHeader, _regions[0], CDSFileMapRegion)) \ - CDS_ONLY(nonstatic_field(FileMapHeader, _cloned_vtables_offset, size_t)) \ + CDS_ONLY(nonstatic_field(FileMapHeader, _cloned_vtables, AOTCompressedPointers::narrowPtr)) \ CDS_ONLY(nonstatic_field(FileMapHeader, _mapped_base_address, char*)) \ CDS_ONLY(nonstatic_field(CDSFileMapRegion, _mapped_base, char*)) \ CDS_ONLY(nonstatic_field(CDSFileMapRegion, _used, size_t)) \ @@ -1203,6 +1204,7 @@ \ /* all enum types */ \ \ + declare_integer_type(AOTCompressedPointers::narrowPtr) \ declare_integer_type(Bytecodes::Code) \ declare_integer_type(InstanceKlass::ClassState) \ declare_integer_type(JavaThreadState) \ diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/memory/FileMapInfo.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/memory/FileMapInfo.java index 94200e31b7e..14d8af58e4d 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/memory/FileMapInfo.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/memory/FileMapInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -97,10 +97,12 @@ public class FileMapInfo { headerObj = VMObjectFactory.newObject(FileMapHeader.class, header); // char* mapped_base_address = header->_mapped_base_address - // size_t cloned_vtable_offset = header->_cloned_vtable_offset + // narrowPtr cloned_vtable_narrowPtr = header->_cloned_vtable_offset + // size_t cloned_vtable_offset = AOTCompressedPointers::get_byte_offset(cloned_vtable_narrowPtr); // CppVtableInfo** vtablesIndex = mapped_base_address + cloned_vtable_offset; mapped_base_address = get_AddressField(FileMapHeader_type, header, "_mapped_base_address"); - long cloned_vtable_offset = get_CIntegerField(FileMapHeader_type, header, "_cloned_vtables_offset"); + long cloned_vtable_narrowPtr = get_CIntegerField(FileMapHeader_type, header, "_cloned_vtables"); + long cloned_vtable_offset = cloned_vtable_narrowPtr; // Currently narrowPtr is the same as offset vtablesIndex = mapped_base_address.addOffsetTo(cloned_vtable_offset); // CDSFileMapRegion* rw_region = &header->_region[rw]; From 961d32842d7841701a33659493a84b4d2c4d2f82 Mon Sep 17 00:00:00 2001 From: Jesper Wilhelmsson Date: Wed, 11 Feb 2026 23:31:23 +0000 Subject: [PATCH 076/120] 8377509: Add licenses for gcc 14.2.0 Reviewed-by: dholmes --- src/java.base/share/legal/gcc.md | 2084 ++++++++++++++++++++++++++++++ 1 file changed, 2084 insertions(+) create mode 100644 src/java.base/share/legal/gcc.md diff --git a/src/java.base/share/legal/gcc.md b/src/java.base/share/legal/gcc.md new file mode 100644 index 00000000000..b78ca12caa9 --- /dev/null +++ b/src/java.base/share/legal/gcc.md @@ -0,0 +1,2084 @@ +## GCC - libgcc and libstdc++ 14.2.0 + +### GNU GENERAL PUBLIC LICENSE v3 + +``` + Version 3, 29 June 2007 + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + Preamble + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + The precise terms and conditions for copying, distribution and +modification follow. + TERMS AND CONDITIONS + 0. Definitions. + "This License" refers to version 3 of the GNU General Public License. + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + A "covered work" means either the unmodified Program or a work based +on the Program. + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + 1. Source Code. + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + The Corresponding Source for a work in source code form is that +same work. + 2. Basic Permissions. + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + 4. Conveying Verbatim Copies. + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + 5. Conveying Modified Source Versions. + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + 6. Conveying Non-Source Forms. + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + 7. Additional Terms. + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + 8. Termination. + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + 9. Acceptance Not Required for Having Copies. + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + 10. Automatic Licensing of Downstream Recipients. + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + 11. Patents. + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + 12. No Surrender of Others' Freedom. + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + 13. Use with the GNU Affero General Public License. + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + 14. Revised Versions of this License. + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + 15. Disclaimer of Warranty. + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + 16. Limitation of Liability. + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + 17. Interpretation of Sections 15 and 16. + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + END OF TERMS AND CONDITIONS + How to Apply These Terms to Your New Programs + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + Copyright (C) + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program 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 for more details. + You should have received a copy of the GNU General Public License + along with this program. If not, see . +Also add information on how to contact you by electronic and paper mail. + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. +``` + +### GCC RUNTIME LIBRARY EXCEPTION v3.1 + +``` +Version 3.1, 31 March 2009 +Copyright (C) 2009 Free Software Foundation, Inc. +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. +This GCC Runtime Library Exception ("Exception") is an additional +permission under section 7 of the GNU General Public License, version +3 ("GPLv3"). It applies to a given file (the "Runtime Library") that +bears a notice placed by the copyright holder of the file stating that +the file is governed by GPLv3 along with this Exception. +When you use GCC to compile a program, GCC may combine portions of +certain GCC header files and runtime libraries with the compiled +program. The purpose of this Exception is to allow compilation of +non-GPL (including proprietary) programs to use, in this way, the +header files and runtime libraries covered by this Exception. +0. Definitions. +A file is an "Independent Module" if it either requires the Runtime +Library for execution after a Compilation Process, or makes use of an +interface provided by the Runtime Library, but is not otherwise based +on the Runtime Library. +"GCC" means a version of the GNU Compiler Collection, with or without +modifications, governed by version 3 (or a specified later version) of +the GNU General Public License (GPL) with the option of using any +subsequent versions published by the FSF. +"GPL-compatible Software" is software whose conditions of propagation, +modification and use would permit combination with GCC in accord with +the license of GCC. +"Target Code" refers to output from any compiler for a real or virtual +target processor architecture, in executable form or suitable for +input to an assembler, loader, linker and/or execution +phase. Notwithstanding that, Target Code does not include data in any +format that is used as a compiler intermediate representation, or used +for producing a compiler intermediate representation. +The "Compilation Process" transforms code entirely represented in +non-intermediate languages designed for human-written code, and/or in +Java Virtual Machine byte code, into Target Code. Thus, for example, +use of source code generators and preprocessors need not be considered +part of the Compilation Process, since the Compilation Process can be +understood as starting with the output of the generators or +preprocessors. +A Compilation Process is "Eligible" if it is done using GCC, alone or +with other GPL-compatible software, or if it is done without using any +work based on GCC. For example, using non-GPL-compatible Software to +optimize any GCC intermediate representations would not qualify as an +Eligible Compilation Process. +1. Grant of Additional Permission. +You have permission to propagate a work of Target Code formed by +combining the Runtime Library with Independent Modules, even if such +propagation would otherwise violate the terms of GPLv3, provided that +all Target Code was generated by Eligible Compilation Processes. You +may then convey such a combination under terms of your choice, +consistent with the licensing of the Independent Modules. +2. No Weakening of GCC Copyleft. +The availability of this Exception does not imply any general +presumption that third-party software is unaffected by the copyleft +requirements of the license of GCC. +``` + +### GNU GENERAL PUBLIC LICENSE v2 + +``` + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + Preamble + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + NO WARRANTY + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + Copyright (C) + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + This program 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 for more details. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +Also add information on how to contact you by electronic and paper mail. +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + , 1 April 1989 + Ty Coon, President of Vice +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. +``` + +### GNU LESSER GENERAL PUBLIC LICENSE v3 + +``` + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + 0. Additional Definitions. + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + 1. Exception to Section 3 of the GNU GPL. + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + 2. Conveying Modified Versions. + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + 3. Object Code Incorporating Material from Library Header Files. + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + b) Accompany the object code with a copy of the GNU GPL and this license + document. + 4. Combined Works. + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + d) Do one of the following: + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + 5. Combined Libraries. + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + 6. Revised Versions of the GNU Lesser General Public License. + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. +``` + +### GNU LESSER GENERAL PUBLIC LICENSE v2.1 + +``` + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + Preamble + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations +below. + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it +becomes a de-facto standard. To achieve this, non-free programs must +be allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control +compilation and installation of the library. + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + a) The modified work must itself be a software library. + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + c) Accompany the work with a written offer, valid for at least + three years, to give the same user the materials specified in + Subsection 6a, above, for a charge no more than the cost of + performing this distribution. + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply, and the section as a whole is intended to apply in other +circumstances. +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License +may add an explicit geographical distribution limitation excluding those +countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + NO WARRANTY + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms +of the ordinary General Public License). + To apply these terms, attach the following notices to the library. +It is safest to attach them to the start of each source file to most +effectively convey the exclusion of warranty; and each file should +have at least the "copyright" line and a pointer to where the full +notice is found. + + Copyright (C) + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + This library 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 + Lesser General Public License for more details. + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +Also add information on how to contact you by electronic and paper mail. +You should also get your employer (if you work as a programmer) or +your school, if any, to sign a "copyright disclaimer" for the library, +if necessary. Here is a sample; alter the names: + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James + Random Hacker. + , 1 April 1990 + Ty Coon, President of Vice +That's all there is to it! +``` + +### GNU Free Documentation License v1.3 + +``` + GNU Free Documentation License + Version 1.3, 3 November 2008 + Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. +0. PREAMBLE +The purpose of this License is to make a manual, textbook, or other +functional and useful document "free" in the sense of freedom: to +assure everyone the effective freedom to copy and redistribute it, +with or without modifying it, either commercially or noncommercially. +Secondarily, this License preserves for the author and publisher a way +to get credit for their work, while not being considered responsible +for modifications made by others. +This License is a kind of "copyleft", which means that derivative +works of the document must themselves be free in the same sense. It +complements the GNU General Public License, which is a copyleft +license designed for free software. +We have designed this License in order to use it for manuals for free +software, because free software needs free documentation: a free +program should come with manuals providing the same freedoms that the +software does. But this License is not limited to software manuals; +it can be used for any textual work, regardless of subject matter or +whether it is published as a printed book. We recommend this License +principally for works whose purpose is instruction or reference. +1. APPLICABILITY AND DEFINITIONS +This License applies to any manual or other work, in any medium, that +contains a notice placed by the copyright holder saying it can be +distributed under the terms of this License. Such a notice grants a +world-wide, royalty-free license, unlimited in duration, to use that +work under the conditions stated herein. The "Document", below, +refers to any such manual or work. Any member of the public is a +licensee, and is addressed as "you". You accept the license if you +copy, modify or distribute the work in a way requiring permission +under copyright law. +A "Modified Version" of the Document means any work containing the +Document or a portion of it, either copied verbatim, or with +modifications and/or translated into another language. +A "Secondary Section" is a named appendix or a front-matter section of +the Document that deals exclusively with the relationship of the +publishers or authors of the Document to the Document's overall +subject (or to related matters) and contains nothing that could fall +directly within that overall subject. (Thus, if the Document is in +part a textbook of mathematics, a Secondary Section may not explain +any mathematics.) The relationship could be a matter of historical +connection with the subject or with related matters, or of legal, +commercial, philosophical, ethical or political position regarding +them. +The "Invariant Sections" are certain Secondary Sections whose titles +are designated, as being those of Invariant Sections, in the notice +that says that the Document is released under this License. If a +section does not fit the above definition of Secondary then it is not +allowed to be designated as Invariant. The Document may contain zero +Invariant Sections. If the Document does not identify any Invariant +Sections then there are none. +The "Cover Texts" are certain short passages of text that are listed, +as Front-Cover Texts or Back-Cover Texts, in the notice that says that +the Document is released under this License. A Front-Cover Text may +be at most 5 words, and a Back-Cover Text may be at most 25 words. +A "Transparent" copy of the Document means a machine-readable copy, +represented in a format whose specification is available to the +general public, that is suitable for revising the document +straightforwardly with generic text editors or (for images composed of +pixels) generic paint programs or (for drawings) some widely available +drawing editor, and that is suitable for input to text formatters or +for automatic translation to a variety of formats suitable for input +to text formatters. A copy made in an otherwise Transparent file +format whose markup, or absence of markup, has been arranged to thwart +or discourage subsequent modification by readers is not Transparent. +An image format is not Transparent if used for any substantial amount +of text. A copy that is not "Transparent" is called "Opaque". +Examples of suitable formats for Transparent copies include plain +ASCII without markup, Texinfo input format, LaTeX input format, SGML +or XML using a publicly available DTD, and standard-conforming simple +HTML, PostScript or PDF designed for human modification. Examples of +transparent image formats include PNG, XCF and JPG. Opaque formats +include proprietary formats that can be read and edited only by +proprietary word processors, SGML or XML for which the DTD and/or +processing tools are not generally available, and the +machine-generated HTML, PostScript or PDF produced by some word +processors for output purposes only. +The "Title Page" means, for a printed book, the title page itself, +plus such following pages as are needed to hold, legibly, the material +this License requires to appear in the title page. For works in +formats which do not have any title page as such, "Title Page" means +the text near the most prominent appearance of the work's title, +preceding the beginning of the body of the text. +The "publisher" means any person or entity that distributes copies of +the Document to the public. +A section "Entitled XYZ" means a named subunit of the Document whose +title either is precisely XYZ or contains XYZ in parentheses following +text that translates XYZ in another language. (Here XYZ stands for a +specific section name mentioned below, such as "Acknowledgements", +"Dedications", "Endorsements", or "History".) To "Preserve the Title" +of such a section when you modify the Document means that it remains a +section "Entitled XYZ" according to this definition. +The Document may include Warranty Disclaimers next to the notice which +states that this License applies to the Document. These Warranty +Disclaimers are considered to be included by reference in this +License, but only as regards disclaiming warranties: any other +implication that these Warranty Disclaimers may have is void and has +no effect on the meaning of this License. +2. VERBATIM COPYING +You may copy and distribute the Document in any medium, either +commercially or noncommercially, provided that this License, the +copyright notices, and the license notice saying this License applies +to the Document are reproduced in all copies, and that you add no +other conditions whatsoever to those of this License. You may not use +technical measures to obstruct or control the reading or further +copying of the copies you make or distribute. However, you may accept +compensation in exchange for copies. If you distribute a large enough +number of copies you must also follow the conditions in section 3. +You may also lend copies, under the same conditions stated above, and +you may publicly display copies. +3. COPYING IN QUANTITY +If you publish printed copies (or copies in media that commonly have +printed covers) of the Document, numbering more than 100, and the +Document's license notice requires Cover Texts, you must enclose the +copies in covers that carry, clearly and legibly, all these Cover +Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on +the back cover. Both covers must also clearly and legibly identify +you as the publisher of these copies. The front cover must present +the full title with all words of the title equally prominent and +visible. You may add other material on the covers in addition. +Copying with changes limited to the covers, as long as they preserve +the title of the Document and satisfy these conditions, can be treated +as verbatim copying in other respects. +If the required texts for either cover are too voluminous to fit +legibly, you should put the first ones listed (as many as fit +reasonably) on the actual cover, and continue the rest onto adjacent +pages. +If you publish or distribute Opaque copies of the Document numbering +more than 100, you must either include a machine-readable Transparent +copy along with each Opaque copy, or state in or with each Opaque copy +a computer-network location from which the general network-using +public has access to download using public-standard network protocols +a complete Transparent copy of the Document, free of added material. +If you use the latter option, you must take reasonably prudent steps, +when you begin distribution of Opaque copies in quantity, to ensure +that this Transparent copy will remain thus accessible at the stated +location until at least one year after the last time you distribute an +Opaque copy (directly or through your agents or retailers) of that +edition to the public. +It is requested, but not required, that you contact the authors of the +Document well before redistributing any large number of copies, to +give them a chance to provide you with an updated version of the +Document. +4. MODIFICATIONS +You may copy and distribute a Modified Version of the Document under +the conditions of sections 2 and 3 above, provided that you release +the Modified Version under precisely this License, with the Modified +Version filling the role of the Document, thus licensing distribution +and modification of the Modified Version to whoever possesses a copy +of it. In addition, you must do these things in the Modified Version: +A. Use in the Title Page (and on the covers, if any) a title distinct + from that of the Document, and from those of previous versions + (which should, if there were any, be listed in the History section + of the Document). You may use the same title as a previous version + if the original publisher of that version gives permission. +B. List on the Title Page, as authors, one or more persons or entities + responsible for authorship of the modifications in the Modified + Version, together with at least five of the principal authors of the + Document (all of its principal authors, if it has fewer than five), + unless they release you from this requirement. +C. State on the Title page the name of the publisher of the + Modified Version, as the publisher. +D. Preserve all the copyright notices of the Document. +E. Add an appropriate copyright notice for your modifications + adjacent to the other copyright notices. +F. Include, immediately after the copyright notices, a license notice + giving the public permission to use the Modified Version under the + terms of this License, in the form shown in the Addendum below. +G. Preserve in that license notice the full lists of Invariant Sections + and required Cover Texts given in the Document's license notice. +H. Include an unaltered copy of this License. +I. Preserve the section Entitled "History", Preserve its Title, and add + to it an item stating at least the title, year, new authors, and + publisher of the Modified Version as given on the Title Page. If + there is no section Entitled "History" in the Document, create one + stating the title, year, authors, and publisher of the Document as + given on its Title Page, then add an item describing the Modified + Version as stated in the previous sentence. +J. Preserve the network location, if any, given in the Document for + public access to a Transparent copy of the Document, and likewise + the network locations given in the Document for previous versions + it was based on. These may be placed in the "History" section. + You may omit a network location for a work that was published at + least four years before the Document itself, or if the original + publisher of the version it refers to gives permission. +K. For any section Entitled "Acknowledgements" or "Dedications", + Preserve the Title of the section, and preserve in the section all + the substance and tone of each of the contributor acknowledgements + and/or dedications given therein. +L. Preserve all the Invariant Sections of the Document, + unaltered in their text and in their titles. Section numbers + or the equivalent are not considered part of the section titles. +M. Delete any section Entitled "Endorsements". Such a section + may not be included in the Modified Version. +N. Do not retitle any existing section to be Entitled "Endorsements" + or to conflict in title with any Invariant Section. +O. Preserve any Warranty Disclaimers. +If the Modified Version includes new front-matter sections or +appendices that qualify as Secondary Sections and contain no material +copied from the Document, you may at your option designate some or all +of these sections as invariant. To do this, add their titles to the +list of Invariant Sections in the Modified Version's license notice. +These titles must be distinct from any other section titles. +You may add a section Entitled "Endorsements", provided it contains +nothing but endorsements of your Modified Version by various +parties--for example, statements of peer review or that the text has +been approved by an organization as the authoritative definition of a +standard. +You may add a passage of up to five words as a Front-Cover Text, and a +passage of up to 25 words as a Back-Cover Text, to the end of the list +of Cover Texts in the Modified Version. Only one passage of +Front-Cover Text and one of Back-Cover Text may be added by (or +through arrangements made by) any one entity. If the Document already +includes a cover text for the same cover, previously added by you or +by arrangement made by the same entity you are acting on behalf of, +you may not add another; but you may replace the old one, on explicit +permission from the previous publisher that added the old one. +The author(s) and publisher(s) of the Document do not by this License +give permission to use their names for publicity for or to assert or +imply endorsement of any Modified Version. +5. COMBINING DOCUMENTS +You may combine the Document with other documents released under this +License, under the terms defined in section 4 above for modified +versions, provided that you include in the combination all of the +Invariant Sections of all of the original documents, unmodified, and +list them all as Invariant Sections of your combined work in its +license notice, and that you preserve all their Warranty Disclaimers. +The combined work need only contain one copy of this License, and +multiple identical Invariant Sections may be replaced with a single +copy. If there are multiple Invariant Sections with the same name but +different contents, make the title of each such section unique by +adding at the end of it, in parentheses, the name of the original +author or publisher of that section if known, or else a unique number. +Make the same adjustment to the section titles in the list of +Invariant Sections in the license notice of the combined work. +In the combination, you must combine any sections Entitled "History" +in the various original documents, forming one section Entitled +"History"; likewise combine any sections Entitled "Acknowledgements", +and any sections Entitled "Dedications". You must delete all sections +Entitled "Endorsements". +6. COLLECTIONS OF DOCUMENTS +You may make a collection consisting of the Document and other +documents released under this License, and replace the individual +copies of this License in the various documents with a single copy +that is included in the collection, provided that you follow the rules +of this License for verbatim copying of each of the documents in all +other respects. +You may extract a single document from such a collection, and +distribute it individually under this License, provided you insert a +copy of this License into the extracted document, and follow this +License in all other respects regarding verbatim copying of that +document. +7. AGGREGATION WITH INDEPENDENT WORKS +A compilation of the Document or its derivatives with other separate +and independent documents or works, in or on a volume of a storage or +distribution medium, is called an "aggregate" if the copyright +resulting from the compilation is not used to limit the legal rights +of the compilation's users beyond what the individual works permit. +When the Document is included in an aggregate, this License does not +apply to the other works in the aggregate which are not themselves +derivative works of the Document. +If the Cover Text requirement of section 3 is applicable to these +copies of the Document, then if the Document is less than one half of +the entire aggregate, the Document's Cover Texts may be placed on +covers that bracket the Document within the aggregate, or the +electronic equivalent of covers if the Document is in electronic form. +Otherwise they must appear on printed covers that bracket the whole +aggregate. +8. TRANSLATION +Translation is considered a kind of modification, so you may +distribute translations of the Document under the terms of section 4. +Replacing Invariant Sections with translations requires special +permission from their copyright holders, but you may include +translations of some or all Invariant Sections in addition to the +original versions of these Invariant Sections. You may include a +translation of this License, and all the license notices in the +Document, and any Warranty Disclaimers, provided that you also include +the original English version of this License and the original versions +of those notices and disclaimers. In case of a disagreement between +the translation and the original version of this License or a notice +or disclaimer, the original version will prevail. +If a section in the Document is Entitled "Acknowledgements", +"Dedications", or "History", the requirement (section 4) to Preserve +its Title (section 1) will typically require changing the actual +title. +9. TERMINATION +You may not copy, modify, sublicense, or distribute the Document +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense, or distribute it is void, and +will automatically terminate your rights under this License. +However, if you cease all violation of this License, then your license +from a particular copyright holder is reinstated (a) provisionally, +unless and until the copyright holder explicitly and finally +terminates your license, and (b) permanently, if the copyright holder +fails to notify you of the violation by some reasonable means prior to +60 days after the cessation. +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, receipt of a copy of some or all of the same material does +not give you any rights to use it. +10. FUTURE REVISIONS OF THIS LICENSE +The Free Software Foundation may publish new, revised versions of the +GNU Free Documentation License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in +detail to address new problems or concerns. See +http://www.gnu.org/copyleft/. +Each version of the License is given a distinguishing version number. +If the Document specifies that a particular numbered version of this +License "or any later version" applies to it, you have the option of +following the terms and conditions either of that specified version or +of any later version that has been published (not as a draft) by the +Free Software Foundation. If the Document does not specify a version +number of this License, you may choose any version ever published (not +as a draft) by the Free Software Foundation. If the Document +specifies that a proxy can decide which future versions of this +License can be used, that proxy's public statement of acceptance of a +version permanently authorizes you to choose that version for the +Document. +11. RELICENSING +"Massive Multiauthor Collaboration Site" (or "MMC Site") means any +World Wide Web server that publishes copyrightable works and also +provides prominent facilities for anybody to edit those works. A +public wiki that anybody can edit is an example of such a server. A +"Massive Multiauthor Collaboration" (or "MMC") contained in the site +means any set of copyrightable works thus published on the MMC site. +"CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0 +license published by Creative Commons Corporation, a not-for-profit +corporation with a principal place of business in San Francisco, +California, as well as future copyleft versions of that license +published by that same organization. +"Incorporate" means to publish or republish a Document, in whole or in +part, as part of another Document. +An MMC is "eligible for relicensing" if it is licensed under this +License, and if all works that were first published under this License +somewhere other than this MMC, and subsequently incorporated in whole or +in part into the MMC, (1) had no cover texts or invariant sections, and +(2) were thus incorporated prior to November 1, 2008. +The operator of an MMC Site may republish an MMC contained in the site +under CC-BY-SA on the same site at any time before August 1, 2009, +provided the MMC is eligible for relicensing. +ADDENDUM: How to use this License for your documents +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and +license notices just after the title page: + Copyright (c) YEAR YOUR NAME. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.3 + or any later version published by the Free Software Foundation; + with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. + A copy of the license is included in the section entitled "GNU + Free Documentation License". +If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, +replace the "with...Texts." line with this: + with the Invariant Sections being LIST THEIR TITLES, with the + Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. +If you have Invariant Sections without Cover Texts, or some other +combination of the three, merge those two alternatives to suit the +situation. +If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, +to permit their use in free software. +``` + +### The Regents of the University of California + +``` +/*- + * Copyright (c) 1991 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. [rescinded 22 July 1999] + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +``` + +### The Go Authors + +``` +Copyright (c) 2009 The Go Authors. All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +``` + +### Apache License v2.0 + +``` + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + 1. Definitions. + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + END OF TERMS AND CONDITIONS + APPENDIX: How to apply the Apache License to your work. + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + Copyright [yyyy] [name of copyright owner] + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +``` + From 370929f8268a859071d111f44ad1cb6fbceb31d7 Mon Sep 17 00:00:00 2001 From: Chen Liang Date: Wed, 11 Feb 2026 23:44:43 +0000 Subject: [PATCH 077/120] 8377601: JavacTemplateTestBase not reporting javac crashes Reviewed-by: vromero --- .../tools/javac/combo/JavacTemplateTestBase.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/test/langtools/lib/combo/tools/javac/combo/JavacTemplateTestBase.java b/test/langtools/lib/combo/tools/javac/combo/JavacTemplateTestBase.java index dd3f5639c21..ed5936210a8 100644 --- a/test/langtools/lib/combo/tools/javac/combo/JavacTemplateTestBase.java +++ b/test/langtools/lib/combo/tools/javac/combo/JavacTemplateTestBase.java @@ -237,19 +237,17 @@ public abstract class JavacTemplateTestBase { if (classpaths.size() > 0) fm.setLocation(StandardLocation.CLASS_PATH, classpaths); JavacTask ct = (JavacTask) systemJavaCompiler.getTask(null, fm, diags, compileOptions, null, files); + File destDir; if (generate) { - File destDir = new File(root, Integer.toString(counter.incrementAndGet())); + destDir = new File(root, Integer.toString(counter.incrementAndGet())); // @@@ Assert that this directory didn't exist, or start counter at max+1 destDir.mkdirs(); fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(destDir)); - ct.generate(); - return destDir; - } - else { - ct.call(); - // Failed result will show up in diags - return nullDir; + } else { + destDir = nullDir; } + ct.generate(); // throws ISE if javac crashes + return destDir; } } From 24f67917c28a71fec1e4641b5b5ac0ff6a75d5a2 Mon Sep 17 00:00:00 2001 From: Yasumasa Suenaga Date: Thu, 12 Feb 2026 01:58:22 +0000 Subject: [PATCH 078/120] 8374577: Heap dump from core does not contain HPROF_GC_ROOT_JAVA_FRAME Reviewed-by: cjplummer, amenkov, kevinw, aturbanov --- .../hotspot/interpreter/OopMapCacheEntry.java | 4 +- .../sun/jvm/hotspot/oops/ConstantPool.java | 9 ++-- .../hotspot/runtime/InterpretedVFrame.java | 46 +++++++++---------- .../hotspot/utilities/HeapHprofBinWriter.java | 29 +++++++++++- .../serviceability/sa/ClhsdbDumpheap.java | 18 +++++++- 5 files changed, 75 insertions(+), 31 deletions(-) diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/OopMapCacheEntry.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/OopMapCacheEntry.java index 75d9589a74f..fda97b4f337 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/OopMapCacheEntry.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/OopMapCacheEntry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -96,7 +96,7 @@ public class OopMapCacheEntry { Method method() { return method; } int bci() { return bci; } - int numberOfEntries() { return maskSize; } + public int numberOfEntries() { return maskSize; } boolean entryAt(int offset) { return mask.at(offset); } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ConstantPool.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ConstantPool.java index 3a4ea5546a1..9d19a1d7df1 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ConstantPool.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ConstantPool.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -253,13 +253,16 @@ public class ConstantPool extends Metadata implements ClassConstants { return res; } + private int invokedynamicBootstrapRefIndexAt(int indyIndex) { + return getCache().getIndyEntryAt(indyIndex).getConstantPoolIndex(); + } + // Translate index, which could be CPCache index or Indy index, to a constant pool index public int to_cp_index(int index, int code) { Assert.that(getCache() != null, "'index' is a rewritten index so this class must have been rewritten"); switch(code) { case Bytecodes._invokedynamic: - int poolIndex = getCache().getIndyEntryAt(index).getConstantPoolIndex(); - return invokeDynamicNameAndTypeRefIndexAt(poolIndex); + return invokedynamicBootstrapRefIndexAt(index); case Bytecodes._getfield: case Bytecodes._getstatic: case Bytecodes._putfield: diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/InterpretedVFrame.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/InterpretedVFrame.java index 75750548ef5..ae9c048f9d7 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/InterpretedVFrame.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/InterpretedVFrame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. * 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,21 +37,18 @@ public class InterpretedVFrame extends JavaVFrame { } public StackValueCollection getLocals() { - Method m = getMethod(); - - int length = (int) m.getMaxLocals(); - - if (m.isNative()) { - // If the method is native, getMaxLocals is not telling the truth. - // maxlocals then equals the size of parameters - length = (int) m.getSizeOfParameters(); - } - - StackValueCollection result = new StackValueCollection(length); - // Get oopmap describing oops and int for current bci OopMapCacheEntry oopMask = getMethod().getMaskFor(getBCI()); + // If the method is native, method()->max_locals() is not telling the truth. + // For our purposes, max locals instead equals the size of parameters. + Method method = getMethod(); + int maxLocals = method.isNative() ? (int)method.getSizeOfParameters() : (int)method.getMaxLocals(); + + int length = maxLocals; + + StackValueCollection result = new StackValueCollection(length); + // handle locals for(int i = 0; i < length; i++) { // Find stack location @@ -74,26 +71,27 @@ public class InterpretedVFrame extends JavaVFrame { } public StackValueCollection getExpressions() { - int length = getFrame().getInterpreterFrameExpressionStackSize(); - - if (getMethod().isNative()) { - // If the method is native, there is no expression stack - length = 0; - } - - int nofLocals = (int) getMethod().getMaxLocals(); - StackValueCollection result = new StackValueCollection(length); - // Get oopmap describing oops and int for current bci OopMapCacheEntry oopMask = getMethod().getMaskFor(getBCI()); + int maskLen = oopMask.numberOfEntries(); + + // If the method is native, method()->max_locals() is not telling the truth. + // For our purposes, max locals instead equals the size of parameters. + Method method = getMethod(); + int maxLocals = method.isNative() ? (int)method.getSizeOfParameters() : (int)method.getMaxLocals(); + + int length = maskLen - maxLocals; + + StackValueCollection result = new StackValueCollection(length); + for(int i = 0; i < length; i++) { // Find stack location Address addr = addressOfExpressionStackAt(i); // Depending on oop/int put it in the right package StackValue sv; - if (oopMask.isOop(i + nofLocals)) { + if (oopMask.isOop(i + maxLocals)) { // oop value sv = new StackValue(addr.getOopHandleAt(0), 0); } else { diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java index 72861d9c30d..ce048bf2d86 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -888,6 +888,16 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter { out.writeInt(index); out.writeInt(DUMMY_STACK_TRACE_ID); writeLocalJNIHandles(jt, index); + + int depth = 0; + var jvf = jt.getLastJavaVFrameDbg(); + while (jvf != null) { + writeStackRefs(index, depth, jvf.getLocals()); + writeStackRefs(index, depth, jvf.getExpressions()); + + depth++; + jvf = jvf.javaSender(); + } } protected void writeLocalJNIHandles(JavaThread jt, int index) throws IOException { @@ -926,6 +936,23 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter { } } + protected void writeStackRefs(int threadIndex, int frameIndex, StackValueCollection values) throws IOException { + for (int index = 0; index < values.size(); index++) { + if (values.get(index).getType() == BasicType.getTObject()) { + OopHandle oopHandle = values.oopHandleAt(index); + Oop oop = objectHeap.newOop(oopHandle); + if (oop != null) { + int size = BYTE_SIZE + OBJ_ID_SIZE + INT_SIZE * 2; + writeHeapRecordPrologue(size); + out.writeByte((byte) HPROF_GC_ROOT_JAVA_FRAME); + writeObjectID(oop); + out.writeInt(threadIndex); + out.writeInt(frameIndex); + } + } + } + } + protected void writeGlobalJNIHandle(Address handleAddr) throws IOException { OopHandle oopHandle = handleAddr.getOopHandleAt(0); Oop oop = objectHeap.newOop(oopHandle); diff --git a/test/hotspot/jtreg/serviceability/sa/ClhsdbDumpheap.java b/test/hotspot/jtreg/serviceability/sa/ClhsdbDumpheap.java index ee9872867ac..722c641f5b9 100644 --- a/test/hotspot/jtreg/serviceability/sa/ClhsdbDumpheap.java +++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbDumpheap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved. * 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,14 @@ import java.util.Map; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; +import java.io.IOException; import static jdk.test.lib.Asserts.assertTrue; import static jdk.test.lib.Asserts.assertFalse; +import static jdk.test.lib.Asserts.fail; import jdk.test.lib.hprof.HprofParser; import jdk.test.lib.apps.LingeredApp; +import jdk.test.lib.hprof.model.Root; import jdk.test.lib.hprof.parser.HprofReader; import jtreg.SkippedException; @@ -66,9 +69,22 @@ public class ClhsdbDumpheap { } } + private static void verifyLocalRefs(String file) throws IOException { + try (var snapshot = HprofReader.readFile(file, false, 0)) { + for (var root = snapshot.getRoots(); root.hasMoreElements();) { + if (root.nextElement().getType() == Root.JAVA_LOCAL) { + // expected + return; + } + } + } + fail("HPROF_GC_ROOT_JAVA_FRAME not found"); + } + private static void verifyDumpFile(File dump) throws Exception { assertTrue(dump.exists() && dump.isFile(), "Could not create dump file " + dump.getAbsolutePath()); printStackTraces(dump.getAbsolutePath()); + verifyLocalRefs(dump.getAbsolutePath()); } private static class SubTest { From 5868d351e28a30a3178e1d3cf09404c6245c2082 Mon Sep 17 00:00:00 2001 From: Amit Kumar Date: Thu, 12 Feb 2026 03:43:12 +0000 Subject: [PATCH 079/120] 8377651: [s390x] build failure without c1 & c2 compiler Reviewed-by: aph, mdoerr --- .../s390/gc/g1/g1BarrierSetAssembler_s390.cpp | 104 +++++++++--------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/src/hotspot/cpu/s390/gc/g1/g1BarrierSetAssembler_s390.cpp b/src/hotspot/cpu/s390/gc/g1/g1BarrierSetAssembler_s390.cpp index 272136fc28c..617bc7cd00c 100644 --- a/src/hotspot/cpu/s390/gc/g1/g1BarrierSetAssembler_s390.cpp +++ b/src/hotspot/cpu/s390/gc/g1/g1BarrierSetAssembler_s390.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2026, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -129,6 +129,57 @@ void G1BarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembler* mas } } +static void generate_post_barrier(MacroAssembler* masm, + const Register store_addr, + const Register new_val, + const Register thread, + const Register tmp1, + const Register tmp2, + Label& done, + bool new_val_may_be_null) { + + __ block_comment("generate_post_barrier {"); + + assert(thread == Z_thread, "must be"); + assert_different_registers(store_addr, new_val, thread, tmp1, tmp2, noreg); + + // Does store cross heap regions? + if (VM_Version::has_DistinctOpnds()) { + __ z_xgrk(tmp1, store_addr, new_val); // tmp1 := store address ^ new value + } else { + __ z_lgr(tmp1, store_addr); + __ z_xgr(tmp1, new_val); + } + __ z_srag(tmp1, tmp1, G1HeapRegion::LogOfHRGrainBytes); // tmp1 := ((store address ^ new value) >> LogOfHRGrainBytes) + __ branch_optimized(Assembler::bcondEqual, done); + + // Crosses regions, storing null? + if (new_val_may_be_null) { + __ z_ltgr(new_val, new_val); + __ z_bre(done); + } else { +#ifdef ASSERT + __ z_ltgr(new_val, new_val); + __ asm_assert(Assembler::bcondNotZero, "null oop not allowed (G1 post)", 0x322); // Checked by caller. +#endif + } + + __ z_srag(tmp1, store_addr, CardTable::card_shift()); + + Address card_table_addr(thread, in_bytes(G1ThreadLocalData::card_table_base_offset())); + __ z_alg(tmp1, card_table_addr); // tmp1 := card address + + if(UseCondCardMark) { + __ z_cli(0, tmp1, G1CardTable::clean_card_val()); + __ branch_optimized(Assembler::bcondNotEqual, done); + } + + static_assert(G1CardTable::dirty_card_val() == 0, "must be to use z_mvi"); + __ z_mvi(0, tmp1, G1CardTable::dirty_card_val()); // *(card address) := dirty_card_val + + __ block_comment("} generate_post_barrier"); +} + #if defined(COMPILER2) #undef __ @@ -204,57 +255,6 @@ void G1BarrierSetAssembler::generate_c2_pre_barrier_stub(MacroAssembler* masm, BLOCK_COMMENT("} generate_c2_pre_barrier_stub"); } -static void generate_post_barrier(MacroAssembler* masm, - const Register store_addr, - const Register new_val, - const Register thread, - const Register tmp1, - const Register tmp2, - Label& done, - bool new_val_may_be_null) { - - __ block_comment("generate_post_barrier {"); - - assert(thread == Z_thread, "must be"); - assert_different_registers(store_addr, new_val, thread, tmp1, tmp2, noreg); - - // Does store cross heap regions? - if (VM_Version::has_DistinctOpnds()) { - __ z_xgrk(tmp1, store_addr, new_val); // tmp1 := store address ^ new value - } else { - __ z_lgr(tmp1, store_addr); - __ z_xgr(tmp1, new_val); - } - __ z_srag(tmp1, tmp1, G1HeapRegion::LogOfHRGrainBytes); // tmp1 := ((store address ^ new value) >> LogOfHRGrainBytes) - __ branch_optimized(Assembler::bcondEqual, done); - - // Crosses regions, storing null? - if (new_val_may_be_null) { - __ z_ltgr(new_val, new_val); - __ z_bre(done); - } else { -#ifdef ASSERT - __ z_ltgr(new_val, new_val); - __ asm_assert(Assembler::bcondNotZero, "null oop not allowed (G1 post)", 0x322); // Checked by caller. -#endif - } - - __ z_srag(tmp1, store_addr, CardTable::card_shift()); - - Address card_table_addr(thread, in_bytes(G1ThreadLocalData::card_table_base_offset())); - __ z_alg(tmp1, card_table_addr); // tmp1 := card address - - if(UseCondCardMark) { - __ z_cli(0, tmp1, G1CardTable::clean_card_val()); - __ branch_optimized(Assembler::bcondNotEqual, done); - } - - static_assert(G1CardTable::dirty_card_val() == 0, "must be to use z_mvi"); - __ z_mvi(0, tmp1, G1CardTable::dirty_card_val()); // *(card address) := dirty_card_val - - __ block_comment("} generate_post_barrier"); -} - void G1BarrierSetAssembler::g1_write_barrier_post_c2(MacroAssembler* masm, Register store_addr, Register new_val, From 6abb29cc07e033e9a747b5a8a62e831c8f629c14 Mon Sep 17 00:00:00 2001 From: Jatin Bhateja Date: Thu, 12 Feb 2026 06:52:08 +0000 Subject: [PATCH 080/120] 8376794: Enable copy and mismatch Partial Inlining for AMD AVX512 targets Reviewed-by: sviswanathan, thartmann --- src/hotspot/cpu/x86/vm_version_x86.cpp | 63 +++++++++---------- .../vector/ArrayMismatchBenchmark.java | 43 +++++++++++++ 2 files changed, 74 insertions(+), 32 deletions(-) diff --git a/src/hotspot/cpu/x86/vm_version_x86.cpp b/src/hotspot/cpu/x86/vm_version_x86.cpp index c65c1c7d219..ef62a29c834 100644 --- a/src/hotspot/cpu/x86/vm_version_x86.cpp +++ b/src/hotspot/cpu/x86/vm_version_x86.cpp @@ -1659,41 +1659,40 @@ void VM_Version::get_processor_features() { if (FLAG_IS_DEFAULT(AllocatePrefetchInstr) && supports_3dnow_prefetch()) { FLAG_SET_DEFAULT(AllocatePrefetchInstr, 3); } -#ifdef COMPILER2 - if (UseAVX > 2) { - if (FLAG_IS_DEFAULT(ArrayOperationPartialInlineSize) || - (!FLAG_IS_DEFAULT(ArrayOperationPartialInlineSize) && - ArrayOperationPartialInlineSize != 0 && - ArrayOperationPartialInlineSize != 16 && - ArrayOperationPartialInlineSize != 32 && - ArrayOperationPartialInlineSize != 64)) { - int inline_size = 0; - if (MaxVectorSize >= 64 && AVX3Threshold == 0) { - inline_size = 64; - } else if (MaxVectorSize >= 32) { - inline_size = 32; - } else if (MaxVectorSize >= 16) { - inline_size = 16; - } - if(!FLAG_IS_DEFAULT(ArrayOperationPartialInlineSize)) { - warning("Setting ArrayOperationPartialInlineSize as %d", inline_size); - } - ArrayOperationPartialInlineSize = inline_size; - } - - if (ArrayOperationPartialInlineSize > MaxVectorSize) { - ArrayOperationPartialInlineSize = MaxVectorSize >= 16 ? MaxVectorSize : 0; - if (ArrayOperationPartialInlineSize) { - warning("Setting ArrayOperationPartialInlineSize as MaxVectorSize=%zd", MaxVectorSize); - } else { - warning("Setting ArrayOperationPartialInlineSize as %zd", ArrayOperationPartialInlineSize); - } - } - } -#endif } #ifdef COMPILER2 + if (UseAVX > 2) { + if (FLAG_IS_DEFAULT(ArrayOperationPartialInlineSize) || + (!FLAG_IS_DEFAULT(ArrayOperationPartialInlineSize) && + ArrayOperationPartialInlineSize != 0 && + ArrayOperationPartialInlineSize != 16 && + ArrayOperationPartialInlineSize != 32 && + ArrayOperationPartialInlineSize != 64)) { + int inline_size = 0; + if (MaxVectorSize >= 64 && AVX3Threshold == 0) { + inline_size = 64; + } else if (MaxVectorSize >= 32) { + inline_size = 32; + } else if (MaxVectorSize >= 16) { + inline_size = 16; + } + if(!FLAG_IS_DEFAULT(ArrayOperationPartialInlineSize)) { + warning("Setting ArrayOperationPartialInlineSize as %d", inline_size); + } + ArrayOperationPartialInlineSize = inline_size; + } + + if (ArrayOperationPartialInlineSize > MaxVectorSize) { + ArrayOperationPartialInlineSize = MaxVectorSize >= 16 ? MaxVectorSize : 0; + if (ArrayOperationPartialInlineSize) { + warning("Setting ArrayOperationPartialInlineSize as MaxVectorSize=%zd", MaxVectorSize); + } else { + warning("Setting ArrayOperationPartialInlineSize as %zd", ArrayOperationPartialInlineSize); + } + } + } + if (FLAG_IS_DEFAULT(OptimizeFill)) { if (MaxVectorSize < 32 || (!EnableX86ECoreOpts && !VM_Version::supports_avx512vlbw())) { OptimizeFill = false; diff --git a/test/micro/org/openjdk/bench/jdk/incubator/vector/ArrayMismatchBenchmark.java b/test/micro/org/openjdk/bench/jdk/incubator/vector/ArrayMismatchBenchmark.java index 2d327958594..876ed43b32e 100644 --- a/test/micro/org/openjdk/bench/jdk/incubator/vector/ArrayMismatchBenchmark.java +++ b/test/micro/org/openjdk/bench/jdk/incubator/vector/ArrayMismatchBenchmark.java @@ -26,6 +26,7 @@ package org.openjdk.bench.jdk.incubator.vector; import jdk.incubator.vector.ByteVector; +import jdk.incubator.vector.ShortVector; import jdk.incubator.vector.DoubleVector; import jdk.incubator.vector.IntVector; import jdk.incubator.vector.LongVector; @@ -59,6 +60,9 @@ public class ArrayMismatchBenchmark { byte[] byteData1; byte[] byteData2; + short[] shortData1; + short[] shortData2; + int[] intData1; int[] intData2; @@ -69,6 +73,7 @@ public class ArrayMismatchBenchmark { double[] doubleData2; static final VectorSpecies BYTE_SPECIES_PREFERRED = ByteVector.SPECIES_PREFERRED; + static final VectorSpecies SHORT_SPECIES_PREFERRED = ShortVector.SPECIES_PREFERRED; static final VectorSpecies INT_SPECIES_PREFERRED = IntVector.SPECIES_PREFERRED; static final VectorSpecies FLOAT_SPECIES_PREFERRED = DoubleVector.SPECIES_PREFERRED; static final VectorSpecies LONG_SPECIES_PREFERRED = LongVector.SPECIES_PREFERRED; @@ -89,6 +94,16 @@ public class ArrayMismatchBenchmark { System.arraycopy(commonBytes, 0, byteData1, 0, common); System.arraycopy(commonBytes, 0, byteData2, 0, common); + } else if (params.getBenchmark().endsWith("Short")) { + shortData1 = new short[size]; + shortData2 = new short[size]; + Arrays.fill(shortData1, (short)random.nextInt()); + Arrays.fill(shortData2, (short)random.nextInt()); + + short[] commonShorts = new short[common]; + Arrays.fill(commonShorts, (short)random.nextInt()); + System.arraycopy(commonShorts, 0, shortData1, 0, common); + System.arraycopy(commonShorts, 0, shortData2, 0, common); } else if (params.getBenchmark().endsWith("Int")) { intData1 = random.ints(size).toArray(); intData2 = random.ints(size).toArray(); @@ -141,6 +156,34 @@ public class ArrayMismatchBenchmark { return mismatch; } + @Benchmark + public int mismatchIntrinsicShort() { + return Arrays.mismatch(shortData1, shortData2); + } + + @Benchmark + public int mismatchVectorShort() { + int length = Math.min(shortData1.length, shortData2.length); + int index = 0; + for (; index < SHORT_SPECIES_PREFERRED.loopBound(length); index += SHORT_SPECIES_PREFERRED.length()) { + ShortVector vector1 = ShortVector.fromArray(SHORT_SPECIES_PREFERRED, shortData1, index); + ShortVector vector2 = ShortVector.fromArray(SHORT_SPECIES_PREFERRED, shortData2, index); + VectorMask mask = vector1.compare(VectorOperators.NE, vector2); + if (mask.anyTrue()) { + return index + mask.firstTrue(); + } + } + // process the tail + int mismatch = -1; + for (int i = index; i < length; ++i) { + if (shortData1[i] != shortData2[i]) { + mismatch = i; + break; + } + } + return mismatch; + } + @Benchmark public int mismatchIntrinsicInt() { return Arrays.mismatch(intData1, intData2); From 6c8d5daad1f388dc9fc8af6c9b3674846050dc7e Mon Sep 17 00:00:00 2001 From: Ramkumar Sunderbabu Date: Thu, 12 Feb 2026 09:07:18 +0000 Subject: [PATCH 081/120] 8373041: Mark gc/g1/TestCodeCacheUnloadDuringConcCycle.java as flagless Reviewed-by: tschatzl, ayang, syan --- .../jtreg/gc/g1/TestCodeCacheUnloadDuringConcCycle.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/hotspot/jtreg/gc/g1/TestCodeCacheUnloadDuringConcCycle.java b/test/hotspot/jtreg/gc/g1/TestCodeCacheUnloadDuringConcCycle.java index e36ccace9dc..94441840723 100644 --- a/test/hotspot/jtreg/gc/g1/TestCodeCacheUnloadDuringConcCycle.java +++ b/test/hotspot/jtreg/gc/g1/TestCodeCacheUnloadDuringConcCycle.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,6 +32,7 @@ package gc.g1; * during concurrent mark, and verify that after the concurrent cycle additional code * cache gc requests start more concurrent cycles. * @requires vm.gc.G1 + * @requires vm.flagless * @library /test/lib /testlibrary / * @modules java.base/jdk.internal.misc * java.management From c988a4e5349c784af0da814b2b942843c50e7871 Mon Sep 17 00:00:00 2001 From: Sean Coffey Date: Thu, 12 Feb 2026 09:45:59 +0000 Subject: [PATCH 082/120] 8044609: javax.net.debug options not working and documented as expected Reviewed-by: wetmore --- .../share/classes/sun/security/ssl/Alert.java | 2 +- .../sun/security/ssl/AlpnExtension.java | 27 +- .../security/ssl/CertSignAlgsExtension.java | 12 +- .../sun/security/ssl/CertStatusExtension.java | 47 ++- .../ssl/CertificateAuthoritiesExtension.java | 24 +- .../sun/security/ssl/CertificateMessage.java | 73 ++-- .../sun/security/ssl/CertificateRequest.java | 51 ++- .../sun/security/ssl/CertificateStatus.java | 7 +- .../sun/security/ssl/CertificateVerify.java | 30 +- .../sun/security/ssl/ChangeCipherSpec.java | 6 +- .../classes/sun/security/ssl/ClientHello.java | 46 ++- .../sun/security/ssl/CookieExtension.java | 15 +- .../sun/security/ssl/DHClientKeyExchange.java | 4 +- .../sun/security/ssl/DHServerKeyExchange.java | 4 +- .../sun/security/ssl/DTLSInputRecord.java | 126 +++--- .../sun/security/ssl/DTLSOutputRecord.java | 22 +- .../security/ssl/ECDHClientKeyExchange.java | 8 +- .../security/ssl/ECDHServerKeyExchange.java | 4 +- .../security/ssl/ECPointFormatsExtension.java | 8 +- .../sun/security/ssl/EncryptedExtensions.java | 4 +- .../ssl/ExtendedMasterSecretExtension.java | 15 +- .../classes/sun/security/ssl/Finished.java | 16 +- .../sun/security/ssl/HandshakeContext.java | 18 +- .../sun/security/ssl/HandshakeOutStream.java | 2 +- .../sun/security/ssl/HelloRequest.java | 12 +- .../sun/security/ssl/HelloVerifyRequest.java | 4 +- .../sun/security/ssl/KeyShareExtension.java | 45 +- .../classes/sun/security/ssl/KeyUpdate.java | 8 +- .../sun/security/ssl/MaxFragExtension.java | 27 +- .../classes/sun/security/ssl/NamedGroup.java | 11 +- .../sun/security/ssl/NewSessionTicket.java | 52 ++- .../sun/security/ssl/OutputRecord.java | 4 +- .../security/ssl/PreSharedKeyExtension.java | 41 +- .../ssl/PredefinedDHParameterSpecs.java | 8 +- .../ssl/PskKeyExchangeModesExtension.java | 12 +- .../security/ssl/QuicEngineOutputRecord.java | 8 +- .../sun/security/ssl/QuicKeyManager.java | 28 +- .../sun/security/ssl/QuicTLSEngineImpl.java | 6 +- .../security/ssl/RSAClientKeyExchange.java | 4 +- .../sun/security/ssl/RSAKeyExchange.java | 14 +- .../security/ssl/RSAServerKeyExchange.java | 4 +- .../sun/security/ssl/RenegoInfoExtension.java | 36 +- .../security/ssl/SSLAlgorithmConstraints.java | 2 +- .../classes/sun/security/ssl/SSLCipher.java | 59 ++- .../sun/security/ssl/SSLConfiguration.java | 11 +- .../sun/security/ssl/SSLContextImpl.java | 40 +- .../sun/security/ssl/SSLEngineImpl.java | 12 +- .../security/ssl/SSLEngineInputRecord.java | 9 +- .../security/ssl/SSLEngineOutputRecord.java | 29 +- .../sun/security/ssl/SSLExtension.java | 2 +- .../sun/security/ssl/SSLExtensions.java | 40 +- .../classes/sun/security/ssl/SSLLogger.java | 388 ++++++++++-------- .../security/ssl/SSLMasterKeyDerivation.java | 3 +- .../security/ssl/SSLSessionContextImpl.java | 10 +- .../sun/security/ssl/SSLSessionImpl.java | 16 +- .../sun/security/ssl/SSLSocketImpl.java | 48 ++- .../security/ssl/SSLSocketInputRecord.java | 16 +- .../security/ssl/SSLSocketOutputRecord.java | 37 +- .../sun/security/ssl/SSLTransport.java | 8 +- .../classes/sun/security/ssl/ServerHello.java | 31 +- .../sun/security/ssl/ServerHelloDone.java | 4 +- .../sun/security/ssl/ServerNameExtension.java | 29 +- .../security/ssl/SessionTicketExtension.java | 32 +- .../ssl/SignatureAlgorithmsExtension.java | 6 +- .../sun/security/ssl/SignatureScheme.java | 26 +- .../security/ssl/StatusResponseManager.java | 79 ++-- .../security/ssl/SunX509KeyManagerImpl.java | 7 +- .../ssl/SupportedGroupsExtension.java | 29 +- .../ssl/SupportedVersionsExtension.java | 24 +- .../sun/security/ssl/TransportContext.java | 20 +- .../security/ssl/TrustManagerFactoryImpl.java | 12 +- .../sun/security/ssl/TrustStoreManager.java | 23 +- .../classes/sun/security/ssl/Utilities.java | 4 +- .../sun/security/ssl/X509Authentication.java | 27 +- .../ssl/X509KeyManagerCertChecking.java | 16 +- .../sun/security/ssl/X509KeyManagerImpl.java | 14 +- .../security/ssl/X509TrustManagerImpl.java | 9 +- .../classes/sun/security/util/DomainName.java | 8 +- .../ssl/SSLEngineImpl/SSLEngineKeyLimit.java | 2 +- .../SSLLogger/DebugPropertyValuesTest.java | 84 ++-- .../MultiNSTNoSessionCreation.java | 2 +- .../ResumptionUpdateBoundValues.java | 2 +- .../ssl/SSLSocketImpl/SSLSocketKeyLimit.java | 2 +- 83 files changed, 1257 insertions(+), 860 deletions(-) diff --git a/src/java.base/share/classes/sun/security/ssl/Alert.java b/src/java.base/share/classes/sun/security/ssl/Alert.java index d172206326f..fb06b02a5d4 100644 --- a/src/java.base/share/classes/sun/security/ssl/Alert.java +++ b/src/java.base/share/classes/sun/security/ssl/Alert.java @@ -238,7 +238,7 @@ public enum Alert { TransportContext tc = (TransportContext)context; AlertMessage am = new AlertMessage(tc, m); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine("Received alert message", am); } diff --git a/src/java.base/share/classes/sun/security/ssl/AlpnExtension.java b/src/java.base/share/classes/sun/security/ssl/AlpnExtension.java index f03a65c8410..f56b6f39a44 100644 --- a/src/java.base/share/classes/sun/security/ssl/AlpnExtension.java +++ b/src/java.base/share/classes/sun/security/ssl/AlpnExtension.java @@ -157,7 +157,8 @@ final class AlpnExtension { // Is it a supported and enabled extension? if (!chc.sslConfig.isAvailable(SSLExtension.CH_ALPN)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() + && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.info( "Ignore client unavailable extension: " + SSLExtension.CH_ALPN.name); @@ -170,7 +171,8 @@ final class AlpnExtension { String[] laps = chc.sslConfig.applicationProtocols; if ((laps == null) || (laps.length == 0)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.info( "No available application protocols"); } @@ -183,7 +185,8 @@ final class AlpnExtension { int length = ap.getBytes(alpnCharset).length; if (length == 0) { // log the configuration problem - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.severe( "Application protocol name cannot be empty"); } @@ -197,7 +200,8 @@ final class AlpnExtension { listLength += (length + 1); } else { // log the configuration problem - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.severe( "Application protocol name (" + ap + ") exceeds the size limit (" + @@ -212,7 +216,8 @@ final class AlpnExtension { if (listLength > MAX_AP_LIST_LENGTH) { // log the configuration problem - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.severe( "The configured application protocols (" + Arrays.toString(laps) + @@ -266,7 +271,8 @@ final class AlpnExtension { if (!shc.sslConfig.isAvailable(SSLExtension.CH_ALPN)) { shc.applicationProtocol = ""; shc.conContext.applicationProtocol = ""; - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.info( "Ignore server unavailable extension: " + SSLExtension.CH_ALPN.name); @@ -288,7 +294,8 @@ final class AlpnExtension { if (noAPSelector && noAlpnProtocols) { shc.applicationProtocol = ""; shc.conContext.applicationProtocol = ""; - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore server unenabled extension: " + SSLExtension.CH_ALPN.name); @@ -378,7 +385,8 @@ final class AlpnExtension { (AlpnSpec)shc.handshakeExtensions.get(SSLExtension.CH_ALPN); if (requestedAlps == null) { // Ignore, this extension was not requested and accepted. - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable extension: " + SSLExtension.SH_ALPN.name); @@ -423,7 +431,8 @@ final class AlpnExtension { // Ignore, no negotiated application layer protocol. shc.applicationProtocol = ""; shc.conContext.applicationProtocol = ""; - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning( "Ignore, no negotiated application layer protocol"); } diff --git a/src/java.base/share/classes/sun/security/ssl/CertSignAlgsExtension.java b/src/java.base/share/classes/sun/security/ssl/CertSignAlgsExtension.java index 2d03d5fef98..1444a77aa90 100644 --- a/src/java.base/share/classes/sun/security/ssl/CertSignAlgsExtension.java +++ b/src/java.base/share/classes/sun/security/ssl/CertSignAlgsExtension.java @@ -94,7 +94,8 @@ final class CertSignAlgsExtension { // Is it a supported and enabled extension? if (!chc.sslConfig.isAvailable( SSLExtension.CH_SIGNATURE_ALGORITHMS_CERT)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable " + "signature_algorithms_cert extension"); @@ -144,7 +145,8 @@ final class CertSignAlgsExtension { // Is it a supported and enabled extension? if (!shc.sslConfig.isAvailable( SSLExtension.CH_SIGNATURE_ALGORITHMS_CERT)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable " + "signature_algorithms_cert extension"); @@ -235,7 +237,8 @@ final class CertSignAlgsExtension { // Is it a supported and enabled extension? if (!shc.sslConfig.isAvailable( SSLExtension.CH_SIGNATURE_ALGORITHMS_CERT)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable " + "signature_algorithms_cert extension"); @@ -283,7 +286,8 @@ final class CertSignAlgsExtension { // Is it a supported and enabled extension? if (!chc.sslConfig.isAvailable( SSLExtension.CH_SIGNATURE_ALGORITHMS_CERT)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable " + "signature_algorithms_cert extension"); diff --git a/src/java.base/share/classes/sun/security/ssl/CertStatusExtension.java b/src/java.base/share/classes/sun/security/ssl/CertStatusExtension.java index dd9b7017390..898c8b3d408 100644 --- a/src/java.base/share/classes/sun/security/ssl/CertStatusExtension.java +++ b/src/java.base/share/classes/sun/security/ssl/CertStatusExtension.java @@ -144,7 +144,8 @@ final class CertStatusExtension { if (statusType == CertStatusRequestType.OCSP.id) { this.statusRequest = new OCSPStatusRequest(statusType, encoded); } else { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.info( "Unknown certificate status request " + "(status type: " + statusType + ")"); @@ -196,7 +197,8 @@ final class CertStatusExtension { if (type == CertStatusRequestType.OCSP.id) { this.statusResponse = new OCSPStatusResponse(type, respData); } else { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.info( "Unknown certificate status response " + "(status type: " + type + ")"); @@ -557,7 +559,8 @@ final class CertStatusExtension { } if (!chc.sslConfig.isAvailable(SSLExtension.CH_STATUS_REQUEST)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable extension: " + SSLExtension.CH_STATUS_REQUEST.name); @@ -598,7 +601,8 @@ final class CertStatusExtension { ServerHandshakeContext shc = (ServerHandshakeContext)context; if (!shc.sslConfig.isAvailable(SSLExtension.CH_STATUS_REQUEST)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Ignore unavailable extension: " + SSLExtension.CH_STATUS_REQUEST.name); } @@ -656,7 +660,8 @@ final class CertStatusExtension { shc.handshakeExtensions.get(SSLExtension.CH_STATUS_REQUEST); if (spec == null) { // Ignore, no status_request extension requested. - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.finest("Ignore unavailable extension: " + SSLExtension.CH_STATUS_REQUEST.name); } @@ -666,7 +671,8 @@ final class CertStatusExtension { // Is it a session resuming? if (shc.isResumption) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.finest( "No status_request response for session resuming"); } @@ -839,7 +845,8 @@ final class CertStatusExtension { statusRequests.add( new OCSPStatusRequest(statusType, encoded)); } else { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.info( "Unknown certificate status request " + "(status type: " + statusType + ")"); @@ -915,7 +922,8 @@ final class CertStatusExtension { } if (!chc.sslConfig.isAvailable(SSLExtension.CH_STATUS_REQUEST_V2)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.finest( "Ignore unavailable status_request_v2 extension"); } @@ -957,7 +965,8 @@ final class CertStatusExtension { ServerHandshakeContext shc = (ServerHandshakeContext)context; if (!shc.sslConfig.isAvailable(SSLExtension.CH_STATUS_REQUEST_V2)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.finest( "Ignore unavailable status_request_v2 extension"); } @@ -1017,7 +1026,8 @@ final class CertStatusExtension { shc.handshakeExtensions.get(SSLExtension.CH_STATUS_REQUEST_V2); if (spec == null) { // Ignore, no status_request_v2 extension requested. - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.finest( "Ignore unavailable status_request_v2 extension"); } @@ -1027,7 +1037,8 @@ final class CertStatusExtension { // Is it a session resuming? if (shc.isResumption) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.finest( "No status_request_v2 response for session resumption"); } @@ -1112,7 +1123,8 @@ final class CertStatusExtension { // Stapling needs to be active and have valid data to proceed if (shc.stapleParams == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.finest( "Stapling is disabled for this connection"); } @@ -1121,7 +1133,8 @@ final class CertStatusExtension { // There needs to be a non-null CertificateEntry to proceed if (shc.currentCertEntry == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.finest("Found null CertificateEntry in context"); } return null; @@ -1140,7 +1153,7 @@ final class CertStatusExtension { if (respBytes == null) { // We're done with this entry. Clear it from the context if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.finest("No status response found for " + x509Cert.getSubjectX500Principal()); } @@ -1149,7 +1162,8 @@ final class CertStatusExtension { } // Build a proper response buffer from the stapling information - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake,verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.finest("Found status response for " + x509Cert.getSubjectX500Principal() + ", response length: " + respBytes.length); @@ -1208,7 +1222,8 @@ final class CertStatusExtension { respList.add(spec.statusResponse.encodedResponse); chc.handshakeSession.setStatusResponses(respList); } else { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake,verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.finest( "Ignoring stapled data on resumed session"); } diff --git a/src/java.base/share/classes/sun/security/ssl/CertificateAuthoritiesExtension.java b/src/java.base/share/classes/sun/security/ssl/CertificateAuthoritiesExtension.java index 6be84e8f8fa..60f13e9ddad 100644 --- a/src/java.base/share/classes/sun/security/ssl/CertificateAuthoritiesExtension.java +++ b/src/java.base/share/classes/sun/security/ssl/CertificateAuthoritiesExtension.java @@ -192,7 +192,8 @@ final class CertificateAuthoritiesExtension { // Is it a supported and enabled extension? if (!chc.sslConfig.isAvailable( SSLExtension.CH_CERTIFICATE_AUTHORITIES)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable " + "certificate_authorities extension"); @@ -205,7 +206,8 @@ final class CertificateAuthoritiesExtension { X509Certificate[] caCerts = chc.sslContext.getX509TrustManager().getAcceptedIssuers(); if (caCerts.length == 0) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "No available certificate authorities"); } @@ -216,7 +218,8 @@ final class CertificateAuthoritiesExtension { List encodedCAs = CertificateAuthoritiesSpec.getEncodedAuthorities(caCerts); if (encodedCAs.isEmpty()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning( "The number of CAs exceeds the maximum size " + "of the certificate_authorities extension"); @@ -270,7 +273,8 @@ final class CertificateAuthoritiesExtension { // Is it a supported and enabled extension? if (!shc.sslConfig.isAvailable( SSLExtension.CH_CERTIFICATE_AUTHORITIES)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable " + "certificate_authorities extension"); @@ -319,7 +323,8 @@ final class CertificateAuthoritiesExtension { // Is it a supported and enabled extension? if (!shc.sslConfig.isAvailable( SSLExtension.CR_CERTIFICATE_AUTHORITIES)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable " + "certificate_authorities extension"); @@ -332,7 +337,8 @@ final class CertificateAuthoritiesExtension { X509Certificate[] caCerts = shc.sslContext.getX509TrustManager().getAcceptedIssuers(); if (caCerts.length == 0) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "No available certificate authorities"); } @@ -343,7 +349,8 @@ final class CertificateAuthoritiesExtension { List encodedCAs = CertificateAuthoritiesSpec.getEncodedAuthorities(caCerts); if (encodedCAs.isEmpty()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning( "Too many certificate authorities to use " + "the certificate_authorities extension"); @@ -397,7 +404,8 @@ final class CertificateAuthoritiesExtension { // Is it a supported and enabled extension? if (!chc.sslConfig.isAvailable( SSLExtension.CR_CERTIFICATE_AUTHORITIES)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable " + "certificate_authorities extension"); diff --git a/src/java.base/share/classes/sun/security/ssl/CertificateMessage.java b/src/java.base/share/classes/sun/security/ssl/CertificateMessage.java index 2a2db34cab9..c6897d71aa6 100644 --- a/src/java.base/share/classes/sun/security/ssl/CertificateMessage.java +++ b/src/java.base/share/classes/sun/security/ssl/CertificateMessage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -265,7 +265,8 @@ final class CertificateMessage { shc.handshakeSession.setLocalCertificates(x509Possession.popCerts); T12CertificateMessage cm = new T12CertificateMessage(shc, x509Possession.popCerts); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Produced server Certificate handshake message", cm); } @@ -293,7 +294,8 @@ final class CertificateMessage { // an empty cert chain instead. if (x509Possession == null) { if (chc.negotiatedProtocol.useTLS10PlusSpec()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "No X.509 certificate for client authentication, " + "use empty Certificate message instead"); @@ -302,7 +304,8 @@ final class CertificateMessage { x509Possession = new X509Possession(null, new X509Certificate[0]); } else { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "No X.509 certificate for client authentication, " + "send a no_certificate alert"); @@ -324,7 +327,8 @@ final class CertificateMessage { } T12CertificateMessage cm = new T12CertificateMessage(chc, x509Possession.popCerts); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Produced client Certificate handshake message", cm); } @@ -360,13 +364,15 @@ final class CertificateMessage { T12CertificateMessage cm = new T12CertificateMessage(hc, message); if (hc.sslConfig.isClientMode) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Consuming server Certificate handshake message", cm); } onCertificate((ClientHandshakeContext)context, cm); } else { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Consuming client Certificate handshake message", cm); } @@ -501,7 +507,8 @@ final class CertificateMessage { try { thisSubjectAltNames = thisCert.getSubjectAlternativeNames(); } catch (CertificateParsingException cpe) { - if (SSLLogger.isOn() && SSLLogger.isOn("handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Attempt to obtain subjectAltNames extension failed!"); } @@ -511,7 +518,8 @@ final class CertificateMessage { try { prevSubjectAltNames = prevCert.getSubjectAlternativeNames(); } catch (CertificateParsingException cpe) { - if (SSLLogger.isOn() && SSLLogger.isOn("handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Attempt to obtain subjectAltNames extension failed!"); } @@ -980,7 +988,8 @@ final class CertificateMessage { certEnt.extensions.produce(shc, enabledCTExts); } - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Produced server Certificate message", cm); } @@ -997,7 +1006,8 @@ final class CertificateMessage { ClientHelloMessage clientHello) { if (hc.peerRequestedCertSignSchemes == null || hc.peerRequestedCertSignSchemes.isEmpty()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning( "No signature_algorithms(_cert) in ClientHello"); } @@ -1008,20 +1018,27 @@ final class CertificateMessage { .stream() .map(ss -> ss.keyAlgorithm) .distinct() - .filter(ka -> SignatureScheme.getPreferableAlgorithm( // Don't select a signature scheme unless - hc.algorithmConstraints, // we will be able to produce - hc.peerRequestedSignatureSchemes, // a CertificateVerify message later + .filter(ka -> SignatureScheme.getPreferableAlgorithm( + // Don't select a signature scheme unless + // we will be able to produce a + // CertificateVerify message later + hc.algorithmConstraints, + hc.peerRequestedSignatureSchemes, ka, hc.negotiatedProtocol) != null - || SSLLogger.logWarning("ssl,handshake", - "Unable to produce CertificateVerify for key algorithm: " + ka)) - .filter(ka -> X509Authentication.valueOfKeyAlgorithm(ka) != null - || SSLLogger.logWarning("ssl,handshake", "Unsupported key algorithm: " + ka)) + || SSLLogger.logWarning(SSLLogger.Opt.HANDSHAKE, + "Unable to produce CertificateVerify for " + + "key algorithm: " + ka)) + .filter(ka -> + X509Authentication.valueOfKeyAlgorithm(ka) != null + || SSLLogger.logWarning(SSLLogger.Opt.HANDSHAKE, + "Unsupported key algorithm: " + ka)) .toArray(String[]::new); SSLPossession pos = X509Authentication .createPossession(hc, supportedKeyTypes); if (pos == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning("No available authentication scheme"); } } @@ -1034,14 +1051,16 @@ final class CertificateMessage { SSLPossession pos = choosePossession(chc, clientHello); X509Certificate[] localCerts; if (pos == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("No available client authentication scheme"); } localCerts = new X509Certificate[0]; } else { chc.handshakePossessions.add(pos); if (!(pos instanceof X509Possession x509Possession)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "No X.509 certificate for client authentication"); } @@ -1067,7 +1086,8 @@ final class CertificateMessage { throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE, "Failed to produce client Certificate message", ce); } - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Produced client Certificate message", cm); } @@ -1103,18 +1123,20 @@ final class CertificateMessage { if (hc.handshakeConsumers.containsKey( SSLHandshake.ENCRYPTED_EXTENSIONS.id)) { throw hc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, - "Unexpected Certificate handshake message"); + "Unexpected Certificate handshake message"); } T13CertificateMessage cm = new T13CertificateMessage(hc, message); if (hc.sslConfig.isClientMode) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Consuming server Certificate handshake message", cm); } onConsumeCertificate((ClientHandshakeContext)context, cm); } else { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Consuming client Certificate handshake message", cm); } @@ -1365,5 +1387,4 @@ final class CertificateMessage { return alert; } - } diff --git a/src/java.base/share/classes/sun/security/ssl/CertificateRequest.java b/src/java.base/share/classes/sun/security/ssl/CertificateRequest.java index a297d9d21b2..039399560cd 100644 --- a/src/java.base/share/classes/sun/security/ssl/CertificateRequest.java +++ b/src/java.base/share/classes/sun/security/ssl/CertificateRequest.java @@ -297,7 +297,7 @@ final class CertificateRequest { shc.sslContext.getX509TrustManager().getAcceptedIssuers(); T10CertificateRequestMessage crm = new T10CertificateRequestMessage( shc, caCerts, shc.negotiatedCipherSuite.keyExchange); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Produced CertificateRequest handshake message", crm); } @@ -360,7 +360,7 @@ final class CertificateRequest { T10CertificateRequestMessage crm = new T10CertificateRequestMessage(chc, message); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Consuming CertificateRequest handshake message", crm); } @@ -400,7 +400,8 @@ final class CertificateRequest { } if (clientAlias == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning("No available client authentication"); } return; @@ -408,7 +409,8 @@ final class CertificateRequest { PrivateKey clientPrivateKey = km.getPrivateKey(clientAlias); if (clientPrivateKey == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning("No available client private key"); } return; @@ -416,7 +418,8 @@ final class CertificateRequest { X509Certificate[] clientCerts = km.getCertificateChain(clientAlias); if ((clientCerts == null) || (clientCerts.length == 0)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning("No available client certificate"); } return; @@ -655,7 +658,7 @@ final class CertificateRequest { T12CertificateRequestMessage crm = new T12CertificateRequestMessage( shc, caCerts, shc.negotiatedCipherSuite.keyExchange, certReqSignAlgs); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Produced CertificateRequest handshake message", crm); } @@ -717,7 +720,7 @@ final class CertificateRequest { T12CertificateRequestMessage crm = new T12CertificateRequestMessage(chc, message); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Consuming CertificateRequest handshake message", crm); } @@ -784,7 +787,8 @@ final class CertificateRequest { T12CertificateRequestMessage crm) { if (hc.peerRequestedCertSignSchemes == null || hc.peerRequestedCertSignSchemes.isEmpty()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning("No signature and hash algorithms " + "in CertificateRequest"); } @@ -804,26 +808,32 @@ final class CertificateRequest { .stream() .map(ss -> ss.keyAlgorithm) .distinct() - .filter(ka -> SignatureScheme.getPreferableAlgorithm( // Don't select a signature scheme unless - hc.algorithmConstraints, // we will be able to produce - hc.peerRequestedSignatureSchemes, // a CertificateVerify message later + // Don't select a signature scheme unless we will be + // able to produce a CertificateVerify message later + .filter(ka -> SignatureScheme.getPreferableAlgorithm( + hc.algorithmConstraints, + hc.peerRequestedSignatureSchemes, ka, hc.negotiatedProtocol) != null - || SSLLogger.logWarning("ssl,handshake", - "Unable to produce CertificateVerify for key algorithm: " + ka)) + || SSLLogger.logWarning(SSLLogger.Opt.HANDSHAKE, + "Unable to produce CertificateVerify for" + + "key algorithm: " + ka)) .filter(ka -> { var xa = X509Authentication.valueOfKeyAlgorithm(ka); // Any auth object will have a set of allowed key types. - // This set should share at least one common algorithm with - // the CR's allowed key types. - return xa != null && !Collections.disjoint(crKeyTypes, Arrays.asList(xa.keyTypes)) - || SSLLogger.logWarning("ssl,handshake", "Unsupported key algorithm: " + ka); + // This set should share at least one common + // algorithm with the CR's allowed key types. + return xa != null && !Collections.disjoint(crKeyTypes, + Arrays.asList(xa.keyTypes)) + || SSLLogger.logWarning(SSLLogger.Opt.HANDSHAKE, + "Unsupported key algorithm: " + ka); }) .toArray(String[]::new); SSLPossession pos = X509Authentication .createPossession(hc, supportedKeyTypes); if (pos == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning("No available authentication scheme"); } } @@ -933,7 +943,8 @@ final class CertificateRequest { SSLExtension[] extTypes = shc.sslConfig.getEnabledExtensions( SSLHandshake.CERTIFICATE_REQUEST, shc.negotiatedProtocol); crm.extensions.produce(shc, extTypes); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Produced CertificateRequest message", crm); } @@ -985,7 +996,7 @@ final class CertificateRequest { T13CertificateRequestMessage crm = new T13CertificateRequestMessage(chc, message); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Consuming CertificateRequest handshake message", crm); } diff --git a/src/java.base/share/classes/sun/security/ssl/CertificateStatus.java b/src/java.base/share/classes/sun/security/ssl/CertificateStatus.java index c2286f3c422..af1e50d3087 100644 --- a/src/java.base/share/classes/sun/security/ssl/CertificateStatus.java +++ b/src/java.base/share/classes/sun/security/ssl/CertificateStatus.java @@ -281,7 +281,7 @@ final class CertificateStatus { new CertificateStatusMessage(chc, message); // Log the message - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Consuming server CertificateStatus handshake message", cst); @@ -325,7 +325,7 @@ final class CertificateStatus { // Create the CertificateStatus message from info in the CertificateStatusMessage csm = new CertificateStatusMessage(shc); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Produced server CertificateStatus handshake message", csm); } @@ -358,7 +358,8 @@ final class CertificateStatus { // status_request[_v2] extension. 2) The CertificateStatus // message was not sent. This means that cert path checking // was deferred, but must happen immediately. - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Server did not send CertificateStatus, " + "checking cert chain without status info."); } diff --git a/src/java.base/share/classes/sun/security/ssl/CertificateVerify.java b/src/java.base/share/classes/sun/security/ssl/CertificateVerify.java index 18ea2b9c3de..47fdef0136d 100644 --- a/src/java.base/share/classes/sun/security/ssl/CertificateVerify.java +++ b/src/java.base/share/classes/sun/security/ssl/CertificateVerify.java @@ -248,7 +248,8 @@ final class CertificateVerify { if (x509Possession == null || x509Possession.popPrivateKey == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "No X.509 credentials negotiated for CertificateVerify"); } @@ -258,7 +259,7 @@ final class CertificateVerify { S30CertificateVerifyMessage cvm = new S30CertificateVerifyMessage(chc, x509Possession); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Produced CertificateVerify handshake message", cvm); } @@ -300,7 +301,7 @@ final class CertificateVerify { S30CertificateVerifyMessage cvm = new S30CertificateVerifyMessage(shc, message); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Consuming CertificateVerify handshake message", cvm); } @@ -503,7 +504,8 @@ final class CertificateVerify { if (x509Possession == null || x509Possession.popPrivateKey == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "No X.509 credentials negotiated for CertificateVerify"); } @@ -513,7 +515,7 @@ final class CertificateVerify { T10CertificateVerifyMessage cvm = new T10CertificateVerifyMessage(chc, x509Possession); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Produced CertificateVerify handshake message", cvm); } @@ -555,7 +557,7 @@ final class CertificateVerify { T10CertificateVerifyMessage cvm = new T10CertificateVerifyMessage(shc, message); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Consuming CertificateVerify handshake message", cvm); } @@ -754,7 +756,8 @@ final class CertificateVerify { if (x509Possession == null || x509Possession.popPrivateKey == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "No X.509 credentials negotiated for CertificateVerify"); } @@ -764,7 +767,7 @@ final class CertificateVerify { T12CertificateVerifyMessage cvm = new T12CertificateVerifyMessage(chc, x509Possession); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Produced CertificateVerify handshake message", cvm); } @@ -806,7 +809,7 @@ final class CertificateVerify { T12CertificateVerifyMessage cvm = new T12CertificateVerifyMessage(shc, message); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Consuming CertificateVerify handshake message", cvm); } @@ -1092,7 +1095,8 @@ final class CertificateVerify { if (x509Possession == null || x509Possession.popPrivateKey == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "No X.509 credentials negotiated for CertificateVerify"); } @@ -1113,7 +1117,7 @@ final class CertificateVerify { X509Possession x509Possession) throws IOException { T13CertificateVerifyMessage cvm = new T13CertificateVerifyMessage(shc, x509Possession); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Produced server CertificateVerify handshake message", cvm); } @@ -1130,7 +1134,7 @@ final class CertificateVerify { X509Possession x509Possession) throws IOException { T13CertificateVerifyMessage cvm = new T13CertificateVerifyMessage(chc, x509Possession); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Produced client CertificateVerify handshake message", cvm); } @@ -1173,7 +1177,7 @@ final class CertificateVerify { T13CertificateVerifyMessage cvm = new T13CertificateVerifyMessage(hc, message); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Consuming CertificateVerify handshake message", cvm); } diff --git a/src/java.base/share/classes/sun/security/ssl/ChangeCipherSpec.java b/src/java.base/share/classes/sun/security/ssl/ChangeCipherSpec.java index d3eac8f13af..2907fc4d7b9 100644 --- a/src/java.base/share/classes/sun/security/ssl/ChangeCipherSpec.java +++ b/src/java.base/share/classes/sun/security/ssl/ChangeCipherSpec.java @@ -108,7 +108,7 @@ final class ChangeCipherSpec { ") and protocol version (" + hc.negotiatedProtocol + ")"); } - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Produced ChangeCipherSpec message"); } @@ -142,7 +142,7 @@ final class ChangeCipherSpec { throw tc.fatal(Alert.UNEXPECTED_MESSAGE, "Malformed or unexpected ChangeCipherSpec message"); } - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Consuming ChangeCipherSpec message"); } @@ -237,7 +237,7 @@ final class ChangeCipherSpec { throw tc.fatal(Alert.UNEXPECTED_MESSAGE, "Malformed or unexpected ChangeCipherSpec message"); } - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Consuming ChangeCipherSpec message"); } diff --git a/src/java.base/share/classes/sun/security/ssl/ClientHello.java b/src/java.base/share/classes/sun/security/ssl/ClientHello.java index 421673d625d..2bb1233b4c8 100644 --- a/src/java.base/share/classes/sun/security/ssl/ClientHello.java +++ b/src/java.base/share/classes/sun/security/ssl/ClientHello.java @@ -431,7 +431,7 @@ final class ClientHello { if (!session.isRejoinable()) { session = null; if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.finest( "Can't resume, the session is not rejoinable"); } @@ -444,7 +444,7 @@ final class ClientHello { if (!chc.isNegotiable(sessionSuite)) { session = null; if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.finest( "Can't resume, unavailable session cipher suite"); } @@ -457,7 +457,7 @@ final class ClientHello { if (!chc.isNegotiable(sessionVersion)) { session = null; if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.finest( "Can't resume, unavailable protocol version"); } @@ -514,7 +514,7 @@ final class ClientHello { session.getIdentificationProtocol(); if (!identityAlg.equalsIgnoreCase(sessionIdentityAlg)) { if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.finest("Can't resume, endpoint id" + " algorithm does not match, requested: " + identityAlg + ", cached: " + sessionIdentityAlg); @@ -524,7 +524,8 @@ final class ClientHello { } if (session != null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake,verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.finest("Try resuming session", session); } @@ -548,7 +549,7 @@ final class ClientHello { } if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.finest( "No new session is allowed, so try to resume " + "the session cipher suite only", sessionSuite); @@ -634,7 +635,8 @@ final class ClientHello { SSLHandshake.CLIENT_HELLO, chc.activeProtocols); chm.extensions.produce(chc, extTypes); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Produced ClientHello handshake message", chm); } @@ -700,7 +702,8 @@ final class ClientHello { // // The HelloVerifyRequest consumer should have updated the // ClientHello handshake message with cookie. - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Produced ClientHello(cookie) handshake message", chc.initialClientHelloMsg); @@ -734,7 +737,8 @@ final class ClientHello { // TLS 1.3 // The HelloRetryRequest consumer should have updated the // ClientHello handshake message with cookie. - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Produced ClientHello(HRR) handshake message", chc.initialClientHelloMsg); @@ -790,7 +794,7 @@ final class ClientHello { ClientHelloMessage chm = new ClientHelloMessage(shc, message, enabledExtensions); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Consuming ClientHello handshake message", chm); } @@ -820,7 +824,7 @@ final class ClientHello { negotiateProtocol(context, clientHello.clientVersion); } context.negotiatedProtocol = negotiatedProtocol; - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Negotiated protocol version: " + negotiatedProtocol.name); } @@ -981,7 +985,7 @@ final class ClientHello { (previous != null) && previous.isRejoinable(); if (!resumingSession) { if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.finest( "Can't resume, " + "the existing session is not rejoinable"); @@ -994,7 +998,7 @@ final class ClientHello { if (sessionProtocol != shc.negotiatedProtocol) { resumingSession = false; if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.finest( "Can't resume, not the same protocol version"); } @@ -1009,7 +1013,7 @@ final class ClientHello { } catch (SSLPeerUnverifiedException e) { resumingSession = false; if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.finest( "Can't resume, " + "client authentication is required"); @@ -1024,7 +1028,7 @@ final class ClientHello { (!clientHello.cipherSuites.contains(suite))) { resumingSession = false; if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.finest( "Can't resume, " + "the session cipher suite is absent"); @@ -1040,7 +1044,7 @@ final class ClientHello { previous.getIdentificationProtocol(); if (!identityAlg.equalsIgnoreCase(sessionIdentityAlg)) { if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.finest("Can't resume, endpoint id" + " algorithm does not match, requested: " + identityAlg + ", cached: " + sessionIdentityAlg); @@ -1055,7 +1059,7 @@ final class ClientHello { shc.resumingSession = resumingSession ? previous : null; if (!resumingSession && SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Session not resumed."); } } @@ -1322,7 +1326,7 @@ final class ClientHello { (previous != null) && previous.isRejoinable(); if (!resumingSession) { if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.finest( "Can't resume, " + "the existing session is not rejoinable"); @@ -1335,7 +1339,7 @@ final class ClientHello { if (sessionProtocol != shc.negotiatedProtocol) { resumingSession = false; if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.finest( "Can't resume, not the same protocol version"); } @@ -1351,7 +1355,7 @@ final class ClientHello { } catch (SSLPeerUnverifiedException e) { resumingSession = false; if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.finest( "Can't resume, " + "client authentication is required"); @@ -1366,7 +1370,7 @@ final class ClientHello { (!clientHello.cipherSuites.contains(suite))) { resumingSession = false; if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.finest( "Can't resume, " + "the session cipher suite is absent"); diff --git a/src/java.base/share/classes/sun/security/ssl/CookieExtension.java b/src/java.base/share/classes/sun/security/ssl/CookieExtension.java index b42cea082e0..e5cb3371d75 100644 --- a/src/java.base/share/classes/sun/security/ssl/CookieExtension.java +++ b/src/java.base/share/classes/sun/security/ssl/CookieExtension.java @@ -117,7 +117,8 @@ public class CookieExtension { // Is it a supported and enabled extension? if (!chc.sslConfig.isAvailable(SSLExtension.CH_COOKIE)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable cookie extension"); } @@ -154,7 +155,8 @@ public class CookieExtension { // Is it a supported and enabled extension? if (!shc.sslConfig.isAvailable(SSLExtension.CH_COOKIE)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable cookie extension"); } @@ -218,7 +220,8 @@ public class CookieExtension { // Is it a supported and enabled extension? if (!shc.sslConfig.isAvailable(SSLExtension.HRR_COOKIE)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable cookie extension"); } @@ -253,7 +256,8 @@ public class CookieExtension { // Is it a supported and enabled extension? if (!chc.sslConfig.isAvailable(SSLExtension.HRR_COOKIE)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable cookie extension"); } @@ -280,7 +284,8 @@ public class CookieExtension { // Is it a supported and enabled extension? if (!shc.sslConfig.isAvailable(SSLExtension.HRR_COOKIE)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable cookie extension"); } diff --git a/src/java.base/share/classes/sun/security/ssl/DHClientKeyExchange.java b/src/java.base/share/classes/sun/security/ssl/DHClientKeyExchange.java index 53f9896a3e4..63031e2b0db 100644 --- a/src/java.base/share/classes/sun/security/ssl/DHClientKeyExchange.java +++ b/src/java.base/share/classes/sun/security/ssl/DHClientKeyExchange.java @@ -187,7 +187,7 @@ final class DHClientKeyExchange { chc.handshakePossessions.add(dhePossession); DHClientKeyExchangeMessage ckem = new DHClientKeyExchangeMessage(chc); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Produced DH ClientKeyExchange handshake message", ckem); } @@ -268,7 +268,7 @@ final class DHClientKeyExchange { DHClientKeyExchangeMessage ckem = new DHClientKeyExchangeMessage(shc, message); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Consuming DH ClientKeyExchange handshake message", ckem); } diff --git a/src/java.base/share/classes/sun/security/ssl/DHServerKeyExchange.java b/src/java.base/share/classes/sun/security/ssl/DHServerKeyExchange.java index 7d94598f5cf..afef70a29d5 100644 --- a/src/java.base/share/classes/sun/security/ssl/DHServerKeyExchange.java +++ b/src/java.base/share/classes/sun/security/ssl/DHServerKeyExchange.java @@ -481,7 +481,7 @@ final class DHServerKeyExchange { ServerHandshakeContext shc = (ServerHandshakeContext)context; DHServerKeyExchangeMessage skem = new DHServerKeyExchangeMessage(shc); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Produced DH ServerKeyExchange handshake message", skem); } @@ -512,7 +512,7 @@ final class DHServerKeyExchange { DHServerKeyExchangeMessage skem = new DHServerKeyExchangeMessage(chc, message); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Consuming DH ServerKeyExchange handshake message", skem); } diff --git a/src/java.base/share/classes/sun/security/ssl/DTLSInputRecord.java b/src/java.base/share/classes/sun/security/ssl/DTLSInputRecord.java index e880f36e846..91759ae6c4b 100644 --- a/src/java.base/share/classes/sun/security/ssl/DTLSInputRecord.java +++ b/src/java.base/share/classes/sun/security/ssl/DTLSInputRecord.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -125,7 +125,7 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { return null; } - if (SSLLogger.isOn() && SSLLogger.isOn("packet")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.RECORD_PACKET)) { SSLLogger.fine("Raw read", packet); } @@ -150,7 +150,7 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { int contentLen = ((packet.get() & 0xFF) << 8) | (packet.get() & 0xFF); // pos: 11, 12 - if (SSLLogger.isOn() && SSLLogger.isOn("record")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.RECORD)) { SSLLogger.fine("READ: " + ProtocolVersion.nameOf(majorVersion, minorVersion) + " " + ContentType.nameOf(contentType) + ", length = " + @@ -162,7 +162,7 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { if (this.readEpoch > recordEpoch) { // Reset the position of the packet buffer. packet.position(recLim); - if (SSLLogger.isOn() && SSLLogger.isOn("record")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.RECORD)) { SSLLogger.fine("READ: discard this old record", recordEnS); } return null; @@ -181,7 +181,8 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { packet.position(recLim); - if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine("Premature record (epoch), discard it."); } @@ -223,7 +224,7 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { plaintextFragment = plaintext.fragment; contentType = plaintext.contentType; } catch (GeneralSecurityException gse) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine("Discard invalid record: " + gse); } @@ -241,7 +242,8 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { // Cleanup the handshake reassembler if necessary. if ((reassembler != null) && (reassembler.handshakeEpoch < recordEpoch)) { - if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine("Cleanup the handshake reassembler"); } @@ -273,7 +275,8 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { if (hsFrag == null) { // invalid, discard this record - if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine( "Invalid handshake message, discard it."); } @@ -296,7 +299,8 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { return pt == null ? null : new Plaintext[] { pt }; } - if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine("The reassembler is not initialized yet."); } @@ -356,7 +360,7 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { int remaining = plaintextFragment.remaining(); if (remaining < handshakeHeaderSize) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine("Discard invalid record: " + "too small record to hold a handshake fragment"); } @@ -368,7 +372,7 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { // Fail fast for unknown handshake message. byte handshakeType = plaintextFragment.get(); // pos: 0 if (!SSLHandshake.isKnown(handshakeType)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine("Discard invalid record: " + "unknown handshake type size, Handshake.msg_type = " + (handshakeType & 0xFF)); @@ -404,7 +408,7 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { ((plaintextFragment.get() & 0xFF) << 8) | (plaintextFragment.get() & 0xFF); // pos: 9-11 if ((remaining - handshakeHeaderSize) < fragmentLength) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine("Discard invalid record: " + "not a complete handshake fragment in the record"); } @@ -748,7 +752,8 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { // It's OK to discard retransmission as the handshake hash // is computed as if each handshake message had been sent // as a single fragment. - if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine("Have got the full message, discard it."); } @@ -767,9 +772,11 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { } // The ranges SHOULD NOT overlap. - if (hole.offset > hsf.fragmentOffset || hole.limit < fragmentLimit) { + if (hole.offset > hsf.fragmentOffset || + hole.limit < fragmentLimit) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine("Discard invalid record: " + "handshake fragment ranges are overlapping"); } @@ -837,9 +844,11 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { } // Read the random (32 bytes) if (fragmentData.remaining() < 32) { - if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { - SSLLogger.fine("Rejected client hello fragment (bad random len) " + - "fo=" + hsf.fragmentOffset + " fl=" + hsf.fragmentLength); + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { + SSLLogger.fine("Rejected client hello fragment" + + "(bad random len) fo=" + + hsf.fragmentOffset + " fl=" + hsf.fragmentLength); } return null; } @@ -861,9 +870,11 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { // Cookie byte[] cookie = Record.getBytes8(fragmentData); if (firstHello && cookie.length != 0) { - if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { - SSLLogger.fine("Rejected initial client hello fragment (bad cookie len) " + - "fo=" + hsf.fragmentOffset + " fl=" + hsf.fragmentLength); + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { + SSLLogger.fine("Rejected initial client hello " + + " fragment (bad cookie len) fo=" + + hsf.fragmentOffset + " fl=" + hsf.fragmentLength); } return null; } @@ -897,9 +908,11 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { } } } catch (IOException ioe) { - if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine("Rejected client hello fragment " + - "fo=" + hsf.fragmentOffset + " fl=" + hsf.fragmentLength); + "fo=" + hsf.fragmentOffset + " fl=" + + hsf.fragmentLength); } return null; } @@ -1029,7 +1042,8 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { int previousEpoch = nextRecordEpoch - 1; if (rf.recordEpoch < previousEpoch) { // Too old to use, discard this record. - if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine( "Too old epoch to use this record, discard it."); } @@ -1075,7 +1089,8 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { if (!isDesired) { // Too old to use, discard this retransmitted record - if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine( "Too old retransmission to use, discard it."); } @@ -1088,7 +1103,8 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { // Previously disordered record for the current epoch. // // Should have been retransmitted. Discard this record. - if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine( "Lagging behind record (sequence), discard it."); } @@ -1126,7 +1142,8 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { Plaintext acquirePlaintext() throws SSLProtocolException { if (bufferedFragments.isEmpty()) { - if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine("No received handshake messages"); } return null; @@ -1147,7 +1164,8 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { // Reset the next handshake flight. resetHandshakeFlight(precedingFlight); - if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine("Received a retransmission flight."); } @@ -1159,7 +1177,8 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { } if (!flightIsReady) { - if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine( "The handshake flight is not ready to use: " + handshakeFlight.handshakeType); @@ -1244,7 +1263,8 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { if (readEpoch != rFrag.recordEpoch) { if (readEpoch > rFrag.recordEpoch) { // discard old records - if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine( "Discard old buffered ciphertext fragments."); } @@ -1256,7 +1276,8 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { flightIsReady = false; } - if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine( "Not yet ready to decrypt the cached fragments."); } @@ -1273,7 +1294,8 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { plaintextFragment = plaintext.fragment; rFrag.contentType = plaintext.contentType; } catch (GeneralSecurityException gse) { - if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine("Discard invalid record: ", gse); } @@ -1295,7 +1317,8 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { if (hsFrag == null) { // invalid, discard this record - if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine( "Invalid handshake fragment, discard it", plaintextFragment); @@ -1446,7 +1469,8 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { if (expectCCSFlight) { // Have the ChangeCipherSpec/Finished flight been received? boolean isReady = hasFinishedMessage(); - if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine( "Has the final flight been received? " + isReady); } @@ -1454,7 +1478,8 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { return isReady; } - if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine("No flight is received yet."); } @@ -1467,7 +1492,8 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { // single handshake message flight boolean isReady = hasCompleted(flightType); - if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine( "Is the handshake message completed? " + isReady); } @@ -1481,7 +1507,8 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { if (flightType == SSLHandshake.SERVER_HELLO.id) { // Firstly, check the first flight handshake message. if (!hasCompleted(flightType)) { - if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine( "The ServerHello message is not completed yet."); } @@ -1493,7 +1520,8 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { // an abbreviated handshake // if (hasFinishedMessage()) { - if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine("It's an abbreviated handshake."); } @@ -1507,7 +1535,8 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { SSLHandshake.SERVER_HELLO_DONE.id); if ((holes == null) || !holes.isEmpty()) { // Not yet got the final message of the flight. - if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine( "Not yet got the ServerHelloDone message"); } @@ -1519,7 +1548,8 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { boolean isReady = hasCompleted(bufferedFragments, handshakeFlight.minMessageSeq, handshakeFlight.maxMessageSeq); - if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine( "Is the ServerHello flight (message " + handshakeFlight.minMessageSeq + "-" + @@ -1542,7 +1572,8 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { // Firstly, check the first flight handshake message. if (!hasCompleted(flightType)) { - if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine( "The ClientKeyExchange or client Certificate " + "message is not completed yet."); @@ -1556,7 +1587,8 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { if (needClientVerify(bufferedFragments) && !hasCompleted(SSLHandshake.CERTIFICATE_VERIFY.id)) { - if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine( "Not yet have the CertificateVerify message"); } @@ -1567,7 +1599,8 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { if (!hasFinishedMessage()) { // not yet have the ChangeCipherSpec/Finished messages - if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine( "Not yet have the ChangeCipherSpec and " + "Finished messages"); @@ -1580,7 +1613,8 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { boolean isReady = hasCompleted(bufferedFragments, handshakeFlight.minMessageSeq, handshakeFlight.maxMessageSeq); - if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine( "Is the ClientKeyExchange flight (message " + handshakeFlight.minMessageSeq + "-" + @@ -1594,7 +1628,8 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { // // Otherwise, need to receive more handshake messages. // - if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine("Need to receive more handshake messages"); } @@ -1741,4 +1776,3 @@ final class DTLSInputRecord extends InputRecord implements DTLSRecord { } } } - diff --git a/src/java.base/share/classes/sun/security/ssl/DTLSOutputRecord.java b/src/java.base/share/classes/sun/security/ssl/DTLSOutputRecord.java index 6bb23b72ef9..c69f00afba1 100644 --- a/src/java.base/share/classes/sun/security/ssl/DTLSOutputRecord.java +++ b/src/java.base/share/classes/sun/security/ssl/DTLSOutputRecord.java @@ -92,7 +92,7 @@ final class DTLSOutputRecord extends OutputRecord implements DTLSRecord { void changeWriteCiphers(SSLWriteCipher writeCipher, boolean useChangeCipherSpec) { if (isClosed()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("outbound has closed, ignore outbound " + "change_cipher_spec message"); } @@ -120,7 +120,7 @@ final class DTLSOutputRecord extends OutputRecord implements DTLSRecord { @Override void encodeAlert(byte level, byte description) { if (isClosed()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("outbound has closed, ignore outbound " + "alert message: " + Alert.nameOf(description)); } @@ -137,7 +137,7 @@ final class DTLSOutputRecord extends OutputRecord implements DTLSRecord { @Override void encodeChangeCipherSpec() { if (isClosed()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("outbound has closed, ignore outbound " + "change_cipher_spec message"); } @@ -154,7 +154,7 @@ final class DTLSOutputRecord extends OutputRecord implements DTLSRecord { void encodeHandshake(byte[] source, int offset, int length) { if (isClosed()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("outbound has closed, ignore outbound " + "handshake message", ByteBuffer.wrap(source, offset, length)); @@ -179,14 +179,14 @@ final class DTLSOutputRecord extends OutputRecord implements DTLSRecord { ByteBuffer[] dsts, int dstsOffset, int dstsLength) throws IOException { if (isClosed) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("outbound has closed, ignore outbound " + "application data or cached messages"); } return null; } else if (isCloseWaiting) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("outbound has closed, ignore outbound " + "application data"); } @@ -201,7 +201,7 @@ final class DTLSOutputRecord extends OutputRecord implements DTLSRecord { ByteBuffer destination) throws IOException { if (writeCipher.authenticator.seqNumOverflow()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine( "sequence number extremely close to overflow " + "(2^64-1 packets). Closing connection."); @@ -269,7 +269,7 @@ final class DTLSOutputRecord extends OutputRecord implements DTLSRecord { destination.limit(destination.position()); destination.position(dstContent); - if (SSLLogger.isOn() && SSLLogger.isOn("record")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.RECORD)) { SSLLogger.fine( "WRITE: " + protocolVersion.name + " " + ContentType.APPLICATION_DATA.name + @@ -282,7 +282,7 @@ final class DTLSOutputRecord extends OutputRecord implements DTLSRecord { dstPos, dstLim, headerSize, protocolVersion); - if (SSLLogger.isOn() && SSLLogger.isOn("packet")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.RECORD_PACKET)) { ByteBuffer temporary = destination.duplicate(); temporary.limit(temporary.position()); temporary.position(dstPos); @@ -497,7 +497,7 @@ final class DTLSOutputRecord extends OutputRecord implements DTLSRecord { dstBuf.limit(dstBuf.position()); dstBuf.position(dstContent); - if (SSLLogger.isOn() && SSLLogger.isOn("record")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.RECORD)) { SSLLogger.fine( "WRITE: " + protocolVersion.name + " " + ContentType.nameOf(memo.contentType) + @@ -511,7 +511,7 @@ final class DTLSOutputRecord extends OutputRecord implements DTLSRecord { ProtocolVersion.valueOf(memo.majorVersion, memo.minorVersion)); - if (SSLLogger.isOn() && SSLLogger.isOn("packet")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.RECORD_PACKET)) { ByteBuffer temporary = dstBuf.duplicate(); temporary.limit(temporary.position()); temporary.position(dstPos); diff --git a/src/java.base/share/classes/sun/security/ssl/ECDHClientKeyExchange.java b/src/java.base/share/classes/sun/security/ssl/ECDHClientKeyExchange.java index a626f6f34d0..00060963d08 100644 --- a/src/java.base/share/classes/sun/security/ssl/ECDHClientKeyExchange.java +++ b/src/java.base/share/classes/sun/security/ssl/ECDHClientKeyExchange.java @@ -199,7 +199,7 @@ final class ECDHClientKeyExchange { ECDHClientKeyExchangeMessage cke = new ECDHClientKeyExchangeMessage( chc, sslPossession.encode()); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Produced ECDH ClientKeyExchange handshake message", cke); } @@ -308,7 +308,7 @@ final class ECDHClientKeyExchange { // parse either handshake message containing either EC/XEC. ECDHClientKeyExchangeMessage cke = new ECDHClientKeyExchangeMessage(shc, message); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Consuming ECDH ClientKeyExchange handshake message", cke); } @@ -397,7 +397,7 @@ final class ECDHClientKeyExchange { new ECDHClientKeyExchangeMessage( chc, sslPossession.encode()); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Produced ECDHE ClientKeyExchange handshake message", cke); } @@ -490,7 +490,7 @@ final class ECDHClientKeyExchange { // parse the EC/XEC handshake message ECDHClientKeyExchangeMessage cke = new ECDHClientKeyExchangeMessage(shc, message); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Consuming ECDHE ClientKeyExchange handshake message", cke); } diff --git a/src/java.base/share/classes/sun/security/ssl/ECDHServerKeyExchange.java b/src/java.base/share/classes/sun/security/ssl/ECDHServerKeyExchange.java index 82e888ef98f..9a2c21db05c 100644 --- a/src/java.base/share/classes/sun/security/ssl/ECDHServerKeyExchange.java +++ b/src/java.base/share/classes/sun/security/ssl/ECDHServerKeyExchange.java @@ -489,7 +489,7 @@ final class ECDHServerKeyExchange { ServerHandshakeContext shc = (ServerHandshakeContext)context; ECDHServerKeyExchangeMessage skem = new ECDHServerKeyExchangeMessage(shc); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Produced ECDH ServerKeyExchange handshake message", skem); } @@ -522,7 +522,7 @@ final class ECDHServerKeyExchange { // AlgorithmConstraints are checked during decoding ECDHServerKeyExchangeMessage skem = new ECDHServerKeyExchangeMessage(chc, message); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Consuming ECDH ServerKeyExchange handshake message", skem); } diff --git a/src/java.base/share/classes/sun/security/ssl/ECPointFormatsExtension.java b/src/java.base/share/classes/sun/security/ssl/ECPointFormatsExtension.java index de61e44b258..64d0aea80bb 100644 --- a/src/java.base/share/classes/sun/security/ssl/ECPointFormatsExtension.java +++ b/src/java.base/share/classes/sun/security/ssl/ECPointFormatsExtension.java @@ -171,7 +171,8 @@ final class ECPointFormatsExtension { // Is it a supported and enabled extension? if (!chc.sslConfig.isAvailable(CH_EC_POINT_FORMATS)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable ec_point_formats extension"); } @@ -193,7 +194,7 @@ final class ECPointFormatsExtension { return extData; } - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Need no ec_point_formats extension"); } @@ -221,7 +222,8 @@ final class ECPointFormatsExtension { // Is it a supported and enabled extension? if (!shc.sslConfig.isAvailable(CH_EC_POINT_FORMATS)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable ec_point_formats extension"); } diff --git a/src/java.base/share/classes/sun/security/ssl/EncryptedExtensions.java b/src/java.base/share/classes/sun/security/ssl/EncryptedExtensions.java index bc34e6fe113..8379d5f6cab 100644 --- a/src/java.base/share/classes/sun/security/ssl/EncryptedExtensions.java +++ b/src/java.base/share/classes/sun/security/ssl/EncryptedExtensions.java @@ -134,7 +134,7 @@ final class EncryptedExtensions { SSLHandshake.ENCRYPTED_EXTENSIONS, shc.negotiatedProtocol); eem.extensions.produce(shc, extTypes); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Produced EncryptedExtensions message", eem); } @@ -168,7 +168,7 @@ final class EncryptedExtensions { EncryptedExtensionsMessage eem = new EncryptedExtensionsMessage(chc, message); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Consuming EncryptedExtensions handshake message", eem); } diff --git a/src/java.base/share/classes/sun/security/ssl/ExtendedMasterSecretExtension.java b/src/java.base/share/classes/sun/security/ssl/ExtendedMasterSecretExtension.java index a6bedd9e205..91e5fa499db 100644 --- a/src/java.base/share/classes/sun/security/ssl/ExtendedMasterSecretExtension.java +++ b/src/java.base/share/classes/sun/security/ssl/ExtendedMasterSecretExtension.java @@ -119,7 +119,8 @@ final class ExtendedMasterSecretExtension { if (!chc.sslConfig.isAvailable(CH_EXTENDED_MASTER_SECRET) || !SSLConfiguration.useExtendedMasterSecret || !chc.conContext.protocolVersion.useTLS10PlusSpec()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable extended_master_secret extension"); } @@ -162,7 +163,8 @@ final class ExtendedMasterSecretExtension { if (!shc.sslConfig.isAvailable(CH_EXTENDED_MASTER_SECRET) || !SSLConfiguration.useExtendedMasterSecret || !shc.negotiatedProtocol.useTLS10PlusSpec()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Ignore unavailable extension: " + CH_EXTENDED_MASTER_SECRET.name); } @@ -182,7 +184,8 @@ final class ExtendedMasterSecretExtension { // with a full handshake. shc.isResumption = false; shc.resumingSession = null; - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "abort session resumption which did not use " + "Extended Master Secret extension"); @@ -213,7 +216,8 @@ final class ExtendedMasterSecretExtension { // Is it a supported and enabled extension? if (!shc.sslConfig.isAvailable(CH_EXTENDED_MASTER_SECRET) || !SSLConfiguration.useExtendedMasterSecret) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Ignore unavailable extension: " + CH_EXTENDED_MASTER_SECRET.name); } @@ -252,7 +256,8 @@ final class ExtendedMasterSecretExtension { } else { // Otherwise, continue with a full handshake. shc.isResumption = false; shc.resumingSession = null; - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "abort session resumption, " + "missing Extended Master Secret extension"); diff --git a/src/java.base/share/classes/sun/security/ssl/Finished.java b/src/java.base/share/classes/sun/security/ssl/Finished.java index 4238ced8f01..bf2d2230719 100644 --- a/src/java.base/share/classes/sun/security/ssl/Finished.java +++ b/src/java.base/share/classes/sun/security/ssl/Finished.java @@ -390,7 +390,7 @@ final class Finished { // Change write cipher and delivery ChangeCipherSpec message. ChangeCipherSpec.t10Producer.produce(chc, message); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Produced client Finished handshake message", fm); } @@ -453,7 +453,7 @@ final class Finished { // Change write cipher and delivery ChangeCipherSpec message. ChangeCipherSpec.t10Producer.produce(shc, message); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Produced server Finished handshake message", fm); } @@ -542,7 +542,7 @@ final class Finished { private void onConsumeFinished(ClientHandshakeContext chc, ByteBuffer message) throws IOException { FinishedMessage fm = new FinishedMessage(chc, message); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Consuming server Finished handshake message", fm); } @@ -602,7 +602,7 @@ final class Finished { } FinishedMessage fm = new FinishedMessage(shc, message); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Consuming client Finished handshake message", fm); } @@ -681,7 +681,7 @@ final class Finished { chc.handshakeHash.update(); FinishedMessage fm = new FinishedMessage(chc); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Produced client Finished handshake message", fm); } @@ -778,7 +778,7 @@ final class Finished { shc.handshakeHash.update(); FinishedMessage fm = new FinishedMessage(shc); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Produced server Finished handshake message", fm); } @@ -930,7 +930,7 @@ final class Finished { } FinishedMessage fm = new FinishedMessage(chc, message); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Consuming server Finished handshake message", fm); } @@ -1073,7 +1073,7 @@ final class Finished { } FinishedMessage fm = new FinishedMessage(shc, message); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Consuming client Finished handshake message", fm); } diff --git a/src/java.base/share/classes/sun/security/ssl/HandshakeContext.java b/src/java.base/share/classes/sun/security/ssl/HandshakeContext.java index a5f340d5203..54a2650c058 100644 --- a/src/java.base/share/classes/sun/security/ssl/HandshakeContext.java +++ b/src/java.base/share/classes/sun/security/ssl/HandshakeContext.java @@ -284,14 +284,16 @@ abstract class HandshakeContext implements ConnectionContext { found = true; break; } - } else if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + } else if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine( "Ignore unsupported cipher suite: " + suite + " for " + protocol.name); } } - if (!found && (SSLLogger.isOn()) && SSLLogger.isOn("handshake")) { + if (!found && (SSLLogger.isOn()) && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "No available cipher suite for " + protocol.name); } @@ -335,7 +337,8 @@ abstract class HandshakeContext implements ConnectionContext { } if (!isSupported && - SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.finest( "Ignore unsupported cipher suite: " + suite); } @@ -556,7 +559,8 @@ abstract class HandshakeContext implements ConnectionContext { cachedStatus.put(groupType, groupAvailable); if (!groupAvailable && - SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine( "No activated named group in " + groupType); } @@ -570,13 +574,15 @@ abstract class HandshakeContext implements ConnectionContext { } } - if (!retval && SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + if (!retval && SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine("No active named group(s), ignore " + suite); } return retval; - } else if (SSLLogger.isOn() && SSLLogger.isOn("verbose")) { + } else if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine("Ignore disabled cipher suite: " + suite); } diff --git a/src/java.base/share/classes/sun/security/ssl/HandshakeOutStream.java b/src/java.base/share/classes/sun/security/ssl/HandshakeOutStream.java index 61571cfd03b..b46de0514f8 100644 --- a/src/java.base/share/classes/sun/security/ssl/HandshakeOutStream.java +++ b/src/java.base/share/classes/sun/security/ssl/HandshakeOutStream.java @@ -61,7 +61,7 @@ public class HandshakeOutStream extends ByteArrayOutputStream { if (!outputRecord.isClosed()) { outputRecord.encodeHandshake(buf, 0, count); } else { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("outbound has closed, ignore outbound " + "handshake messages", ByteBuffer.wrap(buf, 0, count)); } diff --git a/src/java.base/share/classes/sun/security/ssl/HelloRequest.java b/src/java.base/share/classes/sun/security/ssl/HelloRequest.java index b207e1071b0..d2d3b033e80 100644 --- a/src/java.base/share/classes/sun/security/ssl/HelloRequest.java +++ b/src/java.base/share/classes/sun/security/ssl/HelloRequest.java @@ -101,7 +101,7 @@ final class HelloRequest { ServerHandshakeContext shc = (ServerHandshakeContext)context; HelloRequestMessage hrm = new HelloRequestMessage(shc); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Produced HelloRequest handshake message", hrm); } @@ -137,7 +137,7 @@ final class HelloRequest { ServerHandshakeContext shc = (ServerHandshakeContext)context; HelloRequestMessage hrm = new HelloRequestMessage(shc); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Produced HelloRequest handshake message", hrm); } @@ -177,7 +177,7 @@ final class HelloRequest { // be sent by the server at any time. Please don't clean up this // handshake consumer. HelloRequestMessage hrm = new HelloRequestMessage(chc, message); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Consuming HelloRequest handshake message", hrm); } @@ -190,7 +190,8 @@ final class HelloRequest { } if (!chc.conContext.secureRenegotiation) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning( "Continue with insecure renegotiation"); } @@ -206,7 +207,8 @@ final class HelloRequest { // SSLHandshake.CLIENT_HELLO.produce(context, hrm); } else { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore HelloRequest, handshaking is in progress"); } diff --git a/src/java.base/share/classes/sun/security/ssl/HelloVerifyRequest.java b/src/java.base/share/classes/sun/security/ssl/HelloVerifyRequest.java index 1922a4339bb..5c0833eef5c 100644 --- a/src/java.base/share/classes/sun/security/ssl/HelloVerifyRequest.java +++ b/src/java.base/share/classes/sun/security/ssl/HelloVerifyRequest.java @@ -140,7 +140,7 @@ final class HelloVerifyRequest { HelloVerifyRequestMessage hvrm = new HelloVerifyRequestMessage(shc, message); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Produced HelloVerifyRequest handshake message", hvrm); } @@ -197,7 +197,7 @@ final class HelloVerifyRequest { HelloVerifyRequestMessage hvrm = new HelloVerifyRequestMessage(chc, message); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Consuming HelloVerifyRequest handshake message", hvrm); } diff --git a/src/java.base/share/classes/sun/security/ssl/KeyShareExtension.java b/src/java.base/share/classes/sun/security/ssl/KeyShareExtension.java index 0d2cbb8f529..67780afea4f 100644 --- a/src/java.base/share/classes/sun/security/ssl/KeyShareExtension.java +++ b/src/java.base/share/classes/sun/security/ssl/KeyShareExtension.java @@ -93,7 +93,8 @@ final class KeyShareExtension { Record.putInt16(m, namedGroupId); Record.putBytes16(m, keyExchange); } catch (IOException ioe) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning( "Unlikely IOException", ioe); } @@ -225,7 +226,8 @@ final class KeyShareExtension { // Is it a supported and enabled extension? if (!chc.sslConfig.isAvailable(SSLExtension.CH_KEY_SHARE)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable key_share extension"); } @@ -240,7 +242,8 @@ final class KeyShareExtension { namedGroups = chc.clientRequestedNamedGroups; if (namedGroups == null || namedGroups.isEmpty()) { // No supported groups. - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning( "Ignore key_share extension, no supported groups"); } @@ -290,7 +293,8 @@ final class KeyShareExtension { NamedGroup ng) { SSLKeyExchange ke = SSLKeyExchange.valueOf(ng); if (ke == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning( "No key exchange for named group " + ng.name); } @@ -328,7 +332,8 @@ final class KeyShareExtension { ServerHandshakeContext shc = (ServerHandshakeContext)context; if (shc.handshakeExtensions.containsKey(SSLExtension.CH_KEY_SHARE)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "The key_share extension has been loaded"); } @@ -337,7 +342,8 @@ final class KeyShareExtension { // Is it a supported and enabled extension? if (!shc.sslConfig.isAvailable(SSLExtension.CH_KEY_SHARE)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable key_share extension"); } @@ -352,7 +358,7 @@ final class KeyShareExtension { if (ng == null || !NamedGroup.isActivatable(shc.sslConfig, shc.algorithmConstraints, ng)) { if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unsupported named group: " + NamedGroup.nameOf(entry.namedGroupId)); @@ -367,7 +373,7 @@ final class KeyShareExtension { if (!isCredentialPermitted(shc.algorithmConstraints, kaCred)) { if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning( "key share entry of " + ng + " does not " + "comply with algorithm constraints"); @@ -376,7 +382,8 @@ final class KeyShareExtension { credentials.add(kaCred); } } catch (GeneralSecurityException ex) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning( "Cannot decode named group: " + NamedGroup.nameOf(entry.namedGroupId)); @@ -520,7 +527,8 @@ final class KeyShareExtension { SSLExtension.CH_KEY_SHARE); if (kss == null) { // Unlikely, no key_share extension requested. - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning( "Ignore, no client key_share extension"); } @@ -529,7 +537,8 @@ final class KeyShareExtension { // Is it a supported and enabled extension? if (!shc.sslConfig.isAvailable(SSLExtension.SH_KEY_SHARE)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning( "Ignore, no available server key_share extension"); } @@ -540,7 +549,8 @@ final class KeyShareExtension { if ((shc.handshakeCredentials == null) || shc.handshakeCredentials.isEmpty()) { // Unlikely, HelloRetryRequest should be used earlier. - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning( "No available client key share entries"); } @@ -560,7 +570,8 @@ final class KeyShareExtension { SSLKeyExchange ke = SSLKeyExchange.valueOf(ng); if (ke == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning( "No key exchange for named group " + ng.name); } @@ -624,7 +635,8 @@ final class KeyShareExtension { if (keyShare == null) { // Unlikely, HelloRetryRequest should be used instead earlier. - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning( "No available server key_share extension"); } @@ -757,7 +769,7 @@ final class KeyShareExtension { ClientHandshakeContext chc = (ClientHandshakeContext)context; // Cannot use the previous requested key shares anymore. - if (SSLLogger.isOn() && SSLLogger.isOn("handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "No key_share extension in ServerHello, " + "cleanup the key shares if necessary"); @@ -850,7 +862,8 @@ final class KeyShareExtension { for (NamedGroup ng : shc.clientRequestedNamedGroups) { if (NamedGroup.isActivatable(shc.sslConfig, shc.algorithmConstraints, ng)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "HelloRetryRequest selected named group: " + ng.name); diff --git a/src/java.base/share/classes/sun/security/ssl/KeyUpdate.java b/src/java.base/share/classes/sun/security/ssl/KeyUpdate.java index 4e5a9683079..db7ea170a23 100644 --- a/src/java.base/share/classes/sun/security/ssl/KeyUpdate.java +++ b/src/java.base/share/classes/sun/security/ssl/KeyUpdate.java @@ -191,7 +191,7 @@ final class KeyUpdate { // The consuming happens in client side only. PostHandshakeContext hc = (PostHandshakeContext)context; KeyUpdateMessage km = new KeyUpdateMessage(hc, message); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Consuming KeyUpdate post-handshake message", km); } @@ -235,7 +235,7 @@ final class KeyUpdate { rc.baseSecret = nplus1; hc.conContext.inputRecord.changeReadCiphers(rc); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine("KeyUpdate: read key updated"); } } catch (GeneralSecurityException gse) { @@ -276,7 +276,7 @@ final class KeyUpdate { return null; } KeyUpdateMessage km = (KeyUpdateMessage)message; - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Produced KeyUpdate post-handshake message", km); } @@ -328,7 +328,7 @@ final class KeyUpdate { // changeWriteCiphers() implementation. wc.baseSecret = nplus1; hc.conContext.outputRecord.changeWriteCiphers(wc, km.status.id); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine("KeyUpdate: write key updated"); } diff --git a/src/java.base/share/classes/sun/security/ssl/MaxFragExtension.java b/src/java.base/share/classes/sun/security/ssl/MaxFragExtension.java index a6c376ad962..fc471f77fbc 100644 --- a/src/java.base/share/classes/sun/security/ssl/MaxFragExtension.java +++ b/src/java.base/share/classes/sun/security/ssl/MaxFragExtension.java @@ -176,7 +176,8 @@ final class MaxFragExtension { // Is it a supported and enabled extension? if (!chc.sslConfig.isAvailable(CH_MAX_FRAGMENT_LENGTH)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable max_fragment_length extension"); } @@ -213,7 +214,8 @@ final class MaxFragExtension { } else { // log and ignore, no MFL extension. chc.maxFragmentLength = -1; - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "No available max_fragment_length extension can " + "be used for fragment size of " + @@ -243,7 +245,8 @@ final class MaxFragExtension { ServerHandshakeContext shc = (ServerHandshakeContext)context; if (!shc.sslConfig.isAvailable(CH_MAX_FRAGMENT_LENGTH)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable max_fragment_length extension"); } @@ -288,7 +291,8 @@ final class MaxFragExtension { MaxFragLenSpec spec = (MaxFragLenSpec) shc.handshakeExtensions.get(CH_MAX_FRAGMENT_LENGTH); if (spec == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.finest( "Ignore unavailable max_fragment_length extension"); } @@ -305,7 +309,8 @@ final class MaxFragExtension { // For better interoperability, abort the maximum // fragment length negotiation, rather than terminate // the connection with a fatal alert. - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Abort the maximum fragment length negotiation, " + "may overflow the maximum packet size limit."); @@ -413,7 +418,8 @@ final class MaxFragExtension { // For better interoperability, abort the maximum // fragment length negotiation, rather than terminate // the connection with a fatal alert. - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Abort the maximum fragment length negotiation, " + "may overflow the maximum packet size limit."); @@ -455,7 +461,8 @@ final class MaxFragExtension { MaxFragLenSpec spec = (MaxFragLenSpec) shc.handshakeExtensions.get(CH_MAX_FRAGMENT_LENGTH); if (spec == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.finest( "Ignore unavailable max_fragment_length extension"); } @@ -472,7 +479,8 @@ final class MaxFragExtension { // For better interoperability, abort the maximum // fragment length negotiation, rather than terminate // the connection with a fatal alert. - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Abort the maximum fragment length negotiation, " + "may overflow the maximum packet size limit."); @@ -578,7 +586,8 @@ final class MaxFragExtension { // For better interoperability, abort the maximum // fragment length negotiation, rather than terminate // the connection with a fatal alert. - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Abort the maximum fragment length negotiation, " + "may overflow the maximum packet size limit."); diff --git a/src/java.base/share/classes/sun/security/ssl/NamedGroup.java b/src/java.base/share/classes/sun/security/ssl/NamedGroup.java index 02524e67656..430408d54b7 100644 --- a/src/java.base/share/classes/sun/security/ssl/NamedGroup.java +++ b/src/java.base/share/classes/sun/security/ssl/NamedGroup.java @@ -330,7 +330,8 @@ enum NamedGroup { | NoSuchAlgorithmException exp) { if (namedGroupSpec != NamedGroupSpec.NAMED_GROUP_XDH) { mediator = false; - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning( "No AlgorithmParameters or KeyFactory for " + name, exp); @@ -352,7 +353,8 @@ enum NamedGroup { // AlgorithmParameters.getInstance(name); } catch (NoSuchAlgorithmException nsae) { mediator = false; - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning( "No AlgorithmParameters for " + name, nsae); } @@ -445,7 +447,7 @@ enum NamedGroup { NamedGroup ng = NamedGroup.nameOf(ss); if (ng == null || !ng.isAvailable) { if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.finest( "Ignore the named group (" + ss + "), unsupported or unavailable"); @@ -912,7 +914,8 @@ enum NamedGroup { namedGroups = customizedNames; } else { if (defaultNames.length == 0) { - SSLLogger.logWarning("ssl", "No default named groups"); + SSLLogger.logWarning(SSLLogger.Opt.SSL, + "No default named groups"); } namedGroups = defaultNames; } diff --git a/src/java.base/share/classes/sun/security/ssl/NewSessionTicket.java b/src/java.base/share/classes/sun/security/ssl/NewSessionTicket.java index 89b0a72bb32..ae632334de2 100644 --- a/src/java.base/share/classes/sun/security/ssl/NewSessionTicket.java +++ b/src/java.base/share/classes/sun/security/ssl/NewSessionTicket.java @@ -202,7 +202,8 @@ final class NewSessionTicket { this.ticket = Record.getBytes16(m); if (ticket.length == 0) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "No ticket in the NewSessionTicket handshake message"); } @@ -329,7 +330,8 @@ final class NewSessionTicket { if (hc instanceof ServerHandshakeContext) { // Is this session resumable? if (!hc.handshakeSession.isRejoinable()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("No session ticket produced: " + "session is not resumable"); } @@ -347,7 +349,8 @@ final class NewSessionTicket { SSLExtension.PSK_KEY_EXCHANGE_MODES); if (pkemSpec == null || !pkemSpec.contains(PskKeyExchangeMode.PSK_DHE_KE)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("No session ticket produced: " + "client does not support psk_dhe_ke"); } @@ -358,7 +361,8 @@ final class NewSessionTicket { // Check if we have sent a PSK already, then we know it is // using an allowable PSK exchange key mode. if (!hc.handshakeSession.isPSKable()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("No session ticket produced: " + "No session ticket allowed in this session"); } @@ -372,7 +376,8 @@ final class NewSessionTicket { hc.sslContext.engineGetServerSessionContext(); int sessionTimeoutSeconds = sessionCache.getSessionTimeout(); if (sessionTimeoutSeconds > MAX_TICKET_LIFETIME) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("No session ticket produced: " + "session timeout is too long"); } @@ -459,7 +464,8 @@ final class NewSessionTicket { if (!nstm.isValid()) { hc.statelessResumption = false; } else { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Produced NewSessionTicket stateless " + "post-handshake message", nstm); } @@ -474,7 +480,8 @@ final class NewSessionTicket { sessionCache.getSessionTimeout(), hc.sslContext.getSecureRandom(), nonce, newId.getId()); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Produced NewSessionTicket " + "post-handshake message", nstm); } @@ -488,7 +495,7 @@ final class NewSessionTicket { return nstm; } - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("No NewSessionTicket created"); } @@ -526,7 +533,8 @@ final class NewSessionTicket { shc.sslContext.engineGetServerSessionContext(); int sessionTimeoutSeconds = sessionCache.getSessionTimeout(); if (sessionTimeoutSeconds > MAX_TICKET_LIFETIME) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Session timeout is too long. No ticket sent."); } @@ -540,7 +548,7 @@ final class NewSessionTicket { NewSessionTicketMessage nstm = new T12NewSessionTicketMessage(shc, sessionTimeoutSeconds, new SessionTicketSpec().encrypt(shc, sessionCopy)); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Produced NewSessionTicket stateless handshake message", nstm); @@ -579,7 +587,7 @@ final class NewSessionTicket { HandshakeContext hc = (HandshakeContext)context; NewSessionTicketMessage nstm = new T13NewSessionTicketMessage(hc, message); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Consuming NewSessionTicket message", nstm); } @@ -590,7 +598,8 @@ final class NewSessionTicket { // discard tickets with timeout 0 if (nstm.ticketLifetime <= 0 || nstm.ticketLifetime > MAX_TICKET_LIFETIME) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Discarding NewSessionTicket with lifetime " + nstm.ticketLifetime, nstm); @@ -599,7 +608,8 @@ final class NewSessionTicket { } if (sessionCache.getSessionTimeout() > MAX_TICKET_LIFETIME) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Session cache lifetime is too long. " + "Discarding ticket."); @@ -611,7 +621,8 @@ final class NewSessionTicket { SecretKey resumptionMasterSecret = sessionToSave.getResumptionMasterSecret(); if (resumptionMasterSecret == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Session has no resumption master secret. " + "Ignoring ticket."); @@ -637,7 +648,7 @@ final class NewSessionTicket { sessionCopy.setPskIdentity(nstm.ticket); sessionCache.put(sessionCopy, sessionCopy.isPSK()); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("MultiNST PSK (Server): " + Utilities.toHexString(Arrays.copyOf(nstm.ticket, 16))); } @@ -665,7 +676,8 @@ final class NewSessionTicket { NewSessionTicketMessage nstm = new T12NewSessionTicketMessage(hc, message); if (nstm.ticket.length == 0) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("NewSessionTicket ticket was empty"); } return; @@ -674,7 +686,8 @@ final class NewSessionTicket { // discard tickets with timeout 0 if (nstm.ticketLifetime <= 0 || nstm.ticketLifetime > MAX_TICKET_LIFETIME) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Discarding NewSessionTicket with lifetime " + nstm.ticketLifetime, nstm); @@ -686,7 +699,8 @@ final class NewSessionTicket { hc.sslContext.engineGetClientSessionContext(); if (sessionCache.getSessionTimeout() > MAX_TICKET_LIFETIME) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Session cache lifetime is too long. " + "Discarding ticket."); @@ -695,7 +709,7 @@ final class NewSessionTicket { } hc.handshakeSession.setPskIdentity(nstm.ticket); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Consuming NewSessionTicket\n" + nstm); } } diff --git a/src/java.base/share/classes/sun/security/ssl/OutputRecord.java b/src/java.base/share/classes/sun/security/ssl/OutputRecord.java index 416d5d1b5ef..7a188ccf476 100644 --- a/src/java.base/share/classes/sun/security/ssl/OutputRecord.java +++ b/src/java.base/share/classes/sun/security/ssl/OutputRecord.java @@ -188,7 +188,7 @@ abstract class OutputRecord recordLock.lock(); try { if (isClosed()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("outbound has closed, ignore outbound " + "change_cipher_spec message"); } @@ -222,7 +222,7 @@ abstract class OutputRecord recordLock.lock(); try { if (isClosed()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("outbound has closed, ignore outbound " + "key_update handshake message"); } diff --git a/src/java.base/share/classes/sun/security/ssl/PreSharedKeyExtension.java b/src/java.base/share/classes/sun/security/ssl/PreSharedKeyExtension.java index b99c0175838..87d97580bcb 100644 --- a/src/java.base/share/classes/sun/security/ssl/PreSharedKeyExtension.java +++ b/src/java.base/share/classes/sun/security/ssl/PreSharedKeyExtension.java @@ -341,7 +341,8 @@ final class PreSharedKeyExtension { ServerHandshakeContext shc = (ServerHandshakeContext)context; // Is it a supported and enabled extension? if (!shc.sslConfig.isAvailable(SSLExtension.CH_PRE_SHARED_KEY)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable pre_shared_key extension"); } @@ -394,7 +395,7 @@ final class PreSharedKeyExtension { } if (b == null || s == null) { if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Stateless session ticket invalid"); } @@ -402,7 +403,8 @@ final class PreSharedKeyExtension { } if (s != null && canRejoin(clientHello, shc, s)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Resuming session: ", s); } @@ -436,7 +438,7 @@ final class PreSharedKeyExtension { // Check protocol version if (result && s.getProtocolVersion() != shc.negotiatedProtocol) { if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.finest("Can't resume, incorrect protocol version"); } @@ -450,7 +452,7 @@ final class PreSharedKeyExtension { s.getPeerPrincipal(); } catch (SSLPeerUnverifiedException e) { if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.finest( "Can't resume, " + "client authentication is required"); @@ -466,7 +468,8 @@ final class PreSharedKeyExtension { if (result && !shc.localSupportedCertSignAlgs.containsAll(sessionSigAlgs)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Can't resume. Session uses different " + "signature algorithms"); } @@ -481,7 +484,7 @@ final class PreSharedKeyExtension { String sessionIdentityAlg = s.getIdentificationProtocol(); if (!identityAlg.equalsIgnoreCase(sessionIdentityAlg)) { if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.finest("Can't resume, endpoint id" + " algorithm does not match, requested: " + @@ -495,7 +498,7 @@ final class PreSharedKeyExtension { if (result && (!shc.isNegotiable(s.getSuite()) || !clientHello.cipherSuites.contains(s.getSuite()))) { if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.finest( "Can't resume, unavailable session cipher suite"); } @@ -653,7 +656,8 @@ final class PreSharedKeyExtension { // The producing happens in client side only. ClientHandshakeContext chc = (ClientHandshakeContext)context; if (!chc.isResumption || chc.resumingSession == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("No session to resume."); } return null; @@ -663,7 +667,8 @@ final class PreSharedKeyExtension { Collection sessionSigAlgs = chc.resumingSession.getLocalSupportedSignatureSchemes(); if (!chc.localSupportedCertSignAlgs.containsAll(sessionSigAlgs)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Existing session uses different " + "signature algorithms"); } @@ -673,7 +678,8 @@ final class PreSharedKeyExtension { // The session must have a pre-shared key SecretKey psk = chc.resumingSession.getPreSharedKey(); if (psk == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Existing session has no PSK."); } return null; @@ -687,7 +693,8 @@ final class PreSharedKeyExtension { } if (chc.pskIdentity == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "PSK has no identity, or identity was already used"); } @@ -699,7 +706,7 @@ final class PreSharedKeyExtension { chc.sslContext.engineGetClientSessionContext(); sessionCache.remove(chc.resumingSession.getSessionId(), true); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Found resumable session. Preparing PSK message."); SSLLogger.fine( @@ -836,7 +843,7 @@ final class PreSharedKeyExtension { public void absent(ConnectionContext context, HandshakeMessage message) throws IOException { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Handling pre_shared_key absence."); } @@ -901,7 +908,7 @@ final class PreSharedKeyExtension { } SHPreSharedKeySpec shPsk = new SHPreSharedKeySpec(chc, buffer); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Received pre_shared_key extension: ", shPsk); } @@ -911,7 +918,7 @@ final class PreSharedKeyExtension { "Selected identity index is not in correct range."); } - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Resuming session: ", chc.resumingSession); } @@ -925,7 +932,7 @@ final class PreSharedKeyExtension { HandshakeMessage message) throws IOException { ClientHandshakeContext chc = (ClientHandshakeContext)context; - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Handling pre_shared_key absence."); } diff --git a/src/java.base/share/classes/sun/security/ssl/PredefinedDHParameterSpecs.java b/src/java.base/share/classes/sun/security/ssl/PredefinedDHParameterSpecs.java index 8f5cc000494..42e914fcaf8 100644 --- a/src/java.base/share/classes/sun/security/ssl/PredefinedDHParameterSpecs.java +++ b/src/java.base/share/classes/sun/security/ssl/PredefinedDHParameterSpecs.java @@ -246,7 +246,7 @@ final class PredefinedDHParameterSpecs { Matcher spacesMatcher = spacesPattern.matcher(property); property = spacesMatcher.replaceAll(""); - if (SSLLogger.isOn() && SSLLogger.isOn("sslctx")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSLCTX)) { SSLLogger.fine( "The Security Property " + PROPERTY_NAME + ": " + property); @@ -262,7 +262,8 @@ final class PredefinedDHParameterSpecs { String primeModulus = paramsFinder.group(1); BigInteger p = new BigInteger(primeModulus, 16); if (!p.isProbablePrime(PRIME_CERTAINTY)) { - if (SSLLogger.isOn() && SSLLogger.isOn("sslctx")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.SSLCTX)) { SSLLogger.fine( "Prime modulus p in Security Property, " + PROPERTY_NAME + ", is not a prime: " + @@ -279,7 +280,8 @@ final class PredefinedDHParameterSpecs { DHParameterSpec spec = new DHParameterSpec(p, g); defaultParams.put(primeLen, spec); } - } else if (SSLLogger.isOn() && SSLLogger.isOn("sslctx")) { + } else if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.SSLCTX)) { SSLLogger.fine("Invalid Security Property, " + PROPERTY_NAME + ", definition"); } diff --git a/src/java.base/share/classes/sun/security/ssl/PskKeyExchangeModesExtension.java b/src/java.base/share/classes/sun/security/ssl/PskKeyExchangeModesExtension.java index 6c306839b5a..4b641e157a6 100644 --- a/src/java.base/share/classes/sun/security/ssl/PskKeyExchangeModesExtension.java +++ b/src/java.base/share/classes/sun/security/ssl/PskKeyExchangeModesExtension.java @@ -184,7 +184,8 @@ final class PskKeyExchangeModesExtension { // Is it a supported and enabled extension? if (!shc.sslConfig.isAvailable( SSLExtension.PSK_KEY_EXCHANGE_MODES)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable psk_key_exchange_modes extension"); } @@ -216,7 +217,8 @@ final class PskKeyExchangeModesExtension { if (!spec.contains(PskKeyExchangeMode.PSK_DHE_KE)) { shc.isResumption = false; shc.resumingSession = null; - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "abort session resumption, " + "no supported psk_dhe_ke PSK key exchange mode"); @@ -247,7 +249,8 @@ final class PskKeyExchangeModesExtension { // Is it a supported and enabled extension? if (!chc.sslConfig.isAvailable( SSLExtension.PSK_KEY_EXCHANGE_MODES)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning( "Ignore unavailable psk_key_exchange_modes extension"); } @@ -287,7 +290,8 @@ final class PskKeyExchangeModesExtension { if (shc.isResumption) { // resumingSession may not be set shc.isResumption = false; shc.resumingSession = null; - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "abort session resumption, " + "no supported psk_dhe_ke PSK key exchange mode"); diff --git a/src/java.base/share/classes/sun/security/ssl/QuicEngineOutputRecord.java b/src/java.base/share/classes/sun/security/ssl/QuicEngineOutputRecord.java index 7e307ba9d27..3a91906971f 100644 --- a/src/java.base/share/classes/sun/security/ssl/QuicEngineOutputRecord.java +++ b/src/java.base/share/classes/sun/security/ssl/QuicEngineOutputRecord.java @@ -75,14 +75,14 @@ final class QuicEngineOutputRecord extends OutputRecord implements SSLRecord { recordLock.lock(); try { if (isClosed()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("outbound has closed, ignore outbound " + "alert message: " + Alert.nameOf(description)); } return; } if (level == Alert.Level.WARNING.level) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("Suppressing warning-level " + "alert message: " + Alert.nameOf(description)); } @@ -90,7 +90,7 @@ final class QuicEngineOutputRecord extends OutputRecord implements SSLRecord { } if (alert != null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("Suppressing subsequent alert: " + description + ", original: " + alert.id); } @@ -109,7 +109,7 @@ final class QuicEngineOutputRecord extends OutputRecord implements SSLRecord { recordLock.lock(); try { if (isClosed()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("outbound has closed, ignore outbound " + "handshake message", ByteBuffer.wrap(source, offset, length)); diff --git a/src/java.base/share/classes/sun/security/ssl/QuicKeyManager.java b/src/java.base/share/classes/sun/security/ssl/QuicKeyManager.java index 4613dcf96ff..634396868df 100644 --- a/src/java.base/share/classes/sun/security/ssl/QuicKeyManager.java +++ b/src/java.base/share/classes/sun/security/ssl/QuicKeyManager.java @@ -244,7 +244,7 @@ sealed abstract class QuicKeyManager if (toDiscard == null) { return; } - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.finest("discarding keys (keyphase=" + toDiscard.writeCipher.getKeyPhase() + ") of " + this.keySpace + " key space"); @@ -389,7 +389,7 @@ sealed abstract class QuicKeyManager if (toDiscard == null) { return; } - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.finest("discarding keys (keyphase=" + toDiscard.writeCipher.getKeyPhase() + ") of " + this.keySpace + " key space"); @@ -570,7 +570,7 @@ sealed abstract class QuicKeyManager if (series == null) { return; } - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.finest("discarding key (series) of " + this.keySpace + " key space"); } @@ -611,7 +611,7 @@ sealed abstract class QuicKeyManager if (series.canUseOldDecryptKey(packetNumber)) { final QuicReadCipher oldReadCipher = series.old; assert oldReadCipher != null : "old key is unexpectedly null"; - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.finest("using old read key to decrypt packet: " + packetNumber + ", with incoming key phase: " + keyPhase + ", current key phase: " + @@ -624,7 +624,7 @@ sealed abstract class QuicKeyManager if (!series.current.usedByBothEndpoints() && series.current.writeCipher.hasEncryptedAny() && oneRttContext.getLargestPeerAckedPN() - >= series.current.writeCipher.lowestEncryptedPktNum()) { + >= series.current.writeCipher.lowestEncryptedPktNum()) { // RFC-9001, section 6.2: // An endpoint that receives an acknowledgment that is // carried in a packet protected with old keys where any @@ -633,7 +633,7 @@ sealed abstract class QuicKeyManager // KEY_UPDATE_ERROR. This indicates that a peer has // received and acknowledged a packet that initiates a key // update, but has not updated keys in response. - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.finest("peer used incorrect key, was" + " expected to use updated key of" + " key phase: " + currentKeyPhase + @@ -646,7 +646,7 @@ sealed abstract class QuicKeyManager } return; } - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.finest("detected ONE_RTT key update, current key " + "phase: " + currentKeyPhase + ", incoming key phase: " + keyPhase @@ -717,7 +717,7 @@ sealed abstract class QuicKeyManager } final long numEncrypted = cipher.getNumEncrypted(); if (numEncrypted >= 0.8 * confidentialityLimit) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.finest("about to reach confidentiality limit, " + "attempting to initiate a 1-RTT key update," + " packet number: " + @@ -732,7 +732,7 @@ sealed abstract class QuicKeyManager : "key phase of updated key unexpectedly matches " + "the key phase " + cipher.getKeyPhase() + " of current keys"; - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.finest( "1-RTT key update initiated, new key phase: " + newKeyPhase); @@ -755,7 +755,7 @@ sealed abstract class QuicKeyManager // current key phase. This ensures that keys are // available to both peers before // another key update can be initiated. - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.finest( "skipping key update initiation because peer " + "hasn't yet sent us a packet encrypted with " + @@ -803,7 +803,7 @@ sealed abstract class QuicKeyManager // (we avoid timing attacks by not generating // keys during decryption, our key generation // only happens during encryption) - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.finest("next keys unavailable," + " won't decrypt a packet which appears to be" + " a key update"); @@ -815,7 +815,7 @@ sealed abstract class QuicKeyManager // use the next keys to attempt decrypting currentKeySeries.next.readCipher.decryptPacket(packetNumber, packet, headerLength, output); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.finest( "decrypted using next keys for peer-initiated" + " key update; will now switch to new key phase: " + @@ -1025,14 +1025,14 @@ sealed abstract class QuicKeyManager // update the key series this.keySeries = newSeries; if (oldReadCipher != null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.finest( "discarding old read key of key phase: " + oldReadCipher.getKeyPhase()); } oldReadCipher.discard(false); } - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.finest("discarding write key of key phase: " + writeCipherToDiscard.getKeyPhase()); } diff --git a/src/java.base/share/classes/sun/security/ssl/QuicTLSEngineImpl.java b/src/java.base/share/classes/sun/security/ssl/QuicTLSEngineImpl.java index 18790a58c11..74975fc1e5b 100644 --- a/src/java.base/share/classes/sun/security/ssl/QuicTLSEngineImpl.java +++ b/src/java.base/share/classes/sun/security/ssl/QuicTLSEngineImpl.java @@ -560,7 +560,7 @@ public final class QuicTLSEngineImpl implements QuicTLSEngine, SSLTransport { // incoming crypto buffer is null. Validate message type, // check if size is available byte messageType = payload.get(payload.position()); - if (SSLLogger.isOn()) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine("Received message of type 0x" + Integer.toHexString(messageType & 0xFF)); } @@ -835,7 +835,7 @@ public final class QuicTLSEngineImpl implements QuicTLSEngine, SSLTransport { final boolean confirmed = HANDSHAKE_STATE_HANDLE.compareAndSet(this, NEED_SEND_HANDSHAKE_DONE, HANDSHAKE_CONFIRMED); if (confirmed) { - if (SSLLogger.isOn()) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine("QuicTLSEngine (server) marked handshake " + "state as HANDSHAKE_CONFIRMED"); } @@ -853,7 +853,7 @@ public final class QuicTLSEngineImpl implements QuicTLSEngine, SSLTransport { final boolean confirmed = HANDSHAKE_STATE_HANDLE.compareAndSet(this, NEED_RECV_HANDSHAKE_DONE, HANDSHAKE_CONFIRMED); if (confirmed) { - if (SSLLogger.isOn()) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine( "QuicTLSEngine (client) received HANDSHAKE_DONE," + " marking state as HANDSHAKE_DONE"); diff --git a/src/java.base/share/classes/sun/security/ssl/RSAClientKeyExchange.java b/src/java.base/share/classes/sun/security/ssl/RSAClientKeyExchange.java index ec91cb4509a..53d239c9318 100644 --- a/src/java.base/share/classes/sun/security/ssl/RSAClientKeyExchange.java +++ b/src/java.base/share/classes/sun/security/ssl/RSAClientKeyExchange.java @@ -190,7 +190,7 @@ final class RSAClientKeyExchange { throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER, "Cannot generate RSA premaster secret", gse); } - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Produced RSA ClientKeyExchange handshake message", ckem); } @@ -270,7 +270,7 @@ final class RSAClientKeyExchange { RSAClientKeyExchangeMessage ckem = new RSAClientKeyExchangeMessage(shc, message); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Consuming RSA ClientKeyExchange handshake message", ckem); } diff --git a/src/java.base/share/classes/sun/security/ssl/RSAKeyExchange.java b/src/java.base/share/classes/sun/security/ssl/RSAKeyExchange.java index d176d7311d0..d204fddb13c 100644 --- a/src/java.base/share/classes/sun/security/ssl/RSAKeyExchange.java +++ b/src/java.base/share/classes/sun/security/ssl/RSAKeyExchange.java @@ -149,7 +149,8 @@ final class RSAKeyExchange { needFailover = !KeyUtil.isOracleJCEProvider( cipher.getProvider().getName()); } catch (InvalidKeyException | UnsupportedOperationException iue) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning("The Cipher provider " + safeProviderName(cipher) + " caused exception: " + iue.getMessage()); @@ -196,7 +197,8 @@ final class RSAKeyExchange { try { return cipher.getProvider().toString(); } catch (Exception e) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Retrieving The Cipher provider name" + " caused exception ", e); } @@ -204,7 +206,8 @@ final class RSAKeyExchange { try { return cipher.toString() + " (provider name not available)"; } catch (Exception e) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Retrieving The Cipher name" + " caused exception ", e); } @@ -219,7 +222,7 @@ final class RSAKeyExchange { int clientVersion, int serverVersion, byte[] encodedSecret, SecureRandom generator) throws GeneralSecurityException { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Generating a premaster secret"); } @@ -234,7 +237,8 @@ final class RSAKeyExchange { } catch (InvalidAlgorithmParameterException | NoSuchAlgorithmException iae) { // unlikely to happen, otherwise, must be a provider exception - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("RSA premaster secret generation error", iae); } diff --git a/src/java.base/share/classes/sun/security/ssl/RSAServerKeyExchange.java b/src/java.base/share/classes/sun/security/ssl/RSAServerKeyExchange.java index 4ab1cdf1f93..0c0fec10449 100644 --- a/src/java.base/share/classes/sun/security/ssl/RSAServerKeyExchange.java +++ b/src/java.base/share/classes/sun/security/ssl/RSAServerKeyExchange.java @@ -264,7 +264,7 @@ final class RSAServerKeyExchange { RSAServerKeyExchangeMessage skem = new RSAServerKeyExchangeMessage( shc, x509Possession, rsaPossession); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Produced RSA ServerKeyExchange handshake message", skem); } @@ -296,7 +296,7 @@ final class RSAServerKeyExchange { RSAServerKeyExchangeMessage skem = new RSAServerKeyExchangeMessage(chc, message); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Consuming RSA ServerKeyExchange handshake message", skem); } diff --git a/src/java.base/share/classes/sun/security/ssl/RenegoInfoExtension.java b/src/java.base/share/classes/sun/security/ssl/RenegoInfoExtension.java index b744914b31d..0d3d8bd039c 100644 --- a/src/java.base/share/classes/sun/security/ssl/RenegoInfoExtension.java +++ b/src/java.base/share/classes/sun/security/ssl/RenegoInfoExtension.java @@ -138,7 +138,8 @@ final class RenegoInfoExtension { // Is it a supported and enabled extension? if (!chc.sslConfig.isAvailable(CH_RENEGOTIATION_INFO)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable renegotiation_info extension"); } @@ -182,7 +183,8 @@ final class RenegoInfoExtension { return extData; } else { // not secure renegotiation if (HandshakeContext.allowUnsafeRenegotiation) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning("Using insecure renegotiation"); } @@ -216,7 +218,8 @@ final class RenegoInfoExtension { // Is it a supported and enabled extension? if (!shc.sslConfig.isAvailable(CH_RENEGOTIATION_INFO)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Ignore unavailable extension: " + CH_RENEGOTIATION_INFO.name); } @@ -280,7 +283,8 @@ final class RenegoInfoExtension { for (int id : clientHello.cipherSuiteIds) { if (id == CipherSuite.TLS_EMPTY_RENEGOTIATION_INFO_SCSV.id) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.finest( "Safe renegotiation, using the SCSV signaling"); } @@ -294,7 +298,8 @@ final class RenegoInfoExtension { "Failed to negotiate the use of secure renegotiation"); } // otherwise, allow legacy hello message - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning("Warning: No renegotiation " + "indication in ClientHello, allow legacy ClientHello"); } @@ -306,13 +311,15 @@ final class RenegoInfoExtension { "Inconsistent secure renegotiation indication"); } else { // renegotiation, not secure if (HandshakeContext.allowUnsafeRenegotiation) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning("Using insecure renegotiation"); } } else { // Unsafe renegotiation should have been aborted in // earlier processes. - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Terminate insecure renegotiation"); } throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE, @@ -345,7 +352,8 @@ final class RenegoInfoExtension { if (requestedSpec == null && !shc.conContext.secureRenegotiation) { // Ignore, no renegotiation_info extension or SCSV signaling // requested. - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.finest( "Ignore unavailable renegotiation_info extension"); } @@ -354,7 +362,8 @@ final class RenegoInfoExtension { if (!shc.conContext.secureRenegotiation) { // Ignore, no secure renegotiation is negotiated. - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.finest( "No secure renegotiation has been negotiated"); } @@ -515,7 +524,8 @@ final class RenegoInfoExtension { "Failed to negotiate the use of secure renegotiation"); } // otherwise, allow legacy hello message - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning("Warning: No renegotiation " + "indication in ServerHello, allow legacy ServerHello"); } @@ -527,13 +537,15 @@ final class RenegoInfoExtension { "Inconsistent secure renegotiation indication"); } else { // renegotiation, not secure if (HandshakeContext.allowUnsafeRenegotiation) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning("Using insecure renegotiation"); } } else { // Unsafe renegotiation should have been aborted in // earlier processes. - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Terminate insecure renegotiation"); } throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE, diff --git a/src/java.base/share/classes/sun/security/ssl/SSLAlgorithmConstraints.java b/src/java.base/share/classes/sun/security/ssl/SSLAlgorithmConstraints.java index 594766ea0fd..d3207a7aa63 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLAlgorithmConstraints.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLAlgorithmConstraints.java @@ -454,7 +454,7 @@ final class SSLAlgorithmConstraints implements AlgorithmConstraints { .equalsIgnoreCase(paramDigestAlg)); } catch (InvalidParameterSpecException e) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("Invalid AlgorithmParameters: " + parameters + "; Error: " + e.getMessage()); } diff --git a/src/java.base/share/classes/sun/security/ssl/SSLCipher.java b/src/java.base/share/classes/sun/security/ssl/SSLCipher.java index 5dfa5be3420..9d1d6dabaec 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLCipher.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLCipher.java @@ -392,7 +392,8 @@ enum SSLCipher { if (values[1].contains(tag[0])) { index = 0; } else { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine("jdk.tls.keyLimits: Unknown action: " + entry); } @@ -413,13 +414,14 @@ enum SSLCipher { "Length exceeded limits"); } } catch (NumberFormatException e) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine("jdk.tls.keyLimits: " + e.getMessage() + ": " + entry); } continue; } - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine("jdk.tls.keyLimits: entry = " + entry + ". " + values[0] + ":" + tag[index] + " = " + size); } @@ -468,7 +470,7 @@ enum SSLCipher { Cipher.getInstance(transformation); return true; } catch (NoSuchAlgorithmException | NoSuchPaddingException e) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine("Transformation " + transformation + " is" + " not available."); } @@ -860,7 +862,8 @@ enum SSLCipher { "JCE provider " + cipher.getProvider().getName(), sbe); } pt.position(pos); - if (SSLLogger.isOn() && SSLLogger.isOn("plaintext")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RECORD_PLAINTEXT)) { SSLLogger.fine( "Plaintext after DECRYPTION", pt.duplicate()); } @@ -930,7 +933,8 @@ enum SSLCipher { authenticator.increaseSequenceNumber(); } - if (SSLLogger.isOn() && SSLLogger.isOn("plaintext")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RECORD_PLAINTEXT)) { SSLLogger.finest( "Padded plaintext before ENCRYPTION", bb.duplicate()); } @@ -1050,7 +1054,8 @@ enum SSLCipher { "JCE provider " + cipher.getProvider().getName(), sbe); } - if (SSLLogger.isOn() && SSLLogger.isOn("plaintext")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RECORD_PLAINTEXT)) { SSLLogger.fine( "Padded plaintext after DECRYPTION", pt.duplicate().position(pos)); @@ -1182,7 +1187,7 @@ enum SSLCipher { int len = addPadding(bb, blockSize); bb.position(pos); - if (SSLLogger.isOn() && SSLLogger.isOn("plaintext")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.RECORD_PLAINTEXT)) { SSLLogger.fine( "Padded plaintext before ENCRYPTION", bb.duplicate()); @@ -1326,7 +1331,8 @@ enum SSLCipher { "JCE provider " + cipher.getProvider().getName(), sbe); } - if (SSLLogger.isOn() && SSLLogger.isOn("plaintext")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RECORD_PLAINTEXT)) { SSLLogger.fine("Padded plaintext after DECRYPTION", pt.duplicate().position(pos)); } @@ -1478,7 +1484,8 @@ enum SSLCipher { int len = addPadding(bb, blockSize); bb.position(pos); - if (SSLLogger.isOn() && SSLLogger.isOn("plaintext")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RECORD_PLAINTEXT)) { SSLLogger.fine( "Padded plaintext before ENCRYPTION", bb.duplicate()); @@ -1650,7 +1657,8 @@ enum SSLCipher { pt.position(pos); pt.limit(pos + len); - if (SSLLogger.isOn() && SSLLogger.isOn("plaintext")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RECORD_PLAINTEXT)) { SSLLogger.fine( "Plaintext after DECRYPTION", pt.duplicate()); } @@ -1737,7 +1745,8 @@ enum SSLCipher { // DON'T encrypt the nonce for AEAD mode. int len, pos = bb.position(); - if (SSLLogger.isOn() && SSLLogger.isOn("plaintext")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RECORD_PLAINTEXT)) { SSLLogger.fine( "Plaintext before ENCRYPTION", bb.duplicate()); @@ -1823,7 +1832,7 @@ enum SSLCipher { keyLimitCountdown = cipherLimits.getOrDefault( algorithm.toUpperCase(Locale.ENGLISH) + ":" + tag[0], 0L); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine("KeyLimit read side: algorithm = " + algorithm + ":" + tag[0] + "\ncountdown value = " + keyLimitCountdown); @@ -1932,7 +1941,8 @@ enum SSLCipher { contentType = pt.get(i); pt.limit(i); - if (SSLLogger.isOn() && SSLLogger.isOn("plaintext")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RECORD_PLAINTEXT)) { SSLLogger.fine( "Plaintext after DECRYPTION", pt.duplicate()); } @@ -1984,7 +1994,7 @@ enum SSLCipher { keyLimitCountdown = cipherLimits.getOrDefault( algorithm.toUpperCase(Locale.ENGLISH) + ":" + tag[0], 0L); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine("KeyLimit write side: algorithm = " + algorithm + ":" + tag[0] + "\ncountdown value = " + keyLimitCountdown); @@ -2026,7 +2036,8 @@ enum SSLCipher { cipher.updateAAD(aad); int len, pos = bb.position(); - if (SSLLogger.isOn() && SSLLogger.isOn("plaintext")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RECORD_PLAINTEXT)) { SSLLogger.fine( "Plaintext before ENCRYPTION", bb.duplicate()); @@ -2182,7 +2193,8 @@ enum SSLCipher { pt.position(pos); pt.limit(pos + len); - if (SSLLogger.isOn() && SSLLogger.isOn("plaintext")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RECORD_PLAINTEXT)) { SSLLogger.fine( "Plaintext after DECRYPTION", pt.duplicate()); } @@ -2231,7 +2243,7 @@ enum SSLCipher { keyLimitCountdown = cipherLimits.getOrDefault( algorithm.toUpperCase(Locale.ENGLISH) + ":" + tag[0], 0L); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine("algorithm = " + algorithm + ":" + tag[0] + "\ncountdown value = " + keyLimitCountdown); @@ -2273,7 +2285,8 @@ enum SSLCipher { // DON'T encrypt the nonce for AEAD mode. int pos = bb.position(); - if (SSLLogger.isOn() && SSLLogger.isOn("plaintext")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RECORD_PLAINTEXT)) { SSLLogger.fine( "Plaintext before ENCRYPTION", bb.duplicate()); @@ -2450,7 +2463,8 @@ enum SSLCipher { contentType = pt.get(i); pt.limit(i); - if (SSLLogger.isOn() && SSLLogger.isOn("plaintext")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RECORD_PLAINTEXT)) { SSLLogger.fine( "Plaintext after DECRYPTION", pt.duplicate()); } @@ -2499,7 +2513,7 @@ enum SSLCipher { keyLimitCountdown = cipherLimits.getOrDefault( algorithm.toUpperCase(Locale.ENGLISH) + ":" + tag[0], 0L); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine("algorithm = " + algorithm + ":" + tag[0] + "\ncountdown value = " + keyLimitCountdown); @@ -2541,7 +2555,8 @@ enum SSLCipher { cipher.updateAAD(aad); int pos = bb.position(); - if (SSLLogger.isOn() && SSLLogger.isOn("plaintext")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RECORD_PLAINTEXT)) { SSLLogger.fine( "Plaintext before ENCRYPTION", bb.duplicate()); diff --git a/src/java.base/share/classes/sun/security/ssl/SSLConfiguration.java b/src/java.base/share/classes/sun/security/ssl/SSLConfiguration.java index 3c68c669d05..1cc29e29477 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLConfiguration.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLConfiguration.java @@ -202,7 +202,7 @@ final class SSLConfiguration implements Cloneable { nstServerCount > 10) { serverNewSessionTicketCount = SERVER_NST_DEFAULT; if (nstServerCount != null && SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "jdk.tls.server.newSessionTicketCount defaults to " + SERVER_NST_DEFAULT + " as the property was not " + @@ -210,7 +210,7 @@ final class SSLConfiguration implements Cloneable { } } else { serverNewSessionTicketCount = nstServerCount; - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "jdk.tls.server.newSessionTicketCount set to " + serverNewSessionTicketCount); @@ -569,7 +569,7 @@ final class SSLConfiguration implements Cloneable { String property = System.getProperty(propertyName); // this method is called from class initializer; logging here // will occasionally pin threads and deadlock if called from a virtual thread - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,sslctx") + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSLCTX) && !Thread.currentThread().isVirtual()) { SSLLogger.fine( "System property " + propertyName + " is set to '" + @@ -598,8 +598,9 @@ final class SSLConfiguration implements Cloneable { if (scheme != null && scheme.isAvailable) { signatureSchemes.add(schemeName); } else { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,sslctx") - && !Thread.currentThread().isVirtual()) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.SSLCTX) + && !Thread.currentThread().isVirtual()) { SSLLogger.fine( "The current installed providers do not " + "support signature scheme: " + schemeName); diff --git a/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java b/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java index be324eb0949..8df72711dff 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java @@ -104,11 +104,11 @@ public abstract class SSLContextImpl extends SSLContextSpi { * first connection to time out and fail. Make sure it is * primed and ready by getting some initial output from it. */ - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,sslctx")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSLCTX)) { SSLLogger.finest("trigger seeding of SecureRandom"); } secureRandom.nextInt(); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,sslctx")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSLCTX)) { SSLLogger.finest("done seeding of SecureRandom"); } @@ -143,7 +143,7 @@ public abstract class SSLContextImpl extends SSLContextSpi { return (X509ExtendedKeyManager)km; } - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,sslctx")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSLCTX)) { SSLLogger.warning( "X509KeyManager passed to SSLContext.init(): need an " + "X509ExtendedKeyManager for SSLEngine use"); @@ -246,7 +246,8 @@ public abstract class SSLContextImpl extends SSLContextSpi { contextLock.lock(); try { if (statusResponseManager == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,sslctx")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.SSLCTX)) { SSLLogger.finest( "Initializing StatusResponseManager"); } @@ -384,7 +385,7 @@ public abstract class SSLContextImpl extends SSLContextSpi { suites.add(suite); isSupported = true; } else if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,sslctx,verbose")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore disabled cipher suite: " + suite.name); } @@ -393,7 +394,7 @@ public abstract class SSLContextImpl extends SSLContextSpi { } if (!isSupported && SSLLogger.isOn() && - SSLLogger.isOn("ssl,sslctx,verbose")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.finest( "Ignore unsupported cipher suite: " + suite); } @@ -410,7 +411,7 @@ public abstract class SSLContextImpl extends SSLContextSpi { String propertyName) { String property = System.getProperty(propertyName); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,sslctx")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSLCTX)) { SSLLogger.fine( "System property " + propertyName + " is set to '" + property + "'"); @@ -437,7 +438,8 @@ public abstract class SSLContextImpl extends SSLContextSpi { try { suite = CipherSuite.nameOf(cipherSuiteNames[i]); } catch (IllegalArgumentException iae) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,sslctx")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.SSLCTX)) { SSLLogger.fine( "Unknown or unsupported cipher suite name: " + cipherSuiteNames[i]); @@ -449,7 +451,8 @@ public abstract class SSLContextImpl extends SSLContextSpi { if (suite != null && suite.isAvailable()) { cipherSuites.add(suite); } else { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,sslctx")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.SSLCTX)) { SSLLogger.fine( "The current installed providers do not " + "support cipher suite: " + cipherSuiteNames[i]); @@ -907,7 +910,8 @@ public abstract class SSLContextImpl extends SSLContextSpi { tmMediator = getTrustManagers(); } catch (Exception e) { reserved = e; - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,defaultctx")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.DEFAULTCTX)) { SSLLogger.warning( "Failed to load default trust managers", e); } @@ -919,7 +923,8 @@ public abstract class SSLContextImpl extends SSLContextSpi { kmMediator = getKeyManagers(); } catch (Exception e) { reserved = e; - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,defaultctx")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.DEFAULTCTX)) { SSLLogger.warning( "Failed to load default key managers", e); } @@ -977,7 +982,7 @@ public abstract class SSLContextImpl extends SSLContextSpi { String defaultKeyStore = props.get("keyStore"); String defaultKeyStoreType = props.get("keyStoreType"); String defaultKeyStoreProvider = props.get("keyStoreProvider"); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,defaultctx")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.DEFAULTCTX)) { SSLLogger.fine("keyStore is : " + defaultKeyStore); SSLLogger.fine("keyStore type is : " + defaultKeyStoreType); @@ -1007,7 +1012,8 @@ public abstract class SSLContextImpl extends SSLContextSpi { // Try to initialize key store. if ((defaultKeyStoreType.length()) != 0) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,defaultctx")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.DEFAULTCTX)) { SSLLogger.finest("init keystore"); } if (defaultKeyStoreProvider.isEmpty()) { @@ -1030,7 +1036,7 @@ public abstract class SSLContextImpl extends SSLContextSpi { /* * Try to initialize key manager. */ - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,defaultctx")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.DEFAULTCTX)) { SSLLogger.fine("init keymanager of type " + KeyManagerFactory.getDefaultAlgorithm()); } @@ -1068,7 +1074,8 @@ public abstract class SSLContextImpl extends SSLContextSpi { // exception object, which may be not garbage collection // friendly as 'reservedException' is a static filed. reserved = new KeyManagementException(e.getMessage()); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,defaultctx")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.DEFAULTCTX)) { SSLLogger.warning( "Failed to load default SSLContext", e); } @@ -1097,7 +1104,8 @@ public abstract class SSLContextImpl extends SSLContextSpi { super.engineInit(DefaultManagersHolder.keyManagers, DefaultManagersHolder.trustManagers, null); } catch (Exception e) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,defaultctx")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.DEFAULTCTX)) { SSLLogger.fine("default context init failed: ", e); } throw e; diff --git a/src/java.base/share/classes/sun/security/ssl/SSLEngineImpl.java b/src/java.base/share/classes/sun/security/ssl/SSLEngineImpl.java index 5e23e6ee37b..5052f9bc9f4 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLEngineImpl.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLEngineImpl.java @@ -330,7 +330,7 @@ final class SSLEngineImpl extends SSLEngine implements SSLTransport { // application data may be discarded accordingly. As could // be an issue for some applications. This impact can be // mitigated by sending the last flight twice. - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,verbose")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.RECORD)) { SSLLogger.finest("retransmit the last flight messages"); } @@ -397,7 +397,7 @@ final class SSLEngineImpl extends SSLEngine implements SSLTransport { if ((conContext.handshakeContext == null) && !conContext.isOutboundClosed() && !conContext.isBroken) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.finest("trigger key update"); } beginHandshake(); @@ -419,7 +419,7 @@ final class SSLEngineImpl extends SSLEngine implements SSLTransport { !conContext.isOutboundClosed() && !conContext.isInboundClosed() && !conContext.isBroken) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.finest("trigger NST"); } conContext.conSession.updateNST = false; @@ -612,7 +612,7 @@ final class SSLEngineImpl extends SSLEngine implements SSLTransport { } catch (SSLException ssle) { // Need to discard invalid records for DTLS protocols. if (sslContext.isDTLS()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,verbose")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.RECORD)) { SSLLogger.finest("Discard invalid DTLS records", ssle); } @@ -780,7 +780,7 @@ final class SSLEngineImpl extends SSLEngine implements SSLTransport { return; } - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.finest("Closing inbound of SSLEngine"); } @@ -819,7 +819,7 @@ final class SSLEngineImpl extends SSLEngine implements SSLTransport { return; } - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.finest("Closing outbound of SSLEngine"); } diff --git a/src/java.base/share/classes/sun/security/ssl/SSLEngineInputRecord.java b/src/java.base/share/classes/sun/security/ssl/SSLEngineInputRecord.java index 6e08fc71664..00ca3b06369 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLEngineInputRecord.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLEngineInputRecord.java @@ -172,7 +172,7 @@ final class SSLEngineInputRecord extends InputRecord implements SSLRecord { return null; } - if (SSLLogger.isOn() && SSLLogger.isOn("packet")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.RECORD_PACKET)) { SSLLogger.fine("Raw read", packet); } @@ -209,7 +209,7 @@ final class SSLEngineInputRecord extends InputRecord implements SSLRecord { byte minorVersion = packet.get(); // pos: 2 int contentLen = Record.getInt16(packet); // pos: 3, 4 - if (SSLLogger.isOn() && SSLLogger.isOn("record")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.RECORD)) { SSLLogger.fine( "READ: " + ProtocolVersion.nameOf(majorVersion, minorVersion) + @@ -388,7 +388,7 @@ final class SSLEngineInputRecord extends InputRecord implements SSLRecord { * error message, one that's treated as fatal by * clients (Otherwise we'll hang.) */ - if (SSLLogger.isOn() && SSLLogger.isOn("record")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.RECORD)) { SSLLogger.fine( "Requested to negotiate unsupported SSLv2!"); } @@ -410,7 +410,8 @@ final class SSLEngineInputRecord extends InputRecord implements SSLRecord { ByteBuffer converted = convertToClientHello(packet); - if (SSLLogger.isOn() && SSLLogger.isOn("packet")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RECORD_PACKET)) { SSLLogger.fine( "[Converted] ClientHello", converted); } diff --git a/src/java.base/share/classes/sun/security/ssl/SSLEngineOutputRecord.java b/src/java.base/share/classes/sun/security/ssl/SSLEngineOutputRecord.java index 1c8751e66fe..0ed3755afa4 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLEngineOutputRecord.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLEngineOutputRecord.java @@ -73,7 +73,7 @@ final class SSLEngineOutputRecord extends OutputRecord implements SSLRecord { @Override void encodeAlert(byte level, byte description) { if (isClosed()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("outbound has closed, ignore outbound " + "alert message: " + Alert.nameOf(description)); } @@ -91,7 +91,7 @@ final class SSLEngineOutputRecord extends OutputRecord implements SSLRecord { void encodeHandshake(byte[] source, int offset, int length) { if (isClosed()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("outbound has closed, ignore outbound " + "handshake message", ByteBuffer.wrap(source, offset, length)); @@ -138,7 +138,7 @@ final class SSLEngineOutputRecord extends OutputRecord implements SSLRecord { @Override void encodeChangeCipherSpec() { if (isClosed()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("outbound has closed, ignore outbound " + "change_cipher_spec message"); } @@ -171,14 +171,14 @@ final class SSLEngineOutputRecord extends OutputRecord implements SSLRecord { ByteBuffer[] dsts, int dstsOffset, int dstsLength) throws IOException { if (isClosed) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("outbound has closed, ignore outbound " + "application data or cached messages"); } return null; } else if (isCloseWaiting) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("outbound has closed, ignore outbound " + "application data"); } @@ -193,7 +193,7 @@ final class SSLEngineOutputRecord extends OutputRecord implements SSLRecord { ByteBuffer destination) throws IOException { if (writeCipher.authenticator.seqNumOverflow()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine( "sequence number extremely close to overflow " + "(2^64-1 packets). Closing connection."); @@ -275,7 +275,7 @@ final class SSLEngineOutputRecord extends OutputRecord implements SSLRecord { destination.limit(destination.position()); destination.position(dstContent); - if (SSLLogger.isOn() && SSLLogger.isOn("record")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.RECORD)) { SSLLogger.fine( "WRITE: " + protocolVersion.name + " " + ContentType.APPLICATION_DATA.name + @@ -288,7 +288,8 @@ final class SSLEngineOutputRecord extends OutputRecord implements SSLRecord { dstPos, dstLim, headerSize, protocolVersion); - if (SSLLogger.isOn() && SSLLogger.isOn("packet")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RECORD_PACKET)) { ByteBuffer temporary = destination.duplicate(); temporary.limit(temporary.position()); temporary.position(dstPos); @@ -317,7 +318,8 @@ final class SSLEngineOutputRecord extends OutputRecord implements SSLRecord { // // Please don't change the limit of the destination buffer. destination.put(SSLRecord.v2NoCipher); - if (SSLLogger.isOn() && SSLLogger.isOn("packet")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RECORD_PACKET)) { SSLLogger.fine("Raw write", SSLRecord.v2NoCipher); } @@ -332,13 +334,13 @@ final class SSLEngineOutputRecord extends OutputRecord implements SSLRecord { // // Please don't change the limit of the destination buffer. if (SSLLogger.isOn()) { - if (SSLLogger.isOn("record")) { + if (SSLLogger.isOn(SSLLogger.Opt.RECORD)) { SSLLogger.fine(Thread.currentThread().getName() + ", WRITE: SSLv2 ClientHello message" + ", length = " + v2ClientHello.remaining()); } - if (SSLLogger.isOn("packet")) { + if (SSLLogger.isOn(SSLLogger.Opt.RECORD_PACKET)) { SSLLogger.fine("Raw write", v2ClientHello); } } @@ -525,7 +527,7 @@ final class SSLEngineOutputRecord extends OutputRecord implements SSLRecord { dstBuf.limit(dstBuf.position()); dstBuf.position(dstContent); - if (SSLLogger.isOn() && SSLLogger.isOn("record")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.RECORD)) { SSLLogger.fine( "WRITE: " + protocolVersion.name + " " + ContentType.nameOf(memo.contentType) + @@ -543,7 +545,8 @@ final class SSLEngineOutputRecord extends OutputRecord implements SSLRecord { memo.encodeCipher.dispose(); } - if (SSLLogger.isOn() && SSLLogger.isOn("packet")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RECORD_PACKET)) { ByteBuffer temporary = dstBuf.duplicate(); temporary.limit(temporary.position()); temporary.position(dstPos); diff --git a/src/java.base/share/classes/sun/security/ssl/SSLExtension.java b/src/java.base/share/classes/sun/security/ssl/SSLExtension.java index 47a0d0b0e44..aacb9420748 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLExtension.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLExtension.java @@ -844,7 +844,7 @@ enum SSLExtension implements SSLStringizer { String property = System.getProperty(propertyName); // this method is called from class initializer; logging here // will occasionally pin threads and deadlock if called from a virtual thread - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,sslctx") + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSLCTX) && !Thread.currentThread().isVirtual()) { SSLLogger.fine( "System property " + propertyName + " is set to '" + diff --git a/src/java.base/share/classes/sun/security/ssl/SSLExtensions.java b/src/java.base/share/classes/sun/security/ssl/SSLExtensions.java index 66f6293302e..c325890a3b6 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLExtensions.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLExtensions.java @@ -93,7 +93,8 @@ final class SSLExtensions { // However, the implementation of the limit is complicated // and inefficient, and may not worthy the maintenance. isSupported = false; - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning( "Received buggy supported_groups extension " + "in the ServerHello handshake message"); @@ -143,7 +144,8 @@ final class SSLExtensions { m.get(extData); logMap.put(extId, extData); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unknown or unsupported extension", toString(extId, extData)); @@ -171,7 +173,8 @@ final class SSLExtensions { for (SSLExtension extension : extensions) { if (context.negotiatedProtocol != null && !extension.isAvailable(context.negotiatedProtocol)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unsupported extension: " + extension.name); } @@ -181,7 +184,8 @@ final class SSLExtensions { if (!extMap.containsKey(extension)) { if (extension.onLoadAbsence != null) { extension.absentOnLoad(context, handshakeMessage); - } else if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + } else if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable extension: " + extension.name); } @@ -190,7 +194,8 @@ final class SSLExtensions { if (extension.onLoadConsumer == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning( "Ignore unsupported extension: " + extension.name); } @@ -200,7 +205,7 @@ final class SSLExtensions { ByteBuffer m = ByteBuffer.wrap(extMap.get(extension)); extension.consumeOnLoad(context, handshakeMessage, m); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Consumed extension: " + extension.name); } } @@ -215,7 +220,8 @@ final class SSLExtensions { if (!extMap.containsKey(extension)) { if (extension.onTradeAbsence != null) { extension.absentOnTrade(context, handshakeMessage); - } else if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + } else if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable extension: " + extension.name); } @@ -223,7 +229,8 @@ final class SSLExtensions { } if (extension.onTradeConsumer == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning( "Ignore impact of unsupported extension: " + extension.name); @@ -232,7 +239,7 @@ final class SSLExtensions { } extension.consumeOnTrade(context, handshakeMessage); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Populated with extension: " + extension.name); } } @@ -245,7 +252,8 @@ final class SSLExtensions { SSLExtension[] extensions) throws IOException { for (SSLExtension extension : extensions) { if (extMap.containsKey(extension)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore, duplicated extension: " + extension.name); @@ -254,7 +262,8 @@ final class SSLExtensions { } if (extension.networkProducer == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning( "Ignore, no extension producer defined: " + extension.name); @@ -267,7 +276,8 @@ final class SSLExtensions { extMap.put(extension, encoded); encodedLength += encoded.length + 4; // extension_type (2) // extension_data length(2) - } else if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + } else if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { // The extension is not available in the context. SSLLogger.fine( "Ignore, context unavailable extension: " + @@ -284,7 +294,8 @@ final class SSLExtensions { SSLExtension[] extensions) throws IOException { for (SSLExtension extension : extensions) { if (extension.networkProducer == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning( "Ignore, no extension producer defined: " + extension.name); @@ -305,7 +316,8 @@ final class SSLExtensions { encodedLength += encoded.length + 4; // extension_type (2) // extension_data length(2) - } else if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + } else if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { // The extension is not available in the context. SSLLogger.fine( "Ignore, context unavailable extension: " + diff --git a/src/java.base/share/classes/sun/security/ssl/SSLLogger.java b/src/java.base/share/classes/sun/security/ssl/SSLLogger.java index 7fa6fbf91b5..786cd01ac05 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLLogger.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLLogger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,42 +49,90 @@ import static sun.security.ssl.Utilities.LINE_SEP; /** * Implementation of SSL logger. - * + *

* If the system property "javax.net.debug" is not defined, the debug logging * is turned off. If the system property "javax.net.debug" is defined as * empty, the debug logger is specified by System.getLogger("javax.net.ssl"), * and applications can customize and configure the logger or use external * logging mechanisms. If the system property "javax.net.debug" is defined - * and non-empty, a private debug logger implemented in this class is used. + * and non-empty, a private debug logger which logs to System.err is used. */ public final class SSLLogger implements System.Logger { private static final System.Logger logger; - private static final String property; - private static final boolean isOn; + // High level boolean to track whether logging is active (i.e. all/ssl). + // Further checks may be necessary to determine if data is logged. + private static final boolean logging; private final String loggerName; private final boolean useCompactFormat; - static { String p = System.getProperty("javax.net.debug"); if (p != null) { if (p.isEmpty()) { - property = ""; logger = System.getLogger("javax.net.ssl"); + Opt.ALL.on = true; } else { - property = p.toLowerCase(Locale.ENGLISH); - if (property.equals("help")) { + p = p.toLowerCase(Locale.ENGLISH); + if (p.contains("help")) { + // help option calls exit(0) help(); } - + // configure expanded logging mode in constructor logger = new SSLLogger("javax.net.ssl", p); + if (p.contains("all")) { + Opt.ALL.on = true; + } else { + for (Opt o : Opt.values()) { + // deal with special "_" options later + if (o.component.contains("_")) { + continue; + } + + if (p.contains(o.component)) { + o.on = true; + // remove pattern to avoid it being reused + // e.g. "ssl,sslctx" parsing + p = p.replaceFirst(o.component, ""); + } + } + + // "record" and "handshake" subcomponents allow + // extra configuration options + if (Opt.HANDSHAKE.on && p.contains("verbose")) { + Opt.HANDSHAKE_VERBOSE.on = true; + } + + if (Opt.RECORD.on) { + if (p.contains("packet")) { + Opt.RECORD_PACKET.on = true; + } + if (p.contains("plaintext")) { + Opt.RECORD_PLAINTEXT.on = true; + } + } + // finally, if only "ssl" component is declared, then + // enable all subcomponents. "ssl" logs all activity + // except for the "data" and "packet" categories + if (Opt.SSL.on && + EnumSet.allOf(Opt.class) + .stream() + .noneMatch(o -> o.on && o.isSubComponent)) { + for (Opt opt : Opt.values()) { + if (opt.isSubComponent) { + opt.on = true; + } + } + } + } } - isOn = true; + + // javax.net.debug would be misconfigured property with respect + // to logging if value didn't contain "all" or "ssl" + logging = Opt.ALL.on || Opt.SSL.on; } else { - property = null; logger = null; - isOn = false; + logging = false; } } @@ -94,52 +142,17 @@ public final class SSLLogger implements System.Logger { this.useCompactFormat = !options.contains("expand"); } - /** - * Return true if the "javax.net.debug" property contains the - * debug check points, or System.Logger is used. - */ - public static boolean isOn(String checkPoints) { - if (property == null) { // debugging is turned off - return false; - } else if (property.isEmpty()) { // use System.Logger - return true; - } // use provider logger - - String[] options = checkPoints.split(","); - for (String option : options) { - option = option.trim(); - if (!SSLLogger.hasOption(option)) { - return false; - } - } - - return true; - } - @ForceInline public static boolean isOn() { - return isOn; + return logging; } - private static boolean hasOption(String option) { - option = option.toLowerCase(Locale.ENGLISH); - if (property.contains("all")) { - return true; - } else { - // remove first occurrence of "sslctx" since - // it interferes with search for "ssl" - String modified = property.replaceFirst("sslctx", ""); - if (modified.contains("ssl")) { - // don't enable data and plaintext options by default - if (!(option.equals("data") - || option.equals("packet") - || option.equals("plaintext"))) { - return true; - } - } - } + /** + * Return true if the specific DebugOption is enabled or ALL is enabled + */ - return property.contains(option); + public static boolean isOn(Opt option) { + return Opt.ALL.on || option.on; } public static void severe(String msg, Object... params) { @@ -188,33 +201,42 @@ public final class SSLLogger implements System.Logger { } private static void help() { - System.err.println(); - System.err.println("help print the help messages"); - System.err.println("expand expand debugging information"); - System.err.println(); - System.err.println("all turn on all debugging"); - System.err.println("ssl turn on ssl debugging"); - System.err.println(); - System.err.println("The following can be used with ssl:"); - System.err.println("\trecord enable per-record tracing"); - System.err.println("\thandshake print each handshake message"); - System.err.println("\tkeygen print key generation data"); - System.err.println("\tsession print session activity"); - System.err.println("\tdefaultctx print default SSL initialization"); - System.err.println("\tsslctx print SSLContext tracing"); - System.err.println("\tsessioncache print session cache tracing"); - System.err.println("\tkeymanager print key manager tracing"); - System.err.println("\ttrustmanager print trust manager tracing"); - System.err.println("\tpluggability print pluggability tracing"); - System.err.println(); - System.err.println("\thandshake debugging can be widened with:"); - System.err.println("\tdata hex dump of each handshake message"); - System.err.println("\tverbose verbose handshake message printing"); - System.err.println(); - System.err.println("\trecord debugging can be widened with:"); - System.err.println("\tplaintext hex dump of record plaintext"); - System.err.println("\tpacket print raw SSL/TLS packets"); - System.err.println(); + System.err.printf("%n%-16s %s%n", "help", + "print this help message and exit"); + System.err.printf("%-16s %s%n%n", "expand", + "expanded (less compact) output format"); + System.err.printf("%-16s %s%n", "all", "turn on all debugging"); + System.err.printf("%-16s %s%n%n", "ssl", "turn on ssl debugging"); + System.err.printf("The following filters can be used with ssl:%n%n"); + System.err.printf(" %-14s %s%n", "defaultctx", + "print default SSL initialization"); + System.err.printf(" %-14s %s%n", "handshake", + "print each handshake message"); + System.err.printf(" %-12s %s%n", "verbose", + "verbose handshake message printing (widens handshake)"); + System.err.printf(" %-14s %s%n", "keymanager", + "print key manager tracing"); + System.err.printf(" %-14s %s%n", "record", + "enable per-record tracing"); + System.err.printf(" %-12s %s%n", "packet", + "print raw SSL/TLS packets (widens record)"); + System.err.printf(" %-12s %s%n", "plaintext", + "hex dump of record plaintext (widens record)"); + System.err.printf(" %-14s %s%n", "respmgr", + "print OCSP response tracing"); + System.err.printf(" %-14s %s%n", "session", + "print session activity"); + System.err.printf(" %-14s %s%n", "sessioncache", + "print session cache tracing"); + System.err.printf(" %-14s %s%n", "sslctx", + "print SSLContext tracing"); + System.err.printf(" %-14s %s%n", "trustmanager", + "print trust manager tracing"); + System.err.printf("%nIf \"ssl\" is specified by itself," + + " all non-widening filters are enabled.%n"); + System.err.printf("%nSpecifying \"ssl\" with additional filter" + + " options produces general%nSSL debug messages plus just" + + " the selected categories.%n%n"); System.exit(0); } @@ -228,8 +250,8 @@ public final class SSLLogger implements System.Logger { // Logs a warning message and always returns false. This method // can be used as an OR Predicate to add a log in a stream filter. - public static boolean logWarning(String option, String s) { - if (SSLLogger.isOn() && SSLLogger.isOn(option)) { + static boolean logWarning(Opt option, String s) { + if (SSLLogger.isOn() && option.on) { SSLLogger.warning(s); } return false; @@ -240,11 +262,6 @@ public final class SSLLogger implements System.Logger { return loggerName; } - @Override - public boolean isLoggable(Level level) { - return level != Level.OFF; - } - @Override public void log(Level level, ResourceBundle rb, String message, Throwable thrwbl) { @@ -273,11 +290,59 @@ public final class SSLLogger implements System.Logger { } } + @Override + public boolean isLoggable(Level level) { + return level != Level.OFF; + } + + /** + * Enum representing possible debug options for JSSE debugging. + *

+ * ALL and SSL are considered master components. Entries without an + * underscore ("_"), and not ALL or SSL, are subcomponents. Entries + * with an underscore ("_") denote options specific to subcomponents. + *

+ * Fields: + * - 'component': Lowercase name of the option. + * - 'isSubComponent': True for subcomponents. + * - 'on': Indicates whether the option is enabled. Some rule based logic + * is used to determine value of this field. + *

+ * Enabling subcomponents fine-tunes (filters) debug output. + */ + public enum Opt { + ALL, + DEFAULTCTX, + HANDSHAKE, + HANDSHAKE_VERBOSE, + KEYMANAGER, + RECORD, + RECORD_PACKET, + RECORD_PLAINTEXT, + RESPMGR, + SESSION, + SESSIONCACHE, // placeholder for 8344685 + SSLCTX, + TRUSTMANAGER, + SSL; // define ssl last, helps with sslctx matching later. + + final String component; + final boolean isSubComponent; + boolean on; + + Opt() { + this.component = this.toString().toLowerCase(Locale.ENGLISH); + this.isSubComponent = !(component.contains("_") || + component.equals("all") || + component.equals("ssl")); + } + } + private static class SSLSimpleFormatter { private static final String PATTERN = "yyyy-MM-dd kk:mm:ss.SSS z"; private static final DateTimeFormatter dateTimeFormat = DateTimeFormatter.ofPattern(PATTERN, Locale.ENGLISH) - .withZone(ZoneId.systemDefault()); + .withZone(ZoneId.systemDefault()); private static final MessageFormat basicCertFormat = new MessageFormat( """ @@ -293,68 +358,68 @@ public final class SSLLogger implements System.Logger { Locale.ENGLISH); private static final MessageFormat extendedCertFormat = - new MessageFormat( - """ - "version" : "v{0}", - "serial number" : "{1}", - "signature algorithm": "{2}", - "issuer" : "{3}", - "not before" : "{4}", - "not after" : "{5}", - "subject" : "{6}", - "subject public key" : "{7}", - "extensions" : [ - {8} - ] - """, - Locale.ENGLISH); + new MessageFormat( + """ + "version" : "v{0}", + "serial number" : "{1}", + "signature algorithm": "{2}", + "issuer" : "{3}", + "not before" : "{4}", + "not after" : "{5}", + "subject" : "{6}", + "subject public key" : "{7}", + "extensions" : [ + {8} + ] + """, + Locale.ENGLISH); private static final MessageFormat messageFormatNoParas = - new MessageFormat( - """ - '{' - "logger" : "{0}", - "level" : "{1}", - "thread id" : "{2}", - "thread name" : "{3}", - "time" : "{4}", - "caller" : "{5}", - "message" : "{6}" - '}' - """, - Locale.ENGLISH); + new MessageFormat( + """ + '{' + "logger" : "{0}", + "level" : "{1}", + "thread id" : "{2}", + "thread name" : "{3}", + "time" : "{4}", + "caller" : "{5}", + "message" : "{6}" + '}' + """, + Locale.ENGLISH); private static final MessageFormat messageCompactFormatNoParas = - new MessageFormat( - "{0}|{1}|{2}|{3}|{4}|{5}|{6}" + LINE_SEP, - Locale.ENGLISH); + new MessageFormat( + "{0}|{1}|{2}|{3}|{4}|{5}|{6}" + LINE_SEP, + Locale.ENGLISH); private static final MessageFormat messageFormatWithParas = - new MessageFormat( - """ - '{' - "logger" : "{0}", - "level" : "{1}", - "thread id" : "{2}", - "thread name" : "{3}", - "time" : "{4}", - "caller" : "{5}", - "message" : "{6}", - "specifics" : [ - {7} - ] - '}' - """, - Locale.ENGLISH); + new MessageFormat( + """ + '{' + "logger" : "{0}", + "level" : "{1}", + "thread id" : "{2}", + "thread name" : "{3}", + "time" : "{4}", + "caller" : "{5}", + "message" : "{6}", + "specifics" : [ + {7} + ] + '}' + """, + Locale.ENGLISH); private static final MessageFormat messageCompactFormatWithParas = - new MessageFormat( - """ - {0}|{1}|{2}|{3}|{4}|{5}|{6} ( - {7} - ) - """, - Locale.ENGLISH); + new MessageFormat( + """ + {0}|{1}|{2}|{3}|{4}|{5}|{6} ( + {7} + ) + """, + Locale.ENGLISH); private static final MessageFormat keyObjectFormat = new MessageFormat( """ @@ -368,7 +433,7 @@ public final class SSLLogger implements System.Logger { // log message // ... private static String format(SSLLogger logger, Level level, - String message, Object... parameters) { + String message, Object ... parameters) { if (parameters == null || parameters.length == 0) { Object[] messageFields = { @@ -417,7 +482,7 @@ public final class SSLLogger implements System.Logger { .findFirst().orElse("unknown caller")); } - private static String formatParameters(Object... parameters) { + private static String formatParameters(Object ... parameters) { StringBuilder builder = new StringBuilder(512); boolean isFirst = true; for (Object parameter : parameters) { @@ -427,22 +492,21 @@ public final class SSLLogger implements System.Logger { builder.append("," + LINE_SEP); } - if (parameter instanceof Throwable) { - builder.append(formatThrowable((Throwable) parameter)); - } else if (parameter instanceof Certificate) { - builder.append(formatCertificate((Certificate) parameter)); - } else if (parameter instanceof ByteArrayInputStream) { + if (parameter instanceof Throwable t) { + builder.append(formatThrowable(t)); + } else if (parameter instanceof Certificate c) { + builder.append(formatCertificate(c)); + } else if (parameter instanceof ByteArrayInputStream bis) { + builder.append(formatByteArrayInputStream(bis)); + } else if (parameter instanceof ByteBuffer bb) { + builder.append(formatByteBuffer((bb))); + } else if (parameter instanceof byte[] bytes) { builder.append(formatByteArrayInputStream( - (ByteArrayInputStream) parameter)); - } else if (parameter instanceof ByteBuffer) { - builder.append(formatByteBuffer((ByteBuffer) parameter)); - } else if (parameter instanceof byte[]) { - builder.append(formatByteArrayInputStream( - new ByteArrayInputStream((byte[]) parameter))); + new ByteArrayInputStream(bytes))); } else if (parameter instanceof Map.Entry) { @SuppressWarnings("unchecked") Map.Entry mapParameter = - (Map.Entry) parameter; + (Map.Entry)parameter; builder.append(formatMapEntry(mapParameter)); } else { builder.append(formatObject(parameter)); @@ -592,15 +656,15 @@ public final class SSLLogger implements System.Logger { builder.append(" ]"); formatted = builder.toString(); - } else if (value instanceof byte[]) { + } else if (value instanceof byte[] bytes) { formatted = "\"" + key + "\": \"" + - Utilities.toHexString((byte[]) value) + "\""; - } else if (value instanceof Byte) { + Utilities.toHexString((bytes)) + "\""; + } else if (value instanceof Byte b) { formatted = "\"" + key + "\": \"" + - HexFormat.of().toHexDigits((byte) value) + "\""; + HexFormat.of().toHexDigits(b) + "\""; } else { formatted = "\"" + key + "\": " + - "\"" + value.toString() + "\""; + "\"" + value.toString() + "\""; } return Utilities.indent(formatted); diff --git a/src/java.base/share/classes/sun/security/ssl/SSLMasterKeyDerivation.java b/src/java.base/share/classes/sun/security/ssl/SSLMasterKeyDerivation.java index 4de29b7570a..533b7f9a52d 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLMasterKeyDerivation.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLMasterKeyDerivation.java @@ -151,7 +151,8 @@ enum SSLMasterKeyDerivation implements SSLKeyDerivationGenerator { // // For RSA premaster secrets, do not signal a protocol error // due to the Bleichenbacher attack. See comments further down. - if (SSLLogger.isOn() && SSLLogger.isOn("handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("RSA master secret generation error.", iae); } throw new ProviderException(iae); diff --git a/src/java.base/share/classes/sun/security/ssl/SSLSessionContextImpl.java b/src/java.base/share/classes/sun/security/ssl/SSLSessionContextImpl.java index f713f723ea0..9b35d5a1222 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLSessionContextImpl.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLSessionContextImpl.java @@ -339,7 +339,8 @@ final class SSLSessionContextImpl implements SSLSessionContext { if (t < 0 || t > NewSessionTicket.MAX_TICKET_LIFETIME) { timeout = DEFAULT_SESSION_TIMEOUT; - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("Invalid timeout given " + "jdk.tls.server.sessionTicketTimeout: " + t + ". Set to default value " + timeout); @@ -349,7 +350,8 @@ final class SSLSessionContextImpl implements SSLSessionContext { } } catch (NumberFormatException e) { setSessionTimeout(DEFAULT_SESSION_TIMEOUT); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("Invalid timeout for " + "jdk.tls.server.sessionTicketTimeout: " + s + ". Set to default value " + timeout); @@ -363,7 +365,7 @@ final class SSLSessionContextImpl implements SSLSessionContext { if (defaultCacheLimit >= 0) { return defaultCacheLimit; - } else if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + } else if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning( "invalid System Property javax.net.ssl.sessionCacheSize, " + "use the default session cache size (" + @@ -371,7 +373,7 @@ final class SSLSessionContextImpl implements SSLSessionContext { } } catch (Exception e) { // unlikely, log it for safe - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning( "the System Property javax.net.ssl.sessionCacheSize is " + "not available, use the default value (" + diff --git a/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java b/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java index f3a4b964158..af0b8909d30 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java @@ -223,7 +223,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { this.identificationProtocol = hc.sslConfig.identificationProtocol; this.boundValues = new ConcurrentHashMap<>(); - if (SSLLogger.isOn() && SSLLogger.isOn("session")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SESSION)) { SSLLogger.finest("Session initialized: " + this); } } @@ -256,7 +256,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { this.maximumPacketSize = baseSession.maximumPacketSize; this.boundValues = baseSession.boundValues; - if (SSLLogger.isOn() && SSLLogger.isOn("session")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SESSION)) { SSLLogger.finest("Session initialized: " + this); } } @@ -455,7 +455,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { if (same) { this.localCerts = ((X509Possession) pos).popCerts; - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,session")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SESSION)) { SSLLogger.fine("Restored " + len + " local certificates from session ticket" + " for algorithms " + Arrays.toString(certAlgs)); @@ -463,7 +463,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { } else { this.localCerts = null; this.invalidated = true; - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,session")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SESSION)) { SSLLogger.warning("Local certificates can not be restored " + "from session ticket " + "for algorithms " + Arrays.toString(certAlgs)); @@ -482,7 +482,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { // If there is no getMasterSecret with TLS1.2 or under, do not resume. if (!protocolVersion.useTLS13PlusSpec() && getMasterSecret().getEncoded() == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.finest("No MasterSecret, cannot make stateless" + " ticket"); } @@ -490,7 +490,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { } if (boundValues != null && boundValues.size() > 0) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.finest("There are boundValues, cannot make" + " stateless ticket"); } @@ -862,7 +862,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { void setSuite(CipherSuite suite) { cipherSuite = suite; - if (SSLLogger.isOn() && SSLLogger.isOn("session")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SESSION)) { SSLLogger.finest("Negotiating session: " + this); } } @@ -1132,7 +1132,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { return; } invalidated = true; - if (SSLLogger.isOn() && SSLLogger.isOn("session")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SESSION)) { SSLLogger.finest("Invalidated session: " + this); } for (SSLSessionImpl child : childSessions) { diff --git a/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java b/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java index ab01a9d85be..f603cc22949 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java @@ -370,7 +370,7 @@ public final class SSLSocketImpl // start handshaking, if failed, the connection will be closed. ensureNegotiated(false); } catch (IOException ioe) { - if (SSLLogger.isOn() && SSLLogger.isOn("handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.severe("handshake failed", ioe); } @@ -573,7 +573,7 @@ public final class SSLSocketImpl return; } - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine("duplex close of SSLSocket"); } @@ -591,7 +591,7 @@ public final class SSLSocketImpl } } catch (IOException ioe) { // ignore the exception - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("SSLSocket duplex close failed. Debug info only. Exception details:", ioe); } } finally { @@ -601,7 +601,7 @@ public final class SSLSocketImpl closeSocket(false); } catch (IOException ioe) { // ignore the exception - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("SSLSocket close failed. Debug info only. Exception details:", ioe); } } finally { @@ -696,7 +696,8 @@ public final class SSLSocketImpl "close_notify message cannot be sent."); } else { super.shutdownOutput(); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning( "SSLSocket output duplex close failed: " + "SO_LINGER timeout, " + @@ -717,7 +718,8 @@ public final class SSLSocketImpl // failed to send the close_notify message. // conContext.conSession.invalidate(); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning( "Invalidate the session: SO_LINGER timeout, " + "close_notify message cannot be sent."); @@ -832,7 +834,7 @@ public final class SSLSocketImpl return; } - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine("close inbound of SSLSocket"); } @@ -868,7 +870,7 @@ public final class SSLSocketImpl return; } - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine("close outbound of SSLSocket"); } conContext.closeOutbound(); @@ -1027,7 +1029,7 @@ public final class SSLSocketImpl // filed is checked here, in case the closing process is // still in progress. if (hasDepleted) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine("The input stream has been depleted"); } @@ -1048,7 +1050,8 @@ public final class SSLSocketImpl // Double check if the input stream has been depleted. if (hasDepleted) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine("The input stream is closing"); } @@ -1134,7 +1137,7 @@ public final class SSLSocketImpl @Override public void close() throws IOException { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.finest("Closing input stream"); } @@ -1142,7 +1145,7 @@ public final class SSLSocketImpl SSLSocketImpl.this.close(); } catch (IOException ioe) { // ignore the exception - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("input stream close failed. Debug info only. Exception details:", ioe); } } @@ -1218,7 +1221,7 @@ public final class SSLSocketImpl socketInputRecord.deplete( conContext.isNegotiated && (getSoTimeout() > 0)); } catch (Exception ex) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning( "input stream close depletion failed", ex); } @@ -1327,7 +1330,7 @@ public final class SSLSocketImpl @Override public void close() throws IOException { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.finest("Closing output stream"); } @@ -1335,7 +1338,7 @@ public final class SSLSocketImpl SSLSocketImpl.this.close(); } catch (IOException ioe) { // ignore the exception - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("output stream close failed. Debug info only. Exception details:", ioe); } } @@ -1543,7 +1546,7 @@ public final class SSLSocketImpl if ((conContext.handshakeContext == null) && !conContext.isOutboundClosed() && !conContext.isBroken) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.finest("trigger key update"); } startHandshake(); @@ -1562,7 +1565,7 @@ public final class SSLSocketImpl !conContext.isOutboundClosed() && !conContext.isInboundClosed() && !conContext.isBroken) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.finest("trigger new session ticket"); } conContext.conSession.updateNST = false; @@ -1670,7 +1673,7 @@ public final class SSLSocketImpl * This method never returns normally, it always throws an IOException. */ private void handleException(Exception cause) throws IOException { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("handling exception", cause); } @@ -1747,7 +1750,7 @@ public final class SSLSocketImpl @Override public void shutdown() throws IOException { if (!isClosed()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine("close the underlying socket"); } @@ -1773,7 +1776,7 @@ public final class SSLSocketImpl } private void closeSocket(boolean selfInitiated) throws IOException { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine("close the SSL connection " + (selfInitiated ? "(initiative)" : "(passive)")); } @@ -1828,7 +1831,7 @@ public final class SSLSocketImpl * transport without waiting for the responding close_notify. */ private void waitForClose() throws IOException { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine("wait for close_notify or alert"); } @@ -1838,7 +1841,8 @@ public final class SSLSocketImpl try { Plaintext plainText = decode(null); // discard and continue - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.finest( "discard plaintext while waiting for close", plainText); diff --git a/src/java.base/share/classes/sun/security/ssl/SSLSocketInputRecord.java b/src/java.base/share/classes/sun/security/ssl/SSLSocketInputRecord.java index ce7ab630730..fd9c4b171e7 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLSocketInputRecord.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLSocketInputRecord.java @@ -210,7 +210,7 @@ final class SSLSocketInputRecord extends InputRecord implements SSLRecord { int contentLen = ((header[3] & 0xFF) << 8) + (header[4] & 0xFF); // pos: 3, 4 - if (SSLLogger.isOn() && SSLLogger.isOn("record")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.RECORD)) { SSLLogger.fine( "READ: " + ProtocolVersion.nameOf(majorVersion, minorVersion) + @@ -243,7 +243,7 @@ final class SSLSocketInputRecord extends InputRecord implements SSLRecord { readFully(contentLen); recordBody.flip(); - if (SSLLogger.isOn() && SSLLogger.isOn("record")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.RECORD)) { SSLLogger.fine( "READ: " + ProtocolVersion.nameOf(majorVersion, minorVersion) + @@ -407,12 +407,12 @@ final class SSLSocketInputRecord extends InputRecord implements SSLRecord { os.write(SSLRecord.v2NoCipher); // SSLv2Hello if (SSLLogger.isOn()) { - if (SSLLogger.isOn("record")) { + if (SSLLogger.isOn(SSLLogger.Opt.RECORD)) { SSLLogger.fine( "Requested to negotiate unsupported SSLv2!"); } - if (SSLLogger.isOn("packet")) { + if (SSLLogger.isOn(SSLLogger.Opt.RECORD_PACKET)) { SSLLogger.fine("Raw write", SSLRecord.v2NoCipher); } } @@ -445,7 +445,8 @@ final class SSLSocketInputRecord extends InputRecord implements SSLRecord { ByteBuffer converted = convertToClientHello(recordBody); - if (SSLLogger.isOn() && SSLLogger.isOn("packet")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RECORD_PACKET)) { SSLLogger.fine( "[Converted] ClientHello", converted); } @@ -488,13 +489,14 @@ final class SSLSocketInputRecord extends InputRecord implements SSLRecord { private static int read(InputStream is, byte[] buf, int off, int len) throws IOException { int readLen = is.read(buf, off, len); if (readLen < 0) { - if (SSLLogger.isOn() && SSLLogger.isOn("packet")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RECORD_PACKET)) { SSLLogger.fine("Raw read: EOF"); } throw new EOFException("SSL peer shut down incorrectly"); } - if (SSLLogger.isOn() && SSLLogger.isOn("packet")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.RECORD_PACKET)) { ByteBuffer bb = ByteBuffer.wrap(buf, off, readLen); SSLLogger.fine("Raw read", bb); } diff --git a/src/java.base/share/classes/sun/security/ssl/SSLSocketOutputRecord.java b/src/java.base/share/classes/sun/security/ssl/SSLSocketOutputRecord.java index e83ad15db22..43f0580550a 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLSocketOutputRecord.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLSocketOutputRecord.java @@ -55,7 +55,7 @@ final class SSLSocketOutputRecord extends OutputRecord implements SSLRecord { recordLock.lock(); try { if (isClosed()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("outbound has closed, ignore outbound " + "alert message: " + Alert.nameOf(description)); } @@ -67,7 +67,7 @@ final class SSLSocketOutputRecord extends OutputRecord implements SSLRecord { write(level); write(description); - if (SSLLogger.isOn() && SSLLogger.isOn("record")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.RECORD)) { SSLLogger.fine("WRITE: " + protocolVersion.name + " " + ContentType.ALERT.name + "(" + Alert.nameOf(description) + ")" + @@ -81,7 +81,8 @@ final class SSLSocketOutputRecord extends OutputRecord implements SSLRecord { deliverStream.write(buf, 0, count); // may throw IOException deliverStream.flush(); // may throw IOException - if (SSLLogger.isOn() && SSLLogger.isOn("packet")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RECORD_PACKET)) { SSLLogger.fine("Raw write", (new ByteArrayInputStream(buf, 0, count))); } @@ -99,7 +100,7 @@ final class SSLSocketOutputRecord extends OutputRecord implements SSLRecord { recordLock.lock(); try { if (isClosed()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("outbound has closed, ignore outbound " + "handshake message", ByteBuffer.wrap(source, offset, length)); @@ -127,7 +128,8 @@ final class SSLSocketOutputRecord extends OutputRecord implements SSLRecord { int limit = v2ClientHello.limit(); handshakeHash.deliver(record, 2, (limit - 2)); - if (SSLLogger.isOn() && SSLLogger.isOn("record")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RECORD)) { SSLLogger.fine( "WRITE: SSLv2 ClientHello message" + ", length = " + limit); @@ -141,7 +143,8 @@ final class SSLSocketOutputRecord extends OutputRecord implements SSLRecord { deliverStream.write(record, 0, limit); deliverStream.flush(); - if (SSLLogger.isOn() && SSLLogger.isOn("packet")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RECORD_PACKET)) { SSLLogger.fine("Raw write", (new ByteArrayInputStream(record, 0, limit))); } @@ -177,7 +180,7 @@ final class SSLSocketOutputRecord extends OutputRecord implements SSLRecord { return; } - if (SSLLogger.isOn() && SSLLogger.isOn("record")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.RECORD)) { SSLLogger.fine( "WRITE: " + protocolVersion.name + " " + ContentType.HANDSHAKE.name + @@ -191,7 +194,8 @@ final class SSLSocketOutputRecord extends OutputRecord implements SSLRecord { deliverStream.write(buf, 0, count); // may throw IOException deliverStream.flush(); // may throw IOException - if (SSLLogger.isOn() && SSLLogger.isOn("packet")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RECORD_PACKET)) { SSLLogger.fine("Raw write", (new ByteArrayInputStream(buf, 0, count))); } @@ -212,7 +216,7 @@ final class SSLSocketOutputRecord extends OutputRecord implements SSLRecord { recordLock.lock(); try { if (isClosed()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("outbound has closed, ignore outbound " + "change_cipher_spec message"); } @@ -231,7 +235,8 @@ final class SSLSocketOutputRecord extends OutputRecord implements SSLRecord { deliverStream.write(buf, 0, count); // may throw IOException // deliverStream.flush(); // flush in Finished - if (SSLLogger.isOn() && SSLLogger.isOn("packet")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RECORD_PACKET)) { SSLLogger.fine("Raw write", (new ByteArrayInputStream(buf, 0, count))); } @@ -257,7 +262,7 @@ final class SSLSocketOutputRecord extends OutputRecord implements SSLRecord { return; } - if (SSLLogger.isOn() && SSLLogger.isOn("record")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.RECORD)) { SSLLogger.fine( "WRITE: " + protocolVersion.name + " " + ContentType.HANDSHAKE.name + @@ -271,7 +276,8 @@ final class SSLSocketOutputRecord extends OutputRecord implements SSLRecord { deliverStream.write(buf, 0, count); // may throw IOException deliverStream.flush(); // may throw IOException - if (SSLLogger.isOn() && SSLLogger.isOn("packet")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RECORD_PACKET)) { SSLLogger.fine("Raw write", (new ByteArrayInputStream(buf, 0, count))); } @@ -293,7 +299,7 @@ final class SSLSocketOutputRecord extends OutputRecord implements SSLRecord { } if (writeCipher.authenticator.seqNumOverflow()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine( "sequence number extremely close to overflow " + "(2^64-1 packets). Closing connection."); @@ -330,7 +336,7 @@ final class SSLSocketOutputRecord extends OutputRecord implements SSLRecord { count = position; write(source, offset, fragLen); - if (SSLLogger.isOn() && SSLLogger.isOn("record")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.RECORD)) { SSLLogger.fine( "WRITE: " + protocolVersion.name + " " + ContentType.APPLICATION_DATA.name + @@ -345,7 +351,8 @@ final class SSLSocketOutputRecord extends OutputRecord implements SSLRecord { deliverStream.write(buf, 0, count); // may throw IOException deliverStream.flush(); // may throw IOException - if (SSLLogger.isOn() && SSLLogger.isOn("packet")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RECORD_PACKET)) { SSLLogger.fine("Raw write", (new ByteArrayInputStream(buf, 0, count))); } diff --git a/src/java.base/share/classes/sun/security/ssl/SSLTransport.java b/src/java.base/share/classes/sun/security/ssl/SSLTransport.java index 9298e016f63..50bff1e6d21 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLTransport.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLTransport.java @@ -113,7 +113,7 @@ interface SSLTransport { // Code to deliver SSLv2 error message for SSL/TLS connections. if (!context.sslContext.isDTLS()) { context.outputRecord.encodeV2NoCipher(); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.finest("may be talking to SSLv2"); } } @@ -161,7 +161,8 @@ interface SSLTransport { if (context.handshakeContext != null && context.handshakeContext.sslConfig.enableRetransmissions && context.sslContext.isDTLS()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.finest("retransmitted handshake flight"); } @@ -181,7 +182,8 @@ interface SSLTransport { // Note that JDK does not support 0-RTT yet. Otherwise, it is // needed to check early_data. if (!context.isNegotiated) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning("unexpected application data " + "before handshake completion"); } diff --git a/src/java.base/share/classes/sun/security/ssl/ServerHello.java b/src/java.base/share/classes/sun/security/ssl/ServerHello.java index 0567c861e18..6980c216697 100644 --- a/src/java.base/share/classes/sun/security/ssl/ServerHello.java +++ b/src/java.base/share/classes/sun/security/ssl/ServerHello.java @@ -365,7 +365,7 @@ final class ServerHello { shc.sslConfig.getEnabledExtensions( SSLHandshake.SERVER_HELLO, shc.negotiatedProtocol); shm.extensions.produce(shc, serverHelloExtensions); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Produced ServerHello handshake message", shm); } @@ -440,7 +440,8 @@ final class ServerHello { } // The cipher suite has been negotiated. - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("use cipher suite " + cs.name); } @@ -453,7 +454,8 @@ final class ServerHello { if (ke != null) { SSLPossession[] hcds = ke.createPossessions(shc); if ((hcds != null) && (hcds.length != 0)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning( "use legacy cipher suite " + cs.name); } @@ -598,7 +600,7 @@ final class ServerHello { shc.sslConfig.getEnabledExtensions( SSLHandshake.SERVER_HELLO, shc.negotiatedProtocol); shm.extensions.produce(shc, serverHelloExtensions); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Produced ServerHello handshake message", shm); } @@ -768,14 +770,16 @@ final class ServerHello { } // The cipher suite has been negotiated. - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("use cipher suite " + cs.name); } return cs; } if (legacySuite != null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning( "use legacy cipher suite " + legacySuite.name); } @@ -828,7 +832,7 @@ final class ServerHello { shc.sslConfig.getEnabledExtensions( SSLHandshake.HELLO_RETRY_REQUEST, shc.negotiatedProtocol); hhrm.extensions.produce(shc, serverHelloExtensions); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Produced HelloRetryRequest handshake message", hhrm); } @@ -890,7 +894,7 @@ final class ServerHello { shc.sslConfig.getEnabledExtensions( SSLHandshake.MESSAGE_HASH, shc.negotiatedProtocol); hhrm.extensions.produce(shc, serverHelloExtensions); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Reproduced HelloRetryRequest handshake message", hhrm); } @@ -931,7 +935,7 @@ final class ServerHello { } ServerHelloMessage shm = new ServerHelloMessage(chc, message); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Consuming ServerHello handshake message", shm); } @@ -976,7 +980,7 @@ final class ServerHello { } chc.negotiatedProtocol = serverVersion; - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Negotiated protocol version: " + serverVersion.name); } @@ -1031,7 +1035,7 @@ final class ServerHello { chc.conContext.protocolVersion = chc.negotiatedProtocol; chc.conContext.outputRecord.setVersion(chc.negotiatedProtocol); } - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Negotiated protocol version: " + serverVersion.name); } @@ -1177,7 +1181,8 @@ final class ServerHello { chc.handshakeSession = new SSLSessionImpl(chc, chc.negotiatedCipherSuite, newId); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Locally assigned Session Id: " + newId.toString()); } @@ -1249,7 +1254,7 @@ final class ServerHello { private static void setUpPskKD(HandshakeContext hc, SecretKey psk) throws SSLHandshakeException { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Using PSK to derive early secret"); } diff --git a/src/java.base/share/classes/sun/security/ssl/ServerHelloDone.java b/src/java.base/share/classes/sun/security/ssl/ServerHelloDone.java index f38fdb2656b..e188f698f4b 100644 --- a/src/java.base/share/classes/sun/security/ssl/ServerHelloDone.java +++ b/src/java.base/share/classes/sun/security/ssl/ServerHelloDone.java @@ -93,7 +93,7 @@ final class ServerHelloDone { ServerHandshakeContext shc = (ServerHandshakeContext)context; ServerHelloDoneMessage shdm = new ServerHelloDoneMessage(shc); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Produced ServerHelloDone handshake message", shdm); } @@ -147,7 +147,7 @@ final class ServerHelloDone { ServerHelloDoneMessage shdm = new ServerHelloDoneMessage(chc, message); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Consuming ServerHelloDone handshake message", shdm); } diff --git a/src/java.base/share/classes/sun/security/ssl/ServerNameExtension.java b/src/java.base/share/classes/sun/security/ssl/ServerNameExtension.java index 1dbfcdba4df..0e232b17dda 100644 --- a/src/java.base/share/classes/sun/security/ssl/ServerNameExtension.java +++ b/src/java.base/share/classes/sun/security/ssl/ServerNameExtension.java @@ -216,7 +216,8 @@ final class ServerNameExtension { // Is it a supported and enabled extension? if (!chc.sslConfig.isAvailable(CH_SERVER_NAME)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning( "Ignore unavailable server_name extension"); } @@ -261,7 +262,7 @@ final class ServerNameExtension { return extData; } - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning("Unable to indicate server name"); } return null; @@ -287,7 +288,8 @@ final class ServerNameExtension { // Is it a supported and enabled extension? if (!shc.sslConfig.isAvailable(CH_SERVER_NAME)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable extension: " + CH_SERVER_NAME.name); } @@ -305,7 +307,8 @@ final class ServerNameExtension { if (!shc.sslConfig.sniMatchers.isEmpty()) { sni = chooseSni(shc.sslConfig.sniMatchers, spec.serverNames); if (sni != null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "server name indication (" + sni + ") is accepted"); @@ -322,7 +325,8 @@ final class ServerNameExtension { // connection with a "missing_extension" alert. // // We do not reject client without SNI extension currently. - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "no server name matchers, " + "ignore server name indication"); @@ -347,7 +351,8 @@ final class ServerNameExtension { // so don't include the pre-shared key in the // ServerHello handshake message shc.handshakeExtensions.remove(SH_PRE_SHARED_KEY); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "abort session resumption, " + "different server name indication used"); @@ -441,7 +446,8 @@ final class ServerNameExtension { CHServerNamesSpec spec = (CHServerNamesSpec) shc.handshakeExtensions.get(CH_SERVER_NAME); if (spec == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.finest( "Ignore unavailable extension: " + SH_SERVER_NAME.name); } @@ -451,7 +457,8 @@ final class ServerNameExtension { // When resuming a session, the server MUST NOT include a // server_name extension in the server hello. if (shc.isResumption || shc.negotiatedServerName == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.finest( "No expected server name indication response"); } @@ -528,7 +535,8 @@ final class ServerNameExtension { CHServerNamesSpec spec = (CHServerNamesSpec) shc.handshakeExtensions.get(CH_SERVER_NAME); if (spec == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.finest( "Ignore unavailable extension: " + EE_SERVER_NAME.name); } @@ -538,7 +546,8 @@ final class ServerNameExtension { // When resuming a session, the server MUST NOT include a // server_name extension in the server hello. if (shc.isResumption || shc.negotiatedServerName == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.finest( "No expected server name indication response"); } diff --git a/src/java.base/share/classes/sun/security/ssl/SessionTicketExtension.java b/src/java.base/share/classes/sun/security/ssl/SessionTicketExtension.java index de375cdfd98..e58422073c6 100644 --- a/src/java.base/share/classes/sun/security/ssl/SessionTicketExtension.java +++ b/src/java.base/share/classes/sun/security/ssl/SessionTicketExtension.java @@ -93,7 +93,8 @@ final class SessionTicketExtension { kt = Integer.parseInt(s) * 1000; // change to ms if (kt < 0 || kt > NewSessionTicket.MAX_TICKET_LIFETIME) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("Invalid timeout for " + "jdk.tls.server.statelessKeyTimeout: " + kt + ". Set to default value " + @@ -103,7 +104,7 @@ final class SessionTicketExtension { } } catch (NumberFormatException e) { kt = TIMEOUT_DEFAULT; - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("Invalid timeout for " + "jdk.tls.server.statelessKeyTimeout: " + s + ". Set to default value " + TIMEOUT_DEFAULT + @@ -253,7 +254,8 @@ final class SessionTicketExtension { Integer.BYTES + iv.length + 1, encrypted.length); return result; } catch (Exception e) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Encryption failed." + e); } return new byte[0]; @@ -295,7 +297,8 @@ final class SessionTicketExtension { return out; } catch (Exception e) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Decryption failed." + e); } } @@ -310,7 +313,7 @@ final class SessionTicketExtension { gos.write(input, 0, decompressedLen); gos.finish(); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("decompressed bytes: " + decompressedLen + "; compressed bytes: " + baos.size()); } @@ -329,7 +332,7 @@ final class SessionTicketExtension { new ByteArrayInputStream(bytes))) { byte[] out = gis.readAllBytes(); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("compressed bytes: " + compressedLen + "; decompressed bytes: " + out.length); } @@ -395,7 +398,8 @@ final class SessionTicketExtension { // If the context does not allow stateless tickets, exit if (!((SSLSessionContextImpl)chc.sslContext. engineGetClientSessionContext()).statelessEnabled()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Stateless resumption not supported"); } return null; @@ -407,7 +411,8 @@ final class SessionTicketExtension { if (!chc.isResumption || chc.resumingSession == null || chc.resumingSession.getPskIdentity() == null || chc.resumingSession.getProtocolVersion().useTLS13PlusSpec()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Stateless resumption supported"); } return new byte[0]; @@ -451,7 +456,8 @@ final class SessionTicketExtension { shc.statelessResumption = true; if (buffer.remaining() == 0) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Client accepts session tickets."); } return; @@ -463,11 +469,13 @@ final class SessionTicketExtension { if (b != null) { shc.resumingSession = new SSLSessionImpl(shc, b); shc.isResumption = true; - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Valid stateless session ticket found"); } } else { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Invalid stateless session ticket found"); } } @@ -547,7 +555,7 @@ final class SessionTicketExtension { // Disable stateless resumption if server doesn't send the extension. if (chc.statelessResumption) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.info( "Server doesn't support stateless resumption"); } diff --git a/src/java.base/share/classes/sun/security/ssl/SignatureAlgorithmsExtension.java b/src/java.base/share/classes/sun/security/ssl/SignatureAlgorithmsExtension.java index dddeb523516..41ed1b9462b 100644 --- a/src/java.base/share/classes/sun/security/ssl/SignatureAlgorithmsExtension.java +++ b/src/java.base/share/classes/sun/security/ssl/SignatureAlgorithmsExtension.java @@ -182,7 +182,8 @@ final class SignatureAlgorithmsExtension { // Is it a supported and enabled extension? if (!chc.sslConfig.isAvailable( SSLExtension.CH_SIGNATURE_ALGORITHMS)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable signature_algorithms extension"); } @@ -218,7 +219,8 @@ final class SignatureAlgorithmsExtension { // Is it a supported and enabled extension? if (!shc.sslConfig.isAvailable( SSLExtension.CH_SIGNATURE_ALGORITHMS)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable signature_algorithms extension"); } diff --git a/src/java.base/share/classes/sun/security/ssl/SignatureScheme.java b/src/java.base/share/classes/sun/security/ssl/SignatureScheme.java index b91fc17fd29..ba9a6f4fc4e 100644 --- a/src/java.base/share/classes/sun/security/ssl/SignatureScheme.java +++ b/src/java.base/share/classes/sun/security/ssl/SignatureScheme.java @@ -204,7 +204,8 @@ enum SignatureScheme { NoSuchAlgorithmException | RuntimeException exp) { // Signature.getParameters() may throw RuntimeException. mediator = false; - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning( "RSASSA-PSS signature with " + hash + " is not supported by the underlying providers", exp); @@ -297,7 +298,8 @@ enum SignatureScheme { Signature.getInstance(algorithm); } catch (Exception e) { mediator = false; - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning( "Signature algorithm, " + algorithm + ", is not supported by the underlying providers"); @@ -424,7 +426,7 @@ enum SignatureScheme { if (ss != null) { schemesToCheck.add(ss); } else { - SSLLogger.logWarning("ssl,handshake", "Unavailable " + SSLLogger.logWarning(SSLLogger.Opt.HANDSHAKE, "Unavailable " + "configured signature scheme: " + name); } } @@ -433,7 +435,7 @@ enum SignatureScheme { for (SignatureScheme ss: schemesToCheck) { if (!ss.isAvailable) { if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.finest( "Ignore unsupported signature scheme: " + ss.name); } @@ -452,12 +454,12 @@ enum SignatureScheme { if (ss.isPermitted(constraints, scopes)) { supported.add(ss); } else if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.finest( "Ignore disabled signature scheme: " + ss.name); } } else if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.finest( "Ignore inactive signature scheme: " + ss.name); } @@ -476,7 +478,8 @@ enum SignatureScheme { for (int ssid : algorithmIds) { SignatureScheme ss = SignatureScheme.valueOf(ssid); if (ss == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning( "Unsupported signature scheme: " + SignatureScheme.nameOf(ssid)); @@ -486,7 +489,8 @@ enum SignatureScheme { && ss.isAllowed(constraints, protocolVersion, scopes)) { supported.add(ss); } else { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning( "Unsupported signature scheme: " + ss.name); } @@ -546,7 +550,7 @@ enum SignatureScheme { } if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.finest( "Ignore the signature algorithm (" + ss + "), unsupported EC parameter spec: " + params); @@ -575,7 +579,7 @@ enum SignatureScheme { } if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.finest( "Ignore the legacy signature algorithm (" + ss + "), unsupported EC parameter spec: " + params); @@ -661,7 +665,7 @@ enum SignatureScheme { } catch (NoSuchAlgorithmException | InvalidKeyException | InvalidAlgorithmParameterException nsae) { if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.finest( "Ignore unsupported signature algorithm (" + this.name + ")", nsae); diff --git a/src/java.base/share/classes/sun/security/ssl/StatusResponseManager.java b/src/java.base/share/classes/sun/security/ssl/StatusResponseManager.java index d8c4a8ccc3e..2a4dc80eb42 100644 --- a/src/java.base/share/classes/sun/security/ssl/StatusResponseManager.java +++ b/src/java.base/share/classes/sun/security/ssl/StatusResponseManager.java @@ -119,13 +119,13 @@ final class StatusResponseManager { if (cert.getExtensionValue( PKIXExtensions.OCSPNoCheck_Id.toString()) != null) { - if (SSLLogger.isOn() && SSLLogger.isOn("respmgr")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.RESPMGR)) { SSLLogger.fine( "OCSP NoCheck extension found. OCSP will be skipped"); } return null; } else if (defaultResponder != null && respOverride) { - if (SSLLogger.isOn() && SSLLogger.isOn("respmgr")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.RESPMGR)) { SSLLogger.fine( "Responder override: URI is " + defaultResponder); } @@ -165,7 +165,7 @@ final class StatusResponseManager { Map responseMap = new HashMap<>(); List requestList = new ArrayList<>(); - if (SSLLogger.isOn() && SSLLogger.isOn("respmgr")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.RESPMGR)) { SSLLogger.fine( "Beginning check: Type = " + type + ", Chain length = " + chain.length); @@ -192,7 +192,8 @@ final class StatusResponseManager { requestList.add(new OCSPFetchCall(sInfo, ocspReq)); } } catch (IOException exc) { - if (SSLLogger.isOn() && SSLLogger.isOn("respmgr")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RESPMGR)) { SSLLogger.fine( "Exception during CertId creation: ", exc); } @@ -219,14 +220,15 @@ final class StatusResponseManager { requestList.add(new OCSPFetchCall(sInfo, ocspReq)); } } catch (IOException exc) { - if (SSLLogger.isOn() && SSLLogger.isOn("respmgr")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RESPMGR)) { SSLLogger.fine( "Exception during CertId creation: ", exc); } } } } else { - if (SSLLogger.isOn() && SSLLogger.isOn("respmgr")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.RESPMGR)) { SSLLogger.fine("Unsupported status request type: " + type); } } @@ -257,7 +259,8 @@ final class StatusResponseManager { // that, otherwise just log the ExecutionException Throwable cause = Optional.ofNullable( exc.getCause()).orElse(exc); - if (SSLLogger.isOn() && SSLLogger.isOn("respmgr")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RESPMGR)) { SSLLogger.fine("Exception during OCSP fetch: " + cause); } @@ -267,12 +270,13 @@ final class StatusResponseManager { responseMap.put(info.cert, info.responseData.ocspBytes); } else if (SSLLogger.isOn() && - SSLLogger.isOn("respmgr")) { + SSLLogger.isOn(SSLLogger.Opt.RESPMGR)) { SSLLogger.fine( "Completed task had no response data"); } } else { - if (SSLLogger.isOn() && SSLLogger.isOn("respmgr")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RESPMGR)) { SSLLogger.fine("Found cancelled task"); } } @@ -280,7 +284,8 @@ final class StatusResponseManager { } catch (InterruptedException intex) { // Log and reset the interrupted state Thread.currentThread().interrupt(); - if (SSLLogger.isOn() && SSLLogger.isOn("respmgr")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RESPMGR)) { SSLLogger.fine("Interrupt occurred while fetching: " + intex); } @@ -308,7 +313,8 @@ final class StatusResponseManager { for (Extension ext : ocspRequest.extensions) { if (ext.getId().equals( PKIXExtensions.OCSPNonce_Id.toString())) { - if (SSLLogger.isOn() && SSLLogger.isOn("respmgr")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RESPMGR)) { SSLLogger.fine( "Nonce extension found, skipping cache check"); } @@ -323,14 +329,14 @@ final class StatusResponseManager { // and do not return it as a cache hit. if (respEntry != null && respEntry.nextUpdate != null && respEntry.nextUpdate.before(new Date())) { - if (SSLLogger.isOn() && SSLLogger.isOn("respmgr")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.RESPMGR)) { SSLLogger.fine( "nextUpdate threshold exceeded, purging from cache"); } respEntry = null; } - if (SSLLogger.isOn() && SSLLogger.isOn("respmgr")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.RESPMGR)) { SSLLogger.fine( "Check cache for SN" + Debug.toString(cid.getSerialNumber()) + ": " + (respEntry != null ? "HIT" : "MISS")); @@ -493,7 +499,7 @@ final class StatusResponseManager { */ @Override public StatusInfo call() { - if (SSLLogger.isOn() && SSLLogger.isOn("respmgr")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.RESPMGR)) { SSLLogger.fine( "Starting fetch for SN " + Debug.toString(statInfo.cid.getSerialNumber())); @@ -505,13 +511,15 @@ final class StatusResponseManager { if (statInfo.responder == null) { // If we have no URI then there's nothing to do // but return. - if (SSLLogger.isOn() && SSLLogger.isOn("respmgr")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RESPMGR)) { SSLLogger.fine( "Null URI detected, OCSP fetch aborted"); } return statInfo; } else { - if (SSLLogger.isOn() && SSLLogger.isOn("respmgr")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RESPMGR)) { SSLLogger.fine( "Attempting fetch from " + statInfo.responder); } @@ -541,7 +549,8 @@ final class StatusResponseManager { statInfo.cid); // Get the response status and act on it appropriately - if (SSLLogger.isOn() && SSLLogger.isOn("respmgr")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RESPMGR)) { SSLLogger.fine("OCSP Status: " + cacheEntry.status + " (" + respBytes.length + " bytes)"); } @@ -554,7 +563,8 @@ final class StatusResponseManager { addToCache(statInfo.cid, cacheEntry); } } catch (IOException ioe) { - if (SSLLogger.isOn() && SSLLogger.isOn("respmgr")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RESPMGR)) { SSLLogger.fine("Caught exception: ", ioe); } } @@ -573,12 +583,14 @@ final class StatusResponseManager { // If no cache lifetime has been set on entries then // don't cache this response if there is no nextUpdate field if (entry.nextUpdate == null && cacheLifetime == 0) { - if (SSLLogger.isOn() && SSLLogger.isOn("respmgr")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RESPMGR)) { SSLLogger.fine("Not caching this OCSP response"); } } else { responseCache.put(certId, entry); - if (SSLLogger.isOn() && SSLLogger.isOn("respmgr")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.RESPMGR)) { SSLLogger.fine( "Added response for SN " + Debug.toString(certId.getSerialNumber()) + @@ -600,7 +612,7 @@ final class StatusResponseManager { // is necessary. Also, we will only staple if we're doing a full // handshake. if (!shc.sslContext.isStaplingEnabled(false) || shc.isResumption) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("Staping disabled or is a resumed session"); } return null; @@ -623,7 +635,8 @@ final class StatusResponseManager { // selection yet, only accept a request if the ResponderId field // is empty. Finally, we'll only do this in (D)TLS 1.2 or earlier. if (statReqV2 != null && !shc.negotiatedProtocol.useTLS13PlusSpec()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake,verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine("SH Processing status_request_v2 extension"); } // RFC 6961 stapling @@ -661,7 +674,7 @@ final class StatusResponseManager { type = CertStatusRequestType.valueOf(req.statusType); } else { if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.finest("Warning: No suitable request " + "found in the status_request_v2 extension."); } @@ -678,7 +691,8 @@ final class StatusResponseManager { // we will try processing an asserted status_request. if ((statReq != null) && (ext == null || type == null || req == null)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake,verbose")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE_VERBOSE)) { SSLLogger.fine("SH Processing status_request extension"); } ext = SSLExtension.CH_STATUS_REQUEST; @@ -692,7 +706,8 @@ final class StatusResponseManager { if (ocspReq.responderIds.isEmpty()) { req = ocspReq; } else { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.finest("Warning: No suitable request " + "found in the status_request extension."); } @@ -704,7 +719,7 @@ final class StatusResponseManager { // find a suitable StatusRequest, then stapling is disabled. // The ext, type and req variables must have been set to continue. if (type == null || req == null || ext == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine("No suitable status_request or " + "status_request_v2, stapling is disabled"); } @@ -721,7 +736,7 @@ final class StatusResponseManager { } if (x509Possession == null) { // unlikely - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.finest("Warning: no X.509 certificates found. " + "Stapling is disabled."); } @@ -743,7 +758,8 @@ final class StatusResponseManager { responses = statRespMgr.get(fetchType, req, certs, shc.statusRespTimeout, TimeUnit.MILLISECONDS); if (!responses.isEmpty()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.finest("Response manager returned " + responses.size() + " entries."); } @@ -753,7 +769,7 @@ final class StatusResponseManager { byte[] respDER = responses.get(certs[0]); if (respDER == null || respDER.length == 0) { if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.finest("Warning: Null or zero-length " + "response found for leaf certificate. " + "Stapling is disabled."); @@ -763,7 +779,8 @@ final class StatusResponseManager { } params = new StaplingParameters(ext, type, req, responses); } else { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.finest("Warning: no OCSP responses obtained. " + "Stapling is disabled."); } @@ -771,7 +788,7 @@ final class StatusResponseManager { } else { // This should not happen, but if lazy initialization of the // StatusResponseManager doesn't occur we should turn off stapling. - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.finest("Warning: lazy initialization " + "of the StatusResponseManager failed. " + "Stapling is disabled."); diff --git a/src/java.base/share/classes/sun/security/ssl/SunX509KeyManagerImpl.java b/src/java.base/share/classes/sun/security/ssl/SunX509KeyManagerImpl.java index 1fa2356d1de..7775a2bca97 100644 --- a/src/java.base/share/classes/sun/security/ssl/SunX509KeyManagerImpl.java +++ b/src/java.base/share/classes/sun/security/ssl/SunX509KeyManagerImpl.java @@ -129,8 +129,8 @@ final class SunX509KeyManagerImpl extends X509KeyManagerCertChecking { X509Credentials cred = new X509Credentials((PrivateKey) key, (X509Certificate[]) certs); credentialsMap.put(alias, cred); - if (SSLLogger.isOn() && SSLLogger.isOn("keymanager")) { - SSLLogger.fine("found key for : " + alias, (Object[]) certs); + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.KEYMANAGER)) { + SSLLogger.fine("found key for : " + alias, (Object[])certs); } } } @@ -315,7 +315,8 @@ final class SunX509KeyManagerImpl extends X509KeyManagerCertChecking { } if (results == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("keymanager")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.KEYMANAGER)) { SSLLogger.fine("KeyMgr: no matching key found"); } return null; diff --git a/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java b/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java index 67cb37988a1..28e81e52866 100644 --- a/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java +++ b/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java @@ -164,7 +164,8 @@ final class SupportedGroupsExtension { // Is it a supported and enabled extension? if (!chc.sslConfig.isAvailable(CH_SUPPORTED_GROUPS)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable supported_groups extension"); } @@ -177,7 +178,8 @@ final class SupportedGroupsExtension { for (String name : chc.sslConfig.namedGroups) { NamedGroup ng = NamedGroup.nameOf(name); if (ng == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unspecified named group: " + name); } @@ -193,14 +195,16 @@ final class SupportedGroupsExtension { ng.isSupported(chc.activeCipherSuites) && ng.isPermitted(chc.algorithmConstraints)) { namedGroups.add(ng); - } else if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + } else if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore inactive or disabled named group: " + ng.name); } } if (namedGroups.isEmpty()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning("no available named group"); } @@ -244,7 +248,8 @@ final class SupportedGroupsExtension { // Is it a supported and enabled extension? if (!shc.sslConfig.isAvailable(CH_SUPPORTED_GROUPS)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable supported_groups extension"); } @@ -319,7 +324,8 @@ final class SupportedGroupsExtension { // Is it a supported and enabled extension? if (!shc.sslConfig.isAvailable(EE_SUPPORTED_GROUPS)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable supported_groups extension"); } @@ -336,7 +342,7 @@ final class SupportedGroupsExtension { NamedGroup ng = NamedGroup.nameOf(name); if (ng == null) { if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake")) { + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unspecified named group: " + name); } @@ -352,14 +358,16 @@ final class SupportedGroupsExtension { ng.isSupported(shc.activeCipherSuites) && ng.isPermitted(shc.algorithmConstraints)) { namedGroups.add(ng); - } else if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + } else if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore inactive or disabled named group: " + ng.name); } } if (namedGroups.isEmpty()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning("no available named group"); } @@ -399,7 +407,8 @@ final class SupportedGroupsExtension { // Is it a supported and enabled extension? if (!chc.sslConfig.isAvailable(EE_SUPPORTED_GROUPS)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable supported_groups extension"); } diff --git a/src/java.base/share/classes/sun/security/ssl/SupportedVersionsExtension.java b/src/java.base/share/classes/sun/security/ssl/SupportedVersionsExtension.java index 58597c3008c..90c315a57c5 100644 --- a/src/java.base/share/classes/sun/security/ssl/SupportedVersionsExtension.java +++ b/src/java.base/share/classes/sun/security/ssl/SupportedVersionsExtension.java @@ -168,7 +168,8 @@ final class SupportedVersionsExtension { // Is it a supported and enabled extension? if (!chc.sslConfig.isAvailable(CH_SUPPORTED_VERSIONS)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable extension: " + CH_SUPPORTED_VERSIONS.name); @@ -216,7 +217,8 @@ final class SupportedVersionsExtension { // Is it a supported and enabled extension? if (!shc.sslConfig.isAvailable(CH_SUPPORTED_VERSIONS)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable extension: " + CH_SUPPORTED_VERSIONS.name); @@ -308,7 +310,8 @@ final class SupportedVersionsExtension { shc.handshakeExtensions.get(CH_SUPPORTED_VERSIONS); if (svs == null) { // Unlikely, no key_share extension requested. - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.warning( "Ignore unavailable supported_versions extension"); } @@ -317,7 +320,8 @@ final class SupportedVersionsExtension { // Is it a supported and enabled extension? if (!shc.sslConfig.isAvailable(SH_SUPPORTED_VERSIONS)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable extension: " + SH_SUPPORTED_VERSIONS.name); @@ -356,7 +360,8 @@ final class SupportedVersionsExtension { // Is it a supported and enabled extension? if (!chc.sslConfig.isAvailable(SH_SUPPORTED_VERSIONS)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable extension: " + SH_SUPPORTED_VERSIONS.name); @@ -399,7 +404,8 @@ final class SupportedVersionsExtension { // Is it a supported and enabled extension? if (!shc.sslConfig.isAvailable(HRR_SUPPORTED_VERSIONS)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable extension: " + HRR_SUPPORTED_VERSIONS.name); @@ -441,7 +447,8 @@ final class SupportedVersionsExtension { // Is it a supported and enabled extension? if (!chc.sslConfig.isAvailable(HRR_SUPPORTED_VERSIONS)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "Ignore unavailable extension: " + HRR_SUPPORTED_VERSIONS.name); @@ -483,7 +490,8 @@ final class SupportedVersionsExtension { // Is it a supported and enabled extension? if (!shc.sslConfig.isAvailable(HRR_SUPPORTED_VERSIONS)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.HANDSHAKE)) { SSLLogger.fine( "[Reproduce] Ignore unavailable extension: " + HRR_SUPPORTED_VERSIONS.name); diff --git a/src/java.base/share/classes/sun/security/ssl/TransportContext.java b/src/java.base/share/classes/sun/security/ssl/TransportContext.java index 35bdd2fff36..1c68c13bbdc 100644 --- a/src/java.base/share/classes/sun/security/ssl/TransportContext.java +++ b/src/java.base/share/classes/sun/security/ssl/TransportContext.java @@ -269,7 +269,7 @@ final class TransportContext implements ConnectionContext { try { outputRecord.encodeAlert(Alert.Level.WARNING.level, alert.id); } catch (IOException ioe) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning( "Warning: failed to send warning alert " + alert, ioe); } @@ -329,7 +329,7 @@ final class TransportContext implements ConnectionContext { // so we'll do it here. if (closeReason != null) { if (cause == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning( "Closed transport, general or untracked problem"); } @@ -340,7 +340,7 @@ final class TransportContext implements ConnectionContext { if (cause instanceof SSLException) { throw (SSLException)cause; } else { // unlikely, but just in case. - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning( "Closed transport, unexpected rethrowing", cause); } @@ -363,7 +363,7 @@ final class TransportContext implements ConnectionContext { } // shutdown the transport - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.severe("Fatal (" + alert + "): " + diagnostic, cause); } @@ -379,7 +379,7 @@ final class TransportContext implements ConnectionContext { try { inputRecord.close(); } catch (IOException ioe) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("Fatal: input record closure failed", ioe); } @@ -410,7 +410,7 @@ final class TransportContext implements ConnectionContext { try { outputRecord.encodeAlert(Alert.Level.FATAL.level, alert.id); } catch (IOException ioe) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning( "Fatal: failed to send fatal alert " + alert, ioe); } @@ -423,7 +423,7 @@ final class TransportContext implements ConnectionContext { try { outputRecord.close(); } catch (IOException ioe) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("Fatal: output record closure failed", ioe); } @@ -439,7 +439,7 @@ final class TransportContext implements ConnectionContext { try { transport.shutdown(); } catch (IOException ioe) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("Fatal: transport closure failed", ioe); } @@ -525,7 +525,7 @@ final class TransportContext implements ConnectionContext { passiveInboundClose(); } } catch (IOException ioe) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("inbound closure failed", ioe); } } @@ -582,7 +582,7 @@ final class TransportContext implements ConnectionContext { try { initiateOutboundClose(); } catch (IOException ioe) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning("outbound closure failed", ioe); } } diff --git a/src/java.base/share/classes/sun/security/ssl/TrustManagerFactoryImpl.java b/src/java.base/share/classes/sun/security/ssl/TrustManagerFactoryImpl.java index 8b89fecefa8..584a125710e 100644 --- a/src/java.base/share/classes/sun/security/ssl/TrustManagerFactoryImpl.java +++ b/src/java.base/share/classes/sun/security/ssl/TrustManagerFactoryImpl.java @@ -48,24 +48,28 @@ abstract class TrustManagerFactoryImpl extends TrustManagerFactorySpi { trustManager = getInstance(TrustStoreManager.getTrustedCerts()); } catch (SecurityException se) { // eat security exceptions but report other throwables - if (SSLLogger.isOn() && SSLLogger.isOn("trustmanager")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.TRUSTMANAGER)) { SSLLogger.fine( "SunX509: skip default keystore", se); } } catch (Error err) { - if (SSLLogger.isOn() && SSLLogger.isOn("trustmanager")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.TRUSTMANAGER)) { SSLLogger.fine( "SunX509: skip default keystore", err); } throw err; } catch (RuntimeException re) { - if (SSLLogger.isOn() && SSLLogger.isOn("trustmanager")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.TRUSTMANAGER)) { SSLLogger.fine( "SunX509: skip default keystore", re); } throw re; } catch (Exception e) { - if (SSLLogger.isOn() && SSLLogger.isOn("trustmanager")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.TRUSTMANAGER)) { SSLLogger.fine( "SunX509: skip default keystore", e); } diff --git a/src/java.base/share/classes/sun/security/ssl/TrustStoreManager.java b/src/java.base/share/classes/sun/security/ssl/TrustStoreManager.java index a44f3a4e32d..0f0bfa4bfa8 100644 --- a/src/java.base/share/classes/sun/security/ssl/TrustStoreManager.java +++ b/src/java.base/share/classes/sun/security/ssl/TrustStoreManager.java @@ -108,7 +108,8 @@ final class TrustStoreManager { this.storeFile = storeFile; this.lastModified = lastModified; - if (SSLLogger.isOn() && SSLLogger.isOn("trustmanager")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.TRUSTMANAGER)) { SSLLogger.fine( "trustStore is: " + storeName + "\n" + "trustStore type is: " + storeType + "\n" + @@ -152,7 +153,7 @@ final class TrustStoreManager { // Not break, the file is inaccessible. if (SSLLogger.isOn() && - SSLLogger.isOn("trustmanager")) { + SSLLogger.isOn(SSLLogger.Opt.TRUSTMANAGER)) { SSLLogger.fine( "Inaccessible trust store: " + fileName); @@ -267,7 +268,8 @@ final class TrustStoreManager { } // Reload a new key store. - if (SSLLogger.isOn() && SSLLogger.isOn("trustmanager")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.TRUSTMANAGER)) { SSLLogger.fine("Reload the trust store"); } @@ -321,7 +323,8 @@ final class TrustStoreManager { // Reload the trust store if needed. if (ks == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("trustmanager")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.TRUSTMANAGER)) { SSLLogger.fine("Reload the trust store"); } ks = loadKeyStore(descriptor); @@ -329,12 +332,14 @@ final class TrustStoreManager { } // Reload trust certs from the key store. - if (SSLLogger.isOn() && SSLLogger.isOn("trustmanager")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.TRUSTMANAGER)) { SSLLogger.fine("Reload trust certs"); } certs = loadTrustedCerts(ks); - if (SSLLogger.isOn() && SSLLogger.isOn("trustmanager")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.TRUSTMANAGER)) { SSLLogger.fine("Reloaded " + certs.size() + " trust certs"); } @@ -355,7 +360,8 @@ final class TrustStoreManager { descriptor.storeFile == null) { // No file available, no KeyStore available. - if (SSLLogger.isOn() && SSLLogger.isOn("trustmanager")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.TRUSTMANAGER)) { SSLLogger.fine("No available key store"); } @@ -382,7 +388,8 @@ final class TrustStoreManager { ks.load(bis, password); } catch (FileNotFoundException fnfe) { // No file available, no KeyStore available. - if (SSLLogger.isOn() && SSLLogger.isOn("trustmanager")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.TRUSTMANAGER)) { SSLLogger.fine( "Not available key store: " + descriptor.storeName); } diff --git a/src/java.base/share/classes/sun/security/ssl/Utilities.java b/src/java.base/share/classes/sun/security/ssl/Utilities.java index 458551b9d8a..e289a9e1bd6 100644 --- a/src/java.base/share/classes/sun/security/ssl/Utilities.java +++ b/src/java.base/share/classes/sun/security/ssl/Utilities.java @@ -70,7 +70,7 @@ final class Utilities { SNIServerName serverName = sniList.get(i); if (serverName.getType() == StandardConstants.SNI_HOST_NAME) { sniList.set(i, sniHostName); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine( "the previous server name in SNI (" + serverName + ") was replaced with (" + sniHostName + ")"); @@ -116,7 +116,7 @@ final class Utilities { return new SNIHostName(hostname); } catch (IllegalArgumentException iae) { // don't bother to handle illegal host_name - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine(hostname + "\" " + "is not a legal HostName for server name indication"); } diff --git a/src/java.base/share/classes/sun/security/ssl/X509Authentication.java b/src/java.base/share/classes/sun/security/ssl/X509Authentication.java index 6aedff02c34..bdb2dd7706f 100644 --- a/src/java.base/share/classes/sun/security/ssl/X509Authentication.java +++ b/src/java.base/share/classes/sun/security/ssl/X509Authentication.java @@ -201,7 +201,7 @@ enum X509Authentication implements SSLAuthentication { private static SSLPossession createClientPossession( ClientHandshakeContext chc, String[] keyTypes) { X509ExtendedKeyManager km = chc.sslContext.getX509KeyManager(); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.finest("X509KeyManager class: " + km.getClass().getName()); } @@ -243,7 +243,7 @@ enum X509Authentication implements SSLAuthentication { } if (clientAlias == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.finest("No X.509 cert selected for " + Arrays.toString(keyTypes)); } @@ -252,7 +252,7 @@ enum X509Authentication implements SSLAuthentication { PrivateKey clientPrivateKey = km.getPrivateKey(clientAlias); if (clientPrivateKey == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.finest( clientAlias + " is not a private key entry"); } @@ -261,7 +261,7 @@ enum X509Authentication implements SSLAuthentication { X509Certificate[] clientCerts = km.getCertificateChain(clientAlias); if ((clientCerts == null) || (clientCerts.length == 0)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.finest(clientAlias + " is a private key entry with no cert chain stored"); } @@ -270,7 +270,7 @@ enum X509Authentication implements SSLAuthentication { String privateKeyAlgorithm = clientPrivateKey.getAlgorithm(); if (!Arrays.asList(keyTypes).contains(privateKeyAlgorithm)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine( clientAlias + " private key algorithm " + privateKeyAlgorithm + " not in request list"); @@ -280,7 +280,7 @@ enum X509Authentication implements SSLAuthentication { String publicKeyAlgorithm = clientCerts[0].getPublicKey().getAlgorithm(); if (!privateKeyAlgorithm.equals(publicKeyAlgorithm)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine( clientAlias + " private or public key is not of " + "same algorithm: " + @@ -296,7 +296,7 @@ enum X509Authentication implements SSLAuthentication { private static SSLPossession createServerPossession( ServerHandshakeContext shc, String[] keyTypes) { X509ExtendedKeyManager km = shc.sslContext.getX509KeyManager(); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.finest("X509KeyManager class: " + km.getClass().getName()); } @@ -337,7 +337,7 @@ enum X509Authentication implements SSLAuthentication { } if (serverAlias == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.finest("No X.509 cert selected for " + keyType); } continue; @@ -345,7 +345,7 @@ enum X509Authentication implements SSLAuthentication { PrivateKey serverPrivateKey = km.getPrivateKey(serverAlias); if (serverPrivateKey == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.finest( serverAlias + " is not a private key entry"); } @@ -354,7 +354,7 @@ enum X509Authentication implements SSLAuthentication { X509Certificate[] serverCerts = km.getCertificateChain(serverAlias); if ((serverCerts == null) || (serverCerts.length == 0)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.finest( serverAlias + " is not a certificate entry"); } @@ -364,7 +364,7 @@ enum X509Authentication implements SSLAuthentication { PublicKey serverPublicKey = serverCerts[0].getPublicKey(); if ((!serverPrivateKey.getAlgorithm().equals(keyType)) || (!serverPublicKey.getAlgorithm().equals(keyType))) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine( serverAlias + " private or public key is not of " + keyType + " algorithm"); @@ -379,7 +379,7 @@ enum X509Authentication implements SSLAuthentication { if (!shc.negotiatedProtocol.useTLS13PlusSpec() && keyType.equals("EC")) { if (!(serverPublicKey instanceof ECPublicKey)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning(serverAlias + " public key is not an instance of ECPublicKey"); } @@ -398,7 +398,8 @@ enum X509Authentication implements SSLAuthentication { ((shc.clientRequestedNamedGroups != null) && !shc.clientRequestedNamedGroups.contains(namedGroup))) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.warning( "Unsupported named group (" + namedGroup + ") used in the " + serverAlias + " certificate"); diff --git a/src/java.base/share/classes/sun/security/ssl/X509KeyManagerCertChecking.java b/src/java.base/share/classes/sun/security/ssl/X509KeyManagerCertChecking.java index 2a1f01273bd..6d26558847c 100644 --- a/src/java.base/share/classes/sun/security/ssl/X509KeyManagerCertChecking.java +++ b/src/java.base/share/classes/sun/security/ssl/X509KeyManagerCertChecking.java @@ -116,7 +116,7 @@ abstract class X509KeyManagerCertChecking extends X509ExtendedKeyManager { } if (keyIndex == -1) { - if (SSLLogger.isOn() && SSLLogger.isOn("keymanager")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.KEYMANAGER)) { SSLLogger.fine("Ignore alias " + alias + ": key algorithm does not match"); } @@ -134,7 +134,8 @@ abstract class X509KeyManagerCertChecking extends X509ExtendedKeyManager { } } if (!found) { - if (SSLLogger.isOn() && SSLLogger.isOn("keymanager")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.KEYMANAGER)) { SSLLogger.fine( "Ignore alias " + alias + ": issuers do not match"); @@ -150,7 +151,7 @@ abstract class X509KeyManagerCertChecking extends X509ExtendedKeyManager { !conformsToAlgorithmConstraints(constraints, chain, checkType.getValidator())) { - if (SSLLogger.isOn() && SSLLogger.isOn("keymanager")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.KEYMANAGER)) { SSLLogger.fine("Ignore alias " + alias + ": certificate chain does not conform to " + "algorithm constraints"); @@ -219,7 +220,7 @@ abstract class X509KeyManagerCertChecking extends X509ExtendedKeyManager { checker.init(false); } catch (CertPathValidatorException cpve) { // unlikely to happen - if (SSLLogger.isOn() && SSLLogger.isOn("keymanager")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.KEYMANAGER)) { SSLLogger.fine( "Cannot initialize algorithm constraints checker", cpve); @@ -235,7 +236,8 @@ abstract class X509KeyManagerCertChecking extends X509ExtendedKeyManager { // We don't care about the unresolved critical extensions. checker.check(cert, Collections.emptySet()); } catch (CertPathValidatorException cpve) { - if (SSLLogger.isOn() && SSLLogger.isOn("keymanager")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.KEYMANAGER)) { SSLLogger.fine("Certificate does not conform to " + "algorithm constraints", cert, cpve); } @@ -393,7 +395,7 @@ abstract class X509KeyManagerCertChecking extends X509ExtendedKeyManager { } catch (IllegalArgumentException iae) { // unlikely to happen, just in case ... if (SSLLogger.isOn() && - SSLLogger.isOn("keymanager")) { + SSLLogger.isOn(SSLLogger.Opt.KEYMANAGER)) { SSLLogger.fine("Illegal server name: " + serverName); } @@ -409,7 +411,7 @@ abstract class X509KeyManagerCertChecking extends X509ExtendedKeyManager { cert, idAlgorithm); } catch (CertificateException e) { if (SSLLogger.isOn() && - SSLLogger.isOn("keymanager")) { + SSLLogger.isOn(SSLLogger.Opt.KEYMANAGER)) { SSLLogger.fine( "Certificate identity does not match " + "Server Name Indication (SNI): " diff --git a/src/java.base/share/classes/sun/security/ssl/X509KeyManagerImpl.java b/src/java.base/share/classes/sun/security/ssl/X509KeyManagerImpl.java index 72f079db175..be982bfd192 100644 --- a/src/java.base/share/classes/sun/security/ssl/X509KeyManagerImpl.java +++ b/src/java.base/share/classes/sun/security/ssl/X509KeyManagerImpl.java @@ -228,7 +228,7 @@ final class X509KeyManagerImpl extends X509KeyManagerCertChecking { || (secondDot - firstDot < 2) || (alias.length() - secondDot < 2)) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,keymanager")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.KEYMANAGER)) { SSLLogger.warning("Invalid alias format: " + alias); } return null; @@ -255,7 +255,7 @@ final class X509KeyManagerImpl extends X509KeyManagerCertChecking { NoSuchAlgorithmException | IndexOutOfBoundsException e) { // ignore and only log exception - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,keymanager")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.KEYMANAGER)) { SSLLogger.warning("Exception thrown while getting an alias " + alias + ": " + e); } @@ -296,7 +296,7 @@ final class X509KeyManagerImpl extends X509KeyManagerCertChecking { for (EntryStatus status : results) { if (status.checkResult == CheckResult.OK) { if (SSLLogger.isOn() - && SSLLogger.isOn("ssl,keymanager")) { + && SSLLogger.isOn(SSLLogger.Opt.KEYMANAGER)) { SSLLogger.fine("Choosing key: " + status); } return makeAlias(status); @@ -312,13 +312,13 @@ final class X509KeyManagerImpl extends X509KeyManagerCertChecking { } } if (allResults == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,keymanager")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.KEYMANAGER)) { SSLLogger.fine("No matching key found"); } return null; } Collections.sort(allResults); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,keymanager")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.KEYMANAGER)) { SSLLogger.fine( "No good matching key found, " + "returning best match out of", allResults); @@ -358,13 +358,13 @@ final class X509KeyManagerImpl extends X509KeyManagerCertChecking { } } if (allResults == null || allResults.isEmpty()) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,keymanager")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.KEYMANAGER)) { SSLLogger.fine("No matching alias found"); } return null; } Collections.sort(allResults); - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,keymanager")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.KEYMANAGER)) { SSLLogger.fine("Getting aliases", allResults); } return toAliases(allResults); diff --git a/src/java.base/share/classes/sun/security/ssl/X509TrustManagerImpl.java b/src/java.base/share/classes/sun/security/ssl/X509TrustManagerImpl.java index 40ee01d284a..209e315b59d 100644 --- a/src/java.base/share/classes/sun/security/ssl/X509TrustManagerImpl.java +++ b/src/java.base/share/classes/sun/security/ssl/X509TrustManagerImpl.java @@ -74,7 +74,7 @@ final class X509TrustManagerImpl extends X509ExtendedTrustManager { this.trustedCerts = trustedCerts; - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,trustmanager")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.TRUSTMANAGER)) { SSLLogger.fine("adding as trusted certificates", (Object[])trustedCerts.toArray(new X509Certificate[0])); } @@ -91,7 +91,7 @@ final class X509TrustManagerImpl extends X509ExtendedTrustManager { trustedCerts = v.getTrustedCertificates(); serverValidator = v; - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,trustmanager")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.TRUSTMANAGER)) { SSLLogger.fine("adding as trusted certificates", (Object[])trustedCerts.toArray(new X509Certificate[0])); } @@ -294,7 +294,7 @@ final class X509TrustManagerImpl extends X509ExtendedTrustManager { null, checkClientTrusted ? null : authType); } - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,trustmanager")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.TRUSTMANAGER)) { SSLLogger.fine("Found trusted certificate", trustedChain[trustedChain.length - 1]); } @@ -328,7 +328,8 @@ final class X509TrustManagerImpl extends X509ExtendedTrustManager { hostname = new SNIHostName(sniName.getEncoded()); } catch (IllegalArgumentException iae) { // unlikely to happen, just in case ... - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,trustmanager")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.TRUSTMANAGER)) { SSLLogger.fine("Illegal server name: " + sniName); } } diff --git a/src/java.base/share/classes/sun/security/util/DomainName.java b/src/java.base/share/classes/sun/security/util/DomainName.java index 465c155ab87..82a5179e9b5 100644 --- a/src/java.base/share/classes/sun/security/util/DomainName.java +++ b/src/java.base/share/classes/sun/security/util/DomainName.java @@ -192,7 +192,7 @@ class DomainName { } return getRules(tld, new ZipInputStream(pubSuffixStream)); } catch (IOException e) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine( "cannot parse public suffix data for " + tld + ": " + e.getMessage()); @@ -209,8 +209,8 @@ class DomainName { is = new FileInputStream(f); } catch (FileNotFoundException e) { } if (is == null) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl") && - SSLLogger.isOn("trustmanager")) { + if (SSLLogger.isOn() && + SSLLogger.isOn(SSLLogger.Opt.TRUSTMANAGER)) { SSLLogger.fine( "lib/security/public_suffix_list.dat not found"); } @@ -230,7 +230,7 @@ class DomainName { } } if (!found) { - if (SSLLogger.isOn() && SSLLogger.isOn("ssl")) { + if (SSLLogger.isOn() && SSLLogger.isOn(SSLLogger.Opt.SSL)) { SSLLogger.fine("Domain " + tld + " not found"); } return null; diff --git a/test/jdk/sun/security/ssl/SSLEngineImpl/SSLEngineKeyLimit.java b/test/jdk/sun/security/ssl/SSLEngineImpl/SSLEngineKeyLimit.java index 5a704ef4d1f..9c813c46bdc 100644 --- a/test/jdk/sun/security/ssl/SSLEngineImpl/SSLEngineKeyLimit.java +++ b/test/jdk/sun/security/ssl/SSLEngineImpl/SSLEngineKeyLimit.java @@ -111,7 +111,7 @@ public class SSLEngineKeyLimit extends SSLContextTemplate { System.setProperty("test.java.opts", System.getProperty("test.java.opts") + " -Dtest.src=" + System.getProperty("test.src") + " -Dtest.jdk=" + System.getProperty("test.jdk") + - " -Djavax.net.debug=ssl,handshake" + + " -Djavax.net.debug=ssl" + " -Djava.security.properties=" + f.getName()); System.out.println("test.java.opts: " + diff --git a/test/jdk/sun/security/ssl/SSLLogger/DebugPropertyValuesTest.java b/test/jdk/sun/security/ssl/SSLLogger/DebugPropertyValuesTest.java index f32d0e381a6..77f585d6d55 100644 --- a/test/jdk/sun/security/ssl/SSLLogger/DebugPropertyValuesTest.java +++ b/test/jdk/sun/security/ssl/SSLLogger/DebugPropertyValuesTest.java @@ -23,7 +23,7 @@ /** * @test - * @bug 8350582 8340312 8369995 8372004 + * @bug 8350582 8340312 8369995 8044609 8372004 * @library /test/lib /javax/net/ssl/templates * @summary Correct the parsing of the ssl value in javax.net.debug * @run junit DebugPropertyValuesTest @@ -58,30 +58,29 @@ public class DebugPropertyValuesTest extends SSLSocketTemplate { debugMessages.put("handshake", List.of("Produced ClientHello handshake message", "supported_versions")); + debugMessages.put("handshake-expand", + List.of("\"logger\".*: \"javax.net.ssl\",", + "\"specifics\" : \\[", + "\"message\".*: \"Produced ClientHello handshake message")); debugMessages.put("keymanager", List.of("Choosing key:")); debugMessages.put("packet", List.of("Raw write")); debugMessages.put("plaintext", List.of("Plaintext before ENCRYPTION")); debugMessages.put("record", List.of("handshake, length =", "WRITE:")); + debugMessages.put("record-expand", + List.of("\"logger\".*: \"javax.net.ssl\",", + "\"message\".*: \"READ: TLSv1.2 application_data")); debugMessages.put("session", List.of("Session initialized:")); + debugMessages.put("ssl", List.of("jdk.tls.keyLimits:")); debugMessages.put("sslctx", List.of("trigger seeding of SecureRandom")); - debugMessages.put("ssl", List.of("jdk.tls.keyLimits:")); debugMessages.put("trustmanager", List.of("adding as trusted certificates")); debugMessages.put("verbose", List.of("Ignore unsupported cipher suite:")); - debugMessages.put("handshake-expand", - List.of("\"logger\".*: \"javax.net.ssl\",", - "\"specifics\" : \\[", - "\"message\".*: \"Produced ClientHello handshake message")); - debugMessages.put("record-expand", - List.of("\"logger\".*: \"javax.net.ssl\",", - "\"specifics\" : \\[", - "\"message\".*: \"READ: TLSv1.2 application_data")); debugMessages.put("help", - List.of("print the help messages", - "debugging can be widened with:")); + List.of("print this help message and exit", + "verbose handshake message printing")); debugMessages.put("java.security.debug", List.of("properties\\[.*\\|main\\|.*" + DATE_REGEX + ".*\\]:", "certpath\\[.*\\|main\\|.*" + DATE_REGEX + ".*\\]:")); @@ -121,28 +120,24 @@ public class DebugPropertyValuesTest extends SSLSocketTemplate { Arguments.of( List.of("-Djavax.net.debug=ssl,handshake,expand"), List.of("handshake", "handshake-expand", - "keymanager", "record", "session", - "record-expand", "ssl", "sslctx", - "trustmanager", "verbose")), + "ssl", "verbose")), // filtering on record option, with expand Arguments.of(List.of("-Djavax.net.debug=ssl:record,expand"), - List.of("handshake", "handshake-expand", - "keymanager", "record", "record-expand", - "session", "ssl", "sslctx", "trustmanager", - "verbose")), + List.of("record", "record-expand", "ssl")), + // reverse the input params of last example. should be same result + Arguments.of(List.of("-Djavax.net.debug=expand,record:ssl"), + List.of("record", "record-expand", "ssl")), // this test is equivalent to ssl:record mode Arguments.of(List.of("-Djavax.net.debug=ssl,record"), - List.of("handshake", "keymanager", "record", - "session", "ssl", "sslctx", - "trustmanager", "verbose")), + List.of("record", "ssl")), // example of test where no "ssl" value is passed // handshake debugging with verbose mode - // only verbose gets printed. Needs fixing (JDK-8044609) + // No debug logs should be printed Arguments.of(List.of("-Djavax.net.debug=handshake:verbose"), - List.of("verbose")), + List.of()), // another example of test where no "ssl" value is passed Arguments.of(List.of("-Djavax.net.debug=record"), - List.of("record")), + List.of()), // ignore bad sub-option. treat like "ssl" Arguments.of(List.of("-Djavax.net.debug=ssl,typo"), List.of("handshake", "keymanager", @@ -154,28 +149,19 @@ public class DebugPropertyValuesTest extends SSLSocketTemplate { "record", "session", "ssl", "sslctx", "trustmanager", "verbose")), // plaintext is valid for record option - Arguments.of( - List.of("-Djavax.net.debug=ssl:record:plaintext"), - List.of("handshake", "keymanager", "plaintext", - "record", "session", "ssl", - "sslctx", "trustmanager", "verbose")), + Arguments.of(List.of("-Djavax.net.debug=ssl:record:plaintext"), + List.of("plaintext", "record", "ssl")), Arguments.of(List.of("-Djavax.net.debug=ssl:trustmanager"), - List.of("handshake", "keymanager", "record", - "session", "ssl", "sslctx", "trustmanager", - "verbose")), + List.of("ssl", "trustmanager")), Arguments.of(List.of("-Djavax.net.debug=ssl:sslctx"), - List.of("handshake", "keymanager", "record", - "session", "ssl", "sslctx", "trustmanager", - "verbose")), + List.of("ssl", "sslctx")), // help message test. Should exit without running test Arguments.of(List.of("-Djavax.net.debug=help"), List.of("help")), // add in javax.net.debug sanity test Arguments.of(List.of("-Djavax.net.debug=ssl:trustmanager", "-Djava.security.debug=all"), - List.of("handshake", "java.security.debug", - "keymanager", "record", "session", "ssl", - "sslctx", "trustmanager", "verbose")), + List.of("java.security.debug", "ssl", "trustmanager")), // empty invokes System.Logger use Arguments.of(List.of("-Djavax.net.debug", "-Djava.util.logging.config.file=" + LOG_FILE), @@ -196,11 +182,23 @@ public class DebugPropertyValuesTest extends SSLSocketTemplate { OutputAnalyzer outputAnalyzer = ProcessTools.executeTestJava(args); outputAnalyzer.shouldHaveExitValue(0); for (String s : debugMessages.keySet()) { - for (String output : debugMessages.get(s)) { - if (expected.contains(s)) { + List patterns = debugMessages.get(s); + if (expected.contains(s)) { + for (String output : patterns) { outputAnalyzer.shouldMatch(output); - } else { - outputAnalyzer.shouldNotMatch(output); + } + } else { + // some debug messages overlap with each other. Only fail if + // all the messages in the list were unexpected + boolean allUnexpected = true; + for (String output : patterns) { + if (!outputAnalyzer.contains(output)) { + allUnexpected = false; + break; + } + } + if (allUnexpected) { + throw new AssertionError("Unexpected output for key: " + s); } } } diff --git a/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTNoSessionCreation.java b/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTNoSessionCreation.java index a851a5d72bb..646db0b68e6 100644 --- a/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTNoSessionCreation.java +++ b/test/jdk/sun/security/ssl/SSLSessionImpl/MultiNSTNoSessionCreation.java @@ -54,7 +54,7 @@ public class MultiNSTNoSessionCreation { " -Dtest.src=" + System.getProperty("test.src") + " -Dtest.jdk=" + System.getProperty("test.jdk") + " -Dtest.root=" + System.getProperty("test.root") + - " -Djavax.net.debug=ssl,handshake " + params); + " -Djavax.net.debug=ssl " + params); System.out.println("test.java.opts: " + System.getProperty("test.java.opts")); diff --git a/test/jdk/sun/security/ssl/SSLSessionImpl/ResumptionUpdateBoundValues.java b/test/jdk/sun/security/ssl/SSLSessionImpl/ResumptionUpdateBoundValues.java index 2784875d426..d9ac85c4897 100644 --- a/test/jdk/sun/security/ssl/SSLSessionImpl/ResumptionUpdateBoundValues.java +++ b/test/jdk/sun/security/ssl/SSLSessionImpl/ResumptionUpdateBoundValues.java @@ -181,7 +181,7 @@ public class ResumptionUpdateBoundValues extends SSLContextTemplate { System.setProperty("test.java.opts", System.getProperty("test.java.opts") + " -Dtest.src=" + System.getProperty("test.src") + " -Dtest.jdk=" + System.getProperty("test.jdk") + - " -Djavax.net.debug=ssl,handshake"); + " -Djavax.net.debug=ssl"); System.out.println("test.java.opts: " + System.getProperty("test.java.opts")); diff --git a/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketKeyLimit.java b/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketKeyLimit.java index 7ce4d97a7a2..6c45505d9f6 100644 --- a/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketKeyLimit.java +++ b/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketKeyLimit.java @@ -127,7 +127,7 @@ public class SSLSocketKeyLimit { System.setProperty("test.java.opts", System.getProperty("test.java.opts") + " -Dtest.src=" + System.getProperty("test.src") + " -Dtest.jdk=" + System.getProperty("test.jdk") + - " -Djavax.net.debug=ssl,handshake" + + " -Djavax.net.debug=ssl" + " -Djava.security.properties=" + f.getName()); System.out.println("test.java.opts: " + From c032082645835e145d22af1adb62318c7e5e5924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Galder=20Zamarre=C3=B1o?= Date: Thu, 12 Feb 2026 11:22:48 +0000 Subject: [PATCH 083/120] 8374896: Min/Max identity optimization opportunities missing for int and long Reviewed-by: chagedorn, bmaillard --- src/hotspot/share/opto/phaseX.cpp | 2 +- .../compiler/igvn/TestMinMaxIdentity.java | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/hotspot/share/opto/phaseX.cpp b/src/hotspot/share/opto/phaseX.cpp index d2b2904b545..be92d4116b0 100644 --- a/src/hotspot/share/opto/phaseX.cpp +++ b/src/hotspot/share/opto/phaseX.cpp @@ -2680,7 +2680,7 @@ void PhaseIterGVN::add_users_of_use_to_worklist(Node* n, Node* use, Unique_Node_ if (use->is_MinMax()) { for (DUIterator_Fast i2max, i2 = use->fast_outs(i2max); i2 < i2max; i2++) { Node* u = use->fast_out(i2); - if (u->Opcode() == use->Opcode()) { + if (u->is_MinMax()) { worklist.push(u); } } diff --git a/test/hotspot/jtreg/compiler/igvn/TestMinMaxIdentity.java b/test/hotspot/jtreg/compiler/igvn/TestMinMaxIdentity.java index 5b998caf65c..b4c62fb49a9 100644 --- a/test/hotspot/jtreg/compiler/igvn/TestMinMaxIdentity.java +++ b/test/hotspot/jtreg/compiler/igvn/TestMinMaxIdentity.java @@ -73,6 +73,10 @@ public class TestMinMaxIdentity { .flatMap(MinMaxOp::generate) .forEach(testTemplateTokens::add); + // Note that for floating point Min/Max these cases below don't hold + generate(MinMaxOp.MIN_I, MinMaxOp.MAX_I).forEach(testTemplateTokens::add); + generate(MinMaxOp.MIN_L, MinMaxOp.MAX_L).forEach(testTemplateTokens::add); + Stream.of(Fp16MinMaxOp.values()) .flatMap(Fp16MinMaxOp::generate) .forEach(testTemplateTokens::add); @@ -89,6 +93,38 @@ public class TestMinMaxIdentity { testTemplateTokens); } + static Stream generate(MinMaxOp op1, MinMaxOp op2) { + return Stream.of(template("a", "b", op1, op2), template("b", "a", op1, op2), + template("a", "b", op2, op1), template("b", "a", op2, op1)). + map(Template.ZeroArgs::asToken); + } + + static Template.ZeroArgs template(String arg1, String arg2, MinMaxOp op1, MinMaxOp op2) { + return Template.make(() -> scope( + let("boxedTypeName", op1.type.boxedTypeName()), + let("op1", op1.name()), + let("op2", op2.name()), + let("type", op1.type.name()), + let("fn1", op1.functionName), + let("fn2", op2.functionName), + let("arg1", arg1), + let("arg2", arg2), + """ + @Test + @IR(counts = {IRNode.#op1, "= 0", IRNode.#op2, "= 0"}, + phase = CompilePhase.BEFORE_MACRO_EXPANSION) + @Arguments(values = {Argument.NUMBER_42, Argument.NUMBER_42}) + public #type $test(#type #arg1, #type #arg2) { + int i; + for (i = -10; i < 1; i++) { + } + #type c = a * i; + return #boxedTypeName.#fn1(a, #boxedTypeName.#fn2(b, c)); + } + """ + )); + } + enum MinMaxOp { MIN_D("min", CodeGenerationDataNameType.doubles()), MAX_D("max", CodeGenerationDataNameType.doubles()), From 09db4bce5c66cbfc7a7e04f87873a078ef694cc5 Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Thu, 12 Feb 2026 12:58:47 +0000 Subject: [PATCH 084/120] 8377666: Fedora 41 based devkit build should load more packages from archive location Reviewed-by: clanger, erikj --- make/devkit/Tools.gmk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make/devkit/Tools.gmk b/make/devkit/Tools.gmk index db77f2f3f74..74c6d861777 100644 --- a/make/devkit/Tools.gmk +++ b/make/devkit/Tools.gmk @@ -78,7 +78,7 @@ else ifeq ($(BASE_OS), Fedora) endif BASE_URL := http://fedora.riscv.rocks/repos-dist/f$(BASE_OS_VERSION)/latest/$(ARCH)/Packages/ else - LATEST_ARCHIVED_OS_VERSION := 36 + LATEST_ARCHIVED_OS_VERSION := 41 ifeq ($(filter aarch64 armhfp x86_64, $(ARCH)), ) FEDORA_TYPE := fedora-secondary else From 37dc1be67d4c15a040dc99dbc105c3269c65063d Mon Sep 17 00:00:00 2001 From: David Briemann Date: Thu, 12 Feb 2026 13:29:33 +0000 Subject: [PATCH 085/120] 8188131: [PPC] Increase inlining thresholds to the same as other platforms Reviewed-by: mdoerr, mbaesken --- src/hotspot/cpu/ppc/c2_globals_ppc.hpp | 6 +++--- src/hotspot/share/compiler/compilerDefinitions.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/hotspot/cpu/ppc/c2_globals_ppc.hpp b/src/hotspot/cpu/ppc/c2_globals_ppc.hpp index d5a0ff10994..caef322d4a1 100644 --- a/src/hotspot/cpu/ppc/c2_globals_ppc.hpp +++ b/src/hotspot/cpu/ppc/c2_globals_ppc.hpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2019 SAP SE. All rights reserved. + * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2026 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,7 @@ define_pd_global(intx, CompileThreshold, 10000); define_pd_global(intx, OnStackReplacePercentage, 140); define_pd_global(intx, ConditionalMoveLimit, 3); -define_pd_global(intx, FreqInlineSize, 175); +define_pd_global(intx, FreqInlineSize, 325); define_pd_global(intx, MinJumpTableSize, 10); define_pd_global(intx, InteriorEntryAlignment, 16); define_pd_global(size_t, NewSizeThreadIncrease, ScaleForWordSize(4*K)); diff --git a/src/hotspot/share/compiler/compilerDefinitions.cpp b/src/hotspot/share/compiler/compilerDefinitions.cpp index aed1edc0db5..75d84bedcc6 100644 --- a/src/hotspot/share/compiler/compilerDefinitions.cpp +++ b/src/hotspot/share/compiler/compilerDefinitions.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -406,7 +406,7 @@ void CompilerConfig::set_compilation_policy_flags() { if (CompilerConfig::is_tiered() && CompilerConfig::is_c2_enabled()) { #ifdef COMPILER2 // Some inlining tuning -#if defined(X86) || defined(AARCH64) || defined(RISCV64) +#if defined(X86) || defined(AARCH64) || defined(RISCV64) || defined(PPC64) if (FLAG_IS_DEFAULT(InlineSmallCode)) { FLAG_SET_DEFAULT(InlineSmallCode, 2500); } From c73f05bec95c3ef0d8b6235b67478352db9a48a9 Mon Sep 17 00:00:00 2001 From: Alexander Zuev Date: Thu, 12 Feb 2026 16:32:14 +0000 Subject: [PATCH 086/120] 8376233: Clean up code in Desktop native peer Reviewed-by: aivanov, prr --- .../macosx/native/libawt_lwawt/awt/CDesktopPeer.m | 5 ++++- .../windows/native/libawt/windows/awt_Desktop.cpp | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/CDesktopPeer.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/CDesktopPeer.m index e1841c9398c..460749c363d 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/CDesktopPeer.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/CDesktopPeer.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -120,6 +120,7 @@ JNI_COCOA_ENTER(env); if (appURI == nil || [[urlToOpen absoluteString] containsString:[appURI absoluteString]] || [[defaultTerminalApp absoluteString] containsString:[appURI absoluteString]]) { + [urlToOpen release]; return -1; } // Additionally set forPrinting=TRUE for print @@ -129,6 +130,7 @@ JNI_COCOA_ENTER(env); } else if (action == sun_lwawt_macosx_CDesktopPeer_EDIT) { if (appURI == nil || [[urlToOpen absoluteString] containsString:[appURI absoluteString]]) { + [urlToOpen release]; return -1; } // for EDIT: if (defaultApp = TerminalApp) then set appURI = DefaultTextEditor @@ -156,6 +158,7 @@ JNI_COCOA_ENTER(env); dispatch_semaphore_wait(semaphore, timeout); + [urlToOpen release]; JNI_COCOA_EXIT(env); return status; } diff --git a/src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp b/src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp index ebb43b2f078..ba69fa75f73 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp +++ b/src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -92,6 +92,8 @@ JNIEXPORT jstring JNICALL Java_sun_awt_windows_WDesktopPeer_ShellExecute if (wcscmp(verb_c, L"open") == 0) { BOOL isExecutable = SaferiIsExecutableFileType(fileOrUri_c, FALSE); if (isExecutable) { + JNU_ReleaseStringPlatformChars(env, fileOrUri_j, fileOrUri_c); + JNU_ReleaseStringPlatformChars(env, verb_j, verb_c); return env->NewStringUTF("Unsupported URI content"); } } From c7ef631b0c99c725120d7dde4b11fd34baf0455d Mon Sep 17 00:00:00 2001 From: Alexey Semenyuk Date: Thu, 12 Feb 2026 21:13:34 +0000 Subject: [PATCH 087/120] 8377629: jpackage: Tighten up output validation in tests Reviewed-by: almatvee --- .../jdk/jpackage/internal/AppImageSigner.java | 4 +- .../jpackage/internal/cli/StandardOption.java | 5 +- .../jdk/jpackage/internal/cli/Validator.java | 24 +- .../test/FailedCommandErrorValidator.java | 26 +- .../jdk/jpackage/test/JPackageCommand.java | 66 +-- .../test/JPackageOutputValidator.java | 379 ++++++++++++++++++ .../helpers/jdk/jpackage/test/MacSign.java | 4 +- .../jdk/jpackage/test/MacSignVerify.java | 14 +- .../helpers/jdk/jpackage/test/TKit.java | 68 +--- .../cli/OptionsValidationFailTest.excludes | 7 +- .../cli/OptionsValidationFailTest.java | 2 +- .../jpackage/internal/cli/ValidatorTest.java | 43 +- .../jpackage/linux/LinuxResourceTest.java | 96 +++-- .../tools/jpackage/macosx/MacSignTest.java | 59 ++- .../tools/jpackage/macosx/PkgScriptsTest.java | 11 +- .../macosx/SigningPackageTwoStepTest.java | 4 +- .../tools/jpackage/share/AppContentTest.java | 2 +- .../jpackage/share/AppImagePackageTest.java | 6 +- test/jdk/tools/jpackage/share/BasicTest.java | 18 +- test/jdk/tools/jpackage/share/ErrorTest.java | 248 +++++++++--- .../jpackage/share/FileAssociationsTest.java | 17 +- .../tools/jpackage/share/InstallDirTest.java | 5 +- .../tools/jpackage/share/MainClassTest.java | 4 +- .../tools/jpackage/share/ModulePathTest.java | 8 +- .../tools/jpackage/share/OutputErrorTest.java | 5 +- .../jpackage/windows/WinOSConditionTest.java | 16 +- .../jpackage/windows/WinResourceTest.java | 42 +- 27 files changed, 850 insertions(+), 333 deletions(-) create mode 100644 test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageOutputValidator.java diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/AppImageSigner.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/AppImageSigner.java index c908ec7447c..188430511bb 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/AppImageSigner.java +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/AppImageSigner.java @@ -167,14 +167,14 @@ final class AppImageSigner { private static IOException handleCodesignException(MacApplication app, CodesignException ex) { if (!app.contentDirSources().isEmpty()) { // Additional content may cause signing error. - Log.info(I18N.getString("message.codesign.failed.reason.app.content")); + Log.fatalError(I18N.getString("message.codesign.failed.reason.app.content")); } // Signing might not work without Xcode with command line // developer tools. Show user if Xcode is missing as possible // reason. if (!isXcodeDevToolsInstalled()) { - Log.info(I18N.getString("message.codesign.failed.reason.xcode.tools")); + Log.fatalError(I18N.getString("message.codesign.failed.reason.xcode.tools")); } return ex.getCause(); diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardOption.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardOption.java index fedb55116a3..4450a6168e2 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardOption.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardOption.java @@ -248,7 +248,10 @@ public final class StandardOption { .validatorExceptionFormatString("error.parameter-not-mac-bundle") .validator(StandardValidator.IS_VALID_MAC_BUNDLE) .createValidator().orElseThrow(); - b.validator(Validator.and(directoryValidator, macBundleValidator)); + // Use "lazy and" validator composition. + // If the value of the option is not a directory, we want only one error reported, not two: + // one that the value is not a directory and another that it is not a valid macOS bundle. + b.validator(Validator.andLazy(directoryValidator, macBundleValidator)); } })) .create(); diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/Validator.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/Validator.java index 0701071b00f..04d8d7cc09b 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/Validator.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/Validator.java @@ -44,7 +44,7 @@ interface Validator { */ List validate(OptionName optionName, ParsedValue optionValue) throws ValidatorException; - default Validator and(Validator after) { + default Validator andGreedy(Validator after) { Objects.requireNonNull(after); var before = this; return (optionName, optionValue) -> { @@ -55,6 +55,19 @@ interface Validator { }; } + default Validator andLazy(Validator after) { + Objects.requireNonNull(after); + var before = this; + return (optionName, optionValue) -> { + var bErrors = before.validate(optionName, optionValue); + if (!bErrors.isEmpty()) { + return bErrors.stream().map(Exception.class::cast).toList(); + } else { + return after.validate(optionName, optionValue).stream().map(Exception.class::cast).toList(); + } + }; + } + default Validator or(Validator after) { Objects.requireNonNull(after); var before = this; @@ -74,8 +87,13 @@ interface Validator { } @SuppressWarnings("unchecked") - static Validator and(Validator first, Validator second) { - return (Validator)first.and(second); + static Validator andGreedy(Validator first, Validator second) { + return (Validator)first.andGreedy(second); + } + + @SuppressWarnings("unchecked") + static Validator andLazy(Validator first, Validator second) { + return (Validator)first.andLazy(second); } @SuppressWarnings("unchecked") diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/FailedCommandErrorValidator.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/FailedCommandErrorValidator.java index ab644c36a5c..f082e079dd6 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/FailedCommandErrorValidator.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/FailedCommandErrorValidator.java @@ -38,7 +38,7 @@ public final class FailedCommandErrorValidator { this.cmdlinePattern = Objects.requireNonNull(cmdlinePattern); } - public TKit.TextStreamVerifier.Group createGroup() { + public JPackageOutputValidator create() { var asPredicate = cmdlinePattern.asPredicate(); var errorMessage = exitCode().map(v -> { @@ -49,9 +49,9 @@ public final class FailedCommandErrorValidator { var errorMessageWithPrefix = JPackageCommand.makeError(errorMessage).getValue(); - var group = TKit.TextStreamVerifier.group(); + var validator = new JPackageOutputValidator().stderr(); - group.add(TKit.assertTextStream(cmdlinePattern.pattern()).predicate(line -> { + validator.add(TKit.assertTextStream(cmdlinePattern.pattern()).predicate(line -> { if (line.startsWith(errorMessageWithPrefix)) { line = line.substring(errorMessageWithPrefix.length()); return asPredicate.test(line); @@ -60,28 +60,24 @@ public final class FailedCommandErrorValidator { } })); - group.add(TKit.assertTextStream( - JPackageStringBundle.MAIN.cannedFormattedString("message.failed-command-output-header").getValue() - ).predicate(String::equals)); + validator.expectMatchingStrings(JPackageStringBundle.MAIN.cannedFormattedString("message.failed-command-output-header")); - outputVerifier().ifPresent(group::add); + outputValidator().ifPresent(validator::add); - return group; + return validator; } public void applyTo(JPackageCommand cmd) { - cmd.validateOutput(createGroup().create()); + create().applyTo(cmd); } - public FailedCommandErrorValidator validator(TKit.TextStreamVerifier.Group v) { + public FailedCommandErrorValidator validator(JPackageOutputValidator v) { outputValidator = v; return this; } public FailedCommandErrorValidator validator(List validators) { - var group = TKit.TextStreamVerifier.group(); - validators.forEach(group::add); - return validator(group); + return validator(new JPackageOutputValidator().add(validators)); } public FailedCommandErrorValidator validators(TKit.TextStreamVerifier... validators) { @@ -105,11 +101,11 @@ public final class FailedCommandErrorValidator { return Optional.ofNullable(exitCode); } - private Optional outputVerifier() { + private Optional outputValidator() { return Optional.ofNullable(outputValidator); } private final Pattern cmdlinePattern; - private TKit.TextStreamVerifier.Group outputValidator; + private JPackageOutputValidator outputValidator; private Integer exitCode; } diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageCommand.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageCommand.java index 8c7526be9f9..da6af4bed33 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageCommand.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageCommand.java @@ -98,7 +98,7 @@ public class JPackageCommand extends CommandArguments { verifyActions = new Actions(cmd.verifyActions); standardAsserts = cmd.standardAsserts; readOnlyPathAsserts = cmd.readOnlyPathAsserts; - outputValidators = cmd.outputValidators; + validators = cmd.validators; executeInDirectory = cmd.executeInDirectory; winMsiLogFile = cmd.winMsiLogFile; unpackedPackageDirectory = cmd.unpackedPackageDirectory; @@ -895,19 +895,20 @@ public class JPackageCommand extends CommandArguments { return removeOldOutputBundle; } - public JPackageCommand validateOutput(TKit.TextStreamVerifier validator) { - return validateOutput(validator::apply); - } - - public JPackageCommand validateOutput(Consumer> validator) { - Objects.requireNonNull(validator); - saveConsoleOutput(true); - outputValidators.add(validator); + public JPackageCommand validateOut(TKit.TextStreamVerifier validator) { + new JPackageOutputValidator().add(validator).applyTo(this); return this; } - public JPackageCommand validateOutput(TKit.TextStreamVerifier.Group group) { - group.tryCreate().ifPresent(this::validateOutput); + public JPackageCommand validateErr(TKit.TextStreamVerifier validator) { + new JPackageOutputValidator().stderr().add(validator).applyTo(this); + return this; + } + + public JPackageCommand validateResult(Consumer validator) { + Objects.requireNonNull(validator); + saveConsoleOutput(true); + validators.add(validator); return this; } @@ -916,7 +917,7 @@ public class JPackageCommand extends CommandArguments { public String value(JPackageCommand cmd); } - public static Object cannedArgument(Function supplier, String label) { + public static CannedArgument cannedArgument(Function supplier, String label) { Objects.requireNonNull(supplier); Objects.requireNonNull(label); return new CannedArgument() { @@ -936,10 +937,18 @@ public class JPackageCommand extends CommandArguments { return v.addPrefix("message.error-header"); } + public static CannedFormattedString makeError(String key, Object ... args) { + return makeError(JPackageStringBundle.MAIN.cannedFormattedString(key, args)); + } + public static CannedFormattedString makeAdvice(CannedFormattedString v) { return v.addPrefix("message.advice-header"); } + public static CannedFormattedString makeAdvice(String key, Object ... args) { + return makeAdvice(JPackageStringBundle.MAIN.cannedFormattedString(key, args)); + } + public String getValue(CannedFormattedString str) { return new CannedFormattedString(str.formatter(), str.key(), Stream.of(str.args()).map(arg -> { if (arg instanceof CannedArgument cannedArg) { @@ -950,13 +959,13 @@ public class JPackageCommand extends CommandArguments { }).toArray()).getValue(); } - public JPackageCommand validateOutput(CannedFormattedString... str) { - // Will look up the given errors in the order they are specified. - validateOutput(Stream.of(str).map(this::getValue) - .map(TKit::assertTextStream) - .reduce(TKit.TextStreamVerifier.group(), - TKit.TextStreamVerifier.Group::add, - TKit.TextStreamVerifier.Group::add)); + public JPackageCommand validateOut(CannedFormattedString... strings) { + new JPackageOutputValidator().expectMatchingStrings(strings).applyTo(this); + return this; + } + + public JPackageCommand validateErr(CannedFormattedString... strings) { + new JPackageOutputValidator().stderr().expectMatchingStrings(strings).applyTo(this); return this; } @@ -1055,8 +1064,8 @@ public class JPackageCommand extends CommandArguments { ConfigFilesStasher.INSTANCE.accept(this); } - for (final var outputValidator: outputValidators) { - outputValidator.accept(result.getOutput().iterator()); + for (final var validator: validators) { + validator.accept(result); } if (result.getExitCode() == 0 && expectedExitCode.isPresent()) { @@ -1179,14 +1188,13 @@ public class JPackageCommand extends CommandArguments { Function> create() { return cmd -> { - if (enable != null && !enable.test(cmd)) { + if (!cmd.hasArgument(argName) || (enable != null && !enable.test(cmd))) { return List.of(); } else { final List> dirs; if (multiple) { dirs = Stream.of(cmd.getAllArgumentValues(argName)) - .map(Builder::tokenizeValue) - .flatMap(x -> x) + .flatMap(Builder::tokenizeValue) .map(Builder::toExistingFile).toList(); } else { dirs = Optional.ofNullable(cmd.getArgumentValue(argName)) @@ -1197,11 +1205,11 @@ public class JPackageCommand extends CommandArguments { .map(cmd::getArgumentValue) .filter(Objects::nonNull) .map(Builder::toExistingFile) - .filter(Optional::isPresent).map(Optional::orElseThrow) + .flatMap(Optional::stream) .collect(toSet()); return dirs.stream() - .filter(Optional::isPresent).map(Optional::orElseThrow) + .flatMap(Optional::stream) .filter(Predicate.not(mutablePaths::contains)) .toList(); } @@ -1656,10 +1664,6 @@ public class JPackageCommand extends CommandArguments { }).collect(Collectors.joining(" ")); } - public static Stream stripTimestamps(Stream stream) { - return stream.map(JPackageCommand::stripTimestamp); - } - public static String stripTimestamp(String str) { final var m = TIMESTAMP_REGEXP.matcher(str); if (m.find()) { @@ -1836,7 +1840,7 @@ public class JPackageCommand extends CommandArguments { private Path unpackedPackageDirectory; private Set readOnlyPathAsserts = Set.of(ReadOnlyPathAssert.values()); private Set standardAsserts = Set.of(StandardAssert.values()); - private List>> outputValidators = new ArrayList<>(); + private List> validators = new ArrayList<>(); private enum DefaultToolProviderKey { VALUE diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageOutputValidator.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageOutputValidator.java new file mode 100644 index 00000000000..c5c9c018b6a --- /dev/null +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageOutputValidator.java @@ -0,0 +1,379 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * 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.jpackage.test; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Optional; +import java.util.function.Consumer; +import java.util.function.Predicate; +import java.util.stream.Stream; +import jdk.jpackage.internal.util.function.ExceptionBox; + +/** + * Validates a stream (stderr or stdout) in jpackage console output. + */ +public final class JPackageOutputValidator { + + public JPackageOutputValidator() { + } + + public JPackageOutputValidator(JPackageOutputValidator other) { + stdout = other.stdout; + match = other.match; + matchTimestamps = other.matchTimestamps; + stripTimestamps = other.stripTimestamps; + validators.addAll(other.validators); + } + + JPackageOutputValidator copy() { + return new JPackageOutputValidator(this); + } + + /** + * Configures this validator to validate stdout. + * @return this + */ + public JPackageOutputValidator stdout() { + stdout = true; + return this; + } + + /** + * Configures this validator to validate stderr. + * @return this + */ + public JPackageOutputValidator stderr() { + stdout = false; + return this; + } + + /** + * Configures the mode of this validator. Similar to how a regexp pattern can be + * configured for matching or finding. + * + * @param v {@code true} if the entire stream should match the criteria of this + * validator, and {@code false} if the stream may contain additional + * content + * @return this + */ + public JPackageOutputValidator match(boolean v) { + match = v; + return this; + } + + /** + * A shorthand for {@code match(true)}. + * @see #match(boolean) + * @return this + */ + public JPackageOutputValidator match() { + return match(true); + } + + /** + * A shorthand for {@code match(false)}. + * @see #match(boolean) + * @return this + */ + public JPackageOutputValidator find() { + return match(false); + } + + /** + * Configures this validator to filter out lines without a timestamp in the + * stream to be validated. + * + * @return this + */ + public JPackageOutputValidator matchTimestamps() { + matchTimestamps = true; + return this; + } + + /** + * Configures this validator to strip the leading timestamp from lines the + * stream to be validated. + *

+ * If the stream contains lines without timestampts, the validation will fail. + *

+ * Use {@link #matchTimestamps()) to filter out lines without timestamps and + * prevent validation failure. + * + * @return this + */ + public JPackageOutputValidator stripTimestamps() { + stripTimestamps = true; + return this; + } + + public void applyTo(JPackageCommand cmd) { + toResultConsumer(cmd).ifPresent(cmd::validateResult); + } + + public void applyTo(JPackageCommand cmd, Executor.Result result) { + Objects.requireNonNull(result); + toResultConsumer(cmd).ifPresent(validator -> { + validator.accept(result); + }); + } + + public JPackageOutputValidator add(List validators) { + this.validators.addAll(validators); + return this; + } + + public JPackageOutputValidator add(TKit.TextStreamVerifier... validators) { + return add(List.of(validators)); + } + + public JPackageOutputValidator validateEndOfStream() { + validators.add(EndOfStreamValidator.INSTANCE); + return this; + } + + public JPackageOutputValidator expectMatchingStrings(List strings) { + return expectMatchingStrings(strings.toArray(CannedFormattedString[]::new)); + } + + public JPackageOutputValidator expectMatchingStrings(CannedFormattedString... strings) { + validators.add(strings); + return this; + } + + public JPackageOutputValidator add(JPackageOutputValidator other) { + validators.addAll(other.validators); + return this; + } + + public JPackageOutputValidator compose(JPackageOutputValidator other) { + if (stdout != other.stdout) { + throw new IllegalArgumentException(); + } + if (match != other.match) { + throw new IllegalArgumentException(); + } + if (matchTimestamps != other.matchTimestamps) { + throw new IllegalArgumentException(); + } + if (stripTimestamps != other.stripTimestamps) { + throw new IllegalArgumentException(); + } + return add(other); + } + + private Optional> toResultConsumer(JPackageCommand cmd) { + return toStringIteratorConsumer(cmd).map(validator -> { + return toResultConsumer(validator, stdout, match, label()); + }); + } + + private Optional>> toStringIteratorConsumer(JPackageCommand cmd) { + Objects.requireNonNull(cmd); + + var consumers = validators.stream().map(v -> { + return toStringIteratorConsumer(cmd, v); + }).flatMap(Optional::stream); + + if (match && (validators.isEmpty() || !(validators.getLast() instanceof EndOfStreamValidator))) { + consumers = Stream.concat(consumers, Stream.of(TKit.assertEndOfTextStream(label()))); + } + + return consumers.reduce(Consumer::andThen).map(validator -> { + + if (stripTimestamps) { + validator = stripTimestamps(validator, label()); + } + + if (matchTimestamps) { + validator = matchTimestamps(validator, label()); + } + + return validator; + }); + } + + @SuppressWarnings("unchecked") + private Optional>> toStringIteratorConsumer(JPackageCommand cmd, Object validator) { + Objects.requireNonNull(cmd); + switch (validator) { + case TKit.TextStreamVerifier tv -> { + return Optional.of(decorate(tv.copy().label(label()))); + } + case CannedFormattedString[] strings -> { + // Will look up the given strings in the order they are specified. + return Stream.of(strings) + .map(cmd::getValue) + .map(TKit::assertTextStream) + .map(v -> { + return v.predicate(String::equals).label(label()); + }) + .map(this::decorate).reduce(Consumer::andThen); + } + case EndOfStreamValidator eos -> { + return Optional.of(TKit.assertEndOfTextStream(label())); + } + default -> { + throw ExceptionBox.reachedUnreachable(); + } + } + } + + private String label() { + return stdout ? "'stdout'" : "'stderr'"; + } + + private Consumer> decorate(TKit.TextStreamVerifier validator) { + if (match) { + return new OneLineFeeder(validator::apply); + } else { + return validator::apply; + } + } + + private static Consumer toResultConsumer( + Consumer> validator, boolean stdout, boolean match, String label) { + Objects.requireNonNull(validator); + Objects.requireNonNull(label); + + return result -> { + List content; + if (stdout) { + content = result.stdout(); + } else { + content = result.stderr(); + } + + if (match) { + TKit.trace(String.format("Checking %s for exact match against defined validators...", label)); + } + + validator.accept(content.iterator()); + + }; + } + + private static Consumer> stripTimestamps(Consumer> consumer, String label) { + Objects.requireNonNull(consumer); + Objects.requireNonNull(label); + return it -> { + Objects.requireNonNull(it); + TKit.trace(String.format("Strip timestamps in %s...", label)); + consumer.accept(new Iterator() { + + @Override + public boolean hasNext() { + return it.hasNext(); + } + + @Override + public String next() { + var str = it.next(); + var strippedStr = JPackageCommand.stripTimestamp(str); + if (str.length() == strippedStr.length()) { + throw new IllegalArgumentException(String.format("String [%s] doesn't have a timestamp", str)); + } else { + return strippedStr; + } + } + + }); + TKit.trace("Done"); + }; + } + + private static Consumer> matchTimestamps(Consumer> consumer, String label) { + Objects.requireNonNull(consumer); + Objects.requireNonNull(label); + return it -> { + Objects.requireNonNull(it); + TKit.trace(String.format("Match lines with timestamps in %s...", label)); + consumer.accept(new FilteringIterator<>(it, JPackageCommand::withTimestamp)); + TKit.trace("Done"); + }; + } + + private enum EndOfStreamValidator { + INSTANCE + } + + private static final class FilteringIterator implements Iterator { + + public FilteringIterator(Iterator it, Predicate predicate) { + this.it = Objects.requireNonNull(it); + this.predicate = Objects.requireNonNull(predicate); + } + + @Override + public boolean hasNext() { + while (!nextReady && it.hasNext()) { + var v = it.next(); + if (predicate.test(v)) { + next = v; + nextReady = true; + } + } + return nextReady; + } + + @Override + public T next() { + if (!hasNext()) { + throw new NoSuchElementException(); + } + nextReady = false; + return next; + } + + @Override + public void remove() { + it.remove(); + } + + private final Iterator it; + private final Predicate predicate; + private T next; + private boolean nextReady; + } + + private record OneLineFeeder(Consumer> consumer) implements Consumer> { + OneLineFeeder { + Objects.requireNonNull(consumer); + } + + @Override + public void accept(Iterator it) { + consumer.accept(List.of(it.next()).iterator()); + } + } + + boolean stdout = true; + boolean match; + boolean matchTimestamps; + boolean stripTimestamps; + private final List validators = new ArrayList<>(); +} diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/MacSign.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/MacSign.java index 3bbbf436300..4dbb2bc1e18 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/MacSign.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/MacSign.java @@ -712,7 +712,7 @@ public final class MacSign { } public enum StandardCertificateNamePrefix { - CODE_SIGND("Developer ID Application: "), + CODE_SIGN("Developer ID Application: "), INSTALLER("Developer ID Installer: "); StandardCertificateNamePrefix(String value) { @@ -825,7 +825,7 @@ public final class MacSign { return Optional.ofNullable(subjectCommonName).orElseGet(() -> { switch (type) { case CODE_SIGN -> { - return StandardCertificateNamePrefix.CODE_SIGND.value() + validatedUserName(); + return StandardCertificateNamePrefix.CODE_SIGN.value() + validatedUserName(); } case INSTALLER -> { return StandardCertificateNamePrefix.INSTALLER.value() + validatedUserName(); diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/MacSignVerify.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/MacSignVerify.java index ddf899d603c..01c510070be 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/MacSignVerify.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/MacSignVerify.java @@ -28,10 +28,13 @@ import java.nio.file.Path; import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.HexFormat; +import java.util.Iterator; import java.util.List; import java.util.Objects; import java.util.Optional; +import java.util.function.Consumer; import java.util.regex.Pattern; +import java.util.stream.Stream; import jdk.jpackage.internal.util.PListReader; import jdk.jpackage.test.MacHelper.ResolvableCertificateRequest; import jdk.jpackage.test.MacSign.CertificateHash; @@ -211,10 +214,13 @@ public final class MacSignVerify { exec.addArguments("--verify", "--deep", "--strict", "--verbose=2", path.toString()); final var result = exec.saveOutput().executeWithoutExitCodeCheck(); if (result.getExitCode() == 0) { - TKit.TextStreamVerifier.group() - .add(TKit.assertTextStream(": valid on disk").predicate(String::endsWith)) - .add(TKit.assertTextStream(": satisfies its Designated Requirement").predicate(String::endsWith)) - .create().accept(result.getOutput().iterator()); + Stream.of( + ": valid on disk", + ": satisfies its Designated Requirement" + ).map(TKit::assertTextStream).map(v -> { + Consumer> consumer = v.predicate(String::endsWith)::apply; + return consumer; + }).reduce(Consumer::andThen).orElseThrow().accept(result.getOutput().iterator()); } else if (!sudo && result.getOutput().stream().findFirst().filter(str -> { // By some reason /usr/bin/codesign command fails for some installed bundles. // It is known to fail for some AppContentTest test cases and all FileAssociationsTest test cases. diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java index 7666d1e5167..88d11d75f45 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java @@ -1093,7 +1093,6 @@ public final class TKit { label = other.label; negate = other.negate; createException = other.createException; - anotherVerifier = other.anotherVerifier; value = other.value; } @@ -1178,74 +1177,12 @@ public final class TKit { } } } - - if (anotherVerifier != null) { - anotherVerifier.accept(lineIt); - } - } - - public static TextStreamVerifier.Group group() { - return new TextStreamVerifier.Group(); - } - - public static final class Group { - public Group add(TextStreamVerifier verifier) { - if (verifier.anotherVerifier != null) { - throw new IllegalArgumentException(); - } - verifiers.add(verifier); - return this; - } - - public Group add(Group other) { - verifiers.addAll(other.verifiers); - return this; - } - - public Group mutate(Consumer mutator) { - mutator.accept(this); - return this; - } - - public boolean isEmpty() { - return verifiers.isEmpty(); - } - - public Optional>> tryCreate() { - if (isEmpty()) { - return Optional.empty(); - } else { - return Optional.of(create()); - } - } - - public Consumer> create() { - if (verifiers.isEmpty()) { - throw new IllegalStateException(); - } - - if (verifiers.size() == 1) { - return verifiers.getFirst()::apply; - } - - final var head = new TextStreamVerifier(verifiers.getFirst()); - var prev = head; - for (var verifier : verifiers.subList(1, verifiers.size())) { - verifier = new TextStreamVerifier(verifier); - prev.anotherVerifier = verifier::apply; - prev = verifier; - } - return head::apply; - } - - private final List verifiers = new ArrayList<>(); } private BiPredicate predicate; private String label; private boolean negate; private Supplier createException; - private Consumer> anotherVerifier; private final String value; } @@ -1257,11 +1194,12 @@ public final class TKit { return new TextStreamVerifier(what); } - public static Consumer> assertEndOfTextStream() { + public static Consumer> assertEndOfTextStream(String label) { + Objects.requireNonNull(label); return it -> { var tail = new ArrayList(); it.forEachRemaining(tail::add); - assertStringListEquals(List.of(), tail, "Check the end of the output"); + assertStringListEquals(List.of(), tail, String.format("Check the end of %s", label)); }; } diff --git a/test/jdk/tools/jpackage/junit/share/jdk.jpackage/jdk/jpackage/internal/cli/OptionsValidationFailTest.excludes b/test/jdk/tools/jpackage/junit/share/jdk.jpackage/jdk/jpackage/internal/cli/OptionsValidationFailTest.excludes index 07757211927..40f73e624b6 100644 --- a/test/jdk/tools/jpackage/junit/share/jdk.jpackage/jdk/jpackage/internal/cli/OptionsValidationFailTest.excludes +++ b/test/jdk/tools/jpackage/junit/share/jdk.jpackage/jdk/jpackage/internal/cli/OptionsValidationFailTest.excludes @@ -1,12 +1,15 @@ ErrorTest.test(IMAGE; app-desc=Hello; args-add=[--app-version, 0.2]; errors=[message.error-header+[message.version-string-first-number-not-zero], message.advice-header+[error.invalid-cfbundle-version.advice]]) ErrorTest.test(IMAGE; app-desc=Hello; args-add=[--app-version, 1.2.3.4]; errors=[message.error-header+[message.version-string-too-many-components], message.advice-header+[error.invalid-cfbundle-version.advice]]) +ErrorTest.test(IMAGE; app-desc=Hello; args-add=[--app-version, 1.]; errors=[message.error-header+[error.version-string-zero-length-component, 1.], message.advice-header+[error.invalid-cfbundle-version.advice]]) ErrorTest.test(IMAGE; app-desc=Hello; args-add=[--app-version, 1.]; errors=[message.error-header+[error.version-string-zero-length-component, 1.]]) +ErrorTest.test(IMAGE; app-desc=Hello; args-add=[--app-version, 1.b.3]; errors=[message.error-header+[error.version-string-invalid-component, 1.b.3, b.3], message.advice-header+[error.invalid-cfbundle-version.advice]]) ErrorTest.test(IMAGE; app-desc=Hello; args-add=[--app-version, 1.b.3]; errors=[message.error-header+[error.version-string-invalid-component, 1.b.3, b.3]]) +ErrorTest.test(IMAGE; app-desc=Hello; args-add=[--app-version, ]; errors=[message.error-header+[error.version-string-empty], message.advice-header+[error.invalid-cfbundle-version.advice]]) ErrorTest.test(IMAGE; app-desc=Hello; args-add=[--app-version, ]; errors=[message.error-header+[error.version-string-empty]]) ErrorTest.test(IMAGE; app-desc=Hello; args-add=[--jlink-options, --add-modules]; errors=[message.error-header+[error.blocked.option, --add-modules]]) ErrorTest.test(IMAGE; app-desc=Hello; args-add=[--jlink-options, --module-path]; errors=[message.error-header+[error.blocked.option, --module-path]]) ErrorTest.test(IMAGE; app-desc=Hello; args-add=[--jlink-options, --output]; errors=[message.error-header+[error.blocked.option, --output]]) -ErrorTest.test(IMAGE; app-desc=Hello; args-add=[--main-jar, non-existent.jar]; errors=[message.error-header+[error.main-jar-does-not-exist, non-existent.jar]]) +ErrorTest.test(IMAGE; app-desc=Hello; args-add=[--main-jar, non-existent.jar]; find; errors=[message.error-header+[error.main-jar-does-not-exist, non-existent.jar]]) ErrorTest.test(IMAGE; app-desc=Hello; args-add=[--runtime-image, @@EMPTY_DIR@@]; errors=[message.error-header+[error.invalid-runtime-image-missing-file, @@EMPTY_DIR@@, lib/**/libjli.dylib]]) ErrorTest.test(IMAGE; app-desc=Hello; args-add=[--runtime-image, @@INVALID_MAC_RUNTIME_BUNDLE@@]; errors=[message.error-header+[error.invalid-runtime-image-missing-file, @@INVALID_MAC_RUNTIME_BUNDLE@@, Contents/Home/lib/**/libjli.dylib]]) ErrorTest.test(IMAGE; app-desc=Hello; args-add=[--runtime-image, @@INVALID_MAC_RUNTIME_IMAGE@@]; errors=[message.error-header+[error.invalid-runtime-image-missing-file, @@INVALID_MAC_RUNTIME_IMAGE@@, lib/**/libjli.dylib]]) @@ -15,7 +18,7 @@ ErrorTest.test(IMAGE; args-add=[--module, com.foo.bar, --runtime-image, @@JAVA_H ErrorTest.test(IMAGE; args-add=[--module, java.base, --runtime-image, @@JAVA_HOME@@]; errors=[message.error-header+[ERR_NoMainClass]]) ErrorTest.test(LINUX_DEB; app-desc=Hello; args-add=[--linux-package-name, #]; errors=[message.error-header+[error.deb-invalid-value-for-package-name, #], message.advice-header+[error.deb-invalid-value-for-package-name.advice]]) ErrorTest.test(LINUX_RPM; app-desc=Hello; args-add=[--linux-package-name, #]; errors=[message.error-header+[error.rpm-invalid-value-for-package-name, #], message.advice-header+[error.rpm-invalid-value-for-package-name.advice]]) -ErrorTest.test(MAC_PKG; app-desc=Hello; args-add=[--mac-package-identifier, #1]; errors=[message.error-header+[message.invalid-identifier, #1]]) +ErrorTest.test(MAC_PKG; app-desc=Hello; args-add=[--mac-package-identifier, #1]; errors=[message.error-header+[message.invalid-identifier, #1], message.advice-header+[message.invalid-identifier.advice]]) ErrorTest.test(NATIVE; app-desc=Hello; args-add=[--mac-app-store, --runtime-image, @@JAVA_HOME@@]; errors=[message.error-header+[error.invalid-runtime-image-bin-dir, @@JAVA_HOME@@], message.advice-header+[error.invalid-runtime-image-bin-dir.advice, --mac-app-store]]) ErrorTest.test(NATIVE; app-desc=Hello; args-add=[--runtime-image, @@EMPTY_DIR@@]; errors=[message.error-header+[error.invalid-runtime-image-missing-file, @@EMPTY_DIR@@, lib/**/libjli.dylib]]) ErrorTest.test(NATIVE; app-desc=Hello; args-add=[--runtime-image, @@INVALID_MAC_RUNTIME_BUNDLE@@]; errors=[message.error-header+[error.invalid-runtime-image-missing-file, @@INVALID_MAC_RUNTIME_BUNDLE@@, Contents/Home/lib/**/libjli.dylib]]) diff --git a/test/jdk/tools/jpackage/junit/share/jdk.jpackage/jdk/jpackage/internal/cli/OptionsValidationFailTest.java b/test/jdk/tools/jpackage/junit/share/jdk.jpackage/jdk/jpackage/internal/cli/OptionsValidationFailTest.java index 9826f0e9069..9976a71ef3f 100644 --- a/test/jdk/tools/jpackage/junit/share/jdk.jpackage/jdk/jpackage/internal/cli/OptionsValidationFailTest.java +++ b/test/jdk/tools/jpackage/junit/share/jdk.jpackage/jdk/jpackage/internal/cli/OptionsValidationFailTest.java @@ -99,7 +99,7 @@ public class OptionsValidationFailTest { var errorReporter = new Main.ErrorReporter(ex -> { ex.printStackTrace(err); - }, out::append); + }, err::println, false); return parse(args).peekErrors(errors -> { final var firstErr = errors.stream().findFirst().orElseThrow(); diff --git a/test/jdk/tools/jpackage/junit/share/jdk.jpackage/jdk/jpackage/internal/cli/ValidatorTest.java b/test/jdk/tools/jpackage/junit/share/jdk.jpackage/jdk/jpackage/internal/cli/ValidatorTest.java index d8d69027f77..9b8babbfdda 100644 --- a/test/jdk/tools/jpackage/junit/share/jdk.jpackage/jdk/jpackage/internal/cli/ValidatorTest.java +++ b/test/jdk/tools/jpackage/junit/share/jdk.jpackage/jdk/jpackage/internal/cli/ValidatorTest.java @@ -32,11 +32,13 @@ import static org.junit.jupiter.api.Assertions.assertThrowsExactly; import java.util.ArrayList; import java.util.List; +import java.util.function.BinaryOperator; import java.util.function.Function; import java.util.function.Supplier; +import java.util.function.UnaryOperator; import java.util.stream.Stream; -import jdk.jpackage.internal.cli.TestUtils.TestException; import jdk.jpackage.internal.cli.TestUtils.RecordingValidator; +import jdk.jpackage.internal.cli.TestUtils.TestException; import jdk.jpackage.internal.cli.Validator.ParsedValue; import jdk.jpackage.internal.cli.Validator.ValidatingConsumerException; import jdk.jpackage.internal.cli.Validator.ValidatorException; @@ -44,6 +46,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.EnumSource; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; public class ValidatorTest { @@ -187,42 +190,60 @@ public class ValidatorTest { assertNotSame(builder.predicate(), copy.predicate()); } - @Test - public void test_and() { + @ParameterizedTest + @ValueSource(booleans = {true, false}) + public void test_and(boolean greedy) { Function, List> validate = validator -> { return validator.validate(OptionName.of("a"), ParsedValue.create("str", StringToken.of("str"))); }; + BinaryOperator> composer = (a, b) -> { + if (greedy) { + return a.andGreedy(b); + } else { + return a.andLazy(b); + } + }; + + UnaryOperator> exceptionFilter; + if (greedy) { + exceptionFilter = v -> v; + } else { + exceptionFilter = v -> { + return List.of(v.getFirst()); + }; + } + var pass = new RecordingValidator<>(Validator.build().predicate(_ -> true).create()); var foo = failingValidator("foo"); var bar = failingValidator("bar"); var buz = failingValidator("buz"); - assertExceptionListEquals(List.of( + assertExceptionListEquals(exceptionFilter.apply(List.of( new TestException("foo"), new TestException("bar"), new TestException("buz") - ), validate.apply(foo.and(bar).and(pass).and(buz))); - assertEquals(1, pass.counter()); + )), validate.apply(Stream.of(foo, bar, pass, buz).reduce(composer).orElseThrow())); + assertEquals(greedy ? 1 : 0, pass.counter()); pass.resetCounter(); - assertExceptionListEquals(List.of( + assertExceptionListEquals(exceptionFilter.apply(List.of( new TestException("bar"), new TestException("buz"), new TestException("foo") - ), validate.apply(pass.and(bar).and(buz).and(foo))); + )), validate.apply(Stream.of(pass, bar, buz, foo).reduce(composer).orElseThrow())); assertEquals(1, pass.counter()); - assertExceptionListEquals(List.of( + assertExceptionListEquals(exceptionFilter.apply(List.of( new TestException("foo"), new TestException("foo") - ), validate.apply(foo.and(foo))); + )), validate.apply(composer.apply(foo, foo))); pass.resetCounter(); assertExceptionListEquals(List.of( - ), validate.apply(pass.and(pass))); + ), validate.apply(composer.apply(pass, pass))); assertEquals(2, pass.counter()); } diff --git a/test/jdk/tools/jpackage/linux/LinuxResourceTest.java b/test/jdk/tools/jpackage/linux/LinuxResourceTest.java index 8371dc01e43..b82706fc2c2 100644 --- a/test/jdk/tools/jpackage/linux/LinuxResourceTest.java +++ b/test/jdk/tools/jpackage/linux/LinuxResourceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2026, Oracle and/or its affiliates. All rights reserved. * 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.nio.file.Path; import java.util.List; import java.util.Objects; import jdk.jpackage.test.Annotations.Test; +import jdk.jpackage.test.CannedFormattedString; import jdk.jpackage.test.JPackageCommand; +import jdk.jpackage.test.JPackageOutputValidator; import jdk.jpackage.test.LinuxHelper; import jdk.jpackage.test.PackageTest; import jdk.jpackage.test.PackageType; @@ -67,22 +69,26 @@ public class LinuxResourceTest { final var arhProp = property("Architecture", "bar"); TKit.createTextFile(controlFile, List.of( - packageProp.format(), - verProp.format(), - "Section: APPLICATION_SECTION", - "Maintainer: APPLICATION_MAINTAINER", - "Priority: optional", - arhProp.format(), - "Provides: dont-install-me", - "Description: APPLICATION_DESCRIPTION", - "Installed-Size: APPLICATION_INSTALLED_SIZE", - "Depends: PACKAGE_DEFAULT_DEPENDENCIES" + packageProp.format(), + verProp.format(), + "Section: APPLICATION_SECTION", + "Maintainer: APPLICATION_MAINTAINER", + "Priority: optional", + arhProp.format(), + "Provides: dont-install-me", + "Description: APPLICATION_DESCRIPTION", + "Installed-Size: APPLICATION_INSTALLED_SIZE", + "Depends: PACKAGE_DEFAULT_DEPENDENCIES" )); - cmd.validateOutput(MAIN.cannedFormattedString( - "message.using-custom-resource", - String.format("[%s]", MAIN.cannedFormattedString("resource.deb-control-file").getValue()), - controlFile.getFileName())); + new JPackageOutputValidator() + .expectMatchingStrings(MAIN.cannedFormattedString( + "message.using-custom-resource", + String.format("[%s]", MAIN.cannedFormattedString("resource.deb-control-file").getValue()), + controlFile.getFileName())) + .matchTimestamps() + .stripTimestamps() + .applyTo(cmd); packageProp.expectedValue(LinuxHelper.getPackageName(cmd)).token("APPLICATION_PACKAGE").resourceDirFile(controlFile).validateOutput(cmd); verProp.expectedValue(cmd.version()).token("APPLICATION_VERSION_WITH_RELEASE").resourceDirFile(controlFile).validateOutput(cmd); @@ -98,30 +104,34 @@ public class LinuxResourceTest { final var releaseProp = property("Release", "R2"); TKit.createTextFile(specFile, List.of( - packageProp.format(), - verProp.format(), - releaseProp.format(), - "Summary: APPLICATION_SUMMARY", - "License: APPLICATION_LICENSE_TYPE", - "Prefix: %{dirname:APPLICATION_DIRECTORY}", - "Provides: dont-install-me", - "%define _build_id_links none", - "%description", - "APPLICATION_DESCRIPTION", - "%prep", - "%build", - "%install", - "rm -rf %{buildroot}", - "install -d -m 755 %{buildroot}APPLICATION_DIRECTORY", - "cp -r %{_sourcedir}APPLICATION_DIRECTORY/* %{buildroot}APPLICATION_DIRECTORY", - "%files", - "APPLICATION_DIRECTORY" + packageProp.format(), + verProp.format(), + releaseProp.format(), + "Summary: APPLICATION_SUMMARY", + "License: APPLICATION_LICENSE_TYPE", + "Prefix: %{dirname:APPLICATION_DIRECTORY}", + "Provides: dont-install-me", + "%define _build_id_links none", + "%description", + "APPLICATION_DESCRIPTION", + "%prep", + "%build", + "%install", + "rm -rf %{buildroot}", + "install -d -m 755 %{buildroot}APPLICATION_DIRECTORY", + "cp -r %{_sourcedir}APPLICATION_DIRECTORY/* %{buildroot}APPLICATION_DIRECTORY", + "%files", + "APPLICATION_DIRECTORY" )); - cmd.validateOutput(MAIN.cannedFormattedString( - "message.using-custom-resource", - String.format("[%s]", MAIN.cannedFormattedString("resource.rpm-spec-file").getValue()), - specFile.getFileName())); + new JPackageOutputValidator() + .expectMatchingStrings(MAIN.cannedFormattedString( + "message.using-custom-resource", + String.format("[%s]", MAIN.cannedFormattedString("resource.rpm-spec-file").getValue()), + specFile.getFileName())) + .matchTimestamps() + .stripTimestamps() + .applyTo(cmd); packageProp.expectedValue(LinuxHelper.getPackageName(cmd)).token("APPLICATION_PACKAGE").resourceDirFile(specFile).validateOutput(cmd); verProp.expectedValue(cmd.version()).token("APPLICATION_VERSION").resourceDirFile(specFile).validateOutput(cmd); @@ -171,9 +181,15 @@ public class LinuxResourceTest { Objects.requireNonNull(resourceDirFile); final var customResourcePath = customResourcePath(); - cmd.validateOutput( - MAIN.cannedFormattedString("error.unexpected-package-property", name, expectedValue, customValue, customResourcePath), - MAIN.cannedFormattedString("error.unexpected-package-property.advice", token, customValue, name, customResourcePath)); + + new JPackageOutputValidator() + .expectMatchingStrings( + MAIN.cannedFormattedString("error.unexpected-package-property", name, expectedValue, customValue, customResourcePath), + MAIN.cannedFormattedString("error.unexpected-package-property.advice", token, customValue, name, customResourcePath) + ) + .matchTimestamps() + .stripTimestamps() + .applyTo(cmd); } private Path customResourcePath() { diff --git a/test/jdk/tools/jpackage/macosx/MacSignTest.java b/test/jdk/tools/jpackage/macosx/MacSignTest.java index e558b671478..dbb78d2416c 100644 --- a/test/jdk/tools/jpackage/macosx/MacSignTest.java +++ b/test/jdk/tools/jpackage/macosx/MacSignTest.java @@ -41,6 +41,7 @@ import jdk.jpackage.test.Annotations.ParameterSupplier; import jdk.jpackage.test.Annotations.Test; import jdk.jpackage.test.FailedCommandErrorValidator; import jdk.jpackage.test.JPackageCommand; +import jdk.jpackage.test.JPackageOutputValidator; import jdk.jpackage.test.JPackageStringBundle; import jdk.jpackage.test.MacHelper; import jdk.jpackage.test.MacHelper.NamedCertificateRequestSupplier; @@ -75,16 +76,16 @@ public class MacSignTest { Files.createDirectory(appContent); Files.createFile(appContent.resolve("file")); - final var group = TKit.TextStreamVerifier.group(); + final var validator = new JPackageOutputValidator().stderr(); - group.add(TKit.assertTextStream(JPackageStringBundle.MAIN.cannedFormattedString( - "message.codesign.failed.reason.app.content").getValue()).predicate(String::equals)); + validator.expectMatchingStrings(JPackageStringBundle.MAIN.cannedFormattedString( + "message.codesign.failed.reason.app.content")); final var xcodeWarning = TKit.assertTextStream(JPackageStringBundle.MAIN.cannedFormattedString( "message.codesign.failed.reason.xcode.tools").getValue()).predicate(String::equals); if (!MacHelper.isXcodeDevToolsInstalled()) { - group.add(xcodeWarning); + validator.add(xcodeWarning); } var keychain = SigningBase.StandardKeychain.MAIN.keychain(); @@ -94,7 +95,7 @@ public class MacSignTest { SigningBase.StandardCertificateRequest.CODESIGN, keychain); - buildSignCommandErrorValidator(signingKeyOption).createGroup().mutate(group::add); + validator.add(buildSignCommandErrorValidator(signingKeyOption).create()); MacSign.withKeychain(_ -> { @@ -104,13 +105,13 @@ public class MacSignTest { // To make jpackage fail, specify bad additional content. JPackageCommand.helloAppImage() .mutate(MacSignTest::init) - .validateOutput(group.create()) + .mutate(validator::applyTo) .addArguments("--app-content", appContent) .mutate(signingKeyOption::addTo) .mutate(cmd -> { if (MacHelper.isXcodeDevToolsInstalled()) { // Check there is no warning about missing xcode command line developer tools. - cmd.validateOutput(xcodeWarning.copy().negate()); + cmd.validateErr(xcodeWarning.copy().negate()); } }).execute(1); @@ -134,12 +135,11 @@ public class MacSignTest { // Build a matcher for jpackage's failed command output. var errorValidator = buildSignCommandErrorValidator(signingKeyOption, keychain) .output(String.format("%s: no identity found", signingKeyOption.certRequest().name())) - .createGroup(); + .create(); JPackageCommand.helloAppImage() - .setFakeRuntime() - .ignoreDefaultVerbose(true) - .validateOutput(errorValidator.create()) + .mutate(MacSignTest::init) + .mutate(errorValidator::applyTo) .mutate(signingKeyOption::addTo) .mutate(MacHelper.useKeychain(keychain)) .execute(1); @@ -198,7 +198,7 @@ public class MacSignTest { builder.validators(TKit.assertTextStream(regexp)); } } - return builder.createGroup(); + return builder.create(); } }).execute(1); }, MacSign.Keychain.UsageBuilder::addToSearchList, SigningBase.StandardKeychain.EXPIRED.keychain()); @@ -230,12 +230,10 @@ public class MacSignTest { * identities without validation to signing commands, signing a .pkg installer * with a name matching two signing identities succeeds. */ - var group = TKit.TextStreamVerifier.group(); - - group.add(TKit.assertTextStream(JPackageStringBundle.MAIN.cannedFormattedString( - "warning.unsigned.app.image", "pkg").getValue())); - - cmd.validateOutput(group.create().andThen(TKit.assertEndOfTextStream())); + new JPackageOutputValidator().stdout() + .expectMatchingStrings(JPackageStringBundle.MAIN.cannedFormattedString("warning.unsigned.app.image", "pkg")) + .validateEndOfStream() + .applyTo(cmd); cmd.execute(); return; @@ -259,7 +257,7 @@ public class MacSignTest { builder.validators(TKit.assertTextStream(regexp)); } } - return builder.createGroup(); + return builder.create(); } }).execute(1); }, MacSign.Keychain.UsageBuilder::addToSearchList, SigningBase.StandardKeychain.DUPLICATE.keychain()); @@ -330,20 +328,17 @@ public class MacSignTest { } private static JPackageCommand configureOutputValidation(JPackageCommand cmd, Stream options, - Function conv) { + Function conv) { // Validate jpackage's output matches expected output. - var outputValidator = options.sorted(Comparator.comparing(option -> { - return option.certRequest().type(); - })).map(conv).reduce( - TKit.TextStreamVerifier.group(), - TKit.TextStreamVerifier.Group::add, - TKit.TextStreamVerifier.Group::add).tryCreate().map(consumer -> { - return consumer.andThen(TKit.assertEndOfTextStream()); - }).orElseGet(TKit::assertEndOfTextStream); + var outputValidator = new JPackageOutputValidator().stderr(); - cmd.validateOutput(outputValidator); + options.sorted(Comparator.comparing(option -> { + return option.certRequest().type(); + })).map(conv).forEach(outputValidator::add); + + outputValidator.validateEndOfStream().applyTo(cmd); return cmd; } @@ -383,10 +378,8 @@ public class MacSignTest { } } - private static TKit.TextStreamVerifier.Group expectConfigurationError(String key, Object ... args) { - var str = JPackageStringBundle.MAIN.cannedFormattedString(key, args); - str = JPackageCommand.makeError(str); - return TKit.TextStreamVerifier.group().add(TKit.assertTextStream(str.getValue()).predicate(String::equals)); + private static JPackageOutputValidator expectConfigurationError(String key, Object ... args) { + return new JPackageOutputValidator().expectMatchingStrings(JPackageCommand.makeError(key, args)).stderr(); } private static FailedCommandErrorValidator buildSignCommandErrorValidator(SignKeyOptionWithKeychain option) { diff --git a/test/jdk/tools/jpackage/macosx/PkgScriptsTest.java b/test/jdk/tools/jpackage/macosx/PkgScriptsTest.java index 9ee85ae5245..5b2a8b63020 100644 --- a/test/jdk/tools/jpackage/macosx/PkgScriptsTest.java +++ b/test/jdk/tools/jpackage/macosx/PkgScriptsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,6 +32,7 @@ import java.util.stream.Stream; import jdk.jpackage.test.Annotations.ParameterSupplier; import jdk.jpackage.test.Annotations.Test; import jdk.jpackage.test.JPackageCommand; +import jdk.jpackage.test.JPackageOutputValidator; import jdk.jpackage.test.JPackageStringBundle; import jdk.jpackage.test.MacHelper; import jdk.jpackage.test.PackageTest; @@ -94,7 +95,13 @@ public class PkgScriptsTest { "message.no-default-resource", String.format("[%s]", role.resourceCategory()), role.scriptName()); - }).forEach(cmd::validateOutput); + }).forEach(str -> { + new JPackageOutputValidator() + .expectMatchingStrings(str) + .matchTimestamps() + .stripTimestamps() + .applyTo(cmd); + }); }).addInstallVerifier(cmd -> { customScripts.forEach(customScript -> { customScript.verify(cmd); diff --git a/test/jdk/tools/jpackage/macosx/SigningPackageTwoStepTest.java b/test/jdk/tools/jpackage/macosx/SigningPackageTwoStepTest.java index 70ec0e600de..23195c9a856 100644 --- a/test/jdk/tools/jpackage/macosx/SigningPackageTwoStepTest.java +++ b/test/jdk/tools/jpackage/macosx/SigningPackageTwoStepTest.java @@ -212,9 +212,9 @@ public class SigningPackageTwoStepTest { } } - expected.ifPresent(cmd::validateOutput); + expected.ifPresent(cmd::validateOut); unexpected.forEach(str -> { - cmd.validateOutput(TKit.assertTextStream(cmd.getValue(str)).negate()); + cmd.validateOut(TKit.assertTextStream(cmd.getValue(str)).negate()); }); } } diff --git a/test/jdk/tools/jpackage/share/AppContentTest.java b/test/jdk/tools/jpackage/share/AppContentTest.java index e275fae262c..46f5286e48a 100644 --- a/test/jdk/tools/jpackage/share/AppContentTest.java +++ b/test/jdk/tools/jpackage/share/AppContentTest.java @@ -102,7 +102,7 @@ public class AppContentTest { JPackageCommand.helloAppImage() .addArguments("--app-content", appContentValue) .setFakeRuntime() - .validateOutput(expectedWarning) + .validateOut(expectedWarning) .executeIgnoreExitCode(); } diff --git a/test/jdk/tools/jpackage/share/AppImagePackageTest.java b/test/jdk/tools/jpackage/share/AppImagePackageTest.java index ce2300c92d1..e91b3113816 100644 --- a/test/jdk/tools/jpackage/share/AppImagePackageTest.java +++ b/test/jdk/tools/jpackage/share/AppImagePackageTest.java @@ -173,7 +173,7 @@ public class AppImagePackageTest { final var appImageDir = appImageCmd.outputBundle(); - final var expectedError = JPackageStringBundle.MAIN.cannedFormattedString( + final var expectedError = JPackageCommand.makeError( "error.invalid-app-image-file", AppImageFile.getPathInAppImage(Path.of("")), appImageDir); configureBadAppImage(appImageDir, expectedError).addRunOnceInitializer(() -> { @@ -204,7 +204,7 @@ public class AppImagePackageTest { } private static PackageTest configureBadAppImage(Path appImageDir) { - return configureBadAppImage(appImageDir, JPackageStringBundle.MAIN.cannedFormattedString( + return configureBadAppImage(appImageDir, JPackageCommand.makeError( "error.missing-app-image-file", AppImageFile.getPathInAppImage(Path.of("")), appImageDir)); } @@ -212,7 +212,7 @@ public class AppImagePackageTest { return new PackageTest().addInitializer(cmd -> { cmd.usePredefinedAppImage(appImageDir); cmd.ignoreDefaultVerbose(true); // no "--verbose" option - cmd.validateOutput(expectedError); + cmd.validateErr(expectedError); }).setExpectedExitCode(1); } diff --git a/test/jdk/tools/jpackage/share/BasicTest.java b/test/jdk/tools/jpackage/share/BasicTest.java index 977b7c7c057..7ea3f578116 100644 --- a/test/jdk/tools/jpackage/share/BasicTest.java +++ b/test/jdk/tools/jpackage/share/BasicTest.java @@ -47,6 +47,7 @@ import jdk.jpackage.test.ConfigurationTarget; import jdk.jpackage.test.Executor; import jdk.jpackage.test.HelloApp; import jdk.jpackage.test.JPackageCommand; +import jdk.jpackage.test.JPackageOutputValidator; import jdk.jpackage.test.JPackageStringBundle; import jdk.jpackage.test.JavaAppDesc; import jdk.jpackage.test.JavaTool; @@ -241,7 +242,11 @@ public final class BasicTest { JPackageStringBundle.MAIN.cannedFormattedString("message.package-created")); } - cmd.validateOutput(verboseContent.toArray(CannedFormattedString[]::new)); + new JPackageOutputValidator() + .expectMatchingStrings(verboseContent.toArray(CannedFormattedString[]::new)) + .matchTimestamps() + .stripTimestamps() + .applyTo(cmd); }); target.cmd().ifPresent(JPackageCommand::execute); @@ -264,12 +269,9 @@ public final class BasicTest { cmd.addArgument("--verbose"); } - cmd.validateOutput(Stream.of( - List.of("error.no-main-class-with-main-jar", "hello.jar"), - List.of("error.no-main-class-with-main-jar.advice", "hello.jar") - ).map(args -> { - return JPackageStringBundle.MAIN.cannedFormattedString(args.getFirst(), args.subList(1, args.size()).toArray()); - }).toArray(CannedFormattedString[]::new)); + cmd.validateErr( + JPackageCommand.makeError("error.no-main-class-with-main-jar", "hello.jar"), + JPackageCommand.makeAdvice("error.no-main-class-with-main-jar.advice", "hello.jar")); cmd.execute(1); } @@ -429,7 +431,7 @@ public final class BasicTest { if (TestTempType.TEMPDIR_NOT_EMPTY.equals(type)) { pkgTest.setExpectedExitCode(1).addInitializer(cmd -> { - cmd.validateOutput(JPackageStringBundle.MAIN.cannedFormattedString( + cmd.validateErr(JPackageCommand.makeError( "error.parameter-not-empty-directory", cmd.getArgumentValue("--temp"), "--temp")); }).addBundleVerifier(cmd -> { // Check jpackage didn't use the supplied directory. diff --git a/test/jdk/tools/jpackage/share/ErrorTest.java b/test/jdk/tools/jpackage/share/ErrorTest.java index f31ac42dea0..86390a85068 100644 --- a/test/jdk/tools/jpackage/share/ErrorTest.java +++ b/test/jdk/tools/jpackage/share/ErrorTest.java @@ -43,6 +43,7 @@ import java.util.function.Function; import java.util.function.Supplier; import java.util.function.UnaryOperator; import java.util.regex.Pattern; +import java.util.stream.IntStream; import java.util.stream.Stream; import jdk.jpackage.internal.util.TokenReplace; import jdk.jpackage.test.Annotations.Parameter; @@ -51,7 +52,7 @@ import jdk.jpackage.test.Annotations.Test; import jdk.jpackage.test.CannedArgument; import jdk.jpackage.test.CannedFormattedString; import jdk.jpackage.test.JPackageCommand; -import jdk.jpackage.test.JPackageStringBundle; +import jdk.jpackage.test.JPackageOutputValidator; import jdk.jpackage.test.PackageType; import jdk.jpackage.test.TKit; @@ -202,11 +203,35 @@ public final class ErrorTest { private static final Optional NATIVE_TYPE = defaultNativeType(); } - public record TestSpec(Optional type, Optional appDesc, List addArgs, - List removeArgs, List expectedMessages) { + public record TestSpec( + Optional type, + Optional appDesc, + List addArgs, + List removeArgs, + List expectedMessages, + boolean match) { static final class Builder { + Builder() { + type = new PackageTypeSpec(PackageType.IMAGE); + appDesc = DEFAULT_APP_DESC; + match = true; + } + + Builder(Builder other) { + type = other.type; + appDesc = other.appDesc; + match = other.match; + addArgs.addAll(other.addArgs); + removeArgs.addAll(other.removeArgs); + expectedMessages.addAll(other.expectedMessages); + } + + Builder copy() { + return new Builder(this); + } + Builder type(PackageType v) { type = Optional.ofNullable(v).map(PackageTypeSpec::new).orElse(null); return this; @@ -230,6 +255,19 @@ public final class ErrorTest { return appDesc(null); } + Builder match(boolean v) { + match = v; + return this; + } + + Builder match() { + return match(true); + } + + Builder find() { + return match(false); + } + Builder setAddArgs(List v) { addArgs.clear(); addArgs.addAll(v); @@ -269,7 +307,8 @@ public final class ErrorTest { } Builder setMessages(List v) { - expectedMessages = v; + expectedMessages.clear(); + expectedMessages.addAll(v); return this; } @@ -287,11 +326,11 @@ public final class ErrorTest { } Builder error(String key, Object ... args) { - return messages(makeError(JPackageStringBundle.MAIN.cannedFormattedString(key, args))); + return messages(makeError(key, args)); } Builder advice(String key, Object ... args) { - return messages(makeAdvice(JPackageStringBundle.MAIN.cannedFormattedString(key, args))); + return messages(makeAdvice(key, args)); } Builder invalidTypeArg(String arg, String... otherArgs) { @@ -304,15 +343,21 @@ public final class ErrorTest { } TestSpec create() { - return new TestSpec(Optional.ofNullable(type), Optional.ofNullable(appDesc), - List.copyOf(addArgs), List.copyOf(removeArgs), List.copyOf(expectedMessages)); + return new TestSpec( + Optional.ofNullable(type), + Optional.ofNullable(appDesc), + List.copyOf(addArgs), + List.copyOf(removeArgs), + List.copyOf(expectedMessages), + match); } - private PackageTypeSpec type = new PackageTypeSpec(PackageType.IMAGE); - private String appDesc = DEFAULT_APP_DESC; - private List addArgs = new ArrayList<>(); - private List removeArgs = new ArrayList<>(); - private List expectedMessages = new ArrayList<>(); + private PackageTypeSpec type; + private String appDesc; + private boolean match; + private final List addArgs = new ArrayList<>(); + private final List removeArgs = new ArrayList<>(); + private final List expectedMessages = new ArrayList<>(); } public TestSpec { @@ -360,12 +405,29 @@ public final class ErrorTest { cmd.clearArguments().addArguments(newArgs); } - defaultInit(cmd, expectedMessages); - cmd.execute(1); + // Disable default logic adding `--verbose` option + // to jpackage command line. + // It will affect jpackage error messages if the command line is malformed. + cmd.ignoreDefaultVerbose(true); + + // Ignore external runtime as it will interfere + // with jpackage arguments in this test. + cmd.ignoreDefaultRuntime(true); + + var validator = new JPackageOutputValidator().stderr().expectMatchingStrings(expectedMessages).match(match); + if (match) { + new JPackageOutputValidator().stdout().validateEndOfStream().applyTo(cmd); + } + + cmd.mutate(validator::applyTo).execute(1); } TestSpec mapExpectedMessages(UnaryOperator mapper) { - return new TestSpec(type, appDesc, addArgs, removeArgs, expectedMessages.stream().map(mapper).toList()); + return new TestSpec(type, appDesc, addArgs, removeArgs, expectedMessages.stream().map(mapper).toList(), match); + } + + TestSpec copyWithExpectedMessages(List expectedMessages) { + return new TestSpec(type, appDesc, addArgs, removeArgs, expectedMessages, match); } @Override @@ -383,6 +445,9 @@ public final class ErrorTest { if (!removeArgs.isEmpty()) { sb.append("args-del=").append(removeArgs).append("; "); } + if (!match) { + sb.append("find; "); + } sb.append("errors=").append(expectedMessages); return sb.toString(); } @@ -408,7 +473,7 @@ public final class ErrorTest { .error("error.no-main-class-with-main-jar", "hello.jar") .advice("error.no-main-class-with-main-jar.advice", "hello.jar"), // non-existent main jar - testSpec().addArgs("--main-jar", "non-existent.jar") + testSpec().addArgs("--main-jar", "non-existent.jar").find() .error("error.main-jar-does-not-exist", "non-existent.jar"), // non-existent runtime testSpec().addArgs("--runtime-image", "non-existent.runtime") @@ -448,7 +513,7 @@ public final class ErrorTest { createMutuallyExclusive( new ArgumentGroup("--module", "foo.bar"), new ArgumentGroup("--main-jar", "foo.jar") - ).map(TestSpec.Builder::noAppDesc).map(TestSpec.Builder::create).forEach(testCases::add); + ).map(TestSpec.Builder::noAppDesc).map(TestSpec.Builder::find).map(TestSpec.Builder::create).forEach(testCases::add); // forbidden jlink options testCases.addAll(Stream.of("--output", "--add-modules", "--module-path").map(opt -> { @@ -499,7 +564,12 @@ public final class ErrorTest { testSpec().addArgs("--app-version", "").error("error.version-string-empty"), testSpec().addArgs("--app-version", "1.").error("error.version-string-zero-length-component", "1."), testSpec().addArgs("--app-version", "1.b.3").error("error.version-string-invalid-component", "1.b.3", "b.3") - )); + ).map(builder -> { + if (TKit.isOSX()) { + builder.advice("error.invalid-cfbundle-version.advice"); + }; + return builder; + })); } @Test @@ -532,10 +602,13 @@ public final class ErrorTest { } return fromTestSpecBuilders(argsStream.map(args -> { - return testSpec().noAppDesc().nativeType() + var builder = testSpec().noAppDesc().nativeType() .addArgs("--runtime-image", Token.JAVA_HOME.token()) - .addArgs(args) - .error("ERR_NoInstallerEntryPoint", args.getFirst()); + .addArgs(args); + if (args.contains("--add-modules")) { + builder.error("ERR_MutuallyExclusiveOptions", "--runtime-image", "--add-modules"); + } + return builder.error("ERR_NoInstallerEntryPoint", args.getFirst()); })); } @@ -566,17 +639,21 @@ public final class ErrorTest { @Test @ParameterSupplier("invalidNames") - public static void testInvalidAppName(String name) { - testSpec().removeArgs("--name").addArgs("--name", name) - .error("ERR_InvalidAppName", adjustTextStreamVerifierArg(name)).create().test(); + public static void testInvalidAppName(InvalidName name) { + testSpec().removeArgs("--name").addArgs("--name", name.value()) + .error("ERR_InvalidAppName", adjustTextStreamVerifierArg(name.value())) + .match(!name.isMessingUpConsoleOutput()) + .create() + .test(); } @Test @ParameterSupplier("invalidNames") - public static void testInvalidAddLauncherName(String name) { + public static void testInvalidAddLauncherName(InvalidName name) { testAdditionLaunchers(testSpec() .addArgs("--add-launcher", name + "=" + Token.ADD_LAUNCHER_PROPERTY_FILE.token()) - .error("ERR_InvalidSLName", adjustTextStreamVerifierArg(name)) + .error("ERR_InvalidSLName", adjustTextStreamVerifierArg(name.value())) + .match(!name.isMessingUpConsoleOutput()) .create()); } @@ -586,7 +663,27 @@ public final class ErrorTest { if (TKit.isWindows()) { data.add("foo\\bar"); } - return toTestArgs(data.stream()); + return toTestArgs(data.stream().map(InvalidName::new)); + } + + record InvalidName(String value) { + InvalidName { + Objects.requireNonNull(value); + } + + boolean isMessingUpConsoleOutput() { + var controlChars = "\r\n\t".codePoints().toArray(); + return value.codePoints().anyMatch(cp -> { + return IntStream.of(controlChars).anyMatch(v -> { + return v == cp; + }); + }); + } + + @Override + public String toString() { + return value; + } } public static Collection testWindows() { @@ -640,7 +737,8 @@ public final class ErrorTest { testSpec().noAppDesc().addArgs("--app-image", Token.APP_IMAGE.token()) .error("error.app-image.mac-sign.required"), testSpec().type(PackageType.MAC_PKG).addArgs("--mac-package-identifier", "#1") - .error("message.invalid-identifier", "#1"), + .error("message.invalid-identifier", "#1") + .advice("message.invalid-identifier.advice"), // Bundle for mac app store should not have runtime commands testSpec().nativeType().addArgs("--mac-app-store", "--jlink-options", "--bind-services") .error("ERR_MissingJLinkOptMacAppStore", "--strip-native-commands"), @@ -658,21 +756,62 @@ public final class ErrorTest { new ArgumentGroup("--app-version", "2.0"), new ArgumentGroup("--name", "foo"), new ArgumentGroup("--mac-app-store") - ).map(argGroup -> { - return testSpec().noAppDesc().addArgs(argGroup.asArray()).addArgs("--app-image", Token.APP_IMAGE.token()) - .error("ERR_InvalidOptionWithAppImageSigning", argGroup.arg()); - // It should bail out with the same error message regardless of `--mac-sign` option. - }).mapMulti(ErrorTest::duplicateForMacSign).toList()); + ).flatMap(argGroup -> { + var withoutSign = testSpec() + .noAppDesc() + .addArgs(argGroup.asArray()) + .addArgs("--app-image", Token.APP_IMAGE.token()); + + var withSign = withoutSign.copy().addArgs("--mac-sign"); + + withoutSign.error("error.app-image.mac-sign.required"); + + // It should bail out with the same error message regardless of `--mac-sign` option. + return Stream.of(withoutSign, withSign).map(builder -> { + return builder.error("ERR_InvalidOptionWithAppImageSigning", argGroup.arg()); + }); + + }).map(TestSpec.Builder::create).toList()); testCases.addAll(createMutuallyExclusive( new ArgumentGroup("--mac-signing-key-user-name", "foo"), new ArgumentGroup("--mac-app-image-sign-identity", "bar") ).mapMulti(ErrorTest::duplicateForMacSign).toList()); - testCases.addAll(createMutuallyExclusive( - new ArgumentGroup("--mac-signing-key-user-name", "foo"), - new ArgumentGroup("--mac-installer-sign-identity", "bar") - ).map(TestSpec.Builder::nativeType).mapMulti(ErrorTest::duplicateForMacSign).toList()); + for (var packageType : PackageType.MAC) { + testCases.addAll(createMutuallyExclusive( + new ArgumentGroup("--mac-signing-key-user-name", "foo"), + new ArgumentGroup("--mac-installer-sign-identity", "bar") + ).map(builder -> { + return builder.type(packageType); + }).mapMulti(ErrorTest::duplicateForMacSign).map(testCase -> { + if (packageType != PackageType.MAC_PKG) { + /* + * This is a bit tricky. + * The error output should also contain + * + * Error: Option [--mac-installer-sign-identity] is not valid with type [dmg]" error message. + * + * The order of errors is defined by the order of options on the command line causing them. + * If "--mac-installer-sign-identity" goes before "--mac-signing-key-user-name", the error output will be: + * + * Error: Option [--mac-installer-sign-identity] is not valid with type [dmg] + * Error: Mutually exclusive options [--mac-signing-key-user-name] and [--mac-installer-sign-identity] + * + * otherwise errors in the output will be in reverse order. + */ + var expectedMessages = new ArrayList<>(testCase.expectedMessages()); + var invalidTypeOption = makeError("ERR_InvalidTypeOption", "--mac-installer-sign-identity", packageType.getType()); + if (testCase.addArgs().indexOf("--mac-installer-sign-identity") < testCase.addArgs().indexOf("--mac-signing-key-user-name")) { + expectedMessages.addFirst(invalidTypeOption); + } else { + expectedMessages.add(invalidTypeOption); + } + testCase = testCase.copyWithExpectedMessages(expectedMessages); + } + return testCase; + }).toList()); + } return toTestArgs(testCases.stream()); } @@ -707,8 +846,7 @@ public final class ErrorTest { final var signingId = "foo"; final List errorMessages = new ArrayList<>(); - errorMessages.add(makeError(JPackageStringBundle.MAIN.cannedFormattedString( - "error.cert.not.found", "Developer ID Application: " + signingId, ""))); + errorMessages.add(makeError("error.cert.not.found", "Developer ID Application: " + signingId, "")); final var cmd = JPackageCommand.helloAppImage() .ignoreDefaultVerbose(true) @@ -720,9 +858,9 @@ public final class ErrorTest { errorMessages.stream() .map(CannedFormattedString::getValue) .map(TKit::assertTextStream) - .map(TKit.TextStreamVerifier::negate).forEach(cmd::validateOutput); + .map(TKit.TextStreamVerifier::negate).forEach(cmd::validateErr); } else { - cmd.validateOutput(errorMessages.toArray(CannedFormattedString[]::new)); + cmd.validateErr(errorMessages.toArray(CannedFormattedString[]::new)); } cmd.execute(1); @@ -750,12 +888,12 @@ public final class ErrorTest { } private static void macInvalidRuntime(Consumer accumulator) { - var runtimeWithBinDirErr = makeError(JPackageStringBundle.MAIN.cannedFormattedString( + var runtimeWithBinDirErr = makeError( "error.invalid-runtime-image-bin-dir", JPackageCommand.cannedArgument(cmd -> { return Path.of(cmd.getArgumentValue("--runtime-image")); - }, Token.JAVA_HOME.token()))); - var runtimeWithBinDirErrAdvice = makeAdvice(JPackageStringBundle.MAIN.cannedFormattedString( - "error.invalid-runtime-image-bin-dir.advice", "--mac-app-store")); + }, Token.JAVA_HOME.token())); + var runtimeWithBinDirErrAdvice = makeAdvice( + "error.invalid-runtime-image-bin-dir.advice", "--mac-app-store"); Stream.of( testSpec().nativeType().addArgs("--mac-app-store", "--runtime-image", Token.JAVA_HOME.token()) @@ -795,10 +933,10 @@ public final class ErrorTest { } private CannedFormattedString expectedErrorMsg() { - return makeError(JPackageStringBundle.MAIN.cannedFormattedString( + return makeError( "error.invalid-runtime-image-missing-file", JPackageCommand.cannedArgument(cmd -> { return Path.of(cmd.getArgumentValue("--runtime-image")); - }, runtimeDir.token()), missingFile)); + }, runtimeDir.token()), missingFile); } } @@ -869,20 +1007,6 @@ public final class ErrorTest { ); } - private static void defaultInit(JPackageCommand cmd, List expectedMessages) { - - // Disable default logic adding `--verbose` option - // to jpackage command line. - // It will affect jpackage error messages if the command line is malformed. - cmd.ignoreDefaultVerbose(true); - - // Ignore external runtime as it will interfere - // with jpackage arguments in this test. - cmd.ignoreDefaultRuntime(true); - - cmd.validateOutput(expectedMessages.toArray(CannedFormattedString[]::new)); - } - private static Collection toTestArgs(Stream stream) { return stream.filter(v -> { if (v instanceof TestSpec ts) { diff --git a/test/jdk/tools/jpackage/share/FileAssociationsTest.java b/test/jdk/tools/jpackage/share/FileAssociationsTest.java index cd4a0491532..c9bd690d73f 100644 --- a/test/jdk/tools/jpackage/share/FileAssociationsTest.java +++ b/test/jdk/tools/jpackage/share/FileAssociationsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * 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,12 +22,9 @@ */ import static java.util.Map.entry; -import static jdk.jpackage.test.JPackageStringBundle.MAIN; import java.nio.file.Path; import java.util.List; -import java.util.Map; -import java.util.TreeMap; import jdk.jpackage.test.Annotations.Parameter; import jdk.jpackage.test.Annotations.Test; import jdk.jpackage.test.FileAssociations; @@ -123,9 +120,9 @@ public class FileAssociationsTest { )); }).addInitializer(cmd -> { cmd.addArguments("--file-associations", propFile); - cmd.validateOutput( - MAIN.cannedFormattedString("error.no-content-types-for-file-association", 1), - MAIN.cannedFormattedString("error.no-content-types-for-file-association.advice", 1)); + cmd.validateErr( + JPackageCommand.makeError("error.no-content-types-for-file-association", 1), + JPackageCommand.makeAdvice("error.no-content-types-for-file-association.advice", 1)); }).run(); } @@ -141,9 +138,9 @@ public class FileAssociationsTest { )); }).addInitializer(cmd -> { cmd.addArguments("--file-associations", propFile); - cmd.validateOutput( - MAIN.cannedFormattedString("error.too-many-content-types-for-file-association", 1), - MAIN.cannedFormattedString("error.too-many-content-types-for-file-association.advice", 1)); + cmd.validateErr( + JPackageCommand.makeError("error.too-many-content-types-for-file-association", 1), + JPackageCommand.makeAdvice("error.too-many-content-types-for-file-association.advice", 1)); }).run(); } diff --git a/test/jdk/tools/jpackage/share/InstallDirTest.java b/test/jdk/tools/jpackage/share/InstallDirTest.java index db22077cd62..81d1fb3556e 100644 --- a/test/jdk/tools/jpackage/share/InstallDirTest.java +++ b/test/jdk/tools/jpackage/share/InstallDirTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * 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 @@ import jdk.jpackage.test.Annotations.Parameter; import jdk.jpackage.test.Annotations.ParameterSupplier; import jdk.jpackage.test.Annotations.Test; import jdk.jpackage.test.JPackageCommand; -import jdk.jpackage.test.JPackageStringBundle; import jdk.jpackage.test.PackageTest; import jdk.jpackage.test.PackageType; import jdk.jpackage.test.RunnablePackageTest.Action; @@ -106,7 +105,7 @@ public class InstallDirTest { cmd.saveConsoleOutput(true); }) .addBundleVerifier((cmd, result) -> { - cmd.validateOutput(JPackageStringBundle.MAIN.cannedFormattedString("error.invalid-install-dir")); + cmd.validateErr(JPackageCommand.makeError("error.invalid-install-dir")); }) .run(); } diff --git a/test/jdk/tools/jpackage/share/MainClassTest.java b/test/jdk/tools/jpackage/share/MainClassTest.java index 72e77bbbff5..ab4dfe1e1fa 100644 --- a/test/jdk/tools/jpackage/share/MainClassTest.java +++ b/test/jdk/tools/jpackage/share/MainClassTest.java @@ -91,7 +91,7 @@ public final class MainClassTest { } Script expectedErrorMessage(String key, Object... args) { - expectedErrorMessage = JPackageStringBundle.MAIN.cannedFormattedString(key, args); + expectedErrorMessage = JPackageCommand.makeError(key, args); return this; } @@ -222,7 +222,7 @@ public final class MainClassTest { if (script.expectedErrorMessage != null) { // This is the case when main class is not found nor in jar // file nor on command line. - cmd.validateOutput(script.expectedErrorMessage).execute(1); + cmd.validateErr(script.expectedErrorMessage).execute(1); return; } diff --git a/test/jdk/tools/jpackage/share/ModulePathTest.java b/test/jdk/tools/jpackage/share/ModulePathTest.java index 5e053fc0fae..583dd1eb0c4 100644 --- a/test/jdk/tools/jpackage/share/ModulePathTest.java +++ b/test/jdk/tools/jpackage/share/ModulePathTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -125,14 +125,14 @@ public final class ModulePathTest { } else { final CannedFormattedString expectedErrorMessage; if (modulePathArgs.isEmpty()) { - expectedErrorMessage = JPackageStringBundle.MAIN.cannedFormattedString( + expectedErrorMessage = JPackageCommand.makeError( "ERR_MissingArgument2", "--runtime-image", "--module-path"); } else { - expectedErrorMessage = JPackageStringBundle.MAIN.cannedFormattedString( + expectedErrorMessage = JPackageCommand.makeError( "error.no-module-in-path", appDesc.moduleName()); } - cmd.validateOutput(expectedErrorMessage).execute(1); + cmd.validateErr(expectedErrorMessage).execute(1); } } diff --git a/test/jdk/tools/jpackage/share/OutputErrorTest.java b/test/jdk/tools/jpackage/share/OutputErrorTest.java index 110e86e67d9..28dca22a244 100644 --- a/test/jdk/tools/jpackage/share/OutputErrorTest.java +++ b/test/jdk/tools/jpackage/share/OutputErrorTest.java @@ -34,7 +34,6 @@ import jdk.internal.util.OperatingSystem; import jdk.jpackage.test.Annotations.Parameter; import jdk.jpackage.test.Annotations.Test; import jdk.jpackage.test.JPackageCommand; -import jdk.jpackage.test.JPackageStringBundle; import jdk.jpackage.test.JavaTool; import jdk.jpackage.test.PackageTest; import jdk.jpackage.test.TKit; @@ -62,8 +61,8 @@ public final class OutputErrorTest { cmd.setFakeRuntime(); cmd.setArgumentValue("--dest", TKit.createTempDirectory("output")); cmd.removeOldOutputBundle(false); - cmd.validateOutput(JPackageCommand.makeError(JPackageStringBundle.MAIN.cannedFormattedString( - "error.output-bundle-cannot-be-overwritten", cmd.outputBundle().toAbsolutePath()))); + cmd.validateErr(JPackageCommand.makeError( + "error.output-bundle-cannot-be-overwritten", cmd.outputBundle().toAbsolutePath())); var outputBundle = cmd.outputBundle(); diff --git a/test/jdk/tools/jpackage/windows/WinOSConditionTest.java b/test/jdk/tools/jpackage/windows/WinOSConditionTest.java index 6a78f78e804..68f39426c32 100644 --- a/test/jdk/tools/jpackage/windows/WinOSConditionTest.java +++ b/test/jdk/tools/jpackage/windows/WinOSConditionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. * 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,6 +23,9 @@ import java.io.IOException; import java.nio.file.Files; +import java.util.Iterator; +import java.util.function.Consumer; +import java.util.stream.Stream; import jdk.jpackage.test.Annotations.Test; import jdk.jpackage.test.JPackageCommand; import jdk.jpackage.test.PackageTest; @@ -74,10 +77,13 @@ public class WinOSConditionTest { // MSI error code 1603 is generic. // Dig into the last msi log file for log messages specific to failed condition. try (final var lines = cmd.winMsiLogFileContents().orElseThrow()) { - TKit.TextStreamVerifier.group() - .add(TKit.assertTextStream("Doing action: LaunchConditions").predicate(String::endsWith)) - .add(TKit.assertTextStream("Not supported on this version of Windows").predicate(String::endsWith)) - .create().accept(lines.iterator()); + Stream.of( + "Doing action: LaunchConditions", + "Not supported on this version of Windows" + ).map(TKit::assertTextStream).map(v -> { + Consumer> consumer = v.predicate(String::endsWith)::apply; + return consumer; + }).reduce(Consumer::andThen).orElseThrow().accept(lines.iterator()); } }) .createMsiLog(true) diff --git a/test/jdk/tools/jpackage/windows/WinResourceTest.java b/test/jdk/tools/jpackage/windows/WinResourceTest.java index b22501ac6cc..6327b94b420 100644 --- a/test/jdk/tools/jpackage/windows/WinResourceTest.java +++ b/test/jdk/tools/jpackage/windows/WinResourceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * 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,17 +21,20 @@ * questions. */ +import static jdk.jpackage.test.WindowsHelper.getWixTypeFromVerboseJPackageOutput; +import static jdk.jpackage.test.WindowsHelper.WixType.WIX3; + import java.io.IOException; import java.nio.file.Path; -import jdk.jpackage.test.TKit; +import java.util.List; +import jdk.jpackage.test.Annotations.Parameters; +import jdk.jpackage.test.Annotations.Test; +import jdk.jpackage.test.CannedFormattedString; +import jdk.jpackage.test.JPackageOutputValidator; +import jdk.jpackage.test.JPackageStringBundle; import jdk.jpackage.test.PackageTest; import jdk.jpackage.test.PackageType; -import jdk.jpackage.test.JPackageCommand; -import jdk.jpackage.test.Annotations.Test; -import jdk.jpackage.test.Annotations.Parameters; -import java.util.List; -import static jdk.jpackage.test.WindowsHelper.WixType.WIX3; -import static jdk.jpackage.test.WindowsHelper.getWixTypeFromVerboseJPackageOutput; +import jdk.jpackage.test.TKit; /** * Test --resource-dir option. The test should set --resource-dir to point to @@ -52,7 +55,7 @@ import static jdk.jpackage.test.WindowsHelper.getWixTypeFromVerboseJPackageOutpu public class WinResourceTest { - public WinResourceTest(String wixSource, String expectedLogMessage) { + public WinResourceTest(String wixSource, CannedFormattedString expectedLogMessage) { this.wixSource = wixSource; this.expectedLogMessage = expectedLogMessage; } @@ -60,8 +63,10 @@ public class WinResourceTest { @Parameters public static List data() { return List.of(new Object[][]{ - {"main.wxs", "Using custom package resource [Main WiX project file]"}, - {"overrides.wxi", "Using custom package resource [Overrides WiX project file]"}, + {"main.wxs", JPackageStringBundle.MAIN.cannedFormattedString( + "message.using-custom-resource", "[Main WiX project file]", "main.wxs")}, + {"overrides.wxi", JPackageStringBundle.MAIN.cannedFormattedString( + "message.using-custom-resource", "[Overrides WiX project file]", "overrides.wxi")}, }); } @@ -81,6 +86,12 @@ public class WinResourceTest { // Create invalid WiX source file in a resource dir. TKit.createTextFile(resourceDir.resolve(wixSource), List.of( "any string that is an invalid WiX source file")); + + new JPackageOutputValidator() + .matchTimestamps() + .stripTimestamps() + .expectMatchingStrings(expectedLogMessage) + .applyTo(cmd); }) .addBundleVerifier((cmd, result) -> { // Assert jpackage picked custom main.wxs and failed as expected by @@ -92,17 +103,12 @@ public class WinResourceTest { expectedWixErrorMsg = "error WIX0104: Not a valid source file"; } - TKit.assertTextStream(expectedLogMessage) - .predicate(String::startsWith) - .apply(JPackageCommand.stripTimestamps( - result.getOutput().stream()).iterator()); - TKit.assertTextStream(expectedWixErrorMsg) - .apply(result.getOutput()); + TKit.assertTextStream(expectedWixErrorMsg).apply(result.stderr()); }) .setExpectedExitCode(1) .run(); } final String wixSource; - final String expectedLogMessage; + final CannedFormattedString expectedLogMessage; } From eecc0d69047d88840b18a66a4a6f940c0665ab50 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Fri, 13 Feb 2026 01:04:48 +0000 Subject: [PATCH 088/120] 8376996: Remove AppContext usage from SunClipboard.java Reviewed-by: serb, dnguyen --- .../classes/sun/lwawt/macosx/CClipboard.java | 4 +- .../share/classes/sun/awt/SunToolkit.java | 11 ++ .../sun/awt/datatransfer/SunClipboard.java | 125 ++++-------------- 3 files changed, 39 insertions(+), 101 deletions(-) diff --git a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CClipboard.java b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CClipboard.java index c934ec3e234..c81d9f4fd3d 100644 --- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CClipboard.java +++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CClipboard.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -136,7 +136,7 @@ final class CClipboard extends SunClipboard { void checkPasteboardAndNotify() { if (checkPasteboardWithoutNotification()) { notifyChanged(); - lostOwnershipNow(null); + lostOwnershipNow(); } } diff --git a/src/java.desktop/share/classes/sun/awt/SunToolkit.java b/src/java.desktop/share/classes/sun/awt/SunToolkit.java index 51353c7d937..9b2f756fd56 100644 --- a/src/java.desktop/share/classes/sun/awt/SunToolkit.java +++ b/src/java.desktop/share/classes/sun/awt/SunToolkit.java @@ -426,6 +426,17 @@ public abstract class SunToolkit extends Toolkit } } + public static void postEvent(AWTEvent event) { + /* Adding AppContext is temporary to help migrate away from using app contexts + * It is used by code which has already been subject to that migration. + * However until that is complete, there is a single main app context we + * can retrieve to use which would be the same as if the code had + * not been migrated. + * The overload which accepts the AppContext will eventually be replaced by this. + */ + postEvent(AppContext.getAppContext(), event); + } + /* * Post an AWTEvent to the Java EventQueue, using the PostEventQueue * to avoid possibly calling client code (EventQueueSubclass.postEvent()) diff --git a/src/java.desktop/share/classes/sun/awt/datatransfer/SunClipboard.java b/src/java.desktop/share/classes/sun/awt/datatransfer/SunClipboard.java index edffbf59878..bc8071a798b 100644 --- a/src/java.desktop/share/classes/sun/awt/datatransfer/SunClipboard.java +++ b/src/java.desktop/share/classes/sun/awt/datatransfer/SunClipboard.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2026, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ import java.util.HashSet; import java.io.IOException; -import sun.awt.AppContext; import sun.awt.PeerEvent; import sun.awt.SunToolkit; @@ -60,16 +59,11 @@ import sun.awt.SunToolkit; * * @since 1.3 */ -public abstract class SunClipboard extends Clipboard - implements PropertyChangeListener { - - private AppContext contentsContext = null; - - private final Object CLIPBOARD_FLAVOR_LISTENER_KEY; +public abstract class SunClipboard extends Clipboard { /** * A number of {@code FlavorListener}s currently registered - * on this clipboard across all {@code AppContext}s. + * on this clipboard */ private volatile int numberOfFlavorListeners; @@ -82,7 +76,6 @@ public abstract class SunClipboard extends Clipboard public SunClipboard(String name) { super(name); - CLIPBOARD_FLAVOR_LISTENER_KEY = new StringBuffer(name + "_CLIPBOARD_FLAVOR_LISTENER_KEY"); } public synchronized void setContents(Transferable contents, @@ -93,8 +86,6 @@ public abstract class SunClipboard extends Clipboard throw new NullPointerException("contents"); } - initContext(); - final ClipboardOwner oldOwner = this.owner; final Transferable oldContents = this.contents; @@ -110,27 +101,6 @@ public abstract class SunClipboard extends Clipboard } } - private synchronized void initContext() { - final AppContext context = AppContext.getAppContext(); - - if (contentsContext != context) { - // Need to synchronize on the AppContext to guarantee that it cannot - // be disposed after the check, but before the listener is added. - synchronized (context) { - if (context.isDisposed()) { - throw new IllegalStateException("Can't set contents from disposed AppContext"); - } - context.addPropertyChangeListener - (AppContext.DISPOSED_PROPERTY_NAME, this); - } - if (contentsContext != null) { - contentsContext.removePropertyChangeListener - (AppContext.DISPOSED_PROPERTY_NAME, this); - } - contentsContext = context; - } - } - public synchronized Transferable getContents(Object requestor) { if (contents != null) { return contents; @@ -140,13 +110,11 @@ public abstract class SunClipboard extends Clipboard /** - * @return the contents of this clipboard if it has been set from the same - * AppContext as it is currently retrieved or null otherwise + * @return the contents of this clipboard if it has been set or null otherwise * @since 1.5 */ protected synchronized Transferable getContextContents() { - AppContext context = AppContext.getAppContext(); - return (context == contentsContext) ? contents : null; + return contents; } @@ -248,16 +216,8 @@ public abstract class SunClipboard extends Clipboard public abstract long getID(); - public void propertyChange(PropertyChangeEvent evt) { - if (AppContext.DISPOSED_PROPERTY_NAME.equals(evt.getPropertyName()) && - Boolean.TRUE.equals(evt.getNewValue())) { - final AppContext disposedContext = (AppContext)evt.getSource(); - lostOwnershipLater(disposedContext); - } - } - protected void lostOwnershipImpl() { - lostOwnershipLater(null); + lostOwnershipLater(); } /** @@ -270,47 +230,30 @@ public abstract class SunClipboard extends Clipboard * {@code null} if the ownership is lost because another * application acquired ownership. */ - protected void lostOwnershipLater(final AppContext disposedContext) { - final AppContext context = this.contentsContext; - if (context == null) { - return; - } - - SunToolkit.postEvent(context, new PeerEvent(this, () -> lostOwnershipNow(disposedContext), - PeerEvent.PRIORITY_EVENT)); + protected void lostOwnershipLater() { + SunToolkit.postEvent(new PeerEvent(this, () -> lostOwnershipNow(), + PeerEvent.PRIORITY_EVENT)); } - protected void lostOwnershipNow(final AppContext disposedContext) { + + protected void lostOwnershipNow() { + final SunClipboard sunClipboard = SunClipboard.this; ClipboardOwner owner = null; Transferable contents = null; synchronized (sunClipboard) { - final AppContext context = sunClipboard.contentsContext; - - if (context == null) { - return; - } - - if (disposedContext == null || context == disposedContext) { - owner = sunClipboard.owner; - contents = sunClipboard.contents; - sunClipboard.contentsContext = null; - sunClipboard.owner = null; - sunClipboard.contents = null; - sunClipboard.clearNativeContext(); - context.removePropertyChangeListener - (AppContext.DISPOSED_PROPERTY_NAME, sunClipboard); - } else { - return; - } + owner = sunClipboard.owner; + contents = sunClipboard.contents; + sunClipboard.owner = null; + sunClipboard.contents = null; + sunClipboard.clearNativeContext(); } if (owner != null) { owner.lostOwnership(sunClipboard, contents); } } - protected abstract void clearNativeContext(); protected abstract void setContentsNative(Transferable contents); @@ -343,11 +286,8 @@ public abstract class SunClipboard extends Clipboard if (listener == null) { return; } - AppContext appContext = AppContext.getAppContext(); - Set flavorListeners = getFlavorListeners(appContext); if (flavorListeners == null) { flavorListeners = new HashSet<>(); - appContext.put(CLIPBOARD_FLAVOR_LISTENER_KEY, flavorListeners); } flavorListeners.add(listener); @@ -362,7 +302,6 @@ public abstract class SunClipboard extends Clipboard if (listener == null) { return; } - Set flavorListeners = getFlavorListeners(AppContext.getAppContext()); if (flavorListeners == null){ //else we throw NullPointerException, but it is forbidden return; @@ -373,13 +312,8 @@ public abstract class SunClipboard extends Clipboard } } - @SuppressWarnings("unchecked") - private Set getFlavorListeners(AppContext appContext) { - return (Set)appContext.get(CLIPBOARD_FLAVOR_LISTENER_KEY); - } - + private static Set flavorListeners; public synchronized FlavorListener[] getFlavorListeners() { - Set flavorListeners = getFlavorListeners(AppContext.getAppContext()); return flavorListeners == null ? new FlavorListener[0] : flavorListeners.toArray(new FlavorListener[flavorListeners.size()]); } @@ -394,8 +328,7 @@ public abstract class SunClipboard extends Clipboard /** * Checks change of the {@code DataFlavor}s and, if necessary, - * posts notifications on {@code FlavorEvent}s to the - * AppContexts' EDTs. + * posts notifications on {@code FlavorEvent}s to the EDT's. * The parameter {@code formats} is null iff we have just * failed to get formats available on the clipboard. * @@ -411,19 +344,13 @@ public abstract class SunClipboard extends Clipboard } currentFormats = formats; - for (final AppContext appContext : AppContext.getAppContexts()) { - if (appContext == null || appContext.isDisposed()) { - continue; - } - Set flavorListeners = getFlavorListeners(appContext); - if (flavorListeners != null) { - for (FlavorListener listener : flavorListeners) { - if (listener != null) { - PeerEvent peerEvent = new PeerEvent(this, - () -> listener.flavorsChanged(new FlavorEvent(SunClipboard.this)), - PeerEvent.PRIORITY_EVENT); - SunToolkit.postEvent(appContext, peerEvent); - } + if (flavorListeners != null) { + for (FlavorListener listener : flavorListeners) { + if (listener != null) { + PeerEvent peerEvent = new PeerEvent(this, + () -> listener.flavorsChanged(new FlavorEvent(SunClipboard.this)), + PeerEvent.PRIORITY_EVENT); + SunToolkit.postEvent(peerEvent); } } } From 0842782b7ab9e57028fa527073c8f2523137f612 Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Fri, 13 Feb 2026 03:33:02 +0000 Subject: [PATCH 089/120] 8377347: jdk/jfr/event/gc/detailed/TestZAllocationStallEvent.java intermittent OOME Reviewed-by: ayang, stefank --- .../jfr/event/gc/detailed/TestZAllocationStallEvent.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestZAllocationStallEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestZAllocationStallEvent.java index b2f20450d0d..b6f96e9f244 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/TestZAllocationStallEvent.java +++ b/test/jdk/jdk/jfr/event/gc/detailed/TestZAllocationStallEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved. * 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,8 @@ import jdk.test.lib.jfr.Events; * @requires vm.hasJFR & vm.gc.Z * @requires vm.flagless * @library /test/lib /test/jdk /test/hotspot/jtreg - * @run main/othervm -XX:+UseZGC -Xmx32M -Xlog:gc*:gc.log::filecount=0 jdk.jfr.event.gc.detailed.TestZAllocationStallEvent + * @run main/othervm -XX:+UseZGC -Xmx64M -Xlog:gc*:gc.log::filecount=0 + * jdk.jfr.event.gc.detailed.TestZAllocationStallEvent */ public class TestZAllocationStallEvent { @@ -47,7 +48,7 @@ public class TestZAllocationStallEvent { recording.start(); // Allocate many large objects quickly, to outrun the GC - for (int i = 0; i < 100; i++) { + for (int i = 0; i < 1000; i++) { blackHole(new byte[4 * 1024 * 1024]); } From 9c75afb6d0ea95c5356e3e29ae66cfc8b04c3564 Mon Sep 17 00:00:00 2001 From: Robert Toyonaga Date: Fri, 13 Feb 2026 04:47:36 +0000 Subject: [PATCH 090/120] 8353564: Fail fatally if os::release_memory or os::uncommit_memory fails Reviewed-by: stefank, stuefe, dholmes --- src/hotspot/os/aix/os_aix.cpp | 3 +- src/hotspot/os/bsd/os_bsd.cpp | 6 +- src/hotspot/os/linux/os_linux.cpp | 13 ++- src/hotspot/os/windows/os_windows.cpp | 13 ++- src/hotspot/share/cds/filemap.cpp | 8 +- .../share/gc/parallel/psVirtualspace.cpp | 9 +- src/hotspot/share/gc/shared/cardTable.cpp | 4 +- .../share/gc/shenandoah/shenandoahHeap.cpp | 13 +-- .../gc/shenandoah/shenandoahHeapRegion.cpp | 6 +- .../share/memory/allocation.inline.hpp | 3 +- src/hotspot/share/memory/memoryReserver.cpp | 14 +-- src/hotspot/share/memory/memoryReserver.hpp | 2 +- .../memory/metaspace/virtualSpaceNode.cpp | 5 +- src/hotspot/share/memory/virtualspace.cpp | 24 ++--- src/hotspot/share/runtime/os.cpp | 31 +++--- src/hotspot/share/runtime/os.hpp | 10 +- src/hotspot/share/runtime/stackOverflow.cpp | 9 +- .../gtest/gc/z/test_zVirtualMemoryManager.cpp | 3 +- .../gtest/memory/test_virtualspace.cpp | 6 +- test/hotspot/gtest/runtime/test_os.cpp | 97 ++++++++++++------- test/hotspot/gtest/runtime/test_os_linux.cpp | 4 +- .../os/TestMemoryAllocationLogging.java | 2 +- 22 files changed, 133 insertions(+), 152 deletions(-) diff --git a/src/hotspot/os/aix/os_aix.cpp b/src/hotspot/os/aix/os_aix.cpp index 0a8efbece8d..327508e1118 100644 --- a/src/hotspot/os/aix/os_aix.cpp +++ b/src/hotspot/os/aix/os_aix.cpp @@ -1753,10 +1753,9 @@ bool os::pd_create_stack_guard_pages(char* addr, size_t size) { return true; } -bool os::remove_stack_guard_pages(char* addr, size_t size) { +void os::remove_stack_guard_pages(char* addr, size_t size) { // Do not call this; no need to commit stack pages on AIX. ShouldNotReachHere(); - return true; } void os::pd_realign_memory(char *addr, size_t bytes, size_t alignment_hint) { diff --git a/src/hotspot/os/bsd/os_bsd.cpp b/src/hotspot/os/bsd/os_bsd.cpp index 81320b4f1aa..0ed5335adc3 100644 --- a/src/hotspot/os/bsd/os_bsd.cpp +++ b/src/hotspot/os/bsd/os_bsd.cpp @@ -1782,10 +1782,8 @@ bool os::pd_create_stack_guard_pages(char* addr, size_t size) { return os::commit_memory(addr, size, !ExecMem); } -// If this is a growable mapping, remove the guard pages entirely by -// munmap()ping them. If not, just call uncommit_memory(). -bool os::remove_stack_guard_pages(char* addr, size_t size) { - return os::uncommit_memory(addr, size); +void os::remove_stack_guard_pages(char* addr, size_t size) { + os::uncommit_memory(addr, size); } // 'requested_addr' is only treated as a hint, the return value may or diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp index 7190845a8ba..09c514e3d05 100644 --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -3523,6 +3523,9 @@ bool os::pd_uncommit_memory(char* addr, size_t size, bool exec) { log_trace(os, map)("mmap failed: " RANGEFMT " errno=(%s)", RANGEFMTARGS(addr, size), os::strerror(ep.saved_errno())); + if (ep.saved_errno() == ENOMEM) { + fatal("Failed to uncommit " RANGEFMT ". It is possible that the process's maximum number of mappings would have been exceeded. Try increasing the limit.", RANGEFMTARGS(addr, size)); + } return false; } return true; @@ -3633,14 +3636,16 @@ bool os::pd_create_stack_guard_pages(char* addr, size_t size) { // It's safe to always unmap guard pages for primordial thread because we // always place it right after end of the mapped region. -bool os::remove_stack_guard_pages(char* addr, size_t size) { - uintptr_t stack_extent, stack_base; +void os::remove_stack_guard_pages(char* addr, size_t size) { if (os::is_primordial_thread()) { - return ::munmap(addr, size) == 0; + if (::munmap(addr, size) != 0) { + fatal("Failed to munmap " RANGEFMT, RANGEFMTARGS(addr, size)); + } + return; } - return os::uncommit_memory(addr, size); + os::uncommit_memory(addr, size); } // 'requested_addr' is only treated as a hint, the return value may or diff --git a/src/hotspot/os/windows/os_windows.cpp b/src/hotspot/os/windows/os_windows.cpp index b0b7ae18106..2e819e26e37 100644 --- a/src/hotspot/os/windows/os_windows.cpp +++ b/src/hotspot/os/windows/os_windows.cpp @@ -3281,11 +3281,10 @@ static char* map_or_reserve_memory_aligned(size_t size, size_t alignment, int fi // Do manual alignment aligned_base = align_up(extra_base, alignment); - bool rc = (file_desc != -1) ? os::unmap_memory(extra_base, extra_size) : - os::release_memory(extra_base, extra_size); - assert(rc, "release failed"); - if (!rc) { - return nullptr; + if (file_desc != -1) { + os::unmap_memory(extra_base, extra_size); + } else { + os::release_memory(extra_base, extra_size); } // Attempt to map, into the just vacated space, the slightly smaller aligned area. @@ -3681,8 +3680,8 @@ bool os::pd_create_stack_guard_pages(char* addr, size_t size) { return os::commit_memory(addr, size, !ExecMem); } -bool os::remove_stack_guard_pages(char* addr, size_t size) { - return os::uncommit_memory(addr, size); +void os::remove_stack_guard_pages(char* addr, size_t size) { + os::uncommit_memory(addr, size); } static bool protect_pages_individually(char* addr, size_t bytes, unsigned int p, DWORD *old_status) { diff --git a/src/hotspot/share/cds/filemap.cpp b/src/hotspot/share/cds/filemap.cpp index a779fcddfcf..da2d4f6dac2 100644 --- a/src/hotspot/share/cds/filemap.cpp +++ b/src/hotspot/share/cds/filemap.cpp @@ -1325,9 +1325,7 @@ char* FileMapInfo::map_auxiliary_region(int region_index, bool read_only) { if (VerifySharedSpaces && !r->check_region_crc(mapped_base)) { aot_log_error(aot)("region %d CRC error", region_index); - if (!os::unmap_memory(mapped_base, r->used_aligned())) { - fatal("os::unmap_memory of region %d failed", region_index); - } + os::unmap_memory(mapped_base, r->used_aligned()); return nullptr; } @@ -1654,9 +1652,7 @@ void FileMapInfo::unmap_region(int i) { // is released. Zero it so that we don't accidentally read its content. aot_log_info(aot)("Region #%d (%s) is in a reserved space, it will be freed when the space is released", i, shared_region_name[i]); } else { - if (!os::unmap_memory(mapped_base, size)) { - fatal("os::unmap_memory failed"); - } + os::unmap_memory(mapped_base, size); } } r->set_mapped_base(nullptr); diff --git a/src/hotspot/share/gc/parallel/psVirtualspace.cpp b/src/hotspot/share/gc/parallel/psVirtualspace.cpp index f4b24fa51af..93803cf38e1 100644 --- a/src/hotspot/share/gc/parallel/psVirtualspace.cpp +++ b/src/hotspot/share/gc/parallel/psVirtualspace.cpp @@ -78,12 +78,13 @@ bool PSVirtualSpace::shrink_by(size_t bytes) { } char* const base_addr = committed_high_addr() - bytes; - bool result = special() || os::uncommit_memory(base_addr, bytes); - if (result) { - _committed_high_addr -= bytes; + if (!special()) { + os::uncommit_memory(base_addr, bytes); } - return result; + _committed_high_addr -= bytes; + + return true; } #ifndef PRODUCT diff --git a/src/hotspot/share/gc/shared/cardTable.cpp b/src/hotspot/share/gc/shared/cardTable.cpp index 34f1847befe..e6e3fdf3d82 100644 --- a/src/hotspot/share/gc/shared/cardTable.cpp +++ b/src/hotspot/share/gc/shared/cardTable.cpp @@ -169,9 +169,7 @@ void CardTable::resize_covered_region(MemRegion new_region) { // Shrink. MemRegion delta = MemRegion(new_committed.end(), old_committed.word_size() - new_committed.word_size()); - bool res = os::uncommit_memory((char*)delta.start(), - delta.byte_size()); - assert(res, "uncommit should succeed"); + os::uncommit_memory((char*)delta.start(), delta.byte_size()); } log_trace(gc, barrier)("CardTable::resize_covered_region: "); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp index ccfc1c036c2..767da5f9bf3 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp @@ -1775,12 +1775,7 @@ void ShenandoahHeap::scan_roots_for_iteration(ShenandoahScanObjectStack* oop_sta void ShenandoahHeap::reclaim_aux_bitmap_for_iteration() { if (!_aux_bitmap_region_special) { - bool success = os::uncommit_memory((char*)_aux_bitmap_region.start(), _aux_bitmap_region.byte_size()); - if (!success) { - log_warning(gc)("Auxiliary marking bitmap uncommit failed: " PTR_FORMAT " (%zu bytes)", - p2i(_aux_bitmap_region.start()), _aux_bitmap_region.byte_size()); - assert(false, "Auxiliary marking bitmap uncommit should always succeed"); - } + os::uncommit_memory((char*)_aux_bitmap_region.start(), _aux_bitmap_region.byte_size()); } } @@ -2626,11 +2621,7 @@ void ShenandoahHeap::uncommit_bitmap_slice(ShenandoahHeapRegion *r) { size_t len = _bitmap_bytes_per_slice; char* addr = (char*) _bitmap_region.start() + off; - bool success = os::uncommit_memory(addr, len); - if (!success) { - log_warning(gc)("Bitmap slice uncommit failed: " PTR_FORMAT " (%zu bytes)", p2i(addr), len); - assert(false, "Bitmap slice uncommit should always succeed"); - } + os::uncommit_memory(addr, len); } void ShenandoahHeap::forbid_uncommit() { diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp index b0c13df6c4f..afc6b24e168 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp @@ -816,11 +816,7 @@ void ShenandoahHeapRegion::do_commit() { void ShenandoahHeapRegion::do_uncommit() { ShenandoahHeap* heap = ShenandoahHeap::heap(); if (!heap->is_heap_region_special()) { - bool success = os::uncommit_memory((char *) bottom(), RegionSizeBytes); - if (!success) { - log_warning(gc)("Region uncommit failed: " PTR_FORMAT " (%zu bytes)", p2i(bottom()), RegionSizeBytes); - assert(false, "Region uncommit should always succeed"); - } + os::uncommit_memory((char *) bottom(), RegionSizeBytes); } if (!heap->is_bitmap_region_special()) { heap->uncommit_bitmap_slice(this); diff --git a/src/hotspot/share/memory/allocation.inline.hpp b/src/hotspot/share/memory/allocation.inline.hpp index 5561cdbe6f7..1cbff9d0255 100644 --- a/src/hotspot/share/memory/allocation.inline.hpp +++ b/src/hotspot/share/memory/allocation.inline.hpp @@ -87,8 +87,7 @@ E* MmapArrayAllocator::allocate(size_t length, MemTag mem_tag) { template void MmapArrayAllocator::free(E* addr, size_t length) { - bool result = os::release_memory((char*)addr, size_for(length)); - assert(result, "Failed to release memory"); + os::release_memory((char*)addr, size_for(length)); } template diff --git a/src/hotspot/share/memory/memoryReserver.cpp b/src/hotspot/share/memory/memoryReserver.cpp index e8d1887f59f..59e8f30707d 100644 --- a/src/hotspot/share/memory/memoryReserver.cpp +++ b/src/hotspot/share/memory/memoryReserver.cpp @@ -99,9 +99,7 @@ static char* reserve_memory_inner(char* requested_address, } // Base not aligned, retry. - if (!os::release_memory(base, size)) { - fatal("os::release_memory failed"); - } + os::release_memory(base, size); // Map using the requested alignment. return os::reserve_memory_aligned(size, alignment, mem_tag, exec); @@ -231,13 +229,13 @@ ReservedSpace MemoryReserver::reserve(size_t size, mem_tag); } -bool MemoryReserver::release(const ReservedSpace& reserved) { +void MemoryReserver::release(const ReservedSpace& reserved) { assert(reserved.is_reserved(), "Precondition"); if (reserved.special()) { - return os::release_memory_special(reserved.base(), reserved.size()); + os::release_memory_special(reserved.base(), reserved.size()); } else { - return os::release_memory(reserved.base(), reserved.size()); + os::release_memory(reserved.base(), reserved.size()); } } @@ -266,9 +264,7 @@ static char* map_memory_to_file(char* requested_address, // Base not aligned, retry. - if (!os::unmap_memory(base, size)) { - fatal("os::unmap_memory failed"); - } + os::unmap_memory(base, size); // Map using the requested alignment. return os::map_memory_to_file_aligned(size, alignment, fd, mem_tag); diff --git a/src/hotspot/share/memory/memoryReserver.hpp b/src/hotspot/share/memory/memoryReserver.hpp index 9ef12650b55..d13d8d72512 100644 --- a/src/hotspot/share/memory/memoryReserver.hpp +++ b/src/hotspot/share/memory/memoryReserver.hpp @@ -70,7 +70,7 @@ public: MemTag mem_tag); // Release reserved memory - static bool release(const ReservedSpace& reserved); + static void release(const ReservedSpace& reserved); }; class CodeMemoryReserver : AllStatic { diff --git a/src/hotspot/share/memory/metaspace/virtualSpaceNode.cpp b/src/hotspot/share/memory/metaspace/virtualSpaceNode.cpp index d21c6546cf5..df4e507b104 100644 --- a/src/hotspot/share/memory/metaspace/virtualSpaceNode.cpp +++ b/src/hotspot/share/memory/metaspace/virtualSpaceNode.cpp @@ -190,10 +190,7 @@ void VirtualSpaceNode::uncommit_range(MetaWord* p, size_t word_size) { } // Uncommit... - if (os::uncommit_memory((char*)p, word_size * BytesPerWord) == false) { - // Note: this can actually happen, since uncommit may increase the number of mappings. - fatal("Failed to uncommit metaspace."); - } + os::uncommit_memory((char*)p, word_size * BytesPerWord); ASAN_POISON_MEMORY_REGION((char*)p, word_size * BytesPerWord); diff --git a/src/hotspot/share/memory/virtualspace.cpp b/src/hotspot/share/memory/virtualspace.cpp index 92a168248d2..0627c0b9a8e 100644 --- a/src/hotspot/share/memory/virtualspace.cpp +++ b/src/hotspot/share/memory/virtualspace.cpp @@ -370,34 +370,22 @@ void VirtualSpace::shrink_by(size_t size) { assert(middle_high_boundary() <= aligned_upper_new_high && aligned_upper_new_high + upper_needs <= upper_high_boundary(), "must not shrink beyond region"); - if (!os::uncommit_memory(aligned_upper_new_high, upper_needs, _executable)) { - DEBUG_ONLY(warning("os::uncommit_memory failed")); - return; - } else { - _upper_high -= upper_needs; - } + os::uncommit_memory(aligned_upper_new_high, upper_needs, _executable); + _upper_high -= upper_needs; } if (middle_needs > 0) { assert(lower_high_boundary() <= aligned_middle_new_high && aligned_middle_new_high + middle_needs <= middle_high_boundary(), "must not shrink beyond region"); - if (!os::uncommit_memory(aligned_middle_new_high, middle_needs, _executable)) { - DEBUG_ONLY(warning("os::uncommit_memory failed")); - return; - } else { - _middle_high -= middle_needs; - } + os::uncommit_memory(aligned_middle_new_high, middle_needs, _executable); + _middle_high -= middle_needs; } if (lower_needs > 0) { assert(low_boundary() <= aligned_lower_new_high && aligned_lower_new_high + lower_needs <= lower_high_boundary(), "must not shrink beyond region"); - if (!os::uncommit_memory(aligned_lower_new_high, lower_needs, _executable)) { - DEBUG_ONLY(warning("os::uncommit_memory failed")); - return; - } else { - _lower_high -= lower_needs; - } + os::uncommit_memory(aligned_lower_new_high, lower_needs, _executable); + _lower_high -= lower_needs; } _high -= size; diff --git a/src/hotspot/share/runtime/os.cpp b/src/hotspot/share/runtime/os.cpp index 3a5a5745095..58774e59a34 100644 --- a/src/hotspot/share/runtime/os.cpp +++ b/src/hotspot/share/runtime/os.cpp @@ -2293,7 +2293,7 @@ void os::commit_memory_or_exit(char* addr, size_t size, size_t alignment_hint, // We do not have the same lock protection for pd_commit_memory and record_virtual_memory_commit. // We assume that there is some external synchronization that prevents a region from being uncommitted // before it is finished being committed. -bool os::uncommit_memory(char* addr, size_t bytes, bool executable) { +void os::uncommit_memory(char* addr, size_t bytes, bool executable) { assert_nonempty_range(addr, bytes); bool res; if (MemTracker::enabled()) { @@ -2306,13 +2306,10 @@ bool os::uncommit_memory(char* addr, size_t bytes, bool executable) { res = pd_uncommit_memory(addr, bytes, executable); } - if (res) { - log_debug(os, map)("Uncommitted " RANGEFMT, RANGEFMTARGS(addr, bytes)); - } else { - log_info(os, map)("Failed to uncommit " RANGEFMT, RANGEFMTARGS(addr, bytes)); + if (!res) { + fatal("Failed to uncommit " RANGEFMT, RANGEFMTARGS(addr, bytes)); } - - return res; + log_debug(os, map)("Uncommitted " RANGEFMT, RANGEFMTARGS(addr, bytes)); } // The scope of NmtVirtualMemoryLocker covers both pd_release_memory and record_virtual_memory_release because @@ -2320,7 +2317,7 @@ bool os::uncommit_memory(char* addr, size_t bytes, bool executable) { // We do not have the same lock protection for pd_reserve_memory and record_virtual_memory_reserve. // We assume that there is some external synchronization that prevents a region from being released // before it is finished being reserved. -bool os::release_memory(char* addr, size_t bytes) { +void os::release_memory(char* addr, size_t bytes) { assert_nonempty_range(addr, bytes); bool res; if (MemTracker::enabled()) { @@ -2333,11 +2330,9 @@ bool os::release_memory(char* addr, size_t bytes) { res = pd_release_memory(addr, bytes); } if (!res) { - log_info(os, map)("Failed to release " RANGEFMT, RANGEFMTARGS(addr, bytes)); - } else { - log_debug(os, map)("Released " RANGEFMT, RANGEFMTARGS(addr, bytes)); + fatal("Failed to release " RANGEFMT, RANGEFMTARGS(addr, bytes)); } - return res; + log_debug(os, map)("Released " RANGEFMT, RANGEFMTARGS(addr, bytes)); } // Prints all mappings @@ -2406,7 +2401,7 @@ char* os::map_memory(int fd, const char* file_name, size_t file_offset, return result; } -bool os::unmap_memory(char *addr, size_t bytes) { +void os::unmap_memory(char *addr, size_t bytes) { bool result; if (MemTracker::enabled()) { MemTracker::NmtVirtualMemoryLocker nvml; @@ -2417,7 +2412,9 @@ bool os::unmap_memory(char *addr, size_t bytes) { } else { result = pd_unmap_memory(addr, bytes); } - return result; + if (!result) { + fatal("Failed to unmap memory " RANGEFMT, RANGEFMTARGS(addr, bytes)); + } } void os::disclaim_memory(char *addr, size_t bytes) { @@ -2445,7 +2442,7 @@ char* os::reserve_memory_special(size_t size, size_t alignment, size_t page_size return result; } -bool os::release_memory_special(char* addr, size_t bytes) { +void os::release_memory_special(char* addr, size_t bytes) { bool res; if (MemTracker::enabled()) { MemTracker::NmtVirtualMemoryLocker nvml; @@ -2456,7 +2453,9 @@ bool os::release_memory_special(char* addr, size_t bytes) { } else { res = pd_release_memory_special(addr, bytes); } - return res; + if (!res) { + fatal("Failed to release memory special " RANGEFMT, RANGEFMTARGS(addr, bytes)); + } } // Convenience wrapper around naked_short_sleep to allow for longer sleep diff --git a/src/hotspot/share/runtime/os.hpp b/src/hotspot/share/runtime/os.hpp index c6a1d670926..e773b40cb14 100644 --- a/src/hotspot/share/runtime/os.hpp +++ b/src/hotspot/share/runtime/os.hpp @@ -536,8 +536,8 @@ class os: AllStatic { static void commit_memory_or_exit(char* addr, size_t size, size_t alignment_hint, bool executable, const char* mesg); - static bool uncommit_memory(char* addr, size_t bytes, bool executable = false); - static bool release_memory(char* addr, size_t bytes); + static void uncommit_memory(char* addr, size_t bytes, bool executable = false); + static void release_memory(char* addr, size_t bytes); // Does the platform support trimming the native heap? static bool can_trim_native_heap(); @@ -566,7 +566,7 @@ class os: AllStatic { static bool unguard_memory(char* addr, size_t bytes); static bool create_stack_guard_pages(char* addr, size_t bytes); static bool pd_create_stack_guard_pages(char* addr, size_t bytes); - static bool remove_stack_guard_pages(char* addr, size_t bytes); + static void remove_stack_guard_pages(char* addr, size_t bytes); // Helper function to create a new file with template jvmheap.XXXXXX. // Returns a valid fd on success or else returns -1 static int create_file_for_heap(const char* dir); @@ -582,7 +582,7 @@ class os: AllStatic { static char* map_memory(int fd, const char* file_name, size_t file_offset, char *addr, size_t bytes, MemTag mem_tag, bool read_only = false, bool allow_exec = false); - static bool unmap_memory(char *addr, size_t bytes); + static void unmap_memory(char *addr, size_t bytes); static void disclaim_memory(char *addr, size_t bytes); static void realign_memory(char *addr, size_t bytes, size_t alignment_hint); @@ -605,7 +605,7 @@ class os: AllStatic { // reserve, commit and pin the entire memory region static char* reserve_memory_special(size_t size, size_t alignment, size_t page_size, char* addr, bool executable); - static bool release_memory_special(char* addr, size_t bytes); + static void release_memory_special(char* addr, size_t bytes); static void large_page_init(); static size_t large_page_size(); static bool can_commit_large_page_memory(); diff --git a/src/hotspot/share/runtime/stackOverflow.cpp b/src/hotspot/share/runtime/stackOverflow.cpp index e2bd157c555..61dbce8c5b4 100644 --- a/src/hotspot/share/runtime/stackOverflow.cpp +++ b/src/hotspot/share/runtime/stackOverflow.cpp @@ -116,13 +116,8 @@ void StackOverflow::remove_stack_guard_pages() { size_t len = stack_guard_zone_size(); if (os::must_commit_stack_guard_pages()) { - if (os::remove_stack_guard_pages((char *) low_addr, len)) { - _stack_guard_state = stack_guard_unused; - } else { - log_warning(os, thread)("Attempt to deallocate stack guard pages failed (" - PTR_FORMAT "-" PTR_FORMAT ").", p2i(low_addr), p2i(low_addr + len)); - return; - } + os::remove_stack_guard_pages((char *) low_addr, len); + _stack_guard_state = stack_guard_unused; } else { if (_stack_guard_state == stack_guard_unused) return; if (os::unguard_memory((char *) low_addr, len)) { diff --git a/test/hotspot/gtest/gc/z/test_zVirtualMemoryManager.cpp b/test/hotspot/gtest/gc/z/test_zVirtualMemoryManager.cpp index 7c41dde04cb..f2a62fea57d 100644 --- a/test/hotspot/gtest/gc/z/test_zVirtualMemoryManager.cpp +++ b/test/hotspot/gtest/gc/z/test_zVirtualMemoryManager.cpp @@ -168,8 +168,7 @@ public: ASSERT_EQ(vmem, ZVirtualMemory(base_offset + 2 * ZGranuleSize, ZGranuleSize)); _reserver->unreserve(vmem); - const bool released = os::release_memory((char*)untype(blocked), ZGranuleSize); - ASSERT_TRUE(released); + os::release_memory((char*)untype(blocked), ZGranuleSize); } void test_remove_from_low() { diff --git a/test/hotspot/gtest/memory/test_virtualspace.cpp b/test/hotspot/gtest/memory/test_virtualspace.cpp index d2f8927ba28..70f442c5802 100644 --- a/test/hotspot/gtest/memory/test_virtualspace.cpp +++ b/test/hotspot/gtest/memory/test_virtualspace.cpp @@ -34,7 +34,7 @@ namespace { public: MemoryReleaser(ReservedSpace* rs) : _rs(rs) { } ~MemoryReleaser() { - EXPECT_TRUE(MemoryReserver::release(*_rs)); + MemoryReserver::release(*_rs); } }; @@ -355,9 +355,9 @@ class TestReservedSpace : AllStatic { static void release_memory_for_test(ReservedSpace rs) { if (rs.special()) { - EXPECT_TRUE(os::release_memory_special(rs.base(), rs.size())); + os::release_memory_special(rs.base(), rs.size()); } else { - EXPECT_TRUE(os::release_memory(rs.base(), rs.size())); + os::release_memory(rs.base(), rs.size()); } } diff --git a/test/hotspot/gtest/runtime/test_os.cpp b/test/hotspot/gtest/runtime/test_os.cpp index aee7b51e2b3..7f90a21884b 100644 --- a/test/hotspot/gtest/runtime/test_os.cpp +++ b/test/hotspot/gtest/runtime/test_os.cpp @@ -511,7 +511,7 @@ static inline bool can_reserve_executable_memory(void) { static void carefully_release_multiple(address start, int num_stripes, size_t stripe_len) { for (int stripe = 0; stripe < num_stripes; stripe++) { address q = start + (stripe * stripe_len); - EXPECT_TRUE(os::release_memory((char*)q, stripe_len)); + os::release_memory((char*)q, stripe_len); } } @@ -534,7 +534,7 @@ static address reserve_multiple(int num_stripes, size_t stripe_len) { p = (address)os::reserve_memory(total_range_len, mtTest); EXPECT_NE(p, (address)nullptr); // .. release it... - EXPECT_TRUE(os::release_memory((char*)p, total_range_len)); + os::release_memory((char*)p, total_range_len); // ... re-reserve in the same spot multiple areas... for (int stripe = 0; stripe < num_stripes; stripe++) { address q = p + (stripe * stripe_len); @@ -627,7 +627,7 @@ TEST_VM(os, release_multi_mappings) { // On Windows, temporarily switch on UseNUMAInterleaving to allow release_memory to release // multiple mappings in one go (otherwise we assert, which we test too, see death test below). WINDOWS_ONLY(NUMASwitcher b(true);) - ASSERT_TRUE(os::release_memory((char*)p_middle_stripes, middle_stripe_len)); + os::release_memory((char*)p_middle_stripes, middle_stripe_len); } PRINT_MAPPINGS("B"); @@ -641,7 +641,7 @@ TEST_VM(os, release_multi_mappings) { // Clean up. Release all mappings. { WINDOWS_ONLY(NUMASwitcher b(true);) // allow release_memory to release multiple regions - ASSERT_TRUE(os::release_memory((char*)p, total_range_len)); + os::release_memory((char*)p, total_range_len); } } #endif // !AIX @@ -650,29 +650,54 @@ TEST_VM(os, release_multi_mappings) { // On Windows, test that we recognize bad ranges. // On debug this would assert. Test that too. // On other platforms, we are unable to recognize bad ranges. -#ifdef ASSERT -TEST_VM_ASSERT_MSG(os, release_bad_ranges, ".*bad release") { -#else -TEST_VM(os, release_bad_ranges) { -#endif - char* p = os::reserve_memory(4 * M, mtTest); - ASSERT_NE(p, (char*)nullptr); - // Release part of range - ASSERT_FALSE(os::release_memory(p, M)); - // Release part of range - ASSERT_FALSE(os::release_memory(p + M, M)); - // Release more than the range (explicitly switch off NUMA here - // to make os::release_memory() test more strictly and to not - // accidentally release neighbors) - { - NUMASwitcher b(false); - ASSERT_FALSE(os::release_memory(p, M * 5)); - ASSERT_FALSE(os::release_memory(p - M, M * 5)); - ASSERT_FALSE(os::release_memory(p - M, M * 6)); - } - ASSERT_TRUE(os::release_memory(p, 4 * M)); // Release for real - ASSERT_FALSE(os::release_memory(p, 4 * M)); // Again, should fail +#ifdef ASSERT +#define TEST_RELEASE_RANGE_ERROR(name) TEST_VM_ASSERT_MSG(os, name, ".*bad release") +#else +#define TEST_RELEASE_RANGE_ERROR(name) TEST_VM_FATAL_ERROR_MSG(os, name, ".*Failed to release.*") +#endif + +static char* setup_release_test_memory() { + char* p = os::reserve_memory(4 * M, mtTest); + EXPECT_NE(p, (char*)nullptr); + return p; +} + +TEST_RELEASE_RANGE_ERROR(release_bad_range_start) { + char* p = setup_release_test_memory(); + os::release_memory(p, M); // Release part of the range +} + +TEST_RELEASE_RANGE_ERROR(release_bad_range_middle) { + char* p = setup_release_test_memory(); + os::release_memory(p + M, M); // Release middle part +} + +// Release more than the range (explicitly switch off NUMA here +// to make os::release_memory() test more strict and to not +// accidentally release neighbors) +TEST_RELEASE_RANGE_ERROR(release_beyond_range1) { + char* p = setup_release_test_memory(); + NUMASwitcher b(false); + os::release_memory(p, M * 5); +} + +TEST_RELEASE_RANGE_ERROR(release_beyond_range2) { + char* p = setup_release_test_memory(); + NUMASwitcher b(false); + os::release_memory(p - M, M * 5); +} + +TEST_RELEASE_RANGE_ERROR(release_beyond_range3) { + char* p = setup_release_test_memory(); + NUMASwitcher b(false); + os::release_memory(p - M, M * 6); +} + +TEST_RELEASE_RANGE_ERROR(release_already_released) { + char* p = setup_release_test_memory(); + os::release_memory(p, 4 * M); // Release for real + os::release_memory(p, 4 * M); // Again, should fail } #endif // _WIN32 @@ -695,11 +720,11 @@ TEST_VM(os, release_one_mapping_multi_commits) { ASSERT_TRUE(p2 == nullptr || p2 == border); - ASSERT_TRUE(os::release_memory((char*)p, total_range_len)); + os::release_memory((char*)p, total_range_len); PRINT_MAPPINGS("C"); if (p2 != nullptr) { - ASSERT_TRUE(os::release_memory((char*)p2, stripe_len)); + os::release_memory((char*)p2, stripe_len); PRINT_MAPPINGS("D"); } } @@ -772,7 +797,7 @@ TEST_VM(os, find_mapping_simple) { if (os::win32::find_mapping(p + total_range_len, &mapping_info)) { ASSERT_NE(mapping_info.base, p); } - ASSERT_TRUE(os::release_memory((char*)p, total_range_len)); + os::release_memory((char*)p, total_range_len); PRINT_MAPPINGS("B"); ASSERT_FALSE(os::win32::find_mapping(p, &mapping_info)); } @@ -801,7 +826,7 @@ TEST_VM(os, find_mapping_2) { if (os::win32::find_mapping(p + total_range_len, &mapping_info)) { ASSERT_NE(mapping_info.base, p); } - ASSERT_TRUE(os::release_memory((char*)p, total_range_len)); + os::release_memory((char*)p, total_range_len); PRINT_MAPPINGS("B"); ASSERT_FALSE(os::win32::find_mapping(p, &mapping_info)); } @@ -1132,11 +1157,11 @@ TEST_VM(os, commit_memory_or_exit) { ASSERT_NOT_NULL(base); os::commit_memory_or_exit(base, size, false, "Commit failed."); strcpy(base, letters); - ASSERT_TRUE(os::uncommit_memory(base, size, false)); + os::uncommit_memory(base, size, false); os::commit_memory_or_exit(base, size, page_sz, false, "Commit with alignment hint failed."); strcpy(base, letters); - ASSERT_TRUE(os::uncommit_memory(base, size, false)); - EXPECT_TRUE(os::release_memory(base, size)); + os::uncommit_memory(base, size, false); + os::release_memory(base, size); } #if !defined(_AIX) @@ -1152,7 +1177,7 @@ TEST_VM(os, map_memory_to_file) { char* result = os::map_memory_to_file(size, fd, mtTest); ASSERT_NOT_NULL(result); EXPECT_EQ(strcmp(letters, result), 0); - EXPECT_TRUE(os::unmap_memory(result, size)); + os::unmap_memory(result, size); ::close(fd); } @@ -1169,7 +1194,7 @@ TEST_VM(os, map_unmap_memory) { char* result = os::map_memory(fd, path, 0, nullptr, size, mtTest, true, false); ASSERT_NOT_NULL(result); EXPECT_EQ(strcmp(letters, result), 0); - EXPECT_TRUE(os::unmap_memory(result, size)); + os::unmap_memory(result, size); ::close(fd); } @@ -1184,7 +1209,7 @@ TEST_VM(os, map_memory_to_file_aligned) { char* result = os::map_memory_to_file_aligned(os::vm_allocation_granularity(), os::vm_allocation_granularity(), fd, mtTest); ASSERT_NOT_NULL(result); EXPECT_EQ(strcmp(letters, result), 0); - EXPECT_TRUE(os::unmap_memory(result, os::vm_allocation_granularity())); + os::unmap_memory(result, os::vm_allocation_granularity()); ::close(fd); } diff --git a/test/hotspot/gtest/runtime/test_os_linux.cpp b/test/hotspot/gtest/runtime/test_os_linux.cpp index c8467784b0a..337365592dc 100644 --- a/test/hotspot/gtest/runtime/test_os_linux.cpp +++ b/test/hotspot/gtest/runtime/test_os_linux.cpp @@ -379,8 +379,8 @@ TEST_VM(os_linux, pretouch_thp_and_use_concurrent) { for (int i = 0; i < 1000; i++) EXPECT_EQ(*iptr++, i); - EXPECT_TRUE(os::uncommit_memory(heap, size, false)); - EXPECT_TRUE(os::release_memory(heap, size)); + os::uncommit_memory(heap, size, false); + os::release_memory(heap, size); UseTransparentHugePages = useThp; } diff --git a/test/hotspot/jtreg/runtime/os/TestMemoryAllocationLogging.java b/test/hotspot/jtreg/runtime/os/TestMemoryAllocationLogging.java index 9f4f4baeead..60f6d29f16d 100644 --- a/test/hotspot/jtreg/runtime/os/TestMemoryAllocationLogging.java +++ b/test/hotspot/jtreg/runtime/os/TestMemoryAllocationLogging.java @@ -157,7 +157,7 @@ public class TestMemoryAllocationLogging { expectedLogs = new String[] { /* Debug level log */ String.format("Reserved \\[0x.* - 0x.*\\), \\(%d bytes\\)", PAGE_SIZE), - "Failed to uncommit \\[0x.* - 0x.*\\), \\(.* bytes\\)", + "fatal error: Failed to uncommit \\[0x.* - 0x.*\\), \\(.* bytes\\).*", /* Trace level log */ "mmap failed: \\[0x.* - 0x.*\\), \\(.* bytes\\) errno=\\(Invalid argument\\)" }; From 3e9911c19fa58cfca2b32fd795777eedc8733650 Mon Sep 17 00:00:00 2001 From: Yasumasa Suenaga Date: Fri, 13 Feb 2026 06:35:17 +0000 Subject: [PATCH 091/120] 8377710: Test serviceability/sa/TestJhsdbJstackMixed.java encountered Driver timeout Reviewed-by: dholmes, cjplummer --- .../jtreg/serviceability/sa/TestJhsdbJstackMixed.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixed.java b/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixed.java index 42ff12e519d..e90418b1030 100644 --- a/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixed.java +++ b/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixed.java @@ -27,6 +27,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import jdk.test.lib.JDKToolLauncher; +import jdk.test.lib.Platform; import jdk.test.lib.SA.SATestUtils; import jdk.test.lib.Utils; import jdk.test.lib.apps.LingeredApp; @@ -35,7 +36,7 @@ import jdk.test.lib.process.OutputAnalyzer; /** * @test * @key randomness - * @bug 8208091 8374469 + * @bug 8208091 8374469 8377710 * @requires (os.family == "linux" | os.family == "windows") & (vm.hasSA) * @requires (os.arch != "riscv64" | !(vm.cpu.features ~= ".*qemu.*")) * @library /test/lib @@ -152,6 +153,11 @@ public class TestJhsdbJstackMixed { System.err.println(out.getStderr()); out.shouldContain(LingeredAppWithNativeMethod.THREAD_NAME); + out.shouldNotContain("sun.jvm.hotspot.debugger.UnmappedAddressException:"); + if (Platform.isWindows()) { + // We need to check stdout/stderr only once on Windows. + break; + } if (isFibAndAlignedAddress(out.asLines())) { System.out.println("DEBUG: Test triggered interesting condition."); out.shouldNotContain("sun.jvm.hotspot.debugger.UnmappedAddressException:"); @@ -160,7 +166,6 @@ public class TestJhsdbJstackMixed { } System.out.println("DEBUG: Iteration: " + (i + 1) + " - Test didn't trigger interesting condition."); - out.shouldNotContain("sun.jvm.hotspot.debugger.UnmappedAddressException:"); } System.out.println("DEBUG: Test didn't trigger interesting condition " + "but no UnmappedAddressException was thrown. PASS!"); From 93c87ffe4037221725798f6d0ba78cb20d67fcab Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Fri, 13 Feb 2026 07:41:33 +0000 Subject: [PATCH 092/120] 8377128: Add missing @Override annotations in "java.beans.*" packages Reviewed-by: tr, prr --- .../classes/java/beans/BeanDescriptor.java | 3 +- .../share/classes/java/beans/Beans.java | 3 +- .../beans/DefaultPersistenceDelegate.java | 5 +- .../classes/java/beans/EventHandler.java | 3 +- .../java/beans/EventSetDescriptor.java | 3 +- .../share/classes/java/beans/Expression.java | 4 +- .../classes/java/beans/FeatureDescriptor.java | 3 +- .../beans/IndexedPropertyChangeEvent.java | 3 +- .../java/beans/IndexedPropertyDescriptor.java | 6 +- .../classes/java/beans/Introspector.java | 9 ++- .../share/classes/java/beans/MetaData.java | 81 ++++++++++++++++++- .../classes/java/beans/MethodDescriptor.java | 3 +- .../java/beans/PropertyChangeEvent.java | 3 +- .../beans/PropertyChangeListenerProxy.java | 3 +- .../java/beans/PropertyChangeSupport.java | 3 +- .../java/beans/PropertyDescriptor.java | 6 +- .../java/beans/PropertyEditorSupport.java | 14 +++- .../share/classes/java/beans/Statement.java | 4 +- .../java/beans/ThreadGroupContext.java | 3 +- .../beans/VetoableChangeListenerProxy.java | 3 +- .../java/beans/VetoableChangeSupport.java | 3 +- .../share/classes/java/beans/XMLDecoder.java | 3 +- .../share/classes/java/beans/XMLEncoder.java | 7 +- .../beancontext/BeanContextChildSupport.java | 10 ++- .../BeanContextServicesSupport.java | 24 +++++- .../beans/beancontext/BeanContextSupport.java | 33 +++++++- 26 files changed, 219 insertions(+), 26 deletions(-) diff --git a/src/java.desktop/share/classes/java/beans/BeanDescriptor.java b/src/java.desktop/share/classes/java/beans/BeanDescriptor.java index e0428abb3b9..f276b6086af 100644 --- a/src/java.desktop/share/classes/java/beans/BeanDescriptor.java +++ b/src/java.desktop/share/classes/java/beans/BeanDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -118,6 +118,7 @@ public class BeanDescriptor extends FeatureDescriptor { customizerClassRef = old.customizerClassRef; } + @Override void appendTo(StringBuilder sb) { appendTo(sb, "beanClass", this.beanClassRef); appendTo(sb, "customizerClass", this.customizerClassRef); diff --git a/src/java.desktop/share/classes/java/beans/Beans.java b/src/java.desktop/share/classes/java/beans/Beans.java index db94f413ccc..de706fe4451 100644 --- a/src/java.desktop/share/classes/java/beans/Beans.java +++ b/src/java.desktop/share/classes/java/beans/Beans.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -340,6 +340,7 @@ class ObjectInputStreamWithLoader extends ObjectInputStream /** * Use the given ClassLoader rather than using the system class */ + @Override @SuppressWarnings("rawtypes") protected Class resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException { diff --git a/src/java.desktop/share/classes/java/beans/DefaultPersistenceDelegate.java b/src/java.desktop/share/classes/java/beans/DefaultPersistenceDelegate.java index 8e4d3f0577c..a305ce81b3c 100644 --- a/src/java.desktop/share/classes/java/beans/DefaultPersistenceDelegate.java +++ b/src/java.desktop/share/classes/java/beans/DefaultPersistenceDelegate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -130,6 +130,7 @@ public class DefaultPersistenceDelegate extends PersistenceDelegate { * * @see #DefaultPersistenceDelegate(String[]) */ + @Override protected boolean mutatesTo(Object oldInstance, Object newInstance) { // Assume the instance is either mutable or a singleton // if it has a nullary constructor. @@ -153,6 +154,7 @@ public class DefaultPersistenceDelegate extends PersistenceDelegate { * * @see #DefaultPersistenceDelegate(String[]) */ + @Override protected Expression instantiate(Object oldInstance, Encoder out) { int nArgs = constructor.length; Class type = oldInstance.getClass(); @@ -393,6 +395,7 @@ public class DefaultPersistenceDelegate extends PersistenceDelegate { * @see java.beans.Introspector#getBeanInfo * @see java.beans.PropertyDescriptor */ + @Override protected void initialize(Class type, Object oldInstance, Object newInstance, Encoder out) diff --git a/src/java.desktop/share/classes/java/beans/EventHandler.java b/src/java.desktop/share/classes/java/beans/EventHandler.java index cdda3d940d5..60f4e7bafda 100644 --- a/src/java.desktop/share/classes/java/beans/EventHandler.java +++ b/src/java.desktop/share/classes/java/beans/EventHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -415,6 +415,7 @@ public class EventHandler implements InvocationHandler { * * @see EventHandler */ + @Override public Object invoke(final Object proxy, final Method method, final Object[] arguments) { String methodName = method.getName(); if (method.getDeclaringClass() == Object.class) { diff --git a/src/java.desktop/share/classes/java/beans/EventSetDescriptor.java b/src/java.desktop/share/classes/java/beans/EventSetDescriptor.java index 8826ff27902..5855fabf2e5 100644 --- a/src/java.desktop/share/classes/java/beans/EventSetDescriptor.java +++ b/src/java.desktop/share/classes/java/beans/EventSetDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -536,6 +536,7 @@ public class EventSetDescriptor extends FeatureDescriptor { inDefaultEventSet = old.inDefaultEventSet; } + @Override void appendTo(StringBuilder sb) { appendTo(sb, "unicast", this.unicast); appendTo(sb, "inDefaultEventSet", this.inDefaultEventSet); diff --git a/src/java.desktop/share/classes/java/beans/Expression.java b/src/java.desktop/share/classes/java/beans/Expression.java index 21e9e4a4dc0..94fbb76fda3 100644 --- a/src/java.desktop/share/classes/java/beans/Expression.java +++ b/src/java.desktop/share/classes/java/beans/Expression.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -169,6 +169,7 @@ public class Expression extends Statement { this.value = value; } + @Override /*pp*/ String instanceName(Object instance) { return instance == unbound ? "" : super.instanceName(instance); } @@ -176,6 +177,7 @@ public class Expression extends Statement { /** * Prints the value of this expression using a Java-style syntax. */ + @Override public String toString() { return instanceName(value) + "=" + super.toString(); } diff --git a/src/java.desktop/share/classes/java/beans/FeatureDescriptor.java b/src/java.desktop/share/classes/java/beans/FeatureDescriptor.java index 0756d39da7a..ea1bc64534e 100644 --- a/src/java.desktop/share/classes/java/beans/FeatureDescriptor.java +++ b/src/java.desktop/share/classes/java/beans/FeatureDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -406,6 +406,7 @@ public class FeatureDescriptor { * * @since 1.7 */ + @Override public String toString() { StringBuilder sb = new StringBuilder(getClass().getName()); sb.append("[name=").append(this.name); diff --git a/src/java.desktop/share/classes/java/beans/IndexedPropertyChangeEvent.java b/src/java.desktop/share/classes/java/beans/IndexedPropertyChangeEvent.java index 90c0fb109d2..0886f1fc23d 100644 --- a/src/java.desktop/share/classes/java/beans/IndexedPropertyChangeEvent.java +++ b/src/java.desktop/share/classes/java/beans/IndexedPropertyChangeEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -83,6 +83,7 @@ public class IndexedPropertyChangeEvent extends PropertyChangeEvent { return index; } + @Override void appendTo(StringBuilder sb) { sb.append("; index=").append(getIndex()); } diff --git a/src/java.desktop/share/classes/java/beans/IndexedPropertyDescriptor.java b/src/java.desktop/share/classes/java/beans/IndexedPropertyDescriptor.java index a46c8ec9d6e..d0a9529e325 100644 --- a/src/java.desktop/share/classes/java/beans/IndexedPropertyDescriptor.java +++ b/src/java.desktop/share/classes/java/beans/IndexedPropertyDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -400,6 +400,7 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor { * * @since 1.4 */ + @Override public boolean equals(Object obj) { // Note: This would be identical to PropertyDescriptor but they don't // share the same fields. @@ -485,6 +486,7 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor { indexedReadMethodName = old.indexedReadMethodName; } + @Override void updateGenericsFor(Class type) { super.updateGenericsFor(type); try { @@ -502,6 +504,7 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor { * @return a hash code value for this object. * @since 1.5 */ + @Override public int hashCode() { int result = super.hashCode(); @@ -515,6 +518,7 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor { return result; } + @Override void appendTo(StringBuilder sb) { super.appendTo(sb); appendTo(sb, "indexedPropertyType", this.indexedPropertyTypeRef); diff --git a/src/java.desktop/share/classes/java/beans/Introspector.java b/src/java.desktop/share/classes/java/beans/Introspector.java index 564021104a7..cce046b8ec0 100644 --- a/src/java.desktop/share/classes/java/beans/Introspector.java +++ b/src/java.desktop/share/classes/java/beans/Introspector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1345,30 +1345,37 @@ class GenericBeanInfo extends SimpleBeanInfo { this.targetBeanInfoRef = old.targetBeanInfoRef; } + @Override public PropertyDescriptor[] getPropertyDescriptors() { return properties; } + @Override public int getDefaultPropertyIndex() { return defaultProperty; } + @Override public EventSetDescriptor[] getEventSetDescriptors() { return events; } + @Override public int getDefaultEventIndex() { return defaultEvent; } + @Override public MethodDescriptor[] getMethodDescriptors() { return methods; } + @Override public BeanDescriptor getBeanDescriptor() { return beanDescriptor; } + @Override public java.awt.Image getIcon(int iconKind) { BeanInfo targetBeanInfo = getTargetBeanInfo(); if (targetBeanInfo != null) { diff --git a/src/java.desktop/share/classes/java/beans/MetaData.java b/src/java.desktop/share/classes/java/beans/MetaData.java index 347ac8ad555..baed32af44d 100644 --- a/src/java.desktop/share/classes/java/beans/MetaData.java +++ b/src/java.desktop/share/classes/java/beans/MetaData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -66,10 +66,13 @@ class MetaData { static final class NullPersistenceDelegate extends PersistenceDelegate { // Note this will be called by all classes when they reach the // top of their superclass chain. + @Override protected void initialize(Class type, Object oldInstance, Object newInstance, Encoder out) { } + @Override protected Expression instantiate(Object oldInstance, Encoder out) { return null; } + @Override public void writeObject(Object oldInstance, Encoder out) { // System.out.println("NullPersistenceDelegate:writeObject " + oldInstance); } @@ -81,10 +84,12 @@ static final class NullPersistenceDelegate extends PersistenceDelegate { * @author Sergey A. Malenkov */ static final class EnumPersistenceDelegate extends PersistenceDelegate { + @Override protected boolean mutatesTo(Object oldInstance, Object newInstance) { return oldInstance == newInstance; } + @Override protected Expression instantiate(Object oldInstance, Encoder out) { Enum e = (Enum) oldInstance; return new Expression(e, Enum.class, "valueOf", new Object[]{e.getDeclaringClass(), e.name()}); @@ -92,10 +97,12 @@ static final class EnumPersistenceDelegate extends PersistenceDelegate { } static final class PrimitivePersistenceDelegate extends PersistenceDelegate { + @Override protected boolean mutatesTo(Object oldInstance, Object newInstance) { return oldInstance.equals(newInstance); } + @Override protected Expression instantiate(Object oldInstance, Encoder out) { return new Expression(oldInstance, oldInstance.getClass(), "new", new Object[]{oldInstance.toString()}); @@ -103,12 +110,14 @@ static final class PrimitivePersistenceDelegate extends PersistenceDelegate { } static final class ArrayPersistenceDelegate extends PersistenceDelegate { + @Override protected boolean mutatesTo(Object oldInstance, Object newInstance) { return (newInstance != null && oldInstance.getClass() == newInstance.getClass() && // Also ensures the subtype is correct. Array.getLength(oldInstance) == Array.getLength(newInstance)); } + @Override protected Expression instantiate(Object oldInstance, Encoder out) { // System.out.println("instantiate: " + type + " " + oldInstance); Class oldClass = oldInstance.getClass(); @@ -117,6 +126,7 @@ static final class ArrayPersistenceDelegate extends PersistenceDelegate { Array.getLength(oldInstance)}); } + @Override protected void initialize(Class type, Object oldInstance, Object newInstance, Encoder out) { int n = Array.getLength(oldInstance); for (int i = 0; i < n; i++) { @@ -144,6 +154,7 @@ static final class ArrayPersistenceDelegate extends PersistenceDelegate { } static final class ProxyPersistenceDelegate extends PersistenceDelegate { + @Override protected Expression instantiate(Object oldInstance, Encoder out) { Class type = oldInstance.getClass(); java.lang.reflect.Proxy p = (java.lang.reflect.Proxy)oldInstance; @@ -180,8 +191,10 @@ static final class ProxyPersistenceDelegate extends PersistenceDelegate { // Strings static final class java_lang_String_PersistenceDelegate extends PersistenceDelegate { + @Override protected Expression instantiate(Object oldInstance, Encoder out) { return null; } + @Override public void writeObject(Object oldInstance, Encoder out) { // System.out.println("NullPersistenceDelegate:writeObject " + oldInstance); } @@ -189,10 +202,12 @@ static final class java_lang_String_PersistenceDelegate extends PersistenceDeleg // Classes static final class java_lang_Class_PersistenceDelegate extends PersistenceDelegate { + @Override protected boolean mutatesTo(Object oldInstance, Object newInstance) { return oldInstance.equals(newInstance); } + @Override protected Expression instantiate(Object oldInstance, Encoder out) { Class c = (Class)oldInstance; // As of 1.3 it is not possible to call Class.forName("int"), @@ -223,10 +238,12 @@ static final class java_lang_Class_PersistenceDelegate extends PersistenceDelega // Fields static final class java_lang_reflect_Field_PersistenceDelegate extends PersistenceDelegate { + @Override protected boolean mutatesTo(Object oldInstance, Object newInstance) { return oldInstance.equals(newInstance); } + @Override protected Expression instantiate(Object oldInstance, Encoder out) { Field f = (Field)oldInstance; return new Expression(oldInstance, @@ -238,10 +255,12 @@ static final class java_lang_reflect_Field_PersistenceDelegate extends Persisten // Methods static final class java_lang_reflect_Method_PersistenceDelegate extends PersistenceDelegate { + @Override protected boolean mutatesTo(Object oldInstance, Object newInstance) { return oldInstance.equals(newInstance); } + @Override protected Expression instantiate(Object oldInstance, Encoder out) { Method m = (Method)oldInstance; return new Expression(oldInstance, @@ -262,6 +281,7 @@ static final class java_lang_reflect_Method_PersistenceDelegate extends Persiste * @author Sergey A. Malenkov */ static class java_util_Date_PersistenceDelegate extends PersistenceDelegate { + @Override protected boolean mutatesTo(Object oldInstance, Object newInstance) { if (!super.mutatesTo(oldInstance, newInstance)) { return false; @@ -272,6 +292,7 @@ static class java_util_Date_PersistenceDelegate extends PersistenceDelegate { return oldDate.getTime() == newDate.getTime(); } + @Override protected Expression instantiate(Object oldInstance, Encoder out) { Date date = (Date)oldInstance; return new Expression(date, date.getClass(), "new", new Object[] {date.getTime()}); @@ -318,6 +339,7 @@ static final class java_sql_Timestamp_PersistenceDelegate extends java_util_Date } } + @Override protected void initialize(Class type, Object oldInstance, Object newInstance, Encoder out) { // assumes oldInstance and newInstance are Timestamps int nanos = getNanos(oldInstance); @@ -349,6 +371,7 @@ delegates to be registered with concrete classes. * @author Sergey A. Malenkov */ private abstract static class java_util_Collections extends PersistenceDelegate { + @Override protected boolean mutatesTo(Object oldInstance, Object newInstance) { if (!super.mutatesTo(oldInstance, newInstance)) { return false; @@ -361,29 +384,34 @@ private abstract static class java_util_Collections extends PersistenceDelegate return (oldC.size() == newC.size()) && oldC.containsAll(newC); } + @Override protected void initialize(Class type, Object oldInstance, Object newInstance, Encoder out) { // do not initialize these custom collections in default way } static final class EmptyList_PersistenceDelegate extends java_util_Collections { + @Override protected Expression instantiate(Object oldInstance, Encoder out) { return new Expression(oldInstance, Collections.class, "emptyList", null); } } static final class EmptySet_PersistenceDelegate extends java_util_Collections { + @Override protected Expression instantiate(Object oldInstance, Encoder out) { return new Expression(oldInstance, Collections.class, "emptySet", null); } } static final class EmptyMap_PersistenceDelegate extends java_util_Collections { + @Override protected Expression instantiate(Object oldInstance, Encoder out) { return new Expression(oldInstance, Collections.class, "emptyMap", null); } } static final class SingletonList_PersistenceDelegate extends java_util_Collections { + @Override protected Expression instantiate(Object oldInstance, Encoder out) { List list = (List) oldInstance; return new Expression(oldInstance, Collections.class, "singletonList", new Object[]{list.get(0)}); @@ -391,6 +419,7 @@ private abstract static class java_util_Collections extends PersistenceDelegate } static final class SingletonSet_PersistenceDelegate extends java_util_Collections { + @Override protected Expression instantiate(Object oldInstance, Encoder out) { Set set = (Set) oldInstance; return new Expression(oldInstance, Collections.class, "singleton", new Object[]{set.iterator().next()}); @@ -398,6 +427,7 @@ private abstract static class java_util_Collections extends PersistenceDelegate } static final class SingletonMap_PersistenceDelegate extends java_util_Collections { + @Override protected Expression instantiate(Object oldInstance, Encoder out) { Map map = (Map) oldInstance; Object key = map.keySet().iterator().next(); @@ -406,6 +436,7 @@ private abstract static class java_util_Collections extends PersistenceDelegate } static final class UnmodifiableCollection_PersistenceDelegate extends java_util_Collections { + @Override protected Expression instantiate(Object oldInstance, Encoder out) { List list = new ArrayList<>((Collection) oldInstance); return new Expression(oldInstance, Collections.class, "unmodifiableCollection", new Object[]{list}); @@ -413,6 +444,7 @@ private abstract static class java_util_Collections extends PersistenceDelegate } static final class UnmodifiableList_PersistenceDelegate extends java_util_Collections { + @Override protected Expression instantiate(Object oldInstance, Encoder out) { List list = new LinkedList<>((Collection) oldInstance); return new Expression(oldInstance, Collections.class, "unmodifiableList", new Object[]{list}); @@ -420,6 +452,7 @@ private abstract static class java_util_Collections extends PersistenceDelegate } static final class UnmodifiableRandomAccessList_PersistenceDelegate extends java_util_Collections { + @Override protected Expression instantiate(Object oldInstance, Encoder out) { List list = new ArrayList<>((Collection) oldInstance); return new Expression(oldInstance, Collections.class, "unmodifiableList", new Object[]{list}); @@ -427,6 +460,7 @@ private abstract static class java_util_Collections extends PersistenceDelegate } static final class UnmodifiableSet_PersistenceDelegate extends java_util_Collections { + @Override protected Expression instantiate(Object oldInstance, Encoder out) { Set set = new HashSet<>((Set) oldInstance); return new Expression(oldInstance, Collections.class, "unmodifiableSet", new Object[]{set}); @@ -434,6 +468,7 @@ private abstract static class java_util_Collections extends PersistenceDelegate } static final class UnmodifiableSortedSet_PersistenceDelegate extends java_util_Collections { + @Override protected Expression instantiate(Object oldInstance, Encoder out) { SortedSet set = new TreeSet<>((SortedSet) oldInstance); return new Expression(oldInstance, Collections.class, "unmodifiableSortedSet", new Object[]{set}); @@ -441,6 +476,7 @@ private abstract static class java_util_Collections extends PersistenceDelegate } static final class UnmodifiableMap_PersistenceDelegate extends java_util_Collections { + @Override protected Expression instantiate(Object oldInstance, Encoder out) { Map map = new HashMap<>((Map) oldInstance); return new Expression(oldInstance, Collections.class, "unmodifiableMap", new Object[]{map}); @@ -448,6 +484,7 @@ private abstract static class java_util_Collections extends PersistenceDelegate } static final class UnmodifiableSortedMap_PersistenceDelegate extends java_util_Collections { + @Override protected Expression instantiate(Object oldInstance, Encoder out) { SortedMap map = new TreeMap<>((SortedMap) oldInstance); return new Expression(oldInstance, Collections.class, "unmodifiableSortedMap", new Object[]{map}); @@ -455,6 +492,7 @@ private abstract static class java_util_Collections extends PersistenceDelegate } static final class SynchronizedCollection_PersistenceDelegate extends java_util_Collections { + @Override protected Expression instantiate(Object oldInstance, Encoder out) { List list = new ArrayList<>((Collection) oldInstance); return new Expression(oldInstance, Collections.class, "synchronizedCollection", new Object[]{list}); @@ -462,6 +500,7 @@ private abstract static class java_util_Collections extends PersistenceDelegate } static final class SynchronizedList_PersistenceDelegate extends java_util_Collections { + @Override protected Expression instantiate(Object oldInstance, Encoder out) { List list = new LinkedList<>((Collection) oldInstance); return new Expression(oldInstance, Collections.class, "synchronizedList", new Object[]{list}); @@ -469,6 +508,7 @@ private abstract static class java_util_Collections extends PersistenceDelegate } static final class SynchronizedRandomAccessList_PersistenceDelegate extends java_util_Collections { + @Override protected Expression instantiate(Object oldInstance, Encoder out) { List list = new ArrayList<>((Collection) oldInstance); return new Expression(oldInstance, Collections.class, "synchronizedList", new Object[]{list}); @@ -476,6 +516,7 @@ private abstract static class java_util_Collections extends PersistenceDelegate } static final class SynchronizedSet_PersistenceDelegate extends java_util_Collections { + @Override protected Expression instantiate(Object oldInstance, Encoder out) { Set set = new HashSet<>((Set) oldInstance); return new Expression(oldInstance, Collections.class, "synchronizedSet", new Object[]{set}); @@ -483,6 +524,7 @@ private abstract static class java_util_Collections extends PersistenceDelegate } static final class SynchronizedSortedSet_PersistenceDelegate extends java_util_Collections { + @Override protected Expression instantiate(Object oldInstance, Encoder out) { SortedSet set = new TreeSet<>((SortedSet) oldInstance); return new Expression(oldInstance, Collections.class, "synchronizedSortedSet", new Object[]{set}); @@ -490,6 +532,7 @@ private abstract static class java_util_Collections extends PersistenceDelegate } static final class SynchronizedMap_PersistenceDelegate extends java_util_Collections { + @Override protected Expression instantiate(Object oldInstance, Encoder out) { Map map = new HashMap<>((Map) oldInstance); return new Expression(oldInstance, Collections.class, "synchronizedMap", new Object[]{map}); @@ -497,6 +540,7 @@ private abstract static class java_util_Collections extends PersistenceDelegate } static final class SynchronizedSortedMap_PersistenceDelegate extends java_util_Collections { + @Override protected Expression instantiate(Object oldInstance, Encoder out) { SortedMap map = new TreeMap<>((SortedMap) oldInstance); return new Expression(oldInstance, Collections.class, "synchronizedSortedMap", new Object[]{map}); @@ -506,6 +550,7 @@ private abstract static class java_util_Collections extends PersistenceDelegate // Collection static class java_util_Collection_PersistenceDelegate extends DefaultPersistenceDelegate { + @Override protected void initialize(Class type, Object oldInstance, Object newInstance, Encoder out) { java.util.Collection oldO = (java.util.Collection)oldInstance; java.util.Collection newO = (java.util.Collection)newInstance; @@ -521,6 +566,7 @@ static class java_util_Collection_PersistenceDelegate extends DefaultPersistence // List static class java_util_List_PersistenceDelegate extends DefaultPersistenceDelegate { + @Override protected void initialize(Class type, Object oldInstance, Object newInstance, Encoder out) { java.util.List oldO = (java.util.List)oldInstance; java.util.List newO = (java.util.List)newInstance; @@ -556,6 +602,7 @@ static class java_util_List_PersistenceDelegate extends DefaultPersistenceDelega // Map static class java_util_Map_PersistenceDelegate extends DefaultPersistenceDelegate { + @Override protected void initialize(Class type, Object oldInstance, Object newInstance, Encoder out) { // System.out.println("Initializing: " + newInstance); java.util.Map oldMap = (java.util.Map)oldInstance; @@ -612,10 +659,12 @@ static final class java_beans_beancontext_BeanContextSupport_PersistenceDelegate * @author Sergey A. Malenkov */ static final class java_awt_Insets_PersistenceDelegate extends PersistenceDelegate { + @Override protected boolean mutatesTo(Object oldInstance, Object newInstance) { return oldInstance.equals(newInstance); } + @Override protected Expression instantiate(Object oldInstance, Encoder out) { Insets insets = (Insets) oldInstance; Object[] args = new Object[] { @@ -636,10 +685,12 @@ static final class java_awt_Insets_PersistenceDelegate extends PersistenceDelega * @author Sergey A. Malenkov */ static final class java_awt_Font_PersistenceDelegate extends PersistenceDelegate { + @Override protected boolean mutatesTo(Object oldInstance, Object newInstance) { return oldInstance.equals(newInstance); } + @Override protected Expression instantiate(Object oldInstance, Encoder out) { Font font = (Font) oldInstance; @@ -705,10 +756,12 @@ static final class java_awt_Font_PersistenceDelegate extends PersistenceDelegate * @author Sergey A. Malenkov */ static final class java_awt_AWTKeyStroke_PersistenceDelegate extends PersistenceDelegate { + @Override protected boolean mutatesTo(Object oldInstance, Object newInstance) { return oldInstance.equals(newInstance); } + @Override protected Expression instantiate(Object oldInstance, Encoder out) { AWTKeyStroke key = (AWTKeyStroke) oldInstance; @@ -760,10 +813,12 @@ static class StaticFieldsPersistenceDelegate extends PersistenceDelegate { } } + @Override protected Expression instantiate(Object oldInstance, Encoder out) { throw new RuntimeException("Unrecognized instance: " + oldInstance); } + @Override public void writeObject(Object oldInstance, Encoder out) { if (out.getAttribute(this) == null) { out.setAttribute(this, Boolean.TRUE); @@ -781,10 +836,12 @@ static final class java_awt_font_TextAttribute_PersistenceDelegate extends Stati // MenuShortcut static final class java_awt_MenuShortcut_PersistenceDelegate extends PersistenceDelegate { + @Override protected boolean mutatesTo(Object oldInstance, Object newInstance) { return oldInstance.equals(newInstance); } + @Override protected Expression instantiate(Object oldInstance, Encoder out) { java.awt.MenuShortcut m = (java.awt.MenuShortcut)oldInstance; return new Expression(oldInstance, m.getClass(), "new", @@ -794,6 +851,7 @@ static final class java_awt_MenuShortcut_PersistenceDelegate extends Persistence // Component static final class java_awt_Component_PersistenceDelegate extends DefaultPersistenceDelegate { + @Override protected void initialize(Class type, Object oldInstance, Object newInstance, Encoder out) { super.initialize(type, oldInstance, newInstance, out); java.awt.Component c = (java.awt.Component)oldInstance; @@ -841,6 +899,7 @@ static final class java_awt_Component_PersistenceDelegate extends DefaultPersist // Container static final class java_awt_Container_PersistenceDelegate extends DefaultPersistenceDelegate { + @Override protected void initialize(Class type, Object oldInstance, Object newInstance, Encoder out) { super.initialize(type, oldInstance, newInstance, out); // Ignore the children of a JScrollPane. @@ -876,6 +935,7 @@ static final class java_awt_Container_PersistenceDelegate extends DefaultPersist // Choice static final class java_awt_Choice_PersistenceDelegate extends DefaultPersistenceDelegate { + @Override protected void initialize(Class type, Object oldInstance, Object newInstance, Encoder out) { super.initialize(type, oldInstance, newInstance, out); java.awt.Choice m = (java.awt.Choice)oldInstance; @@ -888,6 +948,7 @@ static final class java_awt_Choice_PersistenceDelegate extends DefaultPersistenc // Menu static final class java_awt_Menu_PersistenceDelegate extends DefaultPersistenceDelegate { + @Override protected void initialize(Class type, Object oldInstance, Object newInstance, Encoder out) { super.initialize(type, oldInstance, newInstance, out); java.awt.Menu m = (java.awt.Menu)oldInstance; @@ -900,6 +961,7 @@ static final class java_awt_Menu_PersistenceDelegate extends DefaultPersistenceD // MenuBar static final class java_awt_MenuBar_PersistenceDelegate extends DefaultPersistenceDelegate { + @Override protected void initialize(Class type, Object oldInstance, Object newInstance, Encoder out) { super.initialize(type, oldInstance, newInstance, out); java.awt.MenuBar m = (java.awt.MenuBar)oldInstance; @@ -912,6 +974,7 @@ static final class java_awt_MenuBar_PersistenceDelegate extends DefaultPersisten // List static final class java_awt_List_PersistenceDelegate extends DefaultPersistenceDelegate { + @Override protected void initialize(Class type, Object oldInstance, Object newInstance, Encoder out) { super.initialize(type, oldInstance, newInstance, out); java.awt.List m = (java.awt.List)oldInstance; @@ -958,6 +1021,7 @@ static final class java_awt_BorderLayout_PersistenceDelegate extends DefaultPers // CardLayout static final class java_awt_CardLayout_PersistenceDelegate extends DefaultPersistenceDelegate { + @Override protected void initialize(Class type, Object oldInstance, Object newInstance, Encoder out) { super.initialize(type, oldInstance, newInstance, out); @@ -969,6 +1033,7 @@ static final class java_awt_CardLayout_PersistenceDelegate extends DefaultPersis } } } + @Override protected boolean mutatesTo(Object oldInstance, Object newInstance) { return super.mutatesTo(oldInstance, newInstance) && getVector(newInstance).isEmpty(); } @@ -979,6 +1044,7 @@ static final class java_awt_CardLayout_PersistenceDelegate extends DefaultPersis // GridBagLayout static final class java_awt_GridBagLayout_PersistenceDelegate extends DefaultPersistenceDelegate { + @Override protected void initialize(Class type, Object oldInstance, Object newInstance, Encoder out) { super.initialize(type, oldInstance, newInstance, out); @@ -989,6 +1055,7 @@ static final class java_awt_GridBagLayout_PersistenceDelegate extends DefaultPer } } } + @Override protected boolean mutatesTo(Object oldInstance, Object newInstance) { return super.mutatesTo(oldInstance, newInstance) && getHashtable(newInstance).isEmpty(); } @@ -1003,6 +1070,7 @@ static final class java_awt_GridBagLayout_PersistenceDelegate extends DefaultPer // will be issued before we have added all the children to the JFrame and // will appear blank). static final class javax_swing_JFrame_PersistenceDelegate extends DefaultPersistenceDelegate { + @Override protected void initialize(Class type, Object oldInstance, Object newInstance, Encoder out) { super.initialize(type, oldInstance, newInstance, out); java.awt.Window oldC = (java.awt.Window)oldInstance; @@ -1023,6 +1091,7 @@ static final class javax_swing_JFrame_PersistenceDelegate extends DefaultPersist // DefaultListModel static final class javax_swing_DefaultListModel_PersistenceDelegate extends DefaultPersistenceDelegate { + @Override protected void initialize(Class type, Object oldInstance, Object newInstance, Encoder out) { // Note, the "size" property will be set here. super.initialize(type, oldInstance, newInstance, out); @@ -1037,6 +1106,7 @@ static final class javax_swing_DefaultListModel_PersistenceDelegate extends Defa // DefaultComboBoxModel static final class javax_swing_DefaultComboBoxModel_PersistenceDelegate extends DefaultPersistenceDelegate { + @Override protected void initialize(Class type, Object oldInstance, Object newInstance, Encoder out) { super.initialize(type, oldInstance, newInstance, out); javax.swing.DefaultComboBoxModel m = (javax.swing.DefaultComboBoxModel)oldInstance; @@ -1049,6 +1119,7 @@ static final class javax_swing_DefaultComboBoxModel_PersistenceDelegate extends // DefaultMutableTreeNode static final class javax_swing_tree_DefaultMutableTreeNode_PersistenceDelegate extends DefaultPersistenceDelegate { + @Override protected void initialize(Class type, Object oldInstance, Object newInstance, Encoder out) { super.initialize(type, oldInstance, newInstance, out); @@ -1065,6 +1136,7 @@ static final class javax_swing_tree_DefaultMutableTreeNode_PersistenceDelegate e // ToolTipManager static final class javax_swing_ToolTipManager_PersistenceDelegate extends PersistenceDelegate { + @Override protected Expression instantiate(Object oldInstance, Encoder out) { return new Expression(oldInstance, javax.swing.ToolTipManager.class, "sharedInstance", new Object[]{}); @@ -1073,6 +1145,7 @@ static final class javax_swing_ToolTipManager_PersistenceDelegate extends Persis // JTabbedPane static final class javax_swing_JTabbedPane_PersistenceDelegate extends DefaultPersistenceDelegate { + @Override protected void initialize(Class type, Object oldInstance, Object newInstance, Encoder out) { super.initialize(type, oldInstance, newInstance, out); javax.swing.JTabbedPane p = (javax.swing.JTabbedPane)oldInstance; @@ -1088,10 +1161,12 @@ static final class javax_swing_JTabbedPane_PersistenceDelegate extends DefaultPe // Box static final class javax_swing_Box_PersistenceDelegate extends DefaultPersistenceDelegate { + @Override protected boolean mutatesTo(Object oldInstance, Object newInstance) { return super.mutatesTo(oldInstance, newInstance) && getAxis(oldInstance).equals(getAxis(newInstance)); } + @Override protected Expression instantiate(Object oldInstance, Encoder out) { return new Expression(oldInstance, oldInstance.getClass(), "new", new Object[] {getAxis(oldInstance)}); } @@ -1109,6 +1184,7 @@ static final class javax_swing_Box_PersistenceDelegate extends DefaultPersistenc // need to be added to the menu item. // Not so for JMenu apparently. static final class javax_swing_JMenu_PersistenceDelegate extends DefaultPersistenceDelegate { + @Override protected void initialize(Class type, Object oldInstance, Object newInstance, Encoder out) { super.initialize(type, oldInstance, newInstance, out); javax.swing.JMenu m = (javax.swing.JMenu)oldInstance; @@ -1127,6 +1203,7 @@ static final class javax_swing_JMenu_PersistenceDelegate extends DefaultPersiste * @author Sergey A. Malenkov */ static final class javax_swing_border_MatteBorder_PersistenceDelegate extends PersistenceDelegate { + @Override protected Expression instantiate(Object oldInstance, Encoder out) { MatteBorder border = (MatteBorder) oldInstance; Insets insets = border.getBorderInsets(); @@ -1169,10 +1246,12 @@ static final class javax_swing_JMenu_PersistenceDelegate extends DefaultPersiste * @author Sergey A. Malenkov */ static final class sun_swing_PrintColorUIResource_PersistenceDelegate extends PersistenceDelegate { + @Override protected boolean mutatesTo(Object oldInstance, Object newInstance) { return oldInstance.equals(newInstance); } + @Override protected Expression instantiate(Object oldInstance, Encoder out) { Color color = (Color) oldInstance; Object[] args = new Object[] {color.getRGB()}; diff --git a/src/java.desktop/share/classes/java/beans/MethodDescriptor.java b/src/java.desktop/share/classes/java/beans/MethodDescriptor.java index 00cd3f6db30..a0fef42ff5a 100644 --- a/src/java.desktop/share/classes/java/beans/MethodDescriptor.java +++ b/src/java.desktop/share/classes/java/beans/MethodDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -221,6 +221,7 @@ public class MethodDescriptor extends FeatureDescriptor { } } + @Override void appendTo(StringBuilder sb) { appendTo(sb, "method", this.methodRef.get()); if (this.parameterDescriptors != null) { diff --git a/src/java.desktop/share/classes/java/beans/PropertyChangeEvent.java b/src/java.desktop/share/classes/java/beans/PropertyChangeEvent.java index 1badd4bc72a..0db50ff898a 100644 --- a/src/java.desktop/share/classes/java/beans/PropertyChangeEvent.java +++ b/src/java.desktop/share/classes/java/beans/PropertyChangeEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -161,6 +161,7 @@ public class PropertyChangeEvent extends EventObject { * * @since 1.7 */ + @Override public String toString() { StringBuilder sb = new StringBuilder(getClass().getName()); sb.append("[propertyName=").append(getPropertyName()); diff --git a/src/java.desktop/share/classes/java/beans/PropertyChangeListenerProxy.java b/src/java.desktop/share/classes/java/beans/PropertyChangeListenerProxy.java index e8fe197cfd6..024ae551895 100644 --- a/src/java.desktop/share/classes/java/beans/PropertyChangeListenerProxy.java +++ b/src/java.desktop/share/classes/java/beans/PropertyChangeListenerProxy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -66,6 +66,7 @@ public class PropertyChangeListenerProxy * * @param event the property change event */ + @Override public void propertyChange(PropertyChangeEvent event) { getListener().propertyChange(event); } diff --git a/src/java.desktop/share/classes/java/beans/PropertyChangeSupport.java b/src/java.desktop/share/classes/java/beans/PropertyChangeSupport.java index edad65444ee..1b28fd4e320 100644 --- a/src/java.desktop/share/classes/java/beans/PropertyChangeSupport.java +++ b/src/java.desktop/share/classes/java/beans/PropertyChangeSupport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -566,6 +566,7 @@ public class PropertyChangeSupport implements Serializable { /** * {@inheritDoc} */ + @Override public PropertyChangeListener extract(PropertyChangeListener listener) { while (listener instanceof PropertyChangeListenerProxy) { listener = ((PropertyChangeListenerProxy) listener).getListener(); diff --git a/src/java.desktop/share/classes/java/beans/PropertyDescriptor.java b/src/java.desktop/share/classes/java/beans/PropertyDescriptor.java index 6f5d5d82832..c678199afc1 100644 --- a/src/java.desktop/share/classes/java/beans/PropertyDescriptor.java +++ b/src/java.desktop/share/classes/java/beans/PropertyDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -371,6 +371,7 @@ public class PropertyDescriptor extends FeatureDescriptor { /** * Overridden to ensure that a super class doesn't take precedent */ + @Override void setClass0(Class clz) { if (getClass0() != null && clz.isAssignableFrom(getClass0())) { // don't replace a subclass with a superclass @@ -497,6 +498,7 @@ public class PropertyDescriptor extends FeatureDescriptor { * * @since 1.4 */ + @Override public boolean equals(Object obj) { if (this == obj) { return true; @@ -712,6 +714,7 @@ public class PropertyDescriptor extends FeatureDescriptor { * @return a hash code value for this object. * @since 1.5 */ + @Override public int hashCode() { int result = 7; @@ -742,6 +745,7 @@ public class PropertyDescriptor extends FeatureDescriptor { return baseName; } + @Override void appendTo(StringBuilder sb) { appendTo(sb, "bound", this.bound); appendTo(sb, "constrained", this.constrained); diff --git a/src/java.desktop/share/classes/java/beans/PropertyEditorSupport.java b/src/java.desktop/share/classes/java/beans/PropertyEditorSupport.java index 6c7140769a3..601d4634e1f 100644 --- a/src/java.desktop/share/classes/java/beans/PropertyEditorSupport.java +++ b/src/java.desktop/share/classes/java/beans/PropertyEditorSupport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -94,6 +94,7 @@ public class PropertyEditorSupport implements PropertyEditor { * the PropertyEditor should create a new object to hold any * modified value. */ + @Override public void setValue(Object value) { this.value = value; firePropertyChange(); @@ -104,6 +105,7 @@ public class PropertyEditorSupport implements PropertyEditor { * * @return The value of the property. */ + @Override public Object getValue() { return value; } @@ -116,6 +118,7 @@ public class PropertyEditorSupport implements PropertyEditor { * @return True if the class will honor the paintValue method. */ + @Override public boolean isPaintable() { return false; } @@ -131,6 +134,7 @@ public class PropertyEditorSupport implements PropertyEditor { * @param gfx Graphics object to paint into. * @param box Rectangle within graphics object into which we should paint. */ + @Override public void paintValue(java.awt.Graphics gfx, java.awt.Rectangle box) { } @@ -147,6 +151,7 @@ public class PropertyEditorSupport implements PropertyEditor { * @return A fragment of Java code representing an initializer for the * current value. */ + @Override public String getJavaInitializationString() { return "???"; } @@ -163,6 +168,7 @@ public class PropertyEditorSupport implements PropertyEditor { *

If a non-null value is returned, then the PropertyEditor should * be prepared to parse that string back in setAsText(). */ + @Override public String getAsText() { return (this.value != null) ? this.value.toString() @@ -177,6 +183,7 @@ public class PropertyEditorSupport implements PropertyEditor { * * @param text The string to be parsed. */ + @Override public void setAsText(String text) throws java.lang.IllegalArgumentException { if (value instanceof String) { setValue(text); @@ -198,6 +205,7 @@ public class PropertyEditorSupport implements PropertyEditor { * property cannot be represented as a tagged value. * */ + @Override public String[] getTags() { return null; } @@ -219,6 +227,7 @@ public class PropertyEditorSupport implements PropertyEditor { * not supported. */ + @Override public java.awt.Component getCustomEditor() { return null; } @@ -228,6 +237,7 @@ public class PropertyEditorSupport implements PropertyEditor { * * @return True if the propertyEditor can provide a custom editor. */ + @Override public boolean supportsCustomEditor() { return false; } @@ -250,6 +260,7 @@ public class PropertyEditorSupport implements PropertyEditor { * * @param listener the {@link PropertyChangeListener} to add */ + @Override public synchronized void addPropertyChangeListener( PropertyChangeListener listener) { if (listeners == null) { @@ -268,6 +279,7 @@ public class PropertyEditorSupport implements PropertyEditor { * * @param listener the {@link PropertyChangeListener} to remove */ + @Override public synchronized void removePropertyChangeListener( PropertyChangeListener listener) { if (listeners == null) { diff --git a/src/java.desktop/share/classes/java/beans/Statement.java b/src/java.desktop/share/classes/java/beans/Statement.java index 117aef7f22b..2602aed83d7 100644 --- a/src/java.desktop/share/classes/java/beans/Statement.java +++ b/src/java.desktop/share/classes/java/beans/Statement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -56,6 +56,7 @@ public class Statement { private static Object[] emptyArray = new Object[]{}; static ExceptionListener defaultExceptionListener = new ExceptionListener() { + @Override public void exceptionThrown(Exception e) { System.err.println(e); // e.printStackTrace(); @@ -310,6 +311,7 @@ public class Statement { /** * Prints the value of this statement using a Java-style syntax. */ + @Override public String toString() { // Respect a subclass's implementation here. Object target = getTarget(); diff --git a/src/java.desktop/share/classes/java/beans/ThreadGroupContext.java b/src/java.desktop/share/classes/java/beans/ThreadGroupContext.java index b77154c9a3b..dc42799c9f7 100644 --- a/src/java.desktop/share/classes/java/beans/ThreadGroupContext.java +++ b/src/java.desktop/share/classes/java/beans/ThreadGroupContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2026, Oracle and/or its affiliates. All rights reserved. * 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,6 +42,7 @@ import java.util.WeakHashMap; final class ThreadGroupContext { private static final WeakIdentityMap contexts = new WeakIdentityMap() { + @Override protected ThreadGroupContext create(Object key) { return new ThreadGroupContext(); } diff --git a/src/java.desktop/share/classes/java/beans/VetoableChangeListenerProxy.java b/src/java.desktop/share/classes/java/beans/VetoableChangeListenerProxy.java index 4e4ad96ebd8..a09c3f09b3b 100644 --- a/src/java.desktop/share/classes/java/beans/VetoableChangeListenerProxy.java +++ b/src/java.desktop/share/classes/java/beans/VetoableChangeListenerProxy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -69,6 +69,7 @@ public class VetoableChangeListenerProxy * @throws PropertyVetoException if the recipient wishes the property * change to be rolled back */ + @Override public void vetoableChange(PropertyChangeEvent event) throws PropertyVetoException{ getListener().vetoableChange(event); } diff --git a/src/java.desktop/share/classes/java/beans/VetoableChangeSupport.java b/src/java.desktop/share/classes/java/beans/VetoableChangeSupport.java index cce44ad0355..3ce47142867 100644 --- a/src/java.desktop/share/classes/java/beans/VetoableChangeSupport.java +++ b/src/java.desktop/share/classes/java/beans/VetoableChangeSupport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -555,6 +555,7 @@ public class VetoableChangeSupport implements Serializable { /** * {@inheritDoc} */ + @Override public VetoableChangeListener extract(VetoableChangeListener listener) { while (listener instanceof VetoableChangeListenerProxy) { listener = ((VetoableChangeListenerProxy) listener).getListener(); diff --git a/src/java.desktop/share/classes/java/beans/XMLDecoder.java b/src/java.desktop/share/classes/java/beans/XMLDecoder.java index 3d5fbd3a8ce..32a9ee5953d 100644 --- a/src/java.desktop/share/classes/java/beans/XMLDecoder.java +++ b/src/java.desktop/share/classes/java/beans/XMLDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -166,6 +166,7 @@ public class XMLDecoder implements AutoCloseable { * This method closes the input stream associated * with this stream. */ + @Override public void close() { if (parsingComplete()) { close(this.input.getCharacterStream()); diff --git a/src/java.desktop/share/classes/java/beans/XMLEncoder.java b/src/java.desktop/share/classes/java/beans/XMLEncoder.java index 646b777e7f7..aec59dad0ad 100644 --- a/src/java.desktop/share/classes/java/beans/XMLEncoder.java +++ b/src/java.desktop/share/classes/java/beans/XMLEncoder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -321,6 +321,7 @@ public class XMLEncoder extends Encoder implements AutoCloseable { * * @see XMLDecoder#readObject */ + @Override public void writeObject(Object o) { if (internal) { super.writeObject(o); @@ -391,6 +392,7 @@ public class XMLEncoder extends Encoder implements AutoCloseable { * to the stream. * @see java.beans.PersistenceDelegate#initialize */ + @Override public void writeStatement(Statement oldStm) { // System.out.println("XMLEncoder::writeStatement: " + oldStm); boolean internal = this.internal; @@ -445,6 +447,7 @@ public class XMLEncoder extends Encoder implements AutoCloseable { * to the stream. * @see java.beans.PersistenceDelegate#initialize */ + @Override public void writeExpression(Expression oldExp) { boolean internal = this.internal; this.internal = true; @@ -502,6 +505,7 @@ public class XMLEncoder extends Encoder implements AutoCloseable { clear(); } + @Override void clear() { super.clear(); nameGenerator.clear(); @@ -526,6 +530,7 @@ public class XMLEncoder extends Encoder implements AutoCloseable { * postamble and then closes the output stream associated * with this stream. */ + @Override public void close() { flush(); writeln(""); diff --git a/src/java.desktop/share/classes/java/beans/beancontext/BeanContextChildSupport.java b/src/java.desktop/share/classes/java/beans/beancontext/BeanContextChildSupport.java index 527a8be9cc0..0f623648f7b 100644 --- a/src/java.desktop/share/classes/java/beans/beancontext/BeanContextChildSupport.java +++ b/src/java.desktop/share/classes/java/beans/beancontext/BeanContextChildSupport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -101,6 +101,7 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer * property * @throws PropertyVetoException if the change is rejected */ + @Override public synchronized void setBeanContext(BeanContext bc) throws PropertyVetoException { if (bc == beanContext) return; @@ -146,6 +147,7 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer * @return the nesting {@code BeanContext} for * this {@code BeanContextChildSupport}. */ + @Override public synchronized BeanContext getBeanContext() { return beanContext; } /** @@ -159,6 +161,7 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer * @param name The name of the property to listen on * @param pcl The {@code PropertyChangeListener} to be added */ + @Override public void addPropertyChangeListener(String name, PropertyChangeListener pcl) { pcSupport.addPropertyChangeListener(name, pcl); } @@ -176,6 +179,7 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer * @param name The name of the property that was listened on * @param pcl The PropertyChangeListener to be removed */ + @Override public void removePropertyChangeListener(String name, PropertyChangeListener pcl) { pcSupport.removePropertyChangeListener(name, pcl); } @@ -191,6 +195,7 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer * @param name The name of the property to listen on * @param vcl The {@code VetoableChangeListener} to be added */ + @Override public void addVetoableChangeListener(String name, VetoableChangeListener vcl) { vcSupport.addVetoableChangeListener(name, vcl); } @@ -208,6 +213,7 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer * @param name The name of the property that was listened on * @param vcl The {@code VetoableChangeListener} to be removed */ + @Override public void removeVetoableChangeListener(String name, VetoableChangeListener vcl) { vcSupport.removeVetoableChangeListener(name, vcl); } @@ -220,6 +226,7 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer * @param bcsre The {@code BeanContextServiceRevokedEvent} fired as a * result of a service being revoked */ + @Override public void serviceRevoked(BeanContextServiceRevokedEvent bcsre) { } /** @@ -231,6 +238,7 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer * result of a service becoming available * */ + @Override public void serviceAvailable(BeanContextServiceAvailableEvent bcsae) { } /** diff --git a/src/java.desktop/share/classes/java/beans/beancontext/BeanContextServicesSupport.java b/src/java.desktop/share/classes/java/beans/beancontext/BeanContextServicesSupport.java index 0e2e4211a9c..17897f6865e 100644 --- a/src/java.desktop/share/classes/java/beans/beancontext/BeanContextServicesSupport.java +++ b/src/java.desktop/share/classes/java/beans/beancontext/BeanContextServicesSupport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -131,6 +131,7 @@ public class BeanContextServicesSupport extends BeanContextSupport * call it directly. */ + @Override public void initialize() { super.initialize(); services = new HashMap<>(serializable + 1); @@ -592,6 +593,7 @@ public class BeanContextServicesSupport extends BeanContextSupport * @param peer the peer if the targetChild and peer are related by BeanContextProxy */ + @Override protected BCSChild createBCSChild(Object targetChild, Object peer) { return new BCSSChild(targetChild, peer); } @@ -655,6 +657,7 @@ public class BeanContextServicesSupport extends BeanContextSupport * @throws NullPointerException if the argument is null */ + @Override public void addBeanContextServicesListener(BeanContextServicesListener bcsl) { if (bcsl == null) throw new NullPointerException("bcsl"); @@ -670,6 +673,7 @@ public class BeanContextServicesSupport extends BeanContextSupport * remove a BeanContextServicesListener */ + @Override public void removeBeanContextServicesListener(BeanContextServicesListener bcsl) { if (bcsl == null) throw new NullPointerException("bcsl"); @@ -687,6 +691,7 @@ public class BeanContextServicesSupport extends BeanContextSupport * @param bcsp the service provider */ + @Override public boolean addService(Class serviceClass, BeanContextServiceProvider bcsp) { return addService(serviceClass, bcsp, true); } @@ -739,6 +744,7 @@ public class BeanContextServicesSupport extends BeanContextSupport * @param revokeCurrentServicesNow whether or not to revoke the service */ + @Override public void revokeService(Class serviceClass, BeanContextServiceProvider bcsp, boolean revokeCurrentServicesNow) { if (serviceClass == null) throw new NullPointerException("serviceClass"); @@ -770,6 +776,7 @@ public class BeanContextServicesSupport extends BeanContextSupport * has a service, which may be delegated */ + @Override public synchronized boolean hasService(Class serviceClass) { if (serviceClass == null) throw new NullPointerException("serviceClass"); @@ -807,6 +814,7 @@ public class BeanContextServicesSupport extends BeanContextSupport nestingCtxt = bcs; } + @Override public Object getService(BeanContextServices bcs, Object requestor, Class serviceClass, Object serviceSelector) { Object service = null; @@ -819,14 +827,17 @@ public class BeanContextServicesSupport extends BeanContextSupport return service; } + @Override public void releaseService(BeanContextServices bcs, Object requestor, Object service) { nestingCtxt.releaseService(bcs, requestor, service); } + @Override public Iterator getCurrentServiceSelectors(BeanContextServices bcs, Class serviceClass) { return nestingCtxt.getCurrentServiceSelectors(serviceClass); } + @Override public void serviceRevoked(BeanContextServiceRevokedEvent bcsre) { Iterator i = bcsChildren(); // get the BCSChild values. @@ -848,6 +859,7 @@ public class BeanContextServicesSupport extends BeanContextSupport * obtain a service which may be delegated */ + @Override public Object getService(BeanContextChild child, Object requestor, Class serviceClass, Object serviceSelector, BeanContextServiceRevokedListener bcsrl) throws TooManyListenersException { if (child == null) throw new NullPointerException("child"); if (serviceClass == null) throw new NullPointerException("serviceClass"); @@ -913,6 +925,7 @@ public class BeanContextServicesSupport extends BeanContextSupport * release a service */ + @Override public void releaseService(BeanContextChild child, Object requestor, Object service) { if (child == null) throw new NullPointerException("child"); if (requestor == null) throw new NullPointerException("requestor"); @@ -934,6 +947,7 @@ public class BeanContextServicesSupport extends BeanContextSupport * @return an iterator for all the currently registered service classes. */ + @Override public Iterator getCurrentServiceClasses() { return new BCSIterator(services.keySet().iterator()); } @@ -943,6 +957,7 @@ public class BeanContextServicesSupport extends BeanContextSupport * (if any) available for the specified service. */ + @Override public Iterator getCurrentServiceSelectors(Class serviceClass) { BCSSServiceProvider bcsssp = services.get(serviceClass); @@ -960,6 +975,7 @@ public class BeanContextServicesSupport extends BeanContextSupport * own propagation semantics. */ + @Override public void serviceAvailable(BeanContextServiceAvailableEvent bcssae) { synchronized(BeanContext.globalHierarchyLock) { if (services.containsKey(bcssae.getServiceClass())) return; @@ -992,6 +1008,7 @@ public class BeanContextServicesSupport extends BeanContextSupport * own propagation semantics. */ + @Override public void serviceRevoked(BeanContextServiceRevokedEvent bcssre) { synchronized(BeanContext.globalHierarchyLock) { if (services.containsKey(bcssre.getServiceClass())) return; @@ -1040,6 +1057,7 @@ public class BeanContextServicesSupport extends BeanContextSupport * own child removal side-effects. */ + @Override protected void childJustRemovedHook(Object child, BCSChild bcsc) { BCSSChild bcssc = (BCSSChild)bcsc; @@ -1055,6 +1073,7 @@ public class BeanContextServicesSupport extends BeanContextSupport * subclasses may envelope this method to implement their own semantics. */ + @Override protected synchronized void releaseBeanContextResources() { Object[] bcssc; @@ -1081,6 +1100,7 @@ public class BeanContextServicesSupport extends BeanContextSupport * subclasses may envelope this method to implement their own semantics. */ + @Override protected synchronized void initializeBeanContextResources() { super.initializeBeanContextResources(); @@ -1167,6 +1187,7 @@ public class BeanContextServicesSupport extends BeanContextSupport * processing that has to occur prior to serialization of the children */ + @Override protected synchronized void bcsPreSerializationHook(ObjectOutputStream oos) throws IOException { oos.writeInt(serializable); @@ -1210,6 +1231,7 @@ public class BeanContextServicesSupport extends BeanContextSupport * processing that has to occur prior to serialization of the children */ + @Override protected synchronized void bcsPreDeserializationHook(ObjectInputStream ois) throws IOException, ClassNotFoundException { serializable = ois.readInt(); diff --git a/src/java.desktop/share/classes/java/beans/beancontext/BeanContextSupport.java b/src/java.desktop/share/classes/java/beans/beancontext/BeanContextSupport.java index dbbecb87d7e..3aa77048f8f 100644 --- a/src/java.desktop/share/classes/java/beans/beancontext/BeanContextSupport.java +++ b/src/java.desktop/share/classes/java/beans/beancontext/BeanContextSupport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -186,6 +186,7 @@ public class BeanContextSupport extends BeanContextChildSupport * identified by the beanName parameter is not found * @return the new object */ + @Override public Object instantiateChild(String beanName) throws IOException, ClassNotFoundException { BeanContext bc = getBeanContextPeer(); @@ -199,6 +200,7 @@ public class BeanContextSupport extends BeanContextChildSupport * * @return number of children */ + @Override public int size() { synchronized(children) { return children.size(); @@ -212,6 +214,7 @@ public class BeanContextSupport extends BeanContextChildSupport * * @return {@code true} if there are no children, otherwise {@code false} */ + @Override public boolean isEmpty() { synchronized(children) { return children.isEmpty(); @@ -225,6 +228,7 @@ public class BeanContextSupport extends BeanContextChildSupport * @param o the Object in question * @return {@code true} if this object is a child, otherwise {@code false} */ + @Override public boolean contains(Object o) { synchronized(children) { return children.containsKey(o); @@ -249,6 +253,7 @@ public class BeanContextSupport extends BeanContextChildSupport * currently nested in this {@code BeanContext}. * @return an {@code Iterator} of the nested children */ + @Override public Iterator iterator() { synchronized(children) { return new BCSIterator(children.keySet().iterator()); @@ -259,6 +264,7 @@ public class BeanContextSupport extends BeanContextChildSupport * Gets all JavaBean or {@code BeanContext} * instances currently nested in this BeanContext. */ + @Override public Object[] toArray() { synchronized(children) { return children.keySet().toArray(); @@ -273,6 +279,7 @@ public class BeanContextSupport extends BeanContextChildSupport * types that are of interest. * @return an array of children */ + @Override public Object[] toArray(Object[] arry) { synchronized(children) { return children.keySet().toArray(arry); @@ -290,8 +297,11 @@ public class BeanContextSupport extends BeanContextChildSupport protected static final class BCSIterator implements Iterator { BCSIterator(Iterator i) { super(); src = i; } + @Override public boolean hasNext() { return src.hasNext(); } + @Override public Object next() { return src.next(); } + @Override public void remove() { /* do nothing */ } private Iterator src; @@ -388,6 +398,7 @@ public class BeanContextSupport extends BeanContextChildSupport * @return true if the child was added successfully. * @see #validatePendingAdd */ + @Override public boolean add(Object targetChild) { if (targetChild == null) throw new IllegalArgumentException(); @@ -492,6 +503,7 @@ public class BeanContextSupport extends BeanContextChildSupport * @param targetChild The child objects to remove * @see #validatePendingRemove */ + @Override public boolean remove(Object targetChild) { return remove(targetChild, true); } @@ -579,6 +591,7 @@ public class BeanContextSupport extends BeanContextChildSupport * in the collection are children of * this {@code BeanContext}, false if not. */ + @Override @SuppressWarnings("rawtypes") public boolean containsAll(Collection c) { synchronized(children) { @@ -596,6 +609,7 @@ public class BeanContextSupport extends BeanContextChildSupport * @throws UnsupportedOperationException thrown unconditionally by this implementation * @return this implementation unconditionally throws {@code UnsupportedOperationException} */ + @Override @SuppressWarnings("rawtypes") public boolean addAll(Collection c) { throw new UnsupportedOperationException(); @@ -608,6 +622,7 @@ public class BeanContextSupport extends BeanContextChildSupport * @return this implementation unconditionally throws {@code UnsupportedOperationException} */ + @Override @SuppressWarnings("rawtypes") public boolean removeAll(Collection c) { throw new UnsupportedOperationException(); @@ -620,6 +635,7 @@ public class BeanContextSupport extends BeanContextChildSupport * @throws UnsupportedOperationException thrown unconditionally by this implementation * @return this implementation unconditionally throws {@code UnsupportedOperationException} */ + @Override @SuppressWarnings("rawtypes") public boolean retainAll(Collection c) { throw new UnsupportedOperationException(); @@ -630,6 +646,7 @@ public class BeanContextSupport extends BeanContextChildSupport * implementations must synchronized on the hierarchy lock and "children" protected field * @throws UnsupportedOperationException thrown unconditionally by this implementation */ + @Override public void clear() { throw new UnsupportedOperationException(); } @@ -641,6 +658,7 @@ public class BeanContextSupport extends BeanContextChildSupport * @throws NullPointerException if the argument is null */ + @Override public void addBeanContextMembershipListener(BeanContextMembershipListener bcml) { if (bcml == null) throw new NullPointerException("listener"); @@ -659,6 +677,7 @@ public class BeanContextSupport extends BeanContextChildSupport * @throws NullPointerException if the argument is null */ + @Override public void removeBeanContextMembershipListener(BeanContextMembershipListener bcml) { if (bcml == null) throw new NullPointerException("listener"); @@ -678,6 +697,7 @@ public class BeanContextSupport extends BeanContextChildSupport * @throws NullPointerException if the argument is null */ + @Override public InputStream getResourceAsStream(String name, BeanContextChild bcc) { if (name == null) throw new NullPointerException("name"); if (bcc == null) throw new NullPointerException("bcc"); @@ -697,6 +717,7 @@ public class BeanContextSupport extends BeanContextChildSupport * @return the requested resource as an InputStream */ + @Override public URL getResource(String name, BeanContextChild bcc) { if (name == null) throw new NullPointerException("name"); if (bcc == null) throw new NullPointerException("bcc"); @@ -713,6 +734,7 @@ public class BeanContextSupport extends BeanContextChildSupport * Sets the new design time value for this {@code BeanContext}. * @param dTime the new designTime value */ + @Override public synchronized void setDesignTime(boolean dTime) { if (designTime != dTime) { designTime = dTime; @@ -728,6 +750,7 @@ public class BeanContextSupport extends BeanContextChildSupport * @return {@code true} if in design time mode, * {@code false} if not */ + @Override public synchronized boolean isDesignTime() { return designTime; } /** @@ -768,6 +791,7 @@ public class BeanContextSupport extends BeanContextChildSupport *

* @return {@code true} if the implementor needs a GUI */ + @Override public synchronized boolean needsGui() { BeanContext bc = getBeanContextPeer(); @@ -798,6 +822,7 @@ public class BeanContextSupport extends BeanContextChildSupport * notify this instance that it may no longer render a GUI. */ + @Override public synchronized void dontUseGui() { if (okToUseGui) { okToUseGui = false; @@ -817,6 +842,7 @@ public class BeanContextSupport extends BeanContextChildSupport * Notify this instance that it may now render a GUI */ + @Override public synchronized void okToUseGui() { if (!okToUseGui) { okToUseGui = true; @@ -838,6 +864,7 @@ public class BeanContextSupport extends BeanContextChildSupport * @return is this instance avoiding using its GUI? * @see Visibility */ + @Override public boolean avoidingGui() { return !okToUseGui && needsGui(); } @@ -1101,6 +1128,7 @@ public class BeanContextSupport extends BeanContextChildSupport * subclasses may envelope to monitor veto child property changes. */ + @Override public void vetoableChange(PropertyChangeEvent pce) throws PropertyVetoException { String propertyName = pce.getPropertyName(); Object source = pce.getSource(); @@ -1121,6 +1149,7 @@ public class BeanContextSupport extends BeanContextChildSupport * subclasses may envelope to monitor child property changes. */ + @Override public void propertyChange(PropertyChangeEvent pce) { String propertyName = pce.getPropertyName(); Object source = pce.getSource(); @@ -1341,6 +1370,7 @@ public class BeanContextSupport extends BeanContextChildSupport * behaved Serializable child. */ + @Override public void propertyChange(PropertyChangeEvent pce) { BeanContextSupport.this.propertyChange(pce); } @@ -1355,6 +1385,7 @@ public class BeanContextSupport extends BeanContextChildSupport * behaved Serializable child. */ + @Override public void vetoableChange(PropertyChangeEvent pce) throws PropertyVetoException { BeanContextSupport.this.vetoableChange(pce); } From ce57cef3ed5105deb2a29551564474d87be05afd Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Fri, 13 Feb 2026 08:09:40 +0000 Subject: [PATCH 093/120] 8371979: Convert java/nio/file/FileStore/Basic.java to JUnit Reviewed-by: alanb, bpb --- test/jdk/java/nio/file/FileStore/Basic.java | 217 ++++++++++++-------- 1 file changed, 126 insertions(+), 91 deletions(-) diff --git a/test/jdk/java/nio/file/FileStore/Basic.java b/test/jdk/java/nio/file/FileStore/Basic.java index 052348c1f02..14450aa525b 100644 --- a/test/jdk/java/nio/file/FileStore/Basic.java +++ b/test/jdk/java/nio/file/FileStore/Basic.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2026, Oracle and/or its affiliates. All rights reserved. * 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,39 +28,53 @@ * @library .. /test/lib * @build jdk.test.lib.Platform * jdk.test.lib.util.FileUtils - * @run main Basic + * @run junit Basic */ -import java.nio.file.*; -import java.nio.file.attribute.*; import java.io.File; import java.io.IOException; +import java.nio.file.AccessDeniedException; +import java.nio.file.FileStore; +import java.nio.file.FileSystemException; +import java.nio.file.FileSystems; +import java.nio.file.Files; +import java.nio.file.NoSuchFileException; +import java.nio.file.Path; +import java.nio.file.attribute.AclFileAttributeView; +import java.nio.file.attribute.BasicFileAttributeView; +import java.nio.file.attribute.DosFileAttributeView; +import java.nio.file.attribute.FileAttributeView; +import java.nio.file.attribute.PosixFileAttributeView; +import java.nio.file.attribute.UserDefinedFileAttributeView; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.stream.StreamSupport; + +import org.junit.jupiter.api.condition.EnabledOnOs; +import org.junit.jupiter.api.condition.OS; +import org.junit.jupiter.api.io.TempDir; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; +import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assumptions.assumeTrue; import jdk.test.lib.Platform; import jdk.test.lib.util.FileUtils; -import static jdk.test.lib.Asserts.*; public class Basic { static final long G = 1024L * 1024L * 1024L; - public static void main(String[] args) throws IOException { - Path dir = TestUtil.createTemporaryDirectory(); - try { - doTests(dir); - } finally { - TestUtil.removeAll(dir); - } + static Path[] factory(@TempDir Path tempDir) { + return new Path[] { tempDir }; } static void checkWithin1GB(String space, long expected, long actual) { long diff = Math.abs(actual - expected); - if (diff > G) { - String msg = String.format("%s: |actual %d - expected %d| = %d (%f G)", + assertTrue(diff <= G, () -> String.format("%s: |actual %d - expected %d| = %d (%f G)", space, actual, expected, diff, - (float)diff/G); - throw new RuntimeException(msg); - } + (float)diff/G)); } static void testFileAttributes(Path file, @@ -68,7 +82,7 @@ public class Basic { String viewName) throws IOException { FileStore store = Files.getFileStore(file); boolean supported = store.supportsFileAttributeView(viewClass); - assertTrue(store.supportsFileAttributeView(viewName) == supported); + assertEquals(store.supportsFileAttributeView(viewName), supported); // If the file attribute view is supported by the FileStore then // Files.getFileAttributeView should return that view if (supported) { @@ -76,103 +90,124 @@ public class Basic { } } - static void doTests(Path dir) throws IOException { - /** - * Test: Directory should be on FileStore that is writable - */ - assertTrue(!Files.getFileStore(dir).isReadOnly()); + /* + * Test: Directory should be on FileStore that is writable + */ + @ParameterizedTest + @MethodSource("factory") + void testDirectoryWritable(Path dir) throws IOException { + assertFalse(Files.getFileStore(dir).isReadOnly()); + } - /** - * Test: Two files should have the same FileStore - */ + /* + * Test: Two files should have the same FileStore + */ + @ParameterizedTest + @MethodSource("factory") + void testEquality(Path dir) throws IOException { Path file1 = Files.createFile(dir.resolve("foo")); Path file2 = Files.createFile(dir.resolve("bar")); FileStore store1 = Files.getFileStore(file1); FileStore store2 = Files.getFileStore(file2); - assertTrue(store1.equals(store2)); - assertTrue(store2.equals(store1)); - assertTrue(store1.hashCode() == store2.hashCode()); + assertEquals(store1, store2); + assertEquals(store2, store1); + assertEquals(store1.hashCode(), store2.hashCode()); + } - if (Platform.isWindows()) { - /** - * Test: FileStore.equals() should not be case sensitive - */ - FileStore upper = Files.getFileStore(Path.of("C:\\")); - FileStore lower = Files.getFileStore(Path.of("c:\\")); - assertTrue(lower.equals(upper)); - } + /* + * Test: FileStore should not be case sensitive + */ + @ParameterizedTest + @MethodSource("factory") + @EnabledOnOs({OS.WINDOWS}) + void testCaseSensitivity(Path dir) throws IOException { + FileStore upper = Files.getFileStore(Path.of("C:\\")); + FileStore lower = Files.getFileStore(Path.of("c:\\")); + assertEquals(lower, upper); + } - /** - * Test: File and FileStore attributes - */ - assertTrue(store1.supportsFileAttributeView("basic")); + /* + * Test: File and FileStore attributes + */ + @ParameterizedTest + @MethodSource("factory") + void testAttributes(Path dir) throws IOException { + Path file = Files.createFile(dir.resolve("foo")); + FileStore store = Files.getFileStore(file); + assertTrue(store.supportsFileAttributeView("basic")); testFileAttributes(dir, BasicFileAttributeView.class, "basic"); testFileAttributes(dir, PosixFileAttributeView.class, "posix"); testFileAttributes(dir, DosFileAttributeView.class, "dos"); testFileAttributes(dir, AclFileAttributeView.class, "acl"); testFileAttributes(dir, UserDefinedFileAttributeView.class, "user"); + } - /** - * Test: Space atributes - */ - File f = file1.toFile(); + /* + * Test: Space attributes + */ + @ParameterizedTest + @MethodSource("factory") + void testSpaceAttributes(Path dir) throws IOException { + Path file = Files.createFile(dir.resolve("foo")); + FileStore store = Files.getFileStore(file); + File f = file.toFile(); // check values are "close" - checkWithin1GB("total", f.getTotalSpace(), store1.getTotalSpace()); - checkWithin1GB("free", f.getFreeSpace(), store1.getUnallocatedSpace()); - checkWithin1GB("usable", f.getUsableSpace(), store1.getUsableSpace()); + checkWithin1GB("total", f.getTotalSpace(), store.getTotalSpace()); + checkWithin1GB("free", f.getFreeSpace(), store.getUnallocatedSpace()); + checkWithin1GB("usable", f.getUsableSpace(), store.getUsableSpace()); // get values by name checkWithin1GB("total", f.getTotalSpace(), - (Long)store1.getAttribute("totalSpace")); + (Long)store.getAttribute("totalSpace")); checkWithin1GB("free", f.getFreeSpace(), - (Long)store1.getAttribute("unallocatedSpace")); + (Long)store.getAttribute("unallocatedSpace")); checkWithin1GB("usable", f.getUsableSpace(), - (Long)store1.getAttribute("usableSpace")); + (Long)store.getAttribute("usableSpace")); + } - /** - * Test: Enumerate all FileStores - */ - if (FileUtils.areMountPointsAccessibleAndUnique()) { - FileStore prev = null; - for (FileStore store: FileSystems.getDefault().getFileStores()) { - System.out.format("%s (name=%s type=%s)\n", store, store.name(), - store.type()); + /* + * Test: Enumerate all FileStores + */ + @ParameterizedTest + @MethodSource("factory") + void testEnumerateFileStores(Path dir) throws IOException { + assumeTrue(FileUtils.areMountPointsAccessibleAndUnique()); + List stores = StreamSupport.stream(FileSystems.getDefault() + .getFileStores().spliterator(), false) + .toList(); + Set uniqueStores = new HashSet<>(stores); + assertEquals(stores.size(), uniqueStores.size(), "FileStores should be unique"); + for (FileStore store: stores) { + System.err.format("%s (name=%s type=%s)\n", store, store.name(), + store.type()); - // check space attributes are accessible - try { - store.getTotalSpace(); - store.getUnallocatedSpace(); - store.getUsableSpace(); - } catch (NoSuchFileException nsfe) { - // ignore exception as the store could have been - // deleted since the iterator was instantiated - System.err.format("%s was not found\n", store); - } catch (AccessDeniedException ade) { - // ignore exception as the lack of ability to access the - // store due to lack of file permission or similar does not - // reflect whether the space attributes would be accessible - // were access to be permitted - System.err.format("%s is inaccessible\n", store); - } catch (FileSystemException fse) { - // On Linux, ignore the FSE if the path is one of the - // /run/user/$UID mounts created by pam_systemd(8) as it - // might be mounted as a fuse.portal filesystem and - // its access attempt might fail with EPERM - if (!Platform.isLinux() || store.toString().indexOf("/run/user") == -1) { - throw new RuntimeException(fse); - } else { - System.err.format("%s error: %s\n", store, fse); - } + // check space attributes are accessible + try { + store.getTotalSpace(); + store.getUnallocatedSpace(); + store.getUsableSpace(); + } catch (NoSuchFileException nsfe) { + // ignore exception as the store could have been + // deleted since the iterator was instantiated + System.err.format("%s was not found\n", store); + } catch (AccessDeniedException ade) { + // ignore exception as the lack of ability to access the + // store due to lack of file permission or similar does not + // reflect whether the space attributes would be accessible + // were access to be permitted + System.err.format("%s is inaccessible\n", store); + } catch (FileSystemException fse) { + // On Linux, ignore the FSE if the path is one of the + // /run/user/$UID mounts created by pam_systemd(8) as it + // might be mounted as a fuse.portal filesystem and + // its access attempt might fail with EPERM + if (!Platform.isLinux() || store.toString().indexOf("/run/user") == -1) { + throw new RuntimeException(fse); + } else { + System.err.format("%s error: %s\n", store, fse); } - - // two distinct FileStores should not be equal - assertTrue(!store.equals(prev)); - prev = store; } - } else { - System.err.println - ("Skipping FileStore check due to file system access failure"); } } } From e3661b3cc5066b198f6cb5979deecd1d8d2c5450 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Fri, 13 Feb 2026 08:26:32 +0000 Subject: [PATCH 094/120] 8376664: Find a better place for the Atomic vmstructs toplevel declaration Reviewed-by: dholmes --- src/hotspot/share/gc/shared/vmStructs_gc.hpp | 2 +- src/hotspot/share/runtime/vmStructs.cpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/hotspot/share/gc/shared/vmStructs_gc.hpp b/src/hotspot/share/gc/shared/vmStructs_gc.hpp index 9348fd980f4..5bd87e6adf7 100644 --- a/src/hotspot/share/gc/shared/vmStructs_gc.hpp +++ b/src/hotspot/share/gc/shared/vmStructs_gc.hpp @@ -157,7 +157,7 @@ declare_toplevel_type(CollectedHeap*) \ declare_toplevel_type(ContiguousSpace*) \ declare_toplevel_type(HeapWord*) \ - declare_toplevel_type(HeapWord* volatile) \ + declare_toplevel_type(Atomic) \ declare_toplevel_type(MemRegion*) \ declare_toplevel_type(ThreadLocalAllocBuffer*) \ \ diff --git a/src/hotspot/share/runtime/vmStructs.cpp b/src/hotspot/share/runtime/vmStructs.cpp index 1bbef8537ff..36c55bd2ecc 100644 --- a/src/hotspot/share/runtime/vmStructs.cpp +++ b/src/hotspot/share/runtime/vmStructs.cpp @@ -904,7 +904,6 @@ /*****************************/ \ \ declare_toplevel_type(void*) \ - declare_toplevel_type(Atomic) \ declare_toplevel_type(int*) \ declare_toplevel_type(char*) \ declare_toplevel_type(char**) \ From 4e7106d8919652c1dcd4a501a11057e1a8179b3e Mon Sep 17 00:00:00 2001 From: Harshit Date: Fri, 13 Feb 2026 10:43:26 +0000 Subject: [PATCH 095/120] 8377035: [s390x] Disable JSR166 test cases which uses virtual threads Reviewed-by: jpai, alanb, amitkumar --- .../java/util/concurrent/tck/JSR166TestCase.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/jdk/java/util/concurrent/tck/JSR166TestCase.java b/test/jdk/java/util/concurrent/tck/JSR166TestCase.java index f1f32bee310..641fbf2e495 100644 --- a/test/jdk/java/util/concurrent/tck/JSR166TestCase.java +++ b/test/jdk/java/util/concurrent/tck/JSR166TestCase.java @@ -37,7 +37,9 @@ /* * @test id=default * @summary Conformance testing variant of JSR-166 tck tests. + * @library /test/lib * @build * + * @build jdk.test.lib.Platform * @modules java.management java.base/jdk.internal.util * @run junit/othervm/timeout=1000 JSR166TestCase */ @@ -46,7 +48,9 @@ * @test id=forkjoinpool-common-parallelism * @summary Test implementation details variant of JSR-166 * tck tests with ForkJoinPool common parallelism. + * @library /test/lib * @build * + * @build jdk.test.lib.Platform * @modules java.management java.base/jdk.internal.util * @run junit/othervm/timeout=1000 * --add-opens java.base/java.util.concurrent=ALL-UNNAMED @@ -68,7 +72,9 @@ * @summary Remaining test implementation details variant of * JSR-166 tck tests apart from ForkJoinPool common * parallelism. + * @library /test/lib * @build * + * @build jdk.test.lib.Platform * @modules java.management java.base/jdk.internal.util * @run junit/othervm/timeout=1000 * --add-opens java.base/java.util.concurrent=ALL-UNNAMED @@ -135,6 +141,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; import java.util.regex.Pattern; +import jdk.test.lib.Platform; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestResult; @@ -624,6 +631,13 @@ public class JSR166TestCase extends TestCase { "SynchronousQueue20Test", "ReentrantReadWriteLock20Test" }; + + if (Platform.isS390x()) { + java20TestClassNames = new String[] { + "ForkJoinPool20Test", + }; + } + addNamedTestClasses(suite, java20TestClassNames); } From 486ff5d3fcfa924ebcb0ce92c067a02b8f9a2ebd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Sj=C3=B6len?= Date: Fri, 13 Feb 2026 10:56:13 +0000 Subject: [PATCH 096/120] 8377455: Replace LinkedList with GrowableArray in VM.ThreadDump's OMTable Reviewed-by: dholmes, coleenp --- src/hotspot/share/runtime/vmOperations.cpp | 55 +++++++--------------- 1 file changed, 16 insertions(+), 39 deletions(-) diff --git a/src/hotspot/share/runtime/vmOperations.cpp b/src/hotspot/share/runtime/vmOperations.cpp index c5539fd5e50..ef480f04c57 100644 --- a/src/hotspot/share/runtime/vmOperations.cpp +++ b/src/hotspot/share/runtime/vmOperations.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,6 +51,7 @@ #include "runtime/threadSMR.inline.hpp" #include "runtime/vmOperations.hpp" #include "services/threadService.hpp" +#include "utilities/growableArray.hpp" #include "utilities/ticks.hpp" #define VM_OP_NAME_INITIALIZE(name) #name, @@ -286,42 +287,27 @@ class ObjectMonitorsDump : public MonitorClosure, public ObjectMonitorsView { } private: - class ObjectMonitorLinkedList : - public LinkedListImpl {}; + using ObjectMonitorList = GrowableArrayCHeap; // HashTable SIZE is specified at compile time so we // use 1031 which is the first prime after 1024. - typedef HashTable PtrTable; PtrTable* _ptrs; size_t _key_count; size_t _om_count; - void add_list(int64_t key, ObjectMonitorLinkedList* list) { - _ptrs->put(key, list); - _key_count++; - } - - ObjectMonitorLinkedList* get_list(int64_t key) { - ObjectMonitorLinkedList** listpp = _ptrs->get(key); - return (listpp == nullptr) ? nullptr : *listpp; - } - void add(ObjectMonitor* monitor) { int64_t key = monitor->owner(); - ObjectMonitorLinkedList* list = get_list(key); - if (list == nullptr) { - // Create new list and add it to the hash table: - list = new (mtThread) ObjectMonitorLinkedList; - _ptrs->put(key, list); + bool created = false; + ObjectMonitorList* list = _ptrs->put_if_absent(key, &created); + if (created) { _key_count++; } - assert(list->find(monitor) == nullptr, "Should not contain duplicates"); - list->add(monitor); // Add the ObjectMonitor to the list. + assert(list->find(monitor) == -1, "Should not contain duplicates"); + list->push(monitor); // Add the ObjectMonitor to the list. _om_count++; } @@ -332,17 +318,7 @@ class ObjectMonitorsDump : public MonitorClosure, public ObjectMonitorsView { ObjectMonitorsDump() : _ptrs(new (mtThread) PtrTable), _key_count(0), _om_count(0) {} ~ObjectMonitorsDump() { - class CleanupObjectMonitorsDump: StackObj { - public: - bool do_entry(int64_t& key, ObjectMonitorLinkedList*& list) { - list->clear(); // clear the LinkListNodes - delete list; // then delete the LinkedList - return true; - } - } cleanup; - - _ptrs->unlink(&cleanup); // cleanup the LinkedLists - delete _ptrs; // then delete the hash table + delete _ptrs; } // Implements MonitorClosure used to collect all owned monitors in the system @@ -368,11 +344,12 @@ class ObjectMonitorsDump : public MonitorClosure, public ObjectMonitorsView { // Implements the ObjectMonitorsView interface void visit(MonitorClosure* closure, JavaThread* thread) override { int64_t key = ObjectMonitor::owner_id_from(thread); - ObjectMonitorLinkedList* list = get_list(key); - LinkedListIterator iter(list != nullptr ? list->head() : nullptr); - while (!iter.is_empty()) { - ObjectMonitor* monitor = *iter.next(); - closure->do_monitor(monitor); + ObjectMonitorList* list = _ptrs->get(key); + if (list == nullptr) { + return; + } + for (int i = 0; i < list->length(); i++) { + closure->do_monitor(list->at(i)); } } From c78a2a8c34790c86087d85952c54bf889f09acbe Mon Sep 17 00:00:00 2001 From: Daniel Fuchs Date: Fri, 13 Feb 2026 15:38:31 +0000 Subject: [PATCH 097/120] 8377675: java.net.http tests should not depend on ../../../com/sun/net/httpserver test classes Reviewed-by: djelinski, jpai --- test/jdk/java/net/httpclient/EchoHandler.java | 88 ----- .../java/net/httpclient/HttpEchoHandler.java | 89 ----- .../net/httpclient/LightWeightHttpServer.java | 104 ++--- .../jdk/java/net/httpclient/ManyRequests.java | 62 +-- .../java/net/httpclient/ManyRequests2.java | 10 +- .../net/httpclient/ManyRequestsLegacy.java | 82 ++-- .../java/net/httpclient/RequestBodyTest.java | 11 +- test/jdk/java/net/httpclient/SmokeTest.java | 355 ++++++++---------- .../java/net/httpclient/http2/BasicTest.java | 40 +- .../java/net/httpclient/http2/ErrorTest.java | 14 +- .../httpclient/http2/FixedThreadPoolTest.java | 28 +- .../net/httpclient/http2/RedirectTest.java | 27 +- .../net/httpclient/http3/H3BasicTest.java | 41 +- .../http3/H3ConnectionPoolTest.java | 34 +- .../test/lib/common/HttpServerAdapters.java | 248 +++++++++++- .../test/lib/http2/EchoHandler.java | 85 ----- .../test/lib/http2/Http2EchoHandler.java | 102 ----- 17 files changed, 611 insertions(+), 809 deletions(-) delete mode 100644 test/jdk/java/net/httpclient/EchoHandler.java delete mode 100644 test/jdk/java/net/httpclient/HttpEchoHandler.java delete mode 100644 test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/EchoHandler.java delete mode 100644 test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2EchoHandler.java diff --git a/test/jdk/java/net/httpclient/EchoHandler.java b/test/jdk/java/net/httpclient/EchoHandler.java deleted file mode 100644 index 9fd86083801..00000000000 --- a/test/jdk/java/net/httpclient/EchoHandler.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import com.sun.net.httpserver.*; -import java.net.*; -import java.net.http.*; -import java.io.*; -import java.util.concurrent.*; -import javax.net.ssl.*; -import java.nio.file.*; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Random; -import jdk.test.lib.net.SimpleSSLContext; -import static java.net.http.HttpRequest.*; -import static java.net.http.HttpResponse.*; -import java.util.logging.ConsoleHandler; -import java.util.logging.Level; -import java.util.logging.Logger; - -public class EchoHandler implements HttpHandler { - static final Path CWD = Paths.get("."); - public EchoHandler() {} - - @Override - public void handle(HttpExchange t) - throws IOException { - try { - System.err.println("EchoHandler received request to " + t.getRequestURI()); - InputStream is = t.getRequestBody(); - Headers map = t.getRequestHeaders(); - Headers map1 = t.getResponseHeaders(); - map1.add("X-Hello", "world"); - map1.add("X-Bye", "universe"); - String fixedrequest = map.getFirst("XFixed"); - File outfile = Files.createTempFile(CWD, "foo", "bar").toFile(); - FileOutputStream fos = new FileOutputStream(outfile); - int count = (int) is.transferTo(fos); - is.close(); - fos.close(); - InputStream is1 = new FileInputStream(outfile); - OutputStream os = null; - // return the number of bytes received (no echo) - String summary = map.getFirst("XSummary"); - if (fixedrequest != null && summary == null) { - t.sendResponseHeaders(200, count); - os = t.getResponseBody(); - is1.transferTo(os); - } else { - t.sendResponseHeaders(200, 0); - os = t.getResponseBody(); - is1.transferTo(os); - - if (summary != null) { - String s = Integer.toString(count); - os.write(s.getBytes()); - } - } - outfile.delete(); - os.close(); - is1.close(); - } catch (Throwable e) { - e.printStackTrace(); - throw new IOException(e); - } - } -} diff --git a/test/jdk/java/net/httpclient/HttpEchoHandler.java b/test/jdk/java/net/httpclient/HttpEchoHandler.java deleted file mode 100644 index 319a5b901f9..00000000000 --- a/test/jdk/java/net/httpclient/HttpEchoHandler.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import com.sun.net.httpserver.*; -import java.net.*; -import java.net.http.*; -import java.io.*; -import java.util.concurrent.*; -import javax.net.ssl.*; -import java.nio.file.*; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Random; -import jdk.test.lib.net.SimpleSSLContext; -import static java.net.http.HttpRequest.*; -import static java.net.http.HttpResponse.*; -import java.util.logging.ConsoleHandler; -import java.util.logging.Level; -import java.util.logging.Logger; - -public class HttpEchoHandler implements HttpHandler { - static final Path CWD = Paths.get("."); - - public HttpEchoHandler() {} - - @Override - public void handle(HttpExchange t) - throws IOException { - try { - System.err.println("EchoHandler received request to " + t.getRequestURI()); - InputStream is = t.getRequestBody(); - Headers map = t.getRequestHeaders(); - Headers map1 = t.getResponseHeaders(); - map1.add("X-Hello", "world"); - map1.add("X-Bye", "universe"); - String fixedrequest = map.getFirst("XFixed"); - File outfile = Files.createTempFile(CWD, "foo", "bar").toFile(); - FileOutputStream fos = new FileOutputStream(outfile); - int count = (int) is.transferTo(fos); - is.close(); - fos.close(); - InputStream is1 = new FileInputStream(outfile); - OutputStream os = null; - // return the number of bytes received (no echo) - String summary = map.getFirst("XSummary"); - if (fixedrequest != null && summary == null) { - t.sendResponseHeaders(200, count); - os = t.getResponseBody(); - is1.transferTo(os); - } else { - t.sendResponseHeaders(200, 0); - os = t.getResponseBody(); - is1.transferTo(os); - - if (summary != null) { - String s = Integer.toString(count); - os.write(s.getBytes()); - } - } - outfile.delete(); - os.close(); - is1.close(); - } catch (Throwable e) { - e.printStackTrace(); - throw new IOException(e); - } - } -} diff --git a/test/jdk/java/net/httpclient/LightWeightHttpServer.java b/test/jdk/java/net/httpclient/LightWeightHttpServer.java index 496aa2c5778..9045d00829e 100644 --- a/test/jdk/java/net/httpclient/LightWeightHttpServer.java +++ b/test/jdk/java/net/httpclient/LightWeightHttpServer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ /** * library /test/lib / * build jdk.test.lib.net.SimpleSSLContext ProxyServer - * compile ../../../com/sun/net/httpserver/LogFilter.java - * compile ../../../com/sun/net/httpserver/EchoHandler.java - * compile ../../../com/sun/net/httpserver/FileServerHandler.java */ import com.sun.net.httpserver.Headers; import com.sun.net.httpserver.HttpContext; @@ -39,6 +36,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.net.InetAddress; import java.net.InetSocketAddress; +import java.net.http.HttpClient.Version; import java.nio.file.Path; import java.util.HashSet; import java.util.concurrent.BrokenBarrierException; @@ -50,14 +48,21 @@ import java.util.logging.Level; import java.util.logging.Logger; import javax.net.ssl.SSLContext; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.common.HttpServerAdapters.HttpTestContext; +import jdk.httpclient.test.lib.common.HttpServerAdapters.HttpTestEchoHandler; +import jdk.httpclient.test.lib.common.HttpServerAdapters.HttpTestExchange; +import jdk.httpclient.test.lib.common.HttpServerAdapters.HttpTestFileServerHandler; +import jdk.httpclient.test.lib.common.HttpServerAdapters.HttpTestHandler; +import jdk.httpclient.test.lib.common.HttpServerAdapters.HttpTestServer; import jdk.httpclient.test.lib.common.TestServerConfigurator; import jdk.test.lib.net.SimpleSSLContext; public class LightWeightHttpServer { static final SSLContext ctx = SimpleSSLContext.findSSLContext(); - static HttpServer httpServer; - static HttpsServer httpsServer; + static HttpTestServer httpServer; + static HttpTestServer httpsServer; static ExecutorService executor; static int port; static int httpsport; @@ -82,36 +87,31 @@ public class LightWeightHttpServer { ch.setLevel(Level.ALL); logger.addHandler(ch); + executor = Executors.newCachedThreadPool(); + String root = System.getProperty("test.src", ".") + "/docs"; InetSocketAddress addr = new InetSocketAddress(InetAddress.getLoopbackAddress(), 0); - httpServer = HttpServer.create(addr, 0); - if (httpServer instanceof HttpsServer) { - throw new RuntimeException("should not be httpsserver"); - } - httpsServer = HttpsServer.create(addr, 0); - HttpHandler h = new FileServerHandler(root); + httpServer = HttpTestServer.create(Version.HTTP_1_1, null, executor); + httpsServer = HttpTestServer.create(Version.HTTP_1_1, ctx, executor); + HttpTestHandler h = new HttpTestFileServerHandler(root); - HttpContext c1 = httpServer.createContext("/files", h); - HttpContext c2 = httpsServer.createContext("/files", h); - HttpContext c3 = httpServer.createContext("/echo", new EchoHandler()); + HttpTestContext c1 = httpServer.createContext("/files", h); + HttpTestContext c2 = httpsServer.createContext("/files", h); + HttpTestContext c3 = httpServer.createContext("/echo", new EchoHandler()); redirectHandler = new RedirectHandler("/redirect"); redirectHandlerSecure = new RedirectHandler("/redirect"); - HttpContext c4 = httpServer.createContext("/redirect", redirectHandler); - HttpContext c41 = httpsServer.createContext("/redirect", redirectHandlerSecure); - HttpContext c5 = httpsServer.createContext("/echo", new EchoHandler()); - HttpContext c6 = httpServer.createContext("/keepalive", new KeepAliveHandler()); + HttpTestContext c4 = httpServer.createContext("/redirect", redirectHandler); + HttpTestContext c41 = httpsServer.createContext("/redirect", redirectHandlerSecure); + HttpTestContext c5 = httpsServer.createContext("/echo", new EchoHandler()); + HttpTestContext c6 = httpServer.createContext("/keepalive", new KeepAliveHandler()); redirectErrorHandler = new RedirectErrorHandler("/redirecterror"); redirectErrorHandlerSecure = new RedirectErrorHandler("/redirecterror"); - HttpContext c7 = httpServer.createContext("/redirecterror", redirectErrorHandler); - HttpContext c71 = httpsServer.createContext("/redirecterror", redirectErrorHandlerSecure); + HttpTestContext c7 = httpServer.createContext("/redirecterror", redirectErrorHandler); + HttpTestContext c71 = httpsServer.createContext("/redirecterror", redirectErrorHandlerSecure); delayHandler = new DelayHandler(); - HttpContext c8 = httpServer.createContext("/delay", delayHandler); - HttpContext c81 = httpsServer.createContext("/delay", delayHandler); + HttpTestContext c8 = httpServer.createContext("/delay", delayHandler); + HttpTestContext c81 = httpsServer.createContext("/delay", delayHandler); - executor = Executors.newCachedThreadPool(); - httpServer.setExecutor(executor); - httpsServer.setExecutor(executor); - httpsServer.setHttpsConfigurator(new TestServerConfigurator(addr.getAddress(), ctx)); httpServer.start(); httpsServer.start(); @@ -136,10 +136,10 @@ public class LightWeightHttpServer { public static void stop() throws IOException { if (httpServer != null) { - httpServer.stop(0); + httpServer.stop(); } if (httpsServer != null) { - httpsServer.stop(0); + httpsServer.stop(); } if (proxy != null) { proxy.close(); @@ -149,7 +149,14 @@ public class LightWeightHttpServer { } } - static class RedirectErrorHandler implements HttpHandler { + static class EchoHandler extends HttpServerAdapters.HttpTestEchoHandler { + @Override + protected boolean useXFixed() { + return true; + } + } + + static class RedirectErrorHandler implements HttpTestHandler { String root; volatile int count = 1; @@ -167,23 +174,23 @@ public class LightWeightHttpServer { } @Override - public synchronized void handle(HttpExchange t) + public synchronized void handle(HttpTestExchange t) throws IOException { byte[] buf = new byte[2048]; try (InputStream is = t.getRequestBody()) { while (is.read(buf) != -1) ; } - Headers map = t.getResponseHeaders(); - String redirect = root + "/foo/" + Integer.toString(count); + var map = t.getResponseHeaders(); + String redirect = root + "/foo/" + count; increment(); - map.add("Location", redirect); - t.sendResponseHeaders(301, -1); + map.addHeader("Location", redirect); + t.sendResponseHeaders(301, HttpTestExchange.RSPBODY_EMPTY); t.close(); } } - static class RedirectHandler implements HttpHandler { + static class RedirectHandler implements HttpTestHandler { String root; volatile int count = 0; @@ -193,21 +200,21 @@ public class LightWeightHttpServer { } @Override - public synchronized void handle(HttpExchange t) + public synchronized void handle(HttpTestExchange t) throws IOException { byte[] buf = new byte[2048]; try (InputStream is = t.getRequestBody()) { while (is.read(buf) != -1) ; } - Headers map = t.getResponseHeaders(); + var map = t.getResponseHeaders(); if (count++ < 1) { - map.add("Location", root + "/foo/" + count); + map.addHeader("Location", root + "/foo/" + count); } else { - map.add("Location", SmokeTest.midSizedFilename); + map.addHeader("Location", SmokeTest.midSizedFilename); } - t.sendResponseHeaders(301, -1); + t.sendResponseHeaders(301, HttpTestExchange.RSPBODY_EMPTY); t.close(); } @@ -220,7 +227,7 @@ public class LightWeightHttpServer { } } - static class KeepAliveHandler implements HttpHandler { + static class KeepAliveHandler implements HttpTestHandler { volatile int counter = 0; HashSet portSet = new HashSet<>(); @@ -234,7 +241,7 @@ public class LightWeightHttpServer { } @Override - public synchronized void handle(HttpExchange t) + public synchronized void handle(HttpTestExchange t) throws IOException { int remotePort = t.getRemoteAddress().getPort(); String result = "OK"; @@ -286,14 +293,15 @@ public class LightWeightHttpServer { try (InputStream is = t.getRequestBody()) { while (is.read(buf) != -1) ; } - t.sendResponseHeaders(200, result.length()); + byte[] bytes = result.getBytes("US-ASCII"); + t.sendResponseHeaders(200, HttpTestExchange.fixedRsp(bytes.length)); OutputStream o = t.getResponseBody(); - o.write(result.getBytes("US-ASCII")); + o.write(bytes); t.close(); } } - static class DelayHandler implements HttpHandler { + static class DelayHandler implements HttpTestHandler { CyclicBarrier bar1 = new CyclicBarrier(2); CyclicBarrier bar2 = new CyclicBarrier(2); @@ -308,7 +316,7 @@ public class LightWeightHttpServer { } @Override - public synchronized void handle(HttpExchange he) throws IOException { + public synchronized void handle(HttpTestExchange he) throws IOException { try(InputStream is = he.getRequestBody()) { is.readAllBytes(); bar1.await(); @@ -316,7 +324,7 @@ public class LightWeightHttpServer { } catch (InterruptedException | BrokenBarrierException e) { throw new IOException(e); } - he.sendResponseHeaders(200, -1); // will probably fail + he.sendResponseHeaders(200, HttpTestExchange.RSPBODY_EMPTY); // will probably fail he.close(); } } diff --git a/test/jdk/java/net/httpclient/ManyRequests.java b/test/jdk/java/net/httpclient/ManyRequests.java index ee79ac80b68..3609aa8337a 100644 --- a/test/jdk/java/net/httpclient/ManyRequests.java +++ b/test/jdk/java/net/httpclient/ManyRequests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * 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,8 @@ * @test * @bug 8087112 8180044 8256459 * @key intermittent - * @modules java.net.http/jdk.internal.net.http.common - * java.logging - * jdk.httpserver * @library /test/lib /test/jdk/java/net/httpclient/lib - * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.common.TestServerConfigurator - * @compile ../../../com/sun/net/httpserver/LogFilter.java - * @compile ../../../com/sun/net/httpserver/EchoHandler.java - * @compile ../../../com/sun/net/httpserver/FileServerHandler.java + * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.common.HttpServerAdapters * @run main/othervm/timeout=160 -Djdk.httpclient.HttpClient.log=ssl,channel ManyRequests * @run main/othervm/timeout=160 -Djdk.httpclient.HttpClient.log=channel -Dtest.insertDelay=true ManyRequests * @run main/othervm/timeout=160 -Djdk.httpclient.HttpClient.log=channel -Dtest.chunkSize=64 ManyRequests @@ -41,19 +35,14 @@ */ // * @run main/othervm/timeout=40 -Djdk.httpclient.HttpClient.log=ssl,channel ManyRequests -import com.sun.net.httpserver.HttpsConfigurator; -import com.sun.net.httpserver.HttpsParameters; -import com.sun.net.httpserver.HttpsServer; -import com.sun.net.httpserver.HttpExchange; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.ConnectException; -import java.net.InetAddress; -import java.net.InetSocketAddress; import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpClient.Builder; +import java.net.http.HttpClient.Version; import java.net.http.HttpRequest; import java.net.http.HttpRequest.BodyPublishers; import java.net.http.HttpResponse; @@ -61,7 +50,6 @@ import java.net.http.HttpResponse.BodyHandlers; import java.time.Duration; import java.util.Arrays; import java.util.Formatter; -import java.util.HashMap; import java.util.LinkedList; import java.util.Map; import java.util.Random; @@ -77,15 +65,14 @@ import java.util.logging.Level; import java.util.concurrent.CompletableFuture; import java.util.stream.Stream; import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLParameters; -import jdk.httpclient.test.lib.common.TestServerConfigurator; +import jdk.httpclient.test.lib.common.HttpServerAdapters; import jdk.test.lib.Platform; import jdk.test.lib.RandomFactory; import jdk.test.lib.net.SimpleSSLContext; import jdk.test.lib.net.URIBuilder; -public class ManyRequests { +public class ManyRequests implements HttpServerAdapters { static final int MAX_COUNT = 50; static final int MAX_LIMIT = 40; @@ -106,11 +93,8 @@ public class ManyRequests { + ", XFixed=" + XFIXED); SSLContext ctx = SimpleSSLContext.findSSLContext(); - InetSocketAddress addr = new InetSocketAddress(InetAddress.getLoopbackAddress(), 0); - HttpsServer server = HttpsServer.create(addr, 0); ExecutorService executor = executorFor("HTTPS/1.1 Server Thread"); - server.setHttpsConfigurator(new Configurator(addr.getAddress(), ctx)); - server.setExecutor(executor); + HttpTestServer server = HttpTestServer.create(Version.HTTP_1_1, ctx, executor); ExecutorService virtualExecutor = Executors.newThreadPerTaskExecutor(Thread.ofVirtual() .name("HttpClient-Worker", 0).factory()); @@ -125,7 +109,7 @@ public class ManyRequests { System.out.println("OK"); } finally { client.close(); - server.stop(0); + server.stop(); virtualExecutor.close(); executor.shutdownNow(); } @@ -138,15 +122,15 @@ public class ManyRequests { Integer.parseInt(System.getProperty("test.chunkSize", "0"))); static final boolean XFIXED = Boolean.getBoolean("test.XFixed"); - static class TestEchoHandler extends EchoHandler { + static class TestEchoHandler extends HttpTestEchoHandler { final Random rand = RANDOM; @Override - public void handle(HttpExchange e) throws IOException { + public void handle(HttpTestExchange e) throws IOException { System.out.println("Server: received " + e.getRequestURI()); super.handle(e); } @Override - protected void close(HttpExchange t, OutputStream os) throws IOException { + protected void close(HttpTestExchange t, OutputStream os) throws IOException { if (INSERT_DELAY) { try { Thread.sleep(rand.nextInt(200)); } catch (InterruptedException e) {} @@ -155,7 +139,7 @@ public class ManyRequests { super.close(t, os); } @Override - protected void close(HttpExchange t, InputStream is) throws IOException { + protected void close(HttpTestExchange t, InputStream is) throws IOException { if (INSERT_DELAY) { try { Thread.sleep(rand.nextInt(200)); } catch (InterruptedException e) {} @@ -181,7 +165,7 @@ public class ManyRequests { return s; } - static void test(HttpsServer server, HttpClient client) throws Exception { + static void test(HttpTestServer server, HttpClient client) throws Exception { int port = server.getAddress().getPort(); URI baseURI = URIBuilder.newBuilder() @@ -213,8 +197,11 @@ public class ManyRequests { byte[] buf = new byte[(i + 1) * CHUNK_SIZE + i + 1]; // different size bodies rand.nextBytes(buf); URI uri = new URI(baseURI.toString() + String.valueOf(i + 1)); - HttpRequest r = HttpRequest.newBuilder(uri) - .header("XFixed", "true") + HttpRequest.Builder reqBuilder = HttpRequest.newBuilder(uri); + if (XFIXED) { + reqBuilder.header("XFixed", "yes"); + } + HttpRequest r = reqBuilder .POST(BodyPublishers.ofByteArray(buf)) .build(); bodies.put(r, buf); @@ -367,21 +354,6 @@ public class ManyRequests { throw new RuntimeException(sb.toString()); } - static class Configurator extends HttpsConfigurator { - private final InetAddress serverAddr; - public Configurator(InetAddress serverAddr, SSLContext ctx) { - super(ctx); - this.serverAddr = serverAddr; - } - - @Override - public void configure(HttpsParameters params) { - final SSLParameters parameters = getSSLContext().getSupportedSSLParameters(); - TestServerConfigurator.addSNIMatcher(this.serverAddr, parameters); - params.setSSLParameters(parameters); - } - } - private static ExecutorService executorFor(String serverThreadName) { ThreadFactory factory = new ThreadFactory() { final AtomicInteger counter = new AtomicInteger(); diff --git a/test/jdk/java/net/httpclient/ManyRequests2.java b/test/jdk/java/net/httpclient/ManyRequests2.java index a1e2307b820..09fdc18f687 100644 --- a/test/jdk/java/net/httpclient/ManyRequests2.java +++ b/test/jdk/java/net/httpclient/ManyRequests2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2026, Oracle and/or its affiliates. All rights reserved. * 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,8 @@ /* * @test * @bug 8087112 8180044 8256459 - * @modules java.net.http/jdk.internal.net.http.common - * java.logging - * jdk.httpserver * @library /test/lib /test/jdk/java/net/httpclient/lib - * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.common.TestServerConfigurator - * @compile ../../../com/sun/net/httpserver/LogFilter.java - * @compile ../../../com/sun/net/httpserver/EchoHandler.java - * @compile ../../../com/sun/net/httpserver/FileServerHandler.java + * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.common.HttpServerAdapters * @build ManyRequests ManyRequests2 * @run main/othervm/timeout=400 -Dsun.net.httpserver.idleInterval=400 -Dtest.XFixed=true * -Djdk.httpclient.HttpClient.log=channel ManyRequests2 diff --git a/test/jdk/java/net/httpclient/ManyRequestsLegacy.java b/test/jdk/java/net/httpclient/ManyRequestsLegacy.java index 2e58ee50bff..f1c4f881058 100644 --- a/test/jdk/java/net/httpclient/ManyRequestsLegacy.java +++ b/test/jdk/java/net/httpclient/ManyRequestsLegacy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * 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,8 @@ /* * @test - * @modules java.net.http/jdk.internal.net.http.common - * java.logging - * jdk.httpserver * @library /test/lib /test/jdk/java/net/httpclient/lib - * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.common.TestServerConfigurator - * @compile ../../../com/sun/net/httpserver/LogFilter.java - * @compile ../../../com/sun/net/httpserver/EchoHandler.java - * @compile ../../../com/sun/net/httpserver/FileServerHandler.java + * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.common.HttpServerAdapters * @run main/othervm/timeout=80 -Dsun.net.httpserver.idleInterval=50000 ManyRequestsLegacy * @run main/othervm/timeout=80 -Dtest.insertDelay=true -Dsun.net.httpserver.idleInterval=50000 ManyRequestsLegacy * @run main/othervm/timeout=80 -Dtest.chunkSize=64 -Dsun.net.httpserver.idleInterval=50000 ManyRequestsLegacy @@ -44,16 +38,11 @@ import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.HostnameVerifier; -import com.sun.net.httpserver.HttpsConfigurator; -import com.sun.net.httpserver.HttpsParameters; -import com.sun.net.httpserver.HttpsServer; -import com.sun.net.httpserver.HttpExchange; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.ConnectException; import java.net.HttpURLConnection; -import java.net.InetAddress; import java.net.URI; import java.net.URLConnection; import java.util.Map; @@ -62,10 +51,12 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionException; import java.util.concurrent.CompletionStage; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadFactory; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLParameters; import javax.net.ssl.SSLSession; import java.net.http.HttpClient; import java.net.http.HttpClient.Version; @@ -73,22 +64,22 @@ import java.net.http.HttpHeaders; import java.net.http.HttpRequest; import java.net.http.HttpRequest.BodyPublishers; import java.net.http.HttpResponse; -import java.net.InetSocketAddress; import java.util.Arrays; import java.util.Formatter; -import java.util.HashMap; import java.util.LinkedList; import java.util.Random; import java.util.logging.Logger; import java.util.logging.Level; -import jdk.httpclient.test.lib.common.TestServerConfigurator; +import jdk.httpclient.test.lib.common.HttpServerAdapters; import jdk.test.lib.Platform; import jdk.test.lib.RandomFactory; import jdk.test.lib.net.SimpleSSLContext; +import jdk.test.lib.net.URIBuilder; + import static java.net.Proxy.NO_PROXY; -public class ManyRequestsLegacy { +public class ManyRequestsLegacy implements HttpServerAdapters { static final int MAX_COUNT = 20; static final int MAX_LIMIT = 40; @@ -112,9 +103,8 @@ public class ManyRequestsLegacy { return true; } }); - InetSocketAddress addr = new InetSocketAddress(InetAddress.getLoopbackAddress(), 0); - HttpsServer server = HttpsServer.create(addr, 0); - server.setHttpsConfigurator(new Configurator(addr.getAddress(), ctx)); + ExecutorService executor = executorFor("HTTPS/1.1 Server Thread"); + HttpTestServer server = HttpTestServer.create(Version.HTTP_1_1, ctx, executor); LegacyHttpClient client = new LegacyHttpClient(); @@ -122,7 +112,7 @@ public class ManyRequestsLegacy { test(server, client); System.out.println("OK"); } finally { - server.stop(0); + server.stop(); } } @@ -210,15 +200,15 @@ public class ManyRequestsLegacy { } } - static class TestEchoHandler extends EchoHandler { + static class TestEchoHandler extends HttpTestEchoHandler { final Random rand = RANDOM; @Override - public void handle(HttpExchange e) throws IOException { + public void handle(HttpTestExchange e) throws IOException { System.out.println("Server: received " + e.getRequestURI()); super.handle(e); } @Override - protected void close(HttpExchange t, OutputStream os) throws IOException { + protected void close(HttpTestExchange t, OutputStream os) throws IOException { if (INSERT_DELAY) { try { Thread.sleep(rand.nextInt(200)); } catch (InterruptedException e) {} @@ -227,7 +217,7 @@ public class ManyRequestsLegacy { os.close(); } @Override - protected void close(HttpExchange t, InputStream is) throws IOException { + protected void close(HttpTestExchange t, InputStream is) throws IOException { if (INSERT_DELAY) { try { Thread.sleep(rand.nextInt(200)); } catch (InterruptedException e) {} @@ -253,9 +243,13 @@ public class ManyRequestsLegacy { return s; } - static void test(HttpsServer server, LegacyHttpClient client) throws Exception { + static void test(HttpTestServer server, LegacyHttpClient client) throws Exception { int port = server.getAddress().getPort(); - URI baseURI = new URI("https://localhost:" + port + "/foo/x"); + URI baseURI = URIBuilder.newBuilder() + .scheme("https") + .loopback() + .port(port) + .path("/foo/x").build(); server.createContext("/foo", new TestEchoHandler()); server.start(); @@ -279,8 +273,11 @@ public class ManyRequestsLegacy { byte[] buf = new byte[(i + 1) * CHUNK_SIZE + i + 1]; // different size bodies rand.nextBytes(buf); URI uri = new URI(baseURI.toString() + String.valueOf(i + 1)); - HttpRequest r = HttpRequest.newBuilder(uri) - .header("XFixed", "true") + HttpRequest.Builder reqBuilder = HttpRequest.newBuilder(uri); + if (XFIXED) { + reqBuilder.header("XFixed", "yes"); + } + HttpRequest r = reqBuilder .POST(BodyPublishers.ofByteArray(buf)) .build(); bodies.put(r, buf); @@ -432,19 +429,16 @@ public class ManyRequestsLegacy { throw new RuntimeException(sb.toString()); } - static class Configurator extends HttpsConfigurator { - private final InetAddress serverAddr; - - public Configurator(InetAddress serverAddr, SSLContext ctx) { - super(ctx); - this.serverAddr = serverAddr; - } - - @Override - public void configure(HttpsParameters params) { - final SSLParameters parameters = getSSLContext().getSupportedSSLParameters(); - TestServerConfigurator.addSNIMatcher(this.serverAddr, parameters); - params.setSSLParameters(parameters); - } + private static ExecutorService executorFor(String serverThreadName) { + ThreadFactory factory = new ThreadFactory() { + final AtomicInteger counter = new AtomicInteger(); + @Override + public Thread newThread(Runnable r) { + Thread thread = new Thread(r); + thread.setName(serverThreadName + "#" + counter.incrementAndGet()); + return thread; + } + }; + return Executors.newCachedThreadPool(factory); } } diff --git a/test/jdk/java/net/httpclient/RequestBodyTest.java b/test/jdk/java/net/httpclient/RequestBodyTest.java index 668e834e1f0..e43336610f0 100644 --- a/test/jdk/java/net/httpclient/RequestBodyTest.java +++ b/test/jdk/java/net/httpclient/RequestBodyTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -56,14 +56,9 @@ import static org.testng.Assert.*; /* * @test * @bug 8087112 - * @modules java.net.http/jdk.internal.net.http.common - * java.logging - * jdk.httpserver * @library /test/lib /test/jdk/java/net/httpclient/lib - * @compile ../../../com/sun/net/httpserver/LogFilter.java - * @compile ../../../com/sun/net/httpserver/EchoHandler.java - * @compile ../../../com/sun/net/httpserver/FileServerHandler.java - * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.common.TestServerConfigurator + * @build jdk.test.lib.net.SimpleSSLContext + * jdk.httpclient.test.lib.common.HttpServerAdapters * @build LightWeightHttpServer * @build jdk.test.lib.Platform * @build jdk.test.lib.util.FileUtils diff --git a/test/jdk/java/net/httpclient/SmokeTest.java b/test/jdk/java/net/httpclient/SmokeTest.java index 42c082a5e0f..f87cc462fac 100644 --- a/test/jdk/java/net/httpclient/SmokeTest.java +++ b/test/jdk/java/net/httpclient/SmokeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * 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,39 +24,25 @@ /* * @test * @bug 8087112 8178699 8338569 - * @modules java.net.http/jdk.internal.net.http.common - * java.logging - * jdk.httpserver * @library /test/lib /test/jdk/java/net/httpclient/lib / * @build jdk.test.lib.net.SimpleSSLContext ProxyServer * jdk.httpclient.test.lib.common.TestServerConfigurator - * @compile ../../../com/sun/net/httpserver/LogFilter.java - * @compile ../../../com/sun/net/httpserver/FileServerHandler.java * @run main/othervm * -Djdk.internal.httpclient.debug=true * -Djdk.httpclient.HttpClient.log=errors,ssl,trace * SmokeTest */ -import com.sun.net.httpserver.Headers; -import com.sun.net.httpserver.HttpContext; -import com.sun.net.httpserver.HttpExchange; -import com.sun.net.httpserver.HttpHandler; -import com.sun.net.httpserver.HttpServer; -import com.sun.net.httpserver.HttpsConfigurator; -import com.sun.net.httpserver.HttpsParameters; -import com.sun.net.httpserver.HttpsServer; - import java.net.InetAddress; import java.net.Proxy; import java.net.SocketAddress; +import java.net.http.HttpClient.Version; import java.net.http.HttpHeaders; import java.nio.charset.StandardCharsets; import java.util.Collections; import java.util.Optional; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicInteger; import java.net.InetSocketAddress; import java.net.PasswordAuthentication; @@ -94,7 +80,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Random; -import jdk.httpclient.test.lib.common.TestServerConfigurator; +import jdk.httpclient.test.lib.common.HttpServerAdapters; import jdk.test.lib.net.SimpleSSLContext; import static java.nio.file.StandardOpenOption.TRUNCATE_EXISTING; import static java.nio.file.StandardOpenOption.WRITE; @@ -120,11 +106,11 @@ import java.util.logging.Logger; * Uses a FileServerHandler serving a couple of known files * in docs directory. */ -public class SmokeTest { +public class SmokeTest implements HttpServerAdapters { private static final SSLContext ctx = SimpleSSLContext.findSSLContext(); static SSLParameters sslparams; - static HttpServer s1 ; - static HttpsServer s2; + static HttpTestServer s1 ; + static HttpTestServer s2; static ExecutorService executor; static int port; static int httpsport; @@ -142,19 +128,10 @@ public class SmokeTest { static Path smallFile; static String fileroot; - static class HttpEchoHandler implements HttpHandler { - + static class HttpEchoHandler extends HttpTestEchoHandler { @Override - public void handle(HttpExchange exchange) throws IOException { - try (InputStream is = exchange.getRequestBody(); - OutputStream os = exchange.getResponseBody()) { - byte[] bytes = is.readAllBytes(); - long responseLength = bytes.length == 0 ? -1 : bytes.length; - boolean fixedLength = "yes".equals(exchange.getRequestHeaders() - .getFirst("XFixed")); - exchange.sendResponseHeaders(200, fixedLength ? responseLength : 0); - os.write(bytes); - } + protected boolean useXFixed() { + return true; } } @@ -242,8 +219,8 @@ public class SmokeTest { //test12(httproot + "delay/foo", delayHandler); } finally { - s1.stop(0); - s2.stop(0); + s1.stop(); + s2.stop(); proxy.close(); e.shutdownNow(); executor.shutdownNow(); @@ -779,38 +756,31 @@ public class SmokeTest { ch.setLevel(Level.SEVERE); logger.addHandler(ch); - String root = System.getProperty ("test.src", ".")+ "/docs"; - InetSocketAddress addr = new InetSocketAddress(InetAddress.getLoopbackAddress(), 0); - s1 = HttpServer.create (addr, 0); - if (s1 instanceof HttpsServer) { - throw new RuntimeException ("should not be httpsserver"); - } - s2 = HttpsServer.create (addr, 0); - HttpHandler h = new FileServerHandler(root); + sslparams = ctx.getDefaultSSLParameters(); + executor = Executors.newCachedThreadPool(); - HttpContext c1 = s1.createContext("/files", h); - HttpContext c2 = s2.createContext("/files", h); - HttpContext c3 = s1.createContext("/echo", new HttpEchoHandler()); + String root = System.getProperty ("test.src", ".")+ "/docs"; + s1 = HttpTestServer.create(Version.HTTP_1_1, null, executor); + s2 = HttpTestServer.create(Version.HTTP_1_1, ctx, executor); + HttpTestHandler h = new HttpTestFileServerHandler(root); + + HttpTestContext c1 = s1.createContext("/files", h); + HttpTestContext c2 = s2.createContext("/files", h); + HttpTestContext c3 = s1.createContext("/echo", new HttpEchoHandler()); redirectHandler = new RedirectHandler("/redirect"); redirectHandlerSecure = new RedirectHandler("/redirect"); - HttpContext c4 = s1.createContext("/redirect", redirectHandler); - HttpContext c41 = s2.createContext("/redirect", redirectHandlerSecure); - HttpContext c5 = s2.createContext("/echo", new HttpEchoHandler()); - HttpContext c6 = s1.createContext("/keepalive", new KeepAliveHandler()); + HttpTestContext c4 = s1.createContext("/redirect", redirectHandler); + HttpTestContext c41 = s2.createContext("/redirect", redirectHandlerSecure); + HttpTestContext c5 = s2.createContext("/echo", new HttpEchoHandler()); + HttpTestContext c6 = s1.createContext("/keepalive", new KeepAliveHandler()); redirectErrorHandler = new RedirectErrorHandler("/redirecterror"); redirectErrorHandlerSecure = new RedirectErrorHandler("/redirecterror"); - HttpContext c7 = s1.createContext("/redirecterror", redirectErrorHandler); - HttpContext c71 = s2.createContext("/redirecterror", redirectErrorHandlerSecure); + HttpTestContext c7 = s1.createContext("/redirecterror", redirectErrorHandler); + HttpTestContext c71 = s2.createContext("/redirecterror", redirectErrorHandlerSecure); delayHandler = new DelayHandler(); - HttpContext c8 = s1.createContext("/delay", delayHandler); - HttpContext c81 = s2.createContext("/delay", delayHandler); + HttpTestContext c8 = s1.createContext("/delay", delayHandler); + HttpTestContext c81 = s2.createContext("/delay", delayHandler); - executor = Executors.newCachedThreadPool(); - s1.setExecutor(executor); - s2.setExecutor(executor); - sslparams = ctx.getDefaultSSLParameters(); - //sslparams.setProtocols(new String[]{"TLSv1.2"}); - s2.setHttpsConfigurator(new Configurator(addr.getAddress(), ctx)); s1.start(); s2.start(); @@ -839,7 +809,7 @@ public class SmokeTest { } } - static class RedirectHandler implements HttpHandler { + static class RedirectHandler implements HttpTestHandler { private final String root; private volatile int count = 0; @@ -848,17 +818,17 @@ public class SmokeTest { } @Override - public synchronized void handle(HttpExchange t) throws IOException { + public synchronized void handle(HttpTestExchange t) throws IOException { try (InputStream is = t.getRequestBody()) { is.readAllBytes(); } - Headers responseHeaders = t.getResponseHeaders(); + var responseHeaders = t.getResponseHeaders(); if (count++ < 1) { - responseHeaders.add("Location", root + "/foo/" + count); + responseHeaders.addHeader("Location", root + "/foo/" + count); } else { - responseHeaders.add("Location", SmokeTest.midSizedFilename); + responseHeaders.addHeader("Location", SmokeTest.midSizedFilename); } t.sendResponseHeaders(301, 64 * 1024); byte[] bb = new byte[1024]; @@ -879,7 +849,7 @@ public class SmokeTest { } } - static class RedirectErrorHandler implements HttpHandler { + static class RedirectErrorHandler implements HttpTestHandler { private final String root; private volatile int count = 1; @@ -896,21 +866,21 @@ public class SmokeTest { } @Override - public synchronized void handle(HttpExchange t) throws IOException { + public synchronized void handle(HttpTestExchange t) throws IOException { try (InputStream is = t.getRequestBody()) { is.readAllBytes(); } - Headers map = t.getResponseHeaders(); - String redirect = root + "/foo/" + Integer.toString(count); + var map = t.getResponseHeaders(); + String redirect = root + "/foo/" + count; increment(); - map.add("Location", redirect); - t.sendResponseHeaders(301, -1); + map.addHeader("Location", redirect); + t.sendResponseHeaders(301, HttpTestExchange.RSPBODY_EMPTY); t.close(); } } - static class DelayHandler implements HttpHandler { + static class DelayHandler implements HttpTestHandler { CyclicBarrier bar1 = new CyclicBarrier(2); CyclicBarrier bar2 = new CyclicBarrier(2); @@ -925,34 +895,17 @@ public class SmokeTest { } @Override - public synchronized void handle(HttpExchange he) throws IOException { + public synchronized void handle(HttpTestExchange he) throws IOException { he.getRequestBody().readAllBytes(); try { bar1.await(); bar2.await(); } catch (Exception e) { } - he.sendResponseHeaders(200, -1); // will probably fail + he.sendResponseHeaders(200, HttpTestExchange.RSPBODY_EMPTY); // will probably fail he.close(); } } - static class Configurator extends HttpsConfigurator { - private final InetAddress serverAddr; - - public Configurator(InetAddress serverAddr, SSLContext ctx) { - super(ctx); - this.serverAddr = serverAddr; - } - - @Override - public void configure(final HttpsParameters params) { - final SSLParameters p = getSSLContext().getDefaultSSLParameters(); - TestServerConfigurator.addSNIMatcher(this.serverAddr, p); - //p.setProtocols(new String[]{"TLSv1.2"}); - params.setSSLParameters(p); - } - } - static final Path CWD = Paths.get("."); static Path getTempFile(int size) throws IOException { @@ -971,120 +924,132 @@ public class SmokeTest { fos.close(); return f.toPath(); } -} -// check for simple hardcoded sequence and use remote address -// to check. -// First 4 requests executed in sequence (should use same connection/address) -// Next 4 requests parallel (should use different addresses) -// Then send 4 requests in parallel x 100 times (same four addresses used all time) -class KeepAliveHandler implements HttpHandler { - final AtomicInteger counter = new AtomicInteger(0); - final AtomicInteger nparallel = new AtomicInteger(0); + // check for simple hardcoded sequence and use remote address + // to check. + // First 4 requests executed in sequence (should use same connection/address) + // Next 4 requests parallel (should use different addresses) + // Then send 4 requests in parallel x 100 times (same four addresses used all time) - final Set portSet = Collections.synchronizedSet(new HashSet<>()); + static class KeepAliveHandler implements HttpTestHandler { + final AtomicInteger counter = new AtomicInteger(0); + final AtomicInteger nparallel = new AtomicInteger(0); - final int[] ports = new int[8]; + final Set portSet = Collections.synchronizedSet(new HashSet<>()); - void sleep(int n) { - try { - Thread.sleep(n); - } catch (InterruptedException e) {} - } + final int[] ports = new int[8]; - synchronized void setPort(int index, int value) { - ports[index] = value; - } - - synchronized int getPort(int index) { - return ports[index]; - } - - synchronized void getPorts(int[] dest, int from) { - dest[0] = ports[from+0]; - dest[1] = ports[from+1]; - dest[2] = ports[from+2]; - dest[3] = ports[from+3]; - } - - static final CountDownLatch latch = new CountDownLatch(4); - static final CountDownLatch latch7 = new CountDownLatch(4); - static final CountDownLatch latch8 = new CountDownLatch(1); - - @Override - public void handle (HttpExchange t) - throws IOException - { - int np = nparallel.incrementAndGet(); - int remotePort = t.getRemoteAddress().getPort(); - String result = "OK"; - int[] lports = new int[4]; - - int n = counter.getAndIncrement(); - - /// First test - if (n < 4) { - setPort(n, remotePort); - } - if (n == 3) { - getPorts(lports, 0); - // check all values in ports[] are the same - if (lports[0] != lports[1] || lports[2] != lports[3] - || lports[0] != lports[2]) { - result = "Error " + Integer.toString(n); - System.out.println(result); - } - } - // Second test - if (n >=4 && n < 8) { - // delay so that this connection doesn't get reused - // before all 4 requests sent - setPort(n, remotePort); - latch.countDown(); - try {latch.await();} catch (InterruptedException e) {} - latch7.countDown(); - } - if (n == 7) { - // wait until all n <= 7 have called setPort(...) - try {latch7.await();} catch (InterruptedException e) {} - getPorts(lports, 4); - // should be all different - if (lports[0] == lports[1] || lports[2] == lports[3] - || lports[0] == lports[2]) { - result = "Error " + Integer.toString(n); - System.out.println(result); - } - // setup for third test - for (int i=0; i<4; i++) { - portSet.add(lports[i]); - } - System.out.printf("Ports: %d, %d, %d, %d\n", lports[0], lports[1], lports[2], lports[3]); - latch8.countDown(); - } - // Third test - if (n > 7) { - // wait until all n == 7 has updated portSet - try {latch8.await();} catch (InterruptedException e) {} - if (np > 4) { - System.err.println("XXX np = " + np); - } - // just check that port is one of the ones in portSet - if (!portSet.contains(remotePort)) { - System.out.println ("UNEXPECTED REMOTE PORT " - + remotePort + " not in " + portSet); - result = "Error " + Integer.toString(n); - System.out.println(result); + void sleep(int n) { + try { + Thread.sleep(n); + } catch (InterruptedException e) { } } - try (InputStream is = t.getRequestBody()) { - is.readAllBytes(); + synchronized void setPort(int index, int value) { + ports[index] = value; + } + + synchronized int getPort(int index) { + return ports[index]; + } + + synchronized void getPorts(int[] dest, int from) { + dest[0] = ports[from + 0]; + dest[1] = ports[from + 1]; + dest[2] = ports[from + 2]; + dest[3] = ports[from + 3]; + } + + static final CountDownLatch latch = new CountDownLatch(4); + static final CountDownLatch latch7 = new CountDownLatch(4); + static final CountDownLatch latch8 = new CountDownLatch(1); + + @Override + public void handle(HttpTestExchange t) + throws IOException { + int np = nparallel.incrementAndGet(); + int remotePort = t.getRemoteAddress().getPort(); + String result = "OK"; + int[] lports = new int[4]; + + int n = counter.getAndIncrement(); + + /// First test + if (n < 4) { + setPort(n, remotePort); + } + if (n == 3) { + getPorts(lports, 0); + // check all values in ports[] are the same + if (lports[0] != lports[1] || lports[2] != lports[3] + || lports[0] != lports[2]) { + result = "Error " + Integer.toString(n); + System.out.println(result); + } + } + // Second test + if (n >= 4 && n < 8) { + // delay so that this connection doesn't get reused + // before all 4 requests sent + setPort(n, remotePort); + latch.countDown(); + try { + latch.await(); + } catch (InterruptedException e) { + } + latch7.countDown(); + } + if (n == 7) { + // wait until all n <= 7 have called setPort(...) + try { + latch7.await(); + } catch (InterruptedException e) { + } + getPorts(lports, 4); + // should be all different + if (lports[0] == lports[1] || lports[2] == lports[3] + || lports[0] == lports[2]) { + result = "Error " + Integer.toString(n); + System.out.println(result); + } + // setup for third test + for (int i = 0; i < 4; i++) { + portSet.add(lports[i]); + } + System.out.printf("Ports: %d, %d, %d, %d\n", lports[0], lports[1], lports[2], lports[3]); + latch8.countDown(); + } + // Third test + if (n > 7) { + // wait until all n == 7 has updated portSet + try { + latch8.await(); + } catch (InterruptedException e) { + } + if (np > 4) { + System.err.println("XXX np = " + np); + } + // just check that port is one of the ones in portSet + if (!portSet.contains(remotePort)) { + System.out.println("UNEXPECTED REMOTE PORT " + + remotePort + " not in " + portSet); + result = "Error " + Integer.toString(n); + System.out.println(result); + } + } + + try (InputStream is = t.getRequestBody()) { + is.readAllBytes(); + } + byte[] bytes = result.getBytes(StandardCharsets.UTF_8); + long responseLength = HttpTestExchange.fixedRsp(bytes.length); + t.sendResponseHeaders(200, responseLength); + OutputStream o = t.getResponseBody(); + o.write(bytes); + t.close(); + nparallel.getAndDecrement(); } - t.sendResponseHeaders(200, result.length()); - OutputStream o = t.getResponseBody(); - o.write(result.getBytes(StandardCharsets.UTF_8)); - t.close(); - nparallel.getAndDecrement(); } } diff --git a/test/jdk/java/net/httpclient/http2/BasicTest.java b/test/jdk/java/net/httpclient/http2/BasicTest.java index 58ab191fc6f..ddcf707e875 100644 --- a/test/jdk/java/net/httpclient/http2/BasicTest.java +++ b/test/jdk/java/net/httpclient/http2/BasicTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * 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 @@ * @library /test/jdk/java/net/httpclient/lib * /test/lib * @build jdk.httpclient.test.lib.http2.Http2TestServer - * jdk.httpclient.test.lib.http2.Http2TestExchange - * jdk.httpclient.test.lib.http2.Http2EchoHandler * jdk.test.lib.Asserts * jdk.test.lib.Utils * jdk.test.lib.net.SimpleSSLContext @@ -49,9 +47,9 @@ import java.util.concurrent.*; import java.util.Collections; import java.util.LinkedList; import java.util.List; + +import jdk.httpclient.test.lib.common.HttpServerAdapters; import jdk.httpclient.test.lib.http2.Http2TestServer; -import jdk.httpclient.test.lib.http2.Http2TestExchange; -import jdk.httpclient.test.lib.http2.Http2EchoHandler; import jdk.test.lib.net.SimpleSSLContext; import org.junit.jupiter.api.Test; @@ -60,13 +58,13 @@ import static jdk.test.lib.Asserts.assertFileContentsEqual; import static jdk.test.lib.Utils.createTempFile; import static jdk.test.lib.Utils.createTempFileOfSize; -public class BasicTest { +public class BasicTest implements HttpServerAdapters { private static final String TEMP_FILE_PREFIX = HttpClient.class.getPackageName() + '-' + BasicTest.class.getSimpleName() + '-'; static int httpPort, httpsPort; - static Http2TestServer httpServer, httpsServer; + static HttpTestServer httpServer, httpsServer; static HttpClient client = null; static ExecutorService clientExec; static ExecutorService serverExec; @@ -77,18 +75,20 @@ public class BasicTest { static void initialize() throws Exception { try { client = getClient(); - httpServer = new Http2TestServer(false, 0, serverExec, sslContext); - httpServer.addHandler(new Http2EchoHandler(), "/"); + httpServer = HttpTestServer.of( + new Http2TestServer(false, 0, serverExec, sslContext)); + httpServer.addHandler(new HttpTestFileEchoHandler(), "/"); httpServer.addHandler(new EchoWithPingHandler(), "/ping"); httpPort = httpServer.getAddress().getPort(); - httpsServer = new Http2TestServer(true, 0, serverExec, sslContext); - httpsServer.addHandler(new Http2EchoHandler(), "/"); + httpsServer = HttpTestServer.of( + new Http2TestServer(true, 0, serverExec, sslContext)); + httpsServer.addHandler(new HttpTestFileEchoHandler(), "/"); httpsPort = httpsServer.getAddress().getPort(); - httpURIString = "http://localhost:" + httpPort + "/foo/"; - pingURIString = "http://localhost:" + httpPort + "/ping/"; - httpsURIString = "https://localhost:" + httpsPort + "/bar/"; + httpURIString = "http://" + httpServer.serverAuthority() + "/foo/"; + pingURIString = "http://" + httpServer.serverAuthority() + "/ping/"; + httpsURIString = "https://" + httpsServer.serverAuthority() + "/bar/"; httpServer.start(); httpsServer.start(); @@ -104,11 +104,11 @@ public class BasicTest { static CompletableFuture currentCF; - static class EchoWithPingHandler extends Http2EchoHandler { + static class EchoWithPingHandler extends HttpTestFileEchoHandler { private final Object lock = new Object(); @Override - public void handle(Http2TestExchange exchange) throws IOException { + public void handle(HttpTestExchange exchange) throws IOException { // for now only one ping active at a time. don't want to saturate synchronized(lock) { CompletableFuture cf = currentCF; @@ -221,17 +221,17 @@ public class BasicTest { } static void paramsTest() throws Exception { - httpsServer.addHandler((t -> { + httpsServer.addHandler(((HttpTestExchange t) -> { SSLSession s = t.getSSLSession(); String prot = s.getProtocol(); if (prot.equals("TLSv1.2") || prot.equals("TLSv1.3")) { - t.sendResponseHeaders(200, -1); + t.sendResponseHeaders(200, HttpTestExchange.RSPBODY_EMPTY); } else { System.err.printf("Protocols =%s\n", prot); - t.sendResponseHeaders(500, -1); + t.sendResponseHeaders(500, HttpTestExchange.RSPBODY_EMPTY); } }), "/"); - URI u = new URI("https://localhost:"+httpsPort+"/foo"); + URI u = new URI("https://" + httpsServer.serverAuthority() + "/foo"); HttpClient client = getClient(); HttpRequest req = HttpRequest.newBuilder(u).build(); HttpResponse resp = client.send(req, BodyHandlers.ofString()); diff --git a/test/jdk/java/net/httpclient/http2/ErrorTest.java b/test/jdk/java/net/httpclient/http2/ErrorTest.java index 6ecc27441e1..6b36529b38f 100644 --- a/test/jdk/java/net/httpclient/http2/ErrorTest.java +++ b/test/jdk/java/net/httpclient/http2/ErrorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -60,8 +60,9 @@ import javax.net.ssl.SSLContext; import javax.net.ssl.SSLParameters; import java.util.concurrent.Executors; import java.util.concurrent.ExecutorService; + +import jdk.httpclient.test.lib.common.HttpServerAdapters; import jdk.httpclient.test.lib.http2.Http2TestServer; -import jdk.httpclient.test.lib.http2.Http2EchoHandler; import jdk.test.lib.net.SimpleSSLContext; import static java.net.http.HttpClient.Version.HTTP_2; @@ -73,7 +74,7 @@ import org.testng.annotations.Test; * But, the exception that was thrown was not being returned up to application * causing hang problems */ -public class ErrorTest { +public class ErrorTest implements HttpServerAdapters { static final String[] CIPHER_SUITES = new String[]{ "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384" }; @@ -91,16 +92,17 @@ public class ErrorTest { .version(HTTP_2) .build(); - Http2TestServer httpsServer = null; + HttpTestServer httpsServer = null; try { SSLContext serverContext = SimpleSSLContext.findSSLContext(); SSLParameters p = serverContext.getSupportedSSLParameters(); p.setApplicationProtocols(new String[]{"h2"}); - httpsServer = new Http2TestServer(true, + Http2TestServer httpsServerImpl = new Http2TestServer(true, 0, exec, serverContext); - httpsServer.addHandler(new Http2EchoHandler(), "/"); + httpsServer = HttpTestServer.of(httpsServerImpl); + httpsServer.addHandler(new HttpTestFileEchoHandler(), "/"); int httpsPort = httpsServer.getAddress().getPort(); String httpsURIString = "https://localhost:" + httpsPort + "/bar/"; diff --git a/test/jdk/java/net/httpclient/http2/FixedThreadPoolTest.java b/test/jdk/java/net/httpclient/http2/FixedThreadPoolTest.java index 0f807c33dff..2378b0b6982 100644 --- a/test/jdk/java/net/httpclient/http2/FixedThreadPoolTest.java +++ b/test/jdk/java/net/httpclient/http2/FixedThreadPoolTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * @library /test/jdk/java/net/httpclient/lib * /test/lib * @build jdk.httpclient.test.lib.http2.Http2TestServer - * jdk.httpclient.test.lib.http2.Http2EchoHandler * jdk.test.lib.Asserts * jdk.test.lib.Utils * jdk.test.lib.net.SimpleSSLContext @@ -41,8 +40,10 @@ import java.net.http.HttpResponse.BodyHandlers; import javax.net.ssl.*; import java.nio.file.*; import java.util.concurrent.*; + +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestExchange; import jdk.httpclient.test.lib.http2.Http2TestServer; -import jdk.httpclient.test.lib.http2.Http2EchoHandler; import jdk.test.lib.net.SimpleSSLContext; import static java.net.http.HttpClient.Version.HTTP_2; @@ -52,14 +53,13 @@ import static jdk.test.lib.Utils.createTempFileOfSize; import org.testng.annotations.Test; -@Test -public class FixedThreadPoolTest { +public class FixedThreadPoolTest implements HttpServerAdapters { private static final String TEMP_FILE_PREFIX = HttpClient.class.getPackageName() + '-' + FixedThreadPoolTest.class.getSimpleName() + '-'; static int httpPort, httpsPort; - static Http2TestServer httpServer, httpsServer; + static HttpTestServer httpServer, httpsServer; static HttpClient client = null; static ExecutorService exec; private static final SSLContext sslContext = SimpleSSLContext.findSSLContext(); @@ -69,16 +69,18 @@ public class FixedThreadPoolTest { static void initialize() throws Exception { try { client = getClient(); - httpServer = new Http2TestServer(false, 0, exec, sslContext); - httpServer.addHandler(new Http2EchoHandler(), "/"); + httpServer = HttpTestServer.of( + new Http2TestServer(false, 0, exec, sslContext)); + httpServer.addHandler(new HttpTestFileEchoHandler(), "/"); httpPort = httpServer.getAddress().getPort(); - httpsServer = new Http2TestServer(true, 0, exec, sslContext); - httpsServer.addHandler(new Http2EchoHandler(), "/"); + httpsServer = HttpTestServer.of( + new Http2TestServer(true, 0, exec, sslContext)); + httpsServer.addHandler(new HttpTestFileEchoHandler(), "/"); httpsPort = httpsServer.getAddress().getPort(); - httpURIString = "http://localhost:" + httpPort + "/foo/"; - httpsURIString = "https://localhost:" + httpsPort + "/bar/"; + httpURIString = "http://" + httpServer.serverAuthority() + "/foo/"; + httpsURIString = "https://" + httpsServer.serverAuthority() + "/bar/"; httpServer.start(); httpsServer.start(); @@ -193,7 +195,7 @@ public class FixedThreadPoolTest { static void paramsTest() throws Exception { System.err.println("paramsTest"); Http2TestServer server = new Http2TestServer(true, 0, exec, sslContext); - server.addHandler((t -> { + server.addHandler(((Http2TestExchange t) -> { SSLSession s = t.getSSLSession(); String prot = s.getProtocol(); if (prot.equals(expectedTLSVersion(sslContext))) { diff --git a/test/jdk/java/net/httpclient/http2/RedirectTest.java b/test/jdk/java/net/httpclient/http2/RedirectTest.java index 1d7b894bc40..e2acd807bd5 100644 --- a/test/jdk/java/net/httpclient/http2/RedirectTest.java +++ b/test/jdk/java/net/httpclient/http2/RedirectTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ * @library /test/lib /test/jdk/java/net/httpclient/lib * @build jdk.httpclient.test.lib.http2.Http2TestExchange * jdk.httpclient.test.lib.http2.Http2TestServer - * jdk.httpclient.test.lib.http2.Http2EchoHandler * jdk.httpclient.test.lib.http2.Http2RedirectHandler * jdk.test.lib.Asserts * jdk.test.lib.net.SimpleSSLContext @@ -48,16 +47,17 @@ import java.util.concurrent.*; import java.util.function.*; import java.util.Arrays; import java.util.Iterator; + +import jdk.httpclient.test.lib.common.HttpServerAdapters; import jdk.httpclient.test.lib.http2.Http2TestServer; import jdk.httpclient.test.lib.http2.Http2TestExchange; -import jdk.httpclient.test.lib.http2.Http2EchoHandler; import jdk.httpclient.test.lib.http2.Http2RedirectHandler; import org.testng.annotations.Test; import static java.net.http.HttpClient.Version.HTTP_2; -public class RedirectTest { +public class RedirectTest implements HttpServerAdapters { static int httpPort; - static Http2TestServer httpServer; + static HttpTestServer httpServer; static HttpClient client; static String httpURIString, altURIString1, altURIString2; @@ -105,23 +105,26 @@ public class RedirectTest { static void initialize() throws Exception { try { client = getClient(); - httpServer = new Http2TestServer(false, 0, null, null); + Http2TestServer http2ServerImpl = + new Http2TestServer(false, 0, null, null); + httpServer = HttpTestServer.of(http2ServerImpl); httpPort = httpServer.getAddress().getPort(); // urls are accessed in sequence below. The first two are on // different servers. Third on same server as second. So, the // client should use the same http connection. - httpURIString = "http://localhost:" + httpPort + "/foo/"; + httpURIString = "http://" + httpServer.serverAuthority() + "/foo/"; httpURI = URI.create(httpURIString); - altURIString1 = "http://localhost:" + httpPort + "/redir"; + altURIString1 = "http://" + httpServer.serverAuthority() + "/redir"; altURI1 = URI.create(altURIString1); - altURIString2 = "http://localhost:" + httpPort + "/redir_again"; + altURIString2 = "http://" + httpServer.serverAuthority() + "/redir_again"; altURI2 = URI.create(altURIString2); + // TODO: remove dependency on Http2RedirectHandler Redirector r = new Redirector(sup(altURIString1, altURIString2)); - httpServer.addHandler(r, "/foo"); - httpServer.addHandler(r, "/redir"); - httpServer.addHandler(new Http2EchoHandler(), "/redir_again"); + http2ServerImpl.addHandler(r, "/foo"); + http2ServerImpl.addHandler(r, "/redir"); + httpServer.addHandler(new HttpTestFileEchoHandler(), "/redir_again"); httpServer.start(); } catch (Throwable e) { diff --git a/test/jdk/java/net/httpclient/http3/H3BasicTest.java b/test/jdk/java/net/httpclient/http3/H3BasicTest.java index 79002d98995..a03df11c1a3 100644 --- a/test/jdk/java/net/httpclient/http3/H3BasicTest.java +++ b/test/jdk/java/net/httpclient/http3/H3BasicTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -57,8 +57,6 @@ import java.util.concurrent.atomic.AtomicInteger; import jdk.httpclient.test.lib.common.HttpServerAdapters; import jdk.httpclient.test.lib.http2.Http2TestServer; -import jdk.httpclient.test.lib.http2.Http2TestExchange; -import jdk.httpclient.test.lib.http2.Http2EchoHandler; import jdk.httpclient.test.lib.http3.Http3TestServer; import jdk.test.lib.RandomFactory; import jdk.test.lib.net.SimpleSSLContext; @@ -79,8 +77,8 @@ public class H3BasicTest implements HttpServerAdapters { private static final String CLASS_NAME = H3BasicTest.class.getSimpleName(); static int http3Port, https2Port; - static Http3TestServer http3OnlyServer; - static Http2TestServer https2AltSvcServer; + static HttpTestServer http3OnlyServer; + static HttpTestServer https2AltSvcServer; static HttpClient client = null; static ExecutorService clientExec; static ExecutorService serverExec; @@ -92,20 +90,21 @@ public class H3BasicTest implements HttpServerAdapters { client = getClient(); // server that only supports HTTP/3 - http3OnlyServer = new Http3TestServer(sslContext, serverExec); - http3OnlyServer.addHandler("/", new Http2EchoHandler()); - http3OnlyServer.addHandler("/ping", new EchoWithPingHandler()); + http3OnlyServer = HttpTestServer.of(new Http3TestServer(sslContext, serverExec)); + http3OnlyServer.createContext("/", new HttpTestFileEchoHandler()); + http3OnlyServer.createContext("/ping", new EchoWithPingHandler()); http3Port = http3OnlyServer.getAddress().getPort(); System.out.println("HTTP/3 server started at localhost:" + http3Port); // server that supports both HTTP/2 and HTTP/3, with HTTP/3 on an altSvc port. - https2AltSvcServer = new Http2TestServer(true, 0, serverExec, sslContext); + Http2TestServer http2ServerImpl = new Http2TestServer(true, 0, serverExec, sslContext); if (RANDOM.nextBoolean()) { - https2AltSvcServer.enableH3AltServiceOnEphemeralPort(); + http2ServerImpl.enableH3AltServiceOnEphemeralPort(); } else { - https2AltSvcServer.enableH3AltServiceOnSamePort(); + http2ServerImpl.enableH3AltServiceOnSamePort(); } - https2AltSvcServer.addHandler(new Http2EchoHandler(), "/"); + https2AltSvcServer = HttpTestServer.of(http2ServerImpl); + https2AltSvcServer.addHandler(new HttpTestFileEchoHandler(), "/"); https2Port = https2AltSvcServer.getAddress().getPort(); if (https2AltSvcServer.supportsH3DirectConnection()) { System.out.println("HTTP/2 server (same HTTP/3 origin) started at localhost:" + https2Port); @@ -113,9 +112,9 @@ public class H3BasicTest implements HttpServerAdapters { System.out.println("HTTP/2 server (different HTTP/3 origin) started at localhost:" + https2Port); } - http3URIString = "https://localhost:" + http3Port + "/foo/"; - pingURIString = "https://localhost:" + http3Port + "/ping/"; - https2URIString = "https://localhost:" + https2Port + "/bar/"; + http3URIString = "https://" + http3OnlyServer.serverAuthority() + "/foo/"; + pingURIString = "https://" + http3OnlyServer.serverAuthority() + "/ping/"; + https2URIString = "https://" + https2AltSvcServer.serverAuthority() + "/bar/"; http3OnlyServer.start(); https2AltSvcServer.start(); @@ -131,11 +130,11 @@ public class H3BasicTest implements HttpServerAdapters { static CompletableFuture currentCF; - static class EchoWithPingHandler extends Http2EchoHandler { + static class EchoWithPingHandler extends HttpTestFileEchoHandler { private final Object lock = new Object(); @Override - public void handle(Http2TestExchange exchange) throws IOException { + public void handle(HttpTestExchange exchange) throws IOException { // for now only one ping active at a time. don't want to saturate System.out.println("PING handler invoked for " + exchange.getRequestURI()); synchronized(lock) { @@ -292,16 +291,16 @@ public class H3BasicTest implements HttpServerAdapters { } static void paramsTest() throws Exception { - URI u = new URI("https://localhost:"+https2Port+"/foo"); + URI u = new URI("https://" + https2AltSvcServer.serverAuthority() + "/foo"); System.out.println("paramsTest: Request to " + u); - https2AltSvcServer.addHandler((t -> { + https2AltSvcServer.addHandler(((HttpTestExchange t) -> { SSLSession s = t.getSSLSession(); String prot = s.getProtocol(); if (prot.equals("TLSv1.3")) { - t.sendResponseHeaders(200, -1); + t.sendResponseHeaders(200, HttpTestExchange.RSPBODY_EMPTY); } else { System.err.printf("Protocols =%s\n", prot); - t.sendResponseHeaders(500, -1); + t.sendResponseHeaders(500, HttpTestExchange.RSPBODY_EMPTY); } }), "/"); HttpClient client = getClient(); diff --git a/test/jdk/java/net/httpclient/http3/H3ConnectionPoolTest.java b/test/jdk/java/net/httpclient/http3/H3ConnectionPoolTest.java index 0449db3e961..c90059ccbfd 100644 --- a/test/jdk/java/net/httpclient/http3/H3ConnectionPoolTest.java +++ b/test/jdk/java/net/httpclient/http3/H3ConnectionPoolTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.net.http.HttpResponse.BodyHandlers; -import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -51,9 +50,7 @@ import java.util.function.Supplier; import javax.net.ssl.SSLContext; import jdk.httpclient.test.lib.common.HttpServerAdapters; -import jdk.httpclient.test.lib.http2.Http2Handler; import jdk.httpclient.test.lib.http2.Http2TestServer; -import jdk.httpclient.test.lib.http2.Http2EchoHandler; import jdk.httpclient.test.lib.http3.Http3TestServer; import jdk.test.lib.net.SimpleSSLContext; import org.testng.annotations.Test; @@ -73,17 +70,17 @@ public class H3ConnectionPoolTest implements HttpServerAdapters { private static final String CLASS_NAME = H3ConnectionPoolTest.class.getSimpleName(); static int altsvcPort, https2Port, http3Port; - static Http3TestServer http3OnlyServer; - static Http2TestServer https2AltSvcServer; + static HttpTestServer http3OnlyServer; + static HttpTestServer https2AltSvcServer; static volatile HttpClient client = null; private static final SSLContext sslContext = SimpleSSLContext.findSSLContext(); static volatile String http3OnlyURIString, https2URIString, http3AltSvcURIString, http3DirectURIString; static void initialize(boolean samePort) throws Exception { - initialize(samePort, Http2EchoHandler::new); + initialize(samePort, HttpTestFileEchoHandler::new); } - static void initialize(boolean samePort, Supplier handlers) throws Exception { + static void initialize(boolean samePort, Supplier handlers) throws Exception { System.out.println("\nConfiguring for advertised AltSvc on " + (samePort ? "same port" : "ephemeral port")); try { @@ -91,16 +88,17 @@ public class H3ConnectionPoolTest implements HttpServerAdapters { client = getClient(); // server that supports both HTTP/2 and HTTP/3, with HTTP/3 on an altSvc port. - https2AltSvcServer = new Http2TestServer(true, sslContext); + Http2TestServer serverImpl = new Http2TestServer(true, sslContext); if (samePort) { System.out.println("Attempting to enable advertised HTTP/3 service on same port"); - https2AltSvcServer.enableH3AltServiceOnSamePort(); + serverImpl.enableH3AltServiceOnSamePort(); System.out.println("Advertised AltSvc on same port " + - (https2AltSvcServer.supportsH3DirectConnection() ? "enabled" : " not enabled")); + (serverImpl.supportsH3DirectConnection() ? "enabled" : " not enabled")); } else { System.out.println("Attempting to enable advertised HTTP/3 service on different port"); - https2AltSvcServer.enableH3AltServiceOnEphemeralPort(); + serverImpl.enableH3AltServiceOnEphemeralPort(); } + https2AltSvcServer = HttpTestServer.of(serverImpl); https2AltSvcServer.addHandler(handlers.get(), "/" + CLASS_NAME + "/https2/"); https2AltSvcServer.addHandler(handlers.get(), "/" + CLASS_NAME + "/h2h3/"); https2Port = https2AltSvcServer.getAddress().getPort(); @@ -113,18 +111,20 @@ public class H3ConnectionPoolTest implements HttpServerAdapters { // one advertised (the alt service endpoint og the HTTP/2 server) // one non advertised (the direct endpoint, at the same authority as HTTP/2, but which // is in fact our http3OnlyServer) + Http3TestServer http3ServerImpl; try { - http3OnlyServer = new Http3TestServer(sslContext, samePort ? 0 : https2Port); + http3ServerImpl = new Http3TestServer(sslContext, samePort ? 0 : https2Port); System.out.println("Unadvertised service enabled on " + (samePort ? "ephemeral port" : "same port")); } catch (IOException ex) { System.out.println("Can't create HTTP/3 server on same port: " + ex); - http3OnlyServer = new Http3TestServer(sslContext, 0); + http3ServerImpl = new Http3TestServer(sslContext, 0); } - http3OnlyServer.addHandler("/" + CLASS_NAME + "/http3/", handlers.get()); - http3OnlyServer.addHandler("/" + CLASS_NAME + "/h2h3/", handlers.get()); + http3OnlyServer = HttpTestServer.of(http3ServerImpl); + http3OnlyServer.createContext("/" + CLASS_NAME + "/http3/", handlers.get()); + http3OnlyServer.createContext("/" + CLASS_NAME + "/h2h3/", handlers.get()); http3OnlyServer.start(); - http3Port = http3OnlyServer.getQuicServer().getAddress().getPort(); + http3Port = http3ServerImpl.getQuicServer().getAddress().getPort(); if (http3Port == https2Port) { System.out.println("HTTP/3 server enabled on same port than HTTP/2 server"); diff --git a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/common/HttpServerAdapters.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/common/HttpServerAdapters.java index 10633340a66..86ea3c8fdcd 100644 --- a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/common/HttpServerAdapters.java +++ b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/common/HttpServerAdapters.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -251,6 +251,60 @@ public interface HttpServerAdapters { * A version agnostic adapter class for HTTP Server Exchange. */ public static abstract class HttpTestExchange implements AutoCloseable { + /** + * This constant can be passed to {@link #sendResponseHeaders(int, long)} + * to indicate an empty response. + */ + public static final int RSPBODY_EMPTY = 0; + /** + * This constant can be passed to {@link #sendResponseHeaders(int, long)} + * to indicate that the response will be chunked. + */ + public static final int RSPBODY_CHUNKED = -1; + + /** + * {@return the response length to pass to {@link #sendResponseHeaders(int, long)} + * if the response is not chunked} + * @param bytes the response length + */ + public static long fixedRsp(long bytes) { + return bytes == 0 ? RSPBODY_EMPTY : bytes; + } + + /** + * {@return the response length to pass to {@link #sendResponseHeaders(int, long)}} + * This is the response length when `chunked` is false, and + * {@link #RSPBODY_CHUNKED} otherwise. + * @param length The number of bytes to send + * @param chunked Whether the response should be chunked + */ + public static long responseLength(long length, boolean chunked) { + return chunked ? HttpTestExchange.RSPBODY_CHUNKED : fixedRsp(length); + } + + /** + * {@return true if the {@linkplain #getRequestHeaders() request headers} + * contain {@code XFixed: yes}} + */ + public boolean rspFixedRequested() { + return "yes".equals(getRequestHeaders() + .firstValue("XFixed") + .orElse(null)); + } + + /** + * {@return the length to be passed to {@link #sendResponseHeaders(int, long)}, + * taking into account whether using {@linkplain #rspFixedRequested() + * fixed length was requested} in the {@linkplain #getRequestHeaders() + * request headers}.} + * By default, returns {@link #RSPBODY_CHUNKED} unless {@linkplain + * #rspFixedRequested() fixed length was requested}. + * @param length the length to use in content-length if fixed length is used. + */ + public long responseLength(long length) { + return responseLength(length, !rspFixedRequested()); + } + public abstract Version getServerVersion(); public abstract Version getExchangeVersion(); public abstract InputStream getRequestBody(); @@ -265,6 +319,10 @@ public interface HttpServerAdapters { public abstract InetSocketAddress getLocalAddress(); public abstract String getConnectionKey(); public abstract SSLSession getSSLSession(); + public CompletableFuture sendPing() { + throw new UnsupportedOperationException("sendPing not supported on " + + getExchangeVersion()); + } public void serverPush(URI uri, HttpHeaders reqHeaders, byte[] body) throws IOException { ByteArrayInputStream bais = new ByteArrayInputStream(body); serverPush(uri, reqHeaders, bais); @@ -543,6 +601,11 @@ public interface HttpServerAdapters { throws IOException { exchange.serverPush(uri, reqHeaders, rspHeaders, body); } + @Override + public CompletableFuture sendPing() { + return exchange.sendPing(); + } + @Override public void requestStopSending(long errorCode) { exchange.requestStopSending(errorCode); @@ -701,7 +764,8 @@ public interface HttpServerAdapters { /** * An echo handler that can be used to transfer large amount of data, and - * uses file on the file system to download the input. + * uses file on the file system to download the input. This handler honors + * the {@code XFixed} header. */ // TODO: it would be good if we could merge this with the Http2EchoHandler, // from which this code was copied and adapted. @@ -737,7 +801,7 @@ public interface HttpServerAdapters { assertFileContentsEqual(check, outfile.toPath()); } catch (Throwable x) { System.err.println("Files do not match: " + x); - t.sendResponseHeaders(500, -1); + t.sendResponseHeaders(500, HttpTestExchange.RSPBODY_EMPTY); outfile.delete(); os.close(); return; @@ -747,7 +811,7 @@ public interface HttpServerAdapters { // return the number of bytes received (no echo) String summary = requestHeaders.firstValue("XSummary").orElse(null); if (fixedrequest != null && summary == null) { - t.sendResponseHeaders(200, count); + t.sendResponseHeaders(200, HttpTestExchange.fixedRsp(count)); os = t.getResponseBody(); if (!t.getRequestMethod().equals("HEAD")) { long count1 = is1.transferTo(os); @@ -756,7 +820,7 @@ public interface HttpServerAdapters { System.err.printf("EchoHandler HEAD received, no bytes sent%n"); } } else { - t.sendResponseHeaders(200, -1); + t.sendResponseHeaders(200, HttpTestExchange.RSPBODY_CHUNKED); os = t.getResponseBody(); if (!t.getRequestMethod().equals("HEAD")) { long count1 = is1.transferTo(os); @@ -780,6 +844,14 @@ public interface HttpServerAdapters { } } + /** + * An echo handler that can be used to transfer small amounts of data. + * All the request data is read in memory in a single byte array before + * being sent back. If the handler is {@linkplain #useXFixed() configured + * to honor the {@code XFixed} header}, and the request headers do not + * specify {@code XFixed: yes}, the data is sent back in chunk mode. + * Otherwise, chunked mode is not used (this is the default). + */ public static class HttpTestEchoHandler implements HttpTestHandler { private final boolean printBytes; @@ -791,10 +863,24 @@ public interface HttpServerAdapters { this.printBytes = printBytes; } + /** + * {@return whether the {@code XFixed} header should be + * honored. If this method returns false, chunked mode will + * not be used. If this method returns true, chunked mode + * will be used unless the request headers contain + * {@code XFixed: yes}} + */ + protected boolean useXFixed() { + return false; + } + @Override public void handle(HttpTestExchange t) throws IOException { - try (InputStream is = t.getRequestBody(); - OutputStream os = t.getResponseBody()) { + InputStream is = null; + OutputStream os = null; + try { + is = t.getRequestBody(); + os = t.getResponseBody(); byte[] bytes = is.readAllBytes(); if (printBytes) { printBytes(System.out, "Echo server got " @@ -804,12 +890,31 @@ public interface HttpServerAdapters { t.getResponseHeaders().addHeader("Content-type", t.getRequestHeaders().firstValue("Content-type").get()); } - t.sendResponseHeaders(200, bytes.length); + + long responseLength = useXFixed() + ? t.responseLength(bytes.length) + : HttpTestExchange.fixedRsp(bytes.length); + t.sendResponseHeaders(200, responseLength); if (!t.getRequestMethod().equals("HEAD")) { os.write(bytes); } + } finally { + if (os != null) close(t, os); + if (is != null) close(t, is); } } + protected void close(OutputStream os) throws IOException { + os.close(); + } + protected void close(InputStream is) throws IOException { + is.close(); + } + protected void close(HttpTestExchange t, OutputStream os) throws IOException { + close(os); + } + protected void close(HttpTestExchange t, InputStream is) throws IOException { + close(is); + } } public static class HttpTestRedirectHandler implements HttpTestHandler { @@ -854,6 +959,117 @@ public interface HttpServerAdapters { } } + /** + * A simple FileServerHandler that understand "XFixed" header. + * If the request headers contain {@code XFixed: yes}, a fixed + * length response is sent. Otherwise, the response will be + * chunked. Note that for directories the response is always + * chunked. + */ + class HttpTestFileServerHandler implements HttpTestHandler { + + String docroot; + + public HttpTestFileServerHandler(String docroot) { + this.docroot = docroot; + } + + public void handle(HttpTestExchange t) + throws IOException + { + InputStream is = t.getRequestBody(); + var rspHeaders = t.getResponseHeaders(); + URI uri = t.getRequestURI(); + String path = uri.getPath(); + + int x = 0; + while (is.read() != -1) x++; + is.close(); + File f = new File(docroot, path); + if (!f.exists()) { + notfound(t, path); + return; + } + + String method = t.getRequestMethod(); + if (method.equals("HEAD")) { + rspHeaders.addHeader("Content-Length", Long.toString(f.length())); + t.sendResponseHeaders(200, HttpTestExchange.RSPBODY_EMPTY); + t.close(); + } else if (!method.equals("GET")) { + t.sendResponseHeaders(405, HttpTestExchange.RSPBODY_EMPTY); + t.close(); + return; + } + + if (path.endsWith(".html") || path.endsWith(".htm")) { + rspHeaders.addHeader("Content-Type", "text/html"); + } else { + rspHeaders.addHeader("Content-Type", "text/plain"); + } + if (f.isDirectory()) { + if (!path.endsWith("/")) { + moved (t); + return; + } + rspHeaders.addHeader("Content-Type", "text/html"); + t.sendResponseHeaders(200, HttpTestExchange.RSPBODY_CHUNKED); + String[] list = f.list(); + try (final OutputStream os = t.getResponseBody(); + final PrintStream p = new PrintStream(os)) { + p.println("

Directory listing for: " + path + "

"); + p.println("
    "); + for (int i = 0; i < list.length; i++) { + p.println("
  • " + list[i] + "
  • "); + } + p.println("


"); + p.flush(); + } + } else { + long clen = f.length(); + t.sendResponseHeaders(200, t.responseLength(clen)); + long count = 0; + try (final OutputStream os = t.getResponseBody(); + final FileInputStream fis = new FileInputStream (f)) { + byte[] buf = new byte [16 * 1024]; + int len; + while ((len=fis.read(buf)) != -1) { + os.write(buf, 0, len); + count += len; + } + if (clen != count) { + System.err.println("FileServerHandler: WARNING: count of bytes sent does not match content-length"); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + void moved(HttpTestExchange t) throws IOException { + var req = t.getRequestHeaders(); + var rsp = t.getResponseHeaders(); + URI uri = t.getRequestURI(); + String host = req.firstValue("Host").get(); + String location = "http://"+host+uri.getPath() + "/"; + rsp.addHeader("Content-Type", "text/html"); + rsp.addHeader("Location", location); + t.sendResponseHeaders(301, HttpTestExchange.RSPBODY_EMPTY); + t.close(); + } + + void notfound(HttpTestExchange t, String p) throws IOException { + t.getResponseHeaders().addHeader("Content-Type", "text/html"); + t.sendResponseHeaders(404, HttpTestExchange.RSPBODY_CHUNKED); + OutputStream os = t.getResponseBody(); + String s = "

File not found

"; + s = s + p + "

"; + os.write(s.getBytes()); + os.close(); + t.close(); + } + } + public static boolean expectException(HttpTestExchange e) { HttpTestRequestHeaders h = e.getRequestHeaders(); Optional expectException = h.firstValue("X-expect-exception"); @@ -1144,6 +1360,22 @@ public interface HttpServerAdapters { public abstract InetSocketAddress getAddress(); public abstract Version getVersion(); + /** + * Adds a new handler and return its context. + * @implSpec + * This method just returns {@link #addHandler(HttpTestHandler, String) + * addHandler(context, root)} + * @apiNote + * This is a convenience method to help migrate from + * {@link HttpServer#createContext(String, HttpHandler)}. + * @param root The context root + * @param handler The handler to attach to the context + * @return the context to which the new handler is attached + */ + public HttpTestContext createContext(String root, HttpTestHandler handler) { + return addHandler(handler, root); + } + /** * {@return the HTTP3 test server which is acting as an alt-service for this server, * if any} diff --git a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/EchoHandler.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/EchoHandler.java deleted file mode 100644 index 047b52b3699..00000000000 --- a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/EchoHandler.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved. - * 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.httpclient.test.lib.http2; - -import java.io.*; -import java.net.http.HttpHeaders; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; - -import jdk.internal.net.http.common.HttpHeadersBuilder; - -public class EchoHandler implements Http2Handler { - static final Path CWD = Paths.get("."); - - public EchoHandler() {} - - @Override - public void handle(Http2TestExchange t) - throws IOException { - try { - System.err.println("EchoHandler received request to " + t.getRequestURI()); - InputStream is = t.getRequestBody(); - HttpHeaders map = t.getRequestHeaders(); - HttpHeadersBuilder map1 = t.getResponseHeaders(); - map1.addHeader("X-Hello", "world"); - map1.addHeader("X-Bye", "universe"); - String fixedrequest = map.firstValue("XFixed").orElse(null); - File outfile = Files.createTempFile(CWD, "foo", "bar").toFile(); - //System.err.println ("QQQ = " + outfile.toString()); - FileOutputStream fos = new FileOutputStream(outfile); - int count = (int) is.transferTo(fos); - System.err.printf("EchoHandler read %d bytes\n", count); - is.close(); - fos.close(); - InputStream is1 = new FileInputStream(outfile); - OutputStream os = null; - // return the number of bytes received (no echo) - String summary = map.firstValue("XSummary").orElse(null); - if (fixedrequest != null && summary == null) { - t.sendResponseHeaders(200, count); - os = t.getResponseBody(); - int count1 = (int)is1.transferTo(os); - System.err.printf("EchoHandler wrote %d bytes\n", count1); - } else { - t.sendResponseHeaders(200, 0); - os = t.getResponseBody(); - int count1 = (int)is1.transferTo(os); - System.err.printf("EchoHandler wrote %d bytes\n", count1); - - if (summary != null) { - String s = Integer.toString(count); - os.write(s.getBytes()); - } - } - outfile.delete(); - os.close(); - is1.close(); - } catch (Throwable e) { - e.printStackTrace(); - throw new IOException(e); - } - } -} diff --git a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2EchoHandler.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2EchoHandler.java deleted file mode 100644 index fd0b03ac691..00000000000 --- a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2EchoHandler.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. - * 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.httpclient.test.lib.http2; - -import java.io.*; -import java.net.http.HttpHeaders; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; - -import jdk.internal.net.http.common.HttpHeadersBuilder; - -import static jdk.test.lib.Asserts.assertFileContentsEqual; - -public class Http2EchoHandler implements Http2Handler { - static final Path CWD = Paths.get("."); - - public Http2EchoHandler() {} - - @Override - public void handle(Http2TestExchange t) - throws IOException { - try { - System.err.printf("EchoHandler received request to %s from %s\n", - t.getRequestURI(), t.getRemoteAddress()); - InputStream is = t.getRequestBody(); - HttpHeaders map = t.getRequestHeaders(); - HttpHeadersBuilder headersBuilder = t.getResponseHeaders(); - headersBuilder.addHeader("X-Hello", "world"); - headersBuilder.addHeader("X-Bye", "universe"); - String fixedrequest = map.firstValue("XFixed").orElse(null); - File outfile = Files.createTempFile(CWD, "foo", "bar").toFile(); - //System.err.println ("QQQ = " + outfile.toString()); - FileOutputStream fos = new FileOutputStream(outfile); - long count = is.transferTo(fos); - System.err.printf("EchoHandler read %s bytes\n", count); - is.close(); - fos.close(); - InputStream is1 = new FileInputStream(outfile); - OutputStream os = null; - - Path check = map.firstValue("X-Compare").map((String s) -> Path.of(s)).orElse(null); - if (check != null) { - System.err.println("EchoHandler checking file match: " + check); - try { - assertFileContentsEqual(check, outfile.toPath()); - } catch (Throwable x) { - System.err.println("Files do not match: " + x); - t.sendResponseHeaders(500, -1); - outfile.delete(); - os.close(); - return; - } - } - - // return the number of bytes received (no echo) - String summary = map.firstValue("XSummary").orElse(null); - if (fixedrequest != null && summary == null) { - t.sendResponseHeaders(200, count); - os = t.getResponseBody(); - long count1 = is1.transferTo(os); - System.err.printf("EchoHandler wrote %s bytes\n", count1); - } else { - t.sendResponseHeaders(200, 0); - os = t.getResponseBody(); - long count1 = is1.transferTo(os); - System.err.printf("EchoHandler wrote %s bytes\n", count1); - - if (summary != null) { - String s = Long.toString(count); - os.write(s.getBytes()); - } - } - outfile.delete(); - os.close(); - is1.close(); - } catch (Throwable e) { - e.printStackTrace(); - throw new IOException(e); - } - } -} From a98d3a76a5d44096321aa02ed86e865066c89bdc Mon Sep 17 00:00:00 2001 From: Jeremy Wood Date: Fri, 13 Feb 2026 19:33:54 +0000 Subject: [PATCH 098/120] 4197755: Arc2D.getBounds() returns an unnecessarily large bounding box Reviewed-by: prr, psadhukhan --- .../share/classes/java/awt/geom/Arc2D.java | 26 +++--- .../awt/geom/Arc2D/Arc2DGetBoundsTest.java | 88 +++++++++++++++++++ 2 files changed, 100 insertions(+), 14 deletions(-) create mode 100644 test/jdk/java/awt/geom/Arc2D/Arc2DGetBoundsTest.java diff --git a/src/java.desktop/share/classes/java/awt/geom/Arc2D.java b/src/java.desktop/share/classes/java/awt/geom/Arc2D.java index 6646a14537e..7402dc98691 100644 --- a/src/java.desktop/share/classes/java/awt/geom/Arc2D.java +++ b/src/java.desktop/share/classes/java/awt/geom/Arc2D.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * 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 @@ package java.awt.geom; +import java.awt.Rectangle; import java.io.IOException; import java.io.Serial; import java.io.Serializable; @@ -1052,19 +1053,7 @@ public abstract class Arc2D extends RectangularShape { } /** - * Returns the high-precision framing rectangle of the arc. The framing - * rectangle contains only the part of this {@code Arc2D} that is - * in between the starting and ending angles and contains the pie - * wedge, if this {@code Arc2D} has a {@code PIE} closure type. - *

- * This method differs from the - * {@link RectangularShape#getBounds() getBounds} in that the - * {@code getBounds} method only returns the bounds of the - * enclosing ellipse of this {@code Arc2D} without considering - * the starting and ending angles of this {@code Arc2D}. - * - * @return the {@code Rectangle2D} that represents the arc's - * framing rectangle. + * {@inheritDoc java.awt.Shape} * @since 1.2 */ public Rectangle2D getBounds2D() { @@ -1110,6 +1099,15 @@ public abstract class Arc2D extends RectangularShape { return makeBounds(x1, y1, x2, y2); } + /** + * {@inheritDoc java.awt.Shape} + * @since 1.2 + */ + @Override + public Rectangle getBounds() { + return getBounds2D().getBounds(); + } + /** * Constructs a {@code Rectangle2D} of the appropriate precision * to hold the parameters calculated to be the framing rectangle diff --git a/test/jdk/java/awt/geom/Arc2D/Arc2DGetBoundsTest.java b/test/jdk/java/awt/geom/Arc2D/Arc2DGetBoundsTest.java new file mode 100644 index 00000000000..983c4583708 --- /dev/null +++ b/test/jdk/java/awt/geom/Arc2D/Arc2DGetBoundsTest.java @@ -0,0 +1,88 @@ +/* + * Copyright (c) 1999, 2026, Oracle and/or its affiliates. All rights reserved. + * 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 4197755 + * @summary Verifies that Arc2D.getBounds() is similar to Arc2D.getBounds2D() + */ + +import java.awt.geom.Arc2D; +import java.awt.geom.Point2D; +import java.util.ArrayList; +import java.util.List; + +public class Arc2DGetBoundsTest { + public static void main(String[] args) { + // Imagine a circle that represents a compass. + // This arc represents the northern / top quarter. + Arc2D arc = new Arc2D.Double(0, 0, 1000, 1000, 45, 90, Arc2D.PIE); + + // Create 8 pie slices, and place a dot in the center of each + List samples = new ArrayList<>(); + for (int segment = 0; segment < 8; segment++) { + double theta = -(segment + .5) / 8.0 * 2 * Math.PI; + Point2D p = new Point2D.Double( + 500 + 100 * Math.cos(theta), + 500 + 100 * Math.sin(theta) + ); + samples.add(p); + } + + // these assertions have never been known to fail: + assertTrue(!arc.contains(samples.get(0))); + assertTrue(arc.contains(samples.get(1))); + assertTrue(arc.contains(samples.get(2))); + assertTrue(!arc.contains(samples.get(3))); + assertTrue(!arc.contains(samples.get(4))); + assertTrue(!arc.contains(samples.get(5))); + assertTrue(!arc.contains(samples.get(6))); + assertTrue(!arc.contains(samples.get(7))); + + assertTrue(arc.getBounds2D().contains(samples.get(0))); + assertTrue(arc.getBounds2D().contains(samples.get(1))); + assertTrue(arc.getBounds2D().contains(samples.get(2))); + assertTrue(arc.getBounds2D().contains(samples.get(3))); + assertTrue(!arc.getBounds2D().contains(samples.get(4))); + assertTrue(!arc.getBounds2D().contains(samples.get(5))); + assertTrue(!arc.getBounds2D().contains(samples.get(6))); + assertTrue(!arc.getBounds2D().contains(samples.get(7))); + + + assertTrue(arc.getBounds().contains(samples.get(0))); + assertTrue(arc.getBounds().contains(samples.get(1))); + assertTrue(arc.getBounds().contains(samples.get(2))); + assertTrue(arc.getBounds().contains(samples.get(3))); + + // these are the assertions that failed before resolving 4197755 + assertTrue(!arc.getBounds().contains(samples.get(4))); + assertTrue(!arc.getBounds().contains(samples.get(5))); + assertTrue(!arc.getBounds().contains(samples.get(6))); + assertTrue(!arc.getBounds().contains(samples.get(7))); + } + + private static void assertTrue(boolean b) { + if (!b) + throw new Error(); + } +} From 1920983edb4001c71efaeefcf819feb977accbea Mon Sep 17 00:00:00 2001 From: Phil Race Date: Fri, 13 Feb 2026 22:40:26 +0000 Subject: [PATCH 099/120] 8377191: Remove AppContext from KeyboardFocusManager Reviewed-by: dnguyen, tr, serb --- .../classes/sun/lwawt/LWWindowPeer.java | 7 +- .../share/classes/java/awt/Component.java | 4 +- .../java/awt/DefaultKeyboardFocusManager.java | 80 +---------- .../java/awt/KeyboardFocusManager.java | 131 +++++------------- .../share/classes/sun/awt/AWTAccessor.java | 7 +- .../share/classes/sun/awt/EmbeddedFrame.java | 4 +- 6 files changed, 46 insertions(+), 187 deletions(-) diff --git a/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java b/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java index 11099f6a8e6..634f578df02 100644 --- a/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java +++ b/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2026, Oracle and/or its affiliates. All rights reserved. * 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,7 +64,6 @@ import javax.swing.JComponent; import sun.awt.AWTAccessor; import sun.awt.AWTAccessor.ComponentAccessor; -import sun.awt.AppContext; import sun.awt.CGraphicsDevice; import sun.awt.DisplayChangedListener; import sun.awt.ExtendedKeyCodes; @@ -1236,9 +1235,7 @@ public class LWWindowPeer return false; } - AppContext targetAppContext = AWTAccessor.getComponentAccessor().getAppContext(getTarget()); - KeyboardFocusManager kfm = AWTAccessor.getKeyboardFocusManagerAccessor() - .getCurrentKeyboardFocusManager(targetAppContext); + KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager(); Window currentActive = kfm.getActiveWindow(); diff --git a/src/java.desktop/share/classes/java/awt/Component.java b/src/java.desktop/share/classes/java/awt/Component.java index e48255aaf00..7f021dcdb85 100644 --- a/src/java.desktop/share/classes/java/awt/Component.java +++ b/src/java.desktop/share/classes/java/awt/Component.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -7938,7 +7938,7 @@ public abstract class Component implements ImageObserver, MenuContainer, (this, temporary, focusedWindowChangeAllowed, time, cause); if (!success) { KeyboardFocusManager.getCurrentKeyboardFocusManager - (appContext).dequeueKeyEvents(time, this); + ().dequeueKeyEvents(time, this); if (focusLog.isLoggable(PlatformLogger.Level.FINEST)) { focusLog.finest("Peer request failed"); } diff --git a/src/java.desktop/share/classes/java/awt/DefaultKeyboardFocusManager.java b/src/java.desktop/share/classes/java/awt/DefaultKeyboardFocusManager.java index 8ee336548d2..cf3c849829f 100644 --- a/src/java.desktop/share/classes/java/awt/DefaultKeyboardFocusManager.java +++ b/src/java.desktop/share/classes/java/awt/DefaultKeyboardFocusManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ import java.util.ListIterator; import java.util.Set; import sun.awt.AWTAccessor; -import sun.awt.AppContext; import sun.awt.SunToolkit; import sun.awt.TimedWindowEvent; import sun.util.logging.PlatformLogger; @@ -231,9 +230,8 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { @Serial private static final long serialVersionUID = -2924743257508701758L; - public DefaultKeyboardFocusManagerSentEvent(AWTEvent nested, - AppContext toNotify) { - super(nested, toNotify); + public DefaultKeyboardFocusManagerSentEvent(AWTEvent nested) { + super(nested); } public final void dispatch() { KeyboardFocusManager manager = @@ -260,76 +258,12 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { } /** - * Sends a synthetic AWTEvent to a Component. If the Component is in - * the current AppContext, then the event is immediately dispatched. - * If the Component is in a different AppContext, then the event is - * posted to the other AppContext's EventQueue, and this method blocks - * until the event is handled or target AppContext is disposed. - * Returns true if successfully dispatched event, false if failed - * to dispatch. + * Sends a synthetic AWTEvent to a Component. */ static boolean sendMessage(Component target, AWTEvent e) { e.isPosted = true; - AppContext myAppContext = AppContext.getAppContext(); - final AppContext targetAppContext = target.appContext; - final SentEvent se = - new DefaultKeyboardFocusManagerSentEvent(e, myAppContext); - - if (myAppContext == targetAppContext) { - se.dispatch(); - } else { - if (targetAppContext.isDisposed()) { - return false; - } - SunToolkit.postEvent(targetAppContext, se); - if (EventQueue.isDispatchThread()) { - if (Thread.currentThread() instanceof EventDispatchThread) { - EventDispatchThread edt = (EventDispatchThread) - Thread.currentThread(); - edt.pumpEvents(SentEvent.ID, new Conditional() { - public boolean evaluate() { - return !se.dispatched && !targetAppContext.isDisposed(); - } - }); - } else { - if (fxAppThreadIsDispatchThread) { - Thread fxCheckDispatchThread = new Thread() { - @Override - public void run() { - while (!se.dispatched && !targetAppContext.isDisposed()) { - try { - Thread.sleep(100); - } catch (InterruptedException e) { - break; - } - } - } - }; - fxCheckDispatchThread.start(); - try { - // check if event is dispatched or disposed - // but since this user app thread is same as - // dispatch thread in fx when run with - // javafx.embed.singleThread=true - // we do not wait infinitely to avoid deadlock - // as dispatch will ultimately be done by this thread - fxCheckDispatchThread.join(500); - } catch (InterruptedException ex) { - } - } - } - } else { - synchronized (se) { - while (!se.dispatched && !targetAppContext.isDisposed()) { - try { - se.wait(1000); - } catch (InterruptedException ie) { - break; - } - } - } - } - } + final SentEvent se = new DefaultKeyboardFocusManagerSentEvent(e); + se.dispatch(); return se.dispatched; } @@ -356,7 +290,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { // Check that the component awaiting focus belongs to // the current focused window. See 8015454. if (toplevel != null && toplevel.isFocused()) { - SunToolkit.postEvent(AppContext.getAppContext(), new SequencedEvent(e)); + SunToolkit.postEvent(new SequencedEvent(e)); return true; } } diff --git a/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java b/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java index 348d0772cf4..06932d33f8a 100644 --- a/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java +++ b/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. * 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,7 +50,6 @@ import java.util.WeakHashMap; import sun.util.logging.PlatformLogger; -import sun.awt.AppContext; import sun.awt.SunToolkit; import sun.awt.KeyboardFocusManagerPeerProvider; import sun.awt.AWTAccessor; @@ -127,9 +126,6 @@ public abstract class KeyboardFocusManager public void setMostRecentFocusOwner(Window window, Component component) { KeyboardFocusManager.setMostRecentFocusOwner(window, component); } - public KeyboardFocusManager getCurrentKeyboardFocusManager(AppContext ctx) { - return KeyboardFocusManager.getCurrentKeyboardFocusManager(ctx); - } public Container getCurrentFocusCycleRoot() { return KeyboardFocusManager.currentFocusCycleRoot; } @@ -183,53 +179,40 @@ public abstract class KeyboardFocusManager static final int TRAVERSAL_KEY_LENGTH = DOWN_CYCLE_TRAVERSAL_KEYS + 1; + private static KeyboardFocusManager manager; + /** - * Returns the current KeyboardFocusManager instance for the calling - * thread's context. + * Returns the current KeyboardFocusManager instance * - * @return this thread's context's KeyboardFocusManager + * @return the current KeyboardFocusManager * @see #setCurrentKeyboardFocusManager */ - public static KeyboardFocusManager getCurrentKeyboardFocusManager() { - return getCurrentKeyboardFocusManager(AppContext.getAppContext()); - } - - static synchronized KeyboardFocusManager - getCurrentKeyboardFocusManager(AppContext appcontext) - { - KeyboardFocusManager manager = (KeyboardFocusManager) - appcontext.get(KeyboardFocusManager.class); + public static synchronized KeyboardFocusManager getCurrentKeyboardFocusManager() { if (manager == null) { manager = new DefaultKeyboardFocusManager(); - appcontext.put(KeyboardFocusManager.class, manager); } return manager; } /** - * Sets the current KeyboardFocusManager instance for the calling thread's - * context. If null is specified, then the current KeyboardFocusManager + * Sets the current KeyboardFocusManager instance. + * If null is specified, then the current KeyboardFocusManager * is replaced with a new instance of DefaultKeyboardFocusManager. * - * @param newManager the new KeyboardFocusManager for this thread's context + * @param newManager the new KeyboardFocusManager * @see #getCurrentKeyboardFocusManager * @see DefaultKeyboardFocusManager */ public static void setCurrentKeyboardFocusManager(KeyboardFocusManager newManager) { - KeyboardFocusManager oldManager = null; + KeyboardFocusManager oldManager = manager; + + if (newManager == null) { + newManager = new DefaultKeyboardFocusManager(); + } synchronized (KeyboardFocusManager.class) { - AppContext appcontext = AppContext.getAppContext(); - - if (newManager != null) { - oldManager = getCurrentKeyboardFocusManager(appcontext); - - appcontext.put(KeyboardFocusManager.class, newManager); - } else { - oldManager = getCurrentKeyboardFocusManager(appcontext); - appcontext.remove(KeyboardFocusManager.class); - } + manager = newManager; } if (oldManager != null) { @@ -344,7 +327,7 @@ public abstract class KeyboardFocusManager private static java.util.Map> mostRecentFocusOwners = new WeakHashMap<>(); /* - * SequencedEvent which is currently dispatched in AppContext. + * SequencedEvent which is currently dispatched. */ transient SequencedEvent currentSequencedEvent = null; @@ -431,13 +414,7 @@ public abstract class KeyboardFocusManager */ public Component getFocusOwner() { synchronized (KeyboardFocusManager.class) { - if (focusOwner == null) { - return null; - } - - return (focusOwner.appContext == AppContext.getAppContext()) - ? focusOwner - : null; + return focusOwner; } } @@ -599,42 +576,32 @@ public abstract class KeyboardFocusManager } /** - * Returns the permanent focus owner, if the permanent focus owner is in - * the same context as the calling thread. The permanent focus owner is + * Returns the permanent focus owner. The permanent focus owner is * defined as the last Component in an application to receive a permanent * FOCUS_GAINED event. The focus owner and permanent focus owner are * equivalent unless a temporary focus change is currently in effect. In * such a situation, the permanent focus owner will again be the focus * owner when the temporary focus change ends. * - * @return the permanent focus owner, or null if the permanent focus owner - * is not a member of the calling thread's context + * @return the permanent focus owner, or null if there is none * @see #getGlobalPermanentFocusOwner * @see #setGlobalPermanentFocusOwner */ public Component getPermanentFocusOwner() { synchronized (KeyboardFocusManager.class) { - if (permanentFocusOwner == null) { - return null; - } - - return (permanentFocusOwner.appContext == - AppContext.getAppContext()) - ? permanentFocusOwner - : null; + return permanentFocusOwner; } } /** - * Returns the permanent focus owner, even if the calling thread is in a - * different context than the permanent focus owner. The permanent focus + * Returns the permanent focus owner. The permanent focus * owner is defined as the last Component in an application to receive a * permanent FOCUS_GAINED event. The focus owner and permanent focus owner * are equivalent unless a temporary focus change is currently in effect. * In such a situation, the permanent focus owner will again be the focus * owner when the temporary focus change ends. * - * @return the permanent focus owner + * @return the permanent focus owner, or null if there is none * @see #getPermanentFocusOwner * @see #setGlobalPermanentFocusOwner */ @@ -701,24 +668,16 @@ public abstract class KeyboardFocusManager } /** - * Returns the focused Window, if the focused Window is in the same context - * as the calling thread. The focused Window is the Window that is or - * contains the focus owner. + * Returns the focused Window. + * The focused Window is the Window that is or contains the focus owner. * - * @return the focused Window, or null if the focused Window is not a - * member of the calling thread's context + * @return the focused Window, or null if there is none * @see #getGlobalFocusedWindow * @see #setGlobalFocusedWindow */ public Window getFocusedWindow() { synchronized (KeyboardFocusManager.class) { - if (focusedWindow == null) { - return null; - } - - return (focusedWindow.appContext == AppContext.getAppContext()) - ? focusedWindow - : null; + return focusedWindow; } } @@ -785,27 +744,19 @@ public abstract class KeyboardFocusManager } /** - * Returns the active Window, if the active Window is in the same context - * as the calling thread. Only a Frame or a Dialog can be the active + * Returns the active Window. Only a Frame or a Dialog can be the active * Window. The native windowing system may denote the active Window or its * children with special decorations, such as a highlighted title bar. * The active Window is always either the focused Window, or the first * Frame or Dialog that is an owner of the focused Window. * - * @return the active Window, or null if the active Window is not a member - * of the calling thread's context + * @return the active Window, or null if there is none * @see #getGlobalActiveWindow * @see #setGlobalActiveWindow */ public Window getActiveWindow() { synchronized (KeyboardFocusManager.class) { - if (activeWindow == null) { - return null; - } - - return (activeWindow.appContext == AppContext.getAppContext()) - ? activeWindow - : null; + return activeWindow; } } @@ -1100,14 +1051,7 @@ public abstract class KeyboardFocusManager */ public Container getCurrentFocusCycleRoot() { synchronized (KeyboardFocusManager.class) { - if (currentFocusCycleRoot == null) { - return null; - } - - return (currentFocusCycleRoot.appContext == - AppContext.getAppContext()) - ? currentFocusCycleRoot - : null; + return currentFocusCycleRoot; } } @@ -2159,7 +2103,7 @@ public abstract class KeyboardFocusManager descendant = heavyweight; } - KeyboardFocusManager manager = getCurrentKeyboardFocusManager(SunToolkit.targetToAppContext(descendant)); + KeyboardFocusManager manager = getCurrentKeyboardFocusManager(); FocusEvent currentFocusOwnerEvent = null; FocusEvent newFocusOwnerEvent = null; @@ -2268,8 +2212,7 @@ public abstract class KeyboardFocusManager descendant = heavyweight; } - KeyboardFocusManager manager = - getCurrentKeyboardFocusManager(SunToolkit.targetToAppContext(descendant)); + KeyboardFocusManager manager = getCurrentKeyboardFocusManager(); KeyboardFocusManager thisManager = getCurrentKeyboardFocusManager(); Component currentFocusOwner = thisManager.getGlobalFocusOwner(); Component nativeFocusOwner = thisManager.getNativeFocusOwner(); @@ -2484,16 +2427,6 @@ public abstract class KeyboardFocusManager KeyboardFocusManager manager = getCurrentKeyboardFocusManager(); LinkedList localLightweightRequests = null; - Component globalFocusOwner = manager.getGlobalFocusOwner(); - if ((globalFocusOwner != null) && - (globalFocusOwner.appContext != AppContext.getAppContext())) - { - // The current app context differs from the app context of a focus - // owner (and all pending lightweight requests), so we do nothing - // now and wait for a next event. - return; - } - synchronized(heavyweightRequests) { if (currentLightweightRequests != null) { clearingCurrentLightweightRequests = true; diff --git a/src/java.desktop/share/classes/sun/awt/AWTAccessor.java b/src/java.desktop/share/classes/sun/awt/AWTAccessor.java index 22df71f564d..3c63a390a81 100644 --- a/src/java.desktop/share/classes/sun/awt/AWTAccessor.java +++ b/src/java.desktop/share/classes/sun/awt/AWTAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -441,11 +441,6 @@ public final class AWTAccessor { */ void setMostRecentFocusOwner(Window window, Component component); - /** - * Returns current KFM of the specified AppContext. - */ - KeyboardFocusManager getCurrentKeyboardFocusManager(AppContext ctx); - /** * Return the current focus cycle root */ diff --git a/src/java.desktop/share/classes/sun/awt/EmbeddedFrame.java b/src/java.desktop/share/classes/sun/awt/EmbeddedFrame.java index 8310b7cb604..ab2ad5dfbf0 100644 --- a/src/java.desktop/share/classes/sun/awt/EmbeddedFrame.java +++ b/src/java.desktop/share/classes/sun/awt/EmbeddedFrame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -218,7 +218,7 @@ public abstract class EmbeddedFrame extends Frame */ public boolean dispatchKeyEvent(KeyEvent e) { - Container currentRoot = AWTAccessor.getKeyboardFocusManagerAccessor() + Container currentRoot = KeyboardFocusManager.getCurrentKeyboardFocusManager() .getCurrentFocusCycleRoot(); // if we are not in EmbeddedFrame's cycle, we should not try to leave. From bf8f7168959c408b5ff52c65665733ac22a51dbc Mon Sep 17 00:00:00 2001 From: Jatin Bhateja Date: Sat, 14 Feb 2026 02:38:18 +0000 Subject: [PATCH 100/120] 8377447: [VectorAPI] Assert wrappers to convert float16 (short) value to float before invoking testng Asserts Reviewed-by: psandoz --- .../vector/Byte128VectorLoadStoreTests.java | 35 +- .../incubator/vector/Byte128VectorTests.java | 521 +++++++++-------- .../vector/Byte256VectorLoadStoreTests.java | 35 +- .../incubator/vector/Byte256VectorTests.java | 521 +++++++++-------- .../vector/Byte512VectorLoadStoreTests.java | 35 +- .../incubator/vector/Byte512VectorTests.java | 521 +++++++++-------- .../vector/Byte64VectorLoadStoreTests.java | 35 +- .../incubator/vector/Byte64VectorTests.java | 521 +++++++++-------- .../vector/ByteMaxVectorLoadStoreTests.java | 35 +- .../incubator/vector/ByteMaxVectorTests.java | 521 +++++++++-------- .../vector/Double128VectorLoadStoreTests.java | 35 +- .../vector/Double128VectorTests.java | 449 ++++++++------- .../vector/Double256VectorLoadStoreTests.java | 35 +- .../vector/Double256VectorTests.java | 449 ++++++++------- .../vector/Double512VectorLoadStoreTests.java | 35 +- .../vector/Double512VectorTests.java | 449 ++++++++------- .../vector/Double64VectorLoadStoreTests.java | 35 +- .../incubator/vector/Double64VectorTests.java | 449 ++++++++------- .../vector/DoubleMaxVectorLoadStoreTests.java | 35 +- .../vector/DoubleMaxVectorTests.java | 449 ++++++++------- .../vector/Float128VectorLoadStoreTests.java | 35 +- .../incubator/vector/Float128VectorTests.java | 459 ++++++++------- .../vector/Float256VectorLoadStoreTests.java | 35 +- .../incubator/vector/Float256VectorTests.java | 459 ++++++++------- .../vector/Float512VectorLoadStoreTests.java | 35 +- .../incubator/vector/Float512VectorTests.java | 459 ++++++++------- .../vector/Float64VectorLoadStoreTests.java | 35 +- .../incubator/vector/Float64VectorTests.java | 459 ++++++++------- .../vector/FloatMaxVectorLoadStoreTests.java | 35 +- .../incubator/vector/FloatMaxVectorTests.java | 459 ++++++++------- .../vector/Int128VectorLoadStoreTests.java | 35 +- .../incubator/vector/Int128VectorTests.java | 523 ++++++++++-------- .../vector/Int256VectorLoadStoreTests.java | 35 +- .../incubator/vector/Int256VectorTests.java | 523 ++++++++++-------- .../vector/Int512VectorLoadStoreTests.java | 35 +- .../incubator/vector/Int512VectorTests.java | 523 ++++++++++-------- .../vector/Int64VectorLoadStoreTests.java | 35 +- .../incubator/vector/Int64VectorTests.java | 523 ++++++++++-------- .../vector/IntMaxVectorLoadStoreTests.java | 35 +- .../incubator/vector/IntMaxVectorTests.java | 523 ++++++++++-------- .../vector/Long128VectorLoadStoreTests.java | 35 +- .../incubator/vector/Long128VectorTests.java | 493 +++++++++-------- .../vector/Long256VectorLoadStoreTests.java | 35 +- .../incubator/vector/Long256VectorTests.java | 493 +++++++++-------- .../vector/Long512VectorLoadStoreTests.java | 35 +- .../incubator/vector/Long512VectorTests.java | 493 +++++++++-------- .../vector/Long64VectorLoadStoreTests.java | 35 +- .../incubator/vector/Long64VectorTests.java | 493 +++++++++-------- .../vector/LongMaxVectorLoadStoreTests.java | 35 +- .../incubator/vector/LongMaxVectorTests.java | 493 +++++++++-------- .../vector/Short128VectorLoadStoreTests.java | 35 +- .../incubator/vector/Short128VectorTests.java | 517 +++++++++-------- .../vector/Short256VectorLoadStoreTests.java | 35 +- .../incubator/vector/Short256VectorTests.java | 517 +++++++++-------- .../vector/Short512VectorLoadStoreTests.java | 35 +- .../incubator/vector/Short512VectorTests.java | 517 +++++++++-------- .../vector/Short64VectorLoadStoreTests.java | 35 +- .../incubator/vector/Short64VectorTests.java | 517 +++++++++-------- .../vector/ShortMaxVectorLoadStoreTests.java | 35 +- .../incubator/vector/ShortMaxVectorTests.java | 517 +++++++++-------- test/jdk/jdk/incubator/vector/gen-tests.sh | 5 +- .../templates/Unit-Compare-Broadcast.template | 8 +- .../templates/Unit-Compare-Masked.template | 2 +- .../vector/templates/Unit-Compare.template | 2 +- .../templates/Unit-Mask-FromToLong.template | 4 +- .../templates/Unit-Miscellaneous.template | 24 +- .../templates/Unit-Reduction-op-func.template | 10 +- .../templates/Unit-Reduction-op.template | 10 +- .../Unit-SaturatingReduction-op.template | 10 +- .../vector/templates/Unit-Test.template | 4 +- .../vector/templates/Unit-Zero.template | 2 +- .../vector/templates/Unit-header.template | 347 +++++++----- .../templates/X-LoadStoreTest.java.template | 35 +- 73 files changed, 9034 insertions(+), 7289 deletions(-) diff --git a/test/jdk/jdk/incubator/vector/Byte128VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Byte128VectorLoadStoreTests.java index e450e3ead7e..1a50b5d8945 100644 --- a/test/jdk/jdk/incubator/vector/Byte128VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Byte128VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Byte128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 128); + static void assertEquals(byte actual, byte expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(byte actual, byte expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(byte [] actual, byte [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(byte [] actual, byte [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Byte128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "byteProviderForIOOBE") @@ -957,11 +972,11 @@ public class Byte128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -972,11 +987,11 @@ public class Byte128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0, "at index #" + j); } } @@ -992,7 +1007,7 @@ public class Byte128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(byte[] r, byte[] a, int[] indexMap) { @@ -1005,7 +1020,7 @@ public class Byte128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Byte128VectorTests.java b/test/jdk/jdk/incubator/vector/Byte128VectorTests.java index fae7b678a09..fa801f05a19 100644 --- a/test/jdk/jdk/incubator/vector/Byte128VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Byte128VectorTests.java @@ -62,6 +62,49 @@ public class Byte128VectorTests extends AbstractVectorTest { ByteVector.SPECIES_128; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(byte actual, byte expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(byte actual, byte expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(byte actual, byte expected, byte delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(byte actual, byte expected, byte delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(byte [] actual, byte [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(byte [] actual, byte [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final byte CONST_SHIFT = Byte.SIZE / 2; @@ -96,10 +139,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +154,13 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { byte[] ref = f.apply(a[i]); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +170,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +189,13 @@ public class Byte128VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +211,13 @@ public class Byte128VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -190,13 +233,13 @@ public class Byte128VectorTests extends AbstractVectorTest { FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -212,13 +255,13 @@ public class Byte128VectorTests extends AbstractVectorTest { FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -230,10 +273,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -245,10 +288,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,12 +300,12 @@ public class Byte128VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -273,20 +316,20 @@ public class Byte128VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (byte)0); + assertEquals(r[i + k], (byte)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (byte)0, "at index #" + idx); + assertEquals(r[idx], (byte)0, "at index #" + idx); } } } @@ -298,19 +341,19 @@ public class Byte128VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (byte)0); + assertEquals(r[i + j], (byte)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (byte)0, "at index #" + idx); + assertEquals(r[idx], (byte)0, "at index #" + idx); } } } @@ -326,11 +369,11 @@ public class Byte128VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -339,12 +382,12 @@ public class Byte128VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -354,17 +397,17 @@ public class Byte128VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (byte)0); + assertEquals(r[i+j], (byte)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -374,17 +417,17 @@ public class Byte128VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (byte)0); + assertEquals(r[i+j], (byte)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -398,10 +441,10 @@ public class Byte128VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -413,10 +456,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -428,10 +471,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -452,18 +495,18 @@ public class Byte128VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -478,18 +521,18 @@ public class Byte128VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -497,10 +540,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -508,10 +551,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -519,10 +562,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -531,10 +574,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -547,10 +590,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -562,10 +605,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -577,10 +620,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -595,10 +638,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -611,11 +654,11 @@ public class Byte128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -629,11 +672,11 @@ public class Byte128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -655,11 +698,11 @@ public class Byte128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -673,11 +716,11 @@ public class Byte128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -697,10 +740,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -712,10 +755,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -724,10 +767,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -737,10 +780,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -756,11 +799,11 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -777,11 +820,11 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -792,11 +835,11 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -813,11 +856,11 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -835,13 +878,13 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, i, b, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -862,13 +905,13 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, i, mask, b, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -883,13 +926,13 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { byte[] ref = f.apply(r, a, i, mask, b, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -910,13 +953,13 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, origin, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -930,13 +973,13 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -951,13 +994,13 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, mask, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -972,13 +1015,13 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, part, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -994,13 +1037,13 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, part, mask, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1013,10 +1056,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1025,10 +1068,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1036,10 +1079,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1047,10 +1090,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1586,7 +1629,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. ByteVector io = (ByteVector) SPECIES.broadcast(0).addIndex(1); ByteVector io2 = (ByteVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); ByteVector a = io.add((byte)1); //[1,2] ByteVector b = a.neg(); //[-1,-2] byte[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1601,19 +1644,19 @@ public class Byte128VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); ByteVector uab0 = zab0.rearrange(unz0,zab1); ByteVector uab1 = zab0.rearrange(unz1,zab1); byte[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { ByteVector io = (ByteVector) SPECIES.broadcast(0).addIndex(1); ByteVector io2 = (ByteVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1628,7 +1671,7 @@ public class Byte128VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test(expectedExceptions = UnsupportedOperationException.class) @@ -3665,20 +3708,20 @@ public class Byte128VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = AND_IDENTITY; - Assert.assertEquals((byte) (id & id), id, + assertEquals((byte) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id & x), x); - Assert.assertEquals((byte) (x & id), x); + assertEquals((byte) (id & x), x); + assertEquals((byte) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id & x), x, + assertEquals((byte) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x & id), x, + assertEquals((byte) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3767,20 +3810,20 @@ public class Byte128VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = OR_IDENTITY; - Assert.assertEquals((byte) (id | id), id, + assertEquals((byte) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id | x), x); - Assert.assertEquals((byte) (x | id), x); + assertEquals((byte) (id | x), x); + assertEquals((byte) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id | x), x, + assertEquals((byte) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x | id), x, + assertEquals((byte) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3869,20 +3912,20 @@ public class Byte128VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = XOR_IDENTITY; - Assert.assertEquals((byte) (id ^ id), id, + assertEquals((byte) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id ^ x), x); - Assert.assertEquals((byte) (x ^ id), x); + assertEquals((byte) (id ^ x), x); + assertEquals((byte) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id ^ x), x, + assertEquals((byte) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x ^ id), x, + assertEquals((byte) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -3971,20 +4014,20 @@ public class Byte128VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = ADD_IDENTITY; - Assert.assertEquals((byte) (id + id), id, + assertEquals((byte) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id + x), x); - Assert.assertEquals((byte) (x + id), x); + assertEquals((byte) (id + x), x); + assertEquals((byte) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id + x), x, + assertEquals((byte) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x + id), x, + assertEquals((byte) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4073,20 +4116,20 @@ public class Byte128VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = MUL_IDENTITY; - Assert.assertEquals((byte) (id * id), id, + assertEquals((byte) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id * x), x); - Assert.assertEquals((byte) (x * id), x); + assertEquals((byte) (id * x), x); + assertEquals((byte) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id * x), x, + assertEquals((byte) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x * id), x, + assertEquals((byte) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4175,20 +4218,20 @@ public class Byte128VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = MIN_IDENTITY; - Assert.assertEquals((byte) Math.min(id, id), id, + assertEquals((byte) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) Math.min(id, x), x); - Assert.assertEquals((byte) Math.min(x, id), x); + assertEquals((byte) Math.min(id, x), x); + assertEquals((byte) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) Math.min(id, x), x, + assertEquals((byte) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) Math.min(x, id), x, + assertEquals((byte) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4277,20 +4320,20 @@ public class Byte128VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = MAX_IDENTITY; - Assert.assertEquals((byte) Math.max(id, id), id, + assertEquals((byte) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) Math.max(id, x), x); - Assert.assertEquals((byte) Math.max(x, id), x); + assertEquals((byte) Math.max(id, x), x); + assertEquals((byte) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) Math.max(id, x), x, + assertEquals((byte) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) Math.max(x, id), x, + assertEquals((byte) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4379,20 +4422,20 @@ public class Byte128VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = UMIN_IDENTITY; - Assert.assertEquals((byte) VectorMath.minUnsigned(id, id), id, + assertEquals((byte) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((byte) VectorMath.minUnsigned(x, id), x); + assertEquals((byte) VectorMath.minUnsigned(id, x), x); + assertEquals((byte) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) VectorMath.minUnsigned(id, x), x, + assertEquals((byte) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) VectorMath.minUnsigned(x, id), x, + assertEquals((byte) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4481,20 +4524,20 @@ public class Byte128VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = UMAX_IDENTITY; - Assert.assertEquals((byte) VectorMath.maxUnsigned(id, id), id, + assertEquals((byte) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((byte) VectorMath.maxUnsigned(x, id), x); + assertEquals((byte) VectorMath.maxUnsigned(id, x), x); + assertEquals((byte) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) VectorMath.maxUnsigned(id, x), x, + assertEquals((byte) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) VectorMath.maxUnsigned(x, id), x, + assertEquals((byte) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4583,20 +4626,20 @@ public class Byte128VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4733,20 +4776,20 @@ public class Byte128VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = SUADD_IDENTITY; - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((byte) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4825,7 +4868,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4845,7 +4888,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4866,7 +4909,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4886,7 +4929,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4905,7 +4948,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4924,7 +4967,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4947,7 +4990,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -4966,7 +5009,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -4989,7 +5032,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5008,7 +5051,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5027,7 +5070,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5050,7 +5093,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5069,7 +5112,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5092,7 +5135,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5111,7 +5154,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5134,7 +5177,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5153,7 +5196,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5176,7 +5219,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5195,7 +5238,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5218,7 +5261,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5237,7 +5280,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5260,7 +5303,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5279,7 +5322,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5302,7 +5345,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5321,7 +5364,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5344,7 +5387,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5361,7 +5404,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5381,7 +5424,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5397,7 +5440,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (byte)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (byte)((long)b[i])); } } } @@ -5417,7 +5460,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (byte)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (byte)((long)b[i]))); } } } @@ -5433,7 +5476,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5453,7 +5496,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5469,7 +5512,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (byte)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (byte)((long)b[i])); } } } @@ -5489,7 +5532,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (byte)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (byte)((long)b[i]))); } } } @@ -5770,7 +5813,7 @@ public class Byte128VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static byte[] sliceUnary(byte[] a, int origin, int idx) { @@ -6720,10 +6763,10 @@ public class Byte128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6752,7 +6795,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6768,7 +6811,7 @@ public class Byte128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -7019,7 +7062,7 @@ public class Byte128VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -7047,7 +7090,7 @@ public class Byte128VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -7062,7 +7105,7 @@ public class Byte128VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7165,7 +7208,7 @@ public class Byte128VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7191,7 +7234,7 @@ public class Byte128VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7205,7 +7248,7 @@ public class Byte128VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7227,7 +7270,7 @@ public class Byte128VectorTests extends AbstractVectorTest { static void loopBoundByte128VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7235,14 +7278,14 @@ public class Byte128VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeByte128VectorTestsSmokeTest() { ByteVector av = ByteVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Byte.SIZE); + assertEquals(elsize, Byte.SIZE); } @Test @@ -7296,7 +7339,7 @@ public class Byte128VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueByte128VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Byte256VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Byte256VectorLoadStoreTests.java index a818043aedc..1b1f6c0ed36 100644 --- a/test/jdk/jdk/incubator/vector/Byte256VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Byte256VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Byte256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 256); + static void assertEquals(byte actual, byte expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(byte actual, byte expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(byte [] actual, byte [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(byte [] actual, byte [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Byte256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "byteProviderForIOOBE") @@ -957,11 +972,11 @@ public class Byte256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -972,11 +987,11 @@ public class Byte256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0, "at index #" + j); } } @@ -992,7 +1007,7 @@ public class Byte256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(byte[] r, byte[] a, int[] indexMap) { @@ -1005,7 +1020,7 @@ public class Byte256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Byte256VectorTests.java b/test/jdk/jdk/incubator/vector/Byte256VectorTests.java index 0e59db7d05d..ec8958e0605 100644 --- a/test/jdk/jdk/incubator/vector/Byte256VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Byte256VectorTests.java @@ -62,6 +62,49 @@ public class Byte256VectorTests extends AbstractVectorTest { ByteVector.SPECIES_256; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(byte actual, byte expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(byte actual, byte expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(byte actual, byte expected, byte delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(byte actual, byte expected, byte delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(byte [] actual, byte [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(byte [] actual, byte [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final byte CONST_SHIFT = Byte.SIZE / 2; @@ -96,10 +139,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +154,13 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { byte[] ref = f.apply(a[i]); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +170,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +189,13 @@ public class Byte256VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +211,13 @@ public class Byte256VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -190,13 +233,13 @@ public class Byte256VectorTests extends AbstractVectorTest { FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -212,13 +255,13 @@ public class Byte256VectorTests extends AbstractVectorTest { FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -230,10 +273,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -245,10 +288,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,12 +300,12 @@ public class Byte256VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -273,20 +316,20 @@ public class Byte256VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (byte)0); + assertEquals(r[i + k], (byte)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (byte)0, "at index #" + idx); + assertEquals(r[idx], (byte)0, "at index #" + idx); } } } @@ -298,19 +341,19 @@ public class Byte256VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (byte)0); + assertEquals(r[i + j], (byte)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (byte)0, "at index #" + idx); + assertEquals(r[idx], (byte)0, "at index #" + idx); } } } @@ -326,11 +369,11 @@ public class Byte256VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -339,12 +382,12 @@ public class Byte256VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -354,17 +397,17 @@ public class Byte256VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (byte)0); + assertEquals(r[i+j], (byte)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -374,17 +417,17 @@ public class Byte256VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (byte)0); + assertEquals(r[i+j], (byte)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -398,10 +441,10 @@ public class Byte256VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -413,10 +456,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -428,10 +471,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -452,18 +495,18 @@ public class Byte256VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -478,18 +521,18 @@ public class Byte256VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -497,10 +540,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -508,10 +551,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -519,10 +562,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -531,10 +574,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -547,10 +590,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -562,10 +605,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -577,10 +620,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -595,10 +638,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -611,11 +654,11 @@ public class Byte256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -629,11 +672,11 @@ public class Byte256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -655,11 +698,11 @@ public class Byte256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -673,11 +716,11 @@ public class Byte256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -697,10 +740,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -712,10 +755,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -724,10 +767,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -737,10 +780,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -756,11 +799,11 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -777,11 +820,11 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -792,11 +835,11 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -813,11 +856,11 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -835,13 +878,13 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, i, b, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -862,13 +905,13 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, i, mask, b, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -883,13 +926,13 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { byte[] ref = f.apply(r, a, i, mask, b, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -910,13 +953,13 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, origin, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -930,13 +973,13 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -951,13 +994,13 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, mask, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -972,13 +1015,13 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, part, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -994,13 +1037,13 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, part, mask, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1013,10 +1056,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1025,10 +1068,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1036,10 +1079,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1047,10 +1090,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1586,7 +1629,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. ByteVector io = (ByteVector) SPECIES.broadcast(0).addIndex(1); ByteVector io2 = (ByteVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); ByteVector a = io.add((byte)1); //[1,2] ByteVector b = a.neg(); //[-1,-2] byte[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1601,19 +1644,19 @@ public class Byte256VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); ByteVector uab0 = zab0.rearrange(unz0,zab1); ByteVector uab1 = zab0.rearrange(unz1,zab1); byte[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { ByteVector io = (ByteVector) SPECIES.broadcast(0).addIndex(1); ByteVector io2 = (ByteVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1628,7 +1671,7 @@ public class Byte256VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test(expectedExceptions = UnsupportedOperationException.class) @@ -3665,20 +3708,20 @@ public class Byte256VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = AND_IDENTITY; - Assert.assertEquals((byte) (id & id), id, + assertEquals((byte) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id & x), x); - Assert.assertEquals((byte) (x & id), x); + assertEquals((byte) (id & x), x); + assertEquals((byte) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id & x), x, + assertEquals((byte) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x & id), x, + assertEquals((byte) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3767,20 +3810,20 @@ public class Byte256VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = OR_IDENTITY; - Assert.assertEquals((byte) (id | id), id, + assertEquals((byte) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id | x), x); - Assert.assertEquals((byte) (x | id), x); + assertEquals((byte) (id | x), x); + assertEquals((byte) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id | x), x, + assertEquals((byte) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x | id), x, + assertEquals((byte) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3869,20 +3912,20 @@ public class Byte256VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = XOR_IDENTITY; - Assert.assertEquals((byte) (id ^ id), id, + assertEquals((byte) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id ^ x), x); - Assert.assertEquals((byte) (x ^ id), x); + assertEquals((byte) (id ^ x), x); + assertEquals((byte) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id ^ x), x, + assertEquals((byte) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x ^ id), x, + assertEquals((byte) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -3971,20 +4014,20 @@ public class Byte256VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = ADD_IDENTITY; - Assert.assertEquals((byte) (id + id), id, + assertEquals((byte) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id + x), x); - Assert.assertEquals((byte) (x + id), x); + assertEquals((byte) (id + x), x); + assertEquals((byte) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id + x), x, + assertEquals((byte) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x + id), x, + assertEquals((byte) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4073,20 +4116,20 @@ public class Byte256VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = MUL_IDENTITY; - Assert.assertEquals((byte) (id * id), id, + assertEquals((byte) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id * x), x); - Assert.assertEquals((byte) (x * id), x); + assertEquals((byte) (id * x), x); + assertEquals((byte) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id * x), x, + assertEquals((byte) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x * id), x, + assertEquals((byte) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4175,20 +4218,20 @@ public class Byte256VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = MIN_IDENTITY; - Assert.assertEquals((byte) Math.min(id, id), id, + assertEquals((byte) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) Math.min(id, x), x); - Assert.assertEquals((byte) Math.min(x, id), x); + assertEquals((byte) Math.min(id, x), x); + assertEquals((byte) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) Math.min(id, x), x, + assertEquals((byte) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) Math.min(x, id), x, + assertEquals((byte) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4277,20 +4320,20 @@ public class Byte256VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = MAX_IDENTITY; - Assert.assertEquals((byte) Math.max(id, id), id, + assertEquals((byte) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) Math.max(id, x), x); - Assert.assertEquals((byte) Math.max(x, id), x); + assertEquals((byte) Math.max(id, x), x); + assertEquals((byte) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) Math.max(id, x), x, + assertEquals((byte) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) Math.max(x, id), x, + assertEquals((byte) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4379,20 +4422,20 @@ public class Byte256VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = UMIN_IDENTITY; - Assert.assertEquals((byte) VectorMath.minUnsigned(id, id), id, + assertEquals((byte) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((byte) VectorMath.minUnsigned(x, id), x); + assertEquals((byte) VectorMath.minUnsigned(id, x), x); + assertEquals((byte) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) VectorMath.minUnsigned(id, x), x, + assertEquals((byte) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) VectorMath.minUnsigned(x, id), x, + assertEquals((byte) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4481,20 +4524,20 @@ public class Byte256VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = UMAX_IDENTITY; - Assert.assertEquals((byte) VectorMath.maxUnsigned(id, id), id, + assertEquals((byte) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((byte) VectorMath.maxUnsigned(x, id), x); + assertEquals((byte) VectorMath.maxUnsigned(id, x), x); + assertEquals((byte) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) VectorMath.maxUnsigned(id, x), x, + assertEquals((byte) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) VectorMath.maxUnsigned(x, id), x, + assertEquals((byte) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4583,20 +4626,20 @@ public class Byte256VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4733,20 +4776,20 @@ public class Byte256VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = SUADD_IDENTITY; - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((byte) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4825,7 +4868,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4845,7 +4888,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4866,7 +4909,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4886,7 +4929,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4905,7 +4948,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4924,7 +4967,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4947,7 +4990,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -4966,7 +5009,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -4989,7 +5032,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5008,7 +5051,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5027,7 +5070,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5050,7 +5093,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5069,7 +5112,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5092,7 +5135,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5111,7 +5154,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5134,7 +5177,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5153,7 +5196,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5176,7 +5219,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5195,7 +5238,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5218,7 +5261,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5237,7 +5280,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5260,7 +5303,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5279,7 +5322,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5302,7 +5345,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5321,7 +5364,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5344,7 +5387,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5361,7 +5404,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5381,7 +5424,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5397,7 +5440,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (byte)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (byte)((long)b[i])); } } } @@ -5417,7 +5460,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (byte)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (byte)((long)b[i]))); } } } @@ -5433,7 +5476,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5453,7 +5496,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5469,7 +5512,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (byte)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (byte)((long)b[i])); } } } @@ -5489,7 +5532,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (byte)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (byte)((long)b[i]))); } } } @@ -5770,7 +5813,7 @@ public class Byte256VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static byte[] sliceUnary(byte[] a, int origin, int idx) { @@ -6720,10 +6763,10 @@ public class Byte256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6752,7 +6795,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6768,7 +6811,7 @@ public class Byte256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -7019,7 +7062,7 @@ public class Byte256VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -7047,7 +7090,7 @@ public class Byte256VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -7062,7 +7105,7 @@ public class Byte256VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7165,7 +7208,7 @@ public class Byte256VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7191,7 +7234,7 @@ public class Byte256VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7205,7 +7248,7 @@ public class Byte256VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7227,7 +7270,7 @@ public class Byte256VectorTests extends AbstractVectorTest { static void loopBoundByte256VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7235,14 +7278,14 @@ public class Byte256VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeByte256VectorTestsSmokeTest() { ByteVector av = ByteVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Byte.SIZE); + assertEquals(elsize, Byte.SIZE); } @Test @@ -7296,7 +7339,7 @@ public class Byte256VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueByte256VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Byte512VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Byte512VectorLoadStoreTests.java index 7df9c1fbf10..61168532de0 100644 --- a/test/jdk/jdk/incubator/vector/Byte512VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Byte512VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Byte512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 512); + static void assertEquals(byte actual, byte expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(byte actual, byte expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(byte [] actual, byte [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(byte [] actual, byte [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Byte512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "byteProviderForIOOBE") @@ -957,11 +972,11 @@ public class Byte512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -972,11 +987,11 @@ public class Byte512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0, "at index #" + j); } } @@ -992,7 +1007,7 @@ public class Byte512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(byte[] r, byte[] a, int[] indexMap) { @@ -1005,7 +1020,7 @@ public class Byte512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Byte512VectorTests.java b/test/jdk/jdk/incubator/vector/Byte512VectorTests.java index 5ad3bbdbc05..711cff6bca3 100644 --- a/test/jdk/jdk/incubator/vector/Byte512VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Byte512VectorTests.java @@ -62,6 +62,49 @@ public class Byte512VectorTests extends AbstractVectorTest { ByteVector.SPECIES_512; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(byte actual, byte expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(byte actual, byte expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(byte actual, byte expected, byte delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(byte actual, byte expected, byte delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(byte [] actual, byte [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(byte [] actual, byte [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final byte CONST_SHIFT = Byte.SIZE / 2; @@ -96,10 +139,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +154,13 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { byte[] ref = f.apply(a[i]); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +170,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +189,13 @@ public class Byte512VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +211,13 @@ public class Byte512VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -190,13 +233,13 @@ public class Byte512VectorTests extends AbstractVectorTest { FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -212,13 +255,13 @@ public class Byte512VectorTests extends AbstractVectorTest { FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -230,10 +273,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -245,10 +288,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,12 +300,12 @@ public class Byte512VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -273,20 +316,20 @@ public class Byte512VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (byte)0); + assertEquals(r[i + k], (byte)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (byte)0, "at index #" + idx); + assertEquals(r[idx], (byte)0, "at index #" + idx); } } } @@ -298,19 +341,19 @@ public class Byte512VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (byte)0); + assertEquals(r[i + j], (byte)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (byte)0, "at index #" + idx); + assertEquals(r[idx], (byte)0, "at index #" + idx); } } } @@ -326,11 +369,11 @@ public class Byte512VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -339,12 +382,12 @@ public class Byte512VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -354,17 +397,17 @@ public class Byte512VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (byte)0); + assertEquals(r[i+j], (byte)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -374,17 +417,17 @@ public class Byte512VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (byte)0); + assertEquals(r[i+j], (byte)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -398,10 +441,10 @@ public class Byte512VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -413,10 +456,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -428,10 +471,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -452,18 +495,18 @@ public class Byte512VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -478,18 +521,18 @@ public class Byte512VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -497,10 +540,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -508,10 +551,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -519,10 +562,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -531,10 +574,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -547,10 +590,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -562,10 +605,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -577,10 +620,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -595,10 +638,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -611,11 +654,11 @@ public class Byte512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -629,11 +672,11 @@ public class Byte512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -655,11 +698,11 @@ public class Byte512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -673,11 +716,11 @@ public class Byte512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -697,10 +740,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -712,10 +755,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -724,10 +767,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -737,10 +780,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -756,11 +799,11 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -777,11 +820,11 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -792,11 +835,11 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -813,11 +856,11 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -835,13 +878,13 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, i, b, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -862,13 +905,13 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, i, mask, b, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -883,13 +926,13 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { byte[] ref = f.apply(r, a, i, mask, b, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -910,13 +953,13 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, origin, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -930,13 +973,13 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -951,13 +994,13 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, mask, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -972,13 +1015,13 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, part, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -994,13 +1037,13 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, part, mask, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1013,10 +1056,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1025,10 +1068,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1036,10 +1079,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1047,10 +1090,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1586,7 +1629,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. ByteVector io = (ByteVector) SPECIES.broadcast(0).addIndex(1); ByteVector io2 = (ByteVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); ByteVector a = io.add((byte)1); //[1,2] ByteVector b = a.neg(); //[-1,-2] byte[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1601,19 +1644,19 @@ public class Byte512VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); ByteVector uab0 = zab0.rearrange(unz0,zab1); ByteVector uab1 = zab0.rearrange(unz1,zab1); byte[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { ByteVector io = (ByteVector) SPECIES.broadcast(0).addIndex(1); ByteVector io2 = (ByteVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1628,7 +1671,7 @@ public class Byte512VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test(expectedExceptions = UnsupportedOperationException.class) @@ -3665,20 +3708,20 @@ public class Byte512VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = AND_IDENTITY; - Assert.assertEquals((byte) (id & id), id, + assertEquals((byte) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id & x), x); - Assert.assertEquals((byte) (x & id), x); + assertEquals((byte) (id & x), x); + assertEquals((byte) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id & x), x, + assertEquals((byte) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x & id), x, + assertEquals((byte) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3767,20 +3810,20 @@ public class Byte512VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = OR_IDENTITY; - Assert.assertEquals((byte) (id | id), id, + assertEquals((byte) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id | x), x); - Assert.assertEquals((byte) (x | id), x); + assertEquals((byte) (id | x), x); + assertEquals((byte) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id | x), x, + assertEquals((byte) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x | id), x, + assertEquals((byte) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3869,20 +3912,20 @@ public class Byte512VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = XOR_IDENTITY; - Assert.assertEquals((byte) (id ^ id), id, + assertEquals((byte) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id ^ x), x); - Assert.assertEquals((byte) (x ^ id), x); + assertEquals((byte) (id ^ x), x); + assertEquals((byte) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id ^ x), x, + assertEquals((byte) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x ^ id), x, + assertEquals((byte) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -3971,20 +4014,20 @@ public class Byte512VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = ADD_IDENTITY; - Assert.assertEquals((byte) (id + id), id, + assertEquals((byte) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id + x), x); - Assert.assertEquals((byte) (x + id), x); + assertEquals((byte) (id + x), x); + assertEquals((byte) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id + x), x, + assertEquals((byte) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x + id), x, + assertEquals((byte) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4073,20 +4116,20 @@ public class Byte512VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = MUL_IDENTITY; - Assert.assertEquals((byte) (id * id), id, + assertEquals((byte) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id * x), x); - Assert.assertEquals((byte) (x * id), x); + assertEquals((byte) (id * x), x); + assertEquals((byte) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id * x), x, + assertEquals((byte) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x * id), x, + assertEquals((byte) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4175,20 +4218,20 @@ public class Byte512VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = MIN_IDENTITY; - Assert.assertEquals((byte) Math.min(id, id), id, + assertEquals((byte) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) Math.min(id, x), x); - Assert.assertEquals((byte) Math.min(x, id), x); + assertEquals((byte) Math.min(id, x), x); + assertEquals((byte) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) Math.min(id, x), x, + assertEquals((byte) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) Math.min(x, id), x, + assertEquals((byte) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4277,20 +4320,20 @@ public class Byte512VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = MAX_IDENTITY; - Assert.assertEquals((byte) Math.max(id, id), id, + assertEquals((byte) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) Math.max(id, x), x); - Assert.assertEquals((byte) Math.max(x, id), x); + assertEquals((byte) Math.max(id, x), x); + assertEquals((byte) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) Math.max(id, x), x, + assertEquals((byte) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) Math.max(x, id), x, + assertEquals((byte) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4379,20 +4422,20 @@ public class Byte512VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = UMIN_IDENTITY; - Assert.assertEquals((byte) VectorMath.minUnsigned(id, id), id, + assertEquals((byte) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((byte) VectorMath.minUnsigned(x, id), x); + assertEquals((byte) VectorMath.minUnsigned(id, x), x); + assertEquals((byte) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) VectorMath.minUnsigned(id, x), x, + assertEquals((byte) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) VectorMath.minUnsigned(x, id), x, + assertEquals((byte) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4481,20 +4524,20 @@ public class Byte512VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = UMAX_IDENTITY; - Assert.assertEquals((byte) VectorMath.maxUnsigned(id, id), id, + assertEquals((byte) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((byte) VectorMath.maxUnsigned(x, id), x); + assertEquals((byte) VectorMath.maxUnsigned(id, x), x); + assertEquals((byte) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) VectorMath.maxUnsigned(id, x), x, + assertEquals((byte) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) VectorMath.maxUnsigned(x, id), x, + assertEquals((byte) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4583,20 +4626,20 @@ public class Byte512VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4733,20 +4776,20 @@ public class Byte512VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = SUADD_IDENTITY; - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((byte) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4825,7 +4868,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4845,7 +4888,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4866,7 +4909,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4886,7 +4929,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4905,7 +4948,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4924,7 +4967,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4947,7 +4990,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -4966,7 +5009,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -4989,7 +5032,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5008,7 +5051,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5027,7 +5070,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5050,7 +5093,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5069,7 +5112,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5092,7 +5135,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5111,7 +5154,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5134,7 +5177,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5153,7 +5196,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5176,7 +5219,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5195,7 +5238,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5218,7 +5261,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5237,7 +5280,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5260,7 +5303,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5279,7 +5322,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5302,7 +5345,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5321,7 +5364,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5344,7 +5387,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5361,7 +5404,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5381,7 +5424,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5397,7 +5440,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (byte)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (byte)((long)b[i])); } } } @@ -5417,7 +5460,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (byte)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (byte)((long)b[i]))); } } } @@ -5433,7 +5476,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5453,7 +5496,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5469,7 +5512,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (byte)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (byte)((long)b[i])); } } } @@ -5489,7 +5532,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (byte)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (byte)((long)b[i]))); } } } @@ -5770,7 +5813,7 @@ public class Byte512VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static byte[] sliceUnary(byte[] a, int origin, int idx) { @@ -6720,10 +6763,10 @@ public class Byte512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6752,7 +6795,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6768,7 +6811,7 @@ public class Byte512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -7019,7 +7062,7 @@ public class Byte512VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -7047,7 +7090,7 @@ public class Byte512VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -7062,7 +7105,7 @@ public class Byte512VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7165,7 +7208,7 @@ public class Byte512VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7191,7 +7234,7 @@ public class Byte512VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7205,7 +7248,7 @@ public class Byte512VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7227,7 +7270,7 @@ public class Byte512VectorTests extends AbstractVectorTest { static void loopBoundByte512VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7235,14 +7278,14 @@ public class Byte512VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeByte512VectorTestsSmokeTest() { ByteVector av = ByteVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Byte.SIZE); + assertEquals(elsize, Byte.SIZE); } @Test @@ -7296,7 +7339,7 @@ public class Byte512VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueByte512VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Byte64VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Byte64VectorLoadStoreTests.java index 870b9f9b8fb..9b0687c73f2 100644 --- a/test/jdk/jdk/incubator/vector/Byte64VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Byte64VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Byte64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 64); + static void assertEquals(byte actual, byte expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(byte actual, byte expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(byte [] actual, byte [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(byte [] actual, byte [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Byte64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "byteProviderForIOOBE") @@ -957,11 +972,11 @@ public class Byte64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -972,11 +987,11 @@ public class Byte64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0, "at index #" + j); } } @@ -992,7 +1007,7 @@ public class Byte64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(byte[] r, byte[] a, int[] indexMap) { @@ -1005,7 +1020,7 @@ public class Byte64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Byte64VectorTests.java b/test/jdk/jdk/incubator/vector/Byte64VectorTests.java index e28fb2b2001..b71d642d447 100644 --- a/test/jdk/jdk/incubator/vector/Byte64VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Byte64VectorTests.java @@ -62,6 +62,49 @@ public class Byte64VectorTests extends AbstractVectorTest { ByteVector.SPECIES_64; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(byte actual, byte expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(byte actual, byte expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(byte actual, byte expected, byte delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(byte actual, byte expected, byte delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(byte [] actual, byte [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(byte [] actual, byte [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final byte CONST_SHIFT = Byte.SIZE / 2; @@ -96,10 +139,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +154,13 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { byte[] ref = f.apply(a[i]); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +170,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +189,13 @@ public class Byte64VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +211,13 @@ public class Byte64VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -190,13 +233,13 @@ public class Byte64VectorTests extends AbstractVectorTest { FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -212,13 +255,13 @@ public class Byte64VectorTests extends AbstractVectorTest { FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -230,10 +273,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -245,10 +288,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,12 +300,12 @@ public class Byte64VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -273,20 +316,20 @@ public class Byte64VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (byte)0); + assertEquals(r[i + k], (byte)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (byte)0, "at index #" + idx); + assertEquals(r[idx], (byte)0, "at index #" + idx); } } } @@ -298,19 +341,19 @@ public class Byte64VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (byte)0); + assertEquals(r[i + j], (byte)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (byte)0, "at index #" + idx); + assertEquals(r[idx], (byte)0, "at index #" + idx); } } } @@ -326,11 +369,11 @@ public class Byte64VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -339,12 +382,12 @@ public class Byte64VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -354,17 +397,17 @@ public class Byte64VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (byte)0); + assertEquals(r[i+j], (byte)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -374,17 +417,17 @@ public class Byte64VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (byte)0); + assertEquals(r[i+j], (byte)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -398,10 +441,10 @@ public class Byte64VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -413,10 +456,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -428,10 +471,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -452,18 +495,18 @@ public class Byte64VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -478,18 +521,18 @@ public class Byte64VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -497,10 +540,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -508,10 +551,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -519,10 +562,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -531,10 +574,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -547,10 +590,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -562,10 +605,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -577,10 +620,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -595,10 +638,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -611,11 +654,11 @@ public class Byte64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -629,11 +672,11 @@ public class Byte64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -655,11 +698,11 @@ public class Byte64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -673,11 +716,11 @@ public class Byte64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -697,10 +740,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -712,10 +755,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -724,10 +767,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -737,10 +780,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -756,11 +799,11 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -777,11 +820,11 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -792,11 +835,11 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -813,11 +856,11 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -835,13 +878,13 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, i, b, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -862,13 +905,13 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, i, mask, b, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -883,13 +926,13 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { byte[] ref = f.apply(r, a, i, mask, b, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -910,13 +953,13 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, origin, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -930,13 +973,13 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -951,13 +994,13 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, mask, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -972,13 +1015,13 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, part, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -994,13 +1037,13 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, part, mask, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1013,10 +1056,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1025,10 +1068,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1036,10 +1079,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1047,10 +1090,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1586,7 +1629,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. ByteVector io = (ByteVector) SPECIES.broadcast(0).addIndex(1); ByteVector io2 = (ByteVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); ByteVector a = io.add((byte)1); //[1,2] ByteVector b = a.neg(); //[-1,-2] byte[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1601,19 +1644,19 @@ public class Byte64VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); ByteVector uab0 = zab0.rearrange(unz0,zab1); ByteVector uab1 = zab0.rearrange(unz1,zab1); byte[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { ByteVector io = (ByteVector) SPECIES.broadcast(0).addIndex(1); ByteVector io2 = (ByteVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1628,7 +1671,7 @@ public class Byte64VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test(expectedExceptions = UnsupportedOperationException.class) @@ -3665,20 +3708,20 @@ public class Byte64VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = AND_IDENTITY; - Assert.assertEquals((byte) (id & id), id, + assertEquals((byte) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id & x), x); - Assert.assertEquals((byte) (x & id), x); + assertEquals((byte) (id & x), x); + assertEquals((byte) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id & x), x, + assertEquals((byte) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x & id), x, + assertEquals((byte) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3767,20 +3810,20 @@ public class Byte64VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = OR_IDENTITY; - Assert.assertEquals((byte) (id | id), id, + assertEquals((byte) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id | x), x); - Assert.assertEquals((byte) (x | id), x); + assertEquals((byte) (id | x), x); + assertEquals((byte) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id | x), x, + assertEquals((byte) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x | id), x, + assertEquals((byte) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3869,20 +3912,20 @@ public class Byte64VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = XOR_IDENTITY; - Assert.assertEquals((byte) (id ^ id), id, + assertEquals((byte) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id ^ x), x); - Assert.assertEquals((byte) (x ^ id), x); + assertEquals((byte) (id ^ x), x); + assertEquals((byte) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id ^ x), x, + assertEquals((byte) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x ^ id), x, + assertEquals((byte) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -3971,20 +4014,20 @@ public class Byte64VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = ADD_IDENTITY; - Assert.assertEquals((byte) (id + id), id, + assertEquals((byte) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id + x), x); - Assert.assertEquals((byte) (x + id), x); + assertEquals((byte) (id + x), x); + assertEquals((byte) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id + x), x, + assertEquals((byte) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x + id), x, + assertEquals((byte) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4073,20 +4116,20 @@ public class Byte64VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = MUL_IDENTITY; - Assert.assertEquals((byte) (id * id), id, + assertEquals((byte) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id * x), x); - Assert.assertEquals((byte) (x * id), x); + assertEquals((byte) (id * x), x); + assertEquals((byte) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id * x), x, + assertEquals((byte) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x * id), x, + assertEquals((byte) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4175,20 +4218,20 @@ public class Byte64VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = MIN_IDENTITY; - Assert.assertEquals((byte) Math.min(id, id), id, + assertEquals((byte) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) Math.min(id, x), x); - Assert.assertEquals((byte) Math.min(x, id), x); + assertEquals((byte) Math.min(id, x), x); + assertEquals((byte) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) Math.min(id, x), x, + assertEquals((byte) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) Math.min(x, id), x, + assertEquals((byte) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4277,20 +4320,20 @@ public class Byte64VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = MAX_IDENTITY; - Assert.assertEquals((byte) Math.max(id, id), id, + assertEquals((byte) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) Math.max(id, x), x); - Assert.assertEquals((byte) Math.max(x, id), x); + assertEquals((byte) Math.max(id, x), x); + assertEquals((byte) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) Math.max(id, x), x, + assertEquals((byte) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) Math.max(x, id), x, + assertEquals((byte) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4379,20 +4422,20 @@ public class Byte64VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = UMIN_IDENTITY; - Assert.assertEquals((byte) VectorMath.minUnsigned(id, id), id, + assertEquals((byte) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((byte) VectorMath.minUnsigned(x, id), x); + assertEquals((byte) VectorMath.minUnsigned(id, x), x); + assertEquals((byte) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) VectorMath.minUnsigned(id, x), x, + assertEquals((byte) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) VectorMath.minUnsigned(x, id), x, + assertEquals((byte) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4481,20 +4524,20 @@ public class Byte64VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = UMAX_IDENTITY; - Assert.assertEquals((byte) VectorMath.maxUnsigned(id, id), id, + assertEquals((byte) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((byte) VectorMath.maxUnsigned(x, id), x); + assertEquals((byte) VectorMath.maxUnsigned(id, x), x); + assertEquals((byte) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) VectorMath.maxUnsigned(id, x), x, + assertEquals((byte) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) VectorMath.maxUnsigned(x, id), x, + assertEquals((byte) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4583,20 +4626,20 @@ public class Byte64VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4733,20 +4776,20 @@ public class Byte64VectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = SUADD_IDENTITY; - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((byte) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4825,7 +4868,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4845,7 +4888,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4866,7 +4909,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4886,7 +4929,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4905,7 +4948,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4924,7 +4967,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4947,7 +4990,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -4966,7 +5009,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -4989,7 +5032,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5008,7 +5051,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5027,7 +5070,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5050,7 +5093,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5069,7 +5112,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5092,7 +5135,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5111,7 +5154,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5134,7 +5177,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5153,7 +5196,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5176,7 +5219,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5195,7 +5238,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5218,7 +5261,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5237,7 +5280,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5260,7 +5303,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5279,7 +5322,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5302,7 +5345,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5321,7 +5364,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5344,7 +5387,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5361,7 +5404,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5381,7 +5424,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5397,7 +5440,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (byte)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (byte)((long)b[i])); } } } @@ -5417,7 +5460,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (byte)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (byte)((long)b[i]))); } } } @@ -5433,7 +5476,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5453,7 +5496,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5469,7 +5512,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (byte)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (byte)((long)b[i])); } } } @@ -5489,7 +5532,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (byte)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (byte)((long)b[i]))); } } } @@ -5770,7 +5813,7 @@ public class Byte64VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static byte[] sliceUnary(byte[] a, int origin, int idx) { @@ -6720,10 +6763,10 @@ public class Byte64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6752,7 +6795,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6768,7 +6811,7 @@ public class Byte64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -7019,7 +7062,7 @@ public class Byte64VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -7047,7 +7090,7 @@ public class Byte64VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -7062,7 +7105,7 @@ public class Byte64VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7165,7 +7208,7 @@ public class Byte64VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7191,7 +7234,7 @@ public class Byte64VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7205,7 +7248,7 @@ public class Byte64VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7227,7 +7270,7 @@ public class Byte64VectorTests extends AbstractVectorTest { static void loopBoundByte64VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7235,14 +7278,14 @@ public class Byte64VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeByte64VectorTestsSmokeTest() { ByteVector av = ByteVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Byte.SIZE); + assertEquals(elsize, Byte.SIZE); } @Test @@ -7296,7 +7339,7 @@ public class Byte64VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueByte64VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/ByteMaxVectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/ByteMaxVectorLoadStoreTests.java index bd5afc3f05a..76c6e9ff49f 100644 --- a/test/jdk/jdk/incubator/vector/ByteMaxVectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/ByteMaxVectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -68,14 +68,29 @@ public class ByteMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / Max); + static void assertEquals(byte actual, byte expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(byte actual, byte expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(byte [] actual, byte [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(byte [] actual, byte [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(byte[] r, byte[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (byte) 0, "at index #" + i); } } @@ -329,7 +344,7 @@ public class ByteMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "byteProviderForIOOBE") @@ -964,11 +979,11 @@ public class ByteMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -979,11 +994,11 @@ public class ByteMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (byte) 0, "at index #" + j); } } @@ -999,7 +1014,7 @@ public class ByteMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(byte[] r, byte[] a, int[] indexMap) { @@ -1012,7 +1027,7 @@ public class ByteMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/ByteMaxVectorTests.java b/test/jdk/jdk/incubator/vector/ByteMaxVectorTests.java index b6932785b55..ccbc2e078b9 100644 --- a/test/jdk/jdk/incubator/vector/ByteMaxVectorTests.java +++ b/test/jdk/jdk/incubator/vector/ByteMaxVectorTests.java @@ -62,6 +62,49 @@ public class ByteMaxVectorTests extends AbstractVectorTest { ByteVector.SPECIES_MAX; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(byte actual, byte expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(byte actual, byte expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(byte actual, byte expected, byte delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(byte actual, byte expected, byte delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(byte [] actual, byte [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(byte [] actual, byte [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static VectorShape getMaxBit() { return VectorShape.S_Max_BIT; @@ -102,10 +145,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -117,13 +160,13 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { byte[] ref = f.apply(a[i]); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -133,10 +176,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -152,13 +195,13 @@ public class ByteMaxVectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -174,13 +217,13 @@ public class ByteMaxVectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -196,13 +239,13 @@ public class ByteMaxVectorTests extends AbstractVectorTest { FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -218,13 +261,13 @@ public class ByteMaxVectorTests extends AbstractVectorTest { FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -236,10 +279,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -251,10 +294,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -263,12 +306,12 @@ public class ByteMaxVectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -279,20 +322,20 @@ public class ByteMaxVectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (byte)0); + assertEquals(r[i + k], (byte)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (byte)0, "at index #" + idx); + assertEquals(r[idx], (byte)0, "at index #" + idx); } } } @@ -304,19 +347,19 @@ public class ByteMaxVectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (byte)0); + assertEquals(r[i + j], (byte)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (byte)0, "at index #" + idx); + assertEquals(r[idx], (byte)0, "at index #" + idx); } } } @@ -332,11 +375,11 @@ public class ByteMaxVectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -345,12 +388,12 @@ public class ByteMaxVectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -360,17 +403,17 @@ public class ByteMaxVectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (byte)0); + assertEquals(r[i+j], (byte)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -380,17 +423,17 @@ public class ByteMaxVectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (byte)0); + assertEquals(r[i+j], (byte)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (byte)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -404,10 +447,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -419,10 +462,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -434,10 +477,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -458,18 +501,18 @@ public class ByteMaxVectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -484,18 +527,18 @@ public class ByteMaxVectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -503,10 +546,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -514,10 +557,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -525,10 +568,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -537,10 +580,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -553,10 +596,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -568,10 +611,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -583,10 +626,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -601,10 +644,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (byte)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -617,11 +660,11 @@ public class ByteMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -635,11 +678,11 @@ public class ByteMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -661,11 +704,11 @@ public class ByteMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -679,11 +722,11 @@ public class ByteMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -703,10 +746,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -718,10 +761,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -730,10 +773,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -743,10 +786,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -762,11 +805,11 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -783,11 +826,11 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -798,11 +841,11 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -819,11 +862,11 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -841,13 +884,13 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, i, b, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -868,13 +911,13 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, i, mask, b, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -889,13 +932,13 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { byte[] ref = f.apply(r, a, i, mask, b, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -916,13 +959,13 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, origin, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -936,13 +979,13 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -957,13 +1000,13 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, mask, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -978,13 +1021,13 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, part, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1000,13 +1043,13 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { byte[] ref = f.apply(a, b, origin, part, mask, i); byte[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1019,10 +1062,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1031,10 +1074,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1042,10 +1085,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1053,10 +1096,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1592,7 +1635,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Do some zipping and shuffling. ByteVector io = (ByteVector) SPECIES.broadcast(0).addIndex(1); ByteVector io2 = (ByteVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); ByteVector a = io.add((byte)1); //[1,2] ByteVector b = a.neg(); //[-1,-2] byte[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1607,19 +1650,19 @@ public class ByteMaxVectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); ByteVector uab0 = zab0.rearrange(unz0,zab1); ByteVector uab1 = zab0.rearrange(unz1,zab1); byte[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { ByteVector io = (ByteVector) SPECIES.broadcast(0).addIndex(1); ByteVector io2 = (ByteVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1634,7 +1677,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test(expectedExceptions = UnsupportedOperationException.class) @@ -3671,20 +3714,20 @@ public class ByteMaxVectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = AND_IDENTITY; - Assert.assertEquals((byte) (id & id), id, + assertEquals((byte) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id & x), x); - Assert.assertEquals((byte) (x & id), x); + assertEquals((byte) (id & x), x); + assertEquals((byte) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id & x), x, + assertEquals((byte) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x & id), x, + assertEquals((byte) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3773,20 +3816,20 @@ public class ByteMaxVectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = OR_IDENTITY; - Assert.assertEquals((byte) (id | id), id, + assertEquals((byte) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id | x), x); - Assert.assertEquals((byte) (x | id), x); + assertEquals((byte) (id | x), x); + assertEquals((byte) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id | x), x, + assertEquals((byte) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x | id), x, + assertEquals((byte) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3875,20 +3918,20 @@ public class ByteMaxVectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = XOR_IDENTITY; - Assert.assertEquals((byte) (id ^ id), id, + assertEquals((byte) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id ^ x), x); - Assert.assertEquals((byte) (x ^ id), x); + assertEquals((byte) (id ^ x), x); + assertEquals((byte) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id ^ x), x, + assertEquals((byte) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x ^ id), x, + assertEquals((byte) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -3977,20 +4020,20 @@ public class ByteMaxVectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = ADD_IDENTITY; - Assert.assertEquals((byte) (id + id), id, + assertEquals((byte) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id + x), x); - Assert.assertEquals((byte) (x + id), x); + assertEquals((byte) (id + x), x); + assertEquals((byte) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id + x), x, + assertEquals((byte) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x + id), x, + assertEquals((byte) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4079,20 +4122,20 @@ public class ByteMaxVectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = MUL_IDENTITY; - Assert.assertEquals((byte) (id * id), id, + assertEquals((byte) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) (id * x), x); - Assert.assertEquals((byte) (x * id), x); + assertEquals((byte) (id * x), x); + assertEquals((byte) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) (id * x), x, + assertEquals((byte) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) (x * id), x, + assertEquals((byte) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4181,20 +4224,20 @@ public class ByteMaxVectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = MIN_IDENTITY; - Assert.assertEquals((byte) Math.min(id, id), id, + assertEquals((byte) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) Math.min(id, x), x); - Assert.assertEquals((byte) Math.min(x, id), x); + assertEquals((byte) Math.min(id, x), x); + assertEquals((byte) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) Math.min(id, x), x, + assertEquals((byte) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) Math.min(x, id), x, + assertEquals((byte) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4283,20 +4326,20 @@ public class ByteMaxVectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = MAX_IDENTITY; - Assert.assertEquals((byte) Math.max(id, id), id, + assertEquals((byte) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) Math.max(id, x), x); - Assert.assertEquals((byte) Math.max(x, id), x); + assertEquals((byte) Math.max(id, x), x); + assertEquals((byte) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) Math.max(id, x), x, + assertEquals((byte) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) Math.max(x, id), x, + assertEquals((byte) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4385,20 +4428,20 @@ public class ByteMaxVectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = UMIN_IDENTITY; - Assert.assertEquals((byte) VectorMath.minUnsigned(id, id), id, + assertEquals((byte) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((byte) VectorMath.minUnsigned(x, id), x); + assertEquals((byte) VectorMath.minUnsigned(id, x), x); + assertEquals((byte) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) VectorMath.minUnsigned(id, x), x, + assertEquals((byte) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) VectorMath.minUnsigned(x, id), x, + assertEquals((byte) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4487,20 +4530,20 @@ public class ByteMaxVectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = UMAX_IDENTITY; - Assert.assertEquals((byte) VectorMath.maxUnsigned(id, id), id, + assertEquals((byte) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((byte) VectorMath.maxUnsigned(x, id), x); + assertEquals((byte) VectorMath.maxUnsigned(id, x), x); + assertEquals((byte) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) VectorMath.maxUnsigned(id, x), x, + assertEquals((byte) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) VectorMath.maxUnsigned(x, id), x, + assertEquals((byte) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4589,20 +4632,20 @@ public class ByteMaxVectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4739,20 +4782,20 @@ public class ByteMaxVectorTests extends AbstractVectorTest { byte[] a = fa.apply(SPECIES.length()); byte id = SUADD_IDENTITY; - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((byte) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); byte x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((byte) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((byte) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4831,7 +4874,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4851,7 +4894,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4872,7 +4915,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4892,7 +4935,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4911,7 +4954,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4930,7 +4973,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4953,7 +4996,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -4972,7 +5015,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -4995,7 +5038,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5014,7 +5057,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5033,7 +5076,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5056,7 +5099,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5075,7 +5118,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5098,7 +5141,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5117,7 +5160,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5140,7 +5183,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5159,7 +5202,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5182,7 +5225,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5201,7 +5244,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5224,7 +5267,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5243,7 +5286,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5266,7 +5309,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5285,7 +5328,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5308,7 +5351,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5327,7 +5370,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5350,7 +5393,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5367,7 +5410,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5387,7 +5430,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5403,7 +5446,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (byte)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (byte)((long)b[i])); } } } @@ -5423,7 +5466,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (byte)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (byte)((long)b[i]))); } } } @@ -5439,7 +5482,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5459,7 +5502,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5475,7 +5518,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (byte)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (byte)((long)b[i])); } } } @@ -5495,7 +5538,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (byte)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (byte)((long)b[i]))); } } } @@ -5776,7 +5819,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static byte[] sliceUnary(byte[] a, int origin, int idx) { @@ -6726,10 +6769,10 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6758,7 +6801,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6774,7 +6817,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -7025,7 +7068,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -7053,7 +7096,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -7068,7 +7111,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7171,7 +7214,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7197,7 +7240,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7211,7 +7254,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7233,7 +7276,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { static void loopBoundByteMaxVectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7241,14 +7284,14 @@ public class ByteMaxVectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeByteMaxVectorTestsSmokeTest() { ByteVector av = ByteVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Byte.SIZE); + assertEquals(elsize, Byte.SIZE); } @Test @@ -7302,7 +7345,7 @@ public class ByteMaxVectorTests extends AbstractVectorTest { @Test static void MaskAllTrueByteMaxVectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Double128VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Double128VectorLoadStoreTests.java index fed75349f68..e4a0a6bf40e 100644 --- a/test/jdk/jdk/incubator/vector/Double128VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Double128VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Double128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 128); + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(double [] actual, double [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double [] actual, double [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(double[] r, double[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Double128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "doubleProviderForIOOBE") @@ -870,11 +885,11 @@ public class Double128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Double128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Double128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(double[] r, double[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Double128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Double128VectorTests.java b/test/jdk/jdk/incubator/vector/Double128VectorTests.java index 1d4cadd2158..685590f06e1 100644 --- a/test/jdk/jdk/incubator/vector/Double128VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Double128VectorTests.java @@ -61,6 +61,43 @@ public class Double128VectorTests extends AbstractVectorTest { DoubleVector.SPECIES_128; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(double actual, double expected, double delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(double actual, double expected, double delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(double [] actual, double [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double [] actual, double [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + // Identity values for reduction operations private static final double ADD_IDENTITY = (double)0; @@ -95,10 +132,10 @@ public class Double128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -110,13 +147,13 @@ public class Double128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { double[] ref = f.apply(a[i]); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -126,10 +163,10 @@ public class Double128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -151,13 +188,13 @@ public class Double128VectorTests extends AbstractVectorTest { double relativeErrorFactor) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); } } @@ -179,14 +216,14 @@ public class Double128VectorTests extends AbstractVectorTest { double relativeError) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); } } @@ -202,13 +239,13 @@ relativeError)); FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -224,13 +261,13 @@ relativeError)); FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -242,10 +279,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,10 +294,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -269,12 +306,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -285,20 +322,20 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (double)0); + assertEquals(r[i + k], (double)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (double)0, "at index #" + idx); + assertEquals(r[idx], (double)0, "at index #" + idx); } } } @@ -310,19 +347,19 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (double)0); + assertEquals(r[i + j], (double)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (double)0, "at index #" + idx); + assertEquals(r[idx], (double)0, "at index #" + idx); } } } @@ -338,11 +375,11 @@ relativeError)); wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -351,12 +388,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -366,17 +403,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (double)0); + assertEquals(r[i+j], (double)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -386,17 +423,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (double)0); + assertEquals(r[i+j], (double)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -410,10 +447,10 @@ relativeError)); try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -425,10 +462,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -440,10 +477,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -464,18 +501,18 @@ relativeError)); try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -490,18 +527,18 @@ relativeError)); for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -509,10 +546,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -520,10 +557,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -531,10 +568,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -543,10 +580,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -559,10 +596,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -574,10 +611,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -589,10 +626,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -607,10 +644,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -623,11 +660,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -641,11 +678,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -667,11 +704,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -685,11 +722,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -709,10 +746,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -724,10 +761,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -736,10 +773,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -749,10 +786,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -768,11 +805,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -789,11 +826,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -804,11 +841,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -825,11 +862,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -921,13 +958,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, i, b, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -948,13 +985,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, i, mask, b, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -969,13 +1006,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { double[] ref = f.apply(r, a, i, mask, b, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -996,13 +1033,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, origin, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -1016,13 +1053,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1037,13 +1074,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, mask, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1058,13 +1095,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, part, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1080,13 +1117,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, part, mask, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1132,10 +1169,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1178,10 +1215,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1584,7 +1621,7 @@ relativeError)); // Do some zipping and shuffling. DoubleVector io = (DoubleVector) SPECIES.broadcast(0).addIndex(1); DoubleVector io2 = (DoubleVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); DoubleVector a = io.add((double)1); //[1,2] DoubleVector b = a.neg(); //[-1,-2] double[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1599,19 +1636,19 @@ relativeError)); manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); DoubleVector uab0 = zab0.rearrange(unz0,zab1); DoubleVector uab1 = zab0.rearrange(unz1,zab1); double[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { DoubleVector io = (DoubleVector) SPECIES.broadcast(0).addIndex(1); DoubleVector io2 = (DoubleVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1628,15 +1665,15 @@ relativeError)); Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); VectorSpecies asIntegralSpecies = asIntegral.species(); Assert.assertNotEquals(asIntegralSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asIntegralSpecies.length(), SPECIES.length()); - Assert.assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); + assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asIntegralSpecies.length(), SPECIES.length()); + assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); } @Test void viewAsFloatingLanesTest() { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); - Assert.assertEquals(asFloating.species(), SPECIES); + assertEquals(asFloating.species(), SPECIES); } static double ADD(double a, double b) { @@ -2432,20 +2469,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = ADD_IDENTITY; - Assert.assertEquals((double) (id + id), id, + assertEquals((double) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) (id + x), x); - Assert.assertEquals((double) (x + id), x); + assertEquals((double) (id + x), x); + assertEquals((double) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) (id + x), x, + assertEquals((double) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) (x + id), x, + assertEquals((double) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -2534,20 +2571,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = MUL_IDENTITY; - Assert.assertEquals((double) (id * id), id, + assertEquals((double) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) (id * x), x); - Assert.assertEquals((double) (x * id), x); + assertEquals((double) (id * x), x); + assertEquals((double) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) (id * x), x, + assertEquals((double) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) (x * id), x, + assertEquals((double) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -2636,20 +2673,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = MIN_IDENTITY; - Assert.assertEquals((double) Math.min(id, id), id, + assertEquals((double) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) Math.min(id, x), x); - Assert.assertEquals((double) Math.min(x, id), x); + assertEquals((double) Math.min(id, x), x); + assertEquals((double) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) Math.min(id, x), x, + assertEquals((double) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) Math.min(x, id), x, + assertEquals((double) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -2738,20 +2775,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = MAX_IDENTITY; - Assert.assertEquals((double) Math.max(id, id), id, + assertEquals((double) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) Math.max(id, x), x); - Assert.assertEquals((double) Math.max(x, id), x); + assertEquals((double) Math.max(id, x), x); + assertEquals((double) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) Math.max(id, x), x, + assertEquals((double) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) Math.max(x, id), x, + assertEquals((double) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -2840,20 +2877,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -2933,7 +2970,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -2953,7 +2990,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -2974,7 +3011,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -2994,7 +3031,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -3015,7 +3052,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); } } } @@ -3035,7 +3072,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); } } } @@ -3056,7 +3093,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); } } } @@ -3076,7 +3113,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); } } } @@ -3097,7 +3134,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); } } } @@ -3117,7 +3154,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); } } } @@ -3136,7 +3173,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3155,7 +3192,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3178,7 +3215,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -3197,7 +3234,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -3220,7 +3257,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -3239,7 +3276,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3258,7 +3295,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3281,7 +3318,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -3300,7 +3337,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -3323,7 +3360,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -3342,7 +3379,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -3365,7 +3402,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -3384,7 +3421,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -3407,7 +3444,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -3424,7 +3461,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -3444,7 +3481,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -3460,7 +3497,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (double)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (double)((long)b[i])); } } } @@ -3480,7 +3517,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (double)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (double)((long)b[i]))); } } } @@ -3496,7 +3533,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -3516,7 +3553,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -3532,7 +3569,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (double)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (double)((long)b[i])); } } } @@ -3552,7 +3589,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (double)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (double)((long)b[i]))); } } } @@ -3833,7 +3870,7 @@ relativeError)); } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static double[] sliceUnary(double[] a, int origin, int idx) { @@ -5052,10 +5089,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -5084,7 +5121,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5100,7 +5137,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5330,7 +5367,7 @@ relativeError)); int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -5358,7 +5395,7 @@ relativeError)); var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -5373,7 +5410,7 @@ relativeError)); var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -5476,7 +5513,7 @@ relativeError)); trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -5502,7 +5539,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5516,7 +5553,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5538,7 +5575,7 @@ relativeError)); static void loopBoundDouble128VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -5546,14 +5583,14 @@ relativeError)); long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeDouble128VectorTestsSmokeTest() { DoubleVector av = DoubleVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Double.SIZE); + assertEquals(elsize, Double.SIZE); } @Test @@ -5607,7 +5644,7 @@ relativeError)); @Test static void MaskAllTrueDouble128VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Double256VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Double256VectorLoadStoreTests.java index d8a7eca2bda..56d5608a89d 100644 --- a/test/jdk/jdk/incubator/vector/Double256VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Double256VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Double256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 256); + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(double [] actual, double [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double [] actual, double [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(double[] r, double[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Double256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "doubleProviderForIOOBE") @@ -870,11 +885,11 @@ public class Double256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Double256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Double256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(double[] r, double[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Double256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Double256VectorTests.java b/test/jdk/jdk/incubator/vector/Double256VectorTests.java index b5acfe0ef34..d39b6f9c923 100644 --- a/test/jdk/jdk/incubator/vector/Double256VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Double256VectorTests.java @@ -61,6 +61,43 @@ public class Double256VectorTests extends AbstractVectorTest { DoubleVector.SPECIES_256; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(double actual, double expected, double delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(double actual, double expected, double delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(double [] actual, double [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double [] actual, double [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + // Identity values for reduction operations private static final double ADD_IDENTITY = (double)0; @@ -95,10 +132,10 @@ public class Double256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -110,13 +147,13 @@ public class Double256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { double[] ref = f.apply(a[i]); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -126,10 +163,10 @@ public class Double256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -151,13 +188,13 @@ public class Double256VectorTests extends AbstractVectorTest { double relativeErrorFactor) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); } } @@ -179,14 +216,14 @@ public class Double256VectorTests extends AbstractVectorTest { double relativeError) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); } } @@ -202,13 +239,13 @@ relativeError)); FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -224,13 +261,13 @@ relativeError)); FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -242,10 +279,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,10 +294,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -269,12 +306,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -285,20 +322,20 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (double)0); + assertEquals(r[i + k], (double)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (double)0, "at index #" + idx); + assertEquals(r[idx], (double)0, "at index #" + idx); } } } @@ -310,19 +347,19 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (double)0); + assertEquals(r[i + j], (double)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (double)0, "at index #" + idx); + assertEquals(r[idx], (double)0, "at index #" + idx); } } } @@ -338,11 +375,11 @@ relativeError)); wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -351,12 +388,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -366,17 +403,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (double)0); + assertEquals(r[i+j], (double)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -386,17 +423,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (double)0); + assertEquals(r[i+j], (double)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -410,10 +447,10 @@ relativeError)); try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -425,10 +462,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -440,10 +477,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -464,18 +501,18 @@ relativeError)); try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -490,18 +527,18 @@ relativeError)); for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -509,10 +546,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -520,10 +557,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -531,10 +568,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -543,10 +580,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -559,10 +596,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -574,10 +611,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -589,10 +626,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -607,10 +644,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -623,11 +660,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -641,11 +678,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -667,11 +704,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -685,11 +722,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -709,10 +746,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -724,10 +761,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -736,10 +773,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -749,10 +786,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -768,11 +805,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -789,11 +826,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -804,11 +841,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -825,11 +862,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -921,13 +958,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, i, b, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -948,13 +985,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, i, mask, b, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -969,13 +1006,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { double[] ref = f.apply(r, a, i, mask, b, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -996,13 +1033,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, origin, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -1016,13 +1053,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1037,13 +1074,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, mask, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1058,13 +1095,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, part, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1080,13 +1117,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, part, mask, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1132,10 +1169,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1178,10 +1215,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1584,7 +1621,7 @@ relativeError)); // Do some zipping and shuffling. DoubleVector io = (DoubleVector) SPECIES.broadcast(0).addIndex(1); DoubleVector io2 = (DoubleVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); DoubleVector a = io.add((double)1); //[1,2] DoubleVector b = a.neg(); //[-1,-2] double[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1599,19 +1636,19 @@ relativeError)); manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); DoubleVector uab0 = zab0.rearrange(unz0,zab1); DoubleVector uab1 = zab0.rearrange(unz1,zab1); double[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { DoubleVector io = (DoubleVector) SPECIES.broadcast(0).addIndex(1); DoubleVector io2 = (DoubleVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1628,15 +1665,15 @@ relativeError)); Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); VectorSpecies asIntegralSpecies = asIntegral.species(); Assert.assertNotEquals(asIntegralSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asIntegralSpecies.length(), SPECIES.length()); - Assert.assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); + assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asIntegralSpecies.length(), SPECIES.length()); + assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); } @Test void viewAsFloatingLanesTest() { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); - Assert.assertEquals(asFloating.species(), SPECIES); + assertEquals(asFloating.species(), SPECIES); } static double ADD(double a, double b) { @@ -2432,20 +2469,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = ADD_IDENTITY; - Assert.assertEquals((double) (id + id), id, + assertEquals((double) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) (id + x), x); - Assert.assertEquals((double) (x + id), x); + assertEquals((double) (id + x), x); + assertEquals((double) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) (id + x), x, + assertEquals((double) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) (x + id), x, + assertEquals((double) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -2534,20 +2571,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = MUL_IDENTITY; - Assert.assertEquals((double) (id * id), id, + assertEquals((double) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) (id * x), x); - Assert.assertEquals((double) (x * id), x); + assertEquals((double) (id * x), x); + assertEquals((double) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) (id * x), x, + assertEquals((double) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) (x * id), x, + assertEquals((double) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -2636,20 +2673,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = MIN_IDENTITY; - Assert.assertEquals((double) Math.min(id, id), id, + assertEquals((double) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) Math.min(id, x), x); - Assert.assertEquals((double) Math.min(x, id), x); + assertEquals((double) Math.min(id, x), x); + assertEquals((double) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) Math.min(id, x), x, + assertEquals((double) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) Math.min(x, id), x, + assertEquals((double) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -2738,20 +2775,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = MAX_IDENTITY; - Assert.assertEquals((double) Math.max(id, id), id, + assertEquals((double) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) Math.max(id, x), x); - Assert.assertEquals((double) Math.max(x, id), x); + assertEquals((double) Math.max(id, x), x); + assertEquals((double) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) Math.max(id, x), x, + assertEquals((double) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) Math.max(x, id), x, + assertEquals((double) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -2840,20 +2877,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -2933,7 +2970,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -2953,7 +2990,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -2974,7 +3011,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -2994,7 +3031,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -3015,7 +3052,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); } } } @@ -3035,7 +3072,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); } } } @@ -3056,7 +3093,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); } } } @@ -3076,7 +3113,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); } } } @@ -3097,7 +3134,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); } } } @@ -3117,7 +3154,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); } } } @@ -3136,7 +3173,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3155,7 +3192,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3178,7 +3215,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -3197,7 +3234,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -3220,7 +3257,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -3239,7 +3276,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3258,7 +3295,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3281,7 +3318,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -3300,7 +3337,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -3323,7 +3360,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -3342,7 +3379,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -3365,7 +3402,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -3384,7 +3421,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -3407,7 +3444,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -3424,7 +3461,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -3444,7 +3481,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -3460,7 +3497,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (double)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (double)((long)b[i])); } } } @@ -3480,7 +3517,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (double)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (double)((long)b[i]))); } } } @@ -3496,7 +3533,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -3516,7 +3553,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -3532,7 +3569,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (double)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (double)((long)b[i])); } } } @@ -3552,7 +3589,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (double)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (double)((long)b[i]))); } } } @@ -3833,7 +3870,7 @@ relativeError)); } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static double[] sliceUnary(double[] a, int origin, int idx) { @@ -5052,10 +5089,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -5084,7 +5121,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5100,7 +5137,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5330,7 +5367,7 @@ relativeError)); int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -5358,7 +5395,7 @@ relativeError)); var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -5373,7 +5410,7 @@ relativeError)); var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -5476,7 +5513,7 @@ relativeError)); trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -5502,7 +5539,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5516,7 +5553,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5538,7 +5575,7 @@ relativeError)); static void loopBoundDouble256VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -5546,14 +5583,14 @@ relativeError)); long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeDouble256VectorTestsSmokeTest() { DoubleVector av = DoubleVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Double.SIZE); + assertEquals(elsize, Double.SIZE); } @Test @@ -5607,7 +5644,7 @@ relativeError)); @Test static void MaskAllTrueDouble256VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Double512VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Double512VectorLoadStoreTests.java index ddf76df1f3a..ea76ba814d5 100644 --- a/test/jdk/jdk/incubator/vector/Double512VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Double512VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Double512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 512); + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(double [] actual, double [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double [] actual, double [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(double[] r, double[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Double512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "doubleProviderForIOOBE") @@ -870,11 +885,11 @@ public class Double512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Double512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Double512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(double[] r, double[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Double512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Double512VectorTests.java b/test/jdk/jdk/incubator/vector/Double512VectorTests.java index 3f85d0e52a6..7983ae0efe7 100644 --- a/test/jdk/jdk/incubator/vector/Double512VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Double512VectorTests.java @@ -61,6 +61,43 @@ public class Double512VectorTests extends AbstractVectorTest { DoubleVector.SPECIES_512; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(double actual, double expected, double delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(double actual, double expected, double delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(double [] actual, double [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double [] actual, double [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + // Identity values for reduction operations private static final double ADD_IDENTITY = (double)0; @@ -95,10 +132,10 @@ public class Double512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -110,13 +147,13 @@ public class Double512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { double[] ref = f.apply(a[i]); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -126,10 +163,10 @@ public class Double512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -151,13 +188,13 @@ public class Double512VectorTests extends AbstractVectorTest { double relativeErrorFactor) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); } } @@ -179,14 +216,14 @@ public class Double512VectorTests extends AbstractVectorTest { double relativeError) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); } } @@ -202,13 +239,13 @@ relativeError)); FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -224,13 +261,13 @@ relativeError)); FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -242,10 +279,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,10 +294,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -269,12 +306,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -285,20 +322,20 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (double)0); + assertEquals(r[i + k], (double)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (double)0, "at index #" + idx); + assertEquals(r[idx], (double)0, "at index #" + idx); } } } @@ -310,19 +347,19 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (double)0); + assertEquals(r[i + j], (double)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (double)0, "at index #" + idx); + assertEquals(r[idx], (double)0, "at index #" + idx); } } } @@ -338,11 +375,11 @@ relativeError)); wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -351,12 +388,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -366,17 +403,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (double)0); + assertEquals(r[i+j], (double)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -386,17 +423,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (double)0); + assertEquals(r[i+j], (double)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -410,10 +447,10 @@ relativeError)); try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -425,10 +462,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -440,10 +477,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -464,18 +501,18 @@ relativeError)); try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -490,18 +527,18 @@ relativeError)); for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -509,10 +546,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -520,10 +557,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -531,10 +568,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -543,10 +580,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -559,10 +596,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -574,10 +611,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -589,10 +626,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -607,10 +644,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -623,11 +660,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -641,11 +678,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -667,11 +704,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -685,11 +722,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -709,10 +746,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -724,10 +761,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -736,10 +773,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -749,10 +786,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -768,11 +805,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -789,11 +826,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -804,11 +841,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -825,11 +862,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -921,13 +958,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, i, b, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -948,13 +985,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, i, mask, b, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -969,13 +1006,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { double[] ref = f.apply(r, a, i, mask, b, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -996,13 +1033,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, origin, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -1016,13 +1053,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1037,13 +1074,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, mask, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1058,13 +1095,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, part, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1080,13 +1117,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, part, mask, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1132,10 +1169,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1178,10 +1215,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1584,7 +1621,7 @@ relativeError)); // Do some zipping and shuffling. DoubleVector io = (DoubleVector) SPECIES.broadcast(0).addIndex(1); DoubleVector io2 = (DoubleVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); DoubleVector a = io.add((double)1); //[1,2] DoubleVector b = a.neg(); //[-1,-2] double[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1599,19 +1636,19 @@ relativeError)); manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); DoubleVector uab0 = zab0.rearrange(unz0,zab1); DoubleVector uab1 = zab0.rearrange(unz1,zab1); double[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { DoubleVector io = (DoubleVector) SPECIES.broadcast(0).addIndex(1); DoubleVector io2 = (DoubleVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1628,15 +1665,15 @@ relativeError)); Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); VectorSpecies asIntegralSpecies = asIntegral.species(); Assert.assertNotEquals(asIntegralSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asIntegralSpecies.length(), SPECIES.length()); - Assert.assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); + assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asIntegralSpecies.length(), SPECIES.length()); + assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); } @Test void viewAsFloatingLanesTest() { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); - Assert.assertEquals(asFloating.species(), SPECIES); + assertEquals(asFloating.species(), SPECIES); } static double ADD(double a, double b) { @@ -2432,20 +2469,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = ADD_IDENTITY; - Assert.assertEquals((double) (id + id), id, + assertEquals((double) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) (id + x), x); - Assert.assertEquals((double) (x + id), x); + assertEquals((double) (id + x), x); + assertEquals((double) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) (id + x), x, + assertEquals((double) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) (x + id), x, + assertEquals((double) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -2534,20 +2571,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = MUL_IDENTITY; - Assert.assertEquals((double) (id * id), id, + assertEquals((double) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) (id * x), x); - Assert.assertEquals((double) (x * id), x); + assertEquals((double) (id * x), x); + assertEquals((double) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) (id * x), x, + assertEquals((double) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) (x * id), x, + assertEquals((double) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -2636,20 +2673,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = MIN_IDENTITY; - Assert.assertEquals((double) Math.min(id, id), id, + assertEquals((double) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) Math.min(id, x), x); - Assert.assertEquals((double) Math.min(x, id), x); + assertEquals((double) Math.min(id, x), x); + assertEquals((double) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) Math.min(id, x), x, + assertEquals((double) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) Math.min(x, id), x, + assertEquals((double) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -2738,20 +2775,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = MAX_IDENTITY; - Assert.assertEquals((double) Math.max(id, id), id, + assertEquals((double) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) Math.max(id, x), x); - Assert.assertEquals((double) Math.max(x, id), x); + assertEquals((double) Math.max(id, x), x); + assertEquals((double) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) Math.max(id, x), x, + assertEquals((double) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) Math.max(x, id), x, + assertEquals((double) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -2840,20 +2877,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -2933,7 +2970,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -2953,7 +2990,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -2974,7 +3011,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -2994,7 +3031,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -3015,7 +3052,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); } } } @@ -3035,7 +3072,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); } } } @@ -3056,7 +3093,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); } } } @@ -3076,7 +3113,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); } } } @@ -3097,7 +3134,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); } } } @@ -3117,7 +3154,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); } } } @@ -3136,7 +3173,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3155,7 +3192,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3178,7 +3215,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -3197,7 +3234,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -3220,7 +3257,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -3239,7 +3276,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3258,7 +3295,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3281,7 +3318,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -3300,7 +3337,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -3323,7 +3360,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -3342,7 +3379,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -3365,7 +3402,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -3384,7 +3421,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -3407,7 +3444,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -3424,7 +3461,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -3444,7 +3481,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -3460,7 +3497,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (double)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (double)((long)b[i])); } } } @@ -3480,7 +3517,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (double)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (double)((long)b[i]))); } } } @@ -3496,7 +3533,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -3516,7 +3553,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -3532,7 +3569,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (double)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (double)((long)b[i])); } } } @@ -3552,7 +3589,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (double)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (double)((long)b[i]))); } } } @@ -3833,7 +3870,7 @@ relativeError)); } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static double[] sliceUnary(double[] a, int origin, int idx) { @@ -5052,10 +5089,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -5084,7 +5121,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5100,7 +5137,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5330,7 +5367,7 @@ relativeError)); int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -5358,7 +5395,7 @@ relativeError)); var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -5373,7 +5410,7 @@ relativeError)); var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -5476,7 +5513,7 @@ relativeError)); trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -5502,7 +5539,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5516,7 +5553,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5538,7 +5575,7 @@ relativeError)); static void loopBoundDouble512VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -5546,14 +5583,14 @@ relativeError)); long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeDouble512VectorTestsSmokeTest() { DoubleVector av = DoubleVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Double.SIZE); + assertEquals(elsize, Double.SIZE); } @Test @@ -5607,7 +5644,7 @@ relativeError)); @Test static void MaskAllTrueDouble512VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Double64VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Double64VectorLoadStoreTests.java index e2c48d84529..30c4b92aa86 100644 --- a/test/jdk/jdk/incubator/vector/Double64VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Double64VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Double64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 64); + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(double [] actual, double [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double [] actual, double [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(double[] r, double[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Double64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "doubleProviderForIOOBE") @@ -870,11 +885,11 @@ public class Double64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Double64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Double64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(double[] r, double[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Double64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Double64VectorTests.java b/test/jdk/jdk/incubator/vector/Double64VectorTests.java index ab3586fb424..2cc56b1bce3 100644 --- a/test/jdk/jdk/incubator/vector/Double64VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Double64VectorTests.java @@ -61,6 +61,43 @@ public class Double64VectorTests extends AbstractVectorTest { DoubleVector.SPECIES_64; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(double actual, double expected, double delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(double actual, double expected, double delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(double [] actual, double [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double [] actual, double [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + // Identity values for reduction operations private static final double ADD_IDENTITY = (double)0; @@ -95,10 +132,10 @@ public class Double64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -110,13 +147,13 @@ public class Double64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { double[] ref = f.apply(a[i]); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -126,10 +163,10 @@ public class Double64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -151,13 +188,13 @@ public class Double64VectorTests extends AbstractVectorTest { double relativeErrorFactor) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); } } @@ -179,14 +216,14 @@ public class Double64VectorTests extends AbstractVectorTest { double relativeError) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); } } @@ -202,13 +239,13 @@ relativeError)); FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -224,13 +261,13 @@ relativeError)); FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -242,10 +279,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,10 +294,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -269,12 +306,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -285,20 +322,20 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (double)0); + assertEquals(r[i + k], (double)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (double)0, "at index #" + idx); + assertEquals(r[idx], (double)0, "at index #" + idx); } } } @@ -310,19 +347,19 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (double)0); + assertEquals(r[i + j], (double)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (double)0, "at index #" + idx); + assertEquals(r[idx], (double)0, "at index #" + idx); } } } @@ -338,11 +375,11 @@ relativeError)); wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -351,12 +388,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -366,17 +403,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (double)0); + assertEquals(r[i+j], (double)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -386,17 +423,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (double)0); + assertEquals(r[i+j], (double)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -410,10 +447,10 @@ relativeError)); try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -425,10 +462,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -440,10 +477,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -464,18 +501,18 @@ relativeError)); try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -490,18 +527,18 @@ relativeError)); for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -509,10 +546,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -520,10 +557,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -531,10 +568,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -543,10 +580,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -559,10 +596,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -574,10 +611,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -589,10 +626,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -607,10 +644,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -623,11 +660,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -641,11 +678,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -667,11 +704,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -685,11 +722,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -709,10 +746,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -724,10 +761,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -736,10 +773,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -749,10 +786,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -768,11 +805,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -789,11 +826,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -804,11 +841,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -825,11 +862,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -921,13 +958,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, i, b, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -948,13 +985,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, i, mask, b, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -969,13 +1006,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { double[] ref = f.apply(r, a, i, mask, b, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -996,13 +1033,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, origin, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -1016,13 +1053,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1037,13 +1074,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, mask, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1058,13 +1095,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, part, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1080,13 +1117,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, part, mask, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1132,10 +1169,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1178,10 +1215,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1584,7 +1621,7 @@ relativeError)); // Do some zipping and shuffling. DoubleVector io = (DoubleVector) SPECIES.broadcast(0).addIndex(1); DoubleVector io2 = (DoubleVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); DoubleVector a = io.add((double)1); //[1,2] DoubleVector b = a.neg(); //[-1,-2] double[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1599,19 +1636,19 @@ relativeError)); manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); DoubleVector uab0 = zab0.rearrange(unz0,zab1); DoubleVector uab1 = zab0.rearrange(unz1,zab1); double[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { DoubleVector io = (DoubleVector) SPECIES.broadcast(0).addIndex(1); DoubleVector io2 = (DoubleVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1628,15 +1665,15 @@ relativeError)); Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); VectorSpecies asIntegralSpecies = asIntegral.species(); Assert.assertNotEquals(asIntegralSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asIntegralSpecies.length(), SPECIES.length()); - Assert.assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); + assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asIntegralSpecies.length(), SPECIES.length()); + assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); } @Test void viewAsFloatingLanesTest() { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); - Assert.assertEquals(asFloating.species(), SPECIES); + assertEquals(asFloating.species(), SPECIES); } static double ADD(double a, double b) { @@ -2432,20 +2469,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = ADD_IDENTITY; - Assert.assertEquals((double) (id + id), id, + assertEquals((double) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) (id + x), x); - Assert.assertEquals((double) (x + id), x); + assertEquals((double) (id + x), x); + assertEquals((double) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) (id + x), x, + assertEquals((double) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) (x + id), x, + assertEquals((double) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -2534,20 +2571,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = MUL_IDENTITY; - Assert.assertEquals((double) (id * id), id, + assertEquals((double) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) (id * x), x); - Assert.assertEquals((double) (x * id), x); + assertEquals((double) (id * x), x); + assertEquals((double) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) (id * x), x, + assertEquals((double) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) (x * id), x, + assertEquals((double) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -2636,20 +2673,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = MIN_IDENTITY; - Assert.assertEquals((double) Math.min(id, id), id, + assertEquals((double) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) Math.min(id, x), x); - Assert.assertEquals((double) Math.min(x, id), x); + assertEquals((double) Math.min(id, x), x); + assertEquals((double) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) Math.min(id, x), x, + assertEquals((double) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) Math.min(x, id), x, + assertEquals((double) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -2738,20 +2775,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = MAX_IDENTITY; - Assert.assertEquals((double) Math.max(id, id), id, + assertEquals((double) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) Math.max(id, x), x); - Assert.assertEquals((double) Math.max(x, id), x); + assertEquals((double) Math.max(id, x), x); + assertEquals((double) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) Math.max(id, x), x, + assertEquals((double) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) Math.max(x, id), x, + assertEquals((double) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -2840,20 +2877,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -2933,7 +2970,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -2953,7 +2990,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -2974,7 +3011,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -2994,7 +3031,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -3015,7 +3052,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); } } } @@ -3035,7 +3072,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); } } } @@ -3056,7 +3093,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); } } } @@ -3076,7 +3113,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); } } } @@ -3097,7 +3134,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); } } } @@ -3117,7 +3154,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); } } } @@ -3136,7 +3173,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3155,7 +3192,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3178,7 +3215,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -3197,7 +3234,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -3220,7 +3257,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -3239,7 +3276,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3258,7 +3295,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3281,7 +3318,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -3300,7 +3337,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -3323,7 +3360,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -3342,7 +3379,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -3365,7 +3402,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -3384,7 +3421,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -3407,7 +3444,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -3424,7 +3461,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -3444,7 +3481,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -3460,7 +3497,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (double)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (double)((long)b[i])); } } } @@ -3480,7 +3517,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (double)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (double)((long)b[i]))); } } } @@ -3496,7 +3533,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -3516,7 +3553,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -3532,7 +3569,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (double)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (double)((long)b[i])); } } } @@ -3552,7 +3589,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (double)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (double)((long)b[i]))); } } } @@ -3833,7 +3870,7 @@ relativeError)); } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static double[] sliceUnary(double[] a, int origin, int idx) { @@ -5052,10 +5089,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -5084,7 +5121,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5100,7 +5137,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5330,7 +5367,7 @@ relativeError)); int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -5358,7 +5395,7 @@ relativeError)); var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -5373,7 +5410,7 @@ relativeError)); var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -5476,7 +5513,7 @@ relativeError)); trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -5502,7 +5539,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5516,7 +5553,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5538,7 +5575,7 @@ relativeError)); static void loopBoundDouble64VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -5546,14 +5583,14 @@ relativeError)); long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeDouble64VectorTestsSmokeTest() { DoubleVector av = DoubleVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Double.SIZE); + assertEquals(elsize, Double.SIZE); } @Test @@ -5607,7 +5644,7 @@ relativeError)); @Test static void MaskAllTrueDouble64VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/DoubleMaxVectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/DoubleMaxVectorLoadStoreTests.java index f8ea6d7c4a2..7d372239435 100644 --- a/test/jdk/jdk/incubator/vector/DoubleMaxVectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/DoubleMaxVectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -68,14 +68,29 @@ public class DoubleMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / Max); + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(double [] actual, double [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double [] actual, double [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(double[] r, double[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (double) 0, "at index #" + i); } } @@ -329,7 +344,7 @@ public class DoubleMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "doubleProviderForIOOBE") @@ -877,11 +892,11 @@ public class DoubleMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -892,11 +907,11 @@ public class DoubleMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (double) 0, "at index #" + j); } } @@ -912,7 +927,7 @@ public class DoubleMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(double[] r, double[] a, int[] indexMap) { @@ -925,7 +940,7 @@ public class DoubleMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/DoubleMaxVectorTests.java b/test/jdk/jdk/incubator/vector/DoubleMaxVectorTests.java index 8f135cd221a..9130698d5e4 100644 --- a/test/jdk/jdk/incubator/vector/DoubleMaxVectorTests.java +++ b/test/jdk/jdk/incubator/vector/DoubleMaxVectorTests.java @@ -61,6 +61,43 @@ public class DoubleMaxVectorTests extends AbstractVectorTest { DoubleVector.SPECIES_MAX; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(double actual, double expected, double delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(double actual, double expected, double delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(double [] actual, double [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double [] actual, double [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static VectorShape getMaxBit() { return VectorShape.S_Max_BIT; @@ -101,10 +138,10 @@ public class DoubleMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -116,13 +153,13 @@ public class DoubleMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { double[] ref = f.apply(a[i]); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -132,10 +169,10 @@ public class DoubleMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -157,13 +194,13 @@ public class DoubleMaxVectorTests extends AbstractVectorTest { double relativeErrorFactor) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); } } @@ -185,14 +222,14 @@ public class DoubleMaxVectorTests extends AbstractVectorTest { double relativeError) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); } } @@ -208,13 +245,13 @@ relativeError)); FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -230,13 +267,13 @@ relativeError)); FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -248,10 +285,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -263,10 +300,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -275,12 +312,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -291,20 +328,20 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (double)0); + assertEquals(r[i + k], (double)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (double)0, "at index #" + idx); + assertEquals(r[idx], (double)0, "at index #" + idx); } } } @@ -316,19 +353,19 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (double)0); + assertEquals(r[i + j], (double)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (double)0, "at index #" + idx); + assertEquals(r[idx], (double)0, "at index #" + idx); } } } @@ -344,11 +381,11 @@ relativeError)); wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -357,12 +394,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -372,17 +409,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (double)0); + assertEquals(r[i+j], (double)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -392,17 +429,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (double)0); + assertEquals(r[i+j], (double)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (double)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -416,10 +453,10 @@ relativeError)); try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -431,10 +468,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -446,10 +483,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -470,18 +507,18 @@ relativeError)); try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -496,18 +533,18 @@ relativeError)); for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -515,10 +552,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -526,10 +563,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -537,10 +574,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -549,10 +586,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -565,10 +602,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -580,10 +617,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -595,10 +632,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -613,10 +650,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (double)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -629,11 +666,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -647,11 +684,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -673,11 +710,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -691,11 +728,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -715,10 +752,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -730,10 +767,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -742,10 +779,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -755,10 +792,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -774,11 +811,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -795,11 +832,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -810,11 +847,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -831,11 +868,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -927,13 +964,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, i, b, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -954,13 +991,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, i, mask, b, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -975,13 +1012,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { double[] ref = f.apply(r, a, i, mask, b, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -1002,13 +1039,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, origin, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -1022,13 +1059,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1043,13 +1080,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, mask, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1064,13 +1101,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, part, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1086,13 +1123,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { double[] ref = f.apply(a, b, origin, part, mask, i); double[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1138,10 +1175,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1184,10 +1221,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1590,7 +1627,7 @@ relativeError)); // Do some zipping and shuffling. DoubleVector io = (DoubleVector) SPECIES.broadcast(0).addIndex(1); DoubleVector io2 = (DoubleVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); DoubleVector a = io.add((double)1); //[1,2] DoubleVector b = a.neg(); //[-1,-2] double[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1605,19 +1642,19 @@ relativeError)); manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); DoubleVector uab0 = zab0.rearrange(unz0,zab1); DoubleVector uab1 = zab0.rearrange(unz1,zab1); double[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { DoubleVector io = (DoubleVector) SPECIES.broadcast(0).addIndex(1); DoubleVector io2 = (DoubleVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1634,15 +1671,15 @@ relativeError)); Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); VectorSpecies asIntegralSpecies = asIntegral.species(); Assert.assertNotEquals(asIntegralSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asIntegralSpecies.length(), SPECIES.length()); - Assert.assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); + assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asIntegralSpecies.length(), SPECIES.length()); + assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); } @Test void viewAsFloatingLanesTest() { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); - Assert.assertEquals(asFloating.species(), SPECIES); + assertEquals(asFloating.species(), SPECIES); } static double ADD(double a, double b) { @@ -2438,20 +2475,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = ADD_IDENTITY; - Assert.assertEquals((double) (id + id), id, + assertEquals((double) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) (id + x), x); - Assert.assertEquals((double) (x + id), x); + assertEquals((double) (id + x), x); + assertEquals((double) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) (id + x), x, + assertEquals((double) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) (x + id), x, + assertEquals((double) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -2540,20 +2577,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = MUL_IDENTITY; - Assert.assertEquals((double) (id * id), id, + assertEquals((double) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) (id * x), x); - Assert.assertEquals((double) (x * id), x); + assertEquals((double) (id * x), x); + assertEquals((double) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) (id * x), x, + assertEquals((double) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) (x * id), x, + assertEquals((double) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -2642,20 +2679,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = MIN_IDENTITY; - Assert.assertEquals((double) Math.min(id, id), id, + assertEquals((double) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) Math.min(id, x), x); - Assert.assertEquals((double) Math.min(x, id), x); + assertEquals((double) Math.min(id, x), x); + assertEquals((double) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) Math.min(id, x), x, + assertEquals((double) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) Math.min(x, id), x, + assertEquals((double) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -2744,20 +2781,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = MAX_IDENTITY; - Assert.assertEquals((double) Math.max(id, id), id, + assertEquals((double) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((double) Math.max(id, x), x); - Assert.assertEquals((double) Math.max(x, id), x); + assertEquals((double) Math.max(id, x), x); + assertEquals((double) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((double) Math.max(id, x), x, + assertEquals((double) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((double) Math.max(x, id), x, + assertEquals((double) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -2846,20 +2883,20 @@ relativeError)); double[] a = fa.apply(SPECIES.length()); double id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); double x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -2939,7 +2976,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -2959,7 +2996,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -2980,7 +3017,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -3000,7 +3037,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -3021,7 +3058,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); } } } @@ -3041,7 +3078,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); } } } @@ -3062,7 +3099,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); } } } @@ -3082,7 +3119,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); } } } @@ -3103,7 +3140,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); } } } @@ -3123,7 +3160,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); } } } @@ -3142,7 +3179,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3161,7 +3198,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3184,7 +3221,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -3203,7 +3240,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -3226,7 +3263,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -3245,7 +3282,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3264,7 +3301,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3287,7 +3324,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -3306,7 +3343,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -3329,7 +3366,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -3348,7 +3385,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -3371,7 +3408,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -3390,7 +3427,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -3413,7 +3450,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -3430,7 +3467,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -3450,7 +3487,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -3466,7 +3503,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (double)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (double)((long)b[i])); } } } @@ -3486,7 +3523,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (double)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (double)((long)b[i]))); } } } @@ -3502,7 +3539,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -3522,7 +3559,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -3538,7 +3575,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (double)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (double)((long)b[i])); } } } @@ -3558,7 +3595,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (double)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (double)((long)b[i]))); } } } @@ -3839,7 +3876,7 @@ relativeError)); } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static double[] sliceUnary(double[] a, int origin, int idx) { @@ -5058,10 +5095,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -5090,7 +5127,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5106,7 +5143,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5336,7 +5373,7 @@ relativeError)); int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -5364,7 +5401,7 @@ relativeError)); var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -5379,7 +5416,7 @@ relativeError)); var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -5482,7 +5519,7 @@ relativeError)); trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -5508,7 +5545,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5522,7 +5559,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5544,7 +5581,7 @@ relativeError)); static void loopBoundDoubleMaxVectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -5552,14 +5589,14 @@ relativeError)); long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeDoubleMaxVectorTestsSmokeTest() { DoubleVector av = DoubleVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Double.SIZE); + assertEquals(elsize, Double.SIZE); } @Test @@ -5613,7 +5650,7 @@ relativeError)); @Test static void MaskAllTrueDoubleMaxVectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Float128VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Float128VectorLoadStoreTests.java index 4421c355c14..33a02167a90 100644 --- a/test/jdk/jdk/incubator/vector/Float128VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Float128VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Float128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 128); + static void assertEquals(float actual, float expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(float actual, float expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(float [] actual, float [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(float [] actual, float [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(float[] r, float[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Float128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "floatProviderForIOOBE") @@ -870,11 +885,11 @@ public class Float128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Float128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Float128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(float[] r, float[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Float128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Float128VectorTests.java b/test/jdk/jdk/incubator/vector/Float128VectorTests.java index f97c5b0064c..71ca2b3b701 100644 --- a/test/jdk/jdk/incubator/vector/Float128VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Float128VectorTests.java @@ -61,6 +61,49 @@ public class Float128VectorTests extends AbstractVectorTest { FloatVector.SPECIES_128; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(float actual, float expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(float actual, float expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(float actual, float expected, float delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(float actual, float expected, float delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(float [] actual, float [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(float [] actual, float [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + // Identity values for reduction operations private static final float ADD_IDENTITY = (float)0; @@ -95,10 +138,10 @@ public class Float128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -110,13 +153,13 @@ public class Float128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { float[] ref = f.apply(a[i]); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -126,10 +169,10 @@ public class Float128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -151,13 +194,13 @@ public class Float128VectorTests extends AbstractVectorTest { float relativeErrorFactor) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); } } @@ -179,14 +222,14 @@ public class Float128VectorTests extends AbstractVectorTest { float relativeError) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); } } @@ -202,13 +245,13 @@ relativeError)); FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -224,13 +267,13 @@ relativeError)); FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -242,10 +285,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,10 +300,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -269,12 +312,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -285,20 +328,20 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (float)0); + assertEquals(r[i + k], (float)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (float)0, "at index #" + idx); + assertEquals(r[idx], (float)0, "at index #" + idx); } } } @@ -310,19 +353,19 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (float)0); + assertEquals(r[i + j], (float)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (float)0, "at index #" + idx); + assertEquals(r[idx], (float)0, "at index #" + idx); } } } @@ -338,11 +381,11 @@ relativeError)); wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -351,12 +394,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -366,17 +409,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (float)0); + assertEquals(r[i+j], (float)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -386,17 +429,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (float)0); + assertEquals(r[i+j], (float)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -410,10 +453,10 @@ relativeError)); try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -425,10 +468,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -440,10 +483,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -464,18 +507,18 @@ relativeError)); try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -490,18 +533,18 @@ relativeError)); for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -509,10 +552,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -520,10 +563,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -531,10 +574,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -543,10 +586,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -559,10 +602,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -574,10 +617,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -589,10 +632,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -607,10 +650,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -623,11 +666,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -641,11 +684,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -667,11 +710,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -685,11 +728,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -709,10 +752,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -724,10 +767,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -736,10 +779,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -749,10 +792,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -768,11 +811,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -789,11 +832,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -804,11 +847,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -825,11 +868,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -921,13 +964,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, i, b, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -948,13 +991,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, i, mask, b, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -969,13 +1012,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { float[] ref = f.apply(r, a, i, mask, b, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -996,13 +1039,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, origin, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -1016,13 +1059,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1037,13 +1080,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, mask, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1058,13 +1101,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, part, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1080,13 +1123,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, part, mask, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1132,10 +1175,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1178,10 +1221,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1189,10 +1232,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1595,7 +1638,7 @@ relativeError)); // Do some zipping and shuffling. FloatVector io = (FloatVector) SPECIES.broadcast(0).addIndex(1); FloatVector io2 = (FloatVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); FloatVector a = io.add((float)1); //[1,2] FloatVector b = a.neg(); //[-1,-2] float[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1610,19 +1653,19 @@ relativeError)); manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); FloatVector uab0 = zab0.rearrange(unz0,zab1); FloatVector uab1 = zab0.rearrange(unz1,zab1); float[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { FloatVector io = (FloatVector) SPECIES.broadcast(0).addIndex(1); FloatVector io2 = (FloatVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1639,15 +1682,15 @@ relativeError)); Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); VectorSpecies asIntegralSpecies = asIntegral.species(); Assert.assertNotEquals(asIntegralSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asIntegralSpecies.length(), SPECIES.length()); - Assert.assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); + assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asIntegralSpecies.length(), SPECIES.length()); + assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); } @Test void viewAsFloatingLanesTest() { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); - Assert.assertEquals(asFloating.species(), SPECIES); + assertEquals(asFloating.species(), SPECIES); } static float ADD(float a, float b) { @@ -2443,20 +2486,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = ADD_IDENTITY; - Assert.assertEquals((float) (id + id), id, + assertEquals((float) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) (id + x), x); - Assert.assertEquals((float) (x + id), x); + assertEquals((float) (id + x), x); + assertEquals((float) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) (id + x), x, + assertEquals((float) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) (x + id), x, + assertEquals((float) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -2545,20 +2588,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = MUL_IDENTITY; - Assert.assertEquals((float) (id * id), id, + assertEquals((float) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) (id * x), x); - Assert.assertEquals((float) (x * id), x); + assertEquals((float) (id * x), x); + assertEquals((float) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) (id * x), x, + assertEquals((float) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) (x * id), x, + assertEquals((float) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -2647,20 +2690,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = MIN_IDENTITY; - Assert.assertEquals((float) Math.min(id, id), id, + assertEquals((float) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) Math.min(id, x), x); - Assert.assertEquals((float) Math.min(x, id), x); + assertEquals((float) Math.min(id, x), x); + assertEquals((float) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) Math.min(id, x), x, + assertEquals((float) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) Math.min(x, id), x, + assertEquals((float) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -2749,20 +2792,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = MAX_IDENTITY; - Assert.assertEquals((float) Math.max(id, id), id, + assertEquals((float) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) Math.max(id, x), x); - Assert.assertEquals((float) Math.max(x, id), x); + assertEquals((float) Math.max(id, x), x); + assertEquals((float) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) Math.max(id, x), x, + assertEquals((float) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) Math.max(x, id), x, + assertEquals((float) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -2851,20 +2894,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -2944,7 +2987,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -2964,7 +3007,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -2985,7 +3028,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -3005,7 +3048,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -3026,7 +3069,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); } } } @@ -3046,7 +3089,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); } } } @@ -3067,7 +3110,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); } } } @@ -3087,7 +3130,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); } } } @@ -3108,7 +3151,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); } } } @@ -3128,7 +3171,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); } } } @@ -3147,7 +3190,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3166,7 +3209,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3189,7 +3232,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -3208,7 +3251,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -3231,7 +3274,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -3250,7 +3293,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3269,7 +3312,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3292,7 +3335,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -3311,7 +3354,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -3334,7 +3377,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -3353,7 +3396,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -3376,7 +3419,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -3395,7 +3438,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -3418,7 +3461,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -3435,7 +3478,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -3455,7 +3498,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -3471,7 +3514,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (float)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (float)((long)b[i])); } } } @@ -3491,7 +3534,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (float)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (float)((long)b[i]))); } } } @@ -3507,7 +3550,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -3527,7 +3570,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -3543,7 +3586,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (float)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (float)((long)b[i])); } } } @@ -3563,7 +3606,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (float)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (float)((long)b[i]))); } } } @@ -3844,7 +3887,7 @@ relativeError)); } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static float[] sliceUnary(float[] a, int origin, int idx) { @@ -5021,10 +5064,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -5053,7 +5096,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5069,7 +5112,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5309,7 +5352,7 @@ relativeError)); int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -5337,7 +5380,7 @@ relativeError)); var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -5352,7 +5395,7 @@ relativeError)); var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -5455,7 +5498,7 @@ relativeError)); trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -5481,7 +5524,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5495,7 +5538,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5517,7 +5560,7 @@ relativeError)); static void loopBoundFloat128VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -5525,14 +5568,14 @@ relativeError)); long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeFloat128VectorTestsSmokeTest() { FloatVector av = FloatVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Float.SIZE); + assertEquals(elsize, Float.SIZE); } @Test @@ -5586,7 +5629,7 @@ relativeError)); @Test static void MaskAllTrueFloat128VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Float256VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Float256VectorLoadStoreTests.java index 0ad426d9954..0c1d8e9d443 100644 --- a/test/jdk/jdk/incubator/vector/Float256VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Float256VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Float256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 256); + static void assertEquals(float actual, float expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(float actual, float expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(float [] actual, float [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(float [] actual, float [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(float[] r, float[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Float256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "floatProviderForIOOBE") @@ -870,11 +885,11 @@ public class Float256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Float256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Float256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(float[] r, float[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Float256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Float256VectorTests.java b/test/jdk/jdk/incubator/vector/Float256VectorTests.java index d9746d3291c..cc61a5cdc5d 100644 --- a/test/jdk/jdk/incubator/vector/Float256VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Float256VectorTests.java @@ -61,6 +61,49 @@ public class Float256VectorTests extends AbstractVectorTest { FloatVector.SPECIES_256; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(float actual, float expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(float actual, float expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(float actual, float expected, float delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(float actual, float expected, float delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(float [] actual, float [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(float [] actual, float [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + // Identity values for reduction operations private static final float ADD_IDENTITY = (float)0; @@ -95,10 +138,10 @@ public class Float256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -110,13 +153,13 @@ public class Float256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { float[] ref = f.apply(a[i]); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -126,10 +169,10 @@ public class Float256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -151,13 +194,13 @@ public class Float256VectorTests extends AbstractVectorTest { float relativeErrorFactor) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); } } @@ -179,14 +222,14 @@ public class Float256VectorTests extends AbstractVectorTest { float relativeError) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); } } @@ -202,13 +245,13 @@ relativeError)); FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -224,13 +267,13 @@ relativeError)); FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -242,10 +285,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,10 +300,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -269,12 +312,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -285,20 +328,20 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (float)0); + assertEquals(r[i + k], (float)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (float)0, "at index #" + idx); + assertEquals(r[idx], (float)0, "at index #" + idx); } } } @@ -310,19 +353,19 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (float)0); + assertEquals(r[i + j], (float)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (float)0, "at index #" + idx); + assertEquals(r[idx], (float)0, "at index #" + idx); } } } @@ -338,11 +381,11 @@ relativeError)); wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -351,12 +394,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -366,17 +409,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (float)0); + assertEquals(r[i+j], (float)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -386,17 +429,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (float)0); + assertEquals(r[i+j], (float)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -410,10 +453,10 @@ relativeError)); try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -425,10 +468,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -440,10 +483,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -464,18 +507,18 @@ relativeError)); try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -490,18 +533,18 @@ relativeError)); for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -509,10 +552,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -520,10 +563,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -531,10 +574,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -543,10 +586,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -559,10 +602,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -574,10 +617,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -589,10 +632,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -607,10 +650,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -623,11 +666,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -641,11 +684,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -667,11 +710,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -685,11 +728,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -709,10 +752,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -724,10 +767,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -736,10 +779,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -749,10 +792,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -768,11 +811,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -789,11 +832,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -804,11 +847,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -825,11 +868,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -921,13 +964,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, i, b, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -948,13 +991,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, i, mask, b, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -969,13 +1012,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { float[] ref = f.apply(r, a, i, mask, b, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -996,13 +1039,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, origin, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -1016,13 +1059,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1037,13 +1080,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, mask, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1058,13 +1101,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, part, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1080,13 +1123,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, part, mask, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1132,10 +1175,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1178,10 +1221,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1189,10 +1232,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1595,7 +1638,7 @@ relativeError)); // Do some zipping and shuffling. FloatVector io = (FloatVector) SPECIES.broadcast(0).addIndex(1); FloatVector io2 = (FloatVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); FloatVector a = io.add((float)1); //[1,2] FloatVector b = a.neg(); //[-1,-2] float[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1610,19 +1653,19 @@ relativeError)); manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); FloatVector uab0 = zab0.rearrange(unz0,zab1); FloatVector uab1 = zab0.rearrange(unz1,zab1); float[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { FloatVector io = (FloatVector) SPECIES.broadcast(0).addIndex(1); FloatVector io2 = (FloatVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1639,15 +1682,15 @@ relativeError)); Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); VectorSpecies asIntegralSpecies = asIntegral.species(); Assert.assertNotEquals(asIntegralSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asIntegralSpecies.length(), SPECIES.length()); - Assert.assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); + assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asIntegralSpecies.length(), SPECIES.length()); + assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); } @Test void viewAsFloatingLanesTest() { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); - Assert.assertEquals(asFloating.species(), SPECIES); + assertEquals(asFloating.species(), SPECIES); } static float ADD(float a, float b) { @@ -2443,20 +2486,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = ADD_IDENTITY; - Assert.assertEquals((float) (id + id), id, + assertEquals((float) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) (id + x), x); - Assert.assertEquals((float) (x + id), x); + assertEquals((float) (id + x), x); + assertEquals((float) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) (id + x), x, + assertEquals((float) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) (x + id), x, + assertEquals((float) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -2545,20 +2588,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = MUL_IDENTITY; - Assert.assertEquals((float) (id * id), id, + assertEquals((float) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) (id * x), x); - Assert.assertEquals((float) (x * id), x); + assertEquals((float) (id * x), x); + assertEquals((float) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) (id * x), x, + assertEquals((float) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) (x * id), x, + assertEquals((float) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -2647,20 +2690,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = MIN_IDENTITY; - Assert.assertEquals((float) Math.min(id, id), id, + assertEquals((float) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) Math.min(id, x), x); - Assert.assertEquals((float) Math.min(x, id), x); + assertEquals((float) Math.min(id, x), x); + assertEquals((float) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) Math.min(id, x), x, + assertEquals((float) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) Math.min(x, id), x, + assertEquals((float) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -2749,20 +2792,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = MAX_IDENTITY; - Assert.assertEquals((float) Math.max(id, id), id, + assertEquals((float) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) Math.max(id, x), x); - Assert.assertEquals((float) Math.max(x, id), x); + assertEquals((float) Math.max(id, x), x); + assertEquals((float) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) Math.max(id, x), x, + assertEquals((float) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) Math.max(x, id), x, + assertEquals((float) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -2851,20 +2894,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -2944,7 +2987,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -2964,7 +3007,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -2985,7 +3028,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -3005,7 +3048,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -3026,7 +3069,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); } } } @@ -3046,7 +3089,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); } } } @@ -3067,7 +3110,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); } } } @@ -3087,7 +3130,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); } } } @@ -3108,7 +3151,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); } } } @@ -3128,7 +3171,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); } } } @@ -3147,7 +3190,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3166,7 +3209,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3189,7 +3232,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -3208,7 +3251,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -3231,7 +3274,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -3250,7 +3293,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3269,7 +3312,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3292,7 +3335,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -3311,7 +3354,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -3334,7 +3377,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -3353,7 +3396,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -3376,7 +3419,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -3395,7 +3438,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -3418,7 +3461,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -3435,7 +3478,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -3455,7 +3498,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -3471,7 +3514,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (float)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (float)((long)b[i])); } } } @@ -3491,7 +3534,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (float)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (float)((long)b[i]))); } } } @@ -3507,7 +3550,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -3527,7 +3570,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -3543,7 +3586,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (float)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (float)((long)b[i])); } } } @@ -3563,7 +3606,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (float)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (float)((long)b[i]))); } } } @@ -3844,7 +3887,7 @@ relativeError)); } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static float[] sliceUnary(float[] a, int origin, int idx) { @@ -5021,10 +5064,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -5053,7 +5096,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5069,7 +5112,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5309,7 +5352,7 @@ relativeError)); int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -5337,7 +5380,7 @@ relativeError)); var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -5352,7 +5395,7 @@ relativeError)); var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -5455,7 +5498,7 @@ relativeError)); trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -5481,7 +5524,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5495,7 +5538,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5517,7 +5560,7 @@ relativeError)); static void loopBoundFloat256VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -5525,14 +5568,14 @@ relativeError)); long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeFloat256VectorTestsSmokeTest() { FloatVector av = FloatVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Float.SIZE); + assertEquals(elsize, Float.SIZE); } @Test @@ -5586,7 +5629,7 @@ relativeError)); @Test static void MaskAllTrueFloat256VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Float512VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Float512VectorLoadStoreTests.java index 56da27f1149..b3fe49e2121 100644 --- a/test/jdk/jdk/incubator/vector/Float512VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Float512VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Float512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 512); + static void assertEquals(float actual, float expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(float actual, float expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(float [] actual, float [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(float [] actual, float [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(float[] r, float[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Float512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "floatProviderForIOOBE") @@ -870,11 +885,11 @@ public class Float512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Float512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Float512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(float[] r, float[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Float512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Float512VectorTests.java b/test/jdk/jdk/incubator/vector/Float512VectorTests.java index ca395221c6b..830001ac268 100644 --- a/test/jdk/jdk/incubator/vector/Float512VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Float512VectorTests.java @@ -61,6 +61,49 @@ public class Float512VectorTests extends AbstractVectorTest { FloatVector.SPECIES_512; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(float actual, float expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(float actual, float expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(float actual, float expected, float delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(float actual, float expected, float delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(float [] actual, float [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(float [] actual, float [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + // Identity values for reduction operations private static final float ADD_IDENTITY = (float)0; @@ -95,10 +138,10 @@ public class Float512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -110,13 +153,13 @@ public class Float512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { float[] ref = f.apply(a[i]); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -126,10 +169,10 @@ public class Float512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -151,13 +194,13 @@ public class Float512VectorTests extends AbstractVectorTest { float relativeErrorFactor) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); } } @@ -179,14 +222,14 @@ public class Float512VectorTests extends AbstractVectorTest { float relativeError) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); } } @@ -202,13 +245,13 @@ relativeError)); FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -224,13 +267,13 @@ relativeError)); FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -242,10 +285,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,10 +300,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -269,12 +312,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -285,20 +328,20 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (float)0); + assertEquals(r[i + k], (float)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (float)0, "at index #" + idx); + assertEquals(r[idx], (float)0, "at index #" + idx); } } } @@ -310,19 +353,19 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (float)0); + assertEquals(r[i + j], (float)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (float)0, "at index #" + idx); + assertEquals(r[idx], (float)0, "at index #" + idx); } } } @@ -338,11 +381,11 @@ relativeError)); wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -351,12 +394,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -366,17 +409,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (float)0); + assertEquals(r[i+j], (float)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -386,17 +429,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (float)0); + assertEquals(r[i+j], (float)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -410,10 +453,10 @@ relativeError)); try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -425,10 +468,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -440,10 +483,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -464,18 +507,18 @@ relativeError)); try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -490,18 +533,18 @@ relativeError)); for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -509,10 +552,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -520,10 +563,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -531,10 +574,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -543,10 +586,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -559,10 +602,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -574,10 +617,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -589,10 +632,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -607,10 +650,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -623,11 +666,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -641,11 +684,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -667,11 +710,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -685,11 +728,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -709,10 +752,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -724,10 +767,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -736,10 +779,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -749,10 +792,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -768,11 +811,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -789,11 +832,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -804,11 +847,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -825,11 +868,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -921,13 +964,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, i, b, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -948,13 +991,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, i, mask, b, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -969,13 +1012,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { float[] ref = f.apply(r, a, i, mask, b, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -996,13 +1039,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, origin, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -1016,13 +1059,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1037,13 +1080,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, mask, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1058,13 +1101,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, part, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1080,13 +1123,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, part, mask, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1132,10 +1175,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1178,10 +1221,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1189,10 +1232,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1595,7 +1638,7 @@ relativeError)); // Do some zipping and shuffling. FloatVector io = (FloatVector) SPECIES.broadcast(0).addIndex(1); FloatVector io2 = (FloatVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); FloatVector a = io.add((float)1); //[1,2] FloatVector b = a.neg(); //[-1,-2] float[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1610,19 +1653,19 @@ relativeError)); manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); FloatVector uab0 = zab0.rearrange(unz0,zab1); FloatVector uab1 = zab0.rearrange(unz1,zab1); float[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { FloatVector io = (FloatVector) SPECIES.broadcast(0).addIndex(1); FloatVector io2 = (FloatVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1639,15 +1682,15 @@ relativeError)); Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); VectorSpecies asIntegralSpecies = asIntegral.species(); Assert.assertNotEquals(asIntegralSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asIntegralSpecies.length(), SPECIES.length()); - Assert.assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); + assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asIntegralSpecies.length(), SPECIES.length()); + assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); } @Test void viewAsFloatingLanesTest() { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); - Assert.assertEquals(asFloating.species(), SPECIES); + assertEquals(asFloating.species(), SPECIES); } static float ADD(float a, float b) { @@ -2443,20 +2486,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = ADD_IDENTITY; - Assert.assertEquals((float) (id + id), id, + assertEquals((float) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) (id + x), x); - Assert.assertEquals((float) (x + id), x); + assertEquals((float) (id + x), x); + assertEquals((float) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) (id + x), x, + assertEquals((float) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) (x + id), x, + assertEquals((float) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -2545,20 +2588,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = MUL_IDENTITY; - Assert.assertEquals((float) (id * id), id, + assertEquals((float) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) (id * x), x); - Assert.assertEquals((float) (x * id), x); + assertEquals((float) (id * x), x); + assertEquals((float) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) (id * x), x, + assertEquals((float) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) (x * id), x, + assertEquals((float) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -2647,20 +2690,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = MIN_IDENTITY; - Assert.assertEquals((float) Math.min(id, id), id, + assertEquals((float) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) Math.min(id, x), x); - Assert.assertEquals((float) Math.min(x, id), x); + assertEquals((float) Math.min(id, x), x); + assertEquals((float) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) Math.min(id, x), x, + assertEquals((float) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) Math.min(x, id), x, + assertEquals((float) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -2749,20 +2792,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = MAX_IDENTITY; - Assert.assertEquals((float) Math.max(id, id), id, + assertEquals((float) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) Math.max(id, x), x); - Assert.assertEquals((float) Math.max(x, id), x); + assertEquals((float) Math.max(id, x), x); + assertEquals((float) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) Math.max(id, x), x, + assertEquals((float) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) Math.max(x, id), x, + assertEquals((float) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -2851,20 +2894,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -2944,7 +2987,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -2964,7 +3007,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -2985,7 +3028,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -3005,7 +3048,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -3026,7 +3069,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); } } } @@ -3046,7 +3089,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); } } } @@ -3067,7 +3110,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); } } } @@ -3087,7 +3130,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); } } } @@ -3108,7 +3151,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); } } } @@ -3128,7 +3171,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); } } } @@ -3147,7 +3190,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3166,7 +3209,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3189,7 +3232,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -3208,7 +3251,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -3231,7 +3274,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -3250,7 +3293,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3269,7 +3312,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3292,7 +3335,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -3311,7 +3354,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -3334,7 +3377,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -3353,7 +3396,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -3376,7 +3419,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -3395,7 +3438,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -3418,7 +3461,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -3435,7 +3478,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -3455,7 +3498,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -3471,7 +3514,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (float)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (float)((long)b[i])); } } } @@ -3491,7 +3534,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (float)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (float)((long)b[i]))); } } } @@ -3507,7 +3550,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -3527,7 +3570,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -3543,7 +3586,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (float)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (float)((long)b[i])); } } } @@ -3563,7 +3606,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (float)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (float)((long)b[i]))); } } } @@ -3844,7 +3887,7 @@ relativeError)); } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static float[] sliceUnary(float[] a, int origin, int idx) { @@ -5021,10 +5064,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -5053,7 +5096,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5069,7 +5112,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5309,7 +5352,7 @@ relativeError)); int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -5337,7 +5380,7 @@ relativeError)); var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -5352,7 +5395,7 @@ relativeError)); var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -5455,7 +5498,7 @@ relativeError)); trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -5481,7 +5524,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5495,7 +5538,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5517,7 +5560,7 @@ relativeError)); static void loopBoundFloat512VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -5525,14 +5568,14 @@ relativeError)); long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeFloat512VectorTestsSmokeTest() { FloatVector av = FloatVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Float.SIZE); + assertEquals(elsize, Float.SIZE); } @Test @@ -5586,7 +5629,7 @@ relativeError)); @Test static void MaskAllTrueFloat512VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Float64VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Float64VectorLoadStoreTests.java index b3ee68a4aca..afa08dc8f33 100644 --- a/test/jdk/jdk/incubator/vector/Float64VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Float64VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Float64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 64); + static void assertEquals(float actual, float expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(float actual, float expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(float [] actual, float [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(float [] actual, float [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(float[] r, float[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Float64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "floatProviderForIOOBE") @@ -870,11 +885,11 @@ public class Float64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Float64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Float64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(float[] r, float[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Float64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Float64VectorTests.java b/test/jdk/jdk/incubator/vector/Float64VectorTests.java index 1b14cdb7791..4a8f917b50e 100644 --- a/test/jdk/jdk/incubator/vector/Float64VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Float64VectorTests.java @@ -61,6 +61,49 @@ public class Float64VectorTests extends AbstractVectorTest { FloatVector.SPECIES_64; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(float actual, float expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(float actual, float expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(float actual, float expected, float delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(float actual, float expected, float delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(float [] actual, float [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(float [] actual, float [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + // Identity values for reduction operations private static final float ADD_IDENTITY = (float)0; @@ -95,10 +138,10 @@ public class Float64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -110,13 +153,13 @@ public class Float64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { float[] ref = f.apply(a[i]); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -126,10 +169,10 @@ public class Float64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -151,13 +194,13 @@ public class Float64VectorTests extends AbstractVectorTest { float relativeErrorFactor) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); } } @@ -179,14 +222,14 @@ public class Float64VectorTests extends AbstractVectorTest { float relativeError) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); } } @@ -202,13 +245,13 @@ relativeError)); FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -224,13 +267,13 @@ relativeError)); FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -242,10 +285,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,10 +300,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -269,12 +312,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -285,20 +328,20 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (float)0); + assertEquals(r[i + k], (float)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (float)0, "at index #" + idx); + assertEquals(r[idx], (float)0, "at index #" + idx); } } } @@ -310,19 +353,19 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (float)0); + assertEquals(r[i + j], (float)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (float)0, "at index #" + idx); + assertEquals(r[idx], (float)0, "at index #" + idx); } } } @@ -338,11 +381,11 @@ relativeError)); wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -351,12 +394,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -366,17 +409,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (float)0); + assertEquals(r[i+j], (float)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -386,17 +429,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (float)0); + assertEquals(r[i+j], (float)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -410,10 +453,10 @@ relativeError)); try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -425,10 +468,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -440,10 +483,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -464,18 +507,18 @@ relativeError)); try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -490,18 +533,18 @@ relativeError)); for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -509,10 +552,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -520,10 +563,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -531,10 +574,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -543,10 +586,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -559,10 +602,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -574,10 +617,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -589,10 +632,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -607,10 +650,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -623,11 +666,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -641,11 +684,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -667,11 +710,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -685,11 +728,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -709,10 +752,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -724,10 +767,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -736,10 +779,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -749,10 +792,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -768,11 +811,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -789,11 +832,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -804,11 +847,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -825,11 +868,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -921,13 +964,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, i, b, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -948,13 +991,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, i, mask, b, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -969,13 +1012,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { float[] ref = f.apply(r, a, i, mask, b, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -996,13 +1039,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, origin, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -1016,13 +1059,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1037,13 +1080,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, mask, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1058,13 +1101,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, part, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1080,13 +1123,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, part, mask, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1132,10 +1175,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1178,10 +1221,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1189,10 +1232,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1595,7 +1638,7 @@ relativeError)); // Do some zipping and shuffling. FloatVector io = (FloatVector) SPECIES.broadcast(0).addIndex(1); FloatVector io2 = (FloatVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); FloatVector a = io.add((float)1); //[1,2] FloatVector b = a.neg(); //[-1,-2] float[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1610,19 +1653,19 @@ relativeError)); manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); FloatVector uab0 = zab0.rearrange(unz0,zab1); FloatVector uab1 = zab0.rearrange(unz1,zab1); float[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { FloatVector io = (FloatVector) SPECIES.broadcast(0).addIndex(1); FloatVector io2 = (FloatVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1639,15 +1682,15 @@ relativeError)); Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); VectorSpecies asIntegralSpecies = asIntegral.species(); Assert.assertNotEquals(asIntegralSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asIntegralSpecies.length(), SPECIES.length()); - Assert.assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); + assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asIntegralSpecies.length(), SPECIES.length()); + assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); } @Test void viewAsFloatingLanesTest() { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); - Assert.assertEquals(asFloating.species(), SPECIES); + assertEquals(asFloating.species(), SPECIES); } static float ADD(float a, float b) { @@ -2443,20 +2486,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = ADD_IDENTITY; - Assert.assertEquals((float) (id + id), id, + assertEquals((float) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) (id + x), x); - Assert.assertEquals((float) (x + id), x); + assertEquals((float) (id + x), x); + assertEquals((float) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) (id + x), x, + assertEquals((float) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) (x + id), x, + assertEquals((float) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -2545,20 +2588,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = MUL_IDENTITY; - Assert.assertEquals((float) (id * id), id, + assertEquals((float) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) (id * x), x); - Assert.assertEquals((float) (x * id), x); + assertEquals((float) (id * x), x); + assertEquals((float) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) (id * x), x, + assertEquals((float) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) (x * id), x, + assertEquals((float) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -2647,20 +2690,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = MIN_IDENTITY; - Assert.assertEquals((float) Math.min(id, id), id, + assertEquals((float) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) Math.min(id, x), x); - Assert.assertEquals((float) Math.min(x, id), x); + assertEquals((float) Math.min(id, x), x); + assertEquals((float) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) Math.min(id, x), x, + assertEquals((float) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) Math.min(x, id), x, + assertEquals((float) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -2749,20 +2792,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = MAX_IDENTITY; - Assert.assertEquals((float) Math.max(id, id), id, + assertEquals((float) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) Math.max(id, x), x); - Assert.assertEquals((float) Math.max(x, id), x); + assertEquals((float) Math.max(id, x), x); + assertEquals((float) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) Math.max(id, x), x, + assertEquals((float) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) Math.max(x, id), x, + assertEquals((float) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -2851,20 +2894,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -2944,7 +2987,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -2964,7 +3007,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -2985,7 +3028,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -3005,7 +3048,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -3026,7 +3069,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); } } } @@ -3046,7 +3089,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); } } } @@ -3067,7 +3110,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); } } } @@ -3087,7 +3130,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); } } } @@ -3108,7 +3151,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); } } } @@ -3128,7 +3171,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); } } } @@ -3147,7 +3190,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3166,7 +3209,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3189,7 +3232,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -3208,7 +3251,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -3231,7 +3274,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -3250,7 +3293,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3269,7 +3312,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3292,7 +3335,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -3311,7 +3354,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -3334,7 +3377,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -3353,7 +3396,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -3376,7 +3419,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -3395,7 +3438,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -3418,7 +3461,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -3435,7 +3478,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -3455,7 +3498,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -3471,7 +3514,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (float)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (float)((long)b[i])); } } } @@ -3491,7 +3534,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (float)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (float)((long)b[i]))); } } } @@ -3507,7 +3550,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -3527,7 +3570,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -3543,7 +3586,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (float)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (float)((long)b[i])); } } } @@ -3563,7 +3606,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (float)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (float)((long)b[i]))); } } } @@ -3844,7 +3887,7 @@ relativeError)); } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static float[] sliceUnary(float[] a, int origin, int idx) { @@ -5021,10 +5064,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -5053,7 +5096,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5069,7 +5112,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5309,7 +5352,7 @@ relativeError)); int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -5337,7 +5380,7 @@ relativeError)); var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -5352,7 +5395,7 @@ relativeError)); var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -5455,7 +5498,7 @@ relativeError)); trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -5481,7 +5524,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5495,7 +5538,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5517,7 +5560,7 @@ relativeError)); static void loopBoundFloat64VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -5525,14 +5568,14 @@ relativeError)); long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeFloat64VectorTestsSmokeTest() { FloatVector av = FloatVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Float.SIZE); + assertEquals(elsize, Float.SIZE); } @Test @@ -5586,7 +5629,7 @@ relativeError)); @Test static void MaskAllTrueFloat64VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/FloatMaxVectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/FloatMaxVectorLoadStoreTests.java index 5c86ab350d2..931e9b78306 100644 --- a/test/jdk/jdk/incubator/vector/FloatMaxVectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/FloatMaxVectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -68,14 +68,29 @@ public class FloatMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / Max); + static void assertEquals(float actual, float expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(float actual, float expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(float [] actual, float [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(float [] actual, float [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(float[] r, float[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (float) 0, "at index #" + i); } } @@ -329,7 +344,7 @@ public class FloatMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "floatProviderForIOOBE") @@ -877,11 +892,11 @@ public class FloatMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -892,11 +907,11 @@ public class FloatMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (float) 0, "at index #" + j); } } @@ -912,7 +927,7 @@ public class FloatMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(float[] r, float[] a, int[] indexMap) { @@ -925,7 +940,7 @@ public class FloatMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/FloatMaxVectorTests.java b/test/jdk/jdk/incubator/vector/FloatMaxVectorTests.java index 53edb408035..6ea96388706 100644 --- a/test/jdk/jdk/incubator/vector/FloatMaxVectorTests.java +++ b/test/jdk/jdk/incubator/vector/FloatMaxVectorTests.java @@ -61,6 +61,49 @@ public class FloatMaxVectorTests extends AbstractVectorTest { FloatVector.SPECIES_MAX; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(float actual, float expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(float actual, float expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(float actual, float expected, float delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(float actual, float expected, float delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(float [] actual, float [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(float [] actual, float [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static VectorShape getMaxBit() { return VectorShape.S_Max_BIT; @@ -101,10 +144,10 @@ public class FloatMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -116,13 +159,13 @@ public class FloatMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { float[] ref = f.apply(a[i]); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -132,10 +175,10 @@ public class FloatMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -157,13 +200,13 @@ public class FloatMaxVectorTests extends AbstractVectorTest { float relativeErrorFactor) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); } } @@ -185,14 +228,14 @@ public class FloatMaxVectorTests extends AbstractVectorTest { float relativeError) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); } } @@ -208,13 +251,13 @@ relativeError)); FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -230,13 +273,13 @@ relativeError)); FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -248,10 +291,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -263,10 +306,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -275,12 +318,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -291,20 +334,20 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (float)0); + assertEquals(r[i + k], (float)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (float)0, "at index #" + idx); + assertEquals(r[idx], (float)0, "at index #" + idx); } } } @@ -316,19 +359,19 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (float)0); + assertEquals(r[i + j], (float)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (float)0, "at index #" + idx); + assertEquals(r[idx], (float)0, "at index #" + idx); } } } @@ -344,11 +387,11 @@ relativeError)); wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -357,12 +400,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -372,17 +415,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (float)0); + assertEquals(r[i+j], (float)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -392,17 +435,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (float)0); + assertEquals(r[i+j], (float)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (float)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -416,10 +459,10 @@ relativeError)); try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -431,10 +474,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -446,10 +489,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -470,18 +513,18 @@ relativeError)); try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -496,18 +539,18 @@ relativeError)); for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -515,10 +558,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -526,10 +569,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -537,10 +580,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -549,10 +592,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -565,10 +608,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -580,10 +623,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -595,10 +638,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -613,10 +656,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (float)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -629,11 +672,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -647,11 +690,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -673,11 +716,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -691,11 +734,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -715,10 +758,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -730,10 +773,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -742,10 +785,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -755,10 +798,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -774,11 +817,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -795,11 +838,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -810,11 +853,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -831,11 +874,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -927,13 +970,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, i, b, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -954,13 +997,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, i, mask, b, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -975,13 +1018,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { float[] ref = f.apply(r, a, i, mask, b, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -1002,13 +1045,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, origin, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -1022,13 +1065,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1043,13 +1086,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, mask, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1064,13 +1107,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, part, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1086,13 +1129,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { float[] ref = f.apply(a, b, origin, part, mask, i); float[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1138,10 +1181,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1184,10 +1227,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1195,10 +1238,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1601,7 +1644,7 @@ relativeError)); // Do some zipping and shuffling. FloatVector io = (FloatVector) SPECIES.broadcast(0).addIndex(1); FloatVector io2 = (FloatVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); FloatVector a = io.add((float)1); //[1,2] FloatVector b = a.neg(); //[-1,-2] float[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1616,19 +1659,19 @@ relativeError)); manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); FloatVector uab0 = zab0.rearrange(unz0,zab1); FloatVector uab1 = zab0.rearrange(unz1,zab1); float[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { FloatVector io = (FloatVector) SPECIES.broadcast(0).addIndex(1); FloatVector io2 = (FloatVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1645,15 +1688,15 @@ relativeError)); Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); VectorSpecies asIntegralSpecies = asIntegral.species(); Assert.assertNotEquals(asIntegralSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asIntegralSpecies.length(), SPECIES.length()); - Assert.assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); + assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asIntegralSpecies.length(), SPECIES.length()); + assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); } @Test void viewAsFloatingLanesTest() { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); - Assert.assertEquals(asFloating.species(), SPECIES); + assertEquals(asFloating.species(), SPECIES); } static float ADD(float a, float b) { @@ -2449,20 +2492,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = ADD_IDENTITY; - Assert.assertEquals((float) (id + id), id, + assertEquals((float) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) (id + x), x); - Assert.assertEquals((float) (x + id), x); + assertEquals((float) (id + x), x); + assertEquals((float) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) (id + x), x, + assertEquals((float) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) (x + id), x, + assertEquals((float) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -2551,20 +2594,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = MUL_IDENTITY; - Assert.assertEquals((float) (id * id), id, + assertEquals((float) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) (id * x), x); - Assert.assertEquals((float) (x * id), x); + assertEquals((float) (id * x), x); + assertEquals((float) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) (id * x), x, + assertEquals((float) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) (x * id), x, + assertEquals((float) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -2653,20 +2696,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = MIN_IDENTITY; - Assert.assertEquals((float) Math.min(id, id), id, + assertEquals((float) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) Math.min(id, x), x); - Assert.assertEquals((float) Math.min(x, id), x); + assertEquals((float) Math.min(id, x), x); + assertEquals((float) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) Math.min(id, x), x, + assertEquals((float) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) Math.min(x, id), x, + assertEquals((float) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -2755,20 +2798,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = MAX_IDENTITY; - Assert.assertEquals((float) Math.max(id, id), id, + assertEquals((float) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((float) Math.max(id, x), x); - Assert.assertEquals((float) Math.max(x, id), x); + assertEquals((float) Math.max(id, x), x); + assertEquals((float) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((float) Math.max(id, x), x, + assertEquals((float) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((float) Math.max(x, id), x, + assertEquals((float) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -2857,20 +2900,20 @@ relativeError)); float[] a = fa.apply(SPECIES.length()); float id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); float x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -2950,7 +2993,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -2970,7 +3013,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -2991,7 +3034,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -3011,7 +3054,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -3032,7 +3075,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_FINITE(a[i + j])); } } } @@ -3052,7 +3095,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_FINITE(a[i + j])); } } } @@ -3073,7 +3116,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NAN(a[i + j])); } } } @@ -3093,7 +3136,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NAN(a[i + j])); } } } @@ -3114,7 +3157,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_INFINITE(a[i + j])); } } } @@ -3134,7 +3177,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_INFINITE(a[i + j])); } } } @@ -3153,7 +3196,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3172,7 +3215,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -3195,7 +3238,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -3214,7 +3257,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -3237,7 +3280,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -3256,7 +3299,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3275,7 +3318,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -3298,7 +3341,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -3317,7 +3360,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -3340,7 +3383,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -3359,7 +3402,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -3382,7 +3425,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -3401,7 +3444,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -3424,7 +3467,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -3441,7 +3484,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -3461,7 +3504,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -3477,7 +3520,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (float)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (float)((long)b[i])); } } } @@ -3497,7 +3540,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (float)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (float)((long)b[i]))); } } } @@ -3513,7 +3556,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -3533,7 +3576,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -3549,7 +3592,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (float)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (float)((long)b[i])); } } } @@ -3569,7 +3612,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (float)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (float)((long)b[i]))); } } } @@ -3850,7 +3893,7 @@ relativeError)); } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static float[] sliceUnary(float[] a, int origin, int idx) { @@ -5027,10 +5070,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -5059,7 +5102,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5075,7 +5118,7 @@ relativeError)); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5315,7 +5358,7 @@ relativeError)); int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -5343,7 +5386,7 @@ relativeError)); var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -5358,7 +5401,7 @@ relativeError)); var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -5461,7 +5504,7 @@ relativeError)); trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -5487,7 +5530,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5501,7 +5544,7 @@ relativeError)); assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -5523,7 +5566,7 @@ relativeError)); static void loopBoundFloatMaxVectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -5531,14 +5574,14 @@ relativeError)); long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeFloatMaxVectorTestsSmokeTest() { FloatVector av = FloatVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Float.SIZE); + assertEquals(elsize, Float.SIZE); } @Test @@ -5592,7 +5635,7 @@ relativeError)); @Test static void MaskAllTrueFloatMaxVectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Int128VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Int128VectorLoadStoreTests.java index f2448365138..f6e640e9615 100644 --- a/test/jdk/jdk/incubator/vector/Int128VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Int128VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Int128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 128); + static void assertEquals(int actual, int expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(int actual, int expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(int [] actual, int [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(int [] actual, int [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(int[] r, int[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Int128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "intProviderForIOOBE") @@ -870,11 +885,11 @@ public class Int128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Int128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Int128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(int[] r, int[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Int128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Int128VectorTests.java b/test/jdk/jdk/incubator/vector/Int128VectorTests.java index 69bb0c84588..1f254abbf0c 100644 --- a/test/jdk/jdk/incubator/vector/Int128VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Int128VectorTests.java @@ -62,6 +62,49 @@ public class Int128VectorTests extends AbstractVectorTest { IntVector.SPECIES_128; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(int actual, int expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(int actual, int expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(int actual, int expected, int delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(int actual, int expected, int delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(int [] actual, int [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(int [] actual, int [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final int CONST_SHIFT = Integer.SIZE / 2; @@ -96,10 +139,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +154,13 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { int[] ref = f.apply(a[i]); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +170,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +189,13 @@ public class Int128VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +211,13 @@ public class Int128VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -190,13 +233,13 @@ public class Int128VectorTests extends AbstractVectorTest { FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -212,13 +255,13 @@ public class Int128VectorTests extends AbstractVectorTest { FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -230,10 +273,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -245,10 +288,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,12 +300,12 @@ public class Int128VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -273,20 +316,20 @@ public class Int128VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (int)0); + assertEquals(r[i + k], (int)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (int)0, "at index #" + idx); + assertEquals(r[idx], (int)0, "at index #" + idx); } } } @@ -298,19 +341,19 @@ public class Int128VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (int)0); + assertEquals(r[i + j], (int)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (int)0, "at index #" + idx); + assertEquals(r[idx], (int)0, "at index #" + idx); } } } @@ -326,11 +369,11 @@ public class Int128VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -339,12 +382,12 @@ public class Int128VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -354,17 +397,17 @@ public class Int128VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (int)0); + assertEquals(r[i+j], (int)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -374,17 +417,17 @@ public class Int128VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (int)0); + assertEquals(r[i+j], (int)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -398,10 +441,10 @@ public class Int128VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -413,10 +456,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -428,10 +471,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -452,18 +495,18 @@ public class Int128VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -478,18 +521,18 @@ public class Int128VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -497,10 +540,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -508,10 +551,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -519,10 +562,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -531,10 +574,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -547,10 +590,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -562,10 +605,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -577,10 +620,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -595,10 +638,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -611,11 +654,11 @@ public class Int128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -629,11 +672,11 @@ public class Int128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -655,11 +698,11 @@ public class Int128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -673,11 +716,11 @@ public class Int128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -697,10 +740,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -712,10 +755,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -724,10 +767,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -737,10 +780,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -756,11 +799,11 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -777,11 +820,11 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -792,11 +835,11 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -813,11 +856,11 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -835,13 +878,13 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, i, b, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -862,13 +905,13 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, i, mask, b, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -883,13 +926,13 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { int[] ref = f.apply(r, a, i, mask, b, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -910,13 +953,13 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, origin, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -930,13 +973,13 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -951,13 +994,13 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, mask, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -972,13 +1015,13 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, part, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -994,13 +1037,13 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, part, mask, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1013,10 +1056,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1026,10 +1069,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1037,10 +1080,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1543,7 +1586,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. IntVector io = (IntVector) SPECIES.broadcast(0).addIndex(1); IntVector io2 = (IntVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); IntVector a = io.add((int)1); //[1,2] IntVector b = a.neg(); //[-1,-2] int[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1558,19 +1601,19 @@ public class Int128VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); IntVector uab0 = zab0.rearrange(unz0,zab1); IntVector uab1 = zab0.rearrange(unz1,zab1); int[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { IntVector io = (IntVector) SPECIES.broadcast(0).addIndex(1); IntVector io2 = (IntVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1585,7 +1628,7 @@ public class Int128VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test @@ -1593,9 +1636,9 @@ public class Int128VectorTests extends AbstractVectorTest { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); VectorSpecies asFloatingSpecies = asFloating.species(); Assert.assertNotEquals(asFloatingSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asFloatingSpecies.length(), SPECIES.length()); - Assert.assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); + assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asFloatingSpecies.length(), SPECIES.length()); + assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); } @Test @@ -3709,20 +3752,20 @@ public class Int128VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = AND_IDENTITY; - Assert.assertEquals((int) (id & id), id, + assertEquals((int) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id & x), x); - Assert.assertEquals((int) (x & id), x); + assertEquals((int) (id & x), x); + assertEquals((int) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id & x), x, + assertEquals((int) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x & id), x, + assertEquals((int) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3811,20 +3854,20 @@ public class Int128VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = OR_IDENTITY; - Assert.assertEquals((int) (id | id), id, + assertEquals((int) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id | x), x); - Assert.assertEquals((int) (x | id), x); + assertEquals((int) (id | x), x); + assertEquals((int) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id | x), x, + assertEquals((int) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x | id), x, + assertEquals((int) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3913,20 +3956,20 @@ public class Int128VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = XOR_IDENTITY; - Assert.assertEquals((int) (id ^ id), id, + assertEquals((int) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id ^ x), x); - Assert.assertEquals((int) (x ^ id), x); + assertEquals((int) (id ^ x), x); + assertEquals((int) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id ^ x), x, + assertEquals((int) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x ^ id), x, + assertEquals((int) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -4015,20 +4058,20 @@ public class Int128VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = ADD_IDENTITY; - Assert.assertEquals((int) (id + id), id, + assertEquals((int) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id + x), x); - Assert.assertEquals((int) (x + id), x); + assertEquals((int) (id + x), x); + assertEquals((int) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id + x), x, + assertEquals((int) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x + id), x, + assertEquals((int) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4117,20 +4160,20 @@ public class Int128VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = MUL_IDENTITY; - Assert.assertEquals((int) (id * id), id, + assertEquals((int) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id * x), x); - Assert.assertEquals((int) (x * id), x); + assertEquals((int) (id * x), x); + assertEquals((int) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id * x), x, + assertEquals((int) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x * id), x, + assertEquals((int) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4219,20 +4262,20 @@ public class Int128VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = MIN_IDENTITY; - Assert.assertEquals((int) Math.min(id, id), id, + assertEquals((int) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) Math.min(id, x), x); - Assert.assertEquals((int) Math.min(x, id), x); + assertEquals((int) Math.min(id, x), x); + assertEquals((int) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) Math.min(id, x), x, + assertEquals((int) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) Math.min(x, id), x, + assertEquals((int) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4321,20 +4364,20 @@ public class Int128VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = MAX_IDENTITY; - Assert.assertEquals((int) Math.max(id, id), id, + assertEquals((int) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) Math.max(id, x), x); - Assert.assertEquals((int) Math.max(x, id), x); + assertEquals((int) Math.max(id, x), x); + assertEquals((int) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) Math.max(id, x), x, + assertEquals((int) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) Math.max(x, id), x, + assertEquals((int) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4423,20 +4466,20 @@ public class Int128VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = UMIN_IDENTITY; - Assert.assertEquals((int) VectorMath.minUnsigned(id, id), id, + assertEquals((int) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((int) VectorMath.minUnsigned(x, id), x); + assertEquals((int) VectorMath.minUnsigned(id, x), x); + assertEquals((int) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) VectorMath.minUnsigned(id, x), x, + assertEquals((int) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) VectorMath.minUnsigned(x, id), x, + assertEquals((int) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4525,20 +4568,20 @@ public class Int128VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = UMAX_IDENTITY; - Assert.assertEquals((int) VectorMath.maxUnsigned(id, id), id, + assertEquals((int) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((int) VectorMath.maxUnsigned(x, id), x); + assertEquals((int) VectorMath.maxUnsigned(id, x), x); + assertEquals((int) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) VectorMath.maxUnsigned(id, x), x, + assertEquals((int) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) VectorMath.maxUnsigned(x, id), x, + assertEquals((int) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4627,20 +4670,20 @@ public class Int128VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4777,20 +4820,20 @@ public class Int128VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = SUADD_IDENTITY; - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((int) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4869,7 +4912,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4889,7 +4932,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4910,7 +4953,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4930,7 +4973,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4949,7 +4992,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4968,7 +5011,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4991,7 +5034,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -5010,7 +5053,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -5033,7 +5076,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5052,7 +5095,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5071,7 +5114,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5094,7 +5137,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5113,7 +5156,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5136,7 +5179,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5155,7 +5198,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5178,7 +5221,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5197,7 +5240,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5220,7 +5263,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5239,7 +5282,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5262,7 +5305,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5281,7 +5324,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5304,7 +5347,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5323,7 +5366,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5346,7 +5389,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5365,7 +5408,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5388,7 +5431,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5405,7 +5448,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5425,7 +5468,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5441,7 +5484,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (int)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (int)((long)b[i])); } } } @@ -5461,7 +5504,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (int)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (int)((long)b[i]))); } } } @@ -5477,7 +5520,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5497,7 +5540,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5513,7 +5556,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (int)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (int)((long)b[i])); } } } @@ -5533,7 +5576,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (int)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (int)((long)b[i]))); } } } @@ -5814,7 +5857,7 @@ public class Int128VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static int[] sliceUnary(int[] a, int origin, int idx) { @@ -6764,10 +6807,10 @@ public class Int128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6796,7 +6839,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6812,7 +6855,7 @@ public class Int128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -7052,7 +7095,7 @@ public class Int128VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -7080,7 +7123,7 @@ public class Int128VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -7095,7 +7138,7 @@ public class Int128VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7198,7 +7241,7 @@ public class Int128VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7224,7 +7267,7 @@ public class Int128VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7238,7 +7281,7 @@ public class Int128VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7260,7 +7303,7 @@ public class Int128VectorTests extends AbstractVectorTest { static void loopBoundInt128VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7268,14 +7311,14 @@ public class Int128VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeInt128VectorTestsSmokeTest() { IntVector av = IntVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Integer.SIZE); + assertEquals(elsize, Integer.SIZE); } @Test @@ -7329,7 +7372,7 @@ public class Int128VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueInt128VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Int256VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Int256VectorLoadStoreTests.java index 1a8c113d3b9..333757be0f8 100644 --- a/test/jdk/jdk/incubator/vector/Int256VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Int256VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Int256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 256); + static void assertEquals(int actual, int expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(int actual, int expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(int [] actual, int [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(int [] actual, int [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(int[] r, int[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Int256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "intProviderForIOOBE") @@ -870,11 +885,11 @@ public class Int256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Int256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Int256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(int[] r, int[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Int256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Int256VectorTests.java b/test/jdk/jdk/incubator/vector/Int256VectorTests.java index 4e63de95b7b..f9f0faad32b 100644 --- a/test/jdk/jdk/incubator/vector/Int256VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Int256VectorTests.java @@ -62,6 +62,49 @@ public class Int256VectorTests extends AbstractVectorTest { IntVector.SPECIES_256; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(int actual, int expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(int actual, int expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(int actual, int expected, int delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(int actual, int expected, int delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(int [] actual, int [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(int [] actual, int [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final int CONST_SHIFT = Integer.SIZE / 2; @@ -96,10 +139,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +154,13 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { int[] ref = f.apply(a[i]); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +170,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +189,13 @@ public class Int256VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +211,13 @@ public class Int256VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -190,13 +233,13 @@ public class Int256VectorTests extends AbstractVectorTest { FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -212,13 +255,13 @@ public class Int256VectorTests extends AbstractVectorTest { FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -230,10 +273,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -245,10 +288,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,12 +300,12 @@ public class Int256VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -273,20 +316,20 @@ public class Int256VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (int)0); + assertEquals(r[i + k], (int)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (int)0, "at index #" + idx); + assertEquals(r[idx], (int)0, "at index #" + idx); } } } @@ -298,19 +341,19 @@ public class Int256VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (int)0); + assertEquals(r[i + j], (int)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (int)0, "at index #" + idx); + assertEquals(r[idx], (int)0, "at index #" + idx); } } } @@ -326,11 +369,11 @@ public class Int256VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -339,12 +382,12 @@ public class Int256VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -354,17 +397,17 @@ public class Int256VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (int)0); + assertEquals(r[i+j], (int)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -374,17 +417,17 @@ public class Int256VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (int)0); + assertEquals(r[i+j], (int)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -398,10 +441,10 @@ public class Int256VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -413,10 +456,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -428,10 +471,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -452,18 +495,18 @@ public class Int256VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -478,18 +521,18 @@ public class Int256VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -497,10 +540,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -508,10 +551,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -519,10 +562,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -531,10 +574,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -547,10 +590,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -562,10 +605,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -577,10 +620,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -595,10 +638,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -611,11 +654,11 @@ public class Int256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -629,11 +672,11 @@ public class Int256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -655,11 +698,11 @@ public class Int256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -673,11 +716,11 @@ public class Int256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -697,10 +740,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -712,10 +755,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -724,10 +767,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -737,10 +780,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -756,11 +799,11 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -777,11 +820,11 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -792,11 +835,11 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -813,11 +856,11 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -835,13 +878,13 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, i, b, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -862,13 +905,13 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, i, mask, b, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -883,13 +926,13 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { int[] ref = f.apply(r, a, i, mask, b, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -910,13 +953,13 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, origin, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -930,13 +973,13 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -951,13 +994,13 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, mask, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -972,13 +1015,13 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, part, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -994,13 +1037,13 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, part, mask, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1013,10 +1056,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1026,10 +1069,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1037,10 +1080,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1543,7 +1586,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. IntVector io = (IntVector) SPECIES.broadcast(0).addIndex(1); IntVector io2 = (IntVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); IntVector a = io.add((int)1); //[1,2] IntVector b = a.neg(); //[-1,-2] int[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1558,19 +1601,19 @@ public class Int256VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); IntVector uab0 = zab0.rearrange(unz0,zab1); IntVector uab1 = zab0.rearrange(unz1,zab1); int[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { IntVector io = (IntVector) SPECIES.broadcast(0).addIndex(1); IntVector io2 = (IntVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1585,7 +1628,7 @@ public class Int256VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test @@ -1593,9 +1636,9 @@ public class Int256VectorTests extends AbstractVectorTest { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); VectorSpecies asFloatingSpecies = asFloating.species(); Assert.assertNotEquals(asFloatingSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asFloatingSpecies.length(), SPECIES.length()); - Assert.assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); + assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asFloatingSpecies.length(), SPECIES.length()); + assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); } @Test @@ -3709,20 +3752,20 @@ public class Int256VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = AND_IDENTITY; - Assert.assertEquals((int) (id & id), id, + assertEquals((int) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id & x), x); - Assert.assertEquals((int) (x & id), x); + assertEquals((int) (id & x), x); + assertEquals((int) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id & x), x, + assertEquals((int) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x & id), x, + assertEquals((int) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3811,20 +3854,20 @@ public class Int256VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = OR_IDENTITY; - Assert.assertEquals((int) (id | id), id, + assertEquals((int) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id | x), x); - Assert.assertEquals((int) (x | id), x); + assertEquals((int) (id | x), x); + assertEquals((int) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id | x), x, + assertEquals((int) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x | id), x, + assertEquals((int) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3913,20 +3956,20 @@ public class Int256VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = XOR_IDENTITY; - Assert.assertEquals((int) (id ^ id), id, + assertEquals((int) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id ^ x), x); - Assert.assertEquals((int) (x ^ id), x); + assertEquals((int) (id ^ x), x); + assertEquals((int) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id ^ x), x, + assertEquals((int) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x ^ id), x, + assertEquals((int) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -4015,20 +4058,20 @@ public class Int256VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = ADD_IDENTITY; - Assert.assertEquals((int) (id + id), id, + assertEquals((int) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id + x), x); - Assert.assertEquals((int) (x + id), x); + assertEquals((int) (id + x), x); + assertEquals((int) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id + x), x, + assertEquals((int) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x + id), x, + assertEquals((int) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4117,20 +4160,20 @@ public class Int256VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = MUL_IDENTITY; - Assert.assertEquals((int) (id * id), id, + assertEquals((int) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id * x), x); - Assert.assertEquals((int) (x * id), x); + assertEquals((int) (id * x), x); + assertEquals((int) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id * x), x, + assertEquals((int) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x * id), x, + assertEquals((int) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4219,20 +4262,20 @@ public class Int256VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = MIN_IDENTITY; - Assert.assertEquals((int) Math.min(id, id), id, + assertEquals((int) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) Math.min(id, x), x); - Assert.assertEquals((int) Math.min(x, id), x); + assertEquals((int) Math.min(id, x), x); + assertEquals((int) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) Math.min(id, x), x, + assertEquals((int) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) Math.min(x, id), x, + assertEquals((int) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4321,20 +4364,20 @@ public class Int256VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = MAX_IDENTITY; - Assert.assertEquals((int) Math.max(id, id), id, + assertEquals((int) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) Math.max(id, x), x); - Assert.assertEquals((int) Math.max(x, id), x); + assertEquals((int) Math.max(id, x), x); + assertEquals((int) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) Math.max(id, x), x, + assertEquals((int) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) Math.max(x, id), x, + assertEquals((int) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4423,20 +4466,20 @@ public class Int256VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = UMIN_IDENTITY; - Assert.assertEquals((int) VectorMath.minUnsigned(id, id), id, + assertEquals((int) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((int) VectorMath.minUnsigned(x, id), x); + assertEquals((int) VectorMath.minUnsigned(id, x), x); + assertEquals((int) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) VectorMath.minUnsigned(id, x), x, + assertEquals((int) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) VectorMath.minUnsigned(x, id), x, + assertEquals((int) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4525,20 +4568,20 @@ public class Int256VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = UMAX_IDENTITY; - Assert.assertEquals((int) VectorMath.maxUnsigned(id, id), id, + assertEquals((int) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((int) VectorMath.maxUnsigned(x, id), x); + assertEquals((int) VectorMath.maxUnsigned(id, x), x); + assertEquals((int) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) VectorMath.maxUnsigned(id, x), x, + assertEquals((int) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) VectorMath.maxUnsigned(x, id), x, + assertEquals((int) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4627,20 +4670,20 @@ public class Int256VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4777,20 +4820,20 @@ public class Int256VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = SUADD_IDENTITY; - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((int) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4869,7 +4912,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4889,7 +4932,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4910,7 +4953,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4930,7 +4973,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4949,7 +4992,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4968,7 +5011,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4991,7 +5034,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -5010,7 +5053,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -5033,7 +5076,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5052,7 +5095,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5071,7 +5114,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5094,7 +5137,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5113,7 +5156,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5136,7 +5179,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5155,7 +5198,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5178,7 +5221,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5197,7 +5240,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5220,7 +5263,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5239,7 +5282,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5262,7 +5305,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5281,7 +5324,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5304,7 +5347,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5323,7 +5366,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5346,7 +5389,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5365,7 +5408,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5388,7 +5431,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5405,7 +5448,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5425,7 +5468,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5441,7 +5484,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (int)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (int)((long)b[i])); } } } @@ -5461,7 +5504,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (int)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (int)((long)b[i]))); } } } @@ -5477,7 +5520,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5497,7 +5540,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5513,7 +5556,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (int)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (int)((long)b[i])); } } } @@ -5533,7 +5576,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (int)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (int)((long)b[i]))); } } } @@ -5814,7 +5857,7 @@ public class Int256VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static int[] sliceUnary(int[] a, int origin, int idx) { @@ -6764,10 +6807,10 @@ public class Int256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6796,7 +6839,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6812,7 +6855,7 @@ public class Int256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -7052,7 +7095,7 @@ public class Int256VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -7080,7 +7123,7 @@ public class Int256VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -7095,7 +7138,7 @@ public class Int256VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7198,7 +7241,7 @@ public class Int256VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7224,7 +7267,7 @@ public class Int256VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7238,7 +7281,7 @@ public class Int256VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7260,7 +7303,7 @@ public class Int256VectorTests extends AbstractVectorTest { static void loopBoundInt256VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7268,14 +7311,14 @@ public class Int256VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeInt256VectorTestsSmokeTest() { IntVector av = IntVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Integer.SIZE); + assertEquals(elsize, Integer.SIZE); } @Test @@ -7329,7 +7372,7 @@ public class Int256VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueInt256VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Int512VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Int512VectorLoadStoreTests.java index 4c4ab6c4bc5..1479dc57df5 100644 --- a/test/jdk/jdk/incubator/vector/Int512VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Int512VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Int512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 512); + static void assertEquals(int actual, int expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(int actual, int expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(int [] actual, int [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(int [] actual, int [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(int[] r, int[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Int512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "intProviderForIOOBE") @@ -870,11 +885,11 @@ public class Int512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Int512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Int512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(int[] r, int[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Int512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Int512VectorTests.java b/test/jdk/jdk/incubator/vector/Int512VectorTests.java index e2de7905a83..d2eda11e6f5 100644 --- a/test/jdk/jdk/incubator/vector/Int512VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Int512VectorTests.java @@ -62,6 +62,49 @@ public class Int512VectorTests extends AbstractVectorTest { IntVector.SPECIES_512; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(int actual, int expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(int actual, int expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(int actual, int expected, int delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(int actual, int expected, int delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(int [] actual, int [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(int [] actual, int [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final int CONST_SHIFT = Integer.SIZE / 2; @@ -96,10 +139,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +154,13 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { int[] ref = f.apply(a[i]); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +170,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +189,13 @@ public class Int512VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +211,13 @@ public class Int512VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -190,13 +233,13 @@ public class Int512VectorTests extends AbstractVectorTest { FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -212,13 +255,13 @@ public class Int512VectorTests extends AbstractVectorTest { FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -230,10 +273,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -245,10 +288,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,12 +300,12 @@ public class Int512VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -273,20 +316,20 @@ public class Int512VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (int)0); + assertEquals(r[i + k], (int)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (int)0, "at index #" + idx); + assertEquals(r[idx], (int)0, "at index #" + idx); } } } @@ -298,19 +341,19 @@ public class Int512VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (int)0); + assertEquals(r[i + j], (int)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (int)0, "at index #" + idx); + assertEquals(r[idx], (int)0, "at index #" + idx); } } } @@ -326,11 +369,11 @@ public class Int512VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -339,12 +382,12 @@ public class Int512VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -354,17 +397,17 @@ public class Int512VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (int)0); + assertEquals(r[i+j], (int)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -374,17 +417,17 @@ public class Int512VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (int)0); + assertEquals(r[i+j], (int)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -398,10 +441,10 @@ public class Int512VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -413,10 +456,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -428,10 +471,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -452,18 +495,18 @@ public class Int512VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -478,18 +521,18 @@ public class Int512VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -497,10 +540,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -508,10 +551,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -519,10 +562,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -531,10 +574,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -547,10 +590,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -562,10 +605,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -577,10 +620,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -595,10 +638,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -611,11 +654,11 @@ public class Int512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -629,11 +672,11 @@ public class Int512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -655,11 +698,11 @@ public class Int512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -673,11 +716,11 @@ public class Int512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -697,10 +740,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -712,10 +755,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -724,10 +767,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -737,10 +780,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -756,11 +799,11 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -777,11 +820,11 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -792,11 +835,11 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -813,11 +856,11 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -835,13 +878,13 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, i, b, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -862,13 +905,13 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, i, mask, b, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -883,13 +926,13 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { int[] ref = f.apply(r, a, i, mask, b, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -910,13 +953,13 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, origin, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -930,13 +973,13 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -951,13 +994,13 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, mask, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -972,13 +1015,13 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, part, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -994,13 +1037,13 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, part, mask, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1013,10 +1056,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1026,10 +1069,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1037,10 +1080,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1543,7 +1586,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. IntVector io = (IntVector) SPECIES.broadcast(0).addIndex(1); IntVector io2 = (IntVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); IntVector a = io.add((int)1); //[1,2] IntVector b = a.neg(); //[-1,-2] int[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1558,19 +1601,19 @@ public class Int512VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); IntVector uab0 = zab0.rearrange(unz0,zab1); IntVector uab1 = zab0.rearrange(unz1,zab1); int[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { IntVector io = (IntVector) SPECIES.broadcast(0).addIndex(1); IntVector io2 = (IntVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1585,7 +1628,7 @@ public class Int512VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test @@ -1593,9 +1636,9 @@ public class Int512VectorTests extends AbstractVectorTest { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); VectorSpecies asFloatingSpecies = asFloating.species(); Assert.assertNotEquals(asFloatingSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asFloatingSpecies.length(), SPECIES.length()); - Assert.assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); + assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asFloatingSpecies.length(), SPECIES.length()); + assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); } @Test @@ -3709,20 +3752,20 @@ public class Int512VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = AND_IDENTITY; - Assert.assertEquals((int) (id & id), id, + assertEquals((int) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id & x), x); - Assert.assertEquals((int) (x & id), x); + assertEquals((int) (id & x), x); + assertEquals((int) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id & x), x, + assertEquals((int) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x & id), x, + assertEquals((int) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3811,20 +3854,20 @@ public class Int512VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = OR_IDENTITY; - Assert.assertEquals((int) (id | id), id, + assertEquals((int) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id | x), x); - Assert.assertEquals((int) (x | id), x); + assertEquals((int) (id | x), x); + assertEquals((int) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id | x), x, + assertEquals((int) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x | id), x, + assertEquals((int) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3913,20 +3956,20 @@ public class Int512VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = XOR_IDENTITY; - Assert.assertEquals((int) (id ^ id), id, + assertEquals((int) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id ^ x), x); - Assert.assertEquals((int) (x ^ id), x); + assertEquals((int) (id ^ x), x); + assertEquals((int) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id ^ x), x, + assertEquals((int) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x ^ id), x, + assertEquals((int) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -4015,20 +4058,20 @@ public class Int512VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = ADD_IDENTITY; - Assert.assertEquals((int) (id + id), id, + assertEquals((int) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id + x), x); - Assert.assertEquals((int) (x + id), x); + assertEquals((int) (id + x), x); + assertEquals((int) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id + x), x, + assertEquals((int) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x + id), x, + assertEquals((int) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4117,20 +4160,20 @@ public class Int512VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = MUL_IDENTITY; - Assert.assertEquals((int) (id * id), id, + assertEquals((int) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id * x), x); - Assert.assertEquals((int) (x * id), x); + assertEquals((int) (id * x), x); + assertEquals((int) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id * x), x, + assertEquals((int) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x * id), x, + assertEquals((int) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4219,20 +4262,20 @@ public class Int512VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = MIN_IDENTITY; - Assert.assertEquals((int) Math.min(id, id), id, + assertEquals((int) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) Math.min(id, x), x); - Assert.assertEquals((int) Math.min(x, id), x); + assertEquals((int) Math.min(id, x), x); + assertEquals((int) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) Math.min(id, x), x, + assertEquals((int) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) Math.min(x, id), x, + assertEquals((int) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4321,20 +4364,20 @@ public class Int512VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = MAX_IDENTITY; - Assert.assertEquals((int) Math.max(id, id), id, + assertEquals((int) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) Math.max(id, x), x); - Assert.assertEquals((int) Math.max(x, id), x); + assertEquals((int) Math.max(id, x), x); + assertEquals((int) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) Math.max(id, x), x, + assertEquals((int) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) Math.max(x, id), x, + assertEquals((int) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4423,20 +4466,20 @@ public class Int512VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = UMIN_IDENTITY; - Assert.assertEquals((int) VectorMath.minUnsigned(id, id), id, + assertEquals((int) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((int) VectorMath.minUnsigned(x, id), x); + assertEquals((int) VectorMath.minUnsigned(id, x), x); + assertEquals((int) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) VectorMath.minUnsigned(id, x), x, + assertEquals((int) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) VectorMath.minUnsigned(x, id), x, + assertEquals((int) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4525,20 +4568,20 @@ public class Int512VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = UMAX_IDENTITY; - Assert.assertEquals((int) VectorMath.maxUnsigned(id, id), id, + assertEquals((int) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((int) VectorMath.maxUnsigned(x, id), x); + assertEquals((int) VectorMath.maxUnsigned(id, x), x); + assertEquals((int) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) VectorMath.maxUnsigned(id, x), x, + assertEquals((int) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) VectorMath.maxUnsigned(x, id), x, + assertEquals((int) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4627,20 +4670,20 @@ public class Int512VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4777,20 +4820,20 @@ public class Int512VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = SUADD_IDENTITY; - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((int) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4869,7 +4912,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4889,7 +4932,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4910,7 +4953,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4930,7 +4973,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4949,7 +4992,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4968,7 +5011,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4991,7 +5034,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -5010,7 +5053,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -5033,7 +5076,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5052,7 +5095,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5071,7 +5114,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5094,7 +5137,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5113,7 +5156,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5136,7 +5179,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5155,7 +5198,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5178,7 +5221,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5197,7 +5240,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5220,7 +5263,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5239,7 +5282,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5262,7 +5305,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5281,7 +5324,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5304,7 +5347,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5323,7 +5366,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5346,7 +5389,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5365,7 +5408,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5388,7 +5431,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5405,7 +5448,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5425,7 +5468,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5441,7 +5484,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (int)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (int)((long)b[i])); } } } @@ -5461,7 +5504,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (int)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (int)((long)b[i]))); } } } @@ -5477,7 +5520,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5497,7 +5540,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5513,7 +5556,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (int)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (int)((long)b[i])); } } } @@ -5533,7 +5576,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (int)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (int)((long)b[i]))); } } } @@ -5814,7 +5857,7 @@ public class Int512VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static int[] sliceUnary(int[] a, int origin, int idx) { @@ -6764,10 +6807,10 @@ public class Int512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6796,7 +6839,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6812,7 +6855,7 @@ public class Int512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -7052,7 +7095,7 @@ public class Int512VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -7080,7 +7123,7 @@ public class Int512VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -7095,7 +7138,7 @@ public class Int512VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7198,7 +7241,7 @@ public class Int512VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7224,7 +7267,7 @@ public class Int512VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7238,7 +7281,7 @@ public class Int512VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7260,7 +7303,7 @@ public class Int512VectorTests extends AbstractVectorTest { static void loopBoundInt512VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7268,14 +7311,14 @@ public class Int512VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeInt512VectorTestsSmokeTest() { IntVector av = IntVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Integer.SIZE); + assertEquals(elsize, Integer.SIZE); } @Test @@ -7329,7 +7372,7 @@ public class Int512VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueInt512VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Int64VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Int64VectorLoadStoreTests.java index a1fa9a8b16c..5dfc0ac2f4f 100644 --- a/test/jdk/jdk/incubator/vector/Int64VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Int64VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Int64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 64); + static void assertEquals(int actual, int expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(int actual, int expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(int [] actual, int [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(int [] actual, int [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(int[] r, int[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Int64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "intProviderForIOOBE") @@ -870,11 +885,11 @@ public class Int64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Int64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Int64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(int[] r, int[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Int64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Int64VectorTests.java b/test/jdk/jdk/incubator/vector/Int64VectorTests.java index d64db80b94d..6eb6322ba2b 100644 --- a/test/jdk/jdk/incubator/vector/Int64VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Int64VectorTests.java @@ -62,6 +62,49 @@ public class Int64VectorTests extends AbstractVectorTest { IntVector.SPECIES_64; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(int actual, int expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(int actual, int expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(int actual, int expected, int delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(int actual, int expected, int delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(int [] actual, int [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(int [] actual, int [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final int CONST_SHIFT = Integer.SIZE / 2; @@ -96,10 +139,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +154,13 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { int[] ref = f.apply(a[i]); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +170,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +189,13 @@ public class Int64VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +211,13 @@ public class Int64VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -190,13 +233,13 @@ public class Int64VectorTests extends AbstractVectorTest { FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -212,13 +255,13 @@ public class Int64VectorTests extends AbstractVectorTest { FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -230,10 +273,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -245,10 +288,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,12 +300,12 @@ public class Int64VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -273,20 +316,20 @@ public class Int64VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (int)0); + assertEquals(r[i + k], (int)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (int)0, "at index #" + idx); + assertEquals(r[idx], (int)0, "at index #" + idx); } } } @@ -298,19 +341,19 @@ public class Int64VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (int)0); + assertEquals(r[i + j], (int)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (int)0, "at index #" + idx); + assertEquals(r[idx], (int)0, "at index #" + idx); } } } @@ -326,11 +369,11 @@ public class Int64VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -339,12 +382,12 @@ public class Int64VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -354,17 +397,17 @@ public class Int64VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (int)0); + assertEquals(r[i+j], (int)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -374,17 +417,17 @@ public class Int64VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (int)0); + assertEquals(r[i+j], (int)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -398,10 +441,10 @@ public class Int64VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -413,10 +456,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -428,10 +471,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -452,18 +495,18 @@ public class Int64VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -478,18 +521,18 @@ public class Int64VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -497,10 +540,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -508,10 +551,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -519,10 +562,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -531,10 +574,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -547,10 +590,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -562,10 +605,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -577,10 +620,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -595,10 +638,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -611,11 +654,11 @@ public class Int64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -629,11 +672,11 @@ public class Int64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -655,11 +698,11 @@ public class Int64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -673,11 +716,11 @@ public class Int64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -697,10 +740,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -712,10 +755,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -724,10 +767,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -737,10 +780,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -756,11 +799,11 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -777,11 +820,11 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -792,11 +835,11 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -813,11 +856,11 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -835,13 +878,13 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, i, b, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -862,13 +905,13 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, i, mask, b, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -883,13 +926,13 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { int[] ref = f.apply(r, a, i, mask, b, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -910,13 +953,13 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, origin, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -930,13 +973,13 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -951,13 +994,13 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, mask, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -972,13 +1015,13 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, part, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -994,13 +1037,13 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, part, mask, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1013,10 +1056,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1026,10 +1069,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1037,10 +1080,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1543,7 +1586,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. IntVector io = (IntVector) SPECIES.broadcast(0).addIndex(1); IntVector io2 = (IntVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); IntVector a = io.add((int)1); //[1,2] IntVector b = a.neg(); //[-1,-2] int[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1558,19 +1601,19 @@ public class Int64VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); IntVector uab0 = zab0.rearrange(unz0,zab1); IntVector uab1 = zab0.rearrange(unz1,zab1); int[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { IntVector io = (IntVector) SPECIES.broadcast(0).addIndex(1); IntVector io2 = (IntVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1585,7 +1628,7 @@ public class Int64VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test @@ -1593,9 +1636,9 @@ public class Int64VectorTests extends AbstractVectorTest { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); VectorSpecies asFloatingSpecies = asFloating.species(); Assert.assertNotEquals(asFloatingSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asFloatingSpecies.length(), SPECIES.length()); - Assert.assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); + assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asFloatingSpecies.length(), SPECIES.length()); + assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); } @Test @@ -3709,20 +3752,20 @@ public class Int64VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = AND_IDENTITY; - Assert.assertEquals((int) (id & id), id, + assertEquals((int) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id & x), x); - Assert.assertEquals((int) (x & id), x); + assertEquals((int) (id & x), x); + assertEquals((int) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id & x), x, + assertEquals((int) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x & id), x, + assertEquals((int) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3811,20 +3854,20 @@ public class Int64VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = OR_IDENTITY; - Assert.assertEquals((int) (id | id), id, + assertEquals((int) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id | x), x); - Assert.assertEquals((int) (x | id), x); + assertEquals((int) (id | x), x); + assertEquals((int) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id | x), x, + assertEquals((int) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x | id), x, + assertEquals((int) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3913,20 +3956,20 @@ public class Int64VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = XOR_IDENTITY; - Assert.assertEquals((int) (id ^ id), id, + assertEquals((int) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id ^ x), x); - Assert.assertEquals((int) (x ^ id), x); + assertEquals((int) (id ^ x), x); + assertEquals((int) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id ^ x), x, + assertEquals((int) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x ^ id), x, + assertEquals((int) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -4015,20 +4058,20 @@ public class Int64VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = ADD_IDENTITY; - Assert.assertEquals((int) (id + id), id, + assertEquals((int) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id + x), x); - Assert.assertEquals((int) (x + id), x); + assertEquals((int) (id + x), x); + assertEquals((int) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id + x), x, + assertEquals((int) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x + id), x, + assertEquals((int) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4117,20 +4160,20 @@ public class Int64VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = MUL_IDENTITY; - Assert.assertEquals((int) (id * id), id, + assertEquals((int) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id * x), x); - Assert.assertEquals((int) (x * id), x); + assertEquals((int) (id * x), x); + assertEquals((int) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id * x), x, + assertEquals((int) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x * id), x, + assertEquals((int) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4219,20 +4262,20 @@ public class Int64VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = MIN_IDENTITY; - Assert.assertEquals((int) Math.min(id, id), id, + assertEquals((int) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) Math.min(id, x), x); - Assert.assertEquals((int) Math.min(x, id), x); + assertEquals((int) Math.min(id, x), x); + assertEquals((int) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) Math.min(id, x), x, + assertEquals((int) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) Math.min(x, id), x, + assertEquals((int) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4321,20 +4364,20 @@ public class Int64VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = MAX_IDENTITY; - Assert.assertEquals((int) Math.max(id, id), id, + assertEquals((int) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) Math.max(id, x), x); - Assert.assertEquals((int) Math.max(x, id), x); + assertEquals((int) Math.max(id, x), x); + assertEquals((int) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) Math.max(id, x), x, + assertEquals((int) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) Math.max(x, id), x, + assertEquals((int) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4423,20 +4466,20 @@ public class Int64VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = UMIN_IDENTITY; - Assert.assertEquals((int) VectorMath.minUnsigned(id, id), id, + assertEquals((int) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((int) VectorMath.minUnsigned(x, id), x); + assertEquals((int) VectorMath.minUnsigned(id, x), x); + assertEquals((int) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) VectorMath.minUnsigned(id, x), x, + assertEquals((int) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) VectorMath.minUnsigned(x, id), x, + assertEquals((int) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4525,20 +4568,20 @@ public class Int64VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = UMAX_IDENTITY; - Assert.assertEquals((int) VectorMath.maxUnsigned(id, id), id, + assertEquals((int) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((int) VectorMath.maxUnsigned(x, id), x); + assertEquals((int) VectorMath.maxUnsigned(id, x), x); + assertEquals((int) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) VectorMath.maxUnsigned(id, x), x, + assertEquals((int) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) VectorMath.maxUnsigned(x, id), x, + assertEquals((int) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4627,20 +4670,20 @@ public class Int64VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4777,20 +4820,20 @@ public class Int64VectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = SUADD_IDENTITY; - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((int) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4869,7 +4912,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4889,7 +4932,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4910,7 +4953,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4930,7 +4973,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4949,7 +4992,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4968,7 +5011,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4991,7 +5034,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -5010,7 +5053,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -5033,7 +5076,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5052,7 +5095,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5071,7 +5114,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5094,7 +5137,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5113,7 +5156,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5136,7 +5179,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5155,7 +5198,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5178,7 +5221,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5197,7 +5240,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5220,7 +5263,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5239,7 +5282,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5262,7 +5305,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5281,7 +5324,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5304,7 +5347,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5323,7 +5366,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5346,7 +5389,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5365,7 +5408,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5388,7 +5431,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5405,7 +5448,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5425,7 +5468,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5441,7 +5484,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (int)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (int)((long)b[i])); } } } @@ -5461,7 +5504,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (int)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (int)((long)b[i]))); } } } @@ -5477,7 +5520,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5497,7 +5540,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5513,7 +5556,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (int)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (int)((long)b[i])); } } } @@ -5533,7 +5576,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (int)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (int)((long)b[i]))); } } } @@ -5814,7 +5857,7 @@ public class Int64VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static int[] sliceUnary(int[] a, int origin, int idx) { @@ -6764,10 +6807,10 @@ public class Int64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6796,7 +6839,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6812,7 +6855,7 @@ public class Int64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -7052,7 +7095,7 @@ public class Int64VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -7080,7 +7123,7 @@ public class Int64VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -7095,7 +7138,7 @@ public class Int64VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7198,7 +7241,7 @@ public class Int64VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7224,7 +7267,7 @@ public class Int64VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7238,7 +7281,7 @@ public class Int64VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7260,7 +7303,7 @@ public class Int64VectorTests extends AbstractVectorTest { static void loopBoundInt64VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7268,14 +7311,14 @@ public class Int64VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeInt64VectorTestsSmokeTest() { IntVector av = IntVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Integer.SIZE); + assertEquals(elsize, Integer.SIZE); } @Test @@ -7329,7 +7372,7 @@ public class Int64VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueInt64VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/IntMaxVectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/IntMaxVectorLoadStoreTests.java index 564849e22fd..d72c428659f 100644 --- a/test/jdk/jdk/incubator/vector/IntMaxVectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/IntMaxVectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -68,14 +68,29 @@ public class IntMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / Max); + static void assertEquals(int actual, int expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(int actual, int expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(int [] actual, int [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(int [] actual, int [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(int[] r, int[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (int) 0, "at index #" + i); } } @@ -329,7 +344,7 @@ public class IntMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "intProviderForIOOBE") @@ -877,11 +892,11 @@ public class IntMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -892,11 +907,11 @@ public class IntMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (int) 0, "at index #" + j); } } @@ -912,7 +927,7 @@ public class IntMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(int[] r, int[] a, int[] indexMap) { @@ -925,7 +940,7 @@ public class IntMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/IntMaxVectorTests.java b/test/jdk/jdk/incubator/vector/IntMaxVectorTests.java index 7bf4dc48171..fc4cf4ea21e 100644 --- a/test/jdk/jdk/incubator/vector/IntMaxVectorTests.java +++ b/test/jdk/jdk/incubator/vector/IntMaxVectorTests.java @@ -62,6 +62,49 @@ public class IntMaxVectorTests extends AbstractVectorTest { IntVector.SPECIES_MAX; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(int actual, int expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(int actual, int expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(int actual, int expected, int delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(int actual, int expected, int delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(int [] actual, int [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(int [] actual, int [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static VectorShape getMaxBit() { return VectorShape.S_Max_BIT; @@ -102,10 +145,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -117,13 +160,13 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { int[] ref = f.apply(a[i]); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -133,10 +176,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -152,13 +195,13 @@ public class IntMaxVectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -174,13 +217,13 @@ public class IntMaxVectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -196,13 +239,13 @@ public class IntMaxVectorTests extends AbstractVectorTest { FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -218,13 +261,13 @@ public class IntMaxVectorTests extends AbstractVectorTest { FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -236,10 +279,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -251,10 +294,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -263,12 +306,12 @@ public class IntMaxVectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -279,20 +322,20 @@ public class IntMaxVectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (int)0); + assertEquals(r[i + k], (int)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (int)0, "at index #" + idx); + assertEquals(r[idx], (int)0, "at index #" + idx); } } } @@ -304,19 +347,19 @@ public class IntMaxVectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (int)0); + assertEquals(r[i + j], (int)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (int)0, "at index #" + idx); + assertEquals(r[idx], (int)0, "at index #" + idx); } } } @@ -332,11 +375,11 @@ public class IntMaxVectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -345,12 +388,12 @@ public class IntMaxVectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -360,17 +403,17 @@ public class IntMaxVectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (int)0); + assertEquals(r[i+j], (int)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -380,17 +423,17 @@ public class IntMaxVectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (int)0); + assertEquals(r[i+j], (int)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (int)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -404,10 +447,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -419,10 +462,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -434,10 +477,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -458,18 +501,18 @@ public class IntMaxVectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -484,18 +527,18 @@ public class IntMaxVectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -503,10 +546,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -514,10 +557,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -525,10 +568,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -537,10 +580,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -553,10 +596,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -568,10 +611,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -583,10 +626,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -601,10 +644,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (int)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -617,11 +660,11 @@ public class IntMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -635,11 +678,11 @@ public class IntMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -661,11 +704,11 @@ public class IntMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -679,11 +722,11 @@ public class IntMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -703,10 +746,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -718,10 +761,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -730,10 +773,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -743,10 +786,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -762,11 +805,11 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -783,11 +826,11 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -798,11 +841,11 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -819,11 +862,11 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -841,13 +884,13 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, i, b, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -868,13 +911,13 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, i, mask, b, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -889,13 +932,13 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { int[] ref = f.apply(r, a, i, mask, b, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -916,13 +959,13 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, origin, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -936,13 +979,13 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -957,13 +1000,13 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, mask, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -978,13 +1021,13 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, part, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1000,13 +1043,13 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { int[] ref = f.apply(a, b, origin, part, mask, i); int[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1019,10 +1062,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1032,10 +1075,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1043,10 +1086,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1549,7 +1592,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Do some zipping and shuffling. IntVector io = (IntVector) SPECIES.broadcast(0).addIndex(1); IntVector io2 = (IntVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); IntVector a = io.add((int)1); //[1,2] IntVector b = a.neg(); //[-1,-2] int[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1564,19 +1607,19 @@ public class IntMaxVectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); IntVector uab0 = zab0.rearrange(unz0,zab1); IntVector uab1 = zab0.rearrange(unz1,zab1); int[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { IntVector io = (IntVector) SPECIES.broadcast(0).addIndex(1); IntVector io2 = (IntVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1591,7 +1634,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test @@ -1599,9 +1642,9 @@ public class IntMaxVectorTests extends AbstractVectorTest { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); VectorSpecies asFloatingSpecies = asFloating.species(); Assert.assertNotEquals(asFloatingSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asFloatingSpecies.length(), SPECIES.length()); - Assert.assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); + assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asFloatingSpecies.length(), SPECIES.length()); + assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); } @Test @@ -3715,20 +3758,20 @@ public class IntMaxVectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = AND_IDENTITY; - Assert.assertEquals((int) (id & id), id, + assertEquals((int) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id & x), x); - Assert.assertEquals((int) (x & id), x); + assertEquals((int) (id & x), x); + assertEquals((int) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id & x), x, + assertEquals((int) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x & id), x, + assertEquals((int) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3817,20 +3860,20 @@ public class IntMaxVectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = OR_IDENTITY; - Assert.assertEquals((int) (id | id), id, + assertEquals((int) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id | x), x); - Assert.assertEquals((int) (x | id), x); + assertEquals((int) (id | x), x); + assertEquals((int) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id | x), x, + assertEquals((int) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x | id), x, + assertEquals((int) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3919,20 +3962,20 @@ public class IntMaxVectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = XOR_IDENTITY; - Assert.assertEquals((int) (id ^ id), id, + assertEquals((int) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id ^ x), x); - Assert.assertEquals((int) (x ^ id), x); + assertEquals((int) (id ^ x), x); + assertEquals((int) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id ^ x), x, + assertEquals((int) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x ^ id), x, + assertEquals((int) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -4021,20 +4064,20 @@ public class IntMaxVectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = ADD_IDENTITY; - Assert.assertEquals((int) (id + id), id, + assertEquals((int) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id + x), x); - Assert.assertEquals((int) (x + id), x); + assertEquals((int) (id + x), x); + assertEquals((int) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id + x), x, + assertEquals((int) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x + id), x, + assertEquals((int) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4123,20 +4166,20 @@ public class IntMaxVectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = MUL_IDENTITY; - Assert.assertEquals((int) (id * id), id, + assertEquals((int) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) (id * x), x); - Assert.assertEquals((int) (x * id), x); + assertEquals((int) (id * x), x); + assertEquals((int) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) (id * x), x, + assertEquals((int) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) (x * id), x, + assertEquals((int) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4225,20 +4268,20 @@ public class IntMaxVectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = MIN_IDENTITY; - Assert.assertEquals((int) Math.min(id, id), id, + assertEquals((int) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) Math.min(id, x), x); - Assert.assertEquals((int) Math.min(x, id), x); + assertEquals((int) Math.min(id, x), x); + assertEquals((int) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) Math.min(id, x), x, + assertEquals((int) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) Math.min(x, id), x, + assertEquals((int) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4327,20 +4370,20 @@ public class IntMaxVectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = MAX_IDENTITY; - Assert.assertEquals((int) Math.max(id, id), id, + assertEquals((int) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) Math.max(id, x), x); - Assert.assertEquals((int) Math.max(x, id), x); + assertEquals((int) Math.max(id, x), x); + assertEquals((int) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) Math.max(id, x), x, + assertEquals((int) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) Math.max(x, id), x, + assertEquals((int) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4429,20 +4472,20 @@ public class IntMaxVectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = UMIN_IDENTITY; - Assert.assertEquals((int) VectorMath.minUnsigned(id, id), id, + assertEquals((int) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((int) VectorMath.minUnsigned(x, id), x); + assertEquals((int) VectorMath.minUnsigned(id, x), x); + assertEquals((int) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) VectorMath.minUnsigned(id, x), x, + assertEquals((int) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) VectorMath.minUnsigned(x, id), x, + assertEquals((int) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4531,20 +4574,20 @@ public class IntMaxVectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = UMAX_IDENTITY; - Assert.assertEquals((int) VectorMath.maxUnsigned(id, id), id, + assertEquals((int) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((int) VectorMath.maxUnsigned(x, id), x); + assertEquals((int) VectorMath.maxUnsigned(id, x), x); + assertEquals((int) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) VectorMath.maxUnsigned(id, x), x, + assertEquals((int) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) VectorMath.maxUnsigned(x, id), x, + assertEquals((int) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4633,20 +4676,20 @@ public class IntMaxVectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4783,20 +4826,20 @@ public class IntMaxVectorTests extends AbstractVectorTest { int[] a = fa.apply(SPECIES.length()); int id = SUADD_IDENTITY; - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((int) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); int x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((int) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((int) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4875,7 +4918,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4895,7 +4938,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4916,7 +4959,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4936,7 +4979,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4955,7 +4998,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4974,7 +5017,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4997,7 +5040,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -5016,7 +5059,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -5039,7 +5082,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5058,7 +5101,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5077,7 +5120,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5100,7 +5143,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5119,7 +5162,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5142,7 +5185,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5161,7 +5204,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5184,7 +5227,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5203,7 +5246,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5226,7 +5269,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5245,7 +5288,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5268,7 +5311,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5287,7 +5330,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5310,7 +5353,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5329,7 +5372,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5352,7 +5395,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5371,7 +5414,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5394,7 +5437,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5411,7 +5454,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5431,7 +5474,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5447,7 +5490,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (int)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (int)((long)b[i])); } } } @@ -5467,7 +5510,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (int)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (int)((long)b[i]))); } } } @@ -5483,7 +5526,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5503,7 +5546,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5519,7 +5562,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (int)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (int)((long)b[i])); } } } @@ -5539,7 +5582,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (int)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (int)((long)b[i]))); } } } @@ -5820,7 +5863,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static int[] sliceUnary(int[] a, int origin, int idx) { @@ -6770,10 +6813,10 @@ public class IntMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6802,7 +6845,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6818,7 +6861,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -7058,7 +7101,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -7086,7 +7129,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -7101,7 +7144,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7204,7 +7247,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7230,7 +7273,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7244,7 +7287,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7266,7 +7309,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { static void loopBoundIntMaxVectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7274,14 +7317,14 @@ public class IntMaxVectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeIntMaxVectorTestsSmokeTest() { IntVector av = IntVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Integer.SIZE); + assertEquals(elsize, Integer.SIZE); } @Test @@ -7335,7 +7378,7 @@ public class IntMaxVectorTests extends AbstractVectorTest { @Test static void MaskAllTrueIntMaxVectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Long128VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Long128VectorLoadStoreTests.java index 57a0880aed3..20df291542f 100644 --- a/test/jdk/jdk/incubator/vector/Long128VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Long128VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Long128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 128); + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(long [] actual, long [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long [] actual, long [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(long[] r, long[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Long128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "longProviderForIOOBE") @@ -870,11 +885,11 @@ public class Long128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Long128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Long128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(long[] r, long[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Long128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Long128VectorTests.java b/test/jdk/jdk/incubator/vector/Long128VectorTests.java index 227f196ffdf..9847f79fc04 100644 --- a/test/jdk/jdk/incubator/vector/Long128VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Long128VectorTests.java @@ -62,6 +62,43 @@ public class Long128VectorTests extends AbstractVectorTest { LongVector.SPECIES_128; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected, long delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(long actual, long expected, long delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(long [] actual, long [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long [] actual, long [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final long CONST_SHIFT = Long.SIZE / 2; @@ -96,10 +133,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +148,13 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { long[] ref = f.apply(a[i]); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +164,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +183,13 @@ public class Long128VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +205,13 @@ public class Long128VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -187,10 +224,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -202,10 +239,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -214,12 +251,12 @@ public class Long128VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -230,20 +267,20 @@ public class Long128VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (long)0); + assertEquals(r[i + k], (long)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (long)0, "at index #" + idx); + assertEquals(r[idx], (long)0, "at index #" + idx); } } } @@ -255,19 +292,19 @@ public class Long128VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (long)0); + assertEquals(r[i + j], (long)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (long)0, "at index #" + idx); + assertEquals(r[idx], (long)0, "at index #" + idx); } } } @@ -283,11 +320,11 @@ public class Long128VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -296,12 +333,12 @@ public class Long128VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -311,17 +348,17 @@ public class Long128VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (long)0); + assertEquals(r[i+j], (long)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -331,17 +368,17 @@ public class Long128VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (long)0); + assertEquals(r[i+j], (long)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -355,10 +392,10 @@ public class Long128VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -370,10 +407,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -385,10 +422,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -409,18 +446,18 @@ public class Long128VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -435,18 +472,18 @@ public class Long128VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -454,10 +491,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -465,10 +502,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -476,10 +513,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -488,10 +525,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -504,10 +541,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -519,10 +556,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -534,10 +571,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -552,10 +589,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -568,11 +605,11 @@ public class Long128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -586,11 +623,11 @@ public class Long128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -612,11 +649,11 @@ public class Long128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -630,11 +667,11 @@ public class Long128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -654,10 +691,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -669,10 +706,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -681,10 +718,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -694,10 +731,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -713,11 +750,11 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -734,11 +771,11 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -749,11 +786,11 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -770,11 +807,11 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -792,13 +829,13 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, i, b, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -819,13 +856,13 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, i, mask, b, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -840,13 +877,13 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { long[] ref = f.apply(r, a, i, mask, b, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -867,13 +904,13 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, origin, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -887,13 +924,13 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -908,13 +945,13 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, mask, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -929,13 +966,13 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, part, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -951,13 +988,13 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, part, mask, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1003,10 +1040,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1016,10 +1053,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1027,10 +1064,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1565,7 +1602,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. LongVector io = (LongVector) SPECIES.broadcast(0).addIndex(1); LongVector io2 = (LongVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); LongVector a = io.add((long)1); //[1,2] LongVector b = a.neg(); //[-1,-2] long[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1580,19 +1617,19 @@ public class Long128VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); LongVector uab0 = zab0.rearrange(unz0,zab1); LongVector uab1 = zab0.rearrange(unz1,zab1); long[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { LongVector io = (LongVector) SPECIES.broadcast(0).addIndex(1); LongVector io2 = (LongVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1607,7 +1644,7 @@ public class Long128VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test @@ -1615,9 +1652,9 @@ public class Long128VectorTests extends AbstractVectorTest { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); VectorSpecies asFloatingSpecies = asFloating.species(); Assert.assertNotEquals(asFloatingSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asFloatingSpecies.length(), SPECIES.length()); - Assert.assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); + assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asFloatingSpecies.length(), SPECIES.length()); + assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); } @Test @@ -3731,20 +3768,20 @@ public class Long128VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = AND_IDENTITY; - Assert.assertEquals((long) (id & id), id, + assertEquals((long) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id & x), x); - Assert.assertEquals((long) (x & id), x); + assertEquals((long) (id & x), x); + assertEquals((long) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id & x), x, + assertEquals((long) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x & id), x, + assertEquals((long) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3833,20 +3870,20 @@ public class Long128VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = OR_IDENTITY; - Assert.assertEquals((long) (id | id), id, + assertEquals((long) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id | x), x); - Assert.assertEquals((long) (x | id), x); + assertEquals((long) (id | x), x); + assertEquals((long) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id | x), x, + assertEquals((long) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x | id), x, + assertEquals((long) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3935,20 +3972,20 @@ public class Long128VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = XOR_IDENTITY; - Assert.assertEquals((long) (id ^ id), id, + assertEquals((long) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id ^ x), x); - Assert.assertEquals((long) (x ^ id), x); + assertEquals((long) (id ^ x), x); + assertEquals((long) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id ^ x), x, + assertEquals((long) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x ^ id), x, + assertEquals((long) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -4037,20 +4074,20 @@ public class Long128VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = ADD_IDENTITY; - Assert.assertEquals((long) (id + id), id, + assertEquals((long) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id + x), x); - Assert.assertEquals((long) (x + id), x); + assertEquals((long) (id + x), x); + assertEquals((long) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id + x), x, + assertEquals((long) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x + id), x, + assertEquals((long) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4139,20 +4176,20 @@ public class Long128VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = MUL_IDENTITY; - Assert.assertEquals((long) (id * id), id, + assertEquals((long) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id * x), x); - Assert.assertEquals((long) (x * id), x); + assertEquals((long) (id * x), x); + assertEquals((long) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id * x), x, + assertEquals((long) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x * id), x, + assertEquals((long) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4241,20 +4278,20 @@ public class Long128VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = MIN_IDENTITY; - Assert.assertEquals((long) Math.min(id, id), id, + assertEquals((long) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) Math.min(id, x), x); - Assert.assertEquals((long) Math.min(x, id), x); + assertEquals((long) Math.min(id, x), x); + assertEquals((long) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) Math.min(id, x), x, + assertEquals((long) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) Math.min(x, id), x, + assertEquals((long) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4343,20 +4380,20 @@ public class Long128VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = MAX_IDENTITY; - Assert.assertEquals((long) Math.max(id, id), id, + assertEquals((long) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) Math.max(id, x), x); - Assert.assertEquals((long) Math.max(x, id), x); + assertEquals((long) Math.max(id, x), x); + assertEquals((long) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) Math.max(id, x), x, + assertEquals((long) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) Math.max(x, id), x, + assertEquals((long) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4445,20 +4482,20 @@ public class Long128VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = UMIN_IDENTITY; - Assert.assertEquals((long) VectorMath.minUnsigned(id, id), id, + assertEquals((long) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((long) VectorMath.minUnsigned(x, id), x); + assertEquals((long) VectorMath.minUnsigned(id, x), x); + assertEquals((long) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) VectorMath.minUnsigned(id, x), x, + assertEquals((long) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) VectorMath.minUnsigned(x, id), x, + assertEquals((long) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4547,20 +4584,20 @@ public class Long128VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = UMAX_IDENTITY; - Assert.assertEquals((long) VectorMath.maxUnsigned(id, id), id, + assertEquals((long) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((long) VectorMath.maxUnsigned(x, id), x); + assertEquals((long) VectorMath.maxUnsigned(id, x), x); + assertEquals((long) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) VectorMath.maxUnsigned(id, x), x, + assertEquals((long) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) VectorMath.maxUnsigned(x, id), x, + assertEquals((long) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4649,20 +4686,20 @@ public class Long128VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4799,20 +4836,20 @@ public class Long128VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = SUADD_IDENTITY; - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((long) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4891,7 +4928,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4911,7 +4948,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4932,7 +4969,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4952,7 +4989,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4971,7 +5008,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4990,7 +5027,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -5013,7 +5050,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -5032,7 +5069,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -5055,7 +5092,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5074,7 +5111,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5093,7 +5130,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5116,7 +5153,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5135,7 +5172,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5158,7 +5195,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5177,7 +5214,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5200,7 +5237,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5219,7 +5256,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5242,7 +5279,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5261,7 +5298,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5284,7 +5321,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5303,7 +5340,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5326,7 +5363,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5345,7 +5382,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5368,7 +5405,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5387,7 +5424,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5410,7 +5447,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5427,7 +5464,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5447,7 +5484,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5464,7 +5501,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5484,7 +5521,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5766,7 +5803,7 @@ public class Long128VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static long[] sliceUnary(long[] a, int origin, int idx) { @@ -6716,10 +6753,10 @@ public class Long128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6748,7 +6785,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6764,7 +6801,7 @@ public class Long128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -6938,7 +6975,7 @@ public class Long128VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -6966,7 +7003,7 @@ public class Long128VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -6981,7 +7018,7 @@ public class Long128VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7084,7 +7121,7 @@ public class Long128VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7110,7 +7147,7 @@ public class Long128VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7124,7 +7161,7 @@ public class Long128VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7146,7 +7183,7 @@ public class Long128VectorTests extends AbstractVectorTest { static void loopBoundLong128VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7154,14 +7191,14 @@ public class Long128VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeLong128VectorTestsSmokeTest() { LongVector av = LongVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Long.SIZE); + assertEquals(elsize, Long.SIZE); } @Test @@ -7215,7 +7252,7 @@ public class Long128VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueLong128VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Long256VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Long256VectorLoadStoreTests.java index f07cf3e68b7..675536ee67b 100644 --- a/test/jdk/jdk/incubator/vector/Long256VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Long256VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Long256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 256); + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(long [] actual, long [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long [] actual, long [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(long[] r, long[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Long256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "longProviderForIOOBE") @@ -870,11 +885,11 @@ public class Long256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Long256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Long256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(long[] r, long[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Long256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Long256VectorTests.java b/test/jdk/jdk/incubator/vector/Long256VectorTests.java index c37e68e3728..0f3e3347480 100644 --- a/test/jdk/jdk/incubator/vector/Long256VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Long256VectorTests.java @@ -62,6 +62,43 @@ public class Long256VectorTests extends AbstractVectorTest { LongVector.SPECIES_256; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected, long delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(long actual, long expected, long delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(long [] actual, long [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long [] actual, long [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final long CONST_SHIFT = Long.SIZE / 2; @@ -96,10 +133,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +148,13 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { long[] ref = f.apply(a[i]); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +164,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +183,13 @@ public class Long256VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +205,13 @@ public class Long256VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -187,10 +224,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -202,10 +239,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -214,12 +251,12 @@ public class Long256VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -230,20 +267,20 @@ public class Long256VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (long)0); + assertEquals(r[i + k], (long)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (long)0, "at index #" + idx); + assertEquals(r[idx], (long)0, "at index #" + idx); } } } @@ -255,19 +292,19 @@ public class Long256VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (long)0); + assertEquals(r[i + j], (long)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (long)0, "at index #" + idx); + assertEquals(r[idx], (long)0, "at index #" + idx); } } } @@ -283,11 +320,11 @@ public class Long256VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -296,12 +333,12 @@ public class Long256VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -311,17 +348,17 @@ public class Long256VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (long)0); + assertEquals(r[i+j], (long)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -331,17 +368,17 @@ public class Long256VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (long)0); + assertEquals(r[i+j], (long)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -355,10 +392,10 @@ public class Long256VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -370,10 +407,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -385,10 +422,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -409,18 +446,18 @@ public class Long256VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -435,18 +472,18 @@ public class Long256VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -454,10 +491,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -465,10 +502,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -476,10 +513,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -488,10 +525,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -504,10 +541,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -519,10 +556,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -534,10 +571,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -552,10 +589,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -568,11 +605,11 @@ public class Long256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -586,11 +623,11 @@ public class Long256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -612,11 +649,11 @@ public class Long256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -630,11 +667,11 @@ public class Long256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -654,10 +691,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -669,10 +706,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -681,10 +718,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -694,10 +731,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -713,11 +750,11 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -734,11 +771,11 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -749,11 +786,11 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -770,11 +807,11 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -792,13 +829,13 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, i, b, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -819,13 +856,13 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, i, mask, b, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -840,13 +877,13 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { long[] ref = f.apply(r, a, i, mask, b, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -867,13 +904,13 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, origin, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -887,13 +924,13 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -908,13 +945,13 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, mask, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -929,13 +966,13 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, part, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -951,13 +988,13 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, part, mask, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1003,10 +1040,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1016,10 +1053,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1027,10 +1064,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1565,7 +1602,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. LongVector io = (LongVector) SPECIES.broadcast(0).addIndex(1); LongVector io2 = (LongVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); LongVector a = io.add((long)1); //[1,2] LongVector b = a.neg(); //[-1,-2] long[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1580,19 +1617,19 @@ public class Long256VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); LongVector uab0 = zab0.rearrange(unz0,zab1); LongVector uab1 = zab0.rearrange(unz1,zab1); long[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { LongVector io = (LongVector) SPECIES.broadcast(0).addIndex(1); LongVector io2 = (LongVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1607,7 +1644,7 @@ public class Long256VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test @@ -1615,9 +1652,9 @@ public class Long256VectorTests extends AbstractVectorTest { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); VectorSpecies asFloatingSpecies = asFloating.species(); Assert.assertNotEquals(asFloatingSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asFloatingSpecies.length(), SPECIES.length()); - Assert.assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); + assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asFloatingSpecies.length(), SPECIES.length()); + assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); } @Test @@ -3731,20 +3768,20 @@ public class Long256VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = AND_IDENTITY; - Assert.assertEquals((long) (id & id), id, + assertEquals((long) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id & x), x); - Assert.assertEquals((long) (x & id), x); + assertEquals((long) (id & x), x); + assertEquals((long) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id & x), x, + assertEquals((long) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x & id), x, + assertEquals((long) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3833,20 +3870,20 @@ public class Long256VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = OR_IDENTITY; - Assert.assertEquals((long) (id | id), id, + assertEquals((long) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id | x), x); - Assert.assertEquals((long) (x | id), x); + assertEquals((long) (id | x), x); + assertEquals((long) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id | x), x, + assertEquals((long) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x | id), x, + assertEquals((long) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3935,20 +3972,20 @@ public class Long256VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = XOR_IDENTITY; - Assert.assertEquals((long) (id ^ id), id, + assertEquals((long) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id ^ x), x); - Assert.assertEquals((long) (x ^ id), x); + assertEquals((long) (id ^ x), x); + assertEquals((long) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id ^ x), x, + assertEquals((long) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x ^ id), x, + assertEquals((long) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -4037,20 +4074,20 @@ public class Long256VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = ADD_IDENTITY; - Assert.assertEquals((long) (id + id), id, + assertEquals((long) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id + x), x); - Assert.assertEquals((long) (x + id), x); + assertEquals((long) (id + x), x); + assertEquals((long) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id + x), x, + assertEquals((long) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x + id), x, + assertEquals((long) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4139,20 +4176,20 @@ public class Long256VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = MUL_IDENTITY; - Assert.assertEquals((long) (id * id), id, + assertEquals((long) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id * x), x); - Assert.assertEquals((long) (x * id), x); + assertEquals((long) (id * x), x); + assertEquals((long) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id * x), x, + assertEquals((long) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x * id), x, + assertEquals((long) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4241,20 +4278,20 @@ public class Long256VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = MIN_IDENTITY; - Assert.assertEquals((long) Math.min(id, id), id, + assertEquals((long) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) Math.min(id, x), x); - Assert.assertEquals((long) Math.min(x, id), x); + assertEquals((long) Math.min(id, x), x); + assertEquals((long) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) Math.min(id, x), x, + assertEquals((long) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) Math.min(x, id), x, + assertEquals((long) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4343,20 +4380,20 @@ public class Long256VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = MAX_IDENTITY; - Assert.assertEquals((long) Math.max(id, id), id, + assertEquals((long) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) Math.max(id, x), x); - Assert.assertEquals((long) Math.max(x, id), x); + assertEquals((long) Math.max(id, x), x); + assertEquals((long) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) Math.max(id, x), x, + assertEquals((long) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) Math.max(x, id), x, + assertEquals((long) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4445,20 +4482,20 @@ public class Long256VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = UMIN_IDENTITY; - Assert.assertEquals((long) VectorMath.minUnsigned(id, id), id, + assertEquals((long) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((long) VectorMath.minUnsigned(x, id), x); + assertEquals((long) VectorMath.minUnsigned(id, x), x); + assertEquals((long) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) VectorMath.minUnsigned(id, x), x, + assertEquals((long) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) VectorMath.minUnsigned(x, id), x, + assertEquals((long) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4547,20 +4584,20 @@ public class Long256VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = UMAX_IDENTITY; - Assert.assertEquals((long) VectorMath.maxUnsigned(id, id), id, + assertEquals((long) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((long) VectorMath.maxUnsigned(x, id), x); + assertEquals((long) VectorMath.maxUnsigned(id, x), x); + assertEquals((long) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) VectorMath.maxUnsigned(id, x), x, + assertEquals((long) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) VectorMath.maxUnsigned(x, id), x, + assertEquals((long) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4649,20 +4686,20 @@ public class Long256VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4799,20 +4836,20 @@ public class Long256VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = SUADD_IDENTITY; - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((long) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4891,7 +4928,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4911,7 +4948,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4932,7 +4969,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4952,7 +4989,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4971,7 +5008,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4990,7 +5027,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -5013,7 +5050,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -5032,7 +5069,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -5055,7 +5092,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5074,7 +5111,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5093,7 +5130,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5116,7 +5153,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5135,7 +5172,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5158,7 +5195,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5177,7 +5214,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5200,7 +5237,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5219,7 +5256,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5242,7 +5279,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5261,7 +5298,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5284,7 +5321,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5303,7 +5340,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5326,7 +5363,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5345,7 +5382,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5368,7 +5405,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5387,7 +5424,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5410,7 +5447,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5427,7 +5464,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5447,7 +5484,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5464,7 +5501,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5484,7 +5521,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5766,7 +5803,7 @@ public class Long256VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static long[] sliceUnary(long[] a, int origin, int idx) { @@ -6716,10 +6753,10 @@ public class Long256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6748,7 +6785,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6764,7 +6801,7 @@ public class Long256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -6938,7 +6975,7 @@ public class Long256VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -6966,7 +7003,7 @@ public class Long256VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -6981,7 +7018,7 @@ public class Long256VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7084,7 +7121,7 @@ public class Long256VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7110,7 +7147,7 @@ public class Long256VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7124,7 +7161,7 @@ public class Long256VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7146,7 +7183,7 @@ public class Long256VectorTests extends AbstractVectorTest { static void loopBoundLong256VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7154,14 +7191,14 @@ public class Long256VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeLong256VectorTestsSmokeTest() { LongVector av = LongVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Long.SIZE); + assertEquals(elsize, Long.SIZE); } @Test @@ -7215,7 +7252,7 @@ public class Long256VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueLong256VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Long512VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Long512VectorLoadStoreTests.java index 1b70f8d1ba4..dfdafc91d1a 100644 --- a/test/jdk/jdk/incubator/vector/Long512VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Long512VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Long512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 512); + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(long [] actual, long [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long [] actual, long [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(long[] r, long[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Long512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "longProviderForIOOBE") @@ -870,11 +885,11 @@ public class Long512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Long512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Long512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(long[] r, long[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Long512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Long512VectorTests.java b/test/jdk/jdk/incubator/vector/Long512VectorTests.java index 5f8abb5bdd5..a575c80a0ce 100644 --- a/test/jdk/jdk/incubator/vector/Long512VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Long512VectorTests.java @@ -62,6 +62,43 @@ public class Long512VectorTests extends AbstractVectorTest { LongVector.SPECIES_512; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected, long delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(long actual, long expected, long delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(long [] actual, long [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long [] actual, long [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final long CONST_SHIFT = Long.SIZE / 2; @@ -96,10 +133,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +148,13 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { long[] ref = f.apply(a[i]); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +164,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +183,13 @@ public class Long512VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +205,13 @@ public class Long512VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -187,10 +224,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -202,10 +239,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -214,12 +251,12 @@ public class Long512VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -230,20 +267,20 @@ public class Long512VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (long)0); + assertEquals(r[i + k], (long)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (long)0, "at index #" + idx); + assertEquals(r[idx], (long)0, "at index #" + idx); } } } @@ -255,19 +292,19 @@ public class Long512VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (long)0); + assertEquals(r[i + j], (long)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (long)0, "at index #" + idx); + assertEquals(r[idx], (long)0, "at index #" + idx); } } } @@ -283,11 +320,11 @@ public class Long512VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -296,12 +333,12 @@ public class Long512VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -311,17 +348,17 @@ public class Long512VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (long)0); + assertEquals(r[i+j], (long)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -331,17 +368,17 @@ public class Long512VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (long)0); + assertEquals(r[i+j], (long)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -355,10 +392,10 @@ public class Long512VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -370,10 +407,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -385,10 +422,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -409,18 +446,18 @@ public class Long512VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -435,18 +472,18 @@ public class Long512VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -454,10 +491,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -465,10 +502,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -476,10 +513,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -488,10 +525,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -504,10 +541,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -519,10 +556,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -534,10 +571,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -552,10 +589,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -568,11 +605,11 @@ public class Long512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -586,11 +623,11 @@ public class Long512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -612,11 +649,11 @@ public class Long512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -630,11 +667,11 @@ public class Long512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -654,10 +691,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -669,10 +706,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -681,10 +718,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -694,10 +731,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -713,11 +750,11 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -734,11 +771,11 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -749,11 +786,11 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -770,11 +807,11 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -792,13 +829,13 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, i, b, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -819,13 +856,13 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, i, mask, b, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -840,13 +877,13 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { long[] ref = f.apply(r, a, i, mask, b, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -867,13 +904,13 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, origin, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -887,13 +924,13 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -908,13 +945,13 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, mask, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -929,13 +966,13 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, part, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -951,13 +988,13 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, part, mask, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1003,10 +1040,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1016,10 +1053,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1027,10 +1064,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1565,7 +1602,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. LongVector io = (LongVector) SPECIES.broadcast(0).addIndex(1); LongVector io2 = (LongVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); LongVector a = io.add((long)1); //[1,2] LongVector b = a.neg(); //[-1,-2] long[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1580,19 +1617,19 @@ public class Long512VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); LongVector uab0 = zab0.rearrange(unz0,zab1); LongVector uab1 = zab0.rearrange(unz1,zab1); long[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { LongVector io = (LongVector) SPECIES.broadcast(0).addIndex(1); LongVector io2 = (LongVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1607,7 +1644,7 @@ public class Long512VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test @@ -1615,9 +1652,9 @@ public class Long512VectorTests extends AbstractVectorTest { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); VectorSpecies asFloatingSpecies = asFloating.species(); Assert.assertNotEquals(asFloatingSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asFloatingSpecies.length(), SPECIES.length()); - Assert.assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); + assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asFloatingSpecies.length(), SPECIES.length()); + assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); } @Test @@ -3731,20 +3768,20 @@ public class Long512VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = AND_IDENTITY; - Assert.assertEquals((long) (id & id), id, + assertEquals((long) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id & x), x); - Assert.assertEquals((long) (x & id), x); + assertEquals((long) (id & x), x); + assertEquals((long) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id & x), x, + assertEquals((long) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x & id), x, + assertEquals((long) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3833,20 +3870,20 @@ public class Long512VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = OR_IDENTITY; - Assert.assertEquals((long) (id | id), id, + assertEquals((long) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id | x), x); - Assert.assertEquals((long) (x | id), x); + assertEquals((long) (id | x), x); + assertEquals((long) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id | x), x, + assertEquals((long) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x | id), x, + assertEquals((long) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3935,20 +3972,20 @@ public class Long512VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = XOR_IDENTITY; - Assert.assertEquals((long) (id ^ id), id, + assertEquals((long) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id ^ x), x); - Assert.assertEquals((long) (x ^ id), x); + assertEquals((long) (id ^ x), x); + assertEquals((long) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id ^ x), x, + assertEquals((long) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x ^ id), x, + assertEquals((long) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -4037,20 +4074,20 @@ public class Long512VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = ADD_IDENTITY; - Assert.assertEquals((long) (id + id), id, + assertEquals((long) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id + x), x); - Assert.assertEquals((long) (x + id), x); + assertEquals((long) (id + x), x); + assertEquals((long) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id + x), x, + assertEquals((long) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x + id), x, + assertEquals((long) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4139,20 +4176,20 @@ public class Long512VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = MUL_IDENTITY; - Assert.assertEquals((long) (id * id), id, + assertEquals((long) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id * x), x); - Assert.assertEquals((long) (x * id), x); + assertEquals((long) (id * x), x); + assertEquals((long) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id * x), x, + assertEquals((long) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x * id), x, + assertEquals((long) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4241,20 +4278,20 @@ public class Long512VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = MIN_IDENTITY; - Assert.assertEquals((long) Math.min(id, id), id, + assertEquals((long) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) Math.min(id, x), x); - Assert.assertEquals((long) Math.min(x, id), x); + assertEquals((long) Math.min(id, x), x); + assertEquals((long) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) Math.min(id, x), x, + assertEquals((long) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) Math.min(x, id), x, + assertEquals((long) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4343,20 +4380,20 @@ public class Long512VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = MAX_IDENTITY; - Assert.assertEquals((long) Math.max(id, id), id, + assertEquals((long) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) Math.max(id, x), x); - Assert.assertEquals((long) Math.max(x, id), x); + assertEquals((long) Math.max(id, x), x); + assertEquals((long) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) Math.max(id, x), x, + assertEquals((long) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) Math.max(x, id), x, + assertEquals((long) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4445,20 +4482,20 @@ public class Long512VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = UMIN_IDENTITY; - Assert.assertEquals((long) VectorMath.minUnsigned(id, id), id, + assertEquals((long) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((long) VectorMath.minUnsigned(x, id), x); + assertEquals((long) VectorMath.minUnsigned(id, x), x); + assertEquals((long) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) VectorMath.minUnsigned(id, x), x, + assertEquals((long) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) VectorMath.minUnsigned(x, id), x, + assertEquals((long) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4547,20 +4584,20 @@ public class Long512VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = UMAX_IDENTITY; - Assert.assertEquals((long) VectorMath.maxUnsigned(id, id), id, + assertEquals((long) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((long) VectorMath.maxUnsigned(x, id), x); + assertEquals((long) VectorMath.maxUnsigned(id, x), x); + assertEquals((long) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) VectorMath.maxUnsigned(id, x), x, + assertEquals((long) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) VectorMath.maxUnsigned(x, id), x, + assertEquals((long) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4649,20 +4686,20 @@ public class Long512VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4799,20 +4836,20 @@ public class Long512VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = SUADD_IDENTITY; - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((long) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4891,7 +4928,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4911,7 +4948,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4932,7 +4969,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4952,7 +4989,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4971,7 +5008,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4990,7 +5027,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -5013,7 +5050,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -5032,7 +5069,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -5055,7 +5092,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5074,7 +5111,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5093,7 +5130,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5116,7 +5153,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5135,7 +5172,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5158,7 +5195,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5177,7 +5214,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5200,7 +5237,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5219,7 +5256,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5242,7 +5279,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5261,7 +5298,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5284,7 +5321,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5303,7 +5340,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5326,7 +5363,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5345,7 +5382,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5368,7 +5405,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5387,7 +5424,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5410,7 +5447,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5427,7 +5464,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5447,7 +5484,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5464,7 +5501,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5484,7 +5521,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5766,7 +5803,7 @@ public class Long512VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static long[] sliceUnary(long[] a, int origin, int idx) { @@ -6716,10 +6753,10 @@ public class Long512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6748,7 +6785,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6764,7 +6801,7 @@ public class Long512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -6938,7 +6975,7 @@ public class Long512VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -6966,7 +7003,7 @@ public class Long512VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -6981,7 +7018,7 @@ public class Long512VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7084,7 +7121,7 @@ public class Long512VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7110,7 +7147,7 @@ public class Long512VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7124,7 +7161,7 @@ public class Long512VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7146,7 +7183,7 @@ public class Long512VectorTests extends AbstractVectorTest { static void loopBoundLong512VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7154,14 +7191,14 @@ public class Long512VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeLong512VectorTestsSmokeTest() { LongVector av = LongVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Long.SIZE); + assertEquals(elsize, Long.SIZE); } @Test @@ -7215,7 +7252,7 @@ public class Long512VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueLong512VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Long64VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Long64VectorLoadStoreTests.java index 53df5e4e092..c4894fd86a4 100644 --- a/test/jdk/jdk/incubator/vector/Long64VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Long64VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Long64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 64); + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(long [] actual, long [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long [] actual, long [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(long[] r, long[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Long64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "longProviderForIOOBE") @@ -870,11 +885,11 @@ public class Long64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -885,11 +900,11 @@ public class Long64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0, "at index #" + j); } } @@ -905,7 +920,7 @@ public class Long64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(long[] r, long[] a, int[] indexMap) { @@ -918,7 +933,7 @@ public class Long64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Long64VectorTests.java b/test/jdk/jdk/incubator/vector/Long64VectorTests.java index 5f8a9018384..3118ce5a4a2 100644 --- a/test/jdk/jdk/incubator/vector/Long64VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Long64VectorTests.java @@ -62,6 +62,43 @@ public class Long64VectorTests extends AbstractVectorTest { LongVector.SPECIES_64; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected, long delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(long actual, long expected, long delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(long [] actual, long [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long [] actual, long [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final long CONST_SHIFT = Long.SIZE / 2; @@ -96,10 +133,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +148,13 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { long[] ref = f.apply(a[i]); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +164,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +183,13 @@ public class Long64VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +205,13 @@ public class Long64VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -187,10 +224,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -202,10 +239,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -214,12 +251,12 @@ public class Long64VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -230,20 +267,20 @@ public class Long64VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (long)0); + assertEquals(r[i + k], (long)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (long)0, "at index #" + idx); + assertEquals(r[idx], (long)0, "at index #" + idx); } } } @@ -255,19 +292,19 @@ public class Long64VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (long)0); + assertEquals(r[i + j], (long)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (long)0, "at index #" + idx); + assertEquals(r[idx], (long)0, "at index #" + idx); } } } @@ -283,11 +320,11 @@ public class Long64VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -296,12 +333,12 @@ public class Long64VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -311,17 +348,17 @@ public class Long64VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (long)0); + assertEquals(r[i+j], (long)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -331,17 +368,17 @@ public class Long64VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (long)0); + assertEquals(r[i+j], (long)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -355,10 +392,10 @@ public class Long64VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -370,10 +407,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -385,10 +422,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -409,18 +446,18 @@ public class Long64VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -435,18 +472,18 @@ public class Long64VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -454,10 +491,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -465,10 +502,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -476,10 +513,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -488,10 +525,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -504,10 +541,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -519,10 +556,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -534,10 +571,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -552,10 +589,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -568,11 +605,11 @@ public class Long64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -586,11 +623,11 @@ public class Long64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -612,11 +649,11 @@ public class Long64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -630,11 +667,11 @@ public class Long64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -654,10 +691,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -669,10 +706,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -681,10 +718,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -694,10 +731,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -713,11 +750,11 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -734,11 +771,11 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -749,11 +786,11 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -770,11 +807,11 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -792,13 +829,13 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, i, b, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -819,13 +856,13 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, i, mask, b, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -840,13 +877,13 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { long[] ref = f.apply(r, a, i, mask, b, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -867,13 +904,13 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, origin, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -887,13 +924,13 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -908,13 +945,13 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, mask, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -929,13 +966,13 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, part, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -951,13 +988,13 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, part, mask, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1003,10 +1040,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1016,10 +1053,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1027,10 +1064,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1565,7 +1602,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. LongVector io = (LongVector) SPECIES.broadcast(0).addIndex(1); LongVector io2 = (LongVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); LongVector a = io.add((long)1); //[1,2] LongVector b = a.neg(); //[-1,-2] long[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1580,19 +1617,19 @@ public class Long64VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); LongVector uab0 = zab0.rearrange(unz0,zab1); LongVector uab1 = zab0.rearrange(unz1,zab1); long[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { LongVector io = (LongVector) SPECIES.broadcast(0).addIndex(1); LongVector io2 = (LongVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1607,7 +1644,7 @@ public class Long64VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test @@ -1615,9 +1652,9 @@ public class Long64VectorTests extends AbstractVectorTest { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); VectorSpecies asFloatingSpecies = asFloating.species(); Assert.assertNotEquals(asFloatingSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asFloatingSpecies.length(), SPECIES.length()); - Assert.assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); + assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asFloatingSpecies.length(), SPECIES.length()); + assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); } @Test @@ -3731,20 +3768,20 @@ public class Long64VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = AND_IDENTITY; - Assert.assertEquals((long) (id & id), id, + assertEquals((long) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id & x), x); - Assert.assertEquals((long) (x & id), x); + assertEquals((long) (id & x), x); + assertEquals((long) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id & x), x, + assertEquals((long) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x & id), x, + assertEquals((long) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3833,20 +3870,20 @@ public class Long64VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = OR_IDENTITY; - Assert.assertEquals((long) (id | id), id, + assertEquals((long) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id | x), x); - Assert.assertEquals((long) (x | id), x); + assertEquals((long) (id | x), x); + assertEquals((long) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id | x), x, + assertEquals((long) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x | id), x, + assertEquals((long) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3935,20 +3972,20 @@ public class Long64VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = XOR_IDENTITY; - Assert.assertEquals((long) (id ^ id), id, + assertEquals((long) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id ^ x), x); - Assert.assertEquals((long) (x ^ id), x); + assertEquals((long) (id ^ x), x); + assertEquals((long) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id ^ x), x, + assertEquals((long) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x ^ id), x, + assertEquals((long) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -4037,20 +4074,20 @@ public class Long64VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = ADD_IDENTITY; - Assert.assertEquals((long) (id + id), id, + assertEquals((long) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id + x), x); - Assert.assertEquals((long) (x + id), x); + assertEquals((long) (id + x), x); + assertEquals((long) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id + x), x, + assertEquals((long) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x + id), x, + assertEquals((long) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4139,20 +4176,20 @@ public class Long64VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = MUL_IDENTITY; - Assert.assertEquals((long) (id * id), id, + assertEquals((long) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id * x), x); - Assert.assertEquals((long) (x * id), x); + assertEquals((long) (id * x), x); + assertEquals((long) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id * x), x, + assertEquals((long) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x * id), x, + assertEquals((long) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4241,20 +4278,20 @@ public class Long64VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = MIN_IDENTITY; - Assert.assertEquals((long) Math.min(id, id), id, + assertEquals((long) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) Math.min(id, x), x); - Assert.assertEquals((long) Math.min(x, id), x); + assertEquals((long) Math.min(id, x), x); + assertEquals((long) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) Math.min(id, x), x, + assertEquals((long) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) Math.min(x, id), x, + assertEquals((long) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4343,20 +4380,20 @@ public class Long64VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = MAX_IDENTITY; - Assert.assertEquals((long) Math.max(id, id), id, + assertEquals((long) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) Math.max(id, x), x); - Assert.assertEquals((long) Math.max(x, id), x); + assertEquals((long) Math.max(id, x), x); + assertEquals((long) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) Math.max(id, x), x, + assertEquals((long) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) Math.max(x, id), x, + assertEquals((long) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4445,20 +4482,20 @@ public class Long64VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = UMIN_IDENTITY; - Assert.assertEquals((long) VectorMath.minUnsigned(id, id), id, + assertEquals((long) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((long) VectorMath.minUnsigned(x, id), x); + assertEquals((long) VectorMath.minUnsigned(id, x), x); + assertEquals((long) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) VectorMath.minUnsigned(id, x), x, + assertEquals((long) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) VectorMath.minUnsigned(x, id), x, + assertEquals((long) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4547,20 +4584,20 @@ public class Long64VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = UMAX_IDENTITY; - Assert.assertEquals((long) VectorMath.maxUnsigned(id, id), id, + assertEquals((long) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((long) VectorMath.maxUnsigned(x, id), x); + assertEquals((long) VectorMath.maxUnsigned(id, x), x); + assertEquals((long) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) VectorMath.maxUnsigned(id, x), x, + assertEquals((long) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) VectorMath.maxUnsigned(x, id), x, + assertEquals((long) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4649,20 +4686,20 @@ public class Long64VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4799,20 +4836,20 @@ public class Long64VectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = SUADD_IDENTITY; - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((long) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4891,7 +4928,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4911,7 +4948,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4932,7 +4969,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4952,7 +4989,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4971,7 +5008,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4990,7 +5027,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -5013,7 +5050,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -5032,7 +5069,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -5055,7 +5092,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5074,7 +5111,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5093,7 +5130,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5116,7 +5153,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5135,7 +5172,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5158,7 +5195,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5177,7 +5214,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5200,7 +5237,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5219,7 +5256,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5242,7 +5279,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5261,7 +5298,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5284,7 +5321,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5303,7 +5340,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5326,7 +5363,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5345,7 +5382,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5368,7 +5405,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5387,7 +5424,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5410,7 +5447,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5427,7 +5464,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5447,7 +5484,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5464,7 +5501,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5484,7 +5521,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5766,7 +5803,7 @@ public class Long64VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static long[] sliceUnary(long[] a, int origin, int idx) { @@ -6716,10 +6753,10 @@ public class Long64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6748,7 +6785,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6764,7 +6801,7 @@ public class Long64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -6938,7 +6975,7 @@ public class Long64VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -6966,7 +7003,7 @@ public class Long64VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -6981,7 +7018,7 @@ public class Long64VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7084,7 +7121,7 @@ public class Long64VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7110,7 +7147,7 @@ public class Long64VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7124,7 +7161,7 @@ public class Long64VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7146,7 +7183,7 @@ public class Long64VectorTests extends AbstractVectorTest { static void loopBoundLong64VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7154,14 +7191,14 @@ public class Long64VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeLong64VectorTestsSmokeTest() { LongVector av = LongVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Long.SIZE); + assertEquals(elsize, Long.SIZE); } @Test @@ -7215,7 +7252,7 @@ public class Long64VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueLong64VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/LongMaxVectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/LongMaxVectorLoadStoreTests.java index e0f8b548228..6994ee7c770 100644 --- a/test/jdk/jdk/incubator/vector/LongMaxVectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/LongMaxVectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -68,14 +68,29 @@ public class LongMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / Max); + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(long [] actual, long [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long [] actual, long [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(long[] r, long[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (long) 0, "at index #" + i); } } @@ -329,7 +344,7 @@ public class LongMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "longProviderForIOOBE") @@ -877,11 +892,11 @@ public class LongMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -892,11 +907,11 @@ public class LongMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (long) 0, "at index #" + j); } } @@ -912,7 +927,7 @@ public class LongMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(long[] r, long[] a, int[] indexMap) { @@ -925,7 +940,7 @@ public class LongMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/LongMaxVectorTests.java b/test/jdk/jdk/incubator/vector/LongMaxVectorTests.java index 17fee0a7765..0e19a587093 100644 --- a/test/jdk/jdk/incubator/vector/LongMaxVectorTests.java +++ b/test/jdk/jdk/incubator/vector/LongMaxVectorTests.java @@ -62,6 +62,43 @@ public class LongMaxVectorTests extends AbstractVectorTest { LongVector.SPECIES_MAX; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected, long delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(long actual, long expected, long delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(long [] actual, long [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long [] actual, long [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static VectorShape getMaxBit() { return VectorShape.S_Max_BIT; @@ -102,10 +139,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -117,13 +154,13 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { long[] ref = f.apply(a[i]); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -133,10 +170,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -152,13 +189,13 @@ public class LongMaxVectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -174,13 +211,13 @@ public class LongMaxVectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -193,10 +230,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -208,10 +245,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -220,12 +257,12 @@ public class LongMaxVectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -236,20 +273,20 @@ public class LongMaxVectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (long)0); + assertEquals(r[i + k], (long)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (long)0, "at index #" + idx); + assertEquals(r[idx], (long)0, "at index #" + idx); } } } @@ -261,19 +298,19 @@ public class LongMaxVectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (long)0); + assertEquals(r[i + j], (long)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (long)0, "at index #" + idx); + assertEquals(r[idx], (long)0, "at index #" + idx); } } } @@ -289,11 +326,11 @@ public class LongMaxVectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -302,12 +339,12 @@ public class LongMaxVectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -317,17 +354,17 @@ public class LongMaxVectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (long)0); + assertEquals(r[i+j], (long)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -337,17 +374,17 @@ public class LongMaxVectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (long)0); + assertEquals(r[i+j], (long)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (long)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -361,10 +398,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -376,10 +413,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -391,10 +428,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -415,18 +452,18 @@ public class LongMaxVectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -441,18 +478,18 @@ public class LongMaxVectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -460,10 +497,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -471,10 +508,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -482,10 +519,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -494,10 +531,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -510,10 +547,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -525,10 +562,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -540,10 +577,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -558,10 +595,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (long)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -574,11 +611,11 @@ public class LongMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -592,11 +629,11 @@ public class LongMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -618,11 +655,11 @@ public class LongMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -636,11 +673,11 @@ public class LongMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -660,10 +697,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -675,10 +712,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -687,10 +724,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -700,10 +737,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -719,11 +756,11 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -740,11 +777,11 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -755,11 +792,11 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -776,11 +813,11 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -798,13 +835,13 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, i, b, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -825,13 +862,13 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, i, mask, b, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -846,13 +883,13 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { long[] ref = f.apply(r, a, i, mask, b, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -873,13 +910,13 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, origin, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -893,13 +930,13 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -914,13 +951,13 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, mask, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -935,13 +972,13 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, part, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -957,13 +994,13 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { long[] ref = f.apply(a, b, origin, part, mask, i); long[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1009,10 +1046,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1022,10 +1059,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1033,10 +1070,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1571,7 +1608,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Do some zipping and shuffling. LongVector io = (LongVector) SPECIES.broadcast(0).addIndex(1); LongVector io2 = (LongVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); LongVector a = io.add((long)1); //[1,2] LongVector b = a.neg(); //[-1,-2] long[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1586,19 +1623,19 @@ public class LongMaxVectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); LongVector uab0 = zab0.rearrange(unz0,zab1); LongVector uab1 = zab0.rearrange(unz1,zab1); long[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { LongVector io = (LongVector) SPECIES.broadcast(0).addIndex(1); LongVector io2 = (LongVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1613,7 +1650,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test @@ -1621,9 +1658,9 @@ public class LongMaxVectorTests extends AbstractVectorTest { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); VectorSpecies asFloatingSpecies = asFloating.species(); Assert.assertNotEquals(asFloatingSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asFloatingSpecies.length(), SPECIES.length()); - Assert.assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); + assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asFloatingSpecies.length(), SPECIES.length()); + assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); } @Test @@ -3737,20 +3774,20 @@ public class LongMaxVectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = AND_IDENTITY; - Assert.assertEquals((long) (id & id), id, + assertEquals((long) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id & x), x); - Assert.assertEquals((long) (x & id), x); + assertEquals((long) (id & x), x); + assertEquals((long) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id & x), x, + assertEquals((long) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x & id), x, + assertEquals((long) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3839,20 +3876,20 @@ public class LongMaxVectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = OR_IDENTITY; - Assert.assertEquals((long) (id | id), id, + assertEquals((long) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id | x), x); - Assert.assertEquals((long) (x | id), x); + assertEquals((long) (id | x), x); + assertEquals((long) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id | x), x, + assertEquals((long) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x | id), x, + assertEquals((long) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3941,20 +3978,20 @@ public class LongMaxVectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = XOR_IDENTITY; - Assert.assertEquals((long) (id ^ id), id, + assertEquals((long) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id ^ x), x); - Assert.assertEquals((long) (x ^ id), x); + assertEquals((long) (id ^ x), x); + assertEquals((long) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id ^ x), x, + assertEquals((long) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x ^ id), x, + assertEquals((long) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -4043,20 +4080,20 @@ public class LongMaxVectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = ADD_IDENTITY; - Assert.assertEquals((long) (id + id), id, + assertEquals((long) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id + x), x); - Assert.assertEquals((long) (x + id), x); + assertEquals((long) (id + x), x); + assertEquals((long) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id + x), x, + assertEquals((long) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x + id), x, + assertEquals((long) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4145,20 +4182,20 @@ public class LongMaxVectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = MUL_IDENTITY; - Assert.assertEquals((long) (id * id), id, + assertEquals((long) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) (id * x), x); - Assert.assertEquals((long) (x * id), x); + assertEquals((long) (id * x), x); + assertEquals((long) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) (id * x), x, + assertEquals((long) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) (x * id), x, + assertEquals((long) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4247,20 +4284,20 @@ public class LongMaxVectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = MIN_IDENTITY; - Assert.assertEquals((long) Math.min(id, id), id, + assertEquals((long) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) Math.min(id, x), x); - Assert.assertEquals((long) Math.min(x, id), x); + assertEquals((long) Math.min(id, x), x); + assertEquals((long) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) Math.min(id, x), x, + assertEquals((long) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) Math.min(x, id), x, + assertEquals((long) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4349,20 +4386,20 @@ public class LongMaxVectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = MAX_IDENTITY; - Assert.assertEquals((long) Math.max(id, id), id, + assertEquals((long) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) Math.max(id, x), x); - Assert.assertEquals((long) Math.max(x, id), x); + assertEquals((long) Math.max(id, x), x); + assertEquals((long) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) Math.max(id, x), x, + assertEquals((long) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) Math.max(x, id), x, + assertEquals((long) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4451,20 +4488,20 @@ public class LongMaxVectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = UMIN_IDENTITY; - Assert.assertEquals((long) VectorMath.minUnsigned(id, id), id, + assertEquals((long) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((long) VectorMath.minUnsigned(x, id), x); + assertEquals((long) VectorMath.minUnsigned(id, x), x); + assertEquals((long) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) VectorMath.minUnsigned(id, x), x, + assertEquals((long) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) VectorMath.minUnsigned(x, id), x, + assertEquals((long) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4553,20 +4590,20 @@ public class LongMaxVectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = UMAX_IDENTITY; - Assert.assertEquals((long) VectorMath.maxUnsigned(id, id), id, + assertEquals((long) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((long) VectorMath.maxUnsigned(x, id), x); + assertEquals((long) VectorMath.maxUnsigned(id, x), x); + assertEquals((long) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) VectorMath.maxUnsigned(id, x), x, + assertEquals((long) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) VectorMath.maxUnsigned(x, id), x, + assertEquals((long) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4655,20 +4692,20 @@ public class LongMaxVectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4805,20 +4842,20 @@ public class LongMaxVectorTests extends AbstractVectorTest { long[] a = fa.apply(SPECIES.length()); long id = SUADD_IDENTITY; - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((long) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); long x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((long) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((long) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4897,7 +4934,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4917,7 +4954,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4938,7 +4975,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4958,7 +4995,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4977,7 +5014,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4996,7 +5033,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -5019,7 +5056,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -5038,7 +5075,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -5061,7 +5098,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5080,7 +5117,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5099,7 +5136,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5122,7 +5159,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5141,7 +5178,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5164,7 +5201,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5183,7 +5220,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5206,7 +5243,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5225,7 +5262,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5248,7 +5285,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5267,7 +5304,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5290,7 +5327,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5309,7 +5346,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5332,7 +5369,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5351,7 +5388,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5374,7 +5411,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5393,7 +5430,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5416,7 +5453,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5433,7 +5470,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5453,7 +5490,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5470,7 +5507,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5490,7 +5527,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5772,7 +5809,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static long[] sliceUnary(long[] a, int origin, int idx) { @@ -6722,10 +6759,10 @@ public class LongMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6754,7 +6791,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6770,7 +6807,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -6944,7 +6981,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -6972,7 +7009,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -6987,7 +7024,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7090,7 +7127,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7116,7 +7153,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7130,7 +7167,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7152,7 +7189,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { static void loopBoundLongMaxVectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7160,14 +7197,14 @@ public class LongMaxVectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeLongMaxVectorTestsSmokeTest() { LongVector av = LongVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Long.SIZE); + assertEquals(elsize, Long.SIZE); } @Test @@ -7221,7 +7258,7 @@ public class LongMaxVectorTests extends AbstractVectorTest { @Test static void MaskAllTrueLongMaxVectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Short128VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Short128VectorLoadStoreTests.java index 5a71c5550f3..18974b65164 100644 --- a/test/jdk/jdk/incubator/vector/Short128VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Short128VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Short128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 128); + static void assertEquals(short actual, short expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(short actual, short expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(short [] actual, short [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(short [] actual, short [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(short[] r, short[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Short128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "shortProviderForIOOBE") @@ -1114,11 +1129,11 @@ public class Short128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -1129,11 +1144,11 @@ public class Short128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0, "at index #" + j); } } @@ -1149,7 +1164,7 @@ public class Short128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(short[] r, short[] a, int[] indexMap) { @@ -1162,7 +1177,7 @@ public class Short128VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Short128VectorTests.java b/test/jdk/jdk/incubator/vector/Short128VectorTests.java index fb740fedfd4..50dc1931663 100644 --- a/test/jdk/jdk/incubator/vector/Short128VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Short128VectorTests.java @@ -62,6 +62,49 @@ public class Short128VectorTests extends AbstractVectorTest { ShortVector.SPECIES_128; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(short actual, short expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(short actual, short expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(short actual, short expected, short delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(short actual, short expected, short delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(short [] actual, short [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(short [] actual, short [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final short CONST_SHIFT = Short.SIZE / 2; @@ -96,10 +139,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +154,13 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { short[] ref = f.apply(a[i]); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +170,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +189,13 @@ public class Short128VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +211,13 @@ public class Short128VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -190,13 +233,13 @@ public class Short128VectorTests extends AbstractVectorTest { FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -212,13 +255,13 @@ public class Short128VectorTests extends AbstractVectorTest { FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -230,10 +273,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -245,10 +288,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,12 +300,12 @@ public class Short128VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -273,20 +316,20 @@ public class Short128VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (short)0); + assertEquals(r[i + k], (short)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (short)0, "at index #" + idx); + assertEquals(r[idx], (short)0, "at index #" + idx); } } } @@ -298,19 +341,19 @@ public class Short128VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (short)0); + assertEquals(r[i + j], (short)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (short)0, "at index #" + idx); + assertEquals(r[idx], (short)0, "at index #" + idx); } } } @@ -326,11 +369,11 @@ public class Short128VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -339,12 +382,12 @@ public class Short128VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -354,17 +397,17 @@ public class Short128VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (short)0); + assertEquals(r[i+j], (short)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -374,17 +417,17 @@ public class Short128VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (short)0); + assertEquals(r[i+j], (short)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -398,10 +441,10 @@ public class Short128VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -413,10 +456,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -428,10 +471,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -452,18 +495,18 @@ public class Short128VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -478,18 +521,18 @@ public class Short128VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -497,10 +540,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -508,10 +551,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -519,10 +562,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -531,10 +574,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -547,10 +590,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -562,10 +605,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -577,10 +620,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -595,10 +638,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -611,11 +654,11 @@ public class Short128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -629,11 +672,11 @@ public class Short128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -655,11 +698,11 @@ public class Short128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -673,11 +716,11 @@ public class Short128VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -697,10 +740,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -712,10 +755,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -724,10 +767,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -737,10 +780,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -756,11 +799,11 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -777,11 +820,11 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -792,11 +835,11 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -813,11 +856,11 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -835,13 +878,13 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, i, b, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -862,13 +905,13 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, i, mask, b, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -883,13 +926,13 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { short[] ref = f.apply(r, a, i, mask, b, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -910,13 +953,13 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, origin, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -930,13 +973,13 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -951,13 +994,13 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, mask, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -972,13 +1015,13 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, part, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -994,13 +1037,13 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, part, mask, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1013,10 +1056,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1026,10 +1069,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1037,10 +1080,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1577,7 +1620,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. ShortVector io = (ShortVector) SPECIES.broadcast(0).addIndex(1); ShortVector io2 = (ShortVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); ShortVector a = io.add((short)1); //[1,2] ShortVector b = a.neg(); //[-1,-2] short[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1592,19 +1635,19 @@ public class Short128VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); ShortVector uab0 = zab0.rearrange(unz0,zab1); ShortVector uab1 = zab0.rearrange(unz1,zab1); short[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { ShortVector io = (ShortVector) SPECIES.broadcast(0).addIndex(1); ShortVector io2 = (ShortVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1619,7 +1662,7 @@ public class Short128VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test(expectedExceptions = UnsupportedOperationException.class) @@ -3656,20 +3699,20 @@ public class Short128VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = AND_IDENTITY; - Assert.assertEquals((short) (id & id), id, + assertEquals((short) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id & x), x); - Assert.assertEquals((short) (x & id), x); + assertEquals((short) (id & x), x); + assertEquals((short) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id & x), x, + assertEquals((short) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x & id), x, + assertEquals((short) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3758,20 +3801,20 @@ public class Short128VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = OR_IDENTITY; - Assert.assertEquals((short) (id | id), id, + assertEquals((short) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id | x), x); - Assert.assertEquals((short) (x | id), x); + assertEquals((short) (id | x), x); + assertEquals((short) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id | x), x, + assertEquals((short) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x | id), x, + assertEquals((short) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3860,20 +3903,20 @@ public class Short128VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = XOR_IDENTITY; - Assert.assertEquals((short) (id ^ id), id, + assertEquals((short) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id ^ x), x); - Assert.assertEquals((short) (x ^ id), x); + assertEquals((short) (id ^ x), x); + assertEquals((short) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id ^ x), x, + assertEquals((short) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x ^ id), x, + assertEquals((short) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -3962,20 +4005,20 @@ public class Short128VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = ADD_IDENTITY; - Assert.assertEquals((short) (id + id), id, + assertEquals((short) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id + x), x); - Assert.assertEquals((short) (x + id), x); + assertEquals((short) (id + x), x); + assertEquals((short) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id + x), x, + assertEquals((short) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x + id), x, + assertEquals((short) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4064,20 +4107,20 @@ public class Short128VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = MUL_IDENTITY; - Assert.assertEquals((short) (id * id), id, + assertEquals((short) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id * x), x); - Assert.assertEquals((short) (x * id), x); + assertEquals((short) (id * x), x); + assertEquals((short) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id * x), x, + assertEquals((short) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x * id), x, + assertEquals((short) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4166,20 +4209,20 @@ public class Short128VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = MIN_IDENTITY; - Assert.assertEquals((short) Math.min(id, id), id, + assertEquals((short) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) Math.min(id, x), x); - Assert.assertEquals((short) Math.min(x, id), x); + assertEquals((short) Math.min(id, x), x); + assertEquals((short) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) Math.min(id, x), x, + assertEquals((short) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) Math.min(x, id), x, + assertEquals((short) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4268,20 +4311,20 @@ public class Short128VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = MAX_IDENTITY; - Assert.assertEquals((short) Math.max(id, id), id, + assertEquals((short) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) Math.max(id, x), x); - Assert.assertEquals((short) Math.max(x, id), x); + assertEquals((short) Math.max(id, x), x); + assertEquals((short) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) Math.max(id, x), x, + assertEquals((short) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) Math.max(x, id), x, + assertEquals((short) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4370,20 +4413,20 @@ public class Short128VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = UMIN_IDENTITY; - Assert.assertEquals((short) VectorMath.minUnsigned(id, id), id, + assertEquals((short) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((short) VectorMath.minUnsigned(x, id), x); + assertEquals((short) VectorMath.minUnsigned(id, x), x); + assertEquals((short) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) VectorMath.minUnsigned(id, x), x, + assertEquals((short) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) VectorMath.minUnsigned(x, id), x, + assertEquals((short) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4472,20 +4515,20 @@ public class Short128VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = UMAX_IDENTITY; - Assert.assertEquals((short) VectorMath.maxUnsigned(id, id), id, + assertEquals((short) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((short) VectorMath.maxUnsigned(x, id), x); + assertEquals((short) VectorMath.maxUnsigned(id, x), x); + assertEquals((short) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) VectorMath.maxUnsigned(id, x), x, + assertEquals((short) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) VectorMath.maxUnsigned(x, id), x, + assertEquals((short) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4574,20 +4617,20 @@ public class Short128VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4724,20 +4767,20 @@ public class Short128VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = SUADD_IDENTITY; - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((short) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4816,7 +4859,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4836,7 +4879,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4857,7 +4900,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4877,7 +4920,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4896,7 +4939,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4915,7 +4958,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4938,7 +4981,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -4957,7 +5000,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -4980,7 +5023,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -4999,7 +5042,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5018,7 +5061,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5041,7 +5084,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5060,7 +5103,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5083,7 +5126,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5102,7 +5145,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5125,7 +5168,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5144,7 +5187,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5167,7 +5210,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5186,7 +5229,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5209,7 +5252,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5228,7 +5271,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5251,7 +5294,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5270,7 +5313,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5293,7 +5336,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5312,7 +5355,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5335,7 +5378,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5352,7 +5395,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5372,7 +5415,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5388,7 +5431,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (short)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (short)((long)b[i])); } } } @@ -5408,7 +5451,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (short)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (short)((long)b[i]))); } } } @@ -5424,7 +5467,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5444,7 +5487,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5460,7 +5503,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (short)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (short)((long)b[i])); } } } @@ -5480,7 +5523,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (short)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (short)((long)b[i]))); } } } @@ -5761,7 +5804,7 @@ public class Short128VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static short[] sliceUnary(short[] a, int origin, int idx) { @@ -6711,10 +6754,10 @@ public class Short128VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6743,7 +6786,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6759,7 +6802,7 @@ public class Short128VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -6999,7 +7042,7 @@ public class Short128VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -7027,7 +7070,7 @@ public class Short128VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -7042,7 +7085,7 @@ public class Short128VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7145,7 +7188,7 @@ public class Short128VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7171,7 +7214,7 @@ public class Short128VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7185,7 +7228,7 @@ public class Short128VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7207,7 +7250,7 @@ public class Short128VectorTests extends AbstractVectorTest { static void loopBoundShort128VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7215,14 +7258,14 @@ public class Short128VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeShort128VectorTestsSmokeTest() { ShortVector av = ShortVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Short.SIZE); + assertEquals(elsize, Short.SIZE); } @Test @@ -7276,7 +7319,7 @@ public class Short128VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueShort128VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Short256VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Short256VectorLoadStoreTests.java index 335d51add59..a7f1d67659e 100644 --- a/test/jdk/jdk/incubator/vector/Short256VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Short256VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Short256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 256); + static void assertEquals(short actual, short expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(short actual, short expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(short [] actual, short [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(short [] actual, short [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(short[] r, short[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Short256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "shortProviderForIOOBE") @@ -1114,11 +1129,11 @@ public class Short256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -1129,11 +1144,11 @@ public class Short256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0, "at index #" + j); } } @@ -1149,7 +1164,7 @@ public class Short256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(short[] r, short[] a, int[] indexMap) { @@ -1162,7 +1177,7 @@ public class Short256VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Short256VectorTests.java b/test/jdk/jdk/incubator/vector/Short256VectorTests.java index cd6aa113b84..b23014665af 100644 --- a/test/jdk/jdk/incubator/vector/Short256VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Short256VectorTests.java @@ -62,6 +62,49 @@ public class Short256VectorTests extends AbstractVectorTest { ShortVector.SPECIES_256; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(short actual, short expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(short actual, short expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(short actual, short expected, short delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(short actual, short expected, short delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(short [] actual, short [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(short [] actual, short [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final short CONST_SHIFT = Short.SIZE / 2; @@ -96,10 +139,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +154,13 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { short[] ref = f.apply(a[i]); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +170,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +189,13 @@ public class Short256VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +211,13 @@ public class Short256VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -190,13 +233,13 @@ public class Short256VectorTests extends AbstractVectorTest { FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -212,13 +255,13 @@ public class Short256VectorTests extends AbstractVectorTest { FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -230,10 +273,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -245,10 +288,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,12 +300,12 @@ public class Short256VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -273,20 +316,20 @@ public class Short256VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (short)0); + assertEquals(r[i + k], (short)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (short)0, "at index #" + idx); + assertEquals(r[idx], (short)0, "at index #" + idx); } } } @@ -298,19 +341,19 @@ public class Short256VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (short)0); + assertEquals(r[i + j], (short)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (short)0, "at index #" + idx); + assertEquals(r[idx], (short)0, "at index #" + idx); } } } @@ -326,11 +369,11 @@ public class Short256VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -339,12 +382,12 @@ public class Short256VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -354,17 +397,17 @@ public class Short256VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (short)0); + assertEquals(r[i+j], (short)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -374,17 +417,17 @@ public class Short256VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (short)0); + assertEquals(r[i+j], (short)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -398,10 +441,10 @@ public class Short256VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -413,10 +456,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -428,10 +471,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -452,18 +495,18 @@ public class Short256VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -478,18 +521,18 @@ public class Short256VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -497,10 +540,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -508,10 +551,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -519,10 +562,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -531,10 +574,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -547,10 +590,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -562,10 +605,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -577,10 +620,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -595,10 +638,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -611,11 +654,11 @@ public class Short256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -629,11 +672,11 @@ public class Short256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -655,11 +698,11 @@ public class Short256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -673,11 +716,11 @@ public class Short256VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -697,10 +740,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -712,10 +755,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -724,10 +767,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -737,10 +780,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -756,11 +799,11 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -777,11 +820,11 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -792,11 +835,11 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -813,11 +856,11 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -835,13 +878,13 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, i, b, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -862,13 +905,13 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, i, mask, b, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -883,13 +926,13 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { short[] ref = f.apply(r, a, i, mask, b, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -910,13 +953,13 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, origin, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -930,13 +973,13 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -951,13 +994,13 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, mask, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -972,13 +1015,13 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, part, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -994,13 +1037,13 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, part, mask, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1013,10 +1056,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1026,10 +1069,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1037,10 +1080,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1577,7 +1620,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. ShortVector io = (ShortVector) SPECIES.broadcast(0).addIndex(1); ShortVector io2 = (ShortVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); ShortVector a = io.add((short)1); //[1,2] ShortVector b = a.neg(); //[-1,-2] short[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1592,19 +1635,19 @@ public class Short256VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); ShortVector uab0 = zab0.rearrange(unz0,zab1); ShortVector uab1 = zab0.rearrange(unz1,zab1); short[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { ShortVector io = (ShortVector) SPECIES.broadcast(0).addIndex(1); ShortVector io2 = (ShortVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1619,7 +1662,7 @@ public class Short256VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test(expectedExceptions = UnsupportedOperationException.class) @@ -3656,20 +3699,20 @@ public class Short256VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = AND_IDENTITY; - Assert.assertEquals((short) (id & id), id, + assertEquals((short) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id & x), x); - Assert.assertEquals((short) (x & id), x); + assertEquals((short) (id & x), x); + assertEquals((short) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id & x), x, + assertEquals((short) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x & id), x, + assertEquals((short) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3758,20 +3801,20 @@ public class Short256VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = OR_IDENTITY; - Assert.assertEquals((short) (id | id), id, + assertEquals((short) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id | x), x); - Assert.assertEquals((short) (x | id), x); + assertEquals((short) (id | x), x); + assertEquals((short) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id | x), x, + assertEquals((short) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x | id), x, + assertEquals((short) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3860,20 +3903,20 @@ public class Short256VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = XOR_IDENTITY; - Assert.assertEquals((short) (id ^ id), id, + assertEquals((short) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id ^ x), x); - Assert.assertEquals((short) (x ^ id), x); + assertEquals((short) (id ^ x), x); + assertEquals((short) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id ^ x), x, + assertEquals((short) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x ^ id), x, + assertEquals((short) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -3962,20 +4005,20 @@ public class Short256VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = ADD_IDENTITY; - Assert.assertEquals((short) (id + id), id, + assertEquals((short) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id + x), x); - Assert.assertEquals((short) (x + id), x); + assertEquals((short) (id + x), x); + assertEquals((short) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id + x), x, + assertEquals((short) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x + id), x, + assertEquals((short) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4064,20 +4107,20 @@ public class Short256VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = MUL_IDENTITY; - Assert.assertEquals((short) (id * id), id, + assertEquals((short) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id * x), x); - Assert.assertEquals((short) (x * id), x); + assertEquals((short) (id * x), x); + assertEquals((short) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id * x), x, + assertEquals((short) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x * id), x, + assertEquals((short) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4166,20 +4209,20 @@ public class Short256VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = MIN_IDENTITY; - Assert.assertEquals((short) Math.min(id, id), id, + assertEquals((short) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) Math.min(id, x), x); - Assert.assertEquals((short) Math.min(x, id), x); + assertEquals((short) Math.min(id, x), x); + assertEquals((short) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) Math.min(id, x), x, + assertEquals((short) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) Math.min(x, id), x, + assertEquals((short) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4268,20 +4311,20 @@ public class Short256VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = MAX_IDENTITY; - Assert.assertEquals((short) Math.max(id, id), id, + assertEquals((short) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) Math.max(id, x), x); - Assert.assertEquals((short) Math.max(x, id), x); + assertEquals((short) Math.max(id, x), x); + assertEquals((short) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) Math.max(id, x), x, + assertEquals((short) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) Math.max(x, id), x, + assertEquals((short) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4370,20 +4413,20 @@ public class Short256VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = UMIN_IDENTITY; - Assert.assertEquals((short) VectorMath.minUnsigned(id, id), id, + assertEquals((short) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((short) VectorMath.minUnsigned(x, id), x); + assertEquals((short) VectorMath.minUnsigned(id, x), x); + assertEquals((short) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) VectorMath.minUnsigned(id, x), x, + assertEquals((short) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) VectorMath.minUnsigned(x, id), x, + assertEquals((short) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4472,20 +4515,20 @@ public class Short256VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = UMAX_IDENTITY; - Assert.assertEquals((short) VectorMath.maxUnsigned(id, id), id, + assertEquals((short) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((short) VectorMath.maxUnsigned(x, id), x); + assertEquals((short) VectorMath.maxUnsigned(id, x), x); + assertEquals((short) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) VectorMath.maxUnsigned(id, x), x, + assertEquals((short) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) VectorMath.maxUnsigned(x, id), x, + assertEquals((short) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4574,20 +4617,20 @@ public class Short256VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4724,20 +4767,20 @@ public class Short256VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = SUADD_IDENTITY; - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((short) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4816,7 +4859,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4836,7 +4879,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4857,7 +4900,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4877,7 +4920,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4896,7 +4939,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4915,7 +4958,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4938,7 +4981,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -4957,7 +5000,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -4980,7 +5023,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -4999,7 +5042,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5018,7 +5061,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5041,7 +5084,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5060,7 +5103,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5083,7 +5126,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5102,7 +5145,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5125,7 +5168,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5144,7 +5187,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5167,7 +5210,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5186,7 +5229,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5209,7 +5252,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5228,7 +5271,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5251,7 +5294,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5270,7 +5313,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5293,7 +5336,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5312,7 +5355,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5335,7 +5378,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5352,7 +5395,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5372,7 +5415,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5388,7 +5431,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (short)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (short)((long)b[i])); } } } @@ -5408,7 +5451,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (short)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (short)((long)b[i]))); } } } @@ -5424,7 +5467,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5444,7 +5487,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5460,7 +5503,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (short)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (short)((long)b[i])); } } } @@ -5480,7 +5523,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (short)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (short)((long)b[i]))); } } } @@ -5761,7 +5804,7 @@ public class Short256VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static short[] sliceUnary(short[] a, int origin, int idx) { @@ -6711,10 +6754,10 @@ public class Short256VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6743,7 +6786,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6759,7 +6802,7 @@ public class Short256VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -6999,7 +7042,7 @@ public class Short256VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -7027,7 +7070,7 @@ public class Short256VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -7042,7 +7085,7 @@ public class Short256VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7145,7 +7188,7 @@ public class Short256VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7171,7 +7214,7 @@ public class Short256VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7185,7 +7228,7 @@ public class Short256VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7207,7 +7250,7 @@ public class Short256VectorTests extends AbstractVectorTest { static void loopBoundShort256VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7215,14 +7258,14 @@ public class Short256VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeShort256VectorTestsSmokeTest() { ShortVector av = ShortVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Short.SIZE); + assertEquals(elsize, Short.SIZE); } @Test @@ -7276,7 +7319,7 @@ public class Short256VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueShort256VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Short512VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Short512VectorLoadStoreTests.java index 7a273986bef..accbe0008b5 100644 --- a/test/jdk/jdk/incubator/vector/Short512VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Short512VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Short512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 512); + static void assertEquals(short actual, short expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(short actual, short expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(short [] actual, short [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(short [] actual, short [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(short[] r, short[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Short512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "shortProviderForIOOBE") @@ -1114,11 +1129,11 @@ public class Short512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -1129,11 +1144,11 @@ public class Short512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0, "at index #" + j); } } @@ -1149,7 +1164,7 @@ public class Short512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(short[] r, short[] a, int[] indexMap) { @@ -1162,7 +1177,7 @@ public class Short512VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Short512VectorTests.java b/test/jdk/jdk/incubator/vector/Short512VectorTests.java index 722f826f3e9..7a08de22cb8 100644 --- a/test/jdk/jdk/incubator/vector/Short512VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Short512VectorTests.java @@ -62,6 +62,49 @@ public class Short512VectorTests extends AbstractVectorTest { ShortVector.SPECIES_512; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(short actual, short expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(short actual, short expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(short actual, short expected, short delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(short actual, short expected, short delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(short [] actual, short [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(short [] actual, short [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final short CONST_SHIFT = Short.SIZE / 2; @@ -96,10 +139,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +154,13 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { short[] ref = f.apply(a[i]); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +170,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +189,13 @@ public class Short512VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +211,13 @@ public class Short512VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -190,13 +233,13 @@ public class Short512VectorTests extends AbstractVectorTest { FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -212,13 +255,13 @@ public class Short512VectorTests extends AbstractVectorTest { FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -230,10 +273,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -245,10 +288,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,12 +300,12 @@ public class Short512VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -273,20 +316,20 @@ public class Short512VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (short)0); + assertEquals(r[i + k], (short)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (short)0, "at index #" + idx); + assertEquals(r[idx], (short)0, "at index #" + idx); } } } @@ -298,19 +341,19 @@ public class Short512VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (short)0); + assertEquals(r[i + j], (short)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (short)0, "at index #" + idx); + assertEquals(r[idx], (short)0, "at index #" + idx); } } } @@ -326,11 +369,11 @@ public class Short512VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -339,12 +382,12 @@ public class Short512VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -354,17 +397,17 @@ public class Short512VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (short)0); + assertEquals(r[i+j], (short)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -374,17 +417,17 @@ public class Short512VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (short)0); + assertEquals(r[i+j], (short)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -398,10 +441,10 @@ public class Short512VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -413,10 +456,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -428,10 +471,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -452,18 +495,18 @@ public class Short512VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -478,18 +521,18 @@ public class Short512VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -497,10 +540,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -508,10 +551,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -519,10 +562,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -531,10 +574,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -547,10 +590,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -562,10 +605,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -577,10 +620,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -595,10 +638,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -611,11 +654,11 @@ public class Short512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -629,11 +672,11 @@ public class Short512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -655,11 +698,11 @@ public class Short512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -673,11 +716,11 @@ public class Short512VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -697,10 +740,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -712,10 +755,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -724,10 +767,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -737,10 +780,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -756,11 +799,11 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -777,11 +820,11 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -792,11 +835,11 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -813,11 +856,11 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -835,13 +878,13 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, i, b, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -862,13 +905,13 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, i, mask, b, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -883,13 +926,13 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { short[] ref = f.apply(r, a, i, mask, b, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -910,13 +953,13 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, origin, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -930,13 +973,13 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -951,13 +994,13 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, mask, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -972,13 +1015,13 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, part, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -994,13 +1037,13 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, part, mask, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1013,10 +1056,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1026,10 +1069,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1037,10 +1080,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1577,7 +1620,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. ShortVector io = (ShortVector) SPECIES.broadcast(0).addIndex(1); ShortVector io2 = (ShortVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); ShortVector a = io.add((short)1); //[1,2] ShortVector b = a.neg(); //[-1,-2] short[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1592,19 +1635,19 @@ public class Short512VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); ShortVector uab0 = zab0.rearrange(unz0,zab1); ShortVector uab1 = zab0.rearrange(unz1,zab1); short[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { ShortVector io = (ShortVector) SPECIES.broadcast(0).addIndex(1); ShortVector io2 = (ShortVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1619,7 +1662,7 @@ public class Short512VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test(expectedExceptions = UnsupportedOperationException.class) @@ -3656,20 +3699,20 @@ public class Short512VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = AND_IDENTITY; - Assert.assertEquals((short) (id & id), id, + assertEquals((short) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id & x), x); - Assert.assertEquals((short) (x & id), x); + assertEquals((short) (id & x), x); + assertEquals((short) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id & x), x, + assertEquals((short) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x & id), x, + assertEquals((short) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3758,20 +3801,20 @@ public class Short512VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = OR_IDENTITY; - Assert.assertEquals((short) (id | id), id, + assertEquals((short) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id | x), x); - Assert.assertEquals((short) (x | id), x); + assertEquals((short) (id | x), x); + assertEquals((short) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id | x), x, + assertEquals((short) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x | id), x, + assertEquals((short) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3860,20 +3903,20 @@ public class Short512VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = XOR_IDENTITY; - Assert.assertEquals((short) (id ^ id), id, + assertEquals((short) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id ^ x), x); - Assert.assertEquals((short) (x ^ id), x); + assertEquals((short) (id ^ x), x); + assertEquals((short) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id ^ x), x, + assertEquals((short) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x ^ id), x, + assertEquals((short) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -3962,20 +4005,20 @@ public class Short512VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = ADD_IDENTITY; - Assert.assertEquals((short) (id + id), id, + assertEquals((short) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id + x), x); - Assert.assertEquals((short) (x + id), x); + assertEquals((short) (id + x), x); + assertEquals((short) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id + x), x, + assertEquals((short) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x + id), x, + assertEquals((short) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4064,20 +4107,20 @@ public class Short512VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = MUL_IDENTITY; - Assert.assertEquals((short) (id * id), id, + assertEquals((short) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id * x), x); - Assert.assertEquals((short) (x * id), x); + assertEquals((short) (id * x), x); + assertEquals((short) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id * x), x, + assertEquals((short) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x * id), x, + assertEquals((short) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4166,20 +4209,20 @@ public class Short512VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = MIN_IDENTITY; - Assert.assertEquals((short) Math.min(id, id), id, + assertEquals((short) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) Math.min(id, x), x); - Assert.assertEquals((short) Math.min(x, id), x); + assertEquals((short) Math.min(id, x), x); + assertEquals((short) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) Math.min(id, x), x, + assertEquals((short) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) Math.min(x, id), x, + assertEquals((short) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4268,20 +4311,20 @@ public class Short512VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = MAX_IDENTITY; - Assert.assertEquals((short) Math.max(id, id), id, + assertEquals((short) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) Math.max(id, x), x); - Assert.assertEquals((short) Math.max(x, id), x); + assertEquals((short) Math.max(id, x), x); + assertEquals((short) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) Math.max(id, x), x, + assertEquals((short) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) Math.max(x, id), x, + assertEquals((short) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4370,20 +4413,20 @@ public class Short512VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = UMIN_IDENTITY; - Assert.assertEquals((short) VectorMath.minUnsigned(id, id), id, + assertEquals((short) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((short) VectorMath.minUnsigned(x, id), x); + assertEquals((short) VectorMath.minUnsigned(id, x), x); + assertEquals((short) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) VectorMath.minUnsigned(id, x), x, + assertEquals((short) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) VectorMath.minUnsigned(x, id), x, + assertEquals((short) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4472,20 +4515,20 @@ public class Short512VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = UMAX_IDENTITY; - Assert.assertEquals((short) VectorMath.maxUnsigned(id, id), id, + assertEquals((short) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((short) VectorMath.maxUnsigned(x, id), x); + assertEquals((short) VectorMath.maxUnsigned(id, x), x); + assertEquals((short) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) VectorMath.maxUnsigned(id, x), x, + assertEquals((short) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) VectorMath.maxUnsigned(x, id), x, + assertEquals((short) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4574,20 +4617,20 @@ public class Short512VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4724,20 +4767,20 @@ public class Short512VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = SUADD_IDENTITY; - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((short) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4816,7 +4859,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4836,7 +4879,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4857,7 +4900,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4877,7 +4920,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4896,7 +4939,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4915,7 +4958,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4938,7 +4981,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -4957,7 +5000,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -4980,7 +5023,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -4999,7 +5042,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5018,7 +5061,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5041,7 +5084,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5060,7 +5103,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5083,7 +5126,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5102,7 +5145,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5125,7 +5168,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5144,7 +5187,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5167,7 +5210,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5186,7 +5229,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5209,7 +5252,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5228,7 +5271,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5251,7 +5294,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5270,7 +5313,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5293,7 +5336,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5312,7 +5355,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5335,7 +5378,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5352,7 +5395,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5372,7 +5415,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5388,7 +5431,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (short)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (short)((long)b[i])); } } } @@ -5408,7 +5451,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (short)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (short)((long)b[i]))); } } } @@ -5424,7 +5467,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5444,7 +5487,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5460,7 +5503,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (short)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (short)((long)b[i])); } } } @@ -5480,7 +5523,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (short)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (short)((long)b[i]))); } } } @@ -5761,7 +5804,7 @@ public class Short512VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static short[] sliceUnary(short[] a, int origin, int idx) { @@ -6711,10 +6754,10 @@ public class Short512VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6743,7 +6786,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6759,7 +6802,7 @@ public class Short512VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -6999,7 +7042,7 @@ public class Short512VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -7027,7 +7070,7 @@ public class Short512VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -7042,7 +7085,7 @@ public class Short512VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7145,7 +7188,7 @@ public class Short512VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7171,7 +7214,7 @@ public class Short512VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7185,7 +7228,7 @@ public class Short512VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7207,7 +7250,7 @@ public class Short512VectorTests extends AbstractVectorTest { static void loopBoundShort512VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7215,14 +7258,14 @@ public class Short512VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeShort512VectorTestsSmokeTest() { ShortVector av = ShortVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Short.SIZE); + assertEquals(elsize, Short.SIZE); } @Test @@ -7276,7 +7319,7 @@ public class Short512VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueShort512VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/Short64VectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/Short64VectorLoadStoreTests.java index 952d71c80a6..063b3e8ca61 100644 --- a/test/jdk/jdk/incubator/vector/Short64VectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/Short64VectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,14 +61,29 @@ public class Short64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 64); + static void assertEquals(short actual, short expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(short actual, short expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(short [] actual, short [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(short [] actual, short [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(short[] r, short[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0, "at index #" + i); } } @@ -322,7 +337,7 @@ public class Short64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "shortProviderForIOOBE") @@ -1114,11 +1129,11 @@ public class Short64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -1129,11 +1144,11 @@ public class Short64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0, "at index #" + j); } } @@ -1149,7 +1164,7 @@ public class Short64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(short[] r, short[] a, int[] indexMap) { @@ -1162,7 +1177,7 @@ public class Short64VectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/Short64VectorTests.java b/test/jdk/jdk/incubator/vector/Short64VectorTests.java index 9ec8ac08789..4181dbce164 100644 --- a/test/jdk/jdk/incubator/vector/Short64VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Short64VectorTests.java @@ -62,6 +62,49 @@ public class Short64VectorTests extends AbstractVectorTest { ShortVector.SPECIES_64; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(short actual, short expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(short actual, short expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(short actual, short expected, short delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(short actual, short expected, short delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(short [] actual, short [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(short [] actual, short [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + private static final short CONST_SHIFT = Short.SIZE / 2; @@ -96,10 +139,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -111,13 +154,13 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { short[] ref = f.apply(a[i]); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -127,10 +170,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -146,13 +189,13 @@ public class Short64VectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -168,13 +211,13 @@ public class Short64VectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -190,13 +233,13 @@ public class Short64VectorTests extends AbstractVectorTest { FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -212,13 +255,13 @@ public class Short64VectorTests extends AbstractVectorTest { FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -230,10 +273,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -245,10 +288,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -257,12 +300,12 @@ public class Short64VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -273,20 +316,20 @@ public class Short64VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (short)0); + assertEquals(r[i + k], (short)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (short)0, "at index #" + idx); + assertEquals(r[idx], (short)0, "at index #" + idx); } } } @@ -298,19 +341,19 @@ public class Short64VectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (short)0); + assertEquals(r[i + j], (short)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (short)0, "at index #" + idx); + assertEquals(r[idx], (short)0, "at index #" + idx); } } } @@ -326,11 +369,11 @@ public class Short64VectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -339,12 +382,12 @@ public class Short64VectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -354,17 +397,17 @@ public class Short64VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (short)0); + assertEquals(r[i+j], (short)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -374,17 +417,17 @@ public class Short64VectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (short)0); + assertEquals(r[i+j], (short)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -398,10 +441,10 @@ public class Short64VectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -413,10 +456,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -428,10 +471,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -452,18 +495,18 @@ public class Short64VectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -478,18 +521,18 @@ public class Short64VectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -497,10 +540,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -508,10 +551,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -519,10 +562,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -531,10 +574,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -547,10 +590,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -562,10 +605,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -577,10 +620,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -595,10 +638,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -611,11 +654,11 @@ public class Short64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -629,11 +672,11 @@ public class Short64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -655,11 +698,11 @@ public class Short64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -673,11 +716,11 @@ public class Short64VectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -697,10 +740,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -712,10 +755,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -724,10 +767,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -737,10 +780,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -756,11 +799,11 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -777,11 +820,11 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -792,11 +835,11 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -813,11 +856,11 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -835,13 +878,13 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, i, b, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -862,13 +905,13 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, i, mask, b, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -883,13 +926,13 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { short[] ref = f.apply(r, a, i, mask, b, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -910,13 +953,13 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, origin, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -930,13 +973,13 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -951,13 +994,13 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, mask, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -972,13 +1015,13 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, part, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -994,13 +1037,13 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, part, mask, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1013,10 +1056,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1026,10 +1069,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1037,10 +1080,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1577,7 +1620,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Do some zipping and shuffling. ShortVector io = (ShortVector) SPECIES.broadcast(0).addIndex(1); ShortVector io2 = (ShortVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); ShortVector a = io.add((short)1); //[1,2] ShortVector b = a.neg(); //[-1,-2] short[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1592,19 +1635,19 @@ public class Short64VectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); ShortVector uab0 = zab0.rearrange(unz0,zab1); ShortVector uab1 = zab0.rearrange(unz1,zab1); short[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { ShortVector io = (ShortVector) SPECIES.broadcast(0).addIndex(1); ShortVector io2 = (ShortVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1619,7 +1662,7 @@ public class Short64VectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test(expectedExceptions = UnsupportedOperationException.class) @@ -3656,20 +3699,20 @@ public class Short64VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = AND_IDENTITY; - Assert.assertEquals((short) (id & id), id, + assertEquals((short) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id & x), x); - Assert.assertEquals((short) (x & id), x); + assertEquals((short) (id & x), x); + assertEquals((short) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id & x), x, + assertEquals((short) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x & id), x, + assertEquals((short) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3758,20 +3801,20 @@ public class Short64VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = OR_IDENTITY; - Assert.assertEquals((short) (id | id), id, + assertEquals((short) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id | x), x); - Assert.assertEquals((short) (x | id), x); + assertEquals((short) (id | x), x); + assertEquals((short) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id | x), x, + assertEquals((short) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x | id), x, + assertEquals((short) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3860,20 +3903,20 @@ public class Short64VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = XOR_IDENTITY; - Assert.assertEquals((short) (id ^ id), id, + assertEquals((short) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id ^ x), x); - Assert.assertEquals((short) (x ^ id), x); + assertEquals((short) (id ^ x), x); + assertEquals((short) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id ^ x), x, + assertEquals((short) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x ^ id), x, + assertEquals((short) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -3962,20 +4005,20 @@ public class Short64VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = ADD_IDENTITY; - Assert.assertEquals((short) (id + id), id, + assertEquals((short) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id + x), x); - Assert.assertEquals((short) (x + id), x); + assertEquals((short) (id + x), x); + assertEquals((short) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id + x), x, + assertEquals((short) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x + id), x, + assertEquals((short) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4064,20 +4107,20 @@ public class Short64VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = MUL_IDENTITY; - Assert.assertEquals((short) (id * id), id, + assertEquals((short) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id * x), x); - Assert.assertEquals((short) (x * id), x); + assertEquals((short) (id * x), x); + assertEquals((short) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id * x), x, + assertEquals((short) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x * id), x, + assertEquals((short) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4166,20 +4209,20 @@ public class Short64VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = MIN_IDENTITY; - Assert.assertEquals((short) Math.min(id, id), id, + assertEquals((short) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) Math.min(id, x), x); - Assert.assertEquals((short) Math.min(x, id), x); + assertEquals((short) Math.min(id, x), x); + assertEquals((short) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) Math.min(id, x), x, + assertEquals((short) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) Math.min(x, id), x, + assertEquals((short) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4268,20 +4311,20 @@ public class Short64VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = MAX_IDENTITY; - Assert.assertEquals((short) Math.max(id, id), id, + assertEquals((short) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) Math.max(id, x), x); - Assert.assertEquals((short) Math.max(x, id), x); + assertEquals((short) Math.max(id, x), x); + assertEquals((short) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) Math.max(id, x), x, + assertEquals((short) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) Math.max(x, id), x, + assertEquals((short) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4370,20 +4413,20 @@ public class Short64VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = UMIN_IDENTITY; - Assert.assertEquals((short) VectorMath.minUnsigned(id, id), id, + assertEquals((short) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((short) VectorMath.minUnsigned(x, id), x); + assertEquals((short) VectorMath.minUnsigned(id, x), x); + assertEquals((short) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) VectorMath.minUnsigned(id, x), x, + assertEquals((short) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) VectorMath.minUnsigned(x, id), x, + assertEquals((short) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4472,20 +4515,20 @@ public class Short64VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = UMAX_IDENTITY; - Assert.assertEquals((short) VectorMath.maxUnsigned(id, id), id, + assertEquals((short) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((short) VectorMath.maxUnsigned(x, id), x); + assertEquals((short) VectorMath.maxUnsigned(id, x), x); + assertEquals((short) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) VectorMath.maxUnsigned(id, x), x, + assertEquals((short) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) VectorMath.maxUnsigned(x, id), x, + assertEquals((short) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4574,20 +4617,20 @@ public class Short64VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4724,20 +4767,20 @@ public class Short64VectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = SUADD_IDENTITY; - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((short) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4816,7 +4859,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4836,7 +4879,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4857,7 +4900,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4877,7 +4920,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4896,7 +4939,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4915,7 +4958,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4938,7 +4981,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -4957,7 +5000,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -4980,7 +5023,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -4999,7 +5042,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5018,7 +5061,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5041,7 +5084,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5060,7 +5103,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5083,7 +5126,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5102,7 +5145,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5125,7 +5168,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5144,7 +5187,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5167,7 +5210,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5186,7 +5229,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5209,7 +5252,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5228,7 +5271,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5251,7 +5294,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5270,7 +5313,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5293,7 +5336,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5312,7 +5355,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5335,7 +5378,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5352,7 +5395,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5372,7 +5415,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5388,7 +5431,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (short)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (short)((long)b[i])); } } } @@ -5408,7 +5451,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (short)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (short)((long)b[i]))); } } } @@ -5424,7 +5467,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5444,7 +5487,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5460,7 +5503,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (short)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (short)((long)b[i])); } } } @@ -5480,7 +5523,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (short)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (short)((long)b[i]))); } } } @@ -5761,7 +5804,7 @@ public class Short64VectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static short[] sliceUnary(short[] a, int origin, int idx) { @@ -6711,10 +6754,10 @@ public class Short64VectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6743,7 +6786,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6759,7 +6802,7 @@ public class Short64VectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -6999,7 +7042,7 @@ public class Short64VectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -7027,7 +7070,7 @@ public class Short64VectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -7042,7 +7085,7 @@ public class Short64VectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7145,7 +7188,7 @@ public class Short64VectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7171,7 +7214,7 @@ public class Short64VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7185,7 +7228,7 @@ public class Short64VectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7207,7 +7250,7 @@ public class Short64VectorTests extends AbstractVectorTest { static void loopBoundShort64VectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7215,14 +7258,14 @@ public class Short64VectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeShort64VectorTestsSmokeTest() { ShortVector av = ShortVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Short.SIZE); + assertEquals(elsize, Short.SIZE); } @Test @@ -7276,7 +7319,7 @@ public class Short64VectorTests extends AbstractVectorTest { @Test static void MaskAllTrueShort64VectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/ShortMaxVectorLoadStoreTests.java b/test/jdk/jdk/incubator/vector/ShortMaxVectorLoadStoreTests.java index 91db367808a..ebed7dd0226 100644 --- a/test/jdk/jdk/incubator/vector/ShortMaxVectorLoadStoreTests.java +++ b/test/jdk/jdk/incubator/vector/ShortMaxVectorLoadStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -68,14 +68,29 @@ public class ShortMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / Max); + static void assertEquals(short actual, short expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals(short actual, short expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals(short [] actual, short [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(short [] actual, short [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals(short[] r, short[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : (short) 0, "at index #" + i); } } @@ -329,7 +344,7 @@ public class ShortMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "shortProviderForIOOBE") @@ -1121,11 +1136,11 @@ public class ShortMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -1136,11 +1151,11 @@ public class ShortMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: (short) 0, "at index #" + j); } } @@ -1156,7 +1171,7 @@ public class ShortMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals(short[] r, short[] a, int[] indexMap) { @@ -1169,7 +1184,7 @@ public class ShortMaxVectorLoadStoreTests extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider diff --git a/test/jdk/jdk/incubator/vector/ShortMaxVectorTests.java b/test/jdk/jdk/incubator/vector/ShortMaxVectorTests.java index ad2efd3575d..f71cf3ca322 100644 --- a/test/jdk/jdk/incubator/vector/ShortMaxVectorTests.java +++ b/test/jdk/jdk/incubator/vector/ShortMaxVectorTests.java @@ -62,6 +62,49 @@ public class ShortMaxVectorTests extends AbstractVectorTest { ShortVector.SPECIES_MAX; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals(short actual, short expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(short actual, short expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(short actual, short expected, short delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals(short actual, short expected, short delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals(short [] actual, short [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(short [] actual, short [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static VectorShape getMaxBit() { return VectorShape.S_Max_BIT; @@ -102,10 +145,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -117,13 +160,13 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { short[] ref = f.apply(a[i]); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -133,10 +176,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -152,13 +195,13 @@ public class ShortMaxVectorTests extends AbstractVectorTest { FReductionOp f, FReductionAllOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -174,13 +217,13 @@ public class ShortMaxVectorTests extends AbstractVectorTest { FReductionMaskedOp f, FReductionAllMaskedOp fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -196,13 +239,13 @@ public class ShortMaxVectorTests extends AbstractVectorTest { FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -218,13 +261,13 @@ public class ShortMaxVectorTests extends AbstractVectorTest { FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } @@ -236,10 +279,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -251,10 +294,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -263,12 +306,12 @@ public class ShortMaxVectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -279,20 +322,20 @@ public class ShortMaxVectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], (short)0); + assertEquals(r[i + k], (short)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (short)0, "at index #" + idx); + assertEquals(r[idx], (short)0, "at index #" + idx); } } } @@ -304,19 +347,19 @@ public class ShortMaxVectorTests extends AbstractVectorTest { k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], (short)0); + assertEquals(r[i + j], (short)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], (short)0, "at index #" + idx); + assertEquals(r[idx], (short)0, "at index #" + idx); } } } @@ -332,11 +375,11 @@ public class ShortMaxVectorTests extends AbstractVectorTest { wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -345,12 +388,12 @@ public class ShortMaxVectorTests extends AbstractVectorTest { try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -360,17 +403,17 @@ public class ShortMaxVectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], (short)0); + assertEquals(r[i+j], (short)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -380,17 +423,17 @@ public class ShortMaxVectorTests extends AbstractVectorTest { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], (short)0); + assertEquals(r[i+j], (short)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], (short)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -404,10 +447,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -419,10 +462,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -434,10 +477,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -458,18 +501,18 @@ public class ShortMaxVectorTests extends AbstractVectorTest { try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -484,18 +527,18 @@ public class ShortMaxVectorTests extends AbstractVectorTest { for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -503,10 +546,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -514,10 +557,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -525,10 +568,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -537,10 +580,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -553,10 +596,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -568,10 +611,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -583,10 +626,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -601,10 +644,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], (short)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -617,11 +660,11 @@ public class ShortMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -635,11 +678,11 @@ public class ShortMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -661,11 +704,11 @@ public class ShortMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -679,11 +722,11 @@ public class ShortMaxVectorTests extends AbstractVectorTest { try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -703,10 +746,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -718,10 +761,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -730,10 +773,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -743,10 +786,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -762,11 +805,11 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -783,11 +826,11 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -798,11 +841,11 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -819,11 +862,11 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -841,13 +884,13 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, i, b, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -868,13 +911,13 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, i, mask, b, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -889,13 +932,13 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { short[] ref = f.apply(r, a, i, mask, b, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -916,13 +959,13 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, origin, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -936,13 +979,13 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -957,13 +1000,13 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, mask, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -978,13 +1021,13 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, part, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1000,13 +1043,13 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { short[] ref = f.apply(a, b, origin, part, mask, i); short[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1019,10 +1062,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1032,10 +1075,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1043,10 +1086,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1583,7 +1626,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Do some zipping and shuffling. ShortVector io = (ShortVector) SPECIES.broadcast(0).addIndex(1); ShortVector io2 = (ShortVector) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); ShortVector a = io.add((short)1); //[1,2] ShortVector b = a.neg(); //[-1,-2] short[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1598,19 +1641,19 @@ public class ShortMaxVectorTests extends AbstractVectorTest { manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle unz1 = VectorShuffle.makeUnzip(SPECIES, 1); ShortVector uab0 = zab0.rearrange(unz0,zab1); ShortVector uab1 = zab0.rearrange(unz1,zab1); short[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { ShortVector io = (ShortVector) SPECIES.broadcast(0).addIndex(1); ShortVector io2 = (ShortVector) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -1625,7 +1668,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { @Test void viewAsIntegeralLanesTest() { Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); } @Test(expectedExceptions = UnsupportedOperationException.class) @@ -3662,20 +3705,20 @@ public class ShortMaxVectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = AND_IDENTITY; - Assert.assertEquals((short) (id & id), id, + assertEquals((short) (id & id), id, "AND(AND_IDENTITY, AND_IDENTITY) != AND_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id & x), x); - Assert.assertEquals((short) (x & id), x); + assertEquals((short) (id & x), x); + assertEquals((short) (x & id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id & x), x, + assertEquals((short) (id & x), x, "AND(AND_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x & id), x, + assertEquals((short) (x & id), x, "AND(" + x + ", AND_IDENTITY) != " + x); } } @@ -3764,20 +3807,20 @@ public class ShortMaxVectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = OR_IDENTITY; - Assert.assertEquals((short) (id | id), id, + assertEquals((short) (id | id), id, "OR(OR_IDENTITY, OR_IDENTITY) != OR_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id | x), x); - Assert.assertEquals((short) (x | id), x); + assertEquals((short) (id | x), x); + assertEquals((short) (x | id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id | x), x, + assertEquals((short) (id | x), x, "OR(OR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x | id), x, + assertEquals((short) (x | id), x, "OR(" + x + ", OR_IDENTITY) != " + x); } } @@ -3866,20 +3909,20 @@ public class ShortMaxVectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = XOR_IDENTITY; - Assert.assertEquals((short) (id ^ id), id, + assertEquals((short) (id ^ id), id, "XOR(XOR_IDENTITY, XOR_IDENTITY) != XOR_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id ^ x), x); - Assert.assertEquals((short) (x ^ id), x); + assertEquals((short) (id ^ x), x); + assertEquals((short) (x ^ id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id ^ x), x, + assertEquals((short) (id ^ x), x, "XOR(XOR_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x ^ id), x, + assertEquals((short) (x ^ id), x, "XOR(" + x + ", XOR_IDENTITY) != " + x); } } @@ -3968,20 +4011,20 @@ public class ShortMaxVectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = ADD_IDENTITY; - Assert.assertEquals((short) (id + id), id, + assertEquals((short) (id + id), id, "ADD(ADD_IDENTITY, ADD_IDENTITY) != ADD_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id + x), x); - Assert.assertEquals((short) (x + id), x); + assertEquals((short) (id + x), x); + assertEquals((short) (x + id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id + x), x, + assertEquals((short) (id + x), x, "ADD(ADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x + id), x, + assertEquals((short) (x + id), x, "ADD(" + x + ", ADD_IDENTITY) != " + x); } } @@ -4070,20 +4113,20 @@ public class ShortMaxVectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = MUL_IDENTITY; - Assert.assertEquals((short) (id * id), id, + assertEquals((short) (id * id), id, "MUL(MUL_IDENTITY, MUL_IDENTITY) != MUL_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) (id * x), x); - Assert.assertEquals((short) (x * id), x); + assertEquals((short) (id * x), x); + assertEquals((short) (x * id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) (id * x), x, + assertEquals((short) (id * x), x, "MUL(MUL_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) (x * id), x, + assertEquals((short) (x * id), x, "MUL(" + x + ", MUL_IDENTITY) != " + x); } } @@ -4172,20 +4215,20 @@ public class ShortMaxVectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = MIN_IDENTITY; - Assert.assertEquals((short) Math.min(id, id), id, + assertEquals((short) Math.min(id, id), id, "MIN(MIN_IDENTITY, MIN_IDENTITY) != MIN_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) Math.min(id, x), x); - Assert.assertEquals((short) Math.min(x, id), x); + assertEquals((short) Math.min(id, x), x); + assertEquals((short) Math.min(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) Math.min(id, x), x, + assertEquals((short) Math.min(id, x), x, "MIN(MIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) Math.min(x, id), x, + assertEquals((short) Math.min(x, id), x, "MIN(" + x + ", MIN_IDENTITY) != " + x); } } @@ -4274,20 +4317,20 @@ public class ShortMaxVectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = MAX_IDENTITY; - Assert.assertEquals((short) Math.max(id, id), id, + assertEquals((short) Math.max(id, id), id, "MAX(MAX_IDENTITY, MAX_IDENTITY) != MAX_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) Math.max(id, x), x); - Assert.assertEquals((short) Math.max(x, id), x); + assertEquals((short) Math.max(id, x), x); + assertEquals((short) Math.max(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) Math.max(id, x), x, + assertEquals((short) Math.max(id, x), x, "MAX(MAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) Math.max(x, id), x, + assertEquals((short) Math.max(x, id), x, "MAX(" + x + ", MAX_IDENTITY) != " + x); } } @@ -4376,20 +4419,20 @@ public class ShortMaxVectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = UMIN_IDENTITY; - Assert.assertEquals((short) VectorMath.minUnsigned(id, id), id, + assertEquals((short) VectorMath.minUnsigned(id, id), id, "UMIN(UMIN_IDENTITY, UMIN_IDENTITY) != UMIN_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) VectorMath.minUnsigned(id, x), x); - Assert.assertEquals((short) VectorMath.minUnsigned(x, id), x); + assertEquals((short) VectorMath.minUnsigned(id, x), x); + assertEquals((short) VectorMath.minUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) VectorMath.minUnsigned(id, x), x, + assertEquals((short) VectorMath.minUnsigned(id, x), x, "UMIN(UMIN_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) VectorMath.minUnsigned(x, id), x, + assertEquals((short) VectorMath.minUnsigned(x, id), x, "UMIN(" + x + ", UMIN_IDENTITY) != " + x); } } @@ -4478,20 +4521,20 @@ public class ShortMaxVectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = UMAX_IDENTITY; - Assert.assertEquals((short) VectorMath.maxUnsigned(id, id), id, + assertEquals((short) VectorMath.maxUnsigned(id, id), id, "UMAX(UMAX_IDENTITY, UMAX_IDENTITY) != UMAX_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) VectorMath.maxUnsigned(id, x), x); - Assert.assertEquals((short) VectorMath.maxUnsigned(x, id), x); + assertEquals((short) VectorMath.maxUnsigned(id, x), x); + assertEquals((short) VectorMath.maxUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) VectorMath.maxUnsigned(id, x), x, + assertEquals((short) VectorMath.maxUnsigned(id, x), x, "UMAX(UMAX_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) VectorMath.maxUnsigned(x, id), x, + assertEquals((short) VectorMath.maxUnsigned(x, id), x, "UMAX(" + x + ", UMAX_IDENTITY) != " + x); } } @@ -4580,20 +4623,20 @@ public class ShortMaxVectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = FIRST_NONZERO_IDENTITY; - Assert.assertEquals(firstNonZero(id, id), id, + assertEquals(firstNonZero(id, id), id, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, FIRST_NONZERO_IDENTITY) != FIRST_NONZERO_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(firstNonZero(id, x), x); - Assert.assertEquals(firstNonZero(x, id), x); + assertEquals(firstNonZero(id, x), x); + assertEquals(firstNonZero(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals(firstNonZero(id, x), x, + assertEquals(firstNonZero(id, x), x, "FIRST_NONZERO(FIRST_NONZERO_IDENTITY, " + x + ") != " + x); - Assert.assertEquals(firstNonZero(x, id), x, + assertEquals(firstNonZero(x, id), x, "FIRST_NONZERO(" + x + ", FIRST_NONZERO_IDENTITY) != " + x); } } @@ -4730,20 +4773,20 @@ public class ShortMaxVectorTests extends AbstractVectorTest { short[] a = fa.apply(SPECIES.length()); short id = SUADD_IDENTITY; - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(id, id), id, + assertEquals((short) VectorMath.addSaturatingUnsigned(id, id), id, "SUADD(SUADD_IDENTITY, SUADD_IDENTITY) != SUADD_IDENTITY"); short x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x); - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x); + assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x); + assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x); } } catch (AssertionError e) { - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x, + assertEquals((short) VectorMath.addSaturatingUnsigned(id, x), x, "SUADD(SUADD_IDENTITY, " + x + ") != " + x); - Assert.assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x, + assertEquals((short) VectorMath.addSaturatingUnsigned(x, id), x, "SUADD(" + x + ", SUADD_IDENTITY) != " + x); } } @@ -4822,7 +4865,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_DEFAULT(a[i + j])); } } } @@ -4842,7 +4885,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j])); } } } @@ -4863,7 +4906,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), testIS_NEGATIVE(a[i + j])); } } } @@ -4883,7 +4926,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_NEGATIVE(a[i + j])); } } } @@ -4902,7 +4945,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4921,7 +4964,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), lt(a[i + j], b[i + j])); } } } @@ -4944,7 +4987,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && lt(a[i + j], b[i + j])); } } } @@ -4963,7 +5006,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), gt(a[i + j], b[i + j])); } } } @@ -4986,7 +5029,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && gt(a[i + j], b[i + j])); } } } @@ -5005,7 +5048,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5024,7 +5067,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), eq(a[i + j], b[i + j])); } } } @@ -5047,7 +5090,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && eq(a[i + j], b[i + j])); } } } @@ -5066,7 +5109,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), neq(a[i + j], b[i + j])); } } } @@ -5089,7 +5132,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && neq(a[i + j], b[i + j])); } } } @@ -5108,7 +5151,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), le(a[i + j], b[i + j])); } } } @@ -5131,7 +5174,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && le(a[i + j], b[i + j])); } } } @@ -5150,7 +5193,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ge(a[i + j], b[i + j])); } } } @@ -5173,7 +5216,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ge(a[i + j], b[i + j])); } } } @@ -5192,7 +5235,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ult(a[i + j], b[i + j])); } } } @@ -5215,7 +5258,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ult(a[i + j], b[i + j])); } } } @@ -5234,7 +5277,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ugt(a[i + j], b[i + j])); } } } @@ -5257,7 +5300,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ugt(a[i + j], b[i + j])); } } } @@ -5276,7 +5319,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), ule(a[i + j], b[i + j])); } } } @@ -5299,7 +5342,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && ule(a[i + j], b[i + j])); } } } @@ -5318,7 +5361,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), uge(a[i + j], b[i + j])); } } } @@ -5341,7 +5384,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && uge(a[i + j], b[i + j])); } } } @@ -5358,7 +5401,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -5378,7 +5421,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < b[i])); } } } @@ -5394,7 +5437,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (short)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] < (short)((long)b[i])); } } } @@ -5414,7 +5457,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (short)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] < (short)((long)b[i]))); } } } @@ -5430,7 +5473,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -5450,7 +5493,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == b[i])); } } } @@ -5466,7 +5509,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (short)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] == (short)((long)b[i])); } } } @@ -5486,7 +5529,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (short)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] == (short)((long)b[i]))); } } } @@ -5767,7 +5810,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { } } - Assert.assertEquals(a, r); + assertEquals(a, r); } static short[] sliceUnary(short[] a, int origin, int idx) { @@ -6717,10 +6760,10 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } @@ -6749,7 +6792,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -6765,7 +6808,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -7005,7 +7048,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -7033,7 +7076,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -7048,7 +7091,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -7151,7 +7194,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -7177,7 +7220,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7191,7 +7234,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -7213,7 +7256,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { static void loopBoundShortMaxVectorTestsSmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -7221,14 +7264,14 @@ public class ShortMaxVectorTests extends AbstractVectorTest { long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSizeShortMaxVectorTestsSmokeTest() { ShortVector av = ShortVector.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, Short.SIZE); + assertEquals(elsize, Short.SIZE); } @Test @@ -7282,7 +7325,7 @@ public class ShortMaxVectorTests extends AbstractVectorTest { @Test static void MaskAllTrueShortMaxVectorTestsSmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } } diff --git a/test/jdk/jdk/incubator/vector/gen-tests.sh b/test/jdk/jdk/incubator/vector/gen-tests.sh index 8b87d9d9efb..239e53367c0 100644 --- a/test/jdk/jdk/incubator/vector/gen-tests.sh +++ b/test/jdk/jdk/incubator/vector/gen-tests.sh @@ -64,6 +64,7 @@ do MinValue=MIN_VALUE kind=BITWISE + fpkind=BITWISE bitstype=$type Bitstype=$Type @@ -99,6 +100,7 @@ do ;; float) kind=FP + fpkind=FP32 bitstype=int Bitstype=Int Boxbitstype=Integer @@ -108,6 +110,7 @@ do ;; double) kind=FP + fpkind=FP64 bitstype=long Bitstype=Long Boxbitstype=Long @@ -117,7 +120,7 @@ do ;; esac - args="$args -K$kind -K$Type -DBoxtype=$Boxtype -DWideboxtype=$Wideboxtype -DMaxValue=$MaxValue -DMinValue=$MinValue" + args="$args -K$kind -K$fpkind -K$Type -DBoxtype=$Boxtype -DWideboxtype=$Wideboxtype -DMaxValue=$MaxValue -DMinValue=$MinValue" args="$args -Dbitstype=$bitstype -DBitstype=$Bitstype -DBoxbitstype=$Boxbitstype" args="$args -Dfptype=$fptype -DFptype=$Fptype -DBoxfptype=$Boxfptype" diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Compare-Broadcast.template b/test/jdk/jdk/incubator/vector/templates/Unit-Compare-Broadcast.template index e3fcdf57e83..92e612e8184 100644 --- a/test/jdk/jdk/incubator/vector/templates/Unit-Compare-Broadcast.template +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Compare-Broadcast.template @@ -10,7 +10,7 @@ // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] [[TEST_OP]] b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] [[TEST_OP]] b[i]); } } } @@ -30,7 +30,7 @@ // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] [[TEST_OP]] b[i])); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] [[TEST_OP]] b[i])); } } } @@ -47,7 +47,7 @@ // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] [[TEST_OP]] ($type$)((long)b[i])); + assertEquals(mv.laneIsSet(j), a[i + j] [[TEST_OP]] ($type$)((long)b[i])); } } } @@ -67,7 +67,7 @@ // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] [[TEST_OP]] ($type$)((long)b[i]))); + assertEquals(mv.laneIsSet(j), mask[j] && (a[i + j] [[TEST_OP]] ($type$)((long)b[i]))); } } } diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Compare-Masked.template b/test/jdk/jdk/incubator/vector/templates/Unit-Compare-Masked.template index b34658ffc4c..6620dc679b8 100644 --- a/test/jdk/jdk/incubator/vector/templates/Unit-Compare-Masked.template +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Compare-Masked.template @@ -16,7 +16,7 @@ // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), mask[j] && [[TEST_OP]](a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), mask[j] && [[TEST_OP]](a[i + j], b[i + j])); } } } diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Compare.template b/test/jdk/jdk/incubator/vector/templates/Unit-Compare.template index 47ddfaf4ab0..f3c7b52f70f 100644 --- a/test/jdk/jdk/incubator/vector/templates/Unit-Compare.template +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Compare.template @@ -12,7 +12,7 @@ // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), [[TEST_OP]](a[i + j], b[i + j])); + assertEquals(mv.laneIsSet(j), [[TEST_OP]](a[i + j], b[i + j])); } } } diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Mask-FromToLong.template b/test/jdk/jdk/incubator/vector/templates/Unit-Mask-FromToLong.template index 784ef5f81b9..3f8bd186ca4 100644 --- a/test/jdk/jdk/incubator/vector/templates/Unit-Mask-FromToLong.template +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Mask-FromToLong.template @@ -5,10 +5,10 @@ int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], a[i] & bits); + assertEquals(r[i], a[i] & bits); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); + assertEquals(r[i], a[i] & bits, "(" + a[i] + ") at index #" + i); } } diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Miscellaneous.template b/test/jdk/jdk/incubator/vector/templates/Unit-Miscellaneous.template index 460f7624f2c..8411565628d 100644 --- a/test/jdk/jdk/incubator/vector/templates/Unit-Miscellaneous.template +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Miscellaneous.template @@ -10,7 +10,7 @@ // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] < b[i]); } } } @@ -26,7 +26,7 @@ // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); + assertEquals(mv.laneIsSet(j), a[i + j] == b[i]); } } } @@ -350,7 +350,7 @@ int subarr[] = Arrays.copyOfRange(a, i, i + SPECIES.length()); int expectedHash = Objects.hash(SPECIES, Arrays.hashCode(subarr)); Assert.assertTrue(hash == expectedHash, "at index " + i + ", hash should be = " + expectedHash + ", but is = " + hash); - Assert.assertEquals(length, SPECIES.length()); + assertEquals(length, SPECIES.length()); } } @@ -378,7 +378,7 @@ var bv = VectorShuffle.fromArray(SPECIES, b, i); boolean eq = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); + assertEquals(eq, Arrays.equals(a, i, to, b, i, to)); } } @@ -393,7 +393,7 @@ var bv = SPECIES.loadMask(b, i); boolean equals = av.equals(bv); int to = i + SPECIES.length(); - Assert.assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); + assertEquals(equals, Arrays.equals(a, i, to, b, i, to)); } } } @@ -496,7 +496,7 @@ trueCount = vmask.trueCount(); var rmask = vmask.compress(); for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(rmask.laneIsSet(j), j < trueCount); + assertEquals(rmask.laneIsSet(j), j < trueCount); } } } @@ -522,7 +522,7 @@ assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { int index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -536,7 +536,7 @@ assert(actualMask.equals(expectedMask)); for (int j = 0; j < SPECIES.length(); j++) { long index = i + j + offset; - Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); + assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit); } } } @@ -558,7 +558,7 @@ static void loopBound$vectorteststype$SmokeTest(int length) { int actualLoopBound = SPECIES.loopBound(length); int expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test(dataProvider = "lengthProvider") @@ -566,14 +566,14 @@ long length = _length; long actualLoopBound = SPECIES.loopBound(length); long expectedLoopBound = length - Math.floorMod(length, SPECIES.length()); - Assert.assertEquals(actualLoopBound, expectedLoopBound); + assertEquals(actualLoopBound, expectedLoopBound); } @Test static void ElementSize$vectorteststype$SmokeTest() { $abstractvectortype$ av = $abstractvectortype$.zero(SPECIES); int elsize = av.elementSize(); - Assert.assertEquals(elsize, $Wideboxtype$.SIZE); + assertEquals(elsize, $Wideboxtype$.SIZE); } @Test @@ -627,6 +627,6 @@ @Test static void MaskAllTrue$vectorteststype$SmokeTest() { for (int ic = 0; ic < INVOC_COUNT; ic++) { - Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); + assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length())); } } diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-op-func.template b/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-op-func.template index c797ad907fb..4be33efd57c 100644 --- a/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-op-func.template +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-op-func.template @@ -11,20 +11,20 @@ $type$[] a = fa.apply(SPECIES.length()); $type$ id = [[TEST_INIT]]; - Assert.assertEquals([[TEST_OP]](id, id), id, + assertEquals([[TEST_OP]](id, id), id, "[[TEST]]([[TEST_INIT]], [[TEST_INIT]]) != [[TEST_INIT]]"); $type$ x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals([[TEST_OP]](id, x), x); - Assert.assertEquals([[TEST_OP]](x, id), x); + assertEquals([[TEST_OP]](id, x), x); + assertEquals([[TEST_OP]](x, id), x); } } catch (AssertionError e) { - Assert.assertEquals([[TEST_OP]](id, x), x, + assertEquals([[TEST_OP]](id, x), x, "[[TEST]]([[TEST_INIT]], " + x + ") != " + x); - Assert.assertEquals([[TEST_OP]](x, id), x, + assertEquals([[TEST_OP]](x, id), x, "[[TEST]](" + x + ", [[TEST_INIT]]) != " + x); } } diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-op.template b/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-op.template index f8438fa58c8..25ae3ba2f12 100644 --- a/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-op.template +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Reduction-op.template @@ -15,20 +15,20 @@ $type$[] a = fa.apply(SPECIES.length()); $type$ id = [[TEST_INIT]]; - Assert.assertEquals(($type$) (id [[TEST_OP]] id), id, + assertEquals(($type$) (id [[TEST_OP]] id), id, "[[TEST]]([[TEST_INIT]], [[TEST_INIT]]) != [[TEST_INIT]]"); $type$ x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals(($type$) (id [[TEST_OP]] x), x); - Assert.assertEquals(($type$) (x [[TEST_OP]] id), x); + assertEquals(($type$) (id [[TEST_OP]] x), x); + assertEquals(($type$) (x [[TEST_OP]] id), x); } } catch (AssertionError e) { - Assert.assertEquals(($type$) (id [[TEST_OP]] x), x, + assertEquals(($type$) (id [[TEST_OP]] x), x, "[[TEST]]([[TEST_INIT]], " + x + ") != " + x); - Assert.assertEquals(($type$) (x [[TEST_OP]] id), x, + assertEquals(($type$) (x [[TEST_OP]] id), x, "[[TEST]](" + x + ", [[TEST_INIT]]) != " + x); } } diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-SaturatingReduction-op.template b/test/jdk/jdk/incubator/vector/templates/Unit-SaturatingReduction-op.template index d961a29e5c8..4769b67fe3e 100644 --- a/test/jdk/jdk/incubator/vector/templates/Unit-SaturatingReduction-op.template +++ b/test/jdk/jdk/incubator/vector/templates/Unit-SaturatingReduction-op.template @@ -11,20 +11,20 @@ $type$[] a = fa.apply(SPECIES.length()); $type$ id = [[TEST_INIT]]; - Assert.assertEquals([[TEST_OP]](id, id), id, + assertEquals([[TEST_OP]](id, id), id, "[[TEST]]([[TEST_INIT]], [[TEST_INIT]]) != [[TEST_INIT]]"); $type$ x = 0; try { for (int i = 0; i < a.length; i++) { x = a[i]; - Assert.assertEquals([[TEST_OP]](id, x), x); - Assert.assertEquals([[TEST_OP]](x, id), x); + assertEquals([[TEST_OP]](id, x), x); + assertEquals([[TEST_OP]](x, id), x); } } catch (AssertionError e) { - Assert.assertEquals([[TEST_OP]](id, x), x, + assertEquals([[TEST_OP]](id, x), x, "[[TEST]]([[TEST_INIT]], " + x + ") != " + x); - Assert.assertEquals([[TEST_OP]](x, id), x, + assertEquals([[TEST_OP]](x, id), x, "[[TEST]](" + x + ", [[TEST_INIT]]) != " + x); } } diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Test.template b/test/jdk/jdk/incubator/vector/templates/Unit-Test.template index 080773ede1a..8af517cfe56 100644 --- a/test/jdk/jdk/incubator/vector/templates/Unit-Test.template +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Test.template @@ -14,7 +14,7 @@ // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), test[[TEST]](a[i + j])); + assertEquals(mv.laneIsSet(j), test[[TEST]](a[i + j])); } } } @@ -34,7 +34,7 @@ // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { - Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && test[[TEST]](a[i + j])); + assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && test[[TEST]](a[i + j])); } } } diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-Zero.template b/test/jdk/jdk/incubator/vector/templates/Unit-Zero.template index a277d66ae3e..a5b13c1ab00 100644 --- a/test/jdk/jdk/incubator/vector/templates/Unit-Zero.template +++ b/test/jdk/jdk/incubator/vector/templates/Unit-Zero.template @@ -2,5 +2,5 @@ @Test(dataProvider = "$type$UnaryOpProvider") static void Zero$vectorteststype$(IntFunction<$type$[]> fa) { [[KERNEL]] - Assert.assertEquals(a, r); + assertEquals(a, r); } diff --git a/test/jdk/jdk/incubator/vector/templates/Unit-header.template b/test/jdk/jdk/incubator/vector/templates/Unit-header.template index e1ec6624022..00a7766492c 100644 --- a/test/jdk/jdk/incubator/vector/templates/Unit-header.template +++ b/test/jdk/jdk/incubator/vector/templates/Unit-header.template @@ -86,6 +86,53 @@ public class $vectorteststype$ extends AbstractVectorTest { #end[MaxBit] static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); + static void assertEquals($type$ actual, $type$ expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals($type$ actual, $type$ expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertEquals($type$ actual, $type$ expected, $type$ delta) { + Assert.assertEquals(actual, expected, delta); + } + static void assertEquals($type$ actual, $type$ expected, $type$ delta, String msg) { + Assert.assertEquals(actual, expected, delta, msg); + } + static void assertEquals($type$ [] actual, $type$ [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals($type$ [] actual, $type$ [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } +#if[!long] + static void assertEquals(long actual, long expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(long actual, long expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } +#end[!long] + static void assertEquals(String actual, String expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(Object actual, Object expected) { + Assert.assertEquals(actual, expected); + } +#if[!FP64] + static void assertEquals(double actual, double expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(double actual, double expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } +#end[!FP64] + static void assertEquals(boolean actual, boolean expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals(boolean actual, boolean expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + #if[MaxBit] static VectorShape getMaxBit() { @@ -154,10 +201,10 @@ public class $vectorteststype$ extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]); } } @@ -169,13 +216,13 @@ public class $vectorteststype$ extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a[i])); } } catch (AssertionError e) { $type$[] ref = f.apply(a[i]); $type$[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -185,10 +232,10 @@ public class $vectorteststype$ extends AbstractVectorTest { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], mask[i % SPECIES.length()] ? f.apply(a[i]) : a[i], "at index #" + i + ", input = " + a[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -207,13 +254,13 @@ public class $vectorteststype$ extends AbstractVectorTest { #else[FP] int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } #end[FP] } @@ -224,13 +271,13 @@ public class $vectorteststype$ extends AbstractVectorTest { $type$ relativeErrorFactor) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); + assertEquals(rc, fa.apply(a), Math.ulp(rc) * relativeErrorFactor, "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), Math.ulp(r[i]) * relativeErrorFactor, "at index #" + i); } } #end[FP] @@ -250,13 +297,13 @@ public class $vectorteststype$ extends AbstractVectorTest { #else[FP] int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } #end[FP] } @@ -267,14 +314,14 @@ public class $vectorteststype$ extends AbstractVectorTest { $type$ relativeError) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), Math.abs(rc * relativeError), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), Math.abs(r[i] * relativeError), "at index #" + i); } } #end[FP] @@ -292,13 +339,13 @@ relativeError)); FReductionOpLong f, FReductionAllOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a)); + assertEquals(rc, fa.apply(a)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(rc, fa.apply(a), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -314,13 +361,13 @@ relativeError)); FReductionMaskedOpLong f, FReductionAllMaskedOpLong fa) { int i = 0; try { - Assert.assertEquals(rc, fa.apply(a, mask)); + assertEquals(rc, fa.apply(a, mask)); for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i, mask)); + assertEquals(r[i], f.apply(a, i, mask)); } } catch (AssertionError e) { - Assert.assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); - Assert.assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); + assertEquals(rc, fa.apply(a, mask), "Final result is incorrect!"); + assertEquals(r[i], f.apply(a, i, mask), "at index #" + i); } } #end[!Long] @@ -333,10 +380,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -348,10 +395,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(r[i], f.apply(a, i)); + assertEquals(r[i], f.apply(a, i)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a, i), "at index #" + i); + assertEquals(r[i], f.apply(a, i), "at index #" + i); } } @@ -360,12 +407,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]); } } @@ -376,20 +423,20 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + k], a[i + j]); + assertEquals(r[i + k], a[i + j]); k++; } } for (; k < vector_len; k++) { - Assert.assertEquals(r[i + k], ($type$)0); + assertEquals(r[i + k], ($type$)0); } } } catch (AssertionError e) { int idx = i + k; if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + j], "at index #" + idx); + assertEquals(r[idx], a[i + j], "at index #" + idx); } else { - Assert.assertEquals(r[idx], ($type$)0, "at index #" + idx); + assertEquals(r[idx], ($type$)0, "at index #" + idx); } } } @@ -401,19 +448,19 @@ relativeError)); k = 0; for (j = 0; j < vector_len; j++) { if (m[(i + j) % SPECIES.length()]) { - Assert.assertEquals(r[i + j], a[i + k]); + assertEquals(r[i + j], a[i + k]); k++; } else { - Assert.assertEquals(r[i + j], ($type$)0); + assertEquals(r[i + j], ($type$)0); } } } } catch (AssertionError e) { int idx = i + j; if (m[idx % SPECIES.length()]) { - Assert.assertEquals(r[idx], a[i + k], "at index #" + idx); + assertEquals(r[idx], a[i + k], "at index #" + idx); } else { - Assert.assertEquals(r[idx], ($type$)0, "at index #" + idx); + assertEquals(r[idx], ($type$)0, "at index #" + idx); } } } @@ -429,11 +476,11 @@ relativeError)); wrapped_index = Math.floorMod((int)order[idx], 2 * vector_len); is_exceptional_idx = wrapped_index >= vector_len; oidx = is_exceptional_idx ? (wrapped_index - vector_len) : wrapped_index; - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx])); } } } catch (AssertionError e) { - Assert.assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); + assertEquals(r[idx], (is_exceptional_idx ? b[i + oidx] : a[i + oidx]), "at index #" + idx + ", order = " + order[idx] + ", a = " + a[i + oidx] + ", b = " + b[i + oidx]); } } @@ -442,12 +489,12 @@ relativeError)); try { for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); } } } catch (AssertionError e) { int idx = i + j; - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]]); } } @@ -457,17 +504,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]]); + assertEquals(r[i+j], a[i+order[i+j]]); else - Assert.assertEquals(r[i+j], ($type$)0); + assertEquals(r[i+j], ($type$)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], ($type$)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], ($type$)0, "at index #" + idx + ", input = " + a[i+order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -477,17 +524,17 @@ relativeError)); for (; i < a.length; i += vector_len) { for (j = 0; j < vector_len; j++) { if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]]); + assertEquals(r[i+j], a[i+(int)order[i+j]]); else - Assert.assertEquals(r[i+j], ($type$)0); + assertEquals(r[i+j], ($type$)0); } } } catch (AssertionError e) { int idx = i + j; if (mask[j % SPECIES.length()]) - Assert.assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], a[i+(int)order[i+j]], "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); else - Assert.assertEquals(r[i+j], ($type$)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); + assertEquals(r[i+j], ($type$)0, "at index #" + idx + ", input = " + a[i+(int)order[i+j]] + ", mask = " + mask[j % SPECIES.length()]); } } @@ -501,10 +548,10 @@ relativeError)); try { for (i = 0; i < a.length; i++) { - Assert.assertEquals(r[i], a[i]); + assertEquals(r[i], a[i]); } } catch (AssertionError e) { - Assert.assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); + assertEquals(r[i], a[i], "at index #" + i + ", input = " + a[i]); } } @@ -516,10 +563,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i])); + assertEquals(r[i], f.apply(a[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i]), "(" + a[i] + ") at index #" + i); } } @@ -531,10 +578,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -555,18 +602,18 @@ relativeError)); try { for (; i < a.length; i++) { //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i])); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i]))); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i]), c[i]), "left associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i])), "right associative test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -581,18 +628,18 @@ relativeError)); for (; i < a.length; i++) { mask_bit = mask[i % SPECIES.length()]; //Left associative - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit)); //Right associative - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit)); //Results equal sanity check - Assert.assertEquals(rl[i], rr[i]); + assertEquals(rl[i], rr[i]); } } catch (AssertionError e) { - Assert.assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); - Assert.assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); + assertEquals(rl[i], f.apply(f.apply(a[i], b[i], mask_bit), c[i], mask_bit), "left associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rr[i], f.apply(a[i], f.apply(b[i], c[i], mask_bit), mask_bit), "right associative masked test at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask_bit); + assertEquals(rl[i], rr[i], "Result checks not equal at index #" + i + "leftRes = " + rl[i] + ", rightRes = " + rr[i]); } } @@ -600,10 +647,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i])); + assertEquals(r[i], f.apply(a[i], b[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b[i]), "(" + a[i] + ", " + b[i] + ") at index #" + i); } } @@ -611,10 +658,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b)); + assertEquals(r[i], f.apply(a[i], b)); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); + assertEquals(r[i], f.apply(a[i], b), "(" + a[i] + ", " + b + ") at index #" + i); } } @@ -622,10 +669,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()]), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -634,10 +681,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], ($type$)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); + assertEquals(r[i], f.apply(a[i], ($type$)((long)b[(i / SPECIES.length()) * SPECIES.length()]))); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], ($type$)((long)b[(i / SPECIES.length()) * SPECIES.length()])), + assertEquals(r[i], f.apply(a[i], ($type$)((long)b[(i / SPECIES.length()) * SPECIES.length()])), "(" + a[i] + ", " + b[(i / SPECIES.length()) * SPECIES.length()] + ") at index #" + i); } } @@ -650,10 +697,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -665,10 +712,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); + assertEquals(r[i], f.apply(a[i], b, mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b + ", mask = " + mask[i % SPECIES.length()]); } } @@ -680,10 +727,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -698,10 +745,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], ($type$)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], ($type$)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], ($type$)((long)b[(i / SPECIES.length()) * SPECIES.length()]), + assertEquals(r[i], f.apply(a[i], ($type$)((long)b[(i / SPECIES.length()) * SPECIES.length()]), mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -714,11 +761,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j])); + assertEquals(r[i+j], f.apply(a[i+j], b[j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j], b[j]), "at index #" + i + ", " + j); } } @@ -732,11 +779,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], b[j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", input2 = " + b[j] + ", mask = " + mask[i]); } } @@ -758,11 +805,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j])); + assertEquals(r[i+j], f.apply(a[i+j])); } } } catch (AssertionError e) { - Assert.assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); + assertEquals(r[i+j], f.apply(a[i+j]), "at index #" + i + ", " + j); } } @@ -776,11 +823,11 @@ relativeError)); try { for (; j < a.length; j += SPECIES.length()) { for (i = 0; i < SPECIES.length(); i++) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i])); + assertEquals(r[i+j], f.apply(a[i+j], mask[i])); } } } catch (AssertionError err) { - Assert.assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); + assertEquals(r[i+j], f.apply(a[i+j], mask[i]), "at index #" + i + ", input1 = " + a[i+j] + ", mask = " + mask[i]); } } @@ -800,10 +847,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i])); + assertEquals(r[i], f.apply(a[i], b[i], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); + assertEquals(r[i], f.apply(a[i], b[i], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i]); } } @@ -815,10 +862,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + assertEquals(r[i], f.apply(a[i], b[i], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); } } @@ -827,10 +874,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); } @@ -840,10 +887,10 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i]); } @@ -859,11 +906,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[i], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[i] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + mask[i % SPECIES.length()]); @@ -880,11 +927,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[i], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[i] + ", mask = " + mask[i % SPECIES.length()]); @@ -895,11 +942,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()]); @@ -916,11 +963,11 @@ relativeError)); int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()])); } } catch (AssertionError err) { - Assert.assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], + assertEquals(r[i], f.apply(a[i], b[(i / SPECIES.length()) * SPECIES.length()], c[(i / SPECIES.length()) * SPECIES.length()], mask[i % SPECIES.length()]), "at index #" + i + ", input1 = " + a[i] + ", input2 = " + b[(i / SPECIES.length()) * SPECIES.length()] + ", input3 = " + c[(i / SPECIES.length()) * SPECIES.length()] + ", mask = " + @@ -1014,13 +1061,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, b, i)); } } catch (AssertionError e) { $type$[] ref = f.apply(a, i, b, i); $type$[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -1041,13 +1088,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, i, mask, b, i)); } } catch (AssertionError e) { $type$[] ref = f.apply(a, i, mask, b, i); $type$[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -1062,13 +1109,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(r, a, i, mask, b, i)); } } catch (AssertionError e) { $type$[] ref = f.apply(r, a, i, mask, b, i); $type$[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + ", a: " + Arrays.toString(Arrays.copyOfRange(a, i, i+SPECIES.length())) + ", b: " @@ -1089,13 +1136,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, origin, i)); } } catch (AssertionError e) { $type$[] ref = f.apply(a, origin, i); $type$[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i); } @@ -1109,13 +1156,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, i)); } } catch (AssertionError e) { $type$[] ref = f.apply(a, b, origin, i); $type$[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1130,13 +1177,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, mask, i)); } } catch (AssertionError e) { $type$[] ref = f.apply(a, b, origin, mask, i); $type$[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin); @@ -1151,13 +1198,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, i)); } } catch (AssertionError e) { $type$[] ref = f.apply(a, b, origin, part, i); $type$[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1173,13 +1220,13 @@ relativeError)); int i = 0; try { for (; i < a.length; i += SPECIES.length()) { - Assert.assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), + assertEquals(Arrays.copyOfRange(r, i, i+SPECIES.length()), f.apply(a, b, origin, part, mask, i)); } } catch (AssertionError e) { $type$[] ref = f.apply(a, b, origin, part, mask, i); $type$[] res = Arrays.copyOfRange(r, i, i+SPECIES.length()); - Assert.assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + assertEquals(res, ref, "(ref: " + Arrays.toString(ref) + ", res: " + Arrays.toString(res) + "), at index #" + i + ", at origin #" + origin @@ -1229,10 +1276,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (int)(a[i+offs])); + assertEquals(r[i], (int)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (int)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } @@ -1279,10 +1326,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } #end[byte] @@ -1291,10 +1338,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (long)(a[i+offs])); + assertEquals(r[i], (long)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } #if[!Double] @@ -1303,10 +1350,10 @@ relativeError)); int i = 0; try { for (; i < r.length; i++) { - Assert.assertEquals(r[i], (double)(a[i+offs])); + assertEquals(r[i], (double)(a[i+offs])); } } catch (AssertionError e) { - Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); + assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]); } } #end[!Double] @@ -1958,7 +2005,7 @@ relativeError)); // Do some zipping and shuffling. $abstractvectortype$ io = ($abstractvectortype$) SPECIES.broadcast(0).addIndex(1); $abstractvectortype$ io2 = ($abstractvectortype$) VectorShuffle.iota(SPECIES,0,1,false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); $abstractvectortype$ a = io.add(($type$)1); //[1,2] $abstractvectortype$ b = a.neg(); //[-1,-2] $type$[] abValues = bothToArray(a,b); //[1,2,-1,-2] @@ -1973,19 +2020,19 @@ relativeError)); manual[i+0] = abValues[i/2]; manual[i+1] = abValues[a.length() + i/2]; } - Assert.assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); + assertEquals(Arrays.toString(zabValues), Arrays.toString(manual)); VectorShuffle<$Boxtype$> unz0 = VectorShuffle.makeUnzip(SPECIES, 0); VectorShuffle<$Boxtype$> unz1 = VectorShuffle.makeUnzip(SPECIES, 1); $abstractvectortype$ uab0 = zab0.rearrange(unz0,zab1); $abstractvectortype$ uab1 = zab0.rearrange(unz1,zab1); $type$[] abValues1 = bothToArray(uab0, uab1); - Assert.assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); + assertEquals(Arrays.toString(abValues), Arrays.toString(abValues1)); } static void iotaShuffle() { $abstractvectortype$ io = ($abstractvectortype$) SPECIES.broadcast(0).addIndex(1); $abstractvectortype$ io2 = ($abstractvectortype$) VectorShuffle.iota(SPECIES, 0 , 1, false).toVector(); - Assert.assertEquals(io, io2); + assertEquals(io, io2); } @Test @@ -2003,12 +2050,12 @@ relativeError)); Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); VectorSpecies asIntegralSpecies = asIntegral.species(); Assert.assertNotEquals(asIntegralSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asIntegralSpecies.length(), SPECIES.length()); - Assert.assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); + assertEquals(asIntegralSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asIntegralSpecies.length(), SPECIES.length()); + assertEquals(asIntegral.viewAsFloatingLanes().species(), SPECIES); #else[FP] Vector asIntegral = SPECIES.zero().viewAsIntegralLanes(); - Assert.assertEquals(asIntegral.species(), SPECIES); + assertEquals(asIntegral.species(), SPECIES); #end[FP] } #if[FP] @@ -2016,7 +2063,7 @@ relativeError)); @Test void viewAsFloatingLanesTest() { Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); - Assert.assertEquals(asFloating.species(), SPECIES); + assertEquals(asFloating.species(), SPECIES); } #else[FP] #if[byteOrShort] @@ -2032,9 +2079,9 @@ relativeError)); Vector asFloating = SPECIES.zero().viewAsFloatingLanes(); VectorSpecies asFloatingSpecies = asFloating.species(); Assert.assertNotEquals(asFloatingSpecies.elementType(), SPECIES.elementType()); - Assert.assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); - Assert.assertEquals(asFloatingSpecies.length(), SPECIES.length()); - Assert.assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); + assertEquals(asFloatingSpecies.vectorShape(), SPECIES.vectorShape()); + assertEquals(asFloatingSpecies.length(), SPECIES.length()); + assertEquals(asFloating.viewAsIntegralLanes().species(), SPECIES); } #end[byteOrShort] #end[FP] diff --git a/test/jdk/jdk/incubator/vector/templates/X-LoadStoreTest.java.template b/test/jdk/jdk/incubator/vector/templates/X-LoadStoreTest.java.template index a68103e1060..6779c78a490 100644 --- a/test/jdk/jdk/incubator/vector/templates/X-LoadStoreTest.java.template +++ b/test/jdk/jdk/incubator/vector/templates/X-LoadStoreTest.java.template @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -81,14 +81,29 @@ public class $vectorteststype$ extends AbstractVectorLoadStoreTest { static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / $bits$); + static void assertEquals($type$ actual, $type$ expected) { + Assert.assertEquals(actual, expected); + } + + static void assertEquals($type$ actual, $type$ expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + + static void assertEquals($type$ [] actual, $type$ [] expected) { + Assert.assertEquals(actual, expected); + } + static void assertEquals($type$ [] actual, $type$ [] expected, String msg) { + Assert.assertEquals(actual, expected, msg); + } + static void assertArraysEquals($type$[] r, $type$[] a, boolean[] mask) { int i = 0; try { for (; i < a.length; i++) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : ($type$) 0); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : ($type$) 0); } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : ($type$) 0, "at index #" + i); + assertEquals(r[i], mask[i % SPECIES.length()] ? a[i] : ($type$) 0, "at index #" + i); } } @@ -342,7 +357,7 @@ public class $vectorteststype$ extends AbstractVectorLoadStoreTest { av.intoArray(r, i); } } - Assert.assertEquals(r, a); + assertEquals(r, a); } @Test(dataProvider = "$type$ProviderForIOOBE") @@ -1225,11 +1240,11 @@ public class $vectorteststype$ extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], a[i + indexMap[j]]); + assertEquals(r[j], a[i + indexMap[j]]); } } } catch (AssertionError e) { - Assert.assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); + assertEquals(r[j], a[i + indexMap[j]], "at index #" + j); } } @@ -1240,11 +1255,11 @@ public class $vectorteststype$ extends AbstractVectorLoadStoreTest { for (; i < a.length; i += SPECIES.length()) { j = i; for (; j < i + SPECIES.length(); j++) { - Assert.assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: ($type$) 0); + assertEquals(r[j], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: ($type$) 0); } } } catch (AssertionError e) { - Assert.assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: ($type$) 0, "at index #" + j); + assertEquals(r[i], mask[j % SPECIES.length()] ? a[i + indexMap[j]]: ($type$) 0, "at index #" + j); } } @@ -1260,7 +1275,7 @@ public class $vectorteststype$ extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } static void assertScatterArraysEquals($type$[] r, $type$[] a, int[] indexMap) { @@ -1273,7 +1288,7 @@ public class $vectorteststype$ extends AbstractVectorLoadStoreTest { } } - Assert.assertEquals(r, expected); + assertEquals(r, expected); } @DataProvider From 49e2a6b696c2063f0b4331b0a6d064852d676fcd Mon Sep 17 00:00:00 2001 From: Jaikiran Pai Date: Sat, 14 Feb 2026 09:12:51 +0000 Subject: [PATCH 101/120] 8377857: Add since checker test for java.naming module Reviewed-by: alanb --- .../classes/javax/naming/InitialContext.java | 4 +-- .../java.naming/JavaNamingCheckSince.java | 29 +++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 test/jdk/tools/sincechecker/modules/java.naming/JavaNamingCheckSince.java diff --git a/src/java.naming/share/classes/javax/naming/InitialContext.java b/src/java.naming/share/classes/javax/naming/InitialContext.java index f2ab1676f4e..a66e843e641 100644 --- a/src/java.naming/share/classes/javax/naming/InitialContext.java +++ b/src/java.naming/share/classes/javax/naming/InitialContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -117,7 +117,7 @@ import com.sun.naming.internal.ResourceManager; * @see Context * @see NamingManager#setInitialContextFactoryBuilder * NamingManager.setInitialContextFactoryBuilder - * @since 1.3, JNDI 1.1 + * @since 1.3 */ public class InitialContext implements Context { diff --git a/test/jdk/tools/sincechecker/modules/java.naming/JavaNamingCheckSince.java b/test/jdk/tools/sincechecker/modules/java.naming/JavaNamingCheckSince.java new file mode 100644 index 00000000000..6d99ab9b727 --- /dev/null +++ b/test/jdk/tools/sincechecker/modules/java.naming/JavaNamingCheckSince.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @summary Test for "@since" in java.naming module + * @library /test/lib /test/jdk/tools/sincechecker + * @run main SinceChecker java.naming + */ From 01c9d7e9b423f5edb62e18a43820275f6f89f7f4 Mon Sep 17 00:00:00 2001 From: Ramkumar Sunderbabu Date: Sun, 15 Feb 2026 02:57:25 +0000 Subject: [PATCH 102/120] 8377517: AArch64: TestUseSHA3IntrinsicsWithUseSHADisabledOnUnsupportedCPU.java fails after JDK-8375443 Reviewed-by: chagedorn --- .../TestUseSHA3IntrinsicsWithUseSHADisabledOnSupportedCPU.java | 2 +- ...TestUseSHA3IntrinsicsWithUseSHADisabledOnUnsupportedCPU.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/hotspot/jtreg/compiler/arguments/TestUseSHA3IntrinsicsWithUseSHADisabledOnSupportedCPU.java b/test/hotspot/jtreg/compiler/arguments/TestUseSHA3IntrinsicsWithUseSHADisabledOnSupportedCPU.java index 2461f1ae92b..cf8000b7a21 100644 --- a/test/hotspot/jtreg/compiler/arguments/TestUseSHA3IntrinsicsWithUseSHADisabledOnSupportedCPU.java +++ b/test/hotspot/jtreg/compiler/arguments/TestUseSHA3IntrinsicsWithUseSHADisabledOnSupportedCPU.java @@ -52,7 +52,7 @@ public class TestUseSHA3IntrinsicsWithUseSHADisabledOnSupportedCPU { private static final String UNLOCK_DIAGNOSTIC = "-XX:+UnlockDiagnosticVMOptions"; public static void main(String[] args) throws Throwable { - if (!IntrinsicPredicates.isSHA3IntrinsicAvailable().getAsBoolean()) { + if (!IntrinsicPredicates.SHA3_INSTRUCTION_AVAILABLE.getAsBoolean()) { throw new SkippedException("Skipping... SHA3 intrinsics are not available on this platform."); } diff --git a/test/hotspot/jtreg/compiler/arguments/TestUseSHA3IntrinsicsWithUseSHADisabledOnUnsupportedCPU.java b/test/hotspot/jtreg/compiler/arguments/TestUseSHA3IntrinsicsWithUseSHADisabledOnUnsupportedCPU.java index 067bc723b5c..1e0df1874b6 100644 --- a/test/hotspot/jtreg/compiler/arguments/TestUseSHA3IntrinsicsWithUseSHADisabledOnUnsupportedCPU.java +++ b/test/hotspot/jtreg/compiler/arguments/TestUseSHA3IntrinsicsWithUseSHADisabledOnUnsupportedCPU.java @@ -51,7 +51,7 @@ public class TestUseSHA3IntrinsicsWithUseSHADisabledOnUnsupportedCPU { private static final String UNLOCK_DIAGNOSTIC = "-XX:+UnlockDiagnosticVMOptions"; public static void main(String[] args) throws Throwable { - if (IntrinsicPredicates.isSHA3IntrinsicAvailable().getAsBoolean()) { + if (IntrinsicPredicates.SHA3_INSTRUCTION_AVAILABLE.getAsBoolean()) { throw new SkippedException("Skipping... SHA3 intrinsics are available on this platform."); } From ef0851d8adbb834e1cd5aff5b3b973b953e57e2d Mon Sep 17 00:00:00 2001 From: Jeremy Wood Date: Sun, 15 Feb 2026 06:04:33 +0000 Subject: [PATCH 103/120] 8377428: VoiceOver Cursor Navigates Invisible Components Reviewed-by: serb, kizune --- .../sun/lwawt/macosx/CAccessibility.java | 62 +++++++-- ...estVoiceOverHiddenComponentNavigation.java | 121 ++++++++++++++++++ 2 files changed, 175 insertions(+), 8 deletions(-) create mode 100644 test/jdk/javax/accessibility/8377428/TestVoiceOverHiddenComponentNavigation.java diff --git a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibility.java b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibility.java index 4947d1a109e..494995735e6 100644 --- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibility.java +++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibility.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1030,13 +1030,19 @@ final class CAccessibility implements PropertyChangeListener { } if (!allowIgnored) { - final AccessibleRole role = context.getAccessibleRole(); - if (role != null && ignoredRoles != null && ignoredRoles.contains(roleKey(role))) { - // Get the child's unignored children. - _addChildren(child, whichChildren, false, childrenAndRoles, ChildrenOperations.COMMON); - } else { - childrenAndRoles.add(child); - childrenAndRoles.add(getAccessibleRole(child)); + // If a Component isn't showing then it should be classified as + // "ignored", and we should skip it and its descendants + if (isShowing(context)) { + final AccessibleRole role = context.getAccessibleRole(); + if (role != null && ignoredRoles != null && + ignoredRoles.contains(roleKey(role))) { + // Get the child's unignored children. + _addChildren(child, whichChildren, false, + childrenAndRoles, ChildrenOperations.COMMON); + } else { + childrenAndRoles.add(child); + childrenAndRoles.add(getAccessibleRole(child)); + } } } else { childrenAndRoles.add(child); @@ -1050,6 +1056,46 @@ final class CAccessibility implements PropertyChangeListener { } } + /** + * Return false if an AccessibleContext is not showing + *

+ * This first checks {@link AccessibleComponent#isShowing()}, if possible. + * If there is no AccessibleComponent then this checks the + * AccessibleStateSet for {@link AccessibleState#SHOWING}. If there is no + * AccessibleStateSet then we assume (given the lack of information) the + * AccessibleContext may be visible, and we recursive check its parent if + * possible. + * + * Return false if an AccessibleContext is not showing + */ + private static boolean isShowing(final AccessibleContext context) { + AccessibleComponent c = context.getAccessibleComponent(); + if (c != null) { + return c.isShowing(); + } + + AccessibleStateSet ass = context.getAccessibleStateSet(); + if (ass != null && ass.contains((AccessibleState.SHOWING))) { + return true; + } else { + // We don't have an AccessibleComponent. And either we don't + // have an AccessibleStateSet OR it doesn't include useful + // info to determine visibility/showing. So our status is + // unknown. When in doubt: assume we're showing and ask our + // parent if it is visible/showing. + } + + Accessible parent = context.getAccessibleParent(); + if (parent == null) { + return true; + } + AccessibleContext parentContext = parent.getAccessibleContext(); + if (parentContext == null) { + return true; + } + return isShowing(parentContext); + } + private static native String roleKey(AccessibleRole aRole); public static Object[] getChildren(final Accessible a, final Component c) { diff --git a/test/jdk/javax/accessibility/8377428/TestVoiceOverHiddenComponentNavigation.java b/test/jdk/javax/accessibility/8377428/TestVoiceOverHiddenComponentNavigation.java new file mode 100644 index 00000000000..f8af95159c2 --- /dev/null +++ b/test/jdk/javax/accessibility/8377428/TestVoiceOverHiddenComponentNavigation.java @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * 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 javax.accessibility.AccessibleComponent; +import javax.accessibility.AccessibleContext; +import javax.swing.BoxLayout; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JPanel; + +/* + * @test + * @key headful + * @bug 8377428 + * @summary manual test for VoiceOver reading hidden components + * @requires os.family == "mac" + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TestVoiceOverHiddenComponentNavigation + */ + +public class TestVoiceOverHiddenComponentNavigation { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + Test UI contains four rows. Each row contains a JButton. + Two of the rows are hidden, and two are visible. + + Follow these steps to test the behaviour: + + 1. Start the VoiceOver (Press Command + F5) application + 2. Move VoiceOver cursor to one of the visible buttons. + 3. Press CTRL + ALT + LEFT to move the VoiceOver cursor back + 4. Repeat step 3 until you reach the "Close" button. + + If VoiceOver ever references a "Hidden Button": then this test + fails. + """; + + PassFailJFrame.builder() + .title("TestVoiceOverHiddenComponentNavigation Instruction") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(TestVoiceOverHiddenComponentNavigation::createUI) + .build() + .awaitAndCheck(); + } + + private static JFrame createUI() { + JPanel rows = new JPanel(); + rows.setLayout(new BoxLayout(rows, BoxLayout.Y_AXIS)); + rows.add(createRow("Hidden Button", "Row 1", false, false)); + rows.add(createRow("Hidden Button", "Row 2", false, true)); + rows.add(createRow("Visible Button", "Row 3", true, false)); + rows.add(createRow("Visible Button", "Row 4", true, true)); + + JFrame frame = new JFrame("A Frame hidden JButtons"); + frame.getContentPane().add(rows); + frame.pack(); + return frame; + } + + /** + * Create a row to add to this demo frame. + * + * @param buttonText the button name/text + * @param panelAXName the panel accessible name + * @param isVisible whether JPanel.isVisible() should be true + * @param useNullAXComponent if true then + * AccessibleJPanel.getAccessibleComponent + * returns null. This was added to test a + * particular code path. + * @return a row for the demo frame + */ + private static JPanel createRow(String buttonText, String panelAXName, + boolean isVisible, + boolean useNullAXComponent) { + JPanel returnValue = new JPanel() { + @Override + public AccessibleContext getAccessibleContext() { + if (accessibleContext == null) { + accessibleContext = new AccessibleJPanel() { + @Override + public AccessibleComponent getAccessibleComponent() { + if (useNullAXComponent) { + return null; + } else { + return super.getAccessibleComponent(); + } + } + }; + accessibleContext.setAccessibleName(panelAXName); + } + return accessibleContext; + } + }; + returnValue.setVisible(isVisible); + JButton button = new JButton(buttonText); + returnValue.add(button); + return returnValue; + } +} \ No newline at end of file From 0196d4ecf69d9509d59a266e163308d0783eaa25 Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Mon, 16 Feb 2026 07:47:52 +0000 Subject: [PATCH 104/120] 8377878: Problem list compiler/vectorization/TestVectorAlgorithms.java on AIX and Linux s390x Reviewed-by: ayang, lucy --- test/hotspot/jtreg/ProblemList.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index 3e4814180f6..07a535f7ad5 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -59,6 +59,8 @@ compiler/codecache/jmx/PoolsIndependenceTest.java 8264632 macosx-all compiler/vectorapi/reshape/TestVectorReinterpret.java 8320897,8348519 aix-ppc64,linux-ppc64le,linux-s390x compiler/vectorapi/VectorRebracket128Test.java 8330538 generic-all +compiler/vectorization/TestVectorAlgorithms.java 8376803 aix-ppc64,linux-s390x + compiler/jvmci/TestUncaughtErrorInCompileMethod.java 8309073 generic-all compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DataPatchTest.java 8331704 linux-riscv64 compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/MaxOopMapStackOffsetTest.java 8331704 linux-riscv64 From 0043a049d222736ecfece6afa7ad8963ef89c787 Mon Sep 17 00:00:00 2001 From: Christian Hagedorn Date: Mon, 16 Feb 2026 08:09:49 +0000 Subject: [PATCH 105/120] 8376174: [IR Framework] Refactor Test VM socket communication Reviewed-by: dfenacci, mchevalier, thartmann --- .../lib/ir_framework/TestFramework.java | 3 +- .../ir_framework/driver/TestVMProcess.java | 61 +----- .../irmatching/parser/TestClassParser.java | 9 +- .../driver/network/TestVMData.java | 104 ++++++++++ .../network/testvm/TestVmMessageReader.java | 69 +++++++ .../network/testvm/java/JavaMessages.java | 50 +++++ .../shared/TestFrameworkSocket.java | 179 ++++++------------ .../lib/ir_framework/test/AbstractTest.java | 7 +- .../test/ApplicableIRRulesPrinter.java | 11 +- .../lib/ir_framework/test/TestVM.java | 14 +- .../lib/ir_framework/test/VMInfoPrinter.java | 5 +- .../ir_framework/test/network/MessageTag.java | 32 ++++ .../test/network/TestVmSocket.java | 105 ++++++++++ .../tests/TestPhaseIRMatching.java | 3 +- 14 files changed, 445 insertions(+), 207 deletions(-) create mode 100644 test/hotspot/jtreg/compiler/lib/ir_framework/driver/network/TestVMData.java create mode 100644 test/hotspot/jtreg/compiler/lib/ir_framework/driver/network/testvm/TestVmMessageReader.java create mode 100644 test/hotspot/jtreg/compiler/lib/ir_framework/driver/network/testvm/java/JavaMessages.java create mode 100644 test/hotspot/jtreg/compiler/lib/ir_framework/test/network/MessageTag.java create mode 100644 test/hotspot/jtreg/compiler/lib/ir_framework/test/network/TestVmSocket.java diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/TestFramework.java b/test/hotspot/jtreg/compiler/lib/ir_framework/TestFramework.java index 137efd18136..debb025f449 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/TestFramework.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/TestFramework.java @@ -881,8 +881,7 @@ public class TestFramework { if (shouldVerifyIR) { try { TestClassParser testClassParser = new TestClassParser(testClass, allowNotCompilable); - Matchable testClassMatchable = testClassParser.parse(testVMProcess.getHotspotPidFileName(), - testVMProcess.getApplicableIRRules()); + Matchable testClassMatchable = testClassParser.parse(testVMProcess.testVmData()); IRMatcher matcher = new IRMatcher(testClassMatchable); matcher.match(); } catch (IRViolationException e) { diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/TestVMProcess.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/TestVMProcess.java index 931d687b0bc..9a55db01fa0 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/TestVMProcess.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/TestVMProcess.java @@ -24,6 +24,7 @@ package compiler.lib.ir_framework.driver; import compiler.lib.ir_framework.TestFramework; +import compiler.lib.ir_framework.driver.network.TestVMData; import compiler.lib.ir_framework.shared.TestFrameworkException; import compiler.lib.ir_framework.shared.TestFrameworkSocket; import compiler.lib.ir_framework.shared.NoTestsRunException; @@ -58,10 +59,9 @@ public class TestVMProcess { private static String lastTestVMOutput = ""; private final ArrayList cmds; - private String hotspotPidFileName; private String commandLine; private OutputAnalyzer oa; - private String applicableIRRules; + private final TestVMData testVmData; public TestVMProcess(List additionalFlags, Class testClass, Set> helperClasses, int defaultWarmup, boolean allowNotCompilable, boolean testClassesOnBootClassPath) { @@ -72,20 +72,17 @@ public class TestVMProcess { allowNotCompilable, testClassesOnBootClassPath); start(); } - processSocketOutput(socket); checkTestVMExitCode(); + String hotspotPidFileName = String.format("hotspot_pid%d.log", oa.pid()); + testVmData = socket.testVmData(hotspotPidFileName, allowNotCompilable); } public String getCommandLine() { return commandLine; } - public String getApplicableIRRules() { - return applicableIRRules; - } - - public String getHotspotPidFileName() { - return hotspotPidFileName; + public TestVMData testVmData() { + return testVmData; } public static String getLastTestVMOutput() { @@ -172,55 +169,9 @@ public class TestVMProcess { process.command().add(1, "-DReproduce=true"); // Add after "/path/to/bin/java" in order to rerun the Test VM directly commandLine = "Command Line:" + System.lineSeparator() + String.join(" ", process.command()) + System.lineSeparator(); - hotspotPidFileName = String.format("hotspot_pid%d.log", oa.pid()); lastTestVMOutput = oa.getOutput(); } - /** - * Process the socket output: All prefixed lines are dumped to the standard output while the remaining lines - * represent the Applicable IR Rules used for IR matching later. - */ - private void processSocketOutput(TestFrameworkSocket socket) { - String output = socket.getOutput(); - if (socket.hasStdOut()) { - StringBuilder testListBuilder = new StringBuilder(); - StringBuilder messagesBuilder = new StringBuilder(); - StringBuilder nonStdOutBuilder = new StringBuilder(); - Scanner scanner = new Scanner(output); - while (scanner.hasNextLine()) { - String line = scanner.nextLine(); - if (line.startsWith(TestFrameworkSocket.STDOUT_PREFIX)) { - // Exclude [STDOUT] from message. - line = line.substring(TestFrameworkSocket.STDOUT_PREFIX.length()); - if (line.startsWith(TestFrameworkSocket.TESTLIST_TAG)) { - // Exclude [TESTLIST] from message for better formatting. - line = "> " + line.substring(TestFrameworkSocket.TESTLIST_TAG.length() + 1); - testListBuilder.append(line).append(System.lineSeparator()); - } else { - messagesBuilder.append(line).append(System.lineSeparator()); - } - } else { - nonStdOutBuilder.append(line).append(System.lineSeparator()); - } - } - System.out.println(); - if (!testListBuilder.isEmpty()) { - System.out.println("Run flag defined test list"); - System.out.println("--------------------------"); - System.out.println(testListBuilder); - System.out.println(); - } - if (!messagesBuilder.isEmpty()) { - System.out.println("Messages from Test VM"); - System.out.println("---------------------"); - System.out.println(messagesBuilder); - } - applicableIRRules = nonStdOutBuilder.toString(); - } else { - applicableIRRules = output; - } - } - private void checkTestVMExitCode() { final int exitCode = oa.getExitValue(); if (EXCLUDE_RANDOM || REPORT_STDOUT || (VERBOSE && exitCode == 0)) { diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/TestClassParser.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/TestClassParser.java index 2329b41afbe..6c899af2116 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/TestClassParser.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/parser/TestClassParser.java @@ -30,6 +30,7 @@ import compiler.lib.ir_framework.driver.irmatching.irmethod.IRMethod; import compiler.lib.ir_framework.driver.irmatching.irmethod.IRMethodMatchable; import compiler.lib.ir_framework.driver.irmatching.parser.hotspot.HotSpotPidFileParser; import compiler.lib.ir_framework.driver.irmatching.parser.hotspot.LoggedMethods; +import compiler.lib.ir_framework.driver.network.TestVMData; import compiler.lib.ir_framework.shared.TestFormat; import java.util.SortedSet; @@ -53,13 +54,13 @@ public class TestClassParser { * Parse the Applicable IR Rules and hotspot_pid* file to create a collection of {@link IRMethod} objects. * Return a default/empty TestClass object if there are no applicable @IR rules in any method of the test class. */ - public Matchable parse(String hotspotPidFileName, String applicableIRRules) { + public Matchable parse(TestVMData testVmData) { ApplicableIRRulesParser applicableIRRulesParser = new ApplicableIRRulesParser(testClass); - TestMethods testMethods = applicableIRRulesParser.parse(applicableIRRules); - VMInfo vmInfo = VMInfoParser.parseVMInfo(applicableIRRules); + TestMethods testMethods = applicableIRRulesParser.parse(testVmData.applicableIRRules()); + VMInfo vmInfo = VMInfoParser.parseVMInfo(testVmData.applicableIRRules()); if (testMethods.hasTestMethods()) { HotSpotPidFileParser hotSpotPidFileParser = new HotSpotPidFileParser(testClass.getName(), testMethods); - LoggedMethods loggedMethods = hotSpotPidFileParser.parse(hotspotPidFileName); + LoggedMethods loggedMethods = hotSpotPidFileParser.parse(testVmData.hotspotPidFileName()); return createTestClass(testMethods, loggedMethods, vmInfo); } return new NonIRTestClass(); diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/network/TestVMData.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/network/TestVMData.java new file mode 100644 index 00000000000..daa6a590ddf --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/network/TestVMData.java @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * 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 compiler.lib.ir_framework.driver.network; + +import compiler.lib.ir_framework.driver.irmatching.IRMatcher; +import compiler.lib.ir_framework.driver.network.testvm.java.JavaMessages; +import compiler.lib.ir_framework.shared.TestFrameworkSocket; +import compiler.lib.ir_framework.test.network.MessageTag; + +import java.util.Scanner; + +/** + * This class collects all the parsed data received over the {@link TestFrameworkSocket}. This data is required later + * in the {@link IRMatcher}. + */ +public class TestVMData { + private final boolean allowNotCompilable; + private final String hotspotPidFileName; + private final String applicableIRRules; + + public TestVMData(JavaMessages javaMessages, String hotspotPidFileName, boolean allowNotCompilable) { + this.applicableIRRules = processOutput(javaMessages); + this.hotspotPidFileName = hotspotPidFileName; + this.allowNotCompilable = allowNotCompilable; + } + + public String hotspotPidFileName() { + return hotspotPidFileName; + } + + public boolean allowNotCompilable() { + return allowNotCompilable; + } + + public String applicableIRRules() { + return applicableIRRules; + } + + /** + * Process the socket output: All prefixed lines are dumped to the standard output while the remaining lines + * represent the Applicable IR Rules used for IR matching later. + */ + private String processOutput(JavaMessages javaMessages) { + String output = javaMessages.output(); + if (javaMessages.hasStdOut()) { + StringBuilder testListBuilder = new StringBuilder(); + StringBuilder messagesBuilder = new StringBuilder(); + StringBuilder nonStdOutBuilder = new StringBuilder(); + Scanner scanner = new Scanner(output); + while (scanner.hasNextLine()) { + String line = scanner.nextLine(); + if (line.startsWith(MessageTag.STDOUT)) { + // Exclude [STDOUT] from message. + line = line.substring(MessageTag.STDOUT.length()); + if (line.startsWith(MessageTag.TEST_LIST)) { + // Exclude [TEST_LIST] from message for better formatting. + line = "> " + line.substring(MessageTag.TEST_LIST.length() + 1); + testListBuilder.append(line).append(System.lineSeparator()); + } else { + messagesBuilder.append(line).append(System.lineSeparator()); + } + } else { + nonStdOutBuilder.append(line).append(System.lineSeparator()); + } + } + System.out.println(); + if (!testListBuilder.isEmpty()) { + System.out.println("Run flag defined test list"); + System.out.println("--------------------------"); + System.out.println(testListBuilder); + System.out.println(); + } + if (!messagesBuilder.isEmpty()) { + System.out.println("Messages from Test VM"); + System.out.println("---------------------"); + System.out.println(messagesBuilder); + } + return nonStdOutBuilder.toString(); + } else { + return output; + } + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/network/testvm/TestVmMessageReader.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/network/testvm/TestVmMessageReader.java new file mode 100644 index 00000000000..b438794964d --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/network/testvm/TestVmMessageReader.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * 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 compiler.lib.ir_framework.driver.network.testvm; + +import compiler.lib.ir_framework.driver.network.testvm.java.JavaMessages; +import compiler.lib.ir_framework.shared.TestFrameworkException; +import compiler.lib.ir_framework.shared.TestFrameworkSocket; +import compiler.lib.ir_framework.test.network.MessageTag; + +import java.io.BufferedReader; +import java.net.Socket; +import java.util.concurrent.Callable; +import java.util.concurrent.Future; + +/** + * Dedicated reader for Test VM messages received by the {@link TestFrameworkSocket}. The reader is used as a task + * wrapped in a {@link Future}. The received messages are returned in a new {@link JavaMessages} wrapper. Once the + * Test VM is terminated, the client connection is closed and the parsed messages can be fetched with + * {@link Future#get()} which calls {@link #call()}. + */ +public class TestVmMessageReader implements Callable { + private final Socket socket; + private final BufferedReader reader; + private boolean receivedStdOut; + + public TestVmMessageReader(Socket socket, BufferedReader reader) { + this.socket = socket; + this.reader = reader; + this.receivedStdOut = false; + } + + @Override + public JavaMessages call() { + try (socket; reader) { + StringBuilder builder = new StringBuilder(); + String line; + while ((line = reader.readLine()) != null) { + builder.append(line).append(System.lineSeparator()); + if (line.startsWith(MessageTag.STDOUT)) { + receivedStdOut = true; + } + } + return new JavaMessages(builder.toString(), receivedStdOut); + } catch (Exception e) { + throw new TestFrameworkException("Error while reading Test VM socket messages", e); + } + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/driver/network/testvm/java/JavaMessages.java b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/network/testvm/java/JavaMessages.java new file mode 100644 index 00000000000..b8a3f39c637 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/driver/network/testvm/java/JavaMessages.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * 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 compiler.lib.ir_framework.driver.network.testvm.java; + +import compiler.lib.ir_framework.test.network.MessageTag; + +/** + * Class to collect all Java messages sent from the Test VM to the Driver VM. + */ +public class JavaMessages { + private final String output; + private final boolean receivedStdOut; + + public JavaMessages(String output, boolean receivedStdOut) { + this.output = output; + this.receivedStdOut = receivedStdOut; + } + + public String output() { + return output; + } + + /** + * Return whether Test VM sent messages to be put on stdout (starting with {@link MessageTag#STDOUT}). + */ + public boolean hasStdOut() { + return receivedStdOut; + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/shared/TestFrameworkSocket.java b/test/hotspot/jtreg/compiler/lib/ir_framework/shared/TestFrameworkSocket.java index f10540ebc5b..77d560952f1 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/shared/TestFrameworkSocket.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/shared/TestFrameworkSocket.java @@ -24,40 +24,27 @@ package compiler.lib.ir_framework.shared; import compiler.lib.ir_framework.TestFramework; +import compiler.lib.ir_framework.driver.network.*; +import compiler.lib.ir_framework.driver.network.testvm.TestVmMessageReader; +import compiler.lib.ir_framework.driver.network.testvm.java.JavaMessages; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; -import java.io.PrintWriter; -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.net.ServerSocket; -import java.net.Socket; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.FutureTask; +import java.net.*; +import java.util.concurrent.*; /** - * Dedicated socket to send data from the flag and Test VM back to the Driver VM. + * Dedicated Driver VM socket to receive data from the Test VM. Could either be received from Java and C2 code. */ public class TestFrameworkSocket implements AutoCloseable { - public static final String STDOUT_PREFIX = "[STDOUT]"; - public static final String TESTLIST_TAG = "[TESTLIST]"; - public static final String DEFAULT_REGEX_TAG = "[DEFAULT_REGEX]"; - public static final String PRINT_TIMES_TAG = "[PRINT_TIMES]"; - public static final String NOT_COMPILABLE_TAG = "[NOT_COMPILABLE]"; - - // Static fields used for Test VM only. private static final String SERVER_PORT_PROPERTY = "ir.framework.server.port"; - private static final int SERVER_PORT = Integer.getInteger(SERVER_PORT_PROPERTY, -1); - private static final boolean REPRODUCE = Boolean.getBoolean("Reproduce"); - private static Socket clientSocket = null; - private static PrintWriter clientWriter = null; - - private final String serverPortPropertyFlag; - private FutureTask socketTask; + private final int serverSocketPort; private final ServerSocket serverSocket; - private boolean receivedStdOut = false; + private boolean running; + private final ExecutorService executor; + private Future javaFuture; public TestFrameworkSocket() { try { @@ -66,140 +53,80 @@ public class TestFrameworkSocket implements AutoCloseable { } catch (IOException e) { throw new TestFrameworkException("Failed to create TestFramework server socket", e); } - int port = serverSocket.getLocalPort(); + serverSocketPort = serverSocket.getLocalPort(); + executor = Executors.newCachedThreadPool(); if (TestFramework.VERBOSE) { - System.out.println("TestFramework server socket uses port " + port); + System.out.println("TestFramework server socket uses port " + serverSocketPort); } - serverPortPropertyFlag = "-D" + SERVER_PORT_PROPERTY + "=" + port; start(); } public String getPortPropertyFlag() { - return serverPortPropertyFlag; + return "-D" + SERVER_PORT_PROPERTY + "=" + serverSocketPort; } private void start() { - socketTask = initSocketTask(); - Thread socketThread = new Thread(socketTask); - socketThread.start(); + running = true; + executor.submit(this::acceptLoop); } /** - * Waits for a client (created by flag or Test VM) to connect. Return the messages received from the client. + * Main loop to wait for new client connections and handling them upon connection request. */ - private FutureTask initSocketTask() { - return new FutureTask<>(() -> { - try (Socket clientSocket = serverSocket.accept(); - BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())) - ) { - StringBuilder builder = new StringBuilder(); - String next; - while ((next = in.readLine()) != null) { - builder.append(next).append(System.lineSeparator()); - if (next.startsWith(STDOUT_PREFIX)) { - receivedStdOut = true; - } - } - return builder.toString(); - } catch (IOException e) { + private void acceptLoop() { + while (running) { + try { + acceptNewClientConnection(); + } catch (TestFrameworkException e) { + running = false; + throw e; + } catch (Exception e) { + running = false; throw new TestFrameworkException("Server socket error", e); } - }); + } + } + + /** + * Accept new client connection and then submit a task accordingly to manage incoming message on that connection/socket. + */ + private void acceptNewClientConnection() throws IOException { + Socket client = serverSocket.accept(); + BufferedReader reader = new BufferedReader(new InputStreamReader(client.getInputStream())); + submitTask(client, reader); + } + + /** + * Submit dedicated tasks which are wrapped into {@link Future} objects. The tasks will read all messages sent + * over that connection. + */ + private void submitTask(Socket client, BufferedReader reader) { + javaFuture = executor.submit(new TestVmMessageReader(client, reader)); } @Override public void close() { try { + running = false; serverSocket.close(); } catch (IOException e) { throw new TestFrameworkException("Could not close socket", e); } + executor.shutdown(); } - /** - * Only called by Test VM to write to server socket. - */ - public static void write(String msg, String tag) { - write(msg, tag, false); + public TestVMData testVmData(String hotspotPidFileName, boolean allowNotCompilable) { + JavaMessages javaMessages = testVmMessages(); + return new TestVMData(javaMessages, hotspotPidFileName, allowNotCompilable); } - /** - * Only called by Test VM to write to server socket. - *

- * The Test VM is spawned by the main jtreg VM. The stdout of the Test VM is hidden - * unless the Verbose or ReportStdout flag is used. TestFrameworkSocket is used by the parent jtreg - * VM and the Test VM to communicate. By sending the prints through the TestFrameworkSocket with the - * parameter stdout set to true, the parent VM will print the received messages to its stdout, making it - * visible to the user. - */ - public static void write(String msg, String tag, boolean stdout) { - if (REPRODUCE) { - System.out.println("Debugging Test VM: Skip writing due to -DReproduce"); - return; - } - TestFramework.check(SERVER_PORT != -1, "Server port was not set correctly for flag and/or Test VM " - + "or method not called from flag or Test VM"); + private JavaMessages testVmMessages() { try { - // Keep the client socket open until the Test VM terminates (calls closeClientSocket before exiting main()). - if (clientSocket == null) { - clientSocket = new Socket(InetAddress.getLoopbackAddress(), SERVER_PORT); - clientWriter = new PrintWriter(clientSocket.getOutputStream(), true); - } - if (stdout) { - msg = STDOUT_PREFIX + tag + " " + msg; - } - clientWriter.println(msg); - } catch (Exception e) { - // When the Test VM is directly run, we should ignore all messages that would normally be sent to the - // Driver VM. - String failMsg = System.lineSeparator() + System.lineSeparator() + """ - ########################################################### - Did you directly run the Test VM (TestVM class) - to reproduce a bug? - => Append the flag -DReproduce=true and try again! - ########################################################### - """; - throw new TestRunException(failMsg, e); - } - if (TestFramework.VERBOSE) { - System.out.println("Written " + tag + " to socket:"); - System.out.println(msg); - } - } - - /** - * Closes (and flushes) the printer to the socket and the socket itself. Is called as last thing before exiting - * the main() method of the flag and the Test VM. - */ - public static void closeClientSocket() { - if (clientSocket != null) { - try { - clientWriter.close(); - clientSocket.close(); - } catch (IOException e) { - throw new RuntimeException("Could not close TestVM socket", e); - } - } - } - - /** - * Get the socket output of the Flag VM. - */ - public String getOutput() { - try { - return socketTask.get(); + return javaFuture.get(); } catch (ExecutionException e) { - // Thrown when socket task was not finished, yet (i.e. no client sent data) but socket was already closed. - return ""; + throw new TestFrameworkException("No test VM messages were received", e); } catch (Exception e) { - throw new TestFrameworkException("Could not read from socket task", e); + throw new TestFrameworkException("Error while fetching Test VM Future", e); } } - - /** - * Return whether Test VM sent messages to be put on stdout (starting with {@link ::STDOUT_PREFIX}). - */ - public boolean hasStdOut() { - return receivedStdOut; - } } diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/test/AbstractTest.java b/test/hotspot/jtreg/compiler/lib/ir_framework/test/AbstractTest.java index 4d227900e2e..152dcab273a 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/test/AbstractTest.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/test/AbstractTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2026, Oracle and/or its affiliates. All rights reserved. * 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,13 @@ package compiler.lib.ir_framework.test; import compiler.lib.ir_framework.*; import compiler.lib.ir_framework.shared.TestRun; import compiler.lib.ir_framework.shared.TestRunException; +import compiler.lib.ir_framework.test.network.TestVmSocket; import jdk.test.whitebox.WhiteBox; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.lang.reflect.Modifier; -import compiler.lib.ir_framework.shared.TestFrameworkSocket; - /** * Abstract super class for base, checked and custom run tests. */ @@ -118,7 +117,7 @@ abstract class AbstractTest { tryCompileMethod(test); } catch (MethodNotCompilableException e) { final Method testMethod = test.getTestMethod(); - TestFrameworkSocket.write("Method not compilable: " + testMethod, TestFrameworkSocket.NOT_COMPILABLE_TAG, true); + TestVmSocket.send("Method not compilable: " + testMethod); TestRun.check(test.isAllowNotCompilable(), "Method " + testMethod + " not compilable (anymore) at level " + test.getCompLevel() + ". Most likely, this is not expected, but if it is, you can use 'allowNotCompilable'."); diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/test/ApplicableIRRulesPrinter.java b/test/hotspot/jtreg/compiler/lib/ir_framework/test/ApplicableIRRulesPrinter.java index 7a868c172dd..15d9a2e4e34 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/test/ApplicableIRRulesPrinter.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/test/ApplicableIRRulesPrinter.java @@ -27,6 +27,8 @@ import compiler.lib.ir_framework.IR; import compiler.lib.ir_framework.IRNode; import compiler.lib.ir_framework.TestFramework; import compiler.lib.ir_framework.shared.*; +import compiler.lib.ir_framework.test.network.MessageTag; +import compiler.lib.ir_framework.test.network.TestVmSocket; import jdk.test.lib.Platform; import jdk.test.whitebox.WhiteBox; @@ -171,9 +173,8 @@ public class ApplicableIRRulesPrinter { } private void printDisableReason(String method, String reason, String[] apply, int ruleIndex, int ruleMax) { - TestFrameworkSocket.write("Disabling IR matching for rule " + ruleIndex + " of " + ruleMax + " in " + - method + ": " + reason + ": " + String.join(", ", apply), - "[ApplicableIRRules]", true); + TestVmSocket.send("Disabling IR matching for rule " + ruleIndex + " of " + ruleMax + " in " + method + ": " + + reason + ": " + String.join(", ", apply)); } private boolean shouldApplyIrRule(IR irAnno, String m, int ruleIndex, int ruleMax) { @@ -286,7 +287,7 @@ public class ApplicableIRRulesPrinter { IRNode.checkIRNodeSupported(s); } } catch (CheckedTestFrameworkException e) { - TestFrameworkSocket.write("Skip Rule " + ruleIndex + ": " + e.getMessage(), TestFrameworkSocket.DEFAULT_REGEX_TAG, true); + TestVmSocket.send("Skip Rule " + ruleIndex + ": " + e.getMessage()); return true; } return false; @@ -524,7 +525,7 @@ public class ApplicableIRRulesPrinter { public void emit() { output.append(END); - TestFrameworkSocket.write(output.toString(), "ApplicableIRRules"); + TestVmSocket.sendWithTag(MessageTag.APPLICABLE_IR_RULES, output.toString()); } } diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/test/TestVM.java b/test/hotspot/jtreg/compiler/lib/ir_framework/test/TestVM.java index 14551141cd7..c5e94c32c08 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/test/TestVM.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/test/TestVM.java @@ -26,6 +26,8 @@ package compiler.lib.ir_framework.test; import compiler.lib.ir_framework.*; import compiler.lib.ir_framework.Compiler; import compiler.lib.ir_framework.shared.*; +import compiler.lib.ir_framework.test.network.MessageTag; +import compiler.lib.ir_framework.test.network.TestVmSocket; import jdk.test.lib.Platform; import jdk.test.lib.Utils; import jdk.test.whitebox.WhiteBox; @@ -38,8 +40,6 @@ import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; -import static compiler.lib.ir_framework.shared.TestFrameworkSocket.PRINT_TIMES_TAG; - /** * This class' main method is called from {@link TestFramework} and represents the so-called "Test VM". The class is * the heart of the framework and is responsible for executing all the specified tests in the test class. It uses the @@ -159,6 +159,7 @@ public class TestVM { */ public static void main(String[] args) { try { + TestVmSocket.connect(); String testClassName = args[0]; System.out.println("TestVM main() called - about to run tests in class " + testClassName); Class testClass = getClassObject(testClassName, "test"); @@ -167,7 +168,7 @@ public class TestVM { framework.addHelperClasses(args); framework.start(); } finally { - TestFrameworkSocket.closeClientSocket(); + TestVmSocket.close(); } } @@ -864,7 +865,7 @@ public class TestVM { System.out.println("Run " + test.toString()); } if (testFilterPresent) { - TestFrameworkSocket.write("Run " + test.toString(), TestFrameworkSocket.TESTLIST_TAG, true); + TestVmSocket.send(MessageTag.TEST_LIST + "Run " + test.toString()); } try { test.run(); @@ -892,10 +893,9 @@ public class TestVM { // Print execution times if (PRINT_TIMES) { - TestFrameworkSocket.write("Test execution times:", PRINT_TIMES_TAG, true); + TestVmSocket.send(MessageTag.PRINT_TIMES + " Test execution times:"); for (Map.Entry entry : durations.entrySet()) { - TestFrameworkSocket.write(String.format("%-25s%15d ns%n", entry.getValue() + ":", entry.getKey()), - PRINT_TIMES_TAG, true); + TestVmSocket.send(MessageTag.PRINT_TIMES + String.format("%-25s%15d ns%n", entry.getValue() + ":", entry.getKey())); } } diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/test/VMInfoPrinter.java b/test/hotspot/jtreg/compiler/lib/ir_framework/test/VMInfoPrinter.java index 470569122dd..2227c7760d5 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/test/VMInfoPrinter.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/test/VMInfoPrinter.java @@ -23,7 +23,8 @@ package compiler.lib.ir_framework.test; -import compiler.lib.ir_framework.shared.TestFrameworkSocket; +import compiler.lib.ir_framework.test.network.MessageTag; +import compiler.lib.ir_framework.test.network.TestVmSocket; import jdk.test.whitebox.WhiteBox; /** @@ -65,6 +66,6 @@ public class VMInfoPrinter { .append(System.lineSeparator()); vmInfo.append(END_VM_INFO); - TestFrameworkSocket.write(vmInfo.toString(), "VMInfo"); + TestVmSocket.sendWithTag(MessageTag.VM_INFO, vmInfo.toString()); } } diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/test/network/MessageTag.java b/test/hotspot/jtreg/compiler/lib/ir_framework/test/network/MessageTag.java new file mode 100644 index 00000000000..2981f203e65 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/test/network/MessageTag.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * 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 compiler.lib.ir_framework.test.network; + +public class MessageTag { + public static final String STDOUT = "[STDOUT]"; + public static final String TEST_LIST = "[TEST_LIST]"; + public static final String PRINT_TIMES = "[PRINT_TIMES]"; + public static final String VM_INFO = "[VM_INFO]"; + public static final String APPLICABLE_IR_RULES = "[APPLICABLE_IR_RULES]"; +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/test/network/TestVmSocket.java b/test/hotspot/jtreg/compiler/lib/ir_framework/test/network/TestVmSocket.java new file mode 100644 index 00000000000..c1065c84320 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/test/network/TestVmSocket.java @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * 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 compiler.lib.ir_framework.test.network; + +import compiler.lib.ir_framework.TestFramework; +import compiler.lib.ir_framework.shared.TestRunException; + +import java.io.IOException; +import java.io.PrintWriter; +import java.net.InetAddress; +import java.net.Socket; + +public class TestVmSocket { + private static final boolean REPRODUCE = Boolean.getBoolean("Reproduce"); + private static final String SERVER_PORT_PROPERTY = "ir.framework.server.port"; + private static final int SERVER_PORT = Integer.getInteger(SERVER_PORT_PROPERTY, -1); + + private static Socket socket = null; + private static PrintWriter writer = null; + + /** + * Send a message to the Driver VM which is unconditionally shown in the Driver VM output. + */ + public static void send(String message) { + sendWithTag(MessageTag.STDOUT, message); + } + + /** + * Send a message to the Driver VM with a {@link MessageTag}. Not all messages are shown by default in the + * Driver VM output and require setting some property flags first like {@code -DPrintTimes=true}. + */ + public static void sendWithTag(String tag, String message) { + if (REPRODUCE) { + // Debugging Test VM: Skip writing due to -DReproduce; + return; + } + + TestFramework.check(socket != null, "must be connected"); + writer.println(tag + " " + message); + } + + public static void connect() { + if (REPRODUCE) { + // Debugging Test VM: Skip writing due to -DReproduce; + return; + } + + TestFramework.check(SERVER_PORT != -1, "Server port was not set correctly for flag and/or test VM " + + "or method not called from flag or test VM"); + + try { + // Keep the client socket open until the test VM terminates (calls closeClientSocket before exiting main()). + socket = new Socket(InetAddress.getLoopbackAddress(), SERVER_PORT); + writer = new PrintWriter(socket.getOutputStream(), true); + } catch (Exception e) { + // When the test VM is directly run, we should ignore all messages that would normally be sent to the + // driver VM. + String failMsg = System.lineSeparator() + System.lineSeparator() + """ + ########################################################### + Did you directly run the test VM (TestVM class) + to reproduce a bug? + => Append the flag -DReproduce=true and try again! + ########################################################### + """; + throw new TestRunException(failMsg, e); + } + + } + + /** + * Closes (and flushes) the printer to the socket and the socket itself. Is called as last thing before exiting + * the main() method of the flag and the test VM. + */ + public static void close() { + if (socket != null) { + writer.close(); + try { + socket.close(); + } catch (IOException e) { + throw new RuntimeException("Could not close TestVM socket", e); + } + } + } +} diff --git a/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestPhaseIRMatching.java b/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestPhaseIRMatching.java index 70e4c463c55..8bec7c03bfe 100644 --- a/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestPhaseIRMatching.java +++ b/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestPhaseIRMatching.java @@ -69,8 +69,7 @@ public class TestPhaseIRMatching { List testVMFlags = flagVMProcess.getTestVMFlags(); TestVMProcess testVMProcess = new TestVMProcess(testVMFlags, testClass, null, -1, false, false); TestClassParser testClassParser = new TestClassParser(testClass, false); - Matchable testClassMatchable = testClassParser.parse(testVMProcess.getHotspotPidFileName(), - testVMProcess.getApplicableIRRules()); + Matchable testClassMatchable = testClassParser.parse(testVMProcess.testVmData()); MatchResult result = testClassMatchable.match(); List expectedFails = new ExpectedFailsBuilder().build(testClass); List foundFailures = new FailureBuilder().build(result); From 1b39d2c28c18130b1dac69c05217572d2760cc53 Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Mon, 16 Feb 2026 08:16:17 +0000 Subject: [PATCH 106/120] 8377898: Hotspot build on AIX with unused-functions warning reports some unused functions Reviewed-by: mdoerr, ayang, lucy --- src/hotspot/cpu/ppc/methodHandles_ppc.cpp | 9 ++------- src/hotspot/os/aix/os_perf_aix.cpp | 6 ------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/hotspot/cpu/ppc/methodHandles_ppc.cpp b/src/hotspot/cpu/ppc/methodHandles_ppc.cpp index 803bb6bfe69..45537e0ea96 100644 --- a/src/hotspot/cpu/ppc/methodHandles_ppc.cpp +++ b/src/hotspot/cpu/ppc/methodHandles_ppc.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2025 SAP SE. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2026 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,11 +49,6 @@ #define BIND(label) bind(label); BLOCK_COMMENT(#label ":") -// Workaround for C++ overloading nastiness on '0' for RegisterOrConstant. -inline static RegisterOrConstant constant(int value) { - return RegisterOrConstant(value); -} - void MethodHandles::load_klass_from_Class(MacroAssembler* _masm, Register klass_reg, Register temp_reg, Register temp2_reg) { if (VerifyMethodHandles) { diff --git a/src/hotspot/os/aix/os_perf_aix.cpp b/src/hotspot/os/aix/os_perf_aix.cpp index aa8819d035f..cbf78083483 100644 --- a/src/hotspot/os/aix/os_perf_aix.cpp +++ b/src/hotspot/os/aix/os_perf_aix.cpp @@ -143,12 +143,6 @@ static OSReturn get_jvm_load(double* jvm_uload, double* jvm_sload) { return OS_OK; } -static void update_prev_time(jvm_time_store_t* from, jvm_time_store_t* to) { - if (from && to) { - memcpy(to, from, sizeof(jvm_time_store_t)); - } -} - static void update_prev_ticks(cpu_tick_store_t* from, cpu_tick_store_t* to) { if (from && to) { memcpy(to, from, sizeof(cpu_tick_store_t)); From b9406a5dbaac7082419ea936f3cc3e61e6ac96d0 Mon Sep 17 00:00:00 2001 From: Anton Artemov Date: Mon, 16 Feb 2026 08:27:26 +0000 Subject: [PATCH 107/120] 8376665: Port fdlibm acosh to Java Reviewed-by: rgiulietti, darcy --- .../share/classes/java/lang/FdLibm.java | 46 +++ .../share/classes/java/lang/Math.java | 37 +- .../share/classes/java/lang/StrictMath.java | 30 +- test/jdk/java/lang/Math/HyperbolicTests.java | 371 +++++++++++++++++- .../java/lang/StrictMath/ExhaustingTests.java | 1 + .../java/lang/StrictMath/FdlibmTranslit.java | 45 +++ .../java/lang/StrictMath/HyperbolicTests.java | 59 ++- 7 files changed, 580 insertions(+), 9 deletions(-) diff --git a/src/java.base/share/classes/java/lang/FdLibm.java b/src/java.base/share/classes/java/lang/FdLibm.java index 78090be2b05..8e75f8f6994 100644 --- a/src/java.base/share/classes/java/lang/FdLibm.java +++ b/src/java.base/share/classes/java/lang/FdLibm.java @@ -3561,4 +3561,50 @@ final class FdLibm { return hx > 0 ? w : -w; } } + + /** + * Return the Inverse Hyperbolic Cosine of x + * + * Method : + * + * + * acosh(x) is defined so that acosh(cosh(alpha)) = alpha, -∞ < alpha < ∞ + * and cosh(acosh(x)) = x, 1 <= x < ∞. + * It can be written as acosh(x) = log(x + sqrt(x^2 - 1)), 1 <= x < ∞. + * acosh(x) := log(x)+ln2, if x is large; else + * := log(2x-1/(sqrt(x*x-1)+x)) if x>2; else + * := log1p(t+sqrt(2.0*t+t*t)); where t=x-1. + * + * + * + * Special cases: + * acosh(x) is NaN with signal if x < 1. + * acosh(NaN) is NaN without signal. + */ + static final class Acosh { + private static final double ln2 = 6.93147180559945286227e-01; + + static double compute(double x) { + double t; + int hx; + hx = __HI(x); + if (hx < 0x3ff0_0000) { // x < 1 */ + return (x - x) / (x - x); + } else if (hx >= 0x41b0_0000) { // x > 2**28 + if (hx >= 0x7ff0_0000) { // x is inf of NaN + return x + x; + } else { + return Log.compute(x) + ln2; // acosh(huge) = log(2x) + } + } else if (((hx - 0x3ff0_0000) | __LO(x)) == 0) { + return 0.0; // acosh(1) = 0 + } else if (hx > 0x4000_0000) { // 2**28 > x > 2 + t = x * x; + return Log.compute(2.0 * x - 1.0 / (x + Sqrt.compute(t - 1.0))); + } else { // 1< x <2 + t = x - 1.0; + return Log1p.compute(t + Sqrt.compute(2.0 * t + t * t)); + } + } + } } diff --git a/src/java.base/share/classes/java/lang/Math.java b/src/java.base/share/classes/java/lang/Math.java index 7add99f9325..4f729fe82cb 100644 --- a/src/java.base/share/classes/java/lang/Math.java +++ b/src/java.base/share/classes/java/lang/Math.java @@ -109,10 +109,10 @@ import static java.lang.Double.*; * acos acos}, {@link atan atan}, {@link exp exp}, {@link expm1 * expm1}, {@link log log}, {@link log10 log10}, {@link log1p log1p}, * {@link sinh sinh}, {@link cosh cosh}, {@link tanh tanh}, {@link asinh asinh}, - * {@link hypot hypot}, and {@link pow pow}. (The {@link sqrt sqrt} - * operation is a required part of IEEE 754 from a different section - * of the standard.) The special case behavior of the recommended - * operations generally follows the guidance of the IEEE 754 + * {@link acosh acosh}, {@link hypot hypot}, and {@link pow pow}. + * (The {@link sqrt sqrt} operation is a required part of IEEE 754 + * from a different section of the standard.) The special case behavior + * of the recommended operations generally follows the guidance of the IEEE 754 * standard. However, the {@code pow} method defines different * behavior for some arguments, as noted in its {@linkplain pow * specification}. The IEEE 754 standard defines its operations to be @@ -2785,6 +2785,35 @@ public final class Math { return StrictMath.asinh(x); } + + + /** + * Returns the inverse hyperbolic cosine of a {@code double} value. + * The inverse hyperbolic cosine of x is defined to be the function such that + * acosh({@linkplain Math#cosh cosh(x)}) = x for any x >= 0. + * Note that range of the exact acosh(x) is >= 0. + *

Special cases: + *

    + * + *
  • If the argument is positive infinity, then the result is + * positive infinity + * + *
  • If the argument less than 1, then the result is NaN. + * + *
  • If the argument is NaN, then the result is NaN. + * + *
  • If the argument is {@code 1.0}, then the result is positive zero. + * + *
+ *

The computed result must be within 2.5 ulps of the exact result. + * @param x The number whose inverse hyperbolic cosine is to be returned. + * @return The inverse hyperbolic cosine of {@code x}. + * @since 27 + */ + public static double acosh(double x) { + return StrictMath.acosh(x); + } + /** * Returns sqrt(x2 +y2) * without intermediate overflow or underflow. diff --git a/src/java.base/share/classes/java/lang/StrictMath.java b/src/java.base/share/classes/java/lang/StrictMath.java index 9540c4b05b4..9421b41620b 100644 --- a/src/java.base/share/classes/java/lang/StrictMath.java +++ b/src/java.base/share/classes/java/lang/StrictMath.java @@ -76,8 +76,8 @@ import jdk.internal.vm.annotation.IntrinsicCandidate; * {@code exp}, {@code log}, {@code log10}, * {@code cbrt}, {@code atan2}, {@code pow}, * {@code sinh}, {@code cosh}, {@code tanh}, - * {@code asinh}, {@code hypot}, {@code expm1}, - * and {@code log1p}. + * {@code asinh}, {@code acosh}, {@code hypot}, + * {@code expm1}, and {@code log1p}. * *

* The platform uses signed two's complement integer arithmetic with @@ -2196,6 +2196,32 @@ public final class StrictMath { return FdLibm.Asinh.compute(x); } + /** + * Returns the inverse hyperbolic cosine of a {@code double} value. + * The inverse hyperbolic cosine of x is defined to be the function such that + * acosh({@linkplain Math#cosh cosh(x)}) = x for any x >= 0. + * Note that range of the exact acosh(x) is >= 0. + *

Special cases: + *

    + * + *
  • If the argument is positive infinity, then the result is + * positive infinity + * + *
  • If the argument less than {@code 1.0}, then the result is NaN. + * + *
  • If the argument is NaN, then the result is NaN. + * + *
  • If the argument is {@code 1.0}, then the result is positive zero. + * + *
+ * @param x The number whose inverse hyperbolic cosine is to be returned. + * @return The inverse hyperbolic cosine of {@code x}. + * @since 27 + */ + public static double acosh(double x) { + return FdLibm.Acosh.compute(x); + } + /** * Returns sqrt(x2 +y2) * without intermediate overflow or underflow. diff --git a/test/jdk/java/lang/Math/HyperbolicTests.java b/test/jdk/java/lang/Math/HyperbolicTests.java index 6f4fad94f6b..ef37a102847 100644 --- a/test/jdk/java/lang/Math/HyperbolicTests.java +++ b/test/jdk/java/lang/Math/HyperbolicTests.java @@ -27,7 +27,7 @@ * @build Tests * @build HyperbolicTests * @run main HyperbolicTests - * @summary Tests for {Math, StrictMath}.{sinh, cosh, tanh, asinh} + * @summary Tests for {Math, StrictMath}.{sinh, cosh, tanh, asinh, acosh} */ import static java.lang.Double.longBitsToDouble; @@ -44,6 +44,7 @@ public class HyperbolicTests { failures += testCosh(); failures += testTanh(); failures += testAsinh(); + failures += testAcosh(); if (failures > 0) { System.err.println("Testing the hyperbolic functions incurred " @@ -1732,4 +1733,372 @@ public class HyperbolicTests { failures += Tests.testUlpDiffWithAbsBound("StrictMath.asinh", -input, StrictMath::asinh, -expected, ulps, Double.NEGATIVE_INFINITY); return failures; } + + /** + * Test accuracy of {Math, StrictMath}.acosh. The specified + * accuracy is 2.5 ulps. + * + * The defintion of acosh(x) is + * + * acosh(cosh(x)) = x + * + * Can be also written as + * + * acosh(x) = ln(x + sqrt(x * x - 1)) + * + * The series expansion of acosh(x) = + * + * ln(2 * x) - (x^-2 / 4 + 3 * x^-4 / 32 + 15 * x^-6 / 288 ...) + * + * Therefore, + * + * 1. acosh(1) = 0. + * + * 2. The domain is x >= 1. + * + * 3. The function is neither odd nor even. + * + */ + static int testAcosh() { + int failures = 0; + /* + * Array elements below generated using a quad acosh + * implementation. Rounded to a double, the quad result + * *should* be correctly rounded, unless we are quite unlucky. + * Assuming the quad value is a correctly rounded double, the + * allowed error is 3.0 ulps instead of 2.5 since the quad + * value rounded to double can have its own 1/2 ulp error. + */ + double [][] testCases = { + // x acosh(x) + {1.0000, +0.00000000000000000000000000000000000e+00 }, + {1.0625, +3.51737390043260579770744786121122844e-01 }, + {1.1250, +4.94932923094526905889563099576718556e-01 }, + {1.1875, +6.03186598686334413155297365190676416e-01 }, + {1.2500, +6.93147180559945309417232121458176575e-01 }, + {1.3125, +7.71307459173256653700937951825817144e-01 }, + {1.3750, +8.41019322011445738489485196126304665e-01 }, + {1.4375, +9.04286762705515769042139988689583282e-01 }, + {1.5000, +9.62423650119206894995517826848736845e-01 }, + {1.5625, +1.01634809667840380541358127166594224e+00 }, + {1.6250, +1.06673243190143557362309154628644597e+00 }, + {1.6875, +1.11408700135293645158376433073169476e+00 }, + {1.7500, +1.15881036042994681173087299087873020e+00 }, + {1.8125, +1.20122101997969472087682270695675759e+00 }, + {1.8750, +1.24157842330772117651284669611837885e+00 }, + {1.9375, +1.28009731675807455651225000558265526e+00 }, + {2.0000, +1.31695789692481670862504634730796848e+00 }, + {2.0625, +1.35231316261931093541047819670045078e+00 }, + {2.1250, +1.38629436111989061883446424291635315e+00 }, + {2.1875, +1.41901510140371506613255066437684651e+00 }, + {2.2500, +1.45057451382258020872826178236677635e+00 }, + {2.3125, +1.48105971405608381331792780208719133e+00 }, + {2.3750, +1.51054775047320739150161777699985299e+00 }, + {2.4375, +1.53910716184424377297903295285722198e+00 }, + {2.5000, +1.56679923697241107866405686258048358e+00 }, + {2.5625, +1.59367904336440765353731339657532894e+00 }, + {2.6250, +1.61979627485649999465013597110633349e+00 }, + {2.6875, +1.64519595581279452177517379518794699e+00 }, + {2.7500, +1.66991903058776998677838891147712239e+00 }, + {2.8125, +1.69400286038199600062127876942753998e+00 }, + {2.8750, +1.71748164473336519458386901818676709e+00 }, + {2.9375, +1.74038678120611400701568860843885133e+00 }, + {3.0000, +1.76274717403908605046521864995958460e+00 }, + {3.0625, +1.78458950036205246630242932084698860e+00 }, + {3.1250, +1.80593844091928647006641838950547765e+00 }, + {3.1875, +1.82681688093354809536648865402886324e+00 }, + {3.2500, +1.84724608571383784130004129627716938e+00 }, + {3.3125, +1.86724585479221893347421970944127165e+00 }, + {3.3750, +1.88683465772058517690549455261749833e+00 }, + {3.4375, +1.90602975413127236084850555002346490e+00 }, + {3.5000, +1.92484730023841378999103565369747369e+00 }, + {3.5625, +1.94330244360892107348697778473632964e+00 }, + {3.6250, +1.96140940774674480423275041043129955e+00 }, + {3.6875, +1.97918156779907568924375778194574535e+00 }, + {3.7500, +1.99663151849857170393899871209510294e+00 }, + {3.8125, +2.01377113529382496280930762219993708e+00 }, + {3.8750, +2.03061162948500957172739654092925159e+00 }, + {3.9375, +2.04716359806812267677620352283230977e+00 }, + {4.0000, +2.06343706889556054672728117262013178e+00 }, + {4.0625, +2.07944154167983592825169636437452953e+00 }, + {4.1250, +2.09518602529851747179664246793750599e+00 }, + {4.1875, +2.11067907179990670152964344211957784e+00 }, + {4.2500, +2.12592880745889053593506179143141713e+00 }, + {4.3125, +2.14094296118944770996055814756135545e+00 }, + {4.3750, +2.15572889058331846311473049052403906e+00 }, + {4.4375, +2.17029360581243752070499251797833202e+00 }, + {4.5000, +2.18464379160510872667627813307212784e+00 }, + {4.5625, +2.19878582748192321247116242073983256e+00 }, + {4.6250, +2.21272580641655511554559532685274022e+00 }, + {4.6875, +2.22646955206835990390469193746457694e+00 }, + {4.7500, +2.24002263471777221819301091423172581e+00 }, + {4.8125, +2.25339038602153389445857144762743321e+00 }, + {4.8750, +2.26657791269250866199452039018610592e+00 }, + {4.9375, +2.27959010919802897270925407255393153e+00 }, + {5.0000, +2.29243166956117768780078731134801529e+00 }, + {5.0625, +2.30510709834096668441430402487399027e+00 }, + {5.1250, +2.31762072085989362346174598175746039e+00 }, + {5.1875, +2.32997669274071514661824152082627607e+00 }, + {5.2500, +2.34217900880836474718960439585388779e+00 }, + {5.3125, +2.35423151140767607019354831300009086e+00 }, + {5.3750, +2.36613789818286932753788120137389157e+00 }, + {5.4375, +2.37790172936055222645518871553565388e+00 }, + {5.5000, +2.38952643457421860822386165703818122e+00 }, + {5.5625, +2.40101531926484683717268315699636478e+00 }, + {5.6250, +2.41237157068916138816151585667001780e+00 }, + {5.6875, +2.42359826356438621752612199535640197e+00 }, + {5.7500, +2.43469836537585339202679859270163341e+00 }, + {5.8125, +2.44567474137160531324234100032920604e+00 }, + {5.8750, +2.45653015926611756205299063862500772e+00 }, + {5.9375, +2.46726729367344889723552955806057589e+00 }, + {6.0000, +2.47788873028847500481395074507450545e+00 }, + {6.0625, +2.48839696983336532007430913631752335e+00 }, + {6.1250, +2.49879443178510181484789673802222733e+00 }, + {6.1875, +2.50908345789860105234876846349648239e+00 }, + {6.2500, +2.51926631553887363826303725428234388e+00 }, + {6.3125, +2.52934520083462740598919885177286592e+00 }, + {6.3750, +2.53932224166478245066792464622248188e+00 }, + {6.4375, +2.54919950048850872717547586051387259e+00 }, + {6.5000, +2.55897897702861255144554182625683448e+00 }, + {6.5625, +2.56866261081738002442374329274624674e+00 }, + {6.6250, +2.57825228361332690085894009323471199e+00 }, + {6.6875, +2.58774982169670016849316580209717247e+00 }, + {6.7500, +2.59715699805102158059159611581476354e+00 }, + {6.8125, +2.60647553443745310075195298905494613e+00 }, + {6.8750, +2.61570710336829463210497297146055746e+00 }, + {6.9375, +2.62485332998549187571842397668306463e+00 }, + {7.0000, +2.63391579384963341725009269461593696e+00 }, + {7.0625, +2.64289603064454821939888620389440586e+00 }, + {7.1250, +2.65179553380227492960508448932353394e+00 }, + {7.1875, +2.66061575605286038291043830648413625e+00 }, + {7.2500, +2.66935811090315420323249076787858338e+00 }, + {7.3125, +2.67802397404849750222123152071366765e+00 }, + {7.3750, +2.68661468472095454727243455865687717e+00 }, + {7.4375, +2.69513154697750528856415868272675449e+00 }, + {7.5000, +2.70357583093140231733394963705451385e+00 }, + {7.5625, +2.71194877392969682611305770501597479e+00 }, + {7.6250, +2.72025158167975322903284501674667068e+00 }, + {7.6875, +2.72848542932740015820479864569947040e+00 }, + {7.7500, +2.73665146248920556040148045776356816e+00 }, + {7.8125, +2.74475079824121464549309272530654441e+00 }, + {7.8750, +2.75278452606635063332660947345292156e+00 }, + {7.9375, +2.76075370876254883072567909046267813e+00 }, + {8.0000, +2.76865938331357383273200140938374547e+00 }, + {8.0625, +2.77650256172435692961336760207948251e+00 }, + {8.1250, +2.78428423182258551535630273235901386e+00 }, + {8.1875, +2.79200535802817788553087801705861609e+00 }, + {8.2500, +2.79966688209218477865004528925200022e+00 }, + {8.3125, +2.80726972380657289240925980113428074e+00 }, + {8.3750, +2.81481478168626496869015857854363587e+00 }, + {8.4375, +2.82230293362473549711106510083524230e+00 }, + {8.5000, +2.82973503752439027536610108611637391e+00 }, + {8.5625, +2.83711193190289165307916749543060640e+00 }, + {8.6250, +2.84443443647652896774770544175385075e+00 }, + {8.6875, +2.85170335272167517356988163822694873e+00 }, + {8.7500, +2.85891946441531570520913194770155741e+00 }, + {8.8125, +2.86608353815558396737111566993889866e+00 }, + {8.8750, +2.87319632386318927416511462539646535e+00 }, + {8.9375, +2.88025855526457737300290165271813925e+00 }, + {9.0000, +2.88727095035762068498655348054621044e+00 }, + {9.0625, +2.89423421186059490016531823326821096e+00 }, + {9.1250, +2.90114902764516041745652356473355270e+00 }, + {9.1875, +2.90801607115403116308966232802812480e+00 }, + {9.2500, +2.91483600180397941677005500735563642e+00 }, + {9.3125, +2.92160946537479329008903038647778851e+00 }, + {9.3750, +2.92833709438477331505751565470704144e+00 }, + {9.4375, +2.93501950845332609861824133070706912e+00 }, + {9.5000, +2.94165731465118607612817277397561825e+00 }, + {9.5625, +2.94825110783877095494122437627939968e+00 }, + {9.6250, +2.95480147099315238696389016790268450e+00 }, + {9.6875, +2.96130897552410066125326263536732120e+00 }, + {9.7500, +2.96777418157964068500790378422486329e+00 }, + {9.8125, +2.97419763834153614964672155497739057e+00 }, + {9.8750, +2.98057988431109948901325801645778406e+00 }, + {9.9375, +2.98692144758570696460723739938555692e+00 }, + {10.0000, +2.99322284612638089791266771377418276e+00 }, + }; + + + for (double [] testCase : testCases) { + failures += testAcoshCaseWithUlpDiff(testCase[0], + testCase[1], + 3.0); + } + + + + for (double nan : Tests.NaNs) { + failures += testAcoshCaseWithUlpDiff(nan, NaNd, 0); + } + + + + double [][] specialTestCases = { + {0.0, NaNd}, + {-0.0, NaNd}, + {1.0, 0.0}, + {Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY}, + {Double.NEGATIVE_INFINITY, NaNd} + }; + + + + for (double [] specialTestCase : specialTestCases) { + failures += testAcoshCaseWithUlpDiff(specialTestCase[0], + specialTestCase[1], + 0.0); + } + + + failures += testAcoshAdditionalTests(); + + return failures; + } + + /** + * Test accuracy of {Math, StrictMath}.acosh using quad precision + * acosh implementation as the reference. There are additional tests. + * The specified accuracy is 2.5 ulps. + * + */ + static int testAcoshAdditionalTests() { + int failures = 0; + /* + * Array elements below are generated using a quad precision acosh + * implementation (libquadmath). Rounded to a double, the quad result + * *should* be correctly rounded, unless we are quite unlucky. + * Assuming the quad value is a correctly rounded double, the + * allowed error is 3.0 ulps instead of 2.5 since the quad + * value rounded to double can have its own 1/2 ulp error. + */ + double[][] testCases = { + // x acosh(x) + {+1.40222409861373051853661308996379375e+01 , +3.33251799248457675610296187717275023e+00 }, + {+4.64063630702987595100239559542387724e+01 , +4.53046765794427717250009108708063951e+00 }, + {+2.26769594350354175560369185404852033e+01 , +3.81401008174403012773998497198756862e+00 }, + {+6.82076069573278687130368780344724655e+01 , +4.91564953670154039555101045371992145e+00 }, + {+9.35345967264471340740783489309251308e+01 , +5.23144999004817476451595194893686997e+00 }, + {+5.24222208302520016331982333213090897e+01 , +4.65238675892723943927493345614044802e+00 }, + {+4.42263893601989721560130419675260782e+00 , +2.16685013650055071552269762531726701e+00 }, + {+5.34403191209646664106003299821168184e+01 , +4.67162513077968730816736013866320559e+00 }, + {+1.76212042009831870714720025716815144e+00 , +1.16720688415256589829633745537084420e+00 }, + {+7.61738148899418732185040425974875689e+00 , +2.71924321506064362327407359954437453e+00 }, + {+6.89904985284954790358824538998305798e+01 , +4.92706344460967378866907640972706781e+00 }, + {+9.31132130019995969405499636195600033e+01 , +5.22693444138174309022758439394131022e+00 }, + {+5.31659489982307036370912101119756699e+01 , +4.66647685890886539018247877652269347e+00 }, + {+6.57379772558717405672723543830215931e+01 , +4.87876612392399046931262815776348806e+00 }, + {+7.04178688554184901704502408392727375e+01 , +4.94754380999195554008986754487841587e+00 }, + {+7.64576059598647788106973166577517986e+01 , +5.02984082858162069509313975886000718e+00 }, + {+5.69898682524488275902285749907605350e+00 , +2.42564775130097776080234839595030019e+00 }, + {+3.34951883898407629658322548493742943e+01 , +4.20432607363489310218001177932001376e+00 }, + {+7.58846381271260241874188068322837353e+01 , +5.02231803118503396528914607189891829e+00 }, + {+3.71685284182660993224089907016605139e+01 , +4.30842856158112686719805147741579474e+00 }, + {+9.82724783457824031529526109807193279e+01 , +5.28086530470046881951663865035216936e+00 }, + {+7.55822276853527057483006501570343971e+01 , +5.01832458735915146090685859231899627e+00 }, + {+8.19590239920287544350685493554919958e+00 , +2.79303880830104526461764198808709567e+00 }, + {+8.85860057527683011358021758496761322e+01 , +5.17708921820009272972577332594088089e+00 }, + {+4.42047291460483080527410493232309818e+01 , +4.48185099473614683233384262644114551e+00 }, + {+4.82954447467224099455052055418491364e+01 , +4.57037722443775069839008053496876858e+00 }, + {+2.82157771675713533454654680099338293e+01 , +4.03271430903366741210592839999395032e+00 }, + {+1.74842128192706276479384541744366288e+01 , +3.55362672330870909254873232512209322e+00 }, + {+8.98679723864892281426364206708967686e+01 , +5.19145784395917044408731940940225234e+00 }, + {+6.99586842581785273154082460678182542e+00 , +2.63331927275597158625520354348567456e+00 }, + {+5.09477665985264778214514080900698900e+01 , +4.62385177612510228171242777653641979e+00 }, + {+3.25842611674598501281252538319677114e+01 , +4.17674101901473628570827854743466486e+00 }, + {+4.99036918354616290116609889082610607e+01 , +4.60314176379122016396592518510391469e+00 }, + {+9.98255656348235120844947232399135828e+00 , +2.99146816849131388203109739268493125e+00 }, + {+8.30115844701927940718633180949836969e+00 , +2.80589439276611715849813780991570715e+00 }, + {+3.90300726488373044276158907450735569e+01 , +4.35731547033614744103231173076054669e+00 }, + {+9.14679267650316347726402455009520054e+01 , +5.20910568139874158502888666687786843e+00 }, + {+4.69801366698952662659394263755530119e+01 , +4.54275878054294975578025810303600533e+00 }, + {+5.95831438716205052941177200409583747e+00 , +2.47081727711668636777886134527797777e+00 }, + {+7.72502501531925105382470064796507359e+01 , +5.04015543904862200893429166398240913e+00 }, + {+1.34111721821950098387787875253707170e+01 , +3.28784240452352224920507313116967307e+00 }, + {+6.91570748043642566926791914738714695e+01 , +4.92947526860125472538045310739830979e+00 }, + {+6.33247983942767831422315794043242931e+01 , +4.84136184327272941501425426966065239e+00 }, + {+7.28157878674183933753738529048860073e+01 , +4.98103282444372675567185179132668151e+00 }, + {+8.89686491926590150569609249942004681e+01 , +5.18139964655774166552638928730792362e+00 }, + {+3.13258612573789463340290240012109280e+01 , +4.13733631620326521460511053592093813e+00 }, + {+5.18140965157089325998640561010688543e+01 , +4.64071629304849263117175976059711265e+00 }, + {+8.47521744710507647369013284333050251e+01 , +5.13284377741645310577993893073249440e+00 }, + {+8.43095533174532931752764852717518806e+01 , +5.12760719138905245783659501854598879e+00 }, + {+4.21240669274286076984026294667273760e+01 , +4.43362549935510675489581351410263443e+00 }, + {+4.73238194816935475728314486332237720e+01 , +4.55004928385543400029944037596031391e+00 }, + {+1.86544426645817758014800347154960036e+01 , +3.61851232034069491499592508470176552e+00 }, + {+5.75938262601410571051019360311329365e+01 , +4.74648718281138202967444216845950983e+00 }, + {+4.27232167589609090896374254953116179e+00 , +2.13131771884641485793724599940809626e+00 }, + {+5.03495317868001706074210233055055141e+01 , +4.61203786952239923442865869830624998e+00 }, + {+7.50809724725515792442820384167134762e+01 , +5.01166999309632169153897035236491293e+00 }, + {+8.91830106756043647919796057976782322e+01 , +5.18380630497515107426424373476548239e+00 }, + {+8.43619216604083419497328577563166618e+01 , +5.12822818585720472109565051928260461e+00 }, + {+2.20623999405381177041363116586580873e+01 , +3.78650797260310183157107999251647380e+00 }, + {+1.39122989185065399908580729970708489e+01 , +3.32462629189603078991830801184905350e+00 }, + {+2.81842266001629120353300095302984118e+01 , +4.03159479043564760795745665884328416e+00 }, + {+4.20150330398823186328627343755215406e+01 , +4.43103301227168439924256715079001048e+00 }, + {+7.12721396815986594219793914817273617e+01 , +4.95960346484961706088932387548050013e+00 }, + {+2.47511696812483386054282163968309760e+01 , +3.90161159523447275422094662483857801e+00 }, + {+3.24364140945400691862232633866369724e+01 , +4.17219116407069688318499622366971673e+00 }, + {+6.55538099356552947938325814902782440e+01 , +4.87596033055444598453664902130389245e+00 }, + {+6.84532751547124860280746361240744591e+01 , +4.91924522217897758728929410442650248e+00 }, + {+3.93848083647737539081390423234552145e+01 , +4.36636613965538581613443666385597861e+00 }, + {+1.56057673113820580823585260077379644e+01 , +3.43975961616459237301460093608428409e+00 }, + {+8.47119903068781923138885758817195892e+01 , +5.13236949468185791854133268753960238e+00 }, + {+9.55854738436600683826327440328896046e+01 , +5.25314067817929358802774910100252994e+00 }, + {+1.56670046394655830823694486753083766e+01 , +3.44368399001615451248068997740627574e+00 }, + {+4.14679026870443507846175634767860174e+01 , +4.41792146385299219920359657474436019e+00 }, + {+5.69249693750823269056127173826098442e+01 , +4.73480409586514749627990327668077645e+00 }, + {+4.93629403713561600852699484676122665e+01 , +4.59224451473128480136302652897840027e+00 }, + {+9.61484189551490686653778539039194584e+01 , +5.25901316478560252169572160735164898e+00 }, + {+2.07759627057374345326934417244046926e+01 , +3.72636417050318935004571518016144611e+00 }, + {+6.32976464844313539970244164578616619e+01 , +4.84093292566853424246928339764776273e+00 }, + {+6.54741204020067897317858296446502209e+01 , +4.87474381391982909784974793043917201e+00 }, + {+8.05042266117176978923453134484589100e+01 , +5.08141829115959617683933639313475601e+00 }, + {+4.81667484910552587962229154072701931e+01 , +4.56770832383321482034955903243661906e+00 }, + {+2.11217831158012465664342016680166125e+01 , +3.74289121691996804899454065396184575e+00 }, + {+9.02656763961261532358548720367252827e+01 , +5.19587377817524068279272963615894387e+00 }, + {+1.50600821596306779781571094645187259e+01 , +3.40409076820438745807924396441229869e+00 }, + {+4.16209905361957765990155166946351528e+01 , +4.42160745328229554045710868854157175e+00 }, + {+8.86791887429291563194055925123393536e+01 , +5.17814062516654447520446624771754712e+00 }, + {+1.70576566142218695176779874600470066e+01 , +3.52888602841986989717710320391598297e+00 }, + {+3.71685638271143758970538328867405653e+01 , +4.30842951458236820308439636796433560e+00 }, + {+1.43758274343816250251393284997902811e+01 , +3.35748343469042965382754422758946510e+00 }, + {+4.60754211385189549332608294207602739e+01 , +4.52330904257767828148397295029679237e+00 }, + {+4.57777167466274974572115752380341291e+01 , +4.51682530040123678433942314310447564e+00 }, + {+9.32357656650976593937230063602328300e+01 , +5.22824982009254837221678766114741857e+00 }, + {+2.23095900244694895775410259375348687e+01 , +3.79766114099573434402313460678612040e+00 }, + {+9.09832666680431856320865335874259472e+01 , +5.20379258533493176911574496349341434e+00 }, + {+8.62251237613208019183730357326567173e+01 , +5.15007514723643448859452771190406728e+00 }, + {+5.10896316393437928127241320908069611e+01 , +4.62663296015956482467254446322296917e+00 }, + {+8.19385868289117524909670464694499969e+01 , +5.09907996803279765921917143342322948e+00 }, + {+4.67622529628467802353952720295637846e+01 , +4.53810915071314717336273606975590283e+00 }, + {+6.36411313235143367705859418492764235e+01 , +4.84634542963631730817381276671897779e+00 }, + {+8.26450413110590460519233602099120617e+01 , +5.10766540264697663339669119714720544e+00 }, + }; + + for (double[] testCase : testCases) { + failures += testAcoshCaseWithUlpDiff(testCase[0], + testCase[1], + 3.0); + } + + return failures; + } + + public static int testAcoshCaseWithTolerance(double input, + double expected, + double tolerance) { + int failures = 0; + failures += Tests.testTolerance("Math.acosh", input, Math::acosh, expected, tolerance); + failures += Tests.testTolerance("StrictMath.acosh", input, StrictMath::acosh, expected, tolerance); + return failures; + } + + public static int testAcoshCaseWithUlpDiff(double input, + double expected, + double ulps) { + int failures = 0; + failures += Tests.testUlpDiffWithAbsBound("Math.acosh", input, Math::acosh, expected, ulps, Double.POSITIVE_INFINITY); + failures += Tests.testUlpDiffWithAbsBound("StrictMath.acosh", input, StrictMath::acosh, expected, ulps, Double.POSITIVE_INFINITY); + return failures; + } } diff --git a/test/jdk/java/lang/StrictMath/ExhaustingTests.java b/test/jdk/java/lang/StrictMath/ExhaustingTests.java index 143227c4cc3..d028f0541fa 100644 --- a/test/jdk/java/lang/StrictMath/ExhaustingTests.java +++ b/test/jdk/java/lang/StrictMath/ExhaustingTests.java @@ -93,6 +93,7 @@ public class ExhaustingTests { new UnaryTestCase("atan", FdlibmTranslit::atan, StrictMath::atan, DEFAULT_SHIFT), new UnaryTestCase("asinh", FdlibmTranslit::asinh, StrictMath::asinh, DEFAULT_SHIFT), + new UnaryTestCase("acosh", FdlibmTranslit::acosh, StrictMath::acosh, DEFAULT_SHIFT), }; for (var testCase : testCases) { diff --git a/test/jdk/java/lang/StrictMath/FdlibmTranslit.java b/test/jdk/java/lang/StrictMath/FdlibmTranslit.java index 3001fed911f..6ac90c826d5 100644 --- a/test/jdk/java/lang/StrictMath/FdlibmTranslit.java +++ b/test/jdk/java/lang/StrictMath/FdlibmTranslit.java @@ -144,6 +144,10 @@ public class FdlibmTranslit { return Asinh.compute(x); } + public static double acosh(double x) { + return Acosh.compute(x); + } + public static double IEEEremainder(double f1, double f2) { return IEEEremainder.compute(f1, f2); } @@ -2796,4 +2800,45 @@ public class FdlibmTranslit { if(hx>0) return w; else return -w; } } + + /* + * Return the Inverse Hyperbolic Cosine of x + * + * Method : + * Based on + * acosh(x) = log [ x + sqrt(x*x-1) ] + * we have + * acosh(x) := log(x)+ln2, if x is large; else + * := log(2x-1/(sqrt(x*x-1)+x)) if x>2; else + * := log1p(t+sqrt(2.0*t+t*t)); where t=x-1. + * + * Special cases: + * acosh(x) is NaN with signal if x<1. + * acosh(NaN) is NaN without signal. + */ + private static final class Acosh { + private static final double one = 1.0; + private static final double ln2 = 6.93147180559945286227e-01; + static double compute(double x) { + double t; + int hx; + hx = __HI(x); + if(hx<0x3ff00000) { /* x < 1 */ + return (x-x)/(x-x); + } else if(hx >=0x41b00000) { /* x > 2**28 */ + if(hx >=0x7ff00000) { /* x is inf of NaN */ + return x+x; + } else + return log(x)+ln2; /* acosh(huge)=log(2x) */ + } else if(((hx-0x3ff00000)|__LO(x))==0) { + return 0.0; /* acosh(1) = 0 */ + } else if (hx > 0x40000000) { /* 2**28 > x > 2 */ + t=x*x; + return log(2.0*x-one/(x+sqrt(t-one))); + } else { /* 1 0) { System.err.println("Testing the hyperbolics incurred " @@ -80,7 +81,8 @@ public class HyperbolicTests { SINH(HyperbolicTests::testSinhCase, FdlibmTranslit::sinh), COSH(HyperbolicTests::testCoshCase, FdlibmTranslit::cosh), TANH(HyperbolicTests::testTanhCase, FdlibmTranslit::tanh), - ASINH(HyperbolicTests::testAsinhCase, FdlibmTranslit::asinh); + ASINH(HyperbolicTests::testAsinhCase, FdlibmTranslit::asinh), + ACOSH(HyperbolicTests::testAcoshCase, FdlibmTranslit::acosh); private DoubleDoubleToInt testCase; private DoubleUnaryOperator transliteration; @@ -260,6 +262,11 @@ public class HyperbolicTests { StrictMath::asinh, expected); } + private static int testAcoshCase(double input, double expected) { + return Tests.test("StrictMath.asinh(double)", input, + StrictMath::acosh, expected); + } + private static int testSinh() { int failures = 0; double [][] testCases = { @@ -563,4 +570,52 @@ public class HyperbolicTests { return failures; } + + private static int testAcosh() { + int failures = 0; + double [][] testCases = { + {0x1.00020000aaaabp+0, 0x1.fffffffff749fp-8}, + {0x1.000346de27853p+0, 0x1.47ae147ae274p-7}, + {0x1.0008000aaab05p+0, 0x1.fffffffffe9f1p-7}, + {0x1.0008000aaab05p+0, 0x1.fffffffffe9f1p-7}, + {0x1.002000aaac169p+0, 0x1.fffffffffe67bp-6}, + {0x1.002000aaac16bp+0, 0x1.ffffffffff679p-6}, + {0x1.00800aab05b1ep+0, 0x1.ffffffffffc9cp-5}, + {0x1.00800aab05b1fp+0, 0x1.ffffffffffe9bp-5}, + {0x1.0147f40224b2ep+0, 0x1.9999999999318p-4}, + {0x1.0147f40224b35p+0, 0x1.9999999999776p-4}, + {0x1.0200aac16db6cp+0, 0x1.ffffffffffe91p-4}, + {0x1.0200aac16db6ep+0, 0x1.fffffffffff91p-4}, + {0x1.080ab05ca613bp+0, 0x1.ffffffffffea5p-3}, + {0x1.080ab05ca6146p+0, 0x1.0000000000001p-2}, + {0x1.20ac1862ae8cep+0, 0x1.fffffffffffedp-2}, + {0x1.20ac1862ae8dp+0, 0x1.ffffffffffffdp-2}, + {0x1.8b07551d9f551p+0, 0x1p+0}, + {0x1.e18fa0df2d9b3p+1, 0x1.ffffffffffffbp+0}, + {0x1.e18fa0df2d9b8p+1, 0x1.ffffffffffffep+0}, + {0x1.e18fa0df2d9bap+1, 0x1.fffffffffffffp+0}, + {0x1.b4ee858de3e68p+4, 0x1.ffffffffffff9p+1}, + {0x1.b4ee858de3e7ap+4, 0x1.ffffffffffffep+1}, + {0x1.b4ee858de3e7dp+4, 0x1.fffffffffffffp+1}, + {0x1.749eaa93f4e5ep+10, 0x1.ffffffffffffcp+2}, + {0x1.749eaa93f4e64p+10, 0x1.ffffffffffffdp+2}, + {0x1.749eaa93f4e76p+10, 0x1p+3}, + {0x1.0f2ebd0a7fb9p+22, 0x1.fffffffffff6fp+3}, + {0x1.0f2ebd0a8005cp+22, 0x1p+4}, + {0x1.1f43fcc4b6316p+45, 0x1.fffffffffffd3p+4}, + {0x1.1f43fcc4b662cp+45, 0x1.fffffffffffffp+4}, + {0x1.fdf25fc26e7cp+1023, 0x1.633c654fee2bap+9}, + {0x1.fdf25fc26e7cp+1023, 0x1.633c654fee2bap+9}, + {0x1.e0976c8f0ebdfp+1, 0x1.ff76fb3f476d5p+0}, + {0x1.ff66e0de4dc6fp+1023, 0x1.633cc2ae1c934p+9}, + {0x1.f97ccb0aef314p+11, 0x1.1ff088806d82ep+3}, + {0x1.fdf28623ef923p+1021, 0x1.628af341989dap+9}, + }; + + for (double[] testCase: testCases) { + failures += testAcoshCase(testCase[0], testCase[1]); + } + + return failures; + } } From c95ee4b8edbf2038e86550acdcf164de20931862 Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Mon, 16 Feb 2026 09:12:06 +0000 Subject: [PATCH 108/120] 8377707: [Linux Alpine] Build failure after JDK-8377368 Reviewed-by: mdoerr, kevinw, clanger, kbarrett --- src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.h | 2 +- src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.h b/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.h index 262e99f4a64..62b1b4d0d6b 100644 --- a/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.h +++ b/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.h @@ -96,7 +96,7 @@ struct core_data { int classes_jsa_fd; // file descriptor of class share archive uintptr_t dynamic_addr; // address of dynamic section of a.out uintptr_t vdso_addr; // address of vDSO - off64_t vdso_offset; // offset of vDSO in core + off_t vdso_offset; // offset of vDSO in core size_t vdso_size; // size of vDSO uintptr_t ld_base_addr; // base address of ld.so size_t num_maps; // number of maps. diff --git a/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c b/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c index 6a991b18c10..6298f569aaf 100644 --- a/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c +++ b/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c @@ -635,8 +635,8 @@ static int handle_vdso(struct ps_prochandle* ph, char* lib_name, size_t lib_name lib_fd = -1; } else { lib_fd = fileno(tmpf); - off64_t ofs = ph->core->vdso_offset; - if (sendfile64(lib_fd, ph->core->core_fd, &ofs, ph->core->vdso_size) == -1) { + off_t ofs = ph->core->vdso_offset; + if (sendfile(lib_fd, ph->core->core_fd, &ofs, ph->core->vdso_size) == -1) { print_debug("can't copy vDSO (%d)\n", errno); fclose(tmpf); lib_fd = -1; From cf0275d6654cfd2243398032a90a7db95c9bc631 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20H=C3=A4ssig?= Date: Mon, 16 Feb 2026 09:59:19 +0000 Subject: [PATCH 109/120] 8376707: Template-Framework Library: Primitive Types Abbreviation Methods Reviewed-by: epeter, galder, chagedorn --- .../library/PrimitiveType.java | 31 +++++++++++- .../examples/TestPrimitiveTypes.java | 48 ++++++++++++++++++- 2 files changed, 76 insertions(+), 3 deletions(-) diff --git a/test/hotspot/jtreg/compiler/lib/template_framework/library/PrimitiveType.java b/test/hotspot/jtreg/compiler/lib/template_framework/library/PrimitiveType.java index b789da45d44..c8541ac1fa6 100644 --- a/test/hotspot/jtreg/compiler/lib/template_framework/library/PrimitiveType.java +++ b/test/hotspot/jtreg/compiler/lib/template_framework/library/PrimitiveType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -141,6 +141,35 @@ public final class PrimitiveType implements CodeGenerationDataNameType { }; } + /** + * Provides the field descriptor for primitive types as per JVMS§4.3.2. + * + * @return the field descriptor of the type. + */ + public String fieldDesc() { + return switch (kind) { + case LONG -> "J"; + case BOOLEAN -> "Z"; + default -> boxedTypeName().substring(0, 1); + }; + } + + /** + * Provides the abbreviation of the type as it would be used for node classes in the + * IR-Framework. Note the the abbreviations for boolean and char are used inconsistently. + * This method maps boolean to "UB", even though it might sometimes be mapped under "B" since + * it is loaded as a byte, and char to "C", even though it might sometimes be mapped to "US" + * for "unsigned short". + * + * @return the abbreviation of the type. + */ + public String abbrev() { + return switch (kind) { + case BOOLEAN -> "UB"; + default -> boxedTypeName().substring(0, 1); + }; + } + /** * Indicates if the type is a floating point type. * diff --git a/test/hotspot/jtreg/testlibrary_tests/template_framework/examples/TestPrimitiveTypes.java b/test/hotspot/jtreg/testlibrary_tests/template_framework/examples/TestPrimitiveTypes.java index b1f5f74e682..6193b6aad0c 100644 --- a/test/hotspot/jtreg/testlibrary_tests/template_framework/examples/TestPrimitiveTypes.java +++ b/test/hotspot/jtreg/testlibrary_tests/template_framework/examples/TestPrimitiveTypes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -174,6 +174,46 @@ public class TestPrimitiveTypes { tests.put("test_names", namesTemplate.asToken()); + var abbrevDefTemplate = Template.make("type", (PrimitiveType type) -> scope( + let("CON1", type.con()), + let("CON2", type.con()), + let("abbrev", type.abbrev()), + let("fieldDesc", type.fieldDesc()), + """ + static #type varAbbrev#abbrev = #CON1; + static #type varFieldDesc#fieldDesc = #CON2; + """ + )); + var swapTemplate = Template.make("type", (PrimitiveType type) -> scope( + let("abbrev", type.abbrev()), + let("fieldDesc", type.fieldDesc()), + """ + #type tmp#abbrev = varAbbrev#abbrev; + varAbbrev#abbrev = varFieldDesc#fieldDesc; + varFieldDesc#fieldDesc = tmp#abbrev; + """ + )); + var abbrevTemplate = Template.make(() -> scope( + """ + public static void test_abbrev() { + """, + Hooks.CLASS_HOOK.insert(scope( + // Create fields that would collide if the abbrev() or fieldDesc() methods produced colliding + // strings for different types + CodeGenerationDataNameType.PRIMITIVE_TYPES.stream().map(type -> + abbrevDefTemplate.asToken(type) + ).toList() + )), + CodeGenerationDataNameType.PRIMITIVE_TYPES.stream().map(type -> + swapTemplate.asToken(type) + ).toList(), + """ + } + """ + )); + + tests.put("test_abbrev", abbrevTemplate.asToken()); + // Test runtime random value generation with LibraryRNG // Runtime random number generation of a given primitive type can be very helpful // when writing tests that require random inputs. @@ -231,6 +271,9 @@ public class TestPrimitiveTypes { import compiler.lib.generators.*; public class InnerTest { + """, + Hooks.CLASS_HOOK.anchor(scope( + """ public static void main() { """, // Call all test methods from main. @@ -241,7 +284,8 @@ public class TestPrimitiveTypes { } """, // Now add all the test methods. - tests.values().stream().toList(), + tests.values().stream().toList() + )), """ } """ From 1a16c0dbaaf483cbb5efd8d948df42687ee655a0 Mon Sep 17 00:00:00 2001 From: Daniel Fuchs Date: Mon, 16 Feb 2026 10:56:29 +0000 Subject: [PATCH 110/120] 8371950: The jdk.httpclient.keepalive.timeout system networking property does not specify the behaviour for values <= 0 Reviewed-by: jpai, michaelm, vyazici --- .../classes/java/net/http/package-info.java | 4 +++- .../share/classes/module-info.java | 20 ++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/java.net.http/share/classes/java/net/http/package-info.java b/src/java.net.http/share/classes/java/net/http/package-info.java index 1b8395c2706..ce954404c81 100644 --- a/src/java.net.http/share/classes/java/net/http/package-info.java +++ b/src/java.net.http/share/classes/java/net/http/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -68,6 +68,8 @@ *

Unless otherwise stated, {@code null} parameter values will cause methods * of all classes in this package to throw {@code NullPointerException}. * + * @see java.net.http/ + * * @spec https://www.rfc-editor.org/info/rfc9114 * RFC 9114: HTTP/3 * @spec https://www.rfc-editor.org/info/rfc7540 diff --git a/src/java.net.http/share/classes/module-info.java b/src/java.net.http/share/classes/module-info.java index 48f23953ad0..fdfd1bf7e0d 100644 --- a/src/java.net.http/share/classes/module-info.java +++ b/src/java.net.http/share/classes/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * 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 @@ */ /** - * Defines the HTTP Client and WebSocket APIs. + * Defines the {@linkplain java.net.http HTTP Client and WebSocket APIs}. *

* System properties used by the java.net.http API *

@@ -144,15 +144,21 @@ * The value for HTTP/2 and HTTP/3 can be overridden with the * {@code jdk.httpclient.keepalive.timeout.h2} and {@code jdk.httpclient.keepalive.timeout.h3} * properties respectively. The value specified for HTTP/2 acts as default value for HTTP/3. + * If the provided value is negative, the default value is used. + * A value of 0 is valid and has no special meaning other than the connection is closed + * when it becomes idle. * *

  • {@systemProperty jdk.httpclient.keepalive.timeout.h2} (default: see - * below)
    The number of seconds to keep idle HTTP/2 connections alive. If not set, then the - * {@code jdk.httpclient.keepalive.timeout} setting is used. + * below)
    The number of seconds to keep idle HTTP/2 connections alive. If not set, or negative, + * then the {@code jdk.httpclient.keepalive.timeout} setting is used. + * A value of 0 is valid and has no special meaning other than the connection is closed + * when it becomes idle. *

  • *
  • {@systemProperty jdk.httpclient.keepalive.timeout.h3} (default: see - * below)
    The number of seconds to keep idle HTTP/3 connections alive. If not set, then the - * {@code jdk.httpclient.keepalive.timeout.h2} setting is used. - *

  • + * below)
    The number of seconds to keep idle HTTP/3 connections alive. If not set, + * or negative, then the {@code jdk.httpclient.keepalive.timeout.h2} setting is used. + * A value of 0 is valid and has no special meaning other than the connection is closed + * when it becomes idle. *
  • {@systemProperty jdk.httpclient.maxframesize} (default: 16384 or 16kB)
    * The HTTP/2 client maximum frame size in bytes. The server is not permitted to send a frame * larger than this. From 5a083744946c54e1d9196e1031ad556dae5f38c7 Mon Sep 17 00:00:00 2001 From: Kerem Kat Date: Mon, 16 Feb 2026 11:40:51 +0000 Subject: [PATCH 111/120] 8374798: C2: Missing Identity optimization opportunity with RShiftI and LShiftI 8377389: C2: Missed Ideal optimization opportunity in PhaseIterGVN for URShiftI and LShiftI Reviewed-by: qamai, chagedorn --- src/hotspot/share/opto/mulnode.cpp | 73 ++++++++++++------- src/hotspot/share/opto/phaseX.cpp | 12 ++- .../c2/gvn/MissedRShiftLShiftIdentity.java | 64 ++++++++++++++++ .../c2/gvn/MissedURShiftLShiftIdeal.java | 64 ++++++++++++++++ 4 files changed, 181 insertions(+), 32 deletions(-) create mode 100644 test/hotspot/jtreg/compiler/c2/gvn/MissedRShiftLShiftIdentity.java create mode 100644 test/hotspot/jtreg/compiler/c2/gvn/MissedURShiftLShiftIdeal.java diff --git a/src/hotspot/share/opto/mulnode.cpp b/src/hotspot/share/opto/mulnode.cpp index aa8d6cfce2e..ac7d1925667 100644 --- a/src/hotspot/share/opto/mulnode.cpp +++ b/src/hotspot/share/opto/mulnode.cpp @@ -1238,20 +1238,26 @@ Node* RShiftNode::IdentityIL(PhaseGVN* phase, BasicType bt) { return in(1); } // Check for useless sign-masking + int lshift_count = 0; if (in(1)->Opcode() == Op_LShift(bt) && in(1)->req() == 3 && - in(1)->in(2) == in(2)) { + // Compare shift counts by value, not by node pointer, to also match a not-yet-normalized + // negative constant (e.g. -1 vs 31) + const_shift_count(phase, in(1), &lshift_count)) { count &= bits_per_java_integer(bt) - 1; // semantics of Java shifts - // Compute masks for which this shifting doesn't change - jlong lo = (CONST64(-1) << (bits_per_java_integer(bt) - ((uint)count)-1)); // FFFF8000 - jlong hi = ~lo; // 00007FFF - const TypeInteger* t11 = phase->type(in(1)->in(1))->isa_integer(bt); - if (t11 == nullptr) { - return this; - } - // Does actual value fit inside of mask? - if (lo <= t11->lo_as_long() && t11->hi_as_long() <= hi) { - return in(1)->in(1); // Then shifting is a nop + lshift_count &= bits_per_java_integer(bt) - 1; + if (count == lshift_count) { + // Compute masks for which this shifting doesn't change + jlong lo = (CONST64(-1) << (bits_per_java_integer(bt) - ((uint)count)-1)); // FFFF8000 + jlong hi = ~lo; // 00007FFF + const TypeInteger* t11 = phase->type(in(1)->in(1))->isa_integer(bt); + if (t11 == nullptr) { + return this; + } + // Does actual value fit inside of mask? + if (lo <= t11->lo_as_long() && t11->hi_as_long() <= hi) { + return in(1)->in(1); // Then shifting is a nop + } } } } @@ -1524,11 +1530,14 @@ Node* URShiftINode::Ideal(PhaseGVN* phase, bool can_reshape) { // If Q is "X << z" the rounding is useless. Look for patterns like // ((X<>> Z and replace with (X + Y>>>Z) & Z-mask. Node *add = in(1); - const TypeInt *t2 = phase->type(in(2))->isa_int(); if (in1_op == Op_AddI) { Node *lshl = add->in(1); - if( lshl->Opcode() == Op_LShiftI && - phase->type(lshl->in(2)) == t2 ) { + // Compare shift counts by value, not by node pointer, to also match a not-yet-normalized + // negative constant (e.g. -1 vs 31) + int lshl_con = 0; + if (lshl->Opcode() == Op_LShiftI && + const_shift_count(phase, lshl, &lshl_con) && + (lshl_con & (BitsPerJavaInteger - 1)) == con) { Node *y_z = phase->transform( new URShiftINode(add->in(2),in(2)) ); Node *sum = phase->transform( new AddINode( lshl->in(1), y_z ) ); return new AndINode( sum, phase->intcon(mask) ); @@ -1555,11 +1564,16 @@ Node* URShiftINode::Ideal(PhaseGVN* phase, bool can_reshape) { // Check for "(X << z ) >>> z" which simply zero-extends Node *shl = in(1); - if( in1_op == Op_LShiftI && - phase->type(shl->in(2)) == t2 ) - return new AndINode( shl->in(1), phase->intcon(mask) ); + // Compare shift counts by value, not by node pointer, to also match a not-yet-normalized + // negative constant (e.g. -1 vs 31) + int shl_con = 0; + if (in1_op == Op_LShiftI && + const_shift_count(phase, shl, &shl_con) && + (shl_con & (BitsPerJavaInteger - 1)) == con) + return new AndINode(shl->in(1), phase->intcon(mask)); // Check for (x >> n) >>> 31. Replace with (x >>> 31) + const TypeInt* t2 = phase->type(in(2))->isa_int(); Node *shr = in(1); if ( in1_op == Op_RShiftI ) { Node *in11 = shr->in(1); @@ -1677,11 +1691,15 @@ Node* URShiftLNode::Ideal(PhaseGVN* phase, bool can_reshape) { const TypeInt *t2 = phase->type(in(2))->isa_int(); if (add->Opcode() == Op_AddL) { Node *lshl = add->in(1); - if( lshl->Opcode() == Op_LShiftL && - phase->type(lshl->in(2)) == t2 ) { - Node *y_z = phase->transform( new URShiftLNode(add->in(2),in(2)) ); - Node *sum = phase->transform( new AddLNode( lshl->in(1), y_z ) ); - return new AndLNode( sum, phase->longcon(mask) ); + // Compare shift counts by value, not by node pointer, to also match a not-yet-normalized + // negative constant (e.g. -1 vs 63) + int lshl_con = 0; + if (lshl->Opcode() == Op_LShiftL && + const_shift_count(phase, lshl, &lshl_con) && + (lshl_con & (BitsPerJavaLong - 1)) == con) { + Node* y_z = phase->transform(new URShiftLNode(add->in(2), in(2))); + Node* sum = phase->transform(new AddLNode(lshl->in(1), y_z)); + return new AndLNode(sum, phase->longcon(mask)); } } @@ -1701,9 +1719,14 @@ Node* URShiftLNode::Ideal(PhaseGVN* phase, bool can_reshape) { // Check for "(X << z ) >>> z" which simply zero-extends Node *shl = in(1); - if( shl->Opcode() == Op_LShiftL && - phase->type(shl->in(2)) == t2 ) - return new AndLNode( shl->in(1), phase->longcon(mask) ); + // Compare shift counts by value, not by node pointer, to also match a not-yet-normalized + // negative constant (e.g. -1 vs 63) + int shl_con = 0; + if (shl->Opcode() == Op_LShiftL && + const_shift_count(phase, shl, &shl_con) && + (shl_con & (BitsPerJavaLong - 1)) == con) { + return new AndLNode(shl->in(1), phase->longcon(mask)); + } // Check for (x >> n) >>> 63. Replace with (x >>> 63) Node *shr = in(1); diff --git a/src/hotspot/share/opto/phaseX.cpp b/src/hotspot/share/opto/phaseX.cpp index be92d4116b0..868dfc03047 100644 --- a/src/hotspot/share/opto/phaseX.cpp +++ b/src/hotspot/share/opto/phaseX.cpp @@ -1722,11 +1722,6 @@ void PhaseIterGVN::verify_Ideal_for(Node* n, bool can_reshape) { case Op_MergeMem: return; - // URShiftINode::Ideal - // Found in tier1-3. Did not investigate further yet. - case Op_URShiftI: - return; - // CMoveINode::Ideal // Found in tier1-3. Did not investigate further yet. case Op_CMoveI: @@ -2594,12 +2589,15 @@ void PhaseIterGVN::add_users_of_use_to_worklist(Node* n, Node* use, Unique_Node_ auto is_boundary = [](Node* n){ return !n->is_ConstraintCast(); }; use->visit_uses(push_the_uses_to_worklist, is_boundary); } - // If changed LShift inputs, check RShift users for useless sign-ext + // If changed LShift inputs, check RShift/URShift users for + // "(X << C) >> C" sign-ext and "(X << C) >>> C" zero-ext optimizations. if (use_op == Op_LShiftI || use_op == Op_LShiftL) { for (DUIterator_Fast i2max, i2 = use->fast_outs(i2max); i2 < i2max; i2++) { Node* u = use->fast_out(i2); - if (u->Opcode() == Op_RShiftI || u->Opcode() == Op_RShiftL) + if (u->Opcode() == Op_RShiftI || u->Opcode() == Op_RShiftL || + u->Opcode() == Op_URShiftI || u->Opcode() == Op_URShiftL) { worklist.push(u); + } } } // If changed LShift inputs, check And users for shift and mask (And) operation diff --git a/test/hotspot/jtreg/compiler/c2/gvn/MissedRShiftLShiftIdentity.java b/test/hotspot/jtreg/compiler/c2/gvn/MissedRShiftLShiftIdentity.java new file mode 100644 index 00000000000..9f8eaab514f --- /dev/null +++ b/test/hotspot/jtreg/compiler/c2/gvn/MissedRShiftLShiftIdentity.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * 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 compiler.c2.gvn; + +/* + * @test + * @bug 8374798 + * @summary RShift(LShift(x, C), C) Identity missed when shift counts are different + * constant nodes for the same effective count (e.g. -1 vs 31) due to + * mask_and_replace_shift_amount normalizing them at different times. + * + * @run main ${test.main.class} + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions + * -XX:+StressIGVN -XX:+StressCCP -XX:VerifyIterativeGVN=1000 -Xbatch -XX:-TieredCompilation + * -XX:CompileCommand=compileonly,${test.main.class}::test* ${test.main.class} + */ + +public class MissedRShiftLShiftIdentity { + public static int iFld = 0; + + public static void test() { + int[] iArr = new int[10]; + int i2 = -1, i3 = 0; + + for (int i11 : iArr) { + iFld = i11; + for (int i1 = 0; i1 < 10; i1++) { + iFld <<= i3; + iFld >>= i2; // RShift + i3 = i2; + } + int i16 = 0; + do { + for (int f3 = 1; f3 < 1; f3 += 3) { + i2 = -1; + } + } while (++i16 < 5); + } + } + + public static void main(String[] args) { + test(); + } +} diff --git a/test/hotspot/jtreg/compiler/c2/gvn/MissedURShiftLShiftIdeal.java b/test/hotspot/jtreg/compiler/c2/gvn/MissedURShiftLShiftIdeal.java new file mode 100644 index 00000000000..774b218b1ca --- /dev/null +++ b/test/hotspot/jtreg/compiler/c2/gvn/MissedURShiftLShiftIdeal.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * 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 compiler.c2.gvn; + +/* + * @test + * @bug 8374798 8377389 + * @summary URShift(LShift(x, C), C) Ideal optimization missed due to missing IGVN notification: + * when LShift inputs change, its URShift users were not re-queued for the + * (X << C) >>> C -> X & mask optimization. + * + * @run main ${test.main.class} + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions + * -XX:+StressIGVN -XX:+StressCCP -XX:VerifyIterativeGVN=0100 -Xbatch -XX:-TieredCompilation + * -XX:CompileCommand=compileonly,${test.main.class}::test* ${test.main.class} + */ + +public class MissedURShiftLShiftIdeal { + public static int iFld = 0; + + public static void test() { + int[] iArr = new int[10]; + int i2 = -1, i3 = 0; + + for (int i11 : iArr) { + iFld = i11; + for (int i1 = 0; i1 < 10; i1++) { + iFld <<= i3; + iFld >>>= i2; // URShift + i3 = i2; + } + int i16 = 0; + do { + for (int f3 = 1; f3 < 1; f3 += 3) { + i2 = -1; + } + } while (++i16 < 5); + } + } + + public static void main(String[] args) { + test(); + } +} From a7255f93ed448e00c215877e13e2c37721c77752 Mon Sep 17 00:00:00 2001 From: Afshin Zafari Date: Mon, 16 Feb 2026 13:19:24 +0000 Subject: [PATCH 112/120] 8366241: NMT: Consolidate [Virtual/Committed/Reserved]Regions into one structure Reviewed-by: phubner, jsjolen --- src/hotspot/share/nmt/memBaseline.cpp | 7 +- src/hotspot/share/nmt/memMapPrinter.cpp | 4 +- src/hotspot/share/nmt/memReporter.cpp | 38 ++-- src/hotspot/share/nmt/memReporter.hpp | 4 +- src/hotspot/share/nmt/regionsTree.cpp | 6 +- src/hotspot/share/nmt/regionsTree.hpp | 22 ++- src/hotspot/share/nmt/regionsTree.inline.hpp | 18 +- .../share/nmt/virtualMemoryTracker.cpp | 48 ++--- .../share/nmt/virtualMemoryTracker.hpp | 150 +++++---------- test/hotspot/gtest/nmt/test_regions_tree.cpp | 26 +-- .../runtime/test_committed_virtualmemory.cpp | 37 ++-- .../runtime/test_virtualMemoryTracker.cpp | 172 +++++++++--------- 12 files changed, 239 insertions(+), 293 deletions(-) diff --git a/src/hotspot/share/nmt/memBaseline.cpp b/src/hotspot/share/nmt/memBaseline.cpp index 118e3ec64c0..65168fd4e09 100644 --- a/src/hotspot/share/nmt/memBaseline.cpp +++ b/src/hotspot/share/nmt/memBaseline.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -168,12 +168,13 @@ int compare_allocation_site(const VirtualMemoryAllocationSite& s1, } bool MemBaseline::aggregate_virtual_memory_allocation_sites() { + SortedLinkedList allocation_sites; VirtualMemoryAllocationSite* site; bool failed_oom = false; - _vma_allocations->visit_reserved_regions([&](ReservedMemoryRegion& rgn) { - VirtualMemoryAllocationSite tmp(*rgn.call_stack(), rgn.mem_tag()); + _vma_allocations->visit_reserved_regions([&](VirtualMemoryRegion& rgn) { + VirtualMemoryAllocationSite tmp(*rgn.reserved_call_stack(), rgn.mem_tag()); site = allocation_sites.find(tmp); if (site == nullptr) { LinkedListNode* node = diff --git a/src/hotspot/share/nmt/memMapPrinter.cpp b/src/hotspot/share/nmt/memMapPrinter.cpp index 9a2fe166d3d..639e06292fc 100644 --- a/src/hotspot/share/nmt/memMapPrinter.cpp +++ b/src/hotspot/share/nmt/memMapPrinter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2023, 2024, Red Hat, Inc. and/or its affiliates. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -149,7 +149,7 @@ public: } } - bool do_allocation_site(const ReservedMemoryRegion* rgn) override { + bool do_allocation_site(const VirtualMemoryRegion* rgn) override { // Cancel iteration if we run out of memory (add returns false); return add(rgn->base(), rgn->end(), rgn->mem_tag()); } diff --git a/src/hotspot/share/nmt/memReporter.cpp b/src/hotspot/share/nmt/memReporter.cpp index 772bda2885b..27a94ec7bc0 100644 --- a/src/hotspot/share/nmt/memReporter.cpp +++ b/src/hotspot/share/nmt/memReporter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -395,14 +395,14 @@ int MemDetailReporter::report_virtual_memory_allocation_sites() { void MemDetailReporter::report_virtual_memory_map() { // Virtual memory map always in base address order output()->print_cr("Virtual memory map:"); - _baseline.virtual_memory_allocations()->visit_reserved_regions([&](ReservedMemoryRegion& rgn) { + _baseline.virtual_memory_allocations()->visit_reserved_regions([&](VirtualMemoryRegion& rgn) { report_virtual_memory_region(&rgn); return true; }); } -void MemDetailReporter::report_virtual_memory_region(const ReservedMemoryRegion* reserved_rgn) { - assert(reserved_rgn != nullptr, "null pointer"); +void MemDetailReporter::report_virtual_memory_region(const VirtualMemoryRegion* rgn) { + assert(rgn != nullptr, "null pointer"); // We don't bother about reporting peaks here. // That is because peaks - in the context of virtual memory, peak of committed areas - make little sense @@ -414,16 +414,16 @@ void MemDetailReporter::report_virtual_memory_region(const ReservedMemoryRegion* // usage *by callsite*. // Don't report if size is too small. - if (amount_in_current_scale(reserved_rgn->size()) == 0) return; + if (amount_in_current_scale(rgn->size()) == 0) return; outputStream* out = output(); const char* scale = current_scale(); - const NativeCallStack* stack = reserved_rgn->call_stack(); - bool all_committed = reserved_rgn->size() == _baseline.virtual_memory_allocations()->committed_size(*reserved_rgn); + const NativeCallStack* stack = rgn->reserved_call_stack(); + bool all_committed = rgn->size() == _baseline.virtual_memory_allocations()->committed_size(*rgn); const char* region_type = (all_committed ? "reserved and committed" : "reserved"); out->cr(); - print_virtual_memory_region(region_type, reserved_rgn->base(), reserved_rgn->size()); - out->print(" for %s", NMTUtil::tag_to_name(reserved_rgn->mem_tag())); + print_virtual_memory_region(region_type, rgn->base(), rgn->size()); + out->print(" for %s", NMTUtil::tag_to_name(rgn->mem_tag())); if (stack->is_empty()) { out->cr(); } else { @@ -433,9 +433,9 @@ void MemDetailReporter::report_virtual_memory_region(const ReservedMemoryRegion* if (all_committed) { bool reserved_and_committed = false; - _baseline.virtual_memory_allocations()->visit_committed_regions(*reserved_rgn, - [&](CommittedMemoryRegion& committed_rgn) { - if (committed_rgn.equals(*reserved_rgn)) { + _baseline.virtual_memory_allocations()->visit_committed_regions(*rgn, + [&](VirtualMemoryRegion& committed_rgn) { + if (committed_rgn.equals(*rgn)) { // One region spanning the entire reserved region, with the same stack trace. // Don't print this regions because the "reserved and committed" line above // already indicates that the region is committed. @@ -450,13 +450,13 @@ void MemDetailReporter::report_virtual_memory_region(const ReservedMemoryRegion* } } - auto print_committed_rgn = [&](const CommittedMemoryRegion& crgn) { + auto print_committed_rgn = [&](const VirtualMemoryRegion& rgn) { // Don't report if size is too small - if (amount_in_current_scale(crgn.size()) == 0) return; - stack = crgn.call_stack(); + if (amount_in_current_scale(rgn.size()) == 0) return; + stack = rgn.committed_call_stack(); out->cr(); INDENT_BY(8, - print_virtual_memory_region("committed", crgn.base(), crgn.size()); + print_virtual_memory_region("committed", rgn.base(), rgn.size()); if (stack->is_empty()) { out->cr(); } else { @@ -466,9 +466,9 @@ void MemDetailReporter::report_virtual_memory_region(const ReservedMemoryRegion* ) }; - _baseline.virtual_memory_allocations()->visit_committed_regions(*reserved_rgn, - [&](CommittedMemoryRegion& crgn) { - print_committed_rgn(crgn); + _baseline.virtual_memory_allocations()->visit_committed_regions(*rgn, + [&](VirtualMemoryRegion& committed_rgn) { + print_committed_rgn(committed_rgn); return true; }); } diff --git a/src/hotspot/share/nmt/memReporter.hpp b/src/hotspot/share/nmt/memReporter.hpp index bab8de138d0..0d7e7344608 100644 --- a/src/hotspot/share/nmt/memReporter.hpp +++ b/src/hotspot/share/nmt/memReporter.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -178,7 +178,7 @@ class MemDetailReporter : public MemSummaryReporter { int report_virtual_memory_allocation_sites(); // Report a virtual memory region - void report_virtual_memory_region(const ReservedMemoryRegion* rgn); + void report_virtual_memory_region(const VirtualMemoryRegion* rgn); }; /* diff --git a/src/hotspot/share/nmt/regionsTree.cpp b/src/hotspot/share/nmt/regionsTree.cpp index 83306cbc14f..1a87d051928 100644 --- a/src/hotspot/share/nmt/regionsTree.cpp +++ b/src/hotspot/share/nmt/regionsTree.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,9 +58,9 @@ void RegionsTree::print_on(outputStream* st) { } #endif -size_t RegionsTree::committed_size(const ReservedMemoryRegion& rgn) { +size_t RegionsTree::committed_size(const VirtualMemoryRegion& rgn) { size_t result = 0; - visit_committed_regions(rgn, [&](CommittedMemoryRegion& crgn) { + visit_committed_regions(rgn, [&](VirtualMemoryRegion& crgn) { result += crgn.size(); return true; }); diff --git a/src/hotspot/share/nmt/regionsTree.hpp b/src/hotspot/share/nmt/regionsTree.hpp index 2e1b37d0c1a..4b27423db8c 100644 --- a/src/hotspot/share/nmt/regionsTree.hpp +++ b/src/hotspot/share/nmt/regionsTree.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. * 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,8 +29,7 @@ #include "nmt/vmatree.hpp" -class ReservedMemoryRegion; -class CommittedMemoryRegion; +class VirtualMemoryRegion; // RegionsTree extends VMATree to add some more specific API and also defines a helper // for processing the tree nodes in a shorter and more meaningful way. class RegionsTree : public VMATree { @@ -46,7 +45,7 @@ class RegionsTree : public VMATree { _with_storage(other._with_storage) {} RegionsTree& operator=(const RegionsTree& other) = delete; - ReservedMemoryRegion find_reserved_region(address addr); + VirtualMemoryRegion find_reserved_region(address addr); void commit_region(address addr, size_t size, const NativeCallStack& stack, SummaryDiff& diff); void uncommit_region(address addr, size_t size, SummaryDiff& diff); @@ -71,6 +70,7 @@ class RegionsTree : public VMATree { return position() - other.position(); } inline NativeCallStackStorage::StackIndex out_stack_index() const { return _node->val().out.reserved_stack(); } + inline NativeCallStackStorage::StackIndex out_committed_stack_index() const { return _node->val().out.committed_stack(); } inline MemTag in_tag() const { return _node->val().in.mem_tag(); } inline MemTag out_tag() const { return _node->val().out.mem_tag(); } inline void set_in_tag(MemTag tag) { _node->val().in.set_tag(tag); } @@ -81,7 +81,7 @@ class RegionsTree : public VMATree { DEBUG_ONLY(void print_on(outputStream* st);) template - void visit_committed_regions(const ReservedMemoryRegion& rgn, F func); + void visit_committed_regions(const VirtualMemoryRegion& rgn, F func); template void visit_reserved_regions(F func); @@ -90,7 +90,7 @@ class RegionsTree : public VMATree { return RegionData(_ncs_storage.push(ncs), tag); } - inline const NativeCallStack stack(NodeHelper& node) { + inline const NativeCallStack reserved_stack(NodeHelper& node) { if (!_with_storage) { return NativeCallStack::empty_stack(); } @@ -98,7 +98,15 @@ class RegionsTree : public VMATree { return _ncs_storage.get(si); } - size_t committed_size(const ReservedMemoryRegion& rgn); + inline const NativeCallStack committed_stack(NodeHelper& node) { + if (!_with_storage) { + return NativeCallStack::empty_stack(); + } + NativeCallStackStorage::StackIndex si = node.out_committed_stack_index(); + return _ncs_storage.get(si); + } + + size_t committed_size(const VirtualMemoryRegion& rgn); }; #endif // NMT_REGIONSTREE_HPP diff --git a/src/hotspot/share/nmt/regionsTree.inline.hpp b/src/hotspot/share/nmt/regionsTree.inline.hpp index 98cfa0e7f2c..793a5c5f1fa 100644 --- a/src/hotspot/share/nmt/regionsTree.inline.hpp +++ b/src/hotspot/share/nmt/regionsTree.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. * 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 "nmt/virtualMemoryTracker.hpp" template -void RegionsTree::visit_committed_regions(const ReservedMemoryRegion& rgn, F func) { +void RegionsTree::visit_committed_regions(const VirtualMemoryRegion& rgn, F func) { position start = (position)rgn.base(); size_t end = reinterpret_cast(rgn.end()) + 1; size_t comm_size = 0; @@ -38,8 +38,12 @@ void RegionsTree::visit_committed_regions(const ReservedMemoryRegion& rgn, F fun visit_range_in_order(start, end, [&](Node* node) { NodeHelper curr(node); if (prev.is_valid() && prev.is_committed_begin()) { - CommittedMemoryRegion cmr((address)prev.position(), curr.distance_from(prev), stack(prev)); - if (!func(cmr)) { + VirtualMemoryRegion rgn((address)prev.position(), + curr.distance_from(prev), + reserved_stack(prev), + committed_stack(prev), + prev.out_tag()); + if (!func(rgn)) { return false; } } @@ -63,13 +67,13 @@ void RegionsTree::visit_reserved_regions(F func) { } prev = curr; if (curr.is_released_begin() || begin_node.out_tag() != curr.out_tag()) { - auto st = stack(begin_node); + auto st = reserved_stack(begin_node); if (rgn_size == 0) { prev.clear_node(); return true; } - ReservedMemoryRegion rmr((address)begin_node.position(), rgn_size, st, begin_node.out_tag()); - if (!func(rmr)) { + VirtualMemoryRegion rgn((address)begin_node.position(), rgn_size, st, begin_node.out_tag()); + if (!func(rgn)) { return false; } rgn_size = 0; diff --git a/src/hotspot/share/nmt/virtualMemoryTracker.cpp b/src/hotspot/share/nmt/virtualMemoryTracker.cpp index d676d93e040..4e4138f81a2 100644 --- a/src/hotspot/share/nmt/virtualMemoryTracker.cpp +++ b/src/hotspot/share/nmt/virtualMemoryTracker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -193,14 +193,14 @@ bool VirtualMemoryTracker::Instance::print_containing_region(const void* p, outp } bool VirtualMemoryTracker::print_containing_region(const void* p, outputStream* st) { - ReservedMemoryRegion rmr = tree()->find_reserved_region((address)p); - if (!rmr.contain_address((address)p)) { + VirtualMemoryRegion rgn = tree()->find_reserved_region((address)p); + if (!rgn.is_valid() || !rgn.contain_address((address)p)) { return false; } st->print_cr(PTR_FORMAT " in mmap'd memory region [" PTR_FORMAT " - " PTR_FORMAT "], tag %s", - p2i(p), p2i(rmr.base()), p2i(rmr.end()), NMTUtil::tag_to_enum_name(rmr.mem_tag())); + p2i(p), p2i(rgn.base()), p2i(rgn.end()), NMTUtil::tag_to_enum_name(rgn.mem_tag())); if (MemTracker::tracking_level() == NMT_detail) { - rmr.call_stack()->print_on(st); + rgn.reserved_call_stack()->print_on(st); } st->cr(); return true; @@ -213,7 +213,7 @@ bool VirtualMemoryTracker::Instance::walk_virtual_memory(VirtualMemoryWalker* wa bool VirtualMemoryTracker::walk_virtual_memory(VirtualMemoryWalker* walker) { bool ret = true; - tree()->visit_reserved_regions([&](ReservedMemoryRegion& rgn) { + tree()->visit_reserved_regions([&](VirtualMemoryRegion& rgn) { if (!walker->do_allocation_site(&rgn)) { ret = false; return false; @@ -223,29 +223,29 @@ bool VirtualMemoryTracker::walk_virtual_memory(VirtualMemoryWalker* walker) { return ret; } -size_t VirtualMemoryTracker::committed_size(const ReservedMemoryRegion* rmr) { +size_t VirtualMemoryTracker::committed_size(const VirtualMemoryRegion* rgn) { size_t result = 0; - tree()->visit_committed_regions(*rmr, [&](CommittedMemoryRegion& crgn) { + tree()->visit_committed_regions(*rgn, [&](VirtualMemoryRegion& crgn) { result += crgn.size(); return true; }); return result; } -size_t VirtualMemoryTracker::Instance::committed_size(const ReservedMemoryRegion* rmr) { +size_t VirtualMemoryTracker::Instance::committed_size(const VirtualMemoryRegion* rgn) { assert(_tracker != nullptr, "Sanity check"); - return _tracker->committed_size(rmr); + return _tracker->committed_size(rgn); } -address VirtualMemoryTracker::Instance::thread_stack_uncommitted_bottom(const ReservedMemoryRegion* rmr) { +address VirtualMemoryTracker::Instance::thread_stack_uncommitted_bottom(const VirtualMemoryRegion* rgn) { assert(_tracker != nullptr, "Sanity check"); - return _tracker->thread_stack_uncommitted_bottom(rmr); + return _tracker->thread_stack_uncommitted_bottom(rgn); } -address VirtualMemoryTracker::thread_stack_uncommitted_bottom(const ReservedMemoryRegion* rmr) { - address bottom = rmr->base(); - address top = rmr->end(); - tree()->visit_committed_regions(*rmr, [&](CommittedMemoryRegion& crgn) { +address VirtualMemoryTracker::thread_stack_uncommitted_bottom(const VirtualMemoryRegion* rgn) { + address bottom = rgn->base(); + address top = rgn->end(); + tree()->visit_committed_regions(*rgn, [&](VirtualMemoryRegion& crgn) { address committed_top = crgn.base() + crgn.size(); if (committed_top < top) { // committed stack guard pages, skip them @@ -299,7 +299,7 @@ class SnapshotThreadStackWalker : public VirtualMemoryWalker { public: SnapshotThreadStackWalker() {} - bool do_allocation_site(const ReservedMemoryRegion* rgn) { + bool do_allocation_site(const VirtualMemoryRegion* rgn) { if (MemTracker::NmtVirtualMemoryLocker::is_safe_to_use()) { assert_lock_strong(NmtVirtualMemory_lock); } @@ -340,19 +340,19 @@ void VirtualMemoryTracker::Instance::snapshot_thread_stacks() { walk_virtual_memory(&walker); } -ReservedMemoryRegion RegionsTree::find_reserved_region(address addr) { - ReservedMemoryRegion rmr; - auto contain_region = [&](ReservedMemoryRegion& region_in_tree) { +VirtualMemoryRegion RegionsTree::find_reserved_region(address addr) { + VirtualMemoryRegion rgn; + auto contain_region = [&](VirtualMemoryRegion& region_in_tree) { if (region_in_tree.contain_address(addr)) { - rmr = region_in_tree; + rgn = region_in_tree; return false; } return true; }; visit_reserved_regions(contain_region); - return rmr; + return rgn; } -bool CommittedMemoryRegion::equals(const ReservedMemoryRegion& rmr) const { - return size() == rmr.size() && call_stack()->equals(*(rmr.call_stack())); +bool VirtualMemoryRegion::equals_including_stacks(const VirtualMemoryRegion& rgn) const { + return size() == rgn.size() && committed_call_stack()->equals(*(rgn.reserved_call_stack())); } diff --git a/src/hotspot/share/nmt/virtualMemoryTracker.hpp b/src/hotspot/share/nmt/virtualMemoryTracker.hpp index c51b53194e6..975169f6247 100644 --- a/src/hotspot/share/nmt/virtualMemoryTracker.hpp +++ b/src/hotspot/share/nmt/virtualMemoryTracker.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -194,15 +194,38 @@ class VirtualMemorySummary : AllStatic { */ class VirtualMemoryRegion { private: - address _base_address; - size_t _size; + address _base_address; + size_t _size; + MemTag _mem_tag; + NativeCallStack _reserved_stack; + NativeCallStack _committed_stack; public: + VirtualMemoryRegion() : + _base_address(0), _size(0), _mem_tag(mtNone), + _reserved_stack(NativeCallStack::empty_stack()) , + _committed_stack(NativeCallStack::empty_stack()) {} + VirtualMemoryRegion(address addr, size_t size) : - _base_address(addr), _size(size) { + _base_address(addr), _size(size), _mem_tag(mtNone), + _reserved_stack(NativeCallStack::empty_stack()) , + _committed_stack(NativeCallStack::empty_stack()) { assert(addr != nullptr, "Invalid address"); assert(size > 0, "Invalid size"); - } + } + + VirtualMemoryRegion(address addr, size_t size, const NativeCallStack& reserved_stack, const NativeCallStack& committed_stack, MemTag mem_tag = mtNone) : + _base_address(addr), _size(size), _mem_tag(mem_tag), + _reserved_stack(reserved_stack), + _committed_stack(committed_stack) { + assert(addr != nullptr, "Invalid address"); + assert(size > 0, "Invalid size"); + } + + VirtualMemoryRegion(address addr, size_t size, const NativeCallStack& stack, MemTag mem_tag = mtNone) + : _base_address(addr), _size(size), _mem_tag(mem_tag), + _reserved_stack(stack), + _committed_stack(NativeCallStack::empty_stack()) {} inline address base() const { return _base_address; } inline address end() const { return base() + size(); } @@ -211,48 +234,18 @@ class VirtualMemoryRegion { inline bool is_empty() const { return size() == 0; } inline bool contain_address(address addr) const { + assert(is_valid(), "sanity"); return (addr >= base() && addr < end()); } - - inline bool contain_region(address addr, size_t size) const { - return contain_address(addr) && contain_address(addr + size - 1); - } - - inline bool same_region(address addr, size_t sz) const { - return (addr == base() && sz == size()); - } - - + private: inline bool overlap_region(address addr, size_t sz) const { assert(sz > 0, "Invalid size"); assert(size() > 0, "Invalid size"); + assert(is_valid(), "sanity"); return MAX2(addr, base()) < MIN2(addr + sz, end()); } - inline bool adjacent_to(address addr, size_t sz) const { - return (addr == end() || (addr + sz) == base()); - } - - void exclude_region(address addr, size_t sz) { - assert(contain_region(addr, sz), "Not containment"); - assert(addr == base() || addr + sz == end(), "Can not exclude from middle"); - size_t new_size = size() - sz; - - if (addr == base()) { - set_base(addr + sz); - } - set_size(new_size); - } - - void expand_region(address addr, size_t sz) { - assert(adjacent_to(addr, sz), "Not adjacent regions"); - if (base() == addr + sz) { - set_base(addr); - } - set_size(size() + sz); - } - // Returns 0 if regions overlap; 1 if this region follows rgn; // -1 if this region precedes rgn. inline int compare(const VirtualMemoryRegion& rgn) const { @@ -266,86 +259,27 @@ class VirtualMemoryRegion { } } + public: // Returns true if regions overlap, false otherwise. inline bool equals(const VirtualMemoryRegion& rgn) const { return compare(rgn) == 0; } - protected: - void set_base(address base) { - assert(base != nullptr, "Sanity check"); - _base_address = base; - } + bool equals_including_stacks(const VirtualMemoryRegion& other) const; + inline const NativeCallStack* committed_call_stack() const { return &_committed_stack; } - void set_size(size_t size) { - assert(size > 0, "Sanity check"); - _size = size; - } -}; + bool is_valid() const { return base() != nullptr && size() != 0;} + inline const NativeCallStack* reserved_call_stack() const { return &_reserved_stack; } -class CommittedMemoryRegion : public VirtualMemoryRegion { - private: - NativeCallStack _stack; - - public: - CommittedMemoryRegion() - : VirtualMemoryRegion((address)1, 1), _stack(NativeCallStack::empty_stack()) { } - - CommittedMemoryRegion(address addr, size_t size, const NativeCallStack& stack) - : VirtualMemoryRegion(addr, size), _stack(stack) { } - - inline void set_call_stack(const NativeCallStack& stack) { _stack = stack; } - inline const NativeCallStack* call_stack() const { return &_stack; } - bool equals(const ReservedMemoryRegion& other) const; -}; - -class ReservedMemoryRegion : public VirtualMemoryRegion { - private: - NativeCallStack _stack; - MemTag _mem_tag; - - public: - bool is_valid() { return base() != (address)1 && size() != 1;} - - ReservedMemoryRegion() - : VirtualMemoryRegion((address)1, 1), _stack(NativeCallStack::empty_stack()), _mem_tag(mtNone) { } - - ReservedMemoryRegion(address base, size_t size, const NativeCallStack& stack, - MemTag mem_tag = mtNone) - : VirtualMemoryRegion(base, size), _stack(stack), _mem_tag(mem_tag) { } - - - ReservedMemoryRegion(address base, size_t size) - : VirtualMemoryRegion(base, size), _stack(NativeCallStack::empty_stack()), _mem_tag(mtNone) { } - - // Copy constructor - ReservedMemoryRegion(const ReservedMemoryRegion& rr) - : VirtualMemoryRegion(rr.base(), rr.size()) { - *this = rr; - } - - inline void set_call_stack(const NativeCallStack& stack) { _stack = stack; } - inline const NativeCallStack* call_stack() const { return &_stack; } - - inline MemTag mem_tag() const { return _mem_tag; } - - ReservedMemoryRegion& operator= (const ReservedMemoryRegion& other) { - set_base(other.base()); - set_size(other.size()); - - _stack = *other.call_stack(); - _mem_tag = other.mem_tag(); - - return *this; - } + inline MemTag mem_tag() const { return _mem_tag; } const char* tag_name() const { return NMTUtil::tag_to_name(_mem_tag); } }; class VirtualMemoryWalker : public StackObj { public: - virtual bool do_allocation_site(const ReservedMemoryRegion* rgn) { return false; } + virtual bool do_allocation_site(const VirtualMemoryRegion* rgn) { return false; } }; @@ -376,8 +310,8 @@ class VirtualMemoryTracker { // Snapshot current thread stacks void snapshot_thread_stacks(); void apply_summary_diff(VMATree::SummaryDiff diff); - size_t committed_size(const ReservedMemoryRegion* rmr); - address thread_stack_uncommitted_bottom(const ReservedMemoryRegion* rmr); + size_t committed_size(const VirtualMemoryRegion* rgn); + address thread_stack_uncommitted_bottom(const VirtualMemoryRegion* rgn); RegionsTree* tree() { return &_tree; } @@ -401,9 +335,9 @@ class VirtualMemoryTracker { static bool print_containing_region(const void* p, outputStream* st); static void snapshot_thread_stacks(); static void apply_summary_diff(VMATree::SummaryDiff diff); - static size_t committed_size(const ReservedMemoryRegion* rmr); + static size_t committed_size(const VirtualMemoryRegion* rgn); // uncommitted thread stack bottom, above guard pages if there is any. - static address thread_stack_uncommitted_bottom(const ReservedMemoryRegion* rmr); + static address thread_stack_uncommitted_bottom(const VirtualMemoryRegion* rgn); static RegionsTree* tree() { return _tracker->tree(); } }; diff --git a/test/hotspot/gtest/nmt/test_regions_tree.cpp b/test/hotspot/gtest/nmt/test_regions_tree.cpp index 7465c84aa72..a17a3fbb945 100644 --- a/test/hotspot/gtest/nmt/test_regions_tree.cpp +++ b/test/hotspot/gtest/nmt/test_regions_tree.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -104,15 +104,15 @@ TEST_VM_F(NMTRegionsTreeTest, FindReservedRegion) { rt.reserve_mapping(1200, 50, rd, not_used); rt.reserve_mapping(1300, 50, rd, not_used); rt.reserve_mapping(1400, 50, rd, not_used); - ReservedMemoryRegion rmr; - rmr = rt.find_reserved_region((address)1205); - EXPECT_EQ(rmr.base(), (address)1200); - rmr = rt.find_reserved_region((address)1305); - EXPECT_EQ(rmr.base(), (address)1300); - rmr = rt.find_reserved_region((address)1405); - EXPECT_EQ(rmr.base(), (address)1400); - rmr = rt.find_reserved_region((address)1005); - EXPECT_EQ(rmr.base(), (address)1000); + VirtualMemoryRegion rgn; + rgn = rt.find_reserved_region((address)1205); + EXPECT_EQ(rgn.base(), (address)1200); + rgn = rt.find_reserved_region((address)1305); + EXPECT_EQ(rgn.base(), (address)1300); + rgn = rt.find_reserved_region((address)1405); + EXPECT_EQ(rgn.base(), (address)1400); + rgn = rt.find_reserved_region((address)1005); + EXPECT_EQ(rgn.base(), (address)1000); } TEST_VM_F(NMTRegionsTreeTest, VisitReservedRegions) { @@ -124,7 +124,7 @@ TEST_VM_F(NMTRegionsTreeTest, VisitReservedRegions) { rt.reserve_mapping(1300, 50, rd, not_used); rt.reserve_mapping(1400, 50, rd, not_used); - rt.visit_reserved_regions([&](const ReservedMemoryRegion& rgn) { + rt.visit_reserved_regions([&](const VirtualMemoryRegion& rgn) { EXPECT_EQ(((size_t)rgn.base()) % 100, 0UL); EXPECT_EQ(rgn.size(), 50UL); return true; @@ -144,9 +144,9 @@ TEST_VM_F(NMTRegionsTreeTest, VisitCommittedRegions) { rt.commit_region((address)1020, 5UL, ncs, not_used); rt.commit_region((address)1030, 5UL, ncs, not_used); rt.commit_region((address)1040, 5UL, ncs, not_used); - ReservedMemoryRegion rmr((address)1000, 50); + VirtualMemoryRegion rgn((address)1000, 50); size_t count = 0; - rt.visit_committed_regions(rmr, [&](CommittedMemoryRegion& crgn) { + rt.visit_committed_regions(rgn, [&](VirtualMemoryRegion& crgn) { count++; EXPECT_EQ((((size_t)crgn.base()) % 100) / 10, count); EXPECT_EQ(crgn.size(), 5UL); diff --git a/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp b/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp index 5b78a66a3ae..8cf62fb9ea5 100644 --- a/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp +++ b/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * 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,15 +45,14 @@ public: VirtualMemoryTracker::Instance::snapshot_thread_stacks(); } - ReservedMemoryRegion rmr_found; + VirtualMemoryRegion rgn_found; { MemTracker::NmtVirtualMemoryLocker vml; - rmr_found = VirtualMemoryTracker::Instance::tree()->find_reserved_region(stack_end); + rgn_found = VirtualMemoryTracker::Instance::tree()->find_reserved_region(stack_end); } - ASSERT_TRUE(rmr_found.is_valid()); - ASSERT_EQ(rmr_found.base(), stack_end); - + ASSERT_TRUE(rgn_found.is_valid()); + ASSERT_EQ(rgn_found.base(), stack_end); int i = 0; address i_addr = (address)&i; @@ -64,12 +63,12 @@ public: bool found_stack_top = false; { MemTracker::NmtVirtualMemoryLocker vml; - VirtualMemoryTracker::Instance::tree()->visit_committed_regions(rmr_found, [&](const CommittedMemoryRegion& cmr) { - if (cmr.base() + cmr.size() == stack_top) { - EXPECT_TRUE(cmr.size() <= stack_size); + VirtualMemoryTracker::Instance::tree()->visit_committed_regions(rgn_found, [&](const VirtualMemoryRegion& rgn) { + if (rgn.base() + rgn.size() == stack_top) { + EXPECT_TRUE(rgn.size() <= stack_size); found_stack_top = true; } - if (i_addr < stack_top && i_addr >= cmr.base()) { + if (i_addr < stack_top && i_addr >= rgn.base()) { found_i_addr = true; } i++; @@ -115,25 +114,25 @@ public: } // trigger the test - ReservedMemoryRegion rmr_found; + VirtualMemoryRegion rgn_found; { MemTracker::NmtVirtualMemoryLocker nvml; VirtualMemoryTracker::Instance::snapshot_thread_stacks(); - rmr_found = VirtualMemoryTracker::Instance::tree()->find_reserved_region((address)base); + rgn_found = VirtualMemoryTracker::Instance::tree()->find_reserved_region((address)base); } - ASSERT_TRUE(rmr_found.is_valid()); - ASSERT_EQ(rmr_found.base(), (address)base); + ASSERT_TRUE(rgn_found.is_valid()); + ASSERT_EQ(rgn_found.base(), (address)base); bool precise_tracking_supported = false; { MemTracker::NmtVirtualMemoryLocker nvml; - VirtualMemoryTracker::Instance::tree()->visit_committed_regions(rmr_found, [&](const CommittedMemoryRegion& cmr){ - if (cmr.size() == size) { + VirtualMemoryTracker::Instance::tree()->visit_committed_regions(rgn_found, [&](const VirtualMemoryRegion& rgn){ + if (rgn.size() == size) { return false; } else { precise_tracking_supported = true; - check_covered_pages(cmr.base(), cmr.size(), (address)base, touch_pages, page_num); + check_covered_pages(rgn.base(), rgn.size(), (address)base, touch_pages, page_num); } return true; }); @@ -151,9 +150,9 @@ public: { MemTracker::NmtVirtualMemoryLocker nvml; VirtualMemoryTracker::Instance::remove_released_region((address)base, size); - rmr_found = VirtualMemoryTracker::Instance::tree()->find_reserved_region((address)base); + rgn_found = VirtualMemoryTracker::Instance::tree()->find_reserved_region((address)base); } - ASSERT_TRUE(!rmr_found.is_valid()); + ASSERT_TRUE(!rgn_found.is_valid()); } static void test_committed_region() { diff --git a/test/hotspot/gtest/runtime/test_virtualMemoryTracker.cpp b/test/hotspot/gtest/runtime/test_virtualMemoryTracker.cpp index 4242302997a..a7e4b273788 100644 --- a/test/hotspot/gtest/runtime/test_virtualMemoryTracker.cpp +++ b/test/hotspot/gtest/runtime/test_virtualMemoryTracker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * 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,41 +50,41 @@ namespace { }; } -#define check(vmt, rmr, regions) check_inner((vmt), (rmr), (regions), ARRAY_SIZE(regions), __FILE__, __LINE__) +#define check(vmt, rgn, regions) check_inner((vmt), (rgn), (regions), ARRAY_SIZE(regions), __FILE__, __LINE__) -#define check_empty(vmt, rmr) \ +#define check_empty(vmt, rgn) \ do { \ - check_inner((vmt), (rmr), nullptr, 0, __FILE__, __LINE__); \ + check_inner((vmt), (rgn), nullptr, 0, __FILE__, __LINE__); \ } while (false) -static void diagnostic_print(VirtualMemoryTracker& vmt, const ReservedMemoryRegion& rmr) { - LOG("In reserved region " PTR_FORMAT ", size %X:", p2i(rmr.base()), rmr.size()); - vmt.tree()->visit_committed_regions(rmr, [&](CommittedMemoryRegion& region) { - LOG(" committed region: " PTR_FORMAT ", size %X", p2i(region.base()), region.size()); +static void diagnostic_print(VirtualMemoryTracker& vmt, const VirtualMemoryRegion& rgn) { + LOG("In reserved region " PTR_FORMAT ", size %X:", p2i(rgn.base()), rgn.size()); + vmt.tree()->visit_committed_regions(rgn, [&](VirtualMemoryRegion& crgn) { + LOG(" committed region: " PTR_FORMAT ", size %X", p2i(crgn.base()), crgn.size()); return true; }); } -static void check_inner(VirtualMemoryTracker& vmt, const ReservedMemoryRegion& rmr, R* regions, size_t regions_size, const char* file, int line) { +static void check_inner(VirtualMemoryTracker& vmt, const VirtualMemoryRegion& rgn, R* regions, size_t regions_size, const char* file, int line) { size_t i = 0; size_t size = 0; // Helpful log - diagnostic_print(vmt, rmr); + diagnostic_print(vmt, rgn); #define WHERE " from " << file << ":" << line - vmt.tree()->visit_committed_regions(rmr, [&](CommittedMemoryRegion& region) { + vmt.tree()->visit_committed_regions(rgn, [&](VirtualMemoryRegion& crgn) { EXPECT_LT(i, regions_size) << WHERE; - EXPECT_EQ(region.base(), regions[i]._addr) << WHERE; - EXPECT_EQ(region.size(), regions[i]._size) << WHERE; - size += region.size(); + EXPECT_EQ(crgn.base(), regions[i]._addr) << WHERE; + EXPECT_EQ(crgn.size(), regions[i]._size) << WHERE; + size += crgn.size(); i++; return true; }); EXPECT_EQ(i, regions_size) << WHERE; - EXPECT_EQ(size, vmt.committed_size(&rmr)) << WHERE; + EXPECT_EQ(size, vmt.committed_size(&rgn)) << WHERE; } class VirtualMemoryTrackerTest { @@ -104,11 +104,11 @@ public: NativeCallStack stack(&frame1, 1); NativeCallStack stack2(&frame2, 1); - // Fetch the added RMR for the space - ReservedMemoryRegion rmr = rtree->find_reserved_region(addr); + // Fetch the added region for the space + VirtualMemoryRegion rgn = rtree->find_reserved_region(addr); - ASSERT_EQ(rmr.size(), size); - ASSERT_EQ(rmr.base(), addr); + ASSERT_EQ(rgn.size(), size); + ASSERT_EQ(rgn.base(), addr); // Commit Size Granularity const size_t cs = 0x1000; @@ -118,24 +118,24 @@ public: { // Commit one region rtree->commit_region(addr + cs, cs, stack, diff); R r[] = { {addr + cs, cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } { // Commit adjacent - lower address rtree->commit_region(addr, cs, stack, diff); R r[] = { {addr, 2 * cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } { // Commit adjacent - higher address rtree->commit_region(addr + 2 * cs, cs, stack, diff); R r[] = { {addr, 3 * cs} }; - check(vmt,rmr, r); + check(vmt, rgn, r); } // Cleanup rtree->uncommit_region(addr, 3 * cs, diff); - ASSERT_EQ(vmt.committed_size(&rmr), 0u); + ASSERT_EQ(vmt.committed_size(&rgn), 0u); // Commit adjacent regions with different stacks @@ -143,14 +143,14 @@ public: { // Commit one region rtree->commit_region(addr + cs, cs, stack, diff); R r[] = { {addr + cs, cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } { // Commit adjacent - lower address rtree->commit_region(addr, cs, stack2, diff); R r[] = { {addr, cs}, {addr + cs, cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } { // Commit adjacent - higher address @@ -158,12 +158,12 @@ public: R r[] = { {addr, cs}, {addr + cs, cs}, {addr + 2 * cs, cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } // Cleanup rtree->uncommit_region(addr, 3 * cs, diff); - ASSERT_EQ(vmt.committed_size(&rmr), 0u); + ASSERT_EQ(vmt.committed_size(&rgn), 0u); } static void test_add_committed_region_adjacent_overlapping() { @@ -180,11 +180,11 @@ public: NativeCallStack stack(&frame1, 1); NativeCallStack stack2(&frame2, 1); - // Fetch the added RMR for the space - ReservedMemoryRegion rmr = rtree->find_reserved_region(addr); + // Fetch the added region for the space + VirtualMemoryRegion rgn = rtree->find_reserved_region(addr); - ASSERT_EQ(rmr.size(), size); - ASSERT_EQ(rmr.base(), addr); + ASSERT_EQ(rgn.size(), size); + ASSERT_EQ(rgn.base(), addr); // Commit Size Granularity const size_t cs = 0x1000; @@ -196,28 +196,28 @@ public: rtree->commit_region(addr + 3 * cs, 2 * cs, stack, diff); R r[] = { {addr, 2 * cs}, {addr + 3 * cs, 2 * cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } { // Commit adjacent and overlapping rtree->commit_region(addr + 2 * cs, 2 * cs, stack, diff); R r[] = { {addr, 5 * cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } // revert to two non-adjacent regions rtree->uncommit_region(addr + 2 * cs, cs, diff); - ASSERT_EQ(vmt.committed_size(&rmr), 4 * cs); + ASSERT_EQ(vmt.committed_size(&rgn), 4 * cs); { // Commit overlapping and adjacent rtree->commit_region(addr + cs, 2 * cs, stack, diff); R r[] = { {addr, 5 * cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } // Cleanup rtree->uncommit_region(addr, 5 * cs, diff); - ASSERT_EQ(vmt.committed_size(&rmr), 0u); + ASSERT_EQ(vmt.committed_size(&rgn), 0u); // Commit adjacent and overlapping regions with different stacks @@ -227,7 +227,7 @@ public: rtree->commit_region(addr + 3 * cs, 2 * cs, stack, diff); R r[] = { {addr, 2 * cs}, {addr + 3 * cs, 2 * cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } { // Commit adjacent and overlapping @@ -235,20 +235,20 @@ public: R r[] = { {addr, 2 * cs}, {addr + 2 * cs, 2 * cs}, {addr + 4 * cs, cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } // revert to two non-adjacent regions rtree->commit_region(addr, 5 * cs, stack, diff); rtree->uncommit_region(addr + 2 * cs, cs, diff); - ASSERT_EQ(vmt.committed_size(&rmr), 4 * cs); + ASSERT_EQ(vmt.committed_size(&rgn), 4 * cs); { // Commit overlapping and adjacent rtree->commit_region(addr + cs, 2 * cs, stack2, diff); R r[] = { {addr, cs}, {addr + cs, 2 * cs}, {addr + 3 * cs, 2 * cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } rtree->tree().remove_all(); @@ -269,12 +269,12 @@ public: NativeCallStack stack(&frame1, 1); NativeCallStack stack2(&frame2, 1); - // Fetch the added RMR for the space - ReservedMemoryRegion rmr = rtree->find_reserved_region(addr); + // Fetch the added region for the space + VirtualMemoryRegion rgn = rtree->find_reserved_region(addr); - ASSERT_EQ(rmr.size(), size); - ASSERT_EQ(rmr.base(), addr); + ASSERT_EQ(rgn.size(), size); + ASSERT_EQ(rgn.base(), addr); // Commit Size Granularity const size_t cs = 0x1000; @@ -284,54 +284,54 @@ public: { // Commit one region rtree->commit_region(addr, cs, stack, diff); R r[] = { {addr, cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } { // Commit the same region rtree->commit_region(addr, cs, stack, diff); R r[] = { {addr, cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } { // Commit a succeeding region rtree->commit_region(addr + cs, cs, stack, diff); R r[] = { {addr, 2 * cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } { // Commit over two regions rtree->commit_region(addr, 2 * cs, stack, diff); R r[] = { {addr, 2 * cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } {// Commit first part of a region rtree->commit_region(addr, cs, stack, diff); R r[] = { {addr, 2 * cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } { // Commit second part of a region rtree->commit_region(addr + cs, cs, stack, diff); R r[] = { {addr, 2 * cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } { // Commit a third part rtree->commit_region(addr + 2 * cs, cs, stack, diff); R r[] = { {addr, 3 * cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } { // Commit in the middle of a region rtree->commit_region(addr + 1 * cs, cs, stack, diff); R r[] = { {addr, 3 * cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } // Cleanup rtree->uncommit_region(addr, 3 * cs, diff); - ASSERT_EQ(vmt.committed_size(&rmr), 0u); + ASSERT_EQ(vmt.committed_size(&rgn), 0u); // With preceding region @@ -342,71 +342,71 @@ public: { R r[] = { {addr, cs}, {addr + 2 * cs, 3 * cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } rtree->commit_region(addr + 3 * cs, cs, stack, diff); { R r[] = { {addr, cs}, {addr + 2 * cs, 3 * cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } rtree->commit_region(addr + 4 * cs, cs, stack, diff); { R r[] = { {addr, cs}, {addr + 2 * cs, 3 * cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } // Cleanup rtree->uncommit_region(addr, 5 * cs, diff); - ASSERT_EQ(vmt.committed_size(&rmr), 0u); + ASSERT_EQ(vmt.committed_size(&rgn), 0u); // With different stacks { // Commit one region rtree->commit_region(addr, cs, stack, diff); R r[] = { {addr, cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } { // Commit the same region rtree->commit_region(addr, cs, stack2, diff); R r[] = { {addr, cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } { // Commit a succeeding region rtree->commit_region(addr + cs, cs, stack, diff); R r[] = { {addr, cs}, {addr + cs, cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } { // Commit over two regions rtree->commit_region(addr, 2 * cs, stack, diff); R r[] = { {addr, 2 * cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } {// Commit first part of a region rtree->commit_region(addr, cs, stack2, diff); R r[] = { {addr, cs}, {addr + cs, cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } { // Commit second part of a region rtree->commit_region(addr + cs, cs, stack2, diff); R r[] = { {addr, 2 * cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } { // Commit a third part rtree->commit_region(addr + 2 * cs, cs, stack2, diff); R r[] = { {addr, 3 * cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } { // Commit in the middle of a region @@ -414,7 +414,7 @@ public: R r[] = { {addr, cs}, {addr + cs, cs}, {addr + 2 * cs, cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } rtree->tree().remove_all(); @@ -445,11 +445,11 @@ public: NativeCallStack stack(&frame1, 1); NativeCallStack stack2(&frame2, 1); - // Fetch the added RMR for the space - ReservedMemoryRegion rmr = rtree->find_reserved_region(addr); + // Fetch the added region for the space + VirtualMemoryRegion rgn = rtree->find_reserved_region(addr); - ASSERT_EQ(rmr.size(), size); - ASSERT_EQ(rmr.base(), addr); + ASSERT_EQ(rgn.size(), size); + ASSERT_EQ(rgn.base(), addr); // Commit Size Granularity const size_t cs = 0x1000; @@ -457,11 +457,11 @@ public: { // Commit regions rtree->commit_region(addr, 3 * cs, stack, diff); R r[] = { {addr, 3 * cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); // Remove only existing rtree->uncommit_region(addr, 3 * cs, diff); - check_empty(vmt, rmr); + check_empty(vmt, rgn); } { @@ -473,7 +473,7 @@ public: rtree->uncommit_region(addr, cs, diff); R r[] = { {addr + 2 * cs, cs}, {addr + 4 * cs, cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } // add back @@ -483,7 +483,7 @@ public: rtree->uncommit_region(addr + 2 * cs, cs, diff); R r[] = { {addr + 0 * cs, cs}, {addr + 4 * cs, cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } // add back @@ -493,17 +493,17 @@ public: rtree->uncommit_region(addr + 4 * cs, cs, diff); R r[] = { {addr + 0 * cs, cs}, {addr + 2 * cs, cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); } rtree->uncommit_region(addr, 5 * cs, diff); - check_empty(vmt, rmr); + check_empty(vmt, rgn); } { // Remove larger region rtree->commit_region(addr + 1 * cs, cs, stack, diff); rtree->uncommit_region(addr, 3 * cs, diff); - check_empty(vmt, rmr); + check_empty(vmt, rgn); } { // Remove smaller region - in the middle @@ -511,50 +511,50 @@ public: rtree->uncommit_region(addr + 1 * cs, cs, diff); R r[] = { { addr + 0 * cs, cs}, { addr + 2 * cs, cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); rtree->uncommit_region(addr, 3 * cs, diff); - check_empty(vmt, rmr); + check_empty(vmt, rgn); } { // Remove smaller region - at the beginning rtree->commit_region(addr, 3 * cs, stack, diff); rtree->uncommit_region(addr + 0 * cs, cs, diff); R r[] = { { addr + 1 * cs, 2 * cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); rtree->uncommit_region(addr, 3 * cs, diff); - check_empty(vmt, rmr); + check_empty(vmt, rgn); } { // Remove smaller region - at the end rtree->commit_region(addr, 3 * cs, stack, diff); rtree->uncommit_region(addr + 2 * cs, cs, diff); R r[] = { { addr, 2 * cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); rtree->uncommit_region(addr, 3 * cs, diff); - check_empty(vmt, rmr); + check_empty(vmt, rgn); } { // Remove smaller, overlapping region - at the beginning rtree->commit_region(addr + 1 * cs, 4 * cs, stack, diff); rtree->uncommit_region(addr, 2 * cs, diff); R r[] = { { addr + 2 * cs, 3 * cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); rtree->uncommit_region(addr + 1 * cs, 4 * cs, diff); - check_empty(vmt, rmr); + check_empty(vmt, rgn); } { // Remove smaller, overlapping region - at the end rtree->commit_region(addr, 3 * cs, stack, diff); rtree->uncommit_region(addr + 2 * cs, 2 * cs, diff); R r[] = { { addr, 2 * cs} }; - check(vmt, rmr, r); + check(vmt, rgn, r); rtree->uncommit_region(addr, 3 * cs, diff); - check_empty(vmt, rmr); + check_empty(vmt, rgn); } rtree->tree().remove_all(); From 81cca851aa615303ce6b8ebe135f1d04a5154025 Mon Sep 17 00:00:00 2001 From: Afshin Zafari Date: Mon, 16 Feb 2026 14:07:40 +0000 Subject: [PATCH 113/120] 8377997: [BACKOUT] 8366241: NMT: Consolidate [Virtual/Committed/Reserved]Regions into one structure Reviewed-by: mhaessig, chagedorn --- src/hotspot/share/nmt/memBaseline.cpp | 7 +- src/hotspot/share/nmt/memMapPrinter.cpp | 4 +- src/hotspot/share/nmt/memReporter.cpp | 38 ++-- src/hotspot/share/nmt/memReporter.hpp | 4 +- src/hotspot/share/nmt/regionsTree.cpp | 6 +- src/hotspot/share/nmt/regionsTree.hpp | 22 +-- src/hotspot/share/nmt/regionsTree.inline.hpp | 18 +- .../share/nmt/virtualMemoryTracker.cpp | 48 ++--- .../share/nmt/virtualMemoryTracker.hpp | 150 ++++++++++----- test/hotspot/gtest/nmt/test_regions_tree.cpp | 26 +-- .../runtime/test_committed_virtualmemory.cpp | 37 ++-- .../runtime/test_virtualMemoryTracker.cpp | 172 +++++++++--------- 12 files changed, 293 insertions(+), 239 deletions(-) diff --git a/src/hotspot/share/nmt/memBaseline.cpp b/src/hotspot/share/nmt/memBaseline.cpp index 65168fd4e09..118e3ec64c0 100644 --- a/src/hotspot/share/nmt/memBaseline.cpp +++ b/src/hotspot/share/nmt/memBaseline.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -168,13 +168,12 @@ int compare_allocation_site(const VirtualMemoryAllocationSite& s1, } bool MemBaseline::aggregate_virtual_memory_allocation_sites() { - SortedLinkedList allocation_sites; VirtualMemoryAllocationSite* site; bool failed_oom = false; - _vma_allocations->visit_reserved_regions([&](VirtualMemoryRegion& rgn) { - VirtualMemoryAllocationSite tmp(*rgn.reserved_call_stack(), rgn.mem_tag()); + _vma_allocations->visit_reserved_regions([&](ReservedMemoryRegion& rgn) { + VirtualMemoryAllocationSite tmp(*rgn.call_stack(), rgn.mem_tag()); site = allocation_sites.find(tmp); if (site == nullptr) { LinkedListNode* node = diff --git a/src/hotspot/share/nmt/memMapPrinter.cpp b/src/hotspot/share/nmt/memMapPrinter.cpp index 639e06292fc..9a2fe166d3d 100644 --- a/src/hotspot/share/nmt/memMapPrinter.cpp +++ b/src/hotspot/share/nmt/memMapPrinter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2023, 2024, Red Hat, Inc. and/or its affiliates. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -149,7 +149,7 @@ public: } } - bool do_allocation_site(const VirtualMemoryRegion* rgn) override { + bool do_allocation_site(const ReservedMemoryRegion* rgn) override { // Cancel iteration if we run out of memory (add returns false); return add(rgn->base(), rgn->end(), rgn->mem_tag()); } diff --git a/src/hotspot/share/nmt/memReporter.cpp b/src/hotspot/share/nmt/memReporter.cpp index 27a94ec7bc0..772bda2885b 100644 --- a/src/hotspot/share/nmt/memReporter.cpp +++ b/src/hotspot/share/nmt/memReporter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -395,14 +395,14 @@ int MemDetailReporter::report_virtual_memory_allocation_sites() { void MemDetailReporter::report_virtual_memory_map() { // Virtual memory map always in base address order output()->print_cr("Virtual memory map:"); - _baseline.virtual_memory_allocations()->visit_reserved_regions([&](VirtualMemoryRegion& rgn) { + _baseline.virtual_memory_allocations()->visit_reserved_regions([&](ReservedMemoryRegion& rgn) { report_virtual_memory_region(&rgn); return true; }); } -void MemDetailReporter::report_virtual_memory_region(const VirtualMemoryRegion* rgn) { - assert(rgn != nullptr, "null pointer"); +void MemDetailReporter::report_virtual_memory_region(const ReservedMemoryRegion* reserved_rgn) { + assert(reserved_rgn != nullptr, "null pointer"); // We don't bother about reporting peaks here. // That is because peaks - in the context of virtual memory, peak of committed areas - make little sense @@ -414,16 +414,16 @@ void MemDetailReporter::report_virtual_memory_region(const VirtualMemoryRegion* // usage *by callsite*. // Don't report if size is too small. - if (amount_in_current_scale(rgn->size()) == 0) return; + if (amount_in_current_scale(reserved_rgn->size()) == 0) return; outputStream* out = output(); const char* scale = current_scale(); - const NativeCallStack* stack = rgn->reserved_call_stack(); - bool all_committed = rgn->size() == _baseline.virtual_memory_allocations()->committed_size(*rgn); + const NativeCallStack* stack = reserved_rgn->call_stack(); + bool all_committed = reserved_rgn->size() == _baseline.virtual_memory_allocations()->committed_size(*reserved_rgn); const char* region_type = (all_committed ? "reserved and committed" : "reserved"); out->cr(); - print_virtual_memory_region(region_type, rgn->base(), rgn->size()); - out->print(" for %s", NMTUtil::tag_to_name(rgn->mem_tag())); + print_virtual_memory_region(region_type, reserved_rgn->base(), reserved_rgn->size()); + out->print(" for %s", NMTUtil::tag_to_name(reserved_rgn->mem_tag())); if (stack->is_empty()) { out->cr(); } else { @@ -433,9 +433,9 @@ void MemDetailReporter::report_virtual_memory_region(const VirtualMemoryRegion* if (all_committed) { bool reserved_and_committed = false; - _baseline.virtual_memory_allocations()->visit_committed_regions(*rgn, - [&](VirtualMemoryRegion& committed_rgn) { - if (committed_rgn.equals(*rgn)) { + _baseline.virtual_memory_allocations()->visit_committed_regions(*reserved_rgn, + [&](CommittedMemoryRegion& committed_rgn) { + if (committed_rgn.equals(*reserved_rgn)) { // One region spanning the entire reserved region, with the same stack trace. // Don't print this regions because the "reserved and committed" line above // already indicates that the region is committed. @@ -450,13 +450,13 @@ void MemDetailReporter::report_virtual_memory_region(const VirtualMemoryRegion* } } - auto print_committed_rgn = [&](const VirtualMemoryRegion& rgn) { + auto print_committed_rgn = [&](const CommittedMemoryRegion& crgn) { // Don't report if size is too small - if (amount_in_current_scale(rgn.size()) == 0) return; - stack = rgn.committed_call_stack(); + if (amount_in_current_scale(crgn.size()) == 0) return; + stack = crgn.call_stack(); out->cr(); INDENT_BY(8, - print_virtual_memory_region("committed", rgn.base(), rgn.size()); + print_virtual_memory_region("committed", crgn.base(), crgn.size()); if (stack->is_empty()) { out->cr(); } else { @@ -466,9 +466,9 @@ void MemDetailReporter::report_virtual_memory_region(const VirtualMemoryRegion* ) }; - _baseline.virtual_memory_allocations()->visit_committed_regions(*rgn, - [&](VirtualMemoryRegion& committed_rgn) { - print_committed_rgn(committed_rgn); + _baseline.virtual_memory_allocations()->visit_committed_regions(*reserved_rgn, + [&](CommittedMemoryRegion& crgn) { + print_committed_rgn(crgn); return true; }); } diff --git a/src/hotspot/share/nmt/memReporter.hpp b/src/hotspot/share/nmt/memReporter.hpp index 0d7e7344608..bab8de138d0 100644 --- a/src/hotspot/share/nmt/memReporter.hpp +++ b/src/hotspot/share/nmt/memReporter.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -178,7 +178,7 @@ class MemDetailReporter : public MemSummaryReporter { int report_virtual_memory_allocation_sites(); // Report a virtual memory region - void report_virtual_memory_region(const VirtualMemoryRegion* rgn); + void report_virtual_memory_region(const ReservedMemoryRegion* rgn); }; /* diff --git a/src/hotspot/share/nmt/regionsTree.cpp b/src/hotspot/share/nmt/regionsTree.cpp index 1a87d051928..83306cbc14f 100644 --- a/src/hotspot/share/nmt/regionsTree.cpp +++ b/src/hotspot/share/nmt/regionsTree.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,9 +58,9 @@ void RegionsTree::print_on(outputStream* st) { } #endif -size_t RegionsTree::committed_size(const VirtualMemoryRegion& rgn) { +size_t RegionsTree::committed_size(const ReservedMemoryRegion& rgn) { size_t result = 0; - visit_committed_regions(rgn, [&](VirtualMemoryRegion& crgn) { + visit_committed_regions(rgn, [&](CommittedMemoryRegion& crgn) { result += crgn.size(); return true; }); diff --git a/src/hotspot/share/nmt/regionsTree.hpp b/src/hotspot/share/nmt/regionsTree.hpp index 4b27423db8c..2e1b37d0c1a 100644 --- a/src/hotspot/share/nmt/regionsTree.hpp +++ b/src/hotspot/share/nmt/regionsTree.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * 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 @@ #include "nmt/vmatree.hpp" -class VirtualMemoryRegion; +class ReservedMemoryRegion; +class CommittedMemoryRegion; // RegionsTree extends VMATree to add some more specific API and also defines a helper // for processing the tree nodes in a shorter and more meaningful way. class RegionsTree : public VMATree { @@ -45,7 +46,7 @@ class RegionsTree : public VMATree { _with_storage(other._with_storage) {} RegionsTree& operator=(const RegionsTree& other) = delete; - VirtualMemoryRegion find_reserved_region(address addr); + ReservedMemoryRegion find_reserved_region(address addr); void commit_region(address addr, size_t size, const NativeCallStack& stack, SummaryDiff& diff); void uncommit_region(address addr, size_t size, SummaryDiff& diff); @@ -70,7 +71,6 @@ class RegionsTree : public VMATree { return position() - other.position(); } inline NativeCallStackStorage::StackIndex out_stack_index() const { return _node->val().out.reserved_stack(); } - inline NativeCallStackStorage::StackIndex out_committed_stack_index() const { return _node->val().out.committed_stack(); } inline MemTag in_tag() const { return _node->val().in.mem_tag(); } inline MemTag out_tag() const { return _node->val().out.mem_tag(); } inline void set_in_tag(MemTag tag) { _node->val().in.set_tag(tag); } @@ -81,7 +81,7 @@ class RegionsTree : public VMATree { DEBUG_ONLY(void print_on(outputStream* st);) template - void visit_committed_regions(const VirtualMemoryRegion& rgn, F func); + void visit_committed_regions(const ReservedMemoryRegion& rgn, F func); template void visit_reserved_regions(F func); @@ -90,7 +90,7 @@ class RegionsTree : public VMATree { return RegionData(_ncs_storage.push(ncs), tag); } - inline const NativeCallStack reserved_stack(NodeHelper& node) { + inline const NativeCallStack stack(NodeHelper& node) { if (!_with_storage) { return NativeCallStack::empty_stack(); } @@ -98,15 +98,7 @@ class RegionsTree : public VMATree { return _ncs_storage.get(si); } - inline const NativeCallStack committed_stack(NodeHelper& node) { - if (!_with_storage) { - return NativeCallStack::empty_stack(); - } - NativeCallStackStorage::StackIndex si = node.out_committed_stack_index(); - return _ncs_storage.get(si); - } - - size_t committed_size(const VirtualMemoryRegion& rgn); + size_t committed_size(const ReservedMemoryRegion& rgn); }; #endif // NMT_REGIONSTREE_HPP diff --git a/src/hotspot/share/nmt/regionsTree.inline.hpp b/src/hotspot/share/nmt/regionsTree.inline.hpp index 793a5c5f1fa..98cfa0e7f2c 100644 --- a/src/hotspot/share/nmt/regionsTree.inline.hpp +++ b/src/hotspot/share/nmt/regionsTree.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * 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 "nmt/virtualMemoryTracker.hpp" template -void RegionsTree::visit_committed_regions(const VirtualMemoryRegion& rgn, F func) { +void RegionsTree::visit_committed_regions(const ReservedMemoryRegion& rgn, F func) { position start = (position)rgn.base(); size_t end = reinterpret_cast(rgn.end()) + 1; size_t comm_size = 0; @@ -38,12 +38,8 @@ void RegionsTree::visit_committed_regions(const VirtualMemoryRegion& rgn, F func visit_range_in_order(start, end, [&](Node* node) { NodeHelper curr(node); if (prev.is_valid() && prev.is_committed_begin()) { - VirtualMemoryRegion rgn((address)prev.position(), - curr.distance_from(prev), - reserved_stack(prev), - committed_stack(prev), - prev.out_tag()); - if (!func(rgn)) { + CommittedMemoryRegion cmr((address)prev.position(), curr.distance_from(prev), stack(prev)); + if (!func(cmr)) { return false; } } @@ -67,13 +63,13 @@ void RegionsTree::visit_reserved_regions(F func) { } prev = curr; if (curr.is_released_begin() || begin_node.out_tag() != curr.out_tag()) { - auto st = reserved_stack(begin_node); + auto st = stack(begin_node); if (rgn_size == 0) { prev.clear_node(); return true; } - VirtualMemoryRegion rgn((address)begin_node.position(), rgn_size, st, begin_node.out_tag()); - if (!func(rgn)) { + ReservedMemoryRegion rmr((address)begin_node.position(), rgn_size, st, begin_node.out_tag()); + if (!func(rmr)) { return false; } rgn_size = 0; diff --git a/src/hotspot/share/nmt/virtualMemoryTracker.cpp b/src/hotspot/share/nmt/virtualMemoryTracker.cpp index 4e4138f81a2..d676d93e040 100644 --- a/src/hotspot/share/nmt/virtualMemoryTracker.cpp +++ b/src/hotspot/share/nmt/virtualMemoryTracker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -193,14 +193,14 @@ bool VirtualMemoryTracker::Instance::print_containing_region(const void* p, outp } bool VirtualMemoryTracker::print_containing_region(const void* p, outputStream* st) { - VirtualMemoryRegion rgn = tree()->find_reserved_region((address)p); - if (!rgn.is_valid() || !rgn.contain_address((address)p)) { + ReservedMemoryRegion rmr = tree()->find_reserved_region((address)p); + if (!rmr.contain_address((address)p)) { return false; } st->print_cr(PTR_FORMAT " in mmap'd memory region [" PTR_FORMAT " - " PTR_FORMAT "], tag %s", - p2i(p), p2i(rgn.base()), p2i(rgn.end()), NMTUtil::tag_to_enum_name(rgn.mem_tag())); + p2i(p), p2i(rmr.base()), p2i(rmr.end()), NMTUtil::tag_to_enum_name(rmr.mem_tag())); if (MemTracker::tracking_level() == NMT_detail) { - rgn.reserved_call_stack()->print_on(st); + rmr.call_stack()->print_on(st); } st->cr(); return true; @@ -213,7 +213,7 @@ bool VirtualMemoryTracker::Instance::walk_virtual_memory(VirtualMemoryWalker* wa bool VirtualMemoryTracker::walk_virtual_memory(VirtualMemoryWalker* walker) { bool ret = true; - tree()->visit_reserved_regions([&](VirtualMemoryRegion& rgn) { + tree()->visit_reserved_regions([&](ReservedMemoryRegion& rgn) { if (!walker->do_allocation_site(&rgn)) { ret = false; return false; @@ -223,29 +223,29 @@ bool VirtualMemoryTracker::walk_virtual_memory(VirtualMemoryWalker* walker) { return ret; } -size_t VirtualMemoryTracker::committed_size(const VirtualMemoryRegion* rgn) { +size_t VirtualMemoryTracker::committed_size(const ReservedMemoryRegion* rmr) { size_t result = 0; - tree()->visit_committed_regions(*rgn, [&](VirtualMemoryRegion& crgn) { + tree()->visit_committed_regions(*rmr, [&](CommittedMemoryRegion& crgn) { result += crgn.size(); return true; }); return result; } -size_t VirtualMemoryTracker::Instance::committed_size(const VirtualMemoryRegion* rgn) { +size_t VirtualMemoryTracker::Instance::committed_size(const ReservedMemoryRegion* rmr) { assert(_tracker != nullptr, "Sanity check"); - return _tracker->committed_size(rgn); + return _tracker->committed_size(rmr); } -address VirtualMemoryTracker::Instance::thread_stack_uncommitted_bottom(const VirtualMemoryRegion* rgn) { +address VirtualMemoryTracker::Instance::thread_stack_uncommitted_bottom(const ReservedMemoryRegion* rmr) { assert(_tracker != nullptr, "Sanity check"); - return _tracker->thread_stack_uncommitted_bottom(rgn); + return _tracker->thread_stack_uncommitted_bottom(rmr); } -address VirtualMemoryTracker::thread_stack_uncommitted_bottom(const VirtualMemoryRegion* rgn) { - address bottom = rgn->base(); - address top = rgn->end(); - tree()->visit_committed_regions(*rgn, [&](VirtualMemoryRegion& crgn) { +address VirtualMemoryTracker::thread_stack_uncommitted_bottom(const ReservedMemoryRegion* rmr) { + address bottom = rmr->base(); + address top = rmr->end(); + tree()->visit_committed_regions(*rmr, [&](CommittedMemoryRegion& crgn) { address committed_top = crgn.base() + crgn.size(); if (committed_top < top) { // committed stack guard pages, skip them @@ -299,7 +299,7 @@ class SnapshotThreadStackWalker : public VirtualMemoryWalker { public: SnapshotThreadStackWalker() {} - bool do_allocation_site(const VirtualMemoryRegion* rgn) { + bool do_allocation_site(const ReservedMemoryRegion* rgn) { if (MemTracker::NmtVirtualMemoryLocker::is_safe_to_use()) { assert_lock_strong(NmtVirtualMemory_lock); } @@ -340,19 +340,19 @@ void VirtualMemoryTracker::Instance::snapshot_thread_stacks() { walk_virtual_memory(&walker); } -VirtualMemoryRegion RegionsTree::find_reserved_region(address addr) { - VirtualMemoryRegion rgn; - auto contain_region = [&](VirtualMemoryRegion& region_in_tree) { +ReservedMemoryRegion RegionsTree::find_reserved_region(address addr) { + ReservedMemoryRegion rmr; + auto contain_region = [&](ReservedMemoryRegion& region_in_tree) { if (region_in_tree.contain_address(addr)) { - rgn = region_in_tree; + rmr = region_in_tree; return false; } return true; }; visit_reserved_regions(contain_region); - return rgn; + return rmr; } -bool VirtualMemoryRegion::equals_including_stacks(const VirtualMemoryRegion& rgn) const { - return size() == rgn.size() && committed_call_stack()->equals(*(rgn.reserved_call_stack())); +bool CommittedMemoryRegion::equals(const ReservedMemoryRegion& rmr) const { + return size() == rmr.size() && call_stack()->equals(*(rmr.call_stack())); } diff --git a/src/hotspot/share/nmt/virtualMemoryTracker.hpp b/src/hotspot/share/nmt/virtualMemoryTracker.hpp index 975169f6247..c51b53194e6 100644 --- a/src/hotspot/share/nmt/virtualMemoryTracker.hpp +++ b/src/hotspot/share/nmt/virtualMemoryTracker.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -194,38 +194,15 @@ class VirtualMemorySummary : AllStatic { */ class VirtualMemoryRegion { private: - address _base_address; - size_t _size; - MemTag _mem_tag; - NativeCallStack _reserved_stack; - NativeCallStack _committed_stack; + address _base_address; + size_t _size; public: - VirtualMemoryRegion() : - _base_address(0), _size(0), _mem_tag(mtNone), - _reserved_stack(NativeCallStack::empty_stack()) , - _committed_stack(NativeCallStack::empty_stack()) {} - VirtualMemoryRegion(address addr, size_t size) : - _base_address(addr), _size(size), _mem_tag(mtNone), - _reserved_stack(NativeCallStack::empty_stack()) , - _committed_stack(NativeCallStack::empty_stack()) { + _base_address(addr), _size(size) { assert(addr != nullptr, "Invalid address"); assert(size > 0, "Invalid size"); - } - - VirtualMemoryRegion(address addr, size_t size, const NativeCallStack& reserved_stack, const NativeCallStack& committed_stack, MemTag mem_tag = mtNone) : - _base_address(addr), _size(size), _mem_tag(mem_tag), - _reserved_stack(reserved_stack), - _committed_stack(committed_stack) { - assert(addr != nullptr, "Invalid address"); - assert(size > 0, "Invalid size"); - } - - VirtualMemoryRegion(address addr, size_t size, const NativeCallStack& stack, MemTag mem_tag = mtNone) - : _base_address(addr), _size(size), _mem_tag(mem_tag), - _reserved_stack(stack), - _committed_stack(NativeCallStack::empty_stack()) {} + } inline address base() const { return _base_address; } inline address end() const { return base() + size(); } @@ -234,18 +211,48 @@ class VirtualMemoryRegion { inline bool is_empty() const { return size() == 0; } inline bool contain_address(address addr) const { - assert(is_valid(), "sanity"); return (addr >= base() && addr < end()); } - private: + + inline bool contain_region(address addr, size_t size) const { + return contain_address(addr) && contain_address(addr + size - 1); + } + + inline bool same_region(address addr, size_t sz) const { + return (addr == base() && sz == size()); + } + + inline bool overlap_region(address addr, size_t sz) const { assert(sz > 0, "Invalid size"); assert(size() > 0, "Invalid size"); - assert(is_valid(), "sanity"); return MAX2(addr, base()) < MIN2(addr + sz, end()); } + inline bool adjacent_to(address addr, size_t sz) const { + return (addr == end() || (addr + sz) == base()); + } + + void exclude_region(address addr, size_t sz) { + assert(contain_region(addr, sz), "Not containment"); + assert(addr == base() || addr + sz == end(), "Can not exclude from middle"); + size_t new_size = size() - sz; + + if (addr == base()) { + set_base(addr + sz); + } + set_size(new_size); + } + + void expand_region(address addr, size_t sz) { + assert(adjacent_to(addr, sz), "Not adjacent regions"); + if (base() == addr + sz) { + set_base(addr); + } + set_size(size() + sz); + } + // Returns 0 if regions overlap; 1 if this region follows rgn; // -1 if this region precedes rgn. inline int compare(const VirtualMemoryRegion& rgn) const { @@ -259,27 +266,86 @@ class VirtualMemoryRegion { } } - public: // Returns true if regions overlap, false otherwise. inline bool equals(const VirtualMemoryRegion& rgn) const { return compare(rgn) == 0; } - bool equals_including_stacks(const VirtualMemoryRegion& other) const; - inline const NativeCallStack* committed_call_stack() const { return &_committed_stack; } + protected: + void set_base(address base) { + assert(base != nullptr, "Sanity check"); + _base_address = base; + } - bool is_valid() const { return base() != nullptr && size() != 0;} + void set_size(size_t size) { + assert(size > 0, "Sanity check"); + _size = size; + } +}; - inline const NativeCallStack* reserved_call_stack() const { return &_reserved_stack; } - inline MemTag mem_tag() const { return _mem_tag; } +class CommittedMemoryRegion : public VirtualMemoryRegion { + private: + NativeCallStack _stack; + + public: + CommittedMemoryRegion() + : VirtualMemoryRegion((address)1, 1), _stack(NativeCallStack::empty_stack()) { } + + CommittedMemoryRegion(address addr, size_t size, const NativeCallStack& stack) + : VirtualMemoryRegion(addr, size), _stack(stack) { } + + inline void set_call_stack(const NativeCallStack& stack) { _stack = stack; } + inline const NativeCallStack* call_stack() const { return &_stack; } + bool equals(const ReservedMemoryRegion& other) const; +}; + +class ReservedMemoryRegion : public VirtualMemoryRegion { + private: + NativeCallStack _stack; + MemTag _mem_tag; + + public: + bool is_valid() { return base() != (address)1 && size() != 1;} + + ReservedMemoryRegion() + : VirtualMemoryRegion((address)1, 1), _stack(NativeCallStack::empty_stack()), _mem_tag(mtNone) { } + + ReservedMemoryRegion(address base, size_t size, const NativeCallStack& stack, + MemTag mem_tag = mtNone) + : VirtualMemoryRegion(base, size), _stack(stack), _mem_tag(mem_tag) { } + + + ReservedMemoryRegion(address base, size_t size) + : VirtualMemoryRegion(base, size), _stack(NativeCallStack::empty_stack()), _mem_tag(mtNone) { } + + // Copy constructor + ReservedMemoryRegion(const ReservedMemoryRegion& rr) + : VirtualMemoryRegion(rr.base(), rr.size()) { + *this = rr; + } + + inline void set_call_stack(const NativeCallStack& stack) { _stack = stack; } + inline const NativeCallStack* call_stack() const { return &_stack; } + + inline MemTag mem_tag() const { return _mem_tag; } + + ReservedMemoryRegion& operator= (const ReservedMemoryRegion& other) { + set_base(other.base()); + set_size(other.size()); + + _stack = *other.call_stack(); + _mem_tag = other.mem_tag(); + + return *this; + } const char* tag_name() const { return NMTUtil::tag_to_name(_mem_tag); } }; class VirtualMemoryWalker : public StackObj { public: - virtual bool do_allocation_site(const VirtualMemoryRegion* rgn) { return false; } + virtual bool do_allocation_site(const ReservedMemoryRegion* rgn) { return false; } }; @@ -310,8 +376,8 @@ class VirtualMemoryTracker { // Snapshot current thread stacks void snapshot_thread_stacks(); void apply_summary_diff(VMATree::SummaryDiff diff); - size_t committed_size(const VirtualMemoryRegion* rgn); - address thread_stack_uncommitted_bottom(const VirtualMemoryRegion* rgn); + size_t committed_size(const ReservedMemoryRegion* rmr); + address thread_stack_uncommitted_bottom(const ReservedMemoryRegion* rmr); RegionsTree* tree() { return &_tree; } @@ -335,9 +401,9 @@ class VirtualMemoryTracker { static bool print_containing_region(const void* p, outputStream* st); static void snapshot_thread_stacks(); static void apply_summary_diff(VMATree::SummaryDiff diff); - static size_t committed_size(const VirtualMemoryRegion* rgn); + static size_t committed_size(const ReservedMemoryRegion* rmr); // uncommitted thread stack bottom, above guard pages if there is any. - static address thread_stack_uncommitted_bottom(const VirtualMemoryRegion* rgn); + static address thread_stack_uncommitted_bottom(const ReservedMemoryRegion* rmr); static RegionsTree* tree() { return _tracker->tree(); } }; diff --git a/test/hotspot/gtest/nmt/test_regions_tree.cpp b/test/hotspot/gtest/nmt/test_regions_tree.cpp index a17a3fbb945..7465c84aa72 100644 --- a/test/hotspot/gtest/nmt/test_regions_tree.cpp +++ b/test/hotspot/gtest/nmt/test_regions_tree.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -104,15 +104,15 @@ TEST_VM_F(NMTRegionsTreeTest, FindReservedRegion) { rt.reserve_mapping(1200, 50, rd, not_used); rt.reserve_mapping(1300, 50, rd, not_used); rt.reserve_mapping(1400, 50, rd, not_used); - VirtualMemoryRegion rgn; - rgn = rt.find_reserved_region((address)1205); - EXPECT_EQ(rgn.base(), (address)1200); - rgn = rt.find_reserved_region((address)1305); - EXPECT_EQ(rgn.base(), (address)1300); - rgn = rt.find_reserved_region((address)1405); - EXPECT_EQ(rgn.base(), (address)1400); - rgn = rt.find_reserved_region((address)1005); - EXPECT_EQ(rgn.base(), (address)1000); + ReservedMemoryRegion rmr; + rmr = rt.find_reserved_region((address)1205); + EXPECT_EQ(rmr.base(), (address)1200); + rmr = rt.find_reserved_region((address)1305); + EXPECT_EQ(rmr.base(), (address)1300); + rmr = rt.find_reserved_region((address)1405); + EXPECT_EQ(rmr.base(), (address)1400); + rmr = rt.find_reserved_region((address)1005); + EXPECT_EQ(rmr.base(), (address)1000); } TEST_VM_F(NMTRegionsTreeTest, VisitReservedRegions) { @@ -124,7 +124,7 @@ TEST_VM_F(NMTRegionsTreeTest, VisitReservedRegions) { rt.reserve_mapping(1300, 50, rd, not_used); rt.reserve_mapping(1400, 50, rd, not_used); - rt.visit_reserved_regions([&](const VirtualMemoryRegion& rgn) { + rt.visit_reserved_regions([&](const ReservedMemoryRegion& rgn) { EXPECT_EQ(((size_t)rgn.base()) % 100, 0UL); EXPECT_EQ(rgn.size(), 50UL); return true; @@ -144,9 +144,9 @@ TEST_VM_F(NMTRegionsTreeTest, VisitCommittedRegions) { rt.commit_region((address)1020, 5UL, ncs, not_used); rt.commit_region((address)1030, 5UL, ncs, not_used); rt.commit_region((address)1040, 5UL, ncs, not_used); - VirtualMemoryRegion rgn((address)1000, 50); + ReservedMemoryRegion rmr((address)1000, 50); size_t count = 0; - rt.visit_committed_regions(rgn, [&](VirtualMemoryRegion& crgn) { + rt.visit_committed_regions(rmr, [&](CommittedMemoryRegion& crgn) { count++; EXPECT_EQ((((size_t)crgn.base()) % 100) / 10, count); EXPECT_EQ(crgn.size(), 5UL); diff --git a/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp b/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp index 8cf62fb9ea5..5b78a66a3ae 100644 --- a/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp +++ b/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * 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,14 +45,15 @@ public: VirtualMemoryTracker::Instance::snapshot_thread_stacks(); } - VirtualMemoryRegion rgn_found; + ReservedMemoryRegion rmr_found; { MemTracker::NmtVirtualMemoryLocker vml; - rgn_found = VirtualMemoryTracker::Instance::tree()->find_reserved_region(stack_end); + rmr_found = VirtualMemoryTracker::Instance::tree()->find_reserved_region(stack_end); } - ASSERT_TRUE(rgn_found.is_valid()); - ASSERT_EQ(rgn_found.base(), stack_end); + ASSERT_TRUE(rmr_found.is_valid()); + ASSERT_EQ(rmr_found.base(), stack_end); + int i = 0; address i_addr = (address)&i; @@ -63,12 +64,12 @@ public: bool found_stack_top = false; { MemTracker::NmtVirtualMemoryLocker vml; - VirtualMemoryTracker::Instance::tree()->visit_committed_regions(rgn_found, [&](const VirtualMemoryRegion& rgn) { - if (rgn.base() + rgn.size() == stack_top) { - EXPECT_TRUE(rgn.size() <= stack_size); + VirtualMemoryTracker::Instance::tree()->visit_committed_regions(rmr_found, [&](const CommittedMemoryRegion& cmr) { + if (cmr.base() + cmr.size() == stack_top) { + EXPECT_TRUE(cmr.size() <= stack_size); found_stack_top = true; } - if (i_addr < stack_top && i_addr >= rgn.base()) { + if (i_addr < stack_top && i_addr >= cmr.base()) { found_i_addr = true; } i++; @@ -114,25 +115,25 @@ public: } // trigger the test - VirtualMemoryRegion rgn_found; + ReservedMemoryRegion rmr_found; { MemTracker::NmtVirtualMemoryLocker nvml; VirtualMemoryTracker::Instance::snapshot_thread_stacks(); - rgn_found = VirtualMemoryTracker::Instance::tree()->find_reserved_region((address)base); + rmr_found = VirtualMemoryTracker::Instance::tree()->find_reserved_region((address)base); } - ASSERT_TRUE(rgn_found.is_valid()); - ASSERT_EQ(rgn_found.base(), (address)base); + ASSERT_TRUE(rmr_found.is_valid()); + ASSERT_EQ(rmr_found.base(), (address)base); bool precise_tracking_supported = false; { MemTracker::NmtVirtualMemoryLocker nvml; - VirtualMemoryTracker::Instance::tree()->visit_committed_regions(rgn_found, [&](const VirtualMemoryRegion& rgn){ - if (rgn.size() == size) { + VirtualMemoryTracker::Instance::tree()->visit_committed_regions(rmr_found, [&](const CommittedMemoryRegion& cmr){ + if (cmr.size() == size) { return false; } else { precise_tracking_supported = true; - check_covered_pages(rgn.base(), rgn.size(), (address)base, touch_pages, page_num); + check_covered_pages(cmr.base(), cmr.size(), (address)base, touch_pages, page_num); } return true; }); @@ -150,9 +151,9 @@ public: { MemTracker::NmtVirtualMemoryLocker nvml; VirtualMemoryTracker::Instance::remove_released_region((address)base, size); - rgn_found = VirtualMemoryTracker::Instance::tree()->find_reserved_region((address)base); + rmr_found = VirtualMemoryTracker::Instance::tree()->find_reserved_region((address)base); } - ASSERT_TRUE(!rgn_found.is_valid()); + ASSERT_TRUE(!rmr_found.is_valid()); } static void test_committed_region() { diff --git a/test/hotspot/gtest/runtime/test_virtualMemoryTracker.cpp b/test/hotspot/gtest/runtime/test_virtualMemoryTracker.cpp index a7e4b273788..4242302997a 100644 --- a/test/hotspot/gtest/runtime/test_virtualMemoryTracker.cpp +++ b/test/hotspot/gtest/runtime/test_virtualMemoryTracker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * 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,41 +50,41 @@ namespace { }; } -#define check(vmt, rgn, regions) check_inner((vmt), (rgn), (regions), ARRAY_SIZE(regions), __FILE__, __LINE__) +#define check(vmt, rmr, regions) check_inner((vmt), (rmr), (regions), ARRAY_SIZE(regions), __FILE__, __LINE__) -#define check_empty(vmt, rgn) \ +#define check_empty(vmt, rmr) \ do { \ - check_inner((vmt), (rgn), nullptr, 0, __FILE__, __LINE__); \ + check_inner((vmt), (rmr), nullptr, 0, __FILE__, __LINE__); \ } while (false) -static void diagnostic_print(VirtualMemoryTracker& vmt, const VirtualMemoryRegion& rgn) { - LOG("In reserved region " PTR_FORMAT ", size %X:", p2i(rgn.base()), rgn.size()); - vmt.tree()->visit_committed_regions(rgn, [&](VirtualMemoryRegion& crgn) { - LOG(" committed region: " PTR_FORMAT ", size %X", p2i(crgn.base()), crgn.size()); +static void diagnostic_print(VirtualMemoryTracker& vmt, const ReservedMemoryRegion& rmr) { + LOG("In reserved region " PTR_FORMAT ", size %X:", p2i(rmr.base()), rmr.size()); + vmt.tree()->visit_committed_regions(rmr, [&](CommittedMemoryRegion& region) { + LOG(" committed region: " PTR_FORMAT ", size %X", p2i(region.base()), region.size()); return true; }); } -static void check_inner(VirtualMemoryTracker& vmt, const VirtualMemoryRegion& rgn, R* regions, size_t regions_size, const char* file, int line) { +static void check_inner(VirtualMemoryTracker& vmt, const ReservedMemoryRegion& rmr, R* regions, size_t regions_size, const char* file, int line) { size_t i = 0; size_t size = 0; // Helpful log - diagnostic_print(vmt, rgn); + diagnostic_print(vmt, rmr); #define WHERE " from " << file << ":" << line - vmt.tree()->visit_committed_regions(rgn, [&](VirtualMemoryRegion& crgn) { + vmt.tree()->visit_committed_regions(rmr, [&](CommittedMemoryRegion& region) { EXPECT_LT(i, regions_size) << WHERE; - EXPECT_EQ(crgn.base(), regions[i]._addr) << WHERE; - EXPECT_EQ(crgn.size(), regions[i]._size) << WHERE; - size += crgn.size(); + EXPECT_EQ(region.base(), regions[i]._addr) << WHERE; + EXPECT_EQ(region.size(), regions[i]._size) << WHERE; + size += region.size(); i++; return true; }); EXPECT_EQ(i, regions_size) << WHERE; - EXPECT_EQ(size, vmt.committed_size(&rgn)) << WHERE; + EXPECT_EQ(size, vmt.committed_size(&rmr)) << WHERE; } class VirtualMemoryTrackerTest { @@ -104,11 +104,11 @@ public: NativeCallStack stack(&frame1, 1); NativeCallStack stack2(&frame2, 1); - // Fetch the added region for the space - VirtualMemoryRegion rgn = rtree->find_reserved_region(addr); + // Fetch the added RMR for the space + ReservedMemoryRegion rmr = rtree->find_reserved_region(addr); - ASSERT_EQ(rgn.size(), size); - ASSERT_EQ(rgn.base(), addr); + ASSERT_EQ(rmr.size(), size); + ASSERT_EQ(rmr.base(), addr); // Commit Size Granularity const size_t cs = 0x1000; @@ -118,24 +118,24 @@ public: { // Commit one region rtree->commit_region(addr + cs, cs, stack, diff); R r[] = { {addr + cs, cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } { // Commit adjacent - lower address rtree->commit_region(addr, cs, stack, diff); R r[] = { {addr, 2 * cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } { // Commit adjacent - higher address rtree->commit_region(addr + 2 * cs, cs, stack, diff); R r[] = { {addr, 3 * cs} }; - check(vmt, rgn, r); + check(vmt,rmr, r); } // Cleanup rtree->uncommit_region(addr, 3 * cs, diff); - ASSERT_EQ(vmt.committed_size(&rgn), 0u); + ASSERT_EQ(vmt.committed_size(&rmr), 0u); // Commit adjacent regions with different stacks @@ -143,14 +143,14 @@ public: { // Commit one region rtree->commit_region(addr + cs, cs, stack, diff); R r[] = { {addr + cs, cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } { // Commit adjacent - lower address rtree->commit_region(addr, cs, stack2, diff); R r[] = { {addr, cs}, {addr + cs, cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } { // Commit adjacent - higher address @@ -158,12 +158,12 @@ public: R r[] = { {addr, cs}, {addr + cs, cs}, {addr + 2 * cs, cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } // Cleanup rtree->uncommit_region(addr, 3 * cs, diff); - ASSERT_EQ(vmt.committed_size(&rgn), 0u); + ASSERT_EQ(vmt.committed_size(&rmr), 0u); } static void test_add_committed_region_adjacent_overlapping() { @@ -180,11 +180,11 @@ public: NativeCallStack stack(&frame1, 1); NativeCallStack stack2(&frame2, 1); - // Fetch the added region for the space - VirtualMemoryRegion rgn = rtree->find_reserved_region(addr); + // Fetch the added RMR for the space + ReservedMemoryRegion rmr = rtree->find_reserved_region(addr); - ASSERT_EQ(rgn.size(), size); - ASSERT_EQ(rgn.base(), addr); + ASSERT_EQ(rmr.size(), size); + ASSERT_EQ(rmr.base(), addr); // Commit Size Granularity const size_t cs = 0x1000; @@ -196,28 +196,28 @@ public: rtree->commit_region(addr + 3 * cs, 2 * cs, stack, diff); R r[] = { {addr, 2 * cs}, {addr + 3 * cs, 2 * cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } { // Commit adjacent and overlapping rtree->commit_region(addr + 2 * cs, 2 * cs, stack, diff); R r[] = { {addr, 5 * cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } // revert to two non-adjacent regions rtree->uncommit_region(addr + 2 * cs, cs, diff); - ASSERT_EQ(vmt.committed_size(&rgn), 4 * cs); + ASSERT_EQ(vmt.committed_size(&rmr), 4 * cs); { // Commit overlapping and adjacent rtree->commit_region(addr + cs, 2 * cs, stack, diff); R r[] = { {addr, 5 * cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } // Cleanup rtree->uncommit_region(addr, 5 * cs, diff); - ASSERT_EQ(vmt.committed_size(&rgn), 0u); + ASSERT_EQ(vmt.committed_size(&rmr), 0u); // Commit adjacent and overlapping regions with different stacks @@ -227,7 +227,7 @@ public: rtree->commit_region(addr + 3 * cs, 2 * cs, stack, diff); R r[] = { {addr, 2 * cs}, {addr + 3 * cs, 2 * cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } { // Commit adjacent and overlapping @@ -235,20 +235,20 @@ public: R r[] = { {addr, 2 * cs}, {addr + 2 * cs, 2 * cs}, {addr + 4 * cs, cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } // revert to two non-adjacent regions rtree->commit_region(addr, 5 * cs, stack, diff); rtree->uncommit_region(addr + 2 * cs, cs, diff); - ASSERT_EQ(vmt.committed_size(&rgn), 4 * cs); + ASSERT_EQ(vmt.committed_size(&rmr), 4 * cs); { // Commit overlapping and adjacent rtree->commit_region(addr + cs, 2 * cs, stack2, diff); R r[] = { {addr, cs}, {addr + cs, 2 * cs}, {addr + 3 * cs, 2 * cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } rtree->tree().remove_all(); @@ -269,12 +269,12 @@ public: NativeCallStack stack(&frame1, 1); NativeCallStack stack2(&frame2, 1); - // Fetch the added region for the space - VirtualMemoryRegion rgn = rtree->find_reserved_region(addr); + // Fetch the added RMR for the space + ReservedMemoryRegion rmr = rtree->find_reserved_region(addr); - ASSERT_EQ(rgn.size(), size); - ASSERT_EQ(rgn.base(), addr); + ASSERT_EQ(rmr.size(), size); + ASSERT_EQ(rmr.base(), addr); // Commit Size Granularity const size_t cs = 0x1000; @@ -284,54 +284,54 @@ public: { // Commit one region rtree->commit_region(addr, cs, stack, diff); R r[] = { {addr, cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } { // Commit the same region rtree->commit_region(addr, cs, stack, diff); R r[] = { {addr, cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } { // Commit a succeeding region rtree->commit_region(addr + cs, cs, stack, diff); R r[] = { {addr, 2 * cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } { // Commit over two regions rtree->commit_region(addr, 2 * cs, stack, diff); R r[] = { {addr, 2 * cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } {// Commit first part of a region rtree->commit_region(addr, cs, stack, diff); R r[] = { {addr, 2 * cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } { // Commit second part of a region rtree->commit_region(addr + cs, cs, stack, diff); R r[] = { {addr, 2 * cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } { // Commit a third part rtree->commit_region(addr + 2 * cs, cs, stack, diff); R r[] = { {addr, 3 * cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } { // Commit in the middle of a region rtree->commit_region(addr + 1 * cs, cs, stack, diff); R r[] = { {addr, 3 * cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } // Cleanup rtree->uncommit_region(addr, 3 * cs, diff); - ASSERT_EQ(vmt.committed_size(&rgn), 0u); + ASSERT_EQ(vmt.committed_size(&rmr), 0u); // With preceding region @@ -342,71 +342,71 @@ public: { R r[] = { {addr, cs}, {addr + 2 * cs, 3 * cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } rtree->commit_region(addr + 3 * cs, cs, stack, diff); { R r[] = { {addr, cs}, {addr + 2 * cs, 3 * cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } rtree->commit_region(addr + 4 * cs, cs, stack, diff); { R r[] = { {addr, cs}, {addr + 2 * cs, 3 * cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } // Cleanup rtree->uncommit_region(addr, 5 * cs, diff); - ASSERT_EQ(vmt.committed_size(&rgn), 0u); + ASSERT_EQ(vmt.committed_size(&rmr), 0u); // With different stacks { // Commit one region rtree->commit_region(addr, cs, stack, diff); R r[] = { {addr, cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } { // Commit the same region rtree->commit_region(addr, cs, stack2, diff); R r[] = { {addr, cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } { // Commit a succeeding region rtree->commit_region(addr + cs, cs, stack, diff); R r[] = { {addr, cs}, {addr + cs, cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } { // Commit over two regions rtree->commit_region(addr, 2 * cs, stack, diff); R r[] = { {addr, 2 * cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } {// Commit first part of a region rtree->commit_region(addr, cs, stack2, diff); R r[] = { {addr, cs}, {addr + cs, cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } { // Commit second part of a region rtree->commit_region(addr + cs, cs, stack2, diff); R r[] = { {addr, 2 * cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } { // Commit a third part rtree->commit_region(addr + 2 * cs, cs, stack2, diff); R r[] = { {addr, 3 * cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } { // Commit in the middle of a region @@ -414,7 +414,7 @@ public: R r[] = { {addr, cs}, {addr + cs, cs}, {addr + 2 * cs, cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } rtree->tree().remove_all(); @@ -445,11 +445,11 @@ public: NativeCallStack stack(&frame1, 1); NativeCallStack stack2(&frame2, 1); - // Fetch the added region for the space - VirtualMemoryRegion rgn = rtree->find_reserved_region(addr); + // Fetch the added RMR for the space + ReservedMemoryRegion rmr = rtree->find_reserved_region(addr); - ASSERT_EQ(rgn.size(), size); - ASSERT_EQ(rgn.base(), addr); + ASSERT_EQ(rmr.size(), size); + ASSERT_EQ(rmr.base(), addr); // Commit Size Granularity const size_t cs = 0x1000; @@ -457,11 +457,11 @@ public: { // Commit regions rtree->commit_region(addr, 3 * cs, stack, diff); R r[] = { {addr, 3 * cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); // Remove only existing rtree->uncommit_region(addr, 3 * cs, diff); - check_empty(vmt, rgn); + check_empty(vmt, rmr); } { @@ -473,7 +473,7 @@ public: rtree->uncommit_region(addr, cs, diff); R r[] = { {addr + 2 * cs, cs}, {addr + 4 * cs, cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } // add back @@ -483,7 +483,7 @@ public: rtree->uncommit_region(addr + 2 * cs, cs, diff); R r[] = { {addr + 0 * cs, cs}, {addr + 4 * cs, cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } // add back @@ -493,17 +493,17 @@ public: rtree->uncommit_region(addr + 4 * cs, cs, diff); R r[] = { {addr + 0 * cs, cs}, {addr + 2 * cs, cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); } rtree->uncommit_region(addr, 5 * cs, diff); - check_empty(vmt, rgn); + check_empty(vmt, rmr); } { // Remove larger region rtree->commit_region(addr + 1 * cs, cs, stack, diff); rtree->uncommit_region(addr, 3 * cs, diff); - check_empty(vmt, rgn); + check_empty(vmt, rmr); } { // Remove smaller region - in the middle @@ -511,50 +511,50 @@ public: rtree->uncommit_region(addr + 1 * cs, cs, diff); R r[] = { { addr + 0 * cs, cs}, { addr + 2 * cs, cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); rtree->uncommit_region(addr, 3 * cs, diff); - check_empty(vmt, rgn); + check_empty(vmt, rmr); } { // Remove smaller region - at the beginning rtree->commit_region(addr, 3 * cs, stack, diff); rtree->uncommit_region(addr + 0 * cs, cs, diff); R r[] = { { addr + 1 * cs, 2 * cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); rtree->uncommit_region(addr, 3 * cs, diff); - check_empty(vmt, rgn); + check_empty(vmt, rmr); } { // Remove smaller region - at the end rtree->commit_region(addr, 3 * cs, stack, diff); rtree->uncommit_region(addr + 2 * cs, cs, diff); R r[] = { { addr, 2 * cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); rtree->uncommit_region(addr, 3 * cs, diff); - check_empty(vmt, rgn); + check_empty(vmt, rmr); } { // Remove smaller, overlapping region - at the beginning rtree->commit_region(addr + 1 * cs, 4 * cs, stack, diff); rtree->uncommit_region(addr, 2 * cs, diff); R r[] = { { addr + 2 * cs, 3 * cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); rtree->uncommit_region(addr + 1 * cs, 4 * cs, diff); - check_empty(vmt, rgn); + check_empty(vmt, rmr); } { // Remove smaller, overlapping region - at the end rtree->commit_region(addr, 3 * cs, stack, diff); rtree->uncommit_region(addr + 2 * cs, 2 * cs, diff); R r[] = { { addr, 2 * cs} }; - check(vmt, rgn, r); + check(vmt, rmr, r); rtree->uncommit_region(addr, 3 * cs, diff); - check_empty(vmt, rgn); + check_empty(vmt, rmr); } rtree->tree().remove_all(); From f5e1e313dab2aa63711c6a64d363e88409bff4ba Mon Sep 17 00:00:00 2001 From: Albert Mingkun Yang Date: Mon, 16 Feb 2026 14:37:28 +0000 Subject: [PATCH 114/120] 8377561: Parallel: Large allocations cause Full GC storm without heap expansion Reviewed-by: tschatzl, jsikstro --- .../share/gc/parallel/parallelScavengeHeap.inline.hpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/hotspot/share/gc/parallel/parallelScavengeHeap.inline.hpp b/src/hotspot/share/gc/parallel/parallelScavengeHeap.inline.hpp index f257f4c9177..0f00b3ec2f9 100644 --- a/src/hotspot/share/gc/parallel/parallelScavengeHeap.inline.hpp +++ b/src/hotspot/share/gc/parallel/parallelScavengeHeap.inline.hpp @@ -30,8 +30,11 @@ #include "gc/parallel/psScavenge.hpp" inline bool ParallelScavengeHeap::should_alloc_in_eden(const size_t size) const { - const size_t eden_size = young_gen()->eden_space()->capacity_in_words(); - return size < eden_size / 2; + const size_t max_young_gen_bytes = young_gen()->max_gen_size(); + const size_t survivor_size_bytes = young_gen()->from_space()->capacity_in_bytes(); + const size_t max_eden_size_bytes = max_young_gen_bytes - survivor_size_bytes * 2; + const size_t max_eden_size_words = max_eden_size_bytes / HeapWordSize; + return size < max_eden_size_words / 2; } inline bool ParallelScavengeHeap::is_in_young(const void* p) const { From a08c730d5fae6a80a0fa457aa465fcf6d5e35b8b Mon Sep 17 00:00:00 2001 From: Daniel Fuchs Date: Mon, 16 Feb 2026 17:01:07 +0000 Subject: [PATCH 115/120] 8377302: HttpServer::stop uses full timeout duration if handler throws Reviewed-by: vyazici, michaelm --- .../net/httpserver/ChunkedOutputStream.java | 6 +- .../classes/sun/net/httpserver/Event.java | 14 +- .../sun/net/httpserver/ExchangeImpl.java | 72 ++++- .../httpserver/FixedLengthOutputStream.java | 5 +- .../sun/net/httpserver/ServerImpl.java | 127 ++++---- .../httpserver/UndefLengthOutputStream.java | 5 +- .../sun/net/httpserver/FailAndStopTest.java | 306 ++++++++++++++++++ 7 files changed, 457 insertions(+), 78 deletions(-) create mode 100644 test/jdk/com/sun/net/httpserver/FailAndStopTest.java diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/ChunkedOutputStream.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/ChunkedOutputStream.java index fd1a940c0a5..0af59f1d1a7 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/ChunkedOutputStream.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/ChunkedOutputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -154,9 +154,7 @@ class ChunkedOutputStream extends FilterOutputStream } finally { closed = true; } - - Event e = new Event.WriteFinished(t); - t.getHttpContext().getServerImpl().addEvent(e); + t.postExchangeFinished(true); } public void flush() throws IOException { diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/Event.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/Event.java index 18c2535492b..41ce83596b7 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/Event.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/Event.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,13 +47,15 @@ abstract sealed class Event { } /** - * Event indicating that writing is finished for a given exchange. + * Event indicating that the exchange is finished, + * without having necessarily read the complete + * request or sent the complete response. + * Typically, this event is posted when invoking + * the filter chain throws an exception. */ - static final class WriteFinished extends Event { - WriteFinished(ExchangeImpl t) { + static final class ExchangeFinished extends Event { + ExchangeFinished(ExchangeImpl t) { super(Objects.requireNonNull(t)); - assert !t.writefinished; - t.writefinished = true; } } } diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java index ad6805938a2..57296842db2 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2026, Oracle and/or its affiliates. All rights reserved. * 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,10 +32,10 @@ import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.lang.System.Logger; import java.lang.System.Logger.Level; -import java.text.*; import java.time.Instant; import java.time.ZoneId; import java.time.format.DateTimeFormatter; +import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Stream; import com.sun.net.httpserver.*; import static com.sun.net.httpserver.HttpExchange.RSPBODY_EMPTY; @@ -46,7 +46,7 @@ class ExchangeImpl { Headers reqHdrs, rspHdrs; Request req; String method; - boolean writefinished; + private boolean writefinished; URI uri; HttpConnection connection; long reqContentLen; @@ -87,6 +87,19 @@ class ExchangeImpl { HttpPrincipal principal; ServerImpl server; + // Used to control that ServerImpl::endExchange is called + // exactly once for this exchange. ServerImpl::endExchange decrements + // the refcount that was incremented by calling ServerImpl::startExchange + // in this ExchangeImpl constructor. + private final AtomicBoolean ended = new AtomicBoolean(); + + // Used to ensure that the Event.ExchangeFinished is posted only + // once for this exchange. The Event.ExchangeFinished is what will + // eventually cause the ServerImpl::finishedLatch to be triggered, + // once the number of active exchanges reaches 0 and ServerImpl::stop + // has been requested. + private final AtomicBoolean finished = new AtomicBoolean(); + ExchangeImpl( String m, URI u, Request req, long len, HttpConnection connection ) throws IOException { @@ -107,6 +120,55 @@ class ExchangeImpl { server.startExchange(); } + /** + * When true, writefinished indicates that all bytes expected + * by the client have been written to the response body + * outputstream, and that the response body outputstream has + * been closed. When all bytes have also been pulled from + * the request body input stream, this makes it possible to + * reuse the connection for the next request. + */ + synchronized boolean writefinished() { + return writefinished; + } + + /** + * Calls ServerImpl::endExchange if not already called for this + * exchange. ServerImpl::endExchange must be called exactly once + * per exchange, and this method ensures that it is not called + * more than once for this exchange. + * @return the new (or current) value of the exchange count. + */ + int endExchange() { + // only call server.endExchange(); once per exchange + if (ended.compareAndSet(false, true)) { + return server.endExchange(); + } + return server.getExchangeCount(); + } + + /** + * Posts the ExchangeFinished event if not already posted. + * If `writefinished` is true, marks the exchange as {@link + * #writefinished()} so that the connection can be reused. + * @param writefinished whether all bytes expected by the + * client have been writen out to the + * response body output stream. + */ + void postExchangeFinished(boolean writefinished) { + // only post ExchangeFinished once per exchange + if (finished.compareAndSet(false, true)) { + if (writefinished) { + synchronized (this) { + assert this.writefinished == false; + this.writefinished = true; + } + } + Event e = new Event.ExchangeFinished(this); + getHttpContext().getServerImpl().addEvent(e); + } + } + public Headers getRequestHeaders() { return reqHdrs; } @@ -140,7 +202,7 @@ class ExchangeImpl { /* close the underlying connection if, * a) the streams not set up yet, no response can be sent, or * b) if the wrapper output stream is not set up, or - * c) if the close of the input/outpu stream fails + * c) if the close of the input/output stream fails */ try { if (uis_orig == null || uos == null) { @@ -157,6 +219,8 @@ class ExchangeImpl { uos.close(); } catch (IOException e) { connection.close(); + } finally { + postExchangeFinished(false); } } diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/FixedLengthOutputStream.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/FixedLengthOutputStream.java index 95de03d27fa..e9dbd93bb12 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/FixedLengthOutputStream.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/FixedLengthOutputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -94,8 +94,7 @@ class FixedLengthOutputStream extends FilterOutputStream is.close(); } catch (IOException e) {} } - Event e = new Event.WriteFinished(t); - t.getHttpContext().getServerImpl().addEvent(e); + t.postExchangeFinished(true); } // flush is a pass-through diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java index e8c8d336e03..94fe78b9c64 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -419,7 +419,8 @@ class ServerImpl { // Stopping marking the state as finished if stop is requested, // termination is in progress and exchange count is 0 if (r instanceof Event.StopRequested) { - logger.log(Level.TRACE, "Handling Stop Requested Event"); + logger.log(Level.TRACE, "Handling {0} event", + r.getClass().getSimpleName()); // checking if terminating is set to true final boolean terminatingCopy = terminating; @@ -437,10 +438,11 @@ class ServerImpl { HttpConnection c = t.getConnection(); try { - if (r instanceof Event.WriteFinished) { + if (r instanceof Event.ExchangeFinished) { - logger.log(Level.TRACE, "Write Finished"); - int exchanges = endExchange(); + logger.log(Level.TRACE, "Handling {0} event", + r.getClass().getSimpleName()); + int exchanges = t.endExchange(); if (terminating && exchanges == 0 && reqConnections.isEmpty()) { finishedLatch.countDown(); } @@ -842,68 +844,77 @@ class ServerImpl { tx = new ExchangeImpl( method, uri, req, clen, connection ); - String chdr = headers.getFirst("Connection"); - Headers rheaders = tx.getResponseHeaders(); + try { - if (chdr != null && chdr.equalsIgnoreCase("close")) { - tx.close = true; - } - if (version.equalsIgnoreCase("http/1.0")) { - tx.http10 = true; - if (chdr == null) { + String chdr = headers.getFirst("Connection"); + Headers rheaders = tx.getResponseHeaders(); + + if (chdr != null && chdr.equalsIgnoreCase("close")) { tx.close = true; - rheaders.set("Connection", "close"); - } else if (chdr.equalsIgnoreCase("keep-alive")) { - rheaders.set("Connection", "keep-alive"); - int idleSeconds = (int) (ServerConfig.getIdleIntervalMillis() / 1000); - String val = "timeout=" + idleSeconds; - rheaders.set("Keep-Alive", val); } - } + if (version.equalsIgnoreCase("http/1.0")) { + tx.http10 = true; + if (chdr == null) { + tx.close = true; + rheaders.set("Connection", "close"); + } else if (chdr.equalsIgnoreCase("keep-alive")) { + rheaders.set("Connection", "keep-alive"); + int idleSeconds = (int) (ServerConfig.getIdleIntervalMillis() / 1000); + String val = "timeout=" + idleSeconds; + rheaders.set("Keep-Alive", val); + } + } - if (newconnection) { - connection.setParameters( - rawin, rawout, chan, engine, sslStreams, - sslContext, protocol, ctx, rawin - ); - } - /* check if client sent an Expect 100 Continue. - * In that case, need to send an interim response. - * In future API may be modified to allow app to - * be involved in this process. - */ - String exp = headers.getFirst("Expect"); - if (exp != null && exp.equalsIgnoreCase("100-continue")) { - logReply(100, requestLine, null); - sendReply( - Code.HTTP_CONTINUE, false, null - ); - } - /* uf is the list of filters seen/set by the user. - * sf is the list of filters established internally - * and which are not visible to the user. uc and sc - * are the corresponding Filter.Chains. - * They are linked together by a LinkHandler - * so that they can both be invoked in one call. - */ - final List sf = ctx.getSystemFilters(); - final List uf = ctx.getFilters(); + if (newconnection) { + connection.setParameters( + rawin, rawout, chan, engine, sslStreams, + sslContext, protocol, ctx, rawin + ); + } + /* check if client sent an Expect 100 Continue. + * In that case, need to send an interim response. + * In future API may be modified to allow app to + * be involved in this process. + */ + String exp = headers.getFirst("Expect"); + if (exp != null && exp.equalsIgnoreCase("100-continue")) { + logReply(100, requestLine, null); + sendReply( + Code.HTTP_CONTINUE, false, null + ); + } + /* uf is the list of filters seen/set by the user. + * sf is the list of filters established internally + * and which are not visible to the user. uc and sc + * are the corresponding Filter.Chains. + * They are linked together by a LinkHandler + * so that they can both be invoked in one call. + */ + final List sf = ctx.getSystemFilters(); + final List uf = ctx.getFilters(); - final Filter.Chain sc = new Filter.Chain(sf, ctx.getHandler()); - final Filter.Chain uc = new Filter.Chain(uf, new LinkHandler(sc)); + final Filter.Chain sc = new Filter.Chain(sf, ctx.getHandler()); + final Filter.Chain uc = new Filter.Chain(uf, new LinkHandler(sc)); - /* set up the two stream references */ - tx.getRequestBody(); - tx.getResponseBody(); - if (https) { - uc.doFilter(new HttpsExchangeImpl(tx)); - } else { - uc.doFilter(new HttpExchangeImpl(tx)); + /* set up the two stream references */ + tx.getRequestBody(); + tx.getResponseBody(); + if (https) { + uc.doFilter(new HttpsExchangeImpl(tx)); + } else { + uc.doFilter(new HttpExchangeImpl(tx)); + } + } catch (Throwable t) { + // release the exchange. + logger.log(Level.TRACE, "ServerImpl.Exchange", t); + if (!tx.writefinished()) { + closeConnection(connection); + } + tx.postExchangeFinished(false); } - } catch (Exception e) { logger.log(Level.TRACE, "ServerImpl.Exchange", e); - if (tx == null || !tx.writefinished) { + if (tx == null || !tx.writefinished()) { closeConnection(connection); } } catch (Throwable t) { diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/UndefLengthOutputStream.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/UndefLengthOutputStream.java index ecda32ecc31..9e1f949321a 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/UndefLengthOutputStream.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/UndefLengthOutputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2026, Oracle and/or its affiliates. All rights reserved. * 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,8 +75,7 @@ class UndefLengthOutputStream extends FilterOutputStream is.close(); } catch (IOException e) {} } - Event e = new Event.WriteFinished(t); - t.getHttpContext().getServerImpl().addEvent(e); + t.postExchangeFinished(true); } // flush is a pass-through diff --git a/test/jdk/com/sun/net/httpserver/FailAndStopTest.java b/test/jdk/com/sun/net/httpserver/FailAndStopTest.java new file mode 100644 index 00000000000..005d78add18 --- /dev/null +++ b/test/jdk/com/sun/net/httpserver/FailAndStopTest.java @@ -0,0 +1,306 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * 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 8377302 + * @summary HttpServer.stop() blocks indefinitely if handler throws + * @modules jdk.httpserver java.logging + * @library /test/lib + * @run main/othervm ${test.main.class} + */ + +import java.io.IOException; +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.Proxy; +import java.net.URL; +import java.nio.charset.StandardCharsets; +import java.util.Optional; +import java.util.function.BiPredicate; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; + +import com.sun.net.httpserver.HttpExchange; +import com.sun.net.httpserver.HttpHandler; +import com.sun.net.httpserver.HttpServer; +import com.sun.net.httpserver.HttpsConfigurator; +import com.sun.net.httpserver.HttpsServer; +import jdk.test.lib.net.SimpleSSLContext; +import jdk.test.lib.net.URIBuilder; +import jdk.test.lib.Utils; +import static com.sun.net.httpserver.HttpExchange.RSPBODY_CHUNKED; + +public class FailAndStopTest implements HttpHandler { + // Keep that logger in a static field to make sure it doesn't + // get GC'ed and recreated before the HttpServer is initialized. + private static final Logger LOGGER = Logger.getLogger("com.sun.net.httpserver"); + private static final String BODY = "OK"; + + static enum TestCases { + FAILNOW("failNow", TestCases::shouldAlwaysFail), + ASSERTNOW("assertNow", TestCases::shouldAlwaysFail), + RESPANDFAIL("failAfterResponseStatus", TestCases::shouldFailExceptForHead), + RESPANDASSERT("assertAfterResponseStatus", TestCases::shouldFailExceptForHead), + CLOSEAFTERRESP("closeExchangeAfterResponseStatus", TestCases::shouldFailExceptForHead), + BODYANDFAIL("failAfterBody", TestCases::shouldFailExceptForHeadOrHttps), + BODYANDASSERT("assertAfterBody", TestCases::shouldFailExceptForHeadOrHttps), + CLOSEBEFOREOS("closeExchangeBeforeOS", TestCases::shouldNeverFail), + CLOSEANDRETURN("closeAndReturn", TestCases::shouldNeverFail), + CLOSEANDFAIL("closeAndFail", TestCases::shouldNeverFail), + CLOSEANDASSERT("closeAndAssert", TestCases::shouldNeverFail); + + private final String query; + private BiPredicate shouldFail; + TestCases(String query, BiPredicate shouldFail) { + this.query = query; + this.shouldFail = shouldFail; + } + boolean shouldFail(String scheme, String method) { + // in case of HEAD method the client should not + // fail if we throw after sending response headers + return shouldFail.test(scheme, method); + } + private static boolean shouldAlwaysFail(String scheme, String method) { + return true; + } + private static boolean shouldNeverFail(String scheme, String method) { + return false; + } + private static boolean shouldFailExceptForHead(String scheme, String method) { + return !"HEAD".equals(method); + } + private static boolean shouldFailExceptForHeadOrHttps(String scheme, String method) { + // When using https, the buffered response bytes may be sent + // when the connection is closed, in which case the full body + // will be correctly received, and the client connection + // will not fail. With plain http, the bytes are not sent and + // the client fails with premature end of file. + return !"HEAD".equals(method) && !"https".equalsIgnoreCase(scheme); + } + + } + + @Override + public void handle(HttpExchange ex) throws IOException { + String query = ex.getRequestURI().getRawQuery(); + TestCases step = TestCases.FAILNOW; + if (query == null || query.equals(step.query)) { + System.out.println("Server: " + step); + throw new NullPointerException("Got you!"); + } + step = TestCases.ASSERTNOW; + if (query.equals(step.query)) { + System.out.println("Server: " + step); + throw new AssertionError("Got you!"); + } + byte[] body = BODY.getBytes(StandardCharsets.UTF_8); + ex.sendResponseHeaders(200, body.length); + step = TestCases.RESPANDFAIL; + if (query.equals(step.query)) { + System.out.println("Server: " + step); + throw new NullPointerException("Got you!"); + } + step = TestCases.RESPANDASSERT; + if (query.equals(step.query)) { + System.out.println("Server: " + step); + throw new AssertionError("Got you!"); + } + step = TestCases.CLOSEAFTERRESP; + if (query.equals(step.query)) { + System.out.println("Server: " + step); + ex.close(); + return; + } + if (!"HEAD".equals(ex.getRequestMethod())) { + ex.getResponseBody().write(body); + } + step = TestCases.BODYANDFAIL; + if (query.equals(step.query)) { + System.out.println("Server: " + step); + throw new NullPointerException("Got you!"); + } + step = TestCases.BODYANDASSERT; + if (query.equals(step.query)) { + System.out.println("Server: " + step); + throw new AssertionError("Got you!"); + } + step = TestCases.CLOSEBEFOREOS; + if (query.equals(step.query)) { + System.out.println("Server: " + step); + ex.close(); + return; + } + System.out.println("Server: closing response body"); + ex.getResponseBody().close(); + step = TestCases.CLOSEANDRETURN; + if (query.equals(step.query)) { + System.out.println("Server: " + step); + ex.close(); + return; + } + step = TestCases.CLOSEANDFAIL; + if (query.equals(step.query)) { + System.out.println("Server: " + step); + throw new NullPointerException("Got you!"); + } + step = TestCases.CLOSEANDASSERT; + if (query.equals(step.query)) { + System.out.println("Server: " + step); + throw new AssertionError("Got you!"); + } + } + + private static void enableHttpServerLogging() { + // set HttpServer's logger to ALL + LOGGER.setLevel(Level.ALL); + // get the root logger, get its first handler (by default + // it's a ConsoleHandler), and set its level to ALL (by + // default its level is INFO). + Logger.getLogger("").getHandlers()[0].setLevel(Level.ALL); + } + + + public static void main(String[] args) throws Exception { + + enableHttpServerLogging(); + + // test with GET + for (var test : TestCases.values()) { + test(test, Optional.empty(), "http"); + test(test, Optional.empty(), "https"); + } + // test with HEAD + for (var test : TestCases.values()) { + test(test, Optional.of("HEAD"), "http"); + test(test, Optional.of("HEAD"), "https"); + } + } + + private static SSLContext initSSLContext(boolean secure) { + SSLContext context = secure ? SimpleSSLContext.findSSLContext() : null; + if (secure) { + SSLContext.setDefault(context); + } + return context; + } + + private static HttpServer createHttpServer(SSLContext context) throws IOException { + var address = new InetSocketAddress(InetAddress.getLoopbackAddress(), 0); + if (context != null) { + var server = HttpsServer.create(address, 0); + server.setHttpsConfigurator(new HttpsConfigurator(context)); + return server; + } else { + return HttpServer.create(address, 0); + } + } + + private static HttpURLConnection createConnection(URL url, boolean secure) + throws IOException { + HttpURLConnection urlc = (HttpURLConnection) url.openConnection(Proxy.NO_PROXY); + if (secure) { + ((HttpsURLConnection)urlc).setHostnameVerifier(new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }); + } + return urlc; + } + + private static void test(TestCases test, Optional method, String scheme) + throws Exception { + boolean secure = "https".equalsIgnoreCase(scheme); + SSLContext context = initSSLContext(secure); + HttpServer server = createHttpServer(context); + + System.out.println("Test: " + method.orElse("GET") + " " + test.query); + System.out.println("Server listening at: " + server.getAddress()); + try { + server.createContext("/FailAndStopTest/", new FailAndStopTest()); + server.start(); + + URL url = URIBuilder.newBuilder() + .scheme(scheme) + .loopback() + .port(server.getAddress().getPort()) + .path("/FailAndStopTest/") + .query(test.query) + .toURLUnchecked(); + System.out.println("Connecting to: " + url); + HttpURLConnection urlc = createConnection(url, secure); + if (method.isPresent()) urlc.setRequestMethod(method.get()); + try { + System.out.println("Client: Response code received: " + urlc.getResponseCode()); + InputStream is = urlc.getInputStream(); + String body = new String(is.readAllBytes(), StandardCharsets.UTF_8); + is.close(); + System.out.printf("Client: read body: \"%s\"%n", body); + if (test.shouldFail(scheme, urlc.getRequestMethod())) { + throw new AssertionError(test.query + ": test did not fail"); + } + if (!method.orElse("GET").equals("HEAD")) { + if (!BODY.equals(body)) { + throw new AssertionError( + String.format("\"%s\" != \"%s\"", body, BODY)); + } + } else if (!body.isEmpty()) { + throw new AssertionError("Body is not empty: " + body); + } + } catch (IOException so) { + if (test.shouldFail(scheme, urlc.getRequestMethod())) { + // expected + System.out.println(test.query + ": Got expected exception: " + so); + } else if (!test.shouldFail("http", urlc.getRequestMethod())) { + // When using https, the buffered response bytes may be sent + // when the connection is closed, in which case the full body + // will be correctly received, and the client connection + // will not fail. With plain http, the bytes are not sent and + // the client fails with premature end of file. + // So only fail here if the test should not fail with plain + // http - we want to accept possible exception for https... + throw new AssertionError( + String.format("%s: test failed with %s", test.query, so), so); + } else { + System.out.printf("%s: WARNING: unexpected exception: %s%n", test.query, so); + // should only happen in those two cases: + assert secure && !"HEAD".equals(method) && + (test == TestCases.BODYANDFAIL || test == TestCases.BODYANDASSERT); + } + } + } finally { + // if not fixed will cause the test to fail in jtreg timeout + server.stop((int)Utils.adjustTimeout(5000)); + System.out.println("Server stopped as expected"); + } + } +} From c3b67387c4c0891891c75f9001ba13feaae09017 Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Mon, 16 Feb 2026 20:24:12 +0000 Subject: [PATCH 116/120] 8366736: Closed System.out causes child process to hang on Windows Reviewed-by: rriggs --- .../classes/java/lang/ProcessBuilder.java | 8 ++- .../classes/java/lang/ProcessImpl.java | 14 +++- .../lang/ProcessBuilder/InheritIOClosed.java | 71 +++++++++++++++++++ 3 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 test/jdk/java/lang/ProcessBuilder/InheritIOClosed.java diff --git a/src/java.base/share/classes/java/lang/ProcessBuilder.java b/src/java.base/share/classes/java/lang/ProcessBuilder.java index d461818eedf..bc92ea4ee82 100644 --- a/src/java.base/share/classes/java/lang/ProcessBuilder.java +++ b/src/java.base/share/classes/java/lang/ProcessBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -930,6 +930,12 @@ public final class ProcessBuilder * command interpreters, or the standard C library function * {@code system()}. * + * @implNote + * When the process is {@link #start started}, + * if {#code System.out} and/or {#code System.err} have been + * closed in the current process, the corresponding output + * in the subprocess will be discarded. + * * @return this process builder * @since 1.7 */ diff --git a/src/java.base/windows/classes/java/lang/ProcessImpl.java b/src/java.base/windows/classes/java/lang/ProcessImpl.java index 1a08aca52e9..26d7afc5363 100644 --- a/src/java.base/windows/classes/java/lang/ProcessImpl.java +++ b/src/java.base/windows/classes/java/lang/ProcessImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2026, Oracle and/or its affiliates. All rights reserved. * 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,12 @@ final class ProcessImpl extends Process { stdHandles[1] = -1L; } else if (redirects[1] == Redirect.INHERIT) { stdHandles[1] = fdAccess.getHandle(FileDescriptor.out); + if (stdHandles[1] == -1L) { + // FileDescriptor.out has been closed. + f1 = newFileOutputStream(Redirect.DISCARD.file(), + Redirect.DISCARD.append()); + stdHandles[1] = fdAccess.getHandle(f1.getFD()); + } } else if (redirects[1] instanceof ProcessBuilder.RedirectPipeImpl) { stdHandles[1] = fdAccess.getHandle(((ProcessBuilder.RedirectPipeImpl) redirects[1]).getFd()); // Force getInputStream to return a null stream, @@ -134,6 +140,12 @@ final class ProcessImpl extends Process { stdHandles[2] = -1L; } else if (redirects[2] == Redirect.INHERIT) { stdHandles[2] = fdAccess.getHandle(FileDescriptor.err); + if (stdHandles[2] == -1L) { + // FileDescriptor.err has been closed. + f2 = newFileOutputStream(Redirect.DISCARD.file(), + Redirect.DISCARD.append()); + stdHandles[2] = fdAccess.getHandle(f2.getFD()); + } } else if (redirects[2] instanceof ProcessBuilder.RedirectPipeImpl) { stdHandles[2] = fdAccess.getHandle(((ProcessBuilder.RedirectPipeImpl) redirects[2]).getFd()); } else { diff --git a/test/jdk/java/lang/ProcessBuilder/InheritIOClosed.java b/test/jdk/java/lang/ProcessBuilder/InheritIOClosed.java new file mode 100644 index 00000000000..3e96a49bd3b --- /dev/null +++ b/test/jdk/java/lang/ProcessBuilder/InheritIOClosed.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @summary child process should not hang even if parent process has closed System.out/err + * @bug 8366736 + * @run main/othervm InheritIOClosed close dontclose + * @run main/othervm InheritIOClosed dontclose close + * @run main/othervm InheritIOClosed close close + */ + +import java.nio.file.Path; + +public class InheritIOClosed { + private final static Path JAVA_EXE = + Path.of(System.getProperty("java.home"), "bin", "java"); + + private static final String s = "1234567890".repeat(10); + + public static void main(String[] args) throws Exception { + if (args.length == 2) { + // Main test process + if (args[0].equals("close")) { + System.out.close(); + } + if (args[1].equals("close")) { + System.err.close(); + } + + ProcessBuilder pb = new ProcessBuilder().inheritIO() + .command(JAVA_EXE.toString(), + "-cp", + System.getProperty("java.class.path"), + InheritIOClosed.class.getName()); + Process process = pb.start(); + process.waitFor(); + + System.out.println("Done"); + } else { + // Child process -- print to System.out/err. Without the fix in + // JDK-8366736, this process will hang on Windows. + for (int i = 0; i < 100; i++) { + System.out.println(s); + } + for (int i = 0; i < 100; i++) { + System.err.println(s); + } + } + } +} From b41ba3a496b59c8058067a49617f798606f0a51c Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Mon, 16 Feb 2026 20:24:47 +0000 Subject: [PATCH 117/120] 8377932: AOT cache is not rejected when JAR file has changed Reviewed-by: kvn, asmehra --- src/hotspot/share/cds/aotClassLocation.cpp | 12 +- .../cds/appcds/aotCache/ChangedJarFile.java | 110 ++++++++++++++++++ 2 files changed, 120 insertions(+), 2 deletions(-) create mode 100644 test/hotspot/jtreg/runtime/cds/appcds/aotCache/ChangedJarFile.java diff --git a/src/hotspot/share/cds/aotClassLocation.cpp b/src/hotspot/share/cds/aotClassLocation.cpp index f77aac3540c..9275b914ef9 100644 --- a/src/hotspot/share/cds/aotClassLocation.cpp +++ b/src/hotspot/share/cds/aotClassLocation.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -426,7 +426,8 @@ bool AOTClassLocation::check(const char* runtime_path, bool has_aot_linked_class bool size_differs = _filesize != st.st_size; bool time_differs = _check_time && (_timestamp != st.st_mtime); if (size_differs || time_differs) { - aot_log_warning(aot)("This file is not the one used while building the shared archive file: '%s'%s%s", + aot_log_warning(aot)("This file is not the one used while building the %s: '%s'%s%s", + CDSConfig::type_of_archive_being_loaded(), runtime_path, time_differs ? ", timestamp has changed" : "", size_differs ? ", size has changed" : ""); @@ -448,6 +449,13 @@ void AOTClassLocationConfig::dumptime_init(JavaThread* current) { java_lang_Throwable::print(current->pending_exception(), tty); vm_exit_during_initialization("AOTClassLocationConfig::dumptime_init_helper() failed unexpectedly"); } + + if (CDSConfig::is_dumping_final_static_archive()) { + // The _max_used_index is usually updated by ClassLoader::record_result(). However, + // when dumping the final archive, the classes are loaded from their images in + // the AOT config file, so we don't go through ClassLoader::record_result(). + dumptime_update_max_used_index(runtime()->_max_used_index); // Same value as recorded in the training run. + } } void AOTClassLocationConfig::dumptime_init_helper(TRAPS) { diff --git a/test/hotspot/jtreg/runtime/cds/appcds/aotCache/ChangedJarFile.java b/test/hotspot/jtreg/runtime/cds/appcds/aotCache/ChangedJarFile.java new file mode 100644 index 00000000000..a717b267347 --- /dev/null +++ b/test/hotspot/jtreg/runtime/cds/appcds/aotCache/ChangedJarFile.java @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +/* + * @test + * @summary AOT cache should be rejected if JAR file(s) in the classpath have changed + * @bug 8377932 + * @requires vm.cds.supports.aot.class.linking + * @library /test/lib + * @build ChangedJarFile + * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar app.jar MyTestApp OtherClass + * @run driver ChangedJarFile AOT + */ + +import jdk.jfr.Event; +import jdk.test.lib.cds.CDSAppTester; +import jdk.test.lib.helpers.ClassFileInstaller; +import jdk.test.lib.process.OutputAnalyzer; + +public class ChangedJarFile { + static final String appJar = ClassFileInstaller.getJarPath("app.jar"); + static final String mainClass = MyTestApp.class.getName(); + + public static void main(String[] args) throws Exception { + // Train and run with unchanged JAR file (which has OtherClass.class) + Tester tester = new Tester(); + tester.run(args); + + // Run again with changed JAR file (which doesn't have OtherClass.class anymore) + ClassFileInstaller.writeJar(appJar, "MyTestApp"); + + // First disable AOT cache to verify test login + tester.productionRun(new String[] {"-XX:AOTMode=off"}, + new String[] {"jarHasChanged"}); + + // Now see if the AOT cache will be automatically disabled + OutputAnalyzer out = + tester.productionRun(new String[] {"-XX:AOTMode=auto", "-Xlog:aot"}, + new String[] {"jarHasChanged"}); + out.shouldMatch("This file is not the one used while building the " + + "AOT cache: '.*app.jar', timestamp has changed, size has changed"); + } + + static class Tester extends CDSAppTester { + public Tester() { + super(mainClass); + } + + @Override + public String classpath(RunMode runMode) { + return appJar; + } + + @Override + public String[] appCommandLine(RunMode runMode) { + return new String[] { mainClass }; + } + + @Override + public void checkExecution(OutputAnalyzer out, RunMode runMode) { + + } + } + + +} + +class MyTestApp { + public static void main(String args[]) { + boolean jarHasChanged = (args.length != 0); + + System.out.println("JAR has changed = " + (jarHasChanged)); + Class c = null; + try { + c = Class.forName("OtherClass"); + System.out.println("Other class = " + c); + } catch (Throwable t) { + if (!jarHasChanged) { + throw new RuntimeException("OtherClass should have been loaded because JAR has not been changed yet", t); + } + } + + if (jarHasChanged && c != null) { + throw new RuntimeException("OtherClass should not be in JAR file"); + } + } +} + +class OtherClass {} From 2925eb8cfbddb0abdcabf735d8f0585132b4baf9 Mon Sep 17 00:00:00 2001 From: Ben Taylor Date: Mon, 16 Feb 2026 20:54:20 +0000 Subject: [PATCH 118/120] 8377044: Shenandoah: Convert ShenandoahHeap related code to use Atomic Reviewed-by: kdnilsen, xpeng, wkemper --- .../share/gc/shenandoah/shenandoahHeap.cpp | 25 ++++++++++--------- .../share/gc/shenandoah/shenandoahHeap.hpp | 8 +++--- .../gc/shenandoah/shenandoahHeap.inline.hpp | 10 ++++---- .../gc/shenandoah/vmStructs_shenandoah.hpp | 2 +- 4 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp index 767da5f9bf3..9dd837b90d2 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp @@ -86,6 +86,7 @@ #include "nmt/memTracker.hpp" #include "oops/compressedOops.inline.hpp" #include "prims/jvmtiTagMap.hpp" +#include "runtime/atomic.hpp" #include "runtime/atomicAccess.hpp" #include "runtime/globals.hpp" #include "runtime/interfaceSupport.inline.hpp" @@ -201,9 +202,9 @@ jint ShenandoahHeap::initialize() { assert(num_min_regions <= _num_regions, "sanity"); _minimum_size = num_min_regions * reg_size_bytes; - _soft_max_size = clamp(SoftMaxHeapSize, min_capacity(), max_capacity()); + _soft_max_size.store_relaxed(clamp(SoftMaxHeapSize, min_capacity(), max_capacity())); - _committed = _initial_size; + _committed.store_relaxed(_initial_size); size_t heap_page_size = UseLargePages ? os::large_page_size() : os::vm_page_size(); size_t bitmap_page_size = UseLargePages ? os::large_page_size() : os::vm_page_size(); @@ -725,17 +726,17 @@ size_t ShenandoahHeap::used() const { } size_t ShenandoahHeap::committed() const { - return AtomicAccess::load(&_committed); + return _committed.load_relaxed(); } void ShenandoahHeap::increase_committed(size_t bytes) { shenandoah_assert_heaplocked_or_safepoint(); - _committed += bytes; + _committed.fetch_then_add(bytes, memory_order_relaxed); } void ShenandoahHeap::decrease_committed(size_t bytes) { shenandoah_assert_heaplocked_or_safepoint(); - _committed -= bytes; + _committed.fetch_then_sub(bytes, memory_order_relaxed); } size_t ShenandoahHeap::capacity() const { @@ -747,7 +748,7 @@ size_t ShenandoahHeap::max_capacity() const { } size_t ShenandoahHeap::soft_max_capacity() const { - size_t v = AtomicAccess::load(&_soft_max_size); + size_t v = _soft_max_size.load_relaxed(); assert(min_capacity() <= v && v <= max_capacity(), "Should be in bounds: %zu <= %zu <= %zu", min_capacity(), v, max_capacity()); @@ -758,7 +759,7 @@ void ShenandoahHeap::set_soft_max_capacity(size_t v) { assert(min_capacity() <= v && v <= max_capacity(), "Should be in bounds: %zu <= %zu <= %zu", min_capacity(), v, max_capacity()); - AtomicAccess::store(&_soft_max_size, v); + _soft_max_size.store_relaxed(v); } size_t ShenandoahHeap::min_capacity() const { @@ -1941,7 +1942,7 @@ private: size_t const _stride; shenandoah_padding(0); - volatile size_t _index; + Atomic _index; shenandoah_padding(1); public: @@ -1954,8 +1955,8 @@ public: size_t stride = _stride; size_t max = _heap->num_regions(); - while (AtomicAccess::load(&_index) < max) { - size_t cur = AtomicAccess::fetch_then_add(&_index, stride, memory_order_relaxed); + while (_index.load_relaxed() < max) { + size_t cur = _index.fetch_then_add(stride, memory_order_relaxed); size_t start = cur; size_t end = MIN2(cur + stride, max); if (start >= max) break; @@ -2703,11 +2704,11 @@ ShenandoahRegionIterator::ShenandoahRegionIterator(ShenandoahHeap* heap) : _index(0) {} void ShenandoahRegionIterator::reset() { - _index = 0; + _index.store_relaxed(0); } bool ShenandoahRegionIterator::has_next() const { - return _index < _heap->num_regions(); + return _index.load_relaxed() < _heap->num_regions(); } ShenandoahLiveData* ShenandoahHeap::get_liveness_cache(uint worker_id) { diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp index 9240091070b..4a4499667ff 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp @@ -88,7 +88,7 @@ private: ShenandoahHeap* _heap; shenandoah_padding(0); - volatile size_t _index; + Atomic _index; shenandoah_padding(1); // No implicit copying: iterators should be passed by reference to capture the state @@ -208,9 +208,9 @@ private: size_t _initial_size; size_t _minimum_size; - volatile size_t _soft_max_size; + Atomic _soft_max_size; shenandoah_padding(0); - volatile size_t _committed; + Atomic _committed; shenandoah_padding(1); public: @@ -340,7 +340,7 @@ private: ShenandoahSharedFlag _full_gc_move_in_progress; ShenandoahSharedFlag _concurrent_strong_root_in_progress; - size_t _gc_no_progress_count; + Atomic _gc_no_progress_count; // This updates the singular, global gc state. This call must happen on a safepoint. void set_gc_state_at_safepoint(uint mask, bool value); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp index e35f116b843..02f2beaf4e0 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp @@ -49,7 +49,7 @@ #include "gc/shenandoah/shenandoahWorkGroup.hpp" #include "oops/compressedOops.inline.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomicAccess.hpp" +#include "runtime/atomic.hpp" #include "runtime/javaThread.hpp" #include "runtime/objectMonitor.inline.hpp" #include "runtime/prefetch.inline.hpp" @@ -61,7 +61,7 @@ inline ShenandoahHeap* ShenandoahHeap::heap() { } inline ShenandoahHeapRegion* ShenandoahRegionIterator::next() { - size_t new_index = AtomicAccess::add(&_index, (size_t) 1, memory_order_relaxed); + size_t new_index = _index.add_then_fetch((size_t) 1, memory_order_relaxed); // get_region() provides the bounds-check and returns null on OOB. return _heap->get_region(new_index - 1); } @@ -75,15 +75,15 @@ inline WorkerThreads* ShenandoahHeap::safepoint_workers() { } inline void ShenandoahHeap::notify_gc_progress() { - AtomicAccess::store(&_gc_no_progress_count, (size_t) 0); + _gc_no_progress_count.store_relaxed((size_t) 0); } inline void ShenandoahHeap::notify_gc_no_progress() { - AtomicAccess::inc(&_gc_no_progress_count); + _gc_no_progress_count.add_then_fetch((size_t) 1); } inline size_t ShenandoahHeap::get_gc_no_progress_count() const { - return AtomicAccess::load(&_gc_no_progress_count); + return _gc_no_progress_count.load_relaxed(); } inline size_t ShenandoahHeap::heap_region_index_containing(const void* addr) const { diff --git a/src/hotspot/share/gc/shenandoah/vmStructs_shenandoah.hpp b/src/hotspot/share/gc/shenandoah/vmStructs_shenandoah.hpp index e5e2b14a3a1..4299bdb8126 100644 --- a/src/hotspot/share/gc/shenandoah/vmStructs_shenandoah.hpp +++ b/src/hotspot/share/gc/shenandoah/vmStructs_shenandoah.hpp @@ -36,7 +36,7 @@ nonstatic_field(ShenandoahHeap, _regions, ShenandoahHeapRegion**) \ nonstatic_field(ShenandoahHeap, _log_min_obj_alignment_in_bytes, int) \ nonstatic_field(ShenandoahHeap, _free_set, ShenandoahFreeSet*) \ - volatile_nonstatic_field(ShenandoahHeap, _committed, size_t) \ + volatile_nonstatic_field(ShenandoahHeap, _committed, Atomic) \ static_field(ShenandoahHeapRegion, RegionSizeBytes, size_t) \ static_field(ShenandoahHeapRegion, RegionSizeBytesShift, size_t) \ nonstatic_field(ShenandoahHeapRegion, _state, Atomic) \ From fbc705d2cc251153a69ca76788462e00861d3f60 Mon Sep 17 00:00:00 2001 From: Ben Taylor Date: Mon, 16 Feb 2026 20:56:24 +0000 Subject: [PATCH 119/120] 8377704: Shenandoah: Convert ShenandoahNMethod to use Atomic Reviewed-by: shade, xpeng, wkemper --- src/hotspot/share/gc/shenandoah/shenandoahNMethod.cpp | 8 ++++---- src/hotspot/share/gc/shenandoah/shenandoahNMethod.hpp | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/hotspot/share/gc/shenandoah/shenandoahNMethod.cpp b/src/hotspot/share/gc/shenandoah/shenandoahNMethod.cpp index 55cec63f045..facaefd4b62 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahNMethod.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahNMethod.cpp @@ -433,8 +433,8 @@ void ShenandoahNMethodTableSnapshot::parallel_nmethods_do(NMethodClosure *f) { ShenandoahNMethod** const list = _list->list(); size_t max = (size_t)_limit; - while (_claimed < max) { - size_t cur = AtomicAccess::fetch_then_add(&_claimed, stride, memory_order_relaxed); + while (_claimed.load_relaxed() < max) { + size_t cur = _claimed.fetch_then_add(stride, memory_order_relaxed); size_t start = cur; size_t end = MIN2(cur + stride, max); if (start >= max) break; @@ -457,8 +457,8 @@ void ShenandoahNMethodTableSnapshot::concurrent_nmethods_do(NMethodClosure* cl) ShenandoahNMethod** list = _list->list(); size_t max = (size_t)_limit; - while (_claimed < max) { - size_t cur = AtomicAccess::fetch_then_add(&_claimed, stride, memory_order_relaxed); + while (_claimed.load_relaxed() < max) { + size_t cur = _claimed.fetch_then_add(stride, memory_order_relaxed); size_t start = cur; size_t end = MIN2(cur + stride, max); if (start >= max) break; diff --git a/src/hotspot/share/gc/shenandoah/shenandoahNMethod.hpp b/src/hotspot/share/gc/shenandoah/shenandoahNMethod.hpp index 5387870c9dc..77faf6c0dcb 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahNMethod.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahNMethod.hpp @@ -30,6 +30,7 @@ #include "gc/shenandoah/shenandoahLock.hpp" #include "gc/shenandoah/shenandoahPadding.hpp" #include "memory/allocation.hpp" +#include "runtime/atomic.hpp" #include "utilities/growableArray.hpp" // ShenandoahNMethod tuple records the internal locations of oop slots within reclocation stream in @@ -115,7 +116,7 @@ private: int _limit; shenandoah_padding(0); - volatile size_t _claimed; + Atomic _claimed; shenandoah_padding(1); public: From 03703f347df7d3507ffeaf45e32be8bec6403b7d Mon Sep 17 00:00:00 2001 From: Harshit Date: Tue, 17 Feb 2026 05:17:54 +0000 Subject: [PATCH 120/120] 8359115: [s390x] Test CreateSymbolsReproducibleTest.java failure Reviewed-by: jpai, amitkumar --- .../platform/createsymbols/CreateSymbolsReproducibleTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/langtools/tools/javac/platform/createsymbols/CreateSymbolsReproducibleTest.java b/test/langtools/tools/javac/platform/createsymbols/CreateSymbolsReproducibleTest.java index ee3bb8c897d..334db17fe39 100644 --- a/test/langtools/tools/javac/platform/createsymbols/CreateSymbolsReproducibleTest.java +++ b/test/langtools/tools/javac/platform/createsymbols/CreateSymbolsReproducibleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,6 +41,7 @@ import org.junit.jupiter.api.Test; * @summary verifies that the ct.sym file created by build.tools.symbolgenerator.CreateSymbols * is reproducible * @library /test/lib + * @requires os.arch != "s390x" * @modules java.compiler * jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.jvm