From 3de6dbab14e950c1725a48686478e4155c8d93c7 Mon Sep 17 00:00:00 2001 From: Damon Nguyen Date: Wed, 11 Feb 2026 00:55:17 +0000 Subject: [PATCH 01/77] 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 02/77] 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 03/77] 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 04/77] 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 05/77] 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 06/77] 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 07/77] 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 08/77] 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 09/77] 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 10/77] 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 11/77] 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 12/77] 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 13/77] 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 14/77] 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 15/77] 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 16/77] 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 17/77] 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 18/77] 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 19/77] 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 20/77] 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 21/77] 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 22/77] 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 23/77] 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 24/77] 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 25/77] 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 26/77] 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 27/77] 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 28/77] 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 29/77] 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 30/77] 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 31/77] 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 32/77] 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 33/77] 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 34/77] 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 35/77] 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 36/77] 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 37/77] 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 38/77] 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 39/77] 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 40/77] 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 41/77] 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 42/77] 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 43/77] 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 44/77] 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 45/77] 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 46/77] 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 47/77] 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 48/77] 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 49/77] 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 50/77] 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 51/77] 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 52/77] 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 53/77] 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 54/77] 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 55/77] 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 56/77] 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 57/77] 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 58/77] 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 59/77] 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 60/77] 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 61/77] 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 62/77] 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 63/77] 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 64/77] 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 65/77] 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 66/77] 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 67/77] 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 68/77] 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 69/77] 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 From 6220c281ef5c728fb476d0b59943583809be16a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Sj=C3=B6len?= Date: Tue, 17 Feb 2026 09:03:37 +0000 Subject: [PATCH 70/77] 8366457: Add ResourceArea and Arena allocators for the RBTree Reviewed-by: azafari, cnorrbin --- src/hotspot/share/utilities/rbTree.hpp | 39 +++++++++++++++++++- test/hotspot/gtest/utilities/test_rbtree.cpp | 16 +++++++- 2 files changed, 52 insertions(+), 3 deletions(-) diff --git a/src/hotspot/share/utilities/rbTree.hpp b/src/hotspot/share/utilities/rbTree.hpp index a2f84ac2373..84e433a9ce6 100644 --- a/src/hotspot/share/utilities/rbTree.hpp +++ b/src/hotspot/share/utilities/rbTree.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 @@ -26,6 +26,9 @@ #define SHARE_UTILITIES_RBTREE_HPP #include "cppstdlib/type_traits.hpp" +#include "memory/allocation.hpp" +#include "memory/arena.hpp" +#include "memory/resourceArea.hpp" #include "metaprogramming/enableIf.hpp" #include "nmt/memTag.hpp" #include "runtime/os.hpp" @@ -458,7 +461,8 @@ class RBTree : public AbstractRBTree, COMPARATOR> { ALLOCATOR _allocator; public: - RBTree() : BaseType(), _allocator() {} + template + RBTree(AllocArgs... alloc_args) : BaseType(), _allocator(alloc_args...) {} NONCOPYABLE(RBTree); ~RBTree() { remove_all(); } @@ -580,9 +584,40 @@ public: void free(void* ptr) { os::free(ptr); } }; +template +class RBTreeArenaAllocator { + Arena* _arena; +public: + RBTreeArenaAllocator(Arena* arena) : _arena(arena) {} + + void* allocate(size_t sz) { + return _arena->Amalloc(sz, strategy); + } + void free(void* ptr) { /* NOP */ } +}; + +template +class RBTreeResourceAreaAllocator { + ResourceArea* _rarea; +public: + RBTreeResourceAreaAllocator(ResourceArea* rarea) : _rarea(rarea) {} + void* allocate(size_t sz) { + return _rarea->Amalloc(sz, strategy); + } + void free(void* ptr) { /* NOP */ } +}; + + + template using RBTreeCHeap = RBTree>; +template +using RBTreeArena = RBTree>; + +template +using RBTreeResourceArea = RBTree>; + template using IntrusiveRBTree = AbstractRBTree; diff --git a/test/hotspot/gtest/utilities/test_rbtree.cpp b/test/hotspot/gtest/utilities/test_rbtree.cpp index a351e2141e8..17df34fb07a 100644 --- a/test/hotspot/gtest/utilities/test_rbtree.cpp +++ b/test/hotspot/gtest/utilities/test_rbtree.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 @@ -1252,3 +1252,17 @@ TEST_VM_F(RBTreeTest, AllocatorMayReturnNull) { EXPECT_EQ(false, success); // The test didn't exit the VM, so it was succesful. } + +TEST_VM_F(RBTreeTest, ArenaAllocator) { + Arena arena(mtTest); + RBTreeArena rbtree(&arena); + bool success = rbtree.upsert(5, 5); + ASSERT_EQ(true, success); +} + +TEST_VM_F(RBTreeTest, ResourceAreaAllocator) { + ResourceArea area(mtTest); + RBTreeResourceArea rbtree(&area); + bool success = rbtree.upsert(5, 5); + ASSERT_EQ(true, success); +} From 7019591013d68547a1c46065ebacc6ec1072e2ec Mon Sep 17 00:00:00 2001 From: Jaikiran Pai Date: Tue, 17 Feb 2026 11:13:40 +0000 Subject: [PATCH 71/77] 8377796: java.net.http.HttpClient.send() and sendAsync() never complete when BodyHandler.apply() returns null Reviewed-by: dfuchs, vyazici --- .../jdk/internal/net/http/Http1Exchange.java | 5 +- .../jdk/internal/net/http/MultiExchange.java | 3 +- .../common/HttpBodySubscriberWrapper.java | 3 +- .../NullReturningBodyHandlerTest.java | 240 ++++++++++++++++++ .../test/lib/common/HttpServerAdapters.java | 4 +- 5 files changed, 249 insertions(+), 6 deletions(-) create mode 100644 test/jdk/java/net/httpclient/NullReturningBodyHandlerTest.java diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/Http1Exchange.java b/src/java.net.http/share/classes/jdk/internal/net/http/Http1Exchange.java index 72a47eca42c..006c4b30bea 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/Http1Exchange.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/Http1Exchange.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 @@ -473,11 +473,10 @@ class Http1Exchange extends ExchangeImpl { @Override Http1ResponseBodySubscriber createResponseSubscriber(BodyHandler handler, ResponseInfo response) { - BodySubscriber subscriber = handler.apply(response); var cancelTimerOnTermination = cancelTimerOnResponseBodySubscriberTermination( exchange.request().isWebSocket(), response.statusCode()); - return new Http1ResponseBodySubscriber<>(subscriber, cancelTimerOnTermination, this); + return new Http1ResponseBodySubscriber<>(handler.apply(response), cancelTimerOnTermination, this); } @Override diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java b/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java index 671874b8fb5..670b8cf3c25 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.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 @@ -384,6 +384,7 @@ class MultiExchange implements Cancelable { private CompletableFuture> handleNoBody(Response r, Exchange exch) { BodySubscriber bs = responseHandler.apply(new ResponseInfoImpl(r.statusCode(), r.headers(), r.version())); + Objects.requireNonNull(bs, "BodyHandler returned a null BodySubscriber"); bs.onSubscribe(new NullSubscription()); bs.onComplete(); CompletionStage cs = ResponseSubscribers.getBodyAsync(executor, bs); diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/common/HttpBodySubscriberWrapper.java b/src/java.net.http/share/classes/jdk/internal/net/http/common/HttpBodySubscriberWrapper.java index f1c1f6f2d2a..86a93f67dcd 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/common/HttpBodySubscriberWrapper.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/common/HttpBodySubscriberWrapper.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 @@ -70,6 +70,7 @@ public class HttpBodySubscriberWrapper implements TrustedSubscriber { volatile SubscriptionWrapper subscription; volatile Throwable withError; public HttpBodySubscriberWrapper(BodySubscriber userSubscriber) { + Objects.requireNonNull(userSubscriber, "BodySubscriber"); this.userSubscriber = userSubscriber; } diff --git a/test/jdk/java/net/httpclient/NullReturningBodyHandlerTest.java b/test/jdk/java/net/httpclient/NullReturningBodyHandlerTest.java new file mode 100644 index 00000000000..2b2e6b2135d --- /dev/null +++ b/test/jdk/java/net/httpclient/NullReturningBodyHandlerTest.java @@ -0,0 +1,240 @@ +/* + * 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 java.io.IOException; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpClient.Version; +import java.net.http.HttpOption; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.net.http.HttpResponse.BodyHandler; +import java.net.http.HttpResponse.BodySubscriber; +import java.net.http.HttpResponse.ResponseInfo; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; + +import javax.net.ssl.SSLContext; + +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.common.HttpServerAdapters.HttpTestEchoHandler; +import jdk.httpclient.test.lib.common.HttpServerAdapters.HttpTestServer; +import jdk.test.lib.net.SimpleSSLContext; +import jdk.test.lib.net.URIBuilder; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import static java.net.http.HttpClient.Builder.NO_PROXY; +import static java.net.http.HttpOption.Http3DiscoveryMode.HTTP_3_URI_ONLY; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +/* + * @test + * @bug 8377796 + * @summary Verify that HttpClient.send()/sendAsync() complete exceptionally + * when BodyHandler.apply() returns null + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters + * jdk.test.lib.net.SimpleSSLContext + * jdk.test.lib.net.URIBuilder + * @run junit ${test.main.class} + */ +class NullReturningBodyHandlerTest { + private static final String CTX_PATH = "/" + NullReturningBodyHandlerTest.class.getName(); + + private static final SSLContext sslContext = SimpleSSLContext.findSSLContext(); + private static HttpClient client; + + private static HttpTestServer h1HttpServer; + private static HttpTestServer h1HttpsServer; + + private static HttpTestServer h2HttpServer; + private static HttpTestServer h2HttpsServer; + + private static HttpTestServer h3Server; + + @BeforeAll + static void beforeAll() throws Exception { + h1HttpServer = HttpTestServer.create(Version.HTTP_1_1); + h1HttpServer.addHandler(new HttpTestEchoHandler(false), CTX_PATH); + h1HttpServer.start(); + System.err.println("HTTP/1.1 http server started at " + h1HttpServer.getAddress()); + + h1HttpsServer = HttpTestServer.create(Version.HTTP_1_1, sslContext); + h1HttpsServer.addHandler(new HttpTestEchoHandler(false), CTX_PATH); + h1HttpsServer.start(); + System.err.println("HTTP/1.1 https server started at " + h1HttpsServer.getAddress()); + + h2HttpServer = HttpTestServer.create(Version.HTTP_2); + h2HttpServer.addHandler(new HttpTestEchoHandler(false), CTX_PATH); + h2HttpServer.start(); + System.err.println("HTTP/2 http server started at " + h2HttpServer.getAddress()); + + h2HttpsServer = HttpTestServer.create(Version.HTTP_2, sslContext); + h2HttpsServer.addHandler(new HttpTestEchoHandler(false), CTX_PATH); + h2HttpsServer.start(); + System.err.println("HTTP/2 https server started at " + h2HttpsServer.getAddress()); + + h3Server = HttpTestServer.create(HTTP_3_URI_ONLY, sslContext); + h3Server.addHandler(new HttpTestEchoHandler(false), CTX_PATH); + h3Server.start(); + System.err.println("HTTP/3 server started at " + h3Server.getAddress()); + + client = HttpServerAdapters.createClientBuilderForH3() + .sslContext(sslContext) + .proxy(NO_PROXY) + .build(); + } + + @AfterAll + static void afterAll() throws Exception { + close(h1HttpServer); + close(h1HttpsServer); + + close(h2HttpServer); + close(h2HttpsServer); + + close(h3Server); + + close(client); + } + + private static void close(final AutoCloseable resource) throws Exception { + if (resource == null) { + return; + } + System.err.println("closing " + resource); + resource.close(); + } + + static List params() throws Exception { + final List args = new ArrayList<>(); + + final URI h1HttpsReq = URIBuilder.newBuilder() + .scheme("https") + .host(h1HttpsServer.getAddress().getAddress()) + .port(h1HttpsServer.getAddress().getPort()) + .path(CTX_PATH) + .query("reqVersion=h1") + .build(); + args.add(Arguments.of(h1HttpsReq, Version.HTTP_1_1, false)); + + final URI h1HttpReq = URIBuilder.newBuilder() + .scheme("http") + .host(h1HttpServer.getAddress().getAddress()) + .port(h1HttpServer.getAddress().getPort()) + .path(CTX_PATH) + .query("reqVersion=h1&scheme=http") + .build(); + args.add(Arguments.of(h1HttpReq, Version.HTTP_1_1, false)); + + final URI h2Req = URIBuilder.newBuilder() + .scheme("https") + .host(h2HttpsServer.getAddress().getAddress()) + .port(h2HttpsServer.getAddress().getPort()) + .path(CTX_PATH) + .query("reqVersion=h2") + .build(); + args.add(Arguments.of(h2Req, Version.HTTP_2, false)); + + final URI h2HttpReq = URIBuilder.newBuilder() + .scheme("http") + .host(h2HttpServer.getAddress().getAddress()) + .port(h2HttpServer.getAddress().getPort()) + .path(CTX_PATH) + .query("reqVersion=h2&scheme=http") + .build(); + // test for HTTP/2 upgrade when there are no already established connections + args.add(Arguments.of(h2HttpReq, Version.HTTP_2, false)); + // test for HTTP/2 upgrade when there is an established connection + args.add(Arguments.of(h2HttpReq, Version.HTTP_2, true)); + + final URI h3Req = URIBuilder.newBuilder() + .scheme("https") + .host(h3Server.getAddress().getAddress()) + .port(h3Server.getAddress().getPort()) + .path(CTX_PATH) + .query("reqVersion=h3") + .build(); + args.add(Arguments.of(h3Req, Version.HTTP_3, false)); + return args; + } + + /* + * Issues a HTTP request with a BodyHandler implementation that returns a null + * BodySubscriber. The test then verifies that the request fails and the exception + * that's raised contains the expected NullPointerException (raised due to + * BodyHandler.apply(...) returning null). + */ + @ParameterizedTest + @MethodSource("params") + void test(final URI reqURI, final Version version, + final boolean requiresWarmupHEADRequest) throws Exception { + if (requiresWarmupHEADRequest) { + // the test only issues a warmup request for HTTP/2 requests + assertEquals(Version.HTTP_2, version, "unexpected HTTP version"); + final HttpRequest head = HttpRequest.newBuilder().HEAD() + .version(version) + .uri(reqURI) + .build(); + System.err.println("issuing warmup head request " + head); + HttpResponse headResp = client.send(head, HttpResponse.BodyHandlers.discarding()); + assertEquals(200, headResp.statusCode(), "unexpected status code for HEAD request"); + } + // now run the actual test + final HttpRequest.Builder builder = HttpRequest.newBuilder() + .version(version) + .uri(reqURI); + if (version == Version.HTTP_3) { + builder.setOption(HttpOption.H3_DISCOVERY, HTTP_3_URI_ONLY); + } + final HttpRequest req = builder.build(); + // test synchronous send() + System.err.println("issuing request " + reqURI); + final IOException ioe = assertThrows(IOException.class, + () -> client.send(req, new AlwaysReturnsNull())); + if (!(ioe.getCause() instanceof NullPointerException)) { + throw ioe; // propagate the original exception + } + // now test with sendAsync() + System.err.println("issuing async request " + reqURI); + final Future> f = client.sendAsync(req, new AlwaysReturnsNull()); + final ExecutionException ee = assertThrows(ExecutionException.class, f::get); + if (!(ee.getCause() instanceof IOException cause) + || !(cause.getCause() instanceof NullPointerException)) { + throw ee; // propagate the original exception + } + } + + private static final class AlwaysReturnsNull implements BodyHandler { + @Override + public BodySubscriber apply(final ResponseInfo responseInfo) { + return null; + } + } +} 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 86ea3c8fdcd..b40cef5d4e6 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 @@ -876,6 +876,8 @@ public interface HttpServerAdapters { @Override public void handle(HttpTestExchange t) throws IOException { + System.err.printf("EchoHandler received request to %s from %s (version %s)%n", + t.getRequestURI(), t.getRemoteAddress(), t.getExchangeVersion()); InputStream is = null; OutputStream os = null; try { @@ -895,7 +897,7 @@ public interface HttpServerAdapters { ? t.responseLength(bytes.length) : HttpTestExchange.fixedRsp(bytes.length); t.sendResponseHeaders(200, responseLength); - if (!t.getRequestMethod().equals("HEAD")) { + if (!t.getRequestMethod().equals("HEAD") && bytes.length > 0) { os.write(bytes); } } finally { From 877a7fd617aef1db2736cd1b1f87008857f64142 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Tue, 17 Feb 2026 12:22:10 +0000 Subject: [PATCH 72/77] 8377164: G1: Clean up g1BlockOffsetTable.hpp Reviewed-by: ayang, iwalulya --- .../share/gc/g1/g1BlockOffsetTable.cpp | 11 +++++++--- .../share/gc/g1/g1BlockOffsetTable.hpp | 22 +++---------------- .../share/gc/g1/g1BlockOffsetTable.inline.hpp | 16 +++++++++++--- 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp b/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp index c695ad977fe..fd70796251d 100644 --- a/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp +++ b/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp @@ -24,10 +24,9 @@ #include "gc/g1/g1BlockOffsetTable.inline.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" -#include "gc/g1/g1HeapRegion.inline.hpp" +#include "gc/g1/g1RegionToSpaceMapper.hpp" +#include "gc/shared/memset_with_concurrent_readers.hpp" #include "logging/log.hpp" -#include "oops/oop.inline.hpp" -#include "runtime/java.hpp" #include "runtime/os.hpp" size_t G1BlockOffsetTable::compute_size(size_t mem_region_words) { @@ -52,6 +51,12 @@ void G1BlockOffsetTable::set_offset_array(Atomic* addr, uint8_t offset) addr->store_relaxed(offset); } +static void check_offset(size_t offset, const char* msg) { + assert(offset < CardTable::card_size_in_words(), + "%s - offset: %zu, N_words: %u", + msg, offset, CardTable::card_size_in_words()); +} + 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); diff --git a/src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp b/src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp index 89c68ce96d2..21d447549a6 100644 --- a/src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp +++ b/src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp @@ -37,19 +37,12 @@ // for each such subregion indicates how far back one must go to find the // start of the chunk that includes the first word of the subregion. class G1BlockOffsetTable : public CHeapObj { -private: // The reserved region covered by the table. MemRegion _reserved; // Biased array-start of BOT array for fast BOT entry translation Atomic* _offset_base; - void check_offset(size_t offset, const char* msg) const { - assert(offset < CardTable::card_size_in_words(), - "%s - offset: %zu, N_words: %u", - msg, offset, CardTable::card_size_in_words()); - } - // Bounds checking accessors: // For performance these have to devolve to array accesses in product builds. inline uint8_t offset_array(Atomic* addr) const; @@ -85,7 +78,6 @@ private: } public: - // Return the number of slots needed for an offset array // that covers mem_region_words words. static size_t compute_size(size_t mem_region_words); @@ -99,22 +91,14 @@ public: // in the heap parameter. G1BlockOffsetTable(MemRegion heap, G1RegionToSpaceMapper* storage); - static bool is_crossing_card_boundary(HeapWord* const obj_start, - HeapWord* const obj_end) { - HeapWord* cur_card_boundary = align_up_by_card_size(obj_start); - // strictly greater-than - return obj_end > cur_card_boundary; - } + inline static bool is_crossing_card_boundary(HeapWord* const obj_start, + HeapWord* const obj_end); // Returns the address of the start of the block reaching into the card containing // "addr". inline HeapWord* block_start_reaching_into_card(const void* addr) const; - void update_for_block(HeapWord* blk_start, HeapWord* blk_end) { - if (is_crossing_card_boundary(blk_start, blk_end)) { - update_for_block_work(blk_start, blk_end); - } - } + inline void update_for_block(HeapWord* blk_start, HeapWord* blk_end); }; #endif // SHARE_GC_G1_G1BLOCKOFFSETTABLE_HPP diff --git a/src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp b/src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp index 0d809b65526..b707e310781 100644 --- a/src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp +++ b/src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp @@ -27,10 +27,7 @@ #include "gc/g1/g1BlockOffsetTable.hpp" -#include "gc/g1/g1HeapRegion.hpp" #include "gc/shared/cardTable.hpp" -#include "gc/shared/memset_with_concurrent_readers.hpp" -#include "oops/oop.inline.hpp" inline HeapWord* G1BlockOffsetTable::block_start_reaching_into_card(const void* addr) const { assert(_reserved.contains(addr), "invalid address"); @@ -70,4 +67,17 @@ inline HeapWord* G1BlockOffsetTable::addr_for_entry(const Atomic* const return result; } +inline bool G1BlockOffsetTable::is_crossing_card_boundary(HeapWord* const obj_start, + HeapWord* const obj_end) { + HeapWord* cur_card_boundary = align_up_by_card_size(obj_start); + // strictly greater-than + return obj_end > cur_card_boundary; +} + +inline void G1BlockOffsetTable::update_for_block(HeapWord* blk_start, HeapWord* blk_end) { + if (is_crossing_card_boundary(blk_start, blk_end)) { + update_for_block_work(blk_start, blk_end); + } +} + #endif // SHARE_GC_G1_G1BLOCKOFFSETTABLE_INLINE_HPP From c1e92e0092710fc5daf8507822e5ca3b8c521dbe Mon Sep 17 00:00:00 2001 From: Casper Norrbin Date: Tue, 17 Feb 2026 12:30:21 +0000 Subject: [PATCH 73/77] 8375621: Move RBTree implementation to inline file to minimize included headers Reviewed-by: jsjolen, stefank --- src/hotspot/share/utilities/rbTree.hpp | 328 ++++---------- src/hotspot/share/utilities/rbTree.inline.hpp | 424 +++++++++++++++++- 2 files changed, 498 insertions(+), 254 deletions(-) diff --git a/src/hotspot/share/utilities/rbTree.hpp b/src/hotspot/share/utilities/rbTree.hpp index 84e433a9ce6..89f9eb256bf 100644 --- a/src/hotspot/share/utilities/rbTree.hpp +++ b/src/hotspot/share/utilities/rbTree.hpp @@ -27,11 +27,7 @@ #include "cppstdlib/type_traits.hpp" #include "memory/allocation.hpp" -#include "memory/arena.hpp" -#include "memory/resourceArea.hpp" -#include "metaprogramming/enableIf.hpp" #include "nmt/memTag.hpp" -#include "runtime/os.hpp" #include "utilities/globalDefinitions.hpp" // An intrusive red-black tree is constructed with two template parameters: @@ -67,8 +63,9 @@ enum class RBTreeOrdering : int { LT, EQ, GT }; template class AbstractRBTree; - +class Arena; class outputStream; +class ResourceArea; class IntrusiveRBNode { template @@ -84,7 +81,7 @@ class IntrusiveRBNode { DEBUG_ONLY(mutable bool _visited); public: - IntrusiveRBNode() : _parent(0), _left(nullptr), _right(nullptr) DEBUG_ONLY(COMMA _visited(false)) {} + IntrusiveRBNode(); // Gets the previous in-order node in the tree. // nullptr is returned if there is no previous node. @@ -99,22 +96,18 @@ public: void print_on(outputStream* st, int depth = 0) const; private: - bool is_black() const { return (_parent & 0x1) != 0; } - bool is_red() const { return (_parent & 0x1) == 0; } + bool is_black() const; + bool is_red() const; - void set_black() { _parent |= 0x1; } - void set_red() { _parent &= ~0x1; } + void set_black(); + void set_red(); - IntrusiveRBNode* parent() const { return (IntrusiveRBNode*)(_parent & ~0x1); } - void set_parent(IntrusiveRBNode* new_parent) { _parent = (_parent & 0x1) | (uintptr_t)new_parent; } + IntrusiveRBNode* parent() const; + void set_parent(IntrusiveRBNode* new_parent); - bool is_right_child() const { - return parent() != nullptr && parent()->_right == this; - } + bool is_right_child() const; - bool is_left_child() const { - return parent() != nullptr && parent()->_left == this; - } + bool is_left_child() const; void replace_child(IntrusiveRBNode* old_child, IntrusiveRBNode* new_child); @@ -145,20 +138,20 @@ private: V _value; public: - const K& key() const { return _key; } + const K& key() const; - V& val() { return _value; } - const V& val() const { return _value; } - void set_val(const V& v) { _value = v; } + V& val(); + const V& val() const; + void set_val(const V& v); - RBNode() {} - RBNode(const K& key) : IntrusiveRBNode(), _key(key) {} - RBNode(const K& key, const V& val) : IntrusiveRBNode(), _key(key), _value(val) {} + RBNode(); + RBNode(const K& key); + RBNode(const K& key, const V& val); - const RBNode* prev() const { return (RBNode*)IntrusiveRBNode::prev(); } - const RBNode* next() const { return (RBNode*)IntrusiveRBNode::next(); } - RBNode* prev() { return (RBNode*)IntrusiveRBNode::prev(); } - RBNode* next() { return (RBNode*)IntrusiveRBNode::next(); } + const RBNode* prev() const; + const RBNode* next() const; + RBNode* prev(); + RBNode* next(); void print_on(outputStream* st, int depth = 0) const; @@ -179,17 +172,15 @@ public: friend AbstractRBTree; NodeType** _insert_location; NodeType* _parent; - Cursor() : _insert_location(nullptr), _parent(nullptr) {} - Cursor(NodeType** insert_location, NodeType* parent) - : _insert_location(insert_location), _parent(parent) {} - Cursor(NodeType* const* insert_location, NodeType* parent) - : _insert_location((NodeType**)insert_location), _parent(parent) {} + Cursor(); + Cursor(NodeType** insert_location, NodeType* parent); + Cursor(NodeType* const* insert_location, NodeType* parent); public: - bool valid() const { return _insert_location != nullptr; } - bool found() const { return *_insert_location != nullptr; } - NodeType* node() { return _insert_location == nullptr ? nullptr : *_insert_location; } - NodeType* node() const { return _insert_location == nullptr ? nullptr : *_insert_location; } + bool valid() const; + bool found() const; + NodeType* node(); + NodeType* node() const; }; protected: @@ -215,36 +206,16 @@ private: static constexpr bool HasNodeVerifier = HasNodeVerifierImpl::value; - RBTreeOrdering cmp(const K& a, const NodeType* b) const { - if constexpr (HasNodeComparator) { - return COMPARATOR::cmp(a, b); - } else if constexpr (HasKeyComparator) { - return COMPARATOR::cmp(a, b->key()); - } - } + RBTreeOrdering cmp(const K& a, const NodeType* b) const; - bool less_than(const NodeType* a, const NodeType* b) const { - if constexpr (HasNodeVerifier) { - return COMPARATOR::less_than(a, b); - } else { - return true; - } - } + bool less_than(const NodeType* a, const NodeType* b) const; - void assert_key_leq(K a, K b) const { - if constexpr (HasKeyComparator) { // Cannot assert if no key comparator exist. - assert(COMPARATOR::cmp(a, b) != RBTreeOrdering::GT, "key a must be less or equal to key b"); - } - } + void assert_key_leq(K a, K b) const; // True if node is black (nil nodes count as black) - static inline bool is_black(const IntrusiveRBNode* node) { - return node == nullptr || node->is_black(); - } + static inline bool is_black(const IntrusiveRBNode* node); - static inline bool is_red(const IntrusiveRBNode* node) { - return node != nullptr && node->is_red(); - } + static inline bool is_red(const IntrusiveRBNode* node); void fix_insert_violations(IntrusiveRBNode* node); @@ -254,18 +225,14 @@ private: void remove_from_tree(IntrusiveRBNode* node); struct empty_verifier { - bool operator()(const NodeType* n) const { - return true; - } + bool operator()(const NodeType* n) const; }; template void verify_self(NODE_VERIFIER verifier, const USER_VERIFIER& extra_verifier) const; struct default_printer { - void operator()(outputStream* st, const NodeType* n, int depth) const { - n->print_on(st, depth); - } + void operator()(outputStream* st, const NodeType* n, int depth) const; }; template @@ -274,12 +241,9 @@ private: public: NONCOPYABLE(AbstractRBTree); - AbstractRBTree() : _num_nodes(0), _root(nullptr) DEBUG_ONLY(COMMA _expected_visited(false)) { - static_assert(std::is_trivially_destructible::value, "key type must be trivially destructable"); - static_assert(HasKeyComparator || HasNodeComparator, "comparator must be of correct type"); - } + AbstractRBTree(); - size_t size() const { return _num_nodes; } + size_t size() const; // Gets the cursor associated with the given node or key. Cursor cursor(const K& key, const NodeType* hint_node = nullptr); @@ -314,87 +278,39 @@ public: void replace_at_cursor(NodeType* new_node, const Cursor& node_cursor); // Finds the node associated with the given key. - NodeType* find_node(const K& key, const NodeType* hint_node = nullptr) const { - Cursor node_cursor = cursor(key, hint_node); - return node_cursor.node(); - } - - NodeType* find_node(const K& key, const NodeType* hint_node = nullptr) { - Cursor node_cursor = cursor(key, hint_node); - return node_cursor.node(); - } + NodeType* find_node(const K& key, const NodeType* hint_node = nullptr); + NodeType* find_node(const K& key, const NodeType* hint_node = nullptr) const; // Inserts the given node into the tree. - void insert(const K& key, NodeType* node, const NodeType* hint_node = nullptr) { - Cursor node_cursor = cursor(key, hint_node); - insert_at_cursor(node, node_cursor); - } + void insert(const K& key, NodeType* node, const NodeType* hint_node = nullptr); - void remove(NodeType* node) { - Cursor node_cursor = cursor(node); - remove_at_cursor(node_cursor); - } + // Removes the given node from the tree. + void remove(NodeType* node); // Finds the node with the closest key <= the given key. // If no node is found, null is returned instead. - NodeType* closest_leq(const K& key) const { - Cursor node_cursor = cursor(key); - return node_cursor.found() ? node_cursor.node() : prev(node_cursor).node(); - } - - NodeType* closest_leq(const K& key) { - Cursor node_cursor = cursor(key); - return node_cursor.found() ? node_cursor.node() : prev(node_cursor).node(); - } + NodeType* closest_leq(const K& key); + NodeType* closest_leq(const K& key) const; // Finds the node with the closest key > the given key. // If no node is found, null is returned instead. - NodeType* closest_gt(const K& key) const { - Cursor node_cursor = cursor(key); - return next(node_cursor).node(); - } - - NodeType* closest_gt(const K& key) { - Cursor node_cursor = cursor(key); - return next(node_cursor).node(); - } + NodeType* closest_gt(const K& key); + NodeType* closest_gt(const K& key) const; // Finds the node with the closest key >= the given key. // If no node is found, null is returned instead. - NodeType* closest_ge(const K& key) const { - Cursor node_cursor = cursor(key); - return node_cursor.found() ? node_cursor.node() : next(node_cursor).node(); - } - - NodeType* closest_ge(const K& key) { - Cursor node_cursor = cursor(key); - return node_cursor.found() ? node_cursor.node() : next(node_cursor).node(); - } + NodeType* closest_ge(const K& key); + NodeType* closest_ge(const K& key) const; // Returns leftmost node, nullptr if tree is empty. // If COMPARATOR::cmp(a, b) behaves canonically (positive value for a > b), this will the smallest key value. - const NodeType* leftmost() const { - IntrusiveRBNode* n = _root, *n2 = nullptr; - while (n != nullptr) { - n2 = n; - n = n->_left; - } - return (NodeType*)n2; - } + NodeType* leftmost(); + const NodeType* leftmost() const; // Returns rightmost node, nullptr if tree is empty. // If COMPARATOR::cmp(a, b) behaves canonically (positive value for a > b), this will the largest key value. - const NodeType* rightmost() const { - IntrusiveRBNode* n = _root, *n2 = nullptr; - while (n != nullptr) { - n2 = n; - n = n->_right; - } - return (NodeType*)n2; - } - - NodeType* leftmost() { return const_cast(static_cast(this)->leftmost()); } - NodeType* rightmost() { return const_cast(static_cast(this)->rightmost()); } + NodeType* rightmost(); + const NodeType* rightmost() const; struct Range { NodeType* start; @@ -406,11 +322,7 @@ public: // Return the range [start, end) // where start->key() <= addr < end->key(). // Failure to find the range leads to start and/or end being null. - Range find_enclosing_range(K key) const { - NodeType* start = closest_leq(key); - NodeType* end = closest_gt(key); - return Range(start, end); - } + Range find_enclosing_range(K key) const; // Visit all RBNodes in ascending order, calling f on each node. // If f returns `true` the iteration continues, otherwise it is stopped at the current node. @@ -420,7 +332,6 @@ public: template void visit_in_order(F f); - // Visit all RBNodes in ascending order whose keys are in range [from, to], calling f on each node. // If f returns `true` the iteration continues, otherwise it is stopped at the current node. template @@ -436,15 +347,7 @@ public: // This should return true if the node is valid. // If provided, each node is also verified through this callable. template - void verify_self(const USER_VERIFIER& extra_verifier = USER_VERIFIER()) const { - if constexpr (HasNodeVerifier) { - verify_self([](const NodeType* a, const NodeType* b){ return COMPARATOR::less_than(a, b);}, extra_verifier); - } else if constexpr (HasKeyComparator) { - verify_self([](const NodeType* a, const NodeType* b){ return COMPARATOR::cmp(a->key(), b->key()) == RBTreeOrdering::LT; }, extra_verifier); - } else { - verify_self([](const NodeType*, const NodeType*){ return true;}, extra_verifier); - } - } + void verify_self(const USER_VERIFIER& extra_verifier = USER_VERIFIER()) const; // Accepts an optional printing callable `void node_printer(outputStream* st, const Node* n, int depth)`. // If provided, each node is printed through this callable rather than the default `print_on`. @@ -462,9 +365,9 @@ class RBTree : public AbstractRBTree, COMPARATOR> { public: template - RBTree(AllocArgs... alloc_args) : BaseType(), _allocator(alloc_args...) {} + RBTree(AllocArgs... alloc_args); + ~RBTree(); NONCOPYABLE(RBTree); - ~RBTree() { remove_all(); } bool copy_into(RBTree& other) const; @@ -475,136 +378,55 @@ public: using BaseType::next; using BaseType::prev; - void replace_at_cursor(RBNode* new_node, const Cursor& node_cursor) { - RBNode* old_node = node_cursor.node(); - BaseType::replace_at_cursor(new_node, node_cursor); - free_node(old_node); - } + void replace_at_cursor(RBNode* new_node, const Cursor& node_cursor); - RBNode* allocate_node(const K& key) { - void* node_place = _allocator.allocate(sizeof(RBNode)); - if (node_place == nullptr) { - return nullptr; - } - return new (node_place) RBNode(key); - } + RBNode* allocate_node(const K& key); + RBNode* allocate_node(const K& key, const V& val); - RBNode* allocate_node(const K& key, const V& val) { - void* node_place = _allocator.allocate(sizeof(RBNode)); - if (node_place == nullptr) { - return nullptr; - } - return new (node_place) RBNode(key, val); - } - - void free_node(RBNode* node) { - node->_value.~V(); - _allocator.free(node); - } + void free_node(RBNode* node); // Inserts a node with the given key/value into the tree, // if the key already exist, the value is updated instead. // Returns false if and only if allocation of a new node failed. - bool upsert(const K& key, const V& val, const RBNode* hint_node = nullptr) { - Cursor node_cursor = cursor(key, hint_node); - RBNode* node = node_cursor.node(); - if (node != nullptr) { - node->set_val(val); - return true; - } - - node = allocate_node(key, val); - if (node == nullptr) { - return false; - } - insert_at_cursor(node, node_cursor); - return true; - } + bool upsert(const K& key, const V& val, const RBNode* hint_node = nullptr); // Finds the value of the node associated with the given key. - V* find(const K& key) { - Cursor node_cursor = cursor(key); - return node_cursor.found() ? &node_cursor.node()->_value : nullptr; - } + V* find(const K& key); + V* find(const K& key) const; - V* find(const K& key) const { - const Cursor node_cursor = cursor(key); - return node_cursor.found() ? &node_cursor.node()->_value : nullptr; - } - - void remove(RBNode* node) { - Cursor node_cursor = cursor(node); - remove_at_cursor(node_cursor); - free_node(node); - } + void remove(RBNode* node); // Removes the node with the given key from the tree if it exists. // Returns true if the node was successfully removed, false otherwise. - bool remove(const K& key) { - Cursor node_cursor = cursor(key); - if (!node_cursor.found()) { - return false; - } - RBNode* node = node_cursor.node(); - remove_at_cursor(node_cursor); - free_node((RBNode*)node); - return true; - } + bool remove(const K& key); // Removes all existing nodes from the tree. - void remove_all() { - IntrusiveRBNode* to_delete[64]; - int stack_idx = 0; - to_delete[stack_idx++] = BaseType::_root; - - while (stack_idx > 0) { - IntrusiveRBNode* head = to_delete[--stack_idx]; - if (head == nullptr) continue; - to_delete[stack_idx++] = head->_left; - to_delete[stack_idx++] = head->_right; - free_node((RBNode*)head); - } - BaseType::_num_nodes = 0; - BaseType::_root = nullptr; - } + void remove_all(); }; template class RBTreeCHeapAllocator { public: - void* allocate(size_t sz) { - void* allocation = os::malloc(sz, mem_tag); - if (allocation == nullptr && strategy == AllocFailStrategy::EXIT_OOM) { - vm_exit_out_of_memory(sz, OOM_MALLOC_ERROR, - "red-black tree failed allocation"); - } - return allocation; - } - - void free(void* ptr) { os::free(ptr); } + void* allocate(size_t sz); + void free(void* ptr); }; template class RBTreeArenaAllocator { Arena* _arena; public: - RBTreeArenaAllocator(Arena* arena) : _arena(arena) {} - - void* allocate(size_t sz) { - return _arena->Amalloc(sz, strategy); - } - void free(void* ptr) { /* NOP */ } + RBTreeArenaAllocator(Arena* arena); + void* allocate(size_t sz); + void free(void* ptr); }; template class RBTreeResourceAreaAllocator { ResourceArea* _rarea; public: - RBTreeResourceAreaAllocator(ResourceArea* rarea) : _rarea(rarea) {} - void* allocate(size_t sz) { - return _rarea->Amalloc(sz, strategy); - } - void free(void* ptr) { /* NOP */ } + RBTreeResourceAreaAllocator(ResourceArea* rarea); + void* allocate(size_t sz); + void free(void* ptr); }; diff --git a/src/hotspot/share/utilities/rbTree.inline.hpp b/src/hotspot/share/utilities/rbTree.inline.hpp index 6e01f92d12a..ed8884b2d27 100644 --- a/src/hotspot/share/utilities/rbTree.inline.hpp +++ b/src/hotspot/share/utilities/rbTree.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 @@ -27,12 +27,49 @@ #include "utilities/rbTree.hpp" +#include "memory/allocation.hpp" +#include "memory/arena.hpp" +#include "memory/resourceArea.hpp" #include "metaprogramming/enableIf.hpp" #include "utilities/debug.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/ostream.hpp" #include "utilities/powerOfTwo.hpp" +inline IntrusiveRBNode::IntrusiveRBNode() + : _parent(0), _left(nullptr), _right(nullptr) DEBUG_ONLY(COMMA _visited(false)) {} + +inline bool IntrusiveRBNode::is_black() const { + return (_parent & 0x1) != 0; +} + +inline bool IntrusiveRBNode::is_red() const { + return (_parent & 0x1) == 0; +} + +inline void IntrusiveRBNode::set_black() { + _parent |= 0x1; +} +inline void IntrusiveRBNode::set_red() { + _parent &= ~0x1; +} + +inline IntrusiveRBNode* IntrusiveRBNode::parent() const { + return reinterpret_cast(_parent & ~0x1); +} + +inline void IntrusiveRBNode::set_parent(IntrusiveRBNode* new_parent) { + _parent = (_parent & 0x1) | reinterpret_cast(new_parent); +} + +inline bool IntrusiveRBNode::is_right_child() const { + return parent() != nullptr && parent()->_right == this; +} + +inline bool IntrusiveRBNode::is_left_child() const { + return parent() != nullptr && parent()->_left == this; +} + inline void IntrusiveRBNode::replace_child(IntrusiveRBNode* old_child, IntrusiveRBNode* new_child) { if (_left == old_child) { _left = new_child; @@ -185,6 +222,144 @@ inline void IntrusiveRBNode::verify( } +template +inline const K& RBNode::key() const { + return _key; +} + +template +inline V& RBNode::val() { + return _value; +} + +template +inline const V& RBNode::val() const { + return _value; +} + +template +inline void RBNode::set_val(const V& v) { + _value = v; +} + +template +inline RBNode::RBNode() {} + +template +inline RBNode::RBNode(const K& key) : IntrusiveRBNode(), _key(key) {} + +template +inline RBNode::RBNode(const K& key, const V& val) : IntrusiveRBNode(), _key(key), _value(val) {} + +template +inline const RBNode* RBNode::prev() const { + return static_cast*>(IntrusiveRBNode::prev()); +} + +template +inline const RBNode* RBNode::next() const { + return static_cast*>(IntrusiveRBNode::next()); +} + +template +inline RBNode* RBNode::prev() { + return static_cast*>(IntrusiveRBNode::prev()); +} + +template +inline RBNode* RBNode::next() { + return static_cast*>(IntrusiveRBNode::next()); +} + +template +inline AbstractRBTree::Cursor::Cursor() + : _insert_location(nullptr), _parent(nullptr) {} + +template +inline AbstractRBTree::Cursor::Cursor(NodeType** insert_location, NodeType* parent) + : _insert_location(insert_location), _parent(parent) {} + +template +inline AbstractRBTree::Cursor::Cursor(NodeType* const* insert_location, NodeType* parent) + : _insert_location(const_cast(insert_location)), _parent(parent) {} + +template +inline bool AbstractRBTree::Cursor::valid() const { + return _insert_location != nullptr; +} + +template +inline bool AbstractRBTree::Cursor::found() const { + return *_insert_location != nullptr; +} + +template +inline NodeType* AbstractRBTree::Cursor::node() { + return _insert_location == nullptr ? nullptr : *_insert_location; +} + +template +inline NodeType* AbstractRBTree::Cursor::node() const { + return _insert_location == nullptr ? nullptr : *_insert_location; +} + +template +inline RBTreeOrdering AbstractRBTree::cmp(const K& a, const NodeType* b) const { + if constexpr (HasNodeComparator) { + return COMPARATOR::cmp(a, b); + } else if constexpr (HasKeyComparator) { + return COMPARATOR::cmp(a, b->key()); + } +} + +template +inline bool AbstractRBTree::less_than(const NodeType* a, const NodeType* b) const { + if constexpr (HasNodeVerifier) { + return COMPARATOR::less_than(a, b); + } else { + return true; + } +} + +template +inline void AbstractRBTree::assert_key_leq(K a, K b) const { + if constexpr (HasKeyComparator) { // Cannot assert if no key comparator exist. + assert(COMPARATOR::cmp(a, b) != RBTreeOrdering::GT, "key a must be less or equal to key b"); + } +} + +template +inline bool AbstractRBTree::is_black(const IntrusiveRBNode* node) { + return node == nullptr || node->is_black(); +} + +template +inline bool AbstractRBTree::is_red(const IntrusiveRBNode* node) { + return node != nullptr && node->is_red(); +} + +template +inline bool AbstractRBTree::empty_verifier::operator()(const NodeType* n) const { + return true; +} + +template +inline void AbstractRBTree::default_printer::operator()(outputStream* st, const NodeType* n, int depth) const { + n->print_on(st, depth); +} + +template +inline AbstractRBTree::AbstractRBTree() + : _num_nodes(0), _root(nullptr) DEBUG_ONLY(COMMA _expected_visited(false)) { + static_assert(std::is_trivially_destructible::value, "key type must be trivially destructable"); + static_assert(HasKeyComparator || HasNodeComparator, "comparator must be of correct type"); +} + +template +inline size_t AbstractRBTree::size() const { + return _num_nodes; +} + template inline const typename AbstractRBTree::Cursor AbstractRBTree::cursor(const K& key, const NodeType* hint_node) const { @@ -596,6 +771,104 @@ AbstractRBTree::prev(const Cursor& node_cursor) { return static_cast*>(this)->prev(node_cursor); } +template +inline NodeType* AbstractRBTree::find_node(const K& key, const NodeType* hint_node) const { + Cursor node_cursor = cursor(key, hint_node); + return node_cursor.node(); +} + +template +inline NodeType* AbstractRBTree::find_node(const K& key, const NodeType* hint_node) { + Cursor node_cursor = cursor(key, hint_node); + return node_cursor.node(); +} + +template +inline void AbstractRBTree::insert(const K& key, NodeType* node, const NodeType* hint_node) { + Cursor node_cursor = cursor(key, hint_node); + insert_at_cursor(node, node_cursor); +} + +template +inline void AbstractRBTree::remove(NodeType* node) { + Cursor node_cursor = cursor(node); + remove_at_cursor(node_cursor); +} + +template +inline NodeType* AbstractRBTree::closest_leq(const K& key) const { + Cursor node_cursor = cursor(key); + return node_cursor.found() ? node_cursor.node() : prev(node_cursor).node(); +} + +template +inline NodeType* AbstractRBTree::closest_leq(const K& key) { + Cursor node_cursor = cursor(key); + return node_cursor.found() ? node_cursor.node() : prev(node_cursor).node(); +} + +template +inline NodeType* AbstractRBTree::closest_gt(const K& key) const { + Cursor node_cursor = cursor(key); + return next(node_cursor).node(); +} + +template +inline NodeType* AbstractRBTree::closest_gt(const K& key) { + Cursor node_cursor = cursor(key); + return next(node_cursor).node(); +} + +template +inline NodeType* AbstractRBTree::closest_ge(const K& key) const { + Cursor node_cursor = cursor(key); + return node_cursor.found() ? node_cursor.node() : next(node_cursor).node(); +} + +template +inline NodeType* AbstractRBTree::closest_ge(const K& key) { + Cursor node_cursor = cursor(key); + return node_cursor.found() ? node_cursor.node() : next(node_cursor).node(); +} + +template +inline const NodeType* AbstractRBTree::leftmost() const { + IntrusiveRBNode* n = _root, *n2 = nullptr; + while (n != nullptr) { + n2 = n; + n = n->_left; + } + return static_cast(n2); +} + +template +inline const NodeType* AbstractRBTree::rightmost() const { + IntrusiveRBNode* n = _root, *n2 = nullptr; + while (n != nullptr) { + n2 = n; + n = n->_right; + } + return static_cast(n2); +} + +template +inline NodeType* AbstractRBTree::leftmost() { + return const_cast(static_cast*>(this)->leftmost()); +} + +template +inline NodeType* AbstractRBTree::rightmost() { + return const_cast(static_cast*>(this)->rightmost()); +} + +template +inline typename AbstractRBTree::Range +AbstractRBTree::find_enclosing_range(K key) const { + NodeType* start = closest_leq(key); + NodeType* end = closest_gt(key); + return Range(start, end); +} + template template inline void AbstractRBTree::visit_in_order(F f) const { @@ -662,6 +935,18 @@ inline void AbstractRBTree::visit_range_in_order(const } } +template +template +inline void AbstractRBTree::verify_self(const USER_VERIFIER& extra_verifier) const { + if constexpr (HasNodeVerifier) { + verify_self([](const NodeType* a, const NodeType* b){ return COMPARATOR::less_than(a, b);}, extra_verifier); + } else if constexpr (HasKeyComparator) { + verify_self([](const NodeType* a, const NodeType* b){ return COMPARATOR::cmp(a->key(), b->key()) == RBTreeOrdering::LT; }, extra_verifier); + } else { + verify_self([](const NodeType*, const NodeType*){ return true;}, extra_verifier); + } +} + template template inline void AbstractRBTree::verify_self(NODE_VERIFIER verifier, const USER_VERIFIER& extra_verifier) const { @@ -753,6 +1038,15 @@ void AbstractRBTree::print_on(outputStream* st, const P } } +template +template +inline RBTree::RBTree(AllocArgs... alloc_args) : BaseType(), _allocator(alloc_args...) {} + +template +inline RBTree::~RBTree() { + remove_all(); +} + template bool RBTree::copy_into(RBTree& other) const { assert(other.size() == 0, "You can only copy into an empty RBTree"); @@ -802,4 +1096,132 @@ bool RBTree::copy_into(RBTree& other) const { return true; } +template +inline void RBTree::replace_at_cursor(RBNode* new_node, const Cursor& node_cursor) { + RBNode* old_node = node_cursor.node(); + BaseType::replace_at_cursor(new_node, node_cursor); + free_node(old_node); +} + +template +inline RBNode* RBTree::allocate_node(const K& key) { + void* node_place = _allocator.allocate(sizeof(RBNode)); + if (node_place == nullptr) { + return nullptr; + } + return new (node_place) RBNode(key); +} + +template +inline RBNode* RBTree::allocate_node(const K& key, const V& val) { + void* node_place = _allocator.allocate(sizeof(RBNode)); + if (node_place == nullptr) { + return nullptr; + } + return new (node_place) RBNode(key, val); +} + +template +inline void RBTree::free_node(RBNode* node) { + node->_value.~V(); + _allocator.free(node); +} + +template +inline bool RBTree::upsert(const K& key, const V& val, const RBNode* hint_node) { + Cursor node_cursor = cursor(key, hint_node); + RBNode* node = node_cursor.node(); + if (node != nullptr) { + node->set_val(val); + return true; + } + + node = allocate_node(key, val); + if (node == nullptr) { + return false; + } + insert_at_cursor(node, node_cursor); + return true; +} + +template +inline V* RBTree::find(const K& key) { + Cursor node_cursor = cursor(key); + return node_cursor.found() ? &node_cursor.node()->_value : nullptr; +} + +template +inline V* RBTree::find(const K& key) const { + const Cursor node_cursor = cursor(key); + return node_cursor.found() ? &node_cursor.node()->_value : nullptr; +} + +template +inline void RBTree::remove(RBNode* node) { + Cursor node_cursor = cursor(node); + remove_at_cursor(node_cursor); + free_node(node); +} + +template +inline bool RBTree::remove(const K& key) { + Cursor node_cursor = cursor(key); + if (!node_cursor.found()) { + return false; + } + RBNode* node = node_cursor.node(); + remove_at_cursor(node_cursor); + free_node((RBNode*)node); + return true; +} + +template +inline void RBTree::remove_all() { + IntrusiveRBNode* to_delete[64]; + int stack_idx = 0; + to_delete[stack_idx++] = BaseType::_root; + + while (stack_idx > 0) { + IntrusiveRBNode* head = to_delete[--stack_idx]; + if (head == nullptr) continue; + to_delete[stack_idx++] = head->_left; + to_delete[stack_idx++] = head->_right; + free_node((RBNode*)head); + } + BaseType::_num_nodes = 0; + BaseType::_root = nullptr; +} + +template +inline void* RBTreeCHeapAllocator::allocate(size_t sz) { + return AllocateHeap(sz, mem_tag, strategy); +} + +template +inline void RBTreeCHeapAllocator::free(void* ptr) { + FreeHeap(ptr); +} + +template +inline RBTreeArenaAllocator::RBTreeArenaAllocator(Arena* arena) : _arena(arena) {} + +template +inline void* RBTreeArenaAllocator::allocate(size_t sz) { + return _arena->Amalloc(sz, strategy); +} + +template +inline void RBTreeArenaAllocator::free(void* ptr) { /* NOP */ } + +template +inline RBTreeResourceAreaAllocator::RBTreeResourceAreaAllocator(ResourceArea* rarea) : _rarea(rarea) {} + +template +inline void* RBTreeResourceAreaAllocator::allocate(size_t sz) { + return _rarea->Amalloc(sz, strategy); +} + +template +inline void RBTreeResourceAreaAllocator::free(void* ptr) { /* NOP */ } + #endif // SHARE_UTILITIES_RBTREE_INLINE_HPP From 0705fe94a70fae0b1639ab8fb11670eda4971574 Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Tue, 17 Feb 2026 13:05:39 +0000 Subject: [PATCH 74/77] 8377413: [MacOS aarch64] guarantee(StressWXHealing) failed: We should not reach here unless StressWXHealing Co-authored-by: Dean Long Reviewed-by: mdoerr, aph --- src/hotspot/share/code/codeBlob.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hotspot/share/code/codeBlob.cpp b/src/hotspot/share/code/codeBlob.cpp index 094b4f82cf0..fcc0b42a461 100644 --- a/src/hotspot/share/code/codeBlob.cpp +++ b/src/hotspot/share/code/codeBlob.cpp @@ -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 @@ -336,6 +336,7 @@ RuntimeBlob::RuntimeBlob( void RuntimeBlob::free(RuntimeBlob* blob) { assert(blob != nullptr, "caller must check for nullptr"); + MACOS_AARCH64_ONLY(os::thread_wx_enable_write()); ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock blob->purge(); { From 7efcea9c84e89948ce2153350f7681ad418c98e8 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Tue, 17 Feb 2026 13:10:06 +0000 Subject: [PATCH 75/77] 8377008: [REDO] G1: Convert remaining volatiles in G1ConcurrentMark to Atomic Reviewed-by: iwalulya, sjohanss, kbarrett --- src/hotspot/share/gc/g1/g1ConcurrentMark.cpp | 72 +++++++++++-------- src/hotspot/share/gc/g1/g1ConcurrentMark.hpp | 32 ++++----- .../share/gc/g1/g1ConcurrentMark.inline.hpp | 14 ++-- .../share/gc/g1/g1RegionMarkStatsCache.hpp | 2 + .../gc/g1/g1YoungGCPostEvacuateTasks.cpp | 4 -- 5 files changed, 66 insertions(+), 58 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp index 8f3cafe1f5b..c739907e2b4 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp @@ -24,6 +24,7 @@ #include "classfile/classLoaderData.hpp" #include "classfile/classLoaderDataGraph.hpp" +#include "cppstdlib/new.hpp" #include "gc/g1/g1BarrierSet.hpp" #include "gc/g1/g1BatchedTask.hpp" #include "gc/g1/g1CardSetMemory.hpp" @@ -519,8 +520,8 @@ G1ConcurrentMark::G1ConcurrentMark(G1CollectedHeap* g1h, _max_concurrent_workers(0), _region_mark_stats(NEW_C_HEAP_ARRAY(G1RegionMarkStats, _g1h->max_num_regions(), mtGC)), - _top_at_mark_starts(NEW_C_HEAP_ARRAY(HeapWord*, _g1h->max_num_regions(), mtGC)), - _top_at_rebuild_starts(NEW_C_HEAP_ARRAY(HeapWord*, _g1h->max_num_regions(), mtGC)), + _top_at_mark_starts(NEW_C_HEAP_ARRAY(Atomic, _g1h->max_num_regions(), mtGC)), + _top_at_rebuild_starts(NEW_C_HEAP_ARRAY(Atomic, _g1h->max_num_regions(), mtGC)), _needs_remembered_set_rebuild(false) { assert(G1CGC_lock != nullptr, "CGC_lock must be initialized"); @@ -564,6 +565,12 @@ void G1ConcurrentMark::fully_initialize() { _tasks[i] = new G1CMTask(i, this, task_queue, _region_mark_stats); } + for (uint i = 0; i < _g1h->max_num_regions(); i++) { + ::new (&_region_mark_stats[i]) G1RegionMarkStats{}; + ::new (&_top_at_mark_starts[i]) Atomic{}; + ::new (&_top_at_rebuild_starts[i]) Atomic{}; + } + reset_at_marking_complete(); } @@ -576,7 +583,7 @@ PartialArrayStateManager* G1ConcurrentMark::partial_array_state_manager() const } void G1ConcurrentMark::reset() { - _has_aborted = false; + _has_aborted.store_relaxed(false); reset_marking_for_restart(); @@ -588,7 +595,7 @@ void G1ConcurrentMark::reset() { uint max_num_regions = _g1h->max_num_regions(); for (uint i = 0; i < max_num_regions; i++) { - _top_at_rebuild_starts[i] = nullptr; + _top_at_rebuild_starts[i].store_relaxed(nullptr); _region_mark_stats[i].clear(); } @@ -600,7 +607,7 @@ void G1ConcurrentMark::clear_statistics(G1HeapRegion* r) { for (uint j = 0; j < _max_num_tasks; ++j) { _tasks[j]->clear_mark_stats_cache(region_idx); } - _top_at_rebuild_starts[region_idx] = nullptr; + _top_at_rebuild_starts[region_idx].store_relaxed(nullptr); _region_mark_stats[region_idx].clear(); } @@ -636,7 +643,7 @@ void G1ConcurrentMark::reset_marking_for_restart() { } clear_has_overflown(); - _finger = _heap.start(); + _finger.store_relaxed(_heap.start()); for (uint i = 0; i < _max_num_tasks; ++i) { _tasks[i]->reset_for_restart(); @@ -657,14 +664,14 @@ void G1ConcurrentMark::set_concurrency(uint active_tasks) { void G1ConcurrentMark::set_concurrency_and_phase(uint active_tasks, bool concurrent) { set_concurrency(active_tasks); - _concurrent = concurrent; + _concurrent.store_relaxed(concurrent); if (!concurrent) { // At this point we should be in a STW phase, and completed marking. assert_at_safepoint_on_vm_thread(); assert(out_of_regions(), "only way to get here: _finger: " PTR_FORMAT ", _heap_end: " PTR_FORMAT, - p2i(_finger), p2i(_heap.end())); + p2i(finger()), p2i(_heap.end())); } } @@ -695,8 +702,8 @@ void G1ConcurrentMark::reset_at_marking_complete() { } G1ConcurrentMark::~G1ConcurrentMark() { - FREE_C_HEAP_ARRAY(HeapWord*, _top_at_mark_starts); - FREE_C_HEAP_ARRAY(HeapWord*, _top_at_rebuild_starts); + FREE_C_HEAP_ARRAY(Atomic, _top_at_mark_starts); + FREE_C_HEAP_ARRAY(Atomic, _top_at_rebuild_starts); FREE_C_HEAP_ARRAY(G1RegionMarkStats, _region_mark_stats); // The G1ConcurrentMark instance is never freed. ShouldNotReachHere(); @@ -921,6 +928,8 @@ public: bool do_heap_region(G1HeapRegion* r) override { if (r->is_old_or_humongous() && !r->is_collection_set_candidate() && !r->in_collection_set()) { _cm->update_top_at_mark_start(r); + } else { + _cm->reset_top_at_mark_start(r); } return false; } @@ -1163,7 +1172,7 @@ void G1ConcurrentMark::concurrent_cycle_start() { } uint G1ConcurrentMark::completed_mark_cycles() const { - return AtomicAccess::load(&_completed_mark_cycles); + return _completed_mark_cycles.load_relaxed(); } void G1ConcurrentMark::concurrent_cycle_end(bool mark_cycle_completed) { @@ -1172,7 +1181,7 @@ void G1ConcurrentMark::concurrent_cycle_end(bool mark_cycle_completed) { _g1h->trace_heap_after_gc(_gc_tracer_cm); if (mark_cycle_completed) { - AtomicAccess::inc(&_completed_mark_cycles, memory_order_relaxed); + _completed_mark_cycles.add_then_fetch(1u, memory_order_relaxed); } if (has_aborted()) { @@ -1186,7 +1195,7 @@ void G1ConcurrentMark::concurrent_cycle_end(bool mark_cycle_completed) { } void G1ConcurrentMark::mark_from_roots() { - _restart_for_overflow = false; + _restart_for_overflow.store_relaxed(false); uint active_workers = calc_active_marking_workers(); @@ -1355,7 +1364,7 @@ void G1ConcurrentMark::remark() { } } else { // We overflowed. Restart concurrent marking. - _restart_for_overflow = true; + _restart_for_overflow.store_relaxed(true); verify_during_pause(G1HeapVerifier::G1VerifyRemark, VerifyLocation::RemarkOverflow); @@ -1784,44 +1793,45 @@ void G1ConcurrentMark::clear_bitmap_for_region(G1HeapRegion* hr) { } G1HeapRegion* G1ConcurrentMark::claim_region(uint worker_id) { - // "checkpoint" the finger - HeapWord* finger = _finger; + // "Checkpoint" the finger. + HeapWord* local_finger = finger(); - while (finger < _heap.end()) { - assert(_g1h->is_in_reserved(finger), "invariant"); + while (local_finger < _heap.end()) { + assert(_g1h->is_in_reserved(local_finger), "invariant"); - G1HeapRegion* curr_region = _g1h->heap_region_containing_or_null(finger); + G1HeapRegion* curr_region = _g1h->heap_region_containing_or_null(local_finger); // Make sure that the reads below do not float before loading curr_region. OrderAccess::loadload(); // Above heap_region_containing may return null as we always scan claim // until the end of the heap. In this case, just jump to the next region. - HeapWord* end = curr_region != nullptr ? curr_region->end() : finger + G1HeapRegion::GrainWords; + HeapWord* end = curr_region != nullptr ? curr_region->end() : local_finger + G1HeapRegion::GrainWords; // Is the gap between reading the finger and doing the CAS too long? - HeapWord* res = AtomicAccess::cmpxchg(&_finger, finger, end); - if (res == finger && curr_region != nullptr) { - // we succeeded + HeapWord* res = _finger.compare_exchange(local_finger, end); + if (res == local_finger && curr_region != nullptr) { + // We succeeded. HeapWord* bottom = curr_region->bottom(); HeapWord* limit = top_at_mark_start(curr_region); log_trace(gc, marking)("Claim region %u bottom " PTR_FORMAT " tams " PTR_FORMAT, curr_region->hrm_index(), p2i(curr_region->bottom()), p2i(top_at_mark_start(curr_region))); - // notice that _finger == end cannot be guaranteed here since, - // someone else might have moved the finger even further - assert(_finger >= end, "the finger should have moved forward"); + // Notice that _finger == end cannot be guaranteed here since, + // someone else might have moved the finger even further. + assert(finger() >= end, "The finger should have moved forward"); if (limit > bottom) { return curr_region; } else { assert(limit == bottom, - "the region limit should be at bottom"); + "The region limit should be at bottom"); // We return null and the caller should try calling // claim_region() again. return nullptr; } } else { - assert(_finger > finger, "the finger should have moved forward"); - // read it again - finger = _finger; + // Read the finger again. + HeapWord* next_finger = finger(); + assert(next_finger > local_finger, "The finger should have moved forward " PTR_FORMAT " " PTR_FORMAT, p2i(local_finger), p2i(next_finger)); + local_finger = next_finger; } } @@ -1957,7 +1967,7 @@ bool G1ConcurrentMark::concurrent_cycle_abort() { void G1ConcurrentMark::abort_marking_threads() { assert(!_root_regions.scan_in_progress(), "still doing root region scan"); - _has_aborted = true; + _has_aborted.store_relaxed(true); _first_overflow_barrier_sync.abort(); _second_overflow_barrier_sync.abort(); } diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMark.hpp b/src/hotspot/share/gc/g1/g1ConcurrentMark.hpp index 0271e6a4208..11da6dae5b3 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMark.hpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.hpp @@ -368,7 +368,7 @@ class G1ConcurrentMark : public CHeapObj { // For grey objects G1CMMarkStack _global_mark_stack; // Grey objects behind global finger - HeapWord* volatile _finger; // The global finger, region aligned, + Atomic _finger; // The global finger, region aligned, // always pointing to the end of the // last claimed region @@ -395,19 +395,19 @@ class G1ConcurrentMark : public CHeapObj { WorkerThreadsBarrierSync _second_overflow_barrier_sync; // Number of completed mark cycles. - volatile uint _completed_mark_cycles; + Atomic _completed_mark_cycles; // This is set by any task, when an overflow on the global data // structures is detected - volatile bool _has_overflown; + Atomic _has_overflown; // True: marking is concurrent, false: we're in remark - volatile bool _concurrent; + Atomic _concurrent; // Set at the end of a Full GC so that marking aborts - volatile bool _has_aborted; + Atomic _has_aborted; // Used when remark aborts due to an overflow to indicate that // another concurrent marking phase should start - volatile bool _restart_for_overflow; + Atomic _restart_for_overflow; ConcurrentGCTimer* _gc_timer_cm; @@ -461,8 +461,8 @@ class G1ConcurrentMark : public CHeapObj { void print_and_reset_taskqueue_stats(); - HeapWord* finger() { return _finger; } - bool concurrent() { return _concurrent; } + HeapWord* finger() { return _finger.load_relaxed(); } + bool concurrent() { return _concurrent.load_relaxed(); } uint active_tasks() { return _num_active_tasks; } TaskTerminator* terminator() { return &_terminator; } @@ -487,7 +487,7 @@ class G1ConcurrentMark : public CHeapObj { // to satisfy an allocation without doing a GC. This is fine, because all // objects in those regions will be considered live anyway because of // SATB guarantees (i.e. their TAMS will be equal to bottom). - bool out_of_regions() { return _finger >= _heap.end(); } + bool out_of_regions() { return finger() >= _heap.end(); } // Returns the task with the given id G1CMTask* task(uint id) { @@ -499,10 +499,10 @@ class G1ConcurrentMark : public CHeapObj { // Access / manipulation of the overflow flag which is set to // indicate that the global stack has overflown - bool has_overflown() { return _has_overflown; } - void set_has_overflown() { _has_overflown = true; } - void clear_has_overflown() { _has_overflown = false; } - bool restart_for_overflow() { return _restart_for_overflow; } + bool has_overflown() { return _has_overflown.load_relaxed(); } + void set_has_overflown() { _has_overflown.store_relaxed(true); } + void clear_has_overflown() { _has_overflown.store_relaxed(false); } + bool restart_for_overflow() { return _restart_for_overflow.load_relaxed(); } // Methods to enter the two overflow sync barriers void enter_first_sync_barrier(uint worker_id); @@ -516,12 +516,12 @@ class G1ConcurrentMark : public CHeapObj { G1RegionMarkStats* _region_mark_stats; // Top pointer for each region at the start of marking. Must be valid for all committed // regions. - HeapWord* volatile* _top_at_mark_starts; + Atomic* _top_at_mark_starts; // Top pointer for each region at the start of the rebuild remembered set process // for regions which remembered sets need to be rebuilt. A null for a given region // means that this region does not be scanned during the rebuilding remembered // set phase at all. - HeapWord* volatile* _top_at_rebuild_starts; + Atomic* _top_at_rebuild_starts; // True when Remark pause selected regions for rebuilding. bool _needs_remembered_set_rebuild; public: @@ -679,7 +679,7 @@ public: uint completed_mark_cycles() const; - bool has_aborted() { return _has_aborted; } + bool has_aborted() { return _has_aborted.load_relaxed(); } void print_summary_info(); diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp b/src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp index 2f4824e4cae..21167d5cae9 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp @@ -194,11 +194,11 @@ inline void G1CMTask::process_array_chunk(objArrayOop obj, size_t start, size_t inline void G1ConcurrentMark::update_top_at_mark_start(G1HeapRegion* r) { uint const region = r->hrm_index(); assert(region < _g1h->max_num_regions(), "Tried to access TAMS for region %u out of bounds", region); - _top_at_mark_starts[region] = r->top(); + _top_at_mark_starts[region].store_relaxed(r->top()); } inline void G1ConcurrentMark::reset_top_at_mark_start(G1HeapRegion* r) { - _top_at_mark_starts[r->hrm_index()] = r->bottom(); + _top_at_mark_starts[r->hrm_index()].store_relaxed(r->bottom()); } inline HeapWord* G1ConcurrentMark::top_at_mark_start(const G1HeapRegion* r) const { @@ -207,7 +207,7 @@ inline HeapWord* G1ConcurrentMark::top_at_mark_start(const G1HeapRegion* r) cons inline HeapWord* G1ConcurrentMark::top_at_mark_start(uint region) const { assert(region < _g1h->max_num_regions(), "Tried to access TARS for region %u out of bounds", region); - return _top_at_mark_starts[region]; + return _top_at_mark_starts[region].load_relaxed(); } inline bool G1ConcurrentMark::obj_allocated_since_mark_start(oop obj) const { @@ -217,7 +217,7 @@ inline bool G1ConcurrentMark::obj_allocated_since_mark_start(oop obj) const { } inline HeapWord* G1ConcurrentMark::top_at_rebuild_start(G1HeapRegion* r) const { - return _top_at_rebuild_starts[r->hrm_index()]; + return _top_at_rebuild_starts[r->hrm_index()].load_relaxed(); } inline void G1ConcurrentMark::update_top_at_rebuild_start(G1HeapRegion* r) { @@ -225,10 +225,10 @@ inline void G1ConcurrentMark::update_top_at_rebuild_start(G1HeapRegion* r) { uint const region = r->hrm_index(); assert(region < _g1h->max_num_regions(), "Tried to access TARS for region %u out of bounds", region); - assert(_top_at_rebuild_starts[region] == nullptr, + assert(top_at_rebuild_start(r) == nullptr, "TARS for region %u has already been set to " PTR_FORMAT " should be null", - region, p2i(_top_at_rebuild_starts[region])); - _top_at_rebuild_starts[region] = r->top(); + region, p2i(top_at_rebuild_start(r))); + _top_at_rebuild_starts[region].store_relaxed(r->top()); } inline void G1CMTask::update_liveness(oop const obj, const size_t obj_size) { diff --git a/src/hotspot/share/gc/g1/g1RegionMarkStatsCache.hpp b/src/hotspot/share/gc/g1/g1RegionMarkStatsCache.hpp index 4dcdd33846e..b8f13f4553d 100644 --- a/src/hotspot/share/gc/g1/g1RegionMarkStatsCache.hpp +++ b/src/hotspot/share/gc/g1/g1RegionMarkStatsCache.hpp @@ -44,6 +44,8 @@ struct G1RegionMarkStats { Atomic _live_words; Atomic _incoming_refs; + G1RegionMarkStats() : _live_words(0), _incoming_refs(0) { } + // Clear all members. void clear() { _live_words.store_relaxed(0); diff --git a/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp b/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp index 3f47d386015..557941981e4 100644 --- a/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp +++ b/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp @@ -497,10 +497,6 @@ class G1PostEvacuateCollectionSetCleanupTask2::ProcessEvacuationFailedRegionsTas G1CollectedHeap* g1h = G1CollectedHeap::heap(); G1ConcurrentMark* cm = g1h->concurrent_mark(); - HeapWord* top_at_mark_start = cm->top_at_mark_start(r); - assert(top_at_mark_start == r->bottom(), "TAMS must not have been set for region %u", r->hrm_index()); - assert(cm->live_bytes(r->hrm_index()) == 0, "Marking live bytes must not be set for region %u", r->hrm_index()); - // Concurrent mark does not mark through regions that we retain (they are root // regions wrt to marking), so we must clear their mark data (tams, bitmap, ...) // set eagerly or during evacuation failure. From 49425184a1a45669b4b79ce6ac28852cf1abb9ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20H=C3=BCbner?= Date: Tue, 17 Feb 2026 13:53:09 +0000 Subject: [PATCH 76/77] 8371590: runtime/ErrorHandling/TestDwarf.java fails with clang toolchain Reviewed-by: jsjolen, aartemov, jsikstro --- .../runtime/ErrorHandling/TestDwarf.java | 19 +++++++++++++------ .../runtime/ErrorHandling/libTestDwarf.c | 16 ++++++++++++++-- .../ErrorHandling/libTestDwarfHelper.h | 5 ++++- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/TestDwarf.java b/test/hotspot/jtreg/runtime/ErrorHandling/TestDwarf.java index 00b5becdbfa..6fe00498797 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/TestDwarf.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/TestDwarf.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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 @@ -108,13 +108,19 @@ public class TestDwarf { if (Platform.isX64() || Platform.isX86()) { // Not all platforms raise SIGFPE but x86_32 and x86_64 do. runAndCheck(new Flags(TestDwarf.class.getCanonicalName(), "nativeDivByZero"), - new DwarfConstraint(0, "Java_TestDwarf_crashNativeDivByZero", "libTestDwarf.c", 59)); + new DwarfConstraint(0, "Java_TestDwarf_crashNativeDivByZero", "libTestDwarf.c", 62)); runAndCheck(new Flags(TestDwarf.class.getCanonicalName(), "nativeMultipleMethods"), - new DwarfConstraint(0, "foo", "libTestDwarf.c", 42), - new DwarfConstraint(1, "Java_TestDwarf_crashNativeMultipleMethods", "libTestDwarf.c", 70)); + new DwarfConstraint(0, "foo", "libTestDwarf.c", 45), + new DwarfConstraint(1, "Java_TestDwarf_crashNativeMultipleMethods", "libTestDwarf.c", 73)); + } + // Null pointer dereferences exhibit different behaviour depending on if GCC or Clang is used. + // When using GCC, the VM will crash gracefully and generate a hs_err which can be parsed. + // On the contrary, with Clang the process exits immediately without hs_err. + // Since runAndCheck needs an hs_err file, we have to skip this subtest. + if (!isUsingClang()) { + runAndCheck(new Flags(TestDwarf.class.getCanonicalName(), "nativeDereferenceNull"), + new DwarfConstraint(0, "dereference_null", "libTestDwarfHelper.h", 49)); } - runAndCheck(new Flags(TestDwarf.class.getCanonicalName(), "nativeDereferenceNull"), - new DwarfConstraint(0, "dereference_null", "libTestDwarfHelper.h", 46)); } // A full pattern could check for lines like: @@ -240,6 +246,7 @@ public class TestDwarf { private static native void crashNativeDivByZero(); private static native void crashNativeDereferenceNull(); private static native void crashNativeMultipleMethods(int x); + private static native boolean isUsingClang(); } class UnsupportedDwarfVersionException extends RuntimeException { } diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/libTestDwarf.c b/test/hotspot/jtreg/runtime/ErrorHandling/libTestDwarf.c index 616a6f07d12..19993d17de3 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/libTestDwarf.c +++ b/test/hotspot/jtreg/runtime/ErrorHandling/libTestDwarf.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 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 @@ -28,7 +28,10 @@ int zero = 0; int result = 0; int limit = 20; -// Just big enough by doing some random things such that it is not inlined. +// Explicitly don't inline. foo needs complexity so GCC/Clang don't optimize it away. +#if !defined(_MSC_VER) +__attribute__((noinline)) +#endif void foo(int x) { printf("foo3:"); printf(" %d\n", x); @@ -76,3 +79,12 @@ JNIEXPORT void JNICALL Java_TestDwarf_crashNativeMultipleMethods(JNIEnv* env, jc } } +// Need to tell if Clang was used to build libTestDwarf. +JNIEXPORT jboolean JNICALL Java_TestDwarf_isUsingClang(JNIEnv* env, jobject obj) { +#if defined(__clang__) + return JNI_TRUE; +#else + return JNI_FALSE; +#endif +} + diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/libTestDwarfHelper.h b/test/hotspot/jtreg/runtime/ErrorHandling/libTestDwarfHelper.h index 1da05c1c3d3..9f9ef33add2 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/libTestDwarfHelper.h +++ b/test/hotspot/jtreg/runtime/ErrorHandling/libTestDwarfHelper.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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 @@ -41,6 +41,9 @@ void unused4() { void unused5() { } +#if !defined(_MSC_VER) +__attribute__((noinline)) +#endif EXPORT void dereference_null() { int* x = (int*)0; *x = 34; // Crash From 63f00fff921ed4ac0f595a0a013d399700433a2c Mon Sep 17 00:00:00 2001 From: Ashutosh Mehra Date: Tue, 17 Feb 2026 16:23:21 +0000 Subject: [PATCH 77/77] 8377507: Store cpu features in AOTCodeCache Reviewed-by: kvn, adinn --- .../cpu/aarch64/vm_version_aarch64.cpp | 46 ++++- .../cpu/aarch64/vm_version_aarch64.hpp | 19 ++- src/hotspot/cpu/x86/vm_version_x86.cpp | 48 +++++- src/hotspot/cpu/x86/vm_version_x86.hpp | 157 ++++++++++-------- src/hotspot/share/code/aotCodeCache.cpp | 78 ++++++++- src/hotspot/share/code/aotCodeCache.hpp | 23 ++- .../share/runtime/abstract_vm_version.hpp | 18 +- .../AOTCodeCPUFeatureIncompatibilityTest.java | 114 +++++++++++++ 8 files changed, 408 insertions(+), 95 deletions(-) create mode 100644 test/hotspot/jtreg/runtime/cds/appcds/aotCode/AOTCodeCPUFeatureIncompatibilityTest.java diff --git a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp b/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp index 0a7bc5a8962..b678921dd97 100644 --- a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/vm_version_aarch64.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. * Copyright (c) 2015, 2020, Red Hat Inc. All rights reserved. * Copyright 2025 Arm Limited and/or its affiliates. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -664,16 +664,52 @@ void VM_Version::initialize() { void VM_Version::insert_features_names(uint64_t features, stringStream& ss) { int i = 0; ss.join([&]() { - while (i < MAX_CPU_FEATURES) { - if (supports_feature((VM_Version::Feature_Flag)i)) { - return _features_names[i++]; + const char* str = nullptr; + while ((i < MAX_CPU_FEATURES) && (str == nullptr)) { + if (supports_feature(features, (VM_Version::Feature_Flag)i)) { + str = _features_names[i]; } i += 1; } - return (const char*)nullptr; + return str; }, ", "); } +void VM_Version::get_cpu_features_name(void* features_buffer, stringStream& ss) { + uint64_t features = *(uint64_t*)features_buffer; + insert_features_names(features, ss); +} + +void VM_Version::get_missing_features_name(void* features_set1, void* features_set2, stringStream& ss) { + uint64_t vm_features_set1 = *(uint64_t*)features_set1; + uint64_t vm_features_set2 = *(uint64_t*)features_set2; + int i = 0; + ss.join([&]() { + const char* str = nullptr; + while ((i < MAX_CPU_FEATURES) && (str == nullptr)) { + Feature_Flag flag = (Feature_Flag)i; + if (supports_feature(vm_features_set1, flag) && !supports_feature(vm_features_set2, flag)) { + str = _features_names[i]; + } + i += 1; + } + return str; + }, ", "); +} + +int VM_Version::cpu_features_size() { + return sizeof(_features); +} + +void VM_Version::store_cpu_features(void* buf) { + *(uint64_t*)buf = _features; +} + +bool VM_Version::supports_features(void* features_buffer) { + uint64_t features_to_test = *(uint64_t*)features_buffer; + return (_features & features_to_test) == features_to_test; +} + #if defined(LINUX) static bool check_info_file(const char* fpath, const char* virt1, VirtualizationType vt1, diff --git a/src/hotspot/cpu/aarch64/vm_version_aarch64.hpp b/src/hotspot/cpu/aarch64/vm_version_aarch64.hpp index 38b112d9936..07f6c09e18f 100644 --- a/src/hotspot/cpu/aarch64/vm_version_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/vm_version_aarch64.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. * Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -184,6 +184,9 @@ public: static bool supports_feature(Feature_Flag flag) { return (_features & BIT_MASK(flag)) != 0; } + static bool supports_feature(uint64_t features, Feature_Flag flag) { + return (features & BIT_MASK(flag)) != 0; + } static int cpu_family() { return _cpu; } static int cpu_model() { return _model; } @@ -244,6 +247,20 @@ public: static bool use_neon_for_vector(int vector_length_in_bytes) { return vector_length_in_bytes <= 16; } + + static void get_cpu_features_name(void* features_buffer, stringStream& ss); + + // Returns names of features present in features_set1 but not in features_set2 + static void get_missing_features_name(void* features_set1, void* features_set2, stringStream& ss); + + // Returns number of bytes required to store cpu features representation + static int cpu_features_size(); + + // Stores cpu features representation in the provided buffer. This representation is arch dependent. + // Size of the buffer must be same as returned by cpu_features_size() + static void store_cpu_features(void* buf); + + static bool supports_features(void* features_to_test); }; #endif // CPU_AARCH64_VM_VERSION_AARCH64_HPP diff --git a/src/hotspot/cpu/x86/vm_version_x86.cpp b/src/hotspot/cpu/x86/vm_version_x86.cpp index ef62a29c834..78d6dec08cf 100644 --- a/src/hotspot/cpu/x86/vm_version_x86.cpp +++ b/src/hotspot/cpu/x86/vm_version_x86.cpp @@ -48,7 +48,7 @@ int VM_Version::_stepping; bool VM_Version::_has_intel_jcc_erratum; VM_Version::CpuidInfo VM_Version::_cpuid_info = { 0, }; -#define DECLARE_CPU_FEATURE_NAME(id, name, bit) name, +#define DECLARE_CPU_FEATURE_NAME(id, name, bit) XSTR(name), const char* VM_Version::_features_names[] = { CPU_FEATURE_FLAGS(DECLARE_CPU_FEATURE_NAME)}; #undef DECLARE_CPU_FEATURE_NAME @@ -3297,12 +3297,50 @@ bool VM_Version::is_intrinsic_supported(vmIntrinsicID id) { void VM_Version::insert_features_names(VM_Version::VM_Features features, stringStream& ss) { int i = 0; ss.join([&]() { - while (i < MAX_CPU_FEATURES) { - if (_features.supports_feature((VM_Version::Feature_Flag)i)) { - return _features_names[i++]; + const char* str = nullptr; + while ((i < MAX_CPU_FEATURES) && (str == nullptr)) { + if (features.supports_feature((VM_Version::Feature_Flag)i)) { + str = _features_names[i]; } i += 1; } - return (const char*)nullptr; + return str; }, ", "); } + +void VM_Version::get_cpu_features_name(void* features_buffer, stringStream& ss) { + VM_Features* features = (VM_Features*)features_buffer; + insert_features_names(*features, ss); +} + +void VM_Version::get_missing_features_name(void* features_set1, void* features_set2, stringStream& ss) { + VM_Features* vm_features_set1 = (VM_Features*)features_set1; + VM_Features* vm_features_set2 = (VM_Features*)features_set2; + int i = 0; + ss.join([&]() { + const char* str = nullptr; + while ((i < MAX_CPU_FEATURES) && (str == nullptr)) { + Feature_Flag flag = (Feature_Flag)i; + if (vm_features_set1->supports_feature(flag) && !vm_features_set2->supports_feature(flag)) { + str = _features_names[i]; + } + i += 1; + } + return str; + }, ", "); +} + +int VM_Version::cpu_features_size() { + return sizeof(VM_Features); +} + +void VM_Version::store_cpu_features(void* buf) { + VM_Features copy = _features; + copy.clear_feature(CPU_HT); // HT does not result in incompatibility of aot code cache + memcpy(buf, ©, sizeof(VM_Features)); +} + +bool VM_Version::supports_features(void* features_buffer) { + VM_Features* features_to_test = (VM_Features*)features_buffer; + return _features.supports_features(features_to_test); +} diff --git a/src/hotspot/cpu/x86/vm_version_x86.hpp b/src/hotspot/cpu/x86/vm_version_x86.hpp index a3f2a801198..e0a895737b7 100644 --- a/src/hotspot/cpu/x86/vm_version_x86.hpp +++ b/src/hotspot/cpu/x86/vm_version_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 @@ -377,84 +377,84 @@ protected: */ enum Feature_Flag { #define CPU_FEATURE_FLAGS(decl) \ - decl(CX8, "cx8", 0) /* next bits are from cpuid 1 (EDX) */ \ - decl(CMOV, "cmov", 1) \ - decl(FXSR, "fxsr", 2) \ - decl(HT, "ht", 3) \ + decl(CX8, cx8, 0) /* next bits are from cpuid 1 (EDX) */ \ + decl(CMOV, cmov, 1) \ + decl(FXSR, fxsr, 2) \ + decl(HT, ht, 3) \ \ - decl(MMX, "mmx", 4) \ - decl(3DNOW_PREFETCH, "3dnowpref", 5) /* Processor supports 3dnow prefetch and prefetchw instructions */ \ + decl(MMX, mmx, 4) \ + decl(3DNOW_PREFETCH, 3dnowpref, 5) /* Processor supports 3dnow prefetch and prefetchw instructions */ \ /* may not necessarily support other 3dnow instructions */ \ - decl(SSE, "sse", 6) \ - decl(SSE2, "sse2", 7) \ + decl(SSE, sse, 6) \ + decl(SSE2, sse2, 7) \ \ - decl(SSE3, "sse3", 8 ) /* SSE3 comes from cpuid 1 (ECX) */ \ - decl(SSSE3, "ssse3", 9 ) \ - decl(SSE4A, "sse4a", 10) \ - decl(SSE4_1, "sse4.1", 11) \ + decl(SSE3, sse3, 8 ) /* SSE3 comes from cpuid 1 (ECX) */ \ + decl(SSSE3, ssse3, 9 ) \ + decl(SSE4A, sse4a, 10) \ + decl(SSE4_1, sse4.1, 11) \ \ - decl(SSE4_2, "sse4.2", 12) \ - decl(POPCNT, "popcnt", 13) \ - decl(LZCNT, "lzcnt", 14) \ - decl(TSC, "tsc", 15) \ + decl(SSE4_2, sse4.2, 12) \ + decl(POPCNT, popcnt, 13) \ + decl(LZCNT, lzcnt, 14) \ + decl(TSC, tsc, 15) \ \ - decl(TSCINV_BIT, "tscinvbit", 16) \ - decl(TSCINV, "tscinv", 17) \ - decl(AVX, "avx", 18) \ - decl(AVX2, "avx2", 19) \ + decl(TSCINV_BIT, tscinvbit, 16) \ + decl(TSCINV, tscinv, 17) \ + decl(AVX, avx, 18) \ + decl(AVX2, avx2, 19) \ \ - decl(AES, "aes", 20) \ - decl(ERMS, "erms", 21) /* enhanced 'rep movsb/stosb' instructions */ \ - decl(CLMUL, "clmul", 22) /* carryless multiply for CRC */ \ - decl(BMI1, "bmi1", 23) \ + decl(AES, aes, 20) \ + decl(ERMS, erms, 21) /* enhanced 'rep movsb/stosb' instructions */ \ + decl(CLMUL, clmul, 22) /* carryless multiply for CRC */ \ + decl(BMI1, bmi1, 23) \ \ - decl(BMI2, "bmi2", 24) \ - decl(RTM, "rtm", 25) /* Restricted Transactional Memory instructions */ \ - decl(ADX, "adx", 26) \ - decl(AVX512F, "avx512f", 27) /* AVX 512bit foundation instructions */ \ + decl(BMI2, bmi2, 24) \ + decl(RTM, rtm, 25) /* Restricted Transactional Memory instructions */ \ + decl(ADX, adx, 26) \ + decl(AVX512F, avx512f, 27) /* AVX 512bit foundation instructions */ \ \ - decl(AVX512DQ, "avx512dq", 28) \ - decl(AVX512PF, "avx512pf", 29) \ - decl(AVX512ER, "avx512er", 30) \ - decl(AVX512CD, "avx512cd", 31) \ + decl(AVX512DQ, avx512dq, 28) \ + decl(AVX512PF, avx512pf, 29) \ + decl(AVX512ER, avx512er, 30) \ + decl(AVX512CD, avx512cd, 31) \ \ - decl(AVX512BW, "avx512bw", 32) /* Byte and word vector instructions */ \ - decl(AVX512VL, "avx512vl", 33) /* EVEX instructions with smaller vector length */ \ - decl(SHA, "sha", 34) /* SHA instructions */ \ - decl(FMA, "fma", 35) /* FMA instructions */ \ + decl(AVX512BW, avx512bw, 32) /* Byte and word vector instructions */ \ + decl(AVX512VL, avx512vl, 33) /* EVEX instructions with smaller vector length */ \ + decl(SHA, sha, 34) /* SHA instructions */ \ + decl(FMA, fma, 35) /* FMA instructions */ \ \ - decl(VZEROUPPER, "vzeroupper", 36) /* Vzeroupper instruction */ \ - decl(AVX512_VPOPCNTDQ, "avx512_vpopcntdq", 37) /* Vector popcount */ \ - decl(AVX512_VPCLMULQDQ, "avx512_vpclmulqdq", 38) /* Vector carryless multiplication */ \ - decl(AVX512_VAES, "avx512_vaes", 39) /* Vector AES instruction */ \ + decl(VZEROUPPER, vzeroupper, 36) /* Vzeroupper instruction */ \ + decl(AVX512_VPOPCNTDQ, avx512_vpopcntdq, 37) /* Vector popcount */ \ + decl(AVX512_VPCLMULQDQ, avx512_vpclmulqdq, 38) /* Vector carryless multiplication */ \ + decl(AVX512_VAES, avx512_vaes, 39) /* Vector AES instruction */ \ \ - decl(AVX512_VNNI, "avx512_vnni", 40) /* Vector Neural Network Instructions */ \ - decl(FLUSH, "clflush", 41) /* flush instruction */ \ - decl(FLUSHOPT, "clflushopt", 42) /* flusopth instruction */ \ - decl(CLWB, "clwb", 43) /* clwb instruction */ \ + decl(AVX512_VNNI, avx512_vnni, 40) /* Vector Neural Network Instructions */ \ + decl(FLUSH, clflush, 41) /* flush instruction */ \ + decl(FLUSHOPT, clflushopt, 42) /* flusopth instruction */ \ + decl(CLWB, clwb, 43) /* clwb instruction */ \ \ - decl(AVX512_VBMI2, "avx512_vbmi2", 44) /* VBMI2 shift left double instructions */ \ - decl(AVX512_VBMI, "avx512_vbmi", 45) /* Vector BMI instructions */ \ - decl(HV, "hv", 46) /* Hypervisor instructions */ \ - decl(SERIALIZE, "serialize", 47) /* CPU SERIALIZE */ \ - decl(RDTSCP, "rdtscp", 48) /* RDTSCP instruction */ \ - decl(RDPID, "rdpid", 49) /* RDPID instruction */ \ - decl(FSRM, "fsrm", 50) /* Fast Short REP MOV */ \ - decl(GFNI, "gfni", 51) /* Vector GFNI instructions */ \ - decl(AVX512_BITALG, "avx512_bitalg", 52) /* Vector sub-word popcount and bit gather instructions */\ - decl(F16C, "f16c", 53) /* Half-precision and single precision FP conversion instructions*/ \ - decl(PKU, "pku", 54) /* Protection keys for user-mode pages */ \ - decl(OSPKE, "ospke", 55) /* OS enables protection keys */ \ - decl(CET_IBT, "cet_ibt", 56) /* Control Flow Enforcement - Indirect Branch Tracking */ \ - decl(CET_SS, "cet_ss", 57) /* Control Flow Enforcement - Shadow Stack */ \ - decl(AVX512_IFMA, "avx512_ifma", 58) /* Integer Vector FMA instructions*/ \ - decl(AVX_IFMA, "avx_ifma", 59) /* 256-bit VEX-coded variant of AVX512-IFMA*/ \ - decl(APX_F, "apx_f", 60) /* Intel Advanced Performance Extensions*/ \ - decl(SHA512, "sha512", 61) /* SHA512 instructions*/ \ - decl(AVX512_FP16, "avx512_fp16", 62) /* AVX512 FP16 ISA support*/ \ - decl(AVX10_1, "avx10_1", 63) /* AVX10 512 bit vector ISA Version 1 support*/ \ - decl(AVX10_2, "avx10_2", 64) /* AVX10 512 bit vector ISA Version 2 support*/ \ - decl(HYBRID, "hybrid", 65) /* Hybrid architecture */ + decl(AVX512_VBMI2, avx512_vbmi2, 44) /* VBMI2 shift left double instructions */ \ + decl(AVX512_VBMI, avx512_vbmi, 45) /* Vector BMI instructions */ \ + decl(HV, hv, 46) /* Hypervisor instructions */ \ + decl(SERIALIZE, serialize, 47) /* CPU SERIALIZE */ \ + decl(RDTSCP, rdtscp, 48) /* RDTSCP instruction */ \ + decl(RDPID, rdpid, 49) /* RDPID instruction */ \ + decl(FSRM, fsrm, 50) /* Fast Short REP MOV */ \ + decl(GFNI, gfni, 51) /* Vector GFNI instructions */ \ + decl(AVX512_BITALG, avx512_bitalg, 52) /* Vector sub-word popcount and bit gather instructions */\ + decl(F16C, f16c, 53) /* Half-precision and single precision FP conversion instructions*/ \ + decl(PKU, pku, 54) /* Protection keys for user-mode pages */ \ + decl(OSPKE, ospke, 55) /* OS enables protection keys */ \ + decl(CET_IBT, cet_ibt, 56) /* Control Flow Enforcement - Indirect Branch Tracking */ \ + decl(CET_SS, cet_ss, 57) /* Control Flow Enforcement - Shadow Stack */ \ + decl(AVX512_IFMA, avx512_ifma, 58) /* Integer Vector FMA instructions*/ \ + decl(AVX_IFMA, avx_ifma, 59) /* 256-bit VEX-coded variant of AVX512-IFMA*/ \ + decl(APX_F, apx_f, 60) /* Intel Advanced Performance Extensions*/ \ + decl(SHA512, sha512, 61) /* SHA512 instructions*/ \ + decl(AVX512_FP16, avx512_fp16, 62) /* AVX512 FP16 ISA support*/ \ + decl(AVX10_1, avx10_1, 63) /* AVX10 512 bit vector ISA Version 1 support*/ \ + decl(AVX10_2, avx10_2, 64) /* AVX10 512 bit vector ISA Version 2 support*/ \ + decl(HYBRID, hybrid, 65) /* Hybrid architecture */ #define DECLARE_CPU_FEATURE_FLAG(id, name, bit) CPU_##id = (bit), CPU_FEATURE_FLAGS(DECLARE_CPU_FEATURE_FLAG) @@ -516,6 +516,15 @@ protected: int idx = index(feature); return (_features_bitmap[idx] & bit_mask(feature)) != 0; } + + bool supports_features(VM_Features* features_to_test) { + for (int i = 0; i < features_bitmap_element_count(); i++) { + if ((_features_bitmap[i] & features_to_test->_features_bitmap[i]) != features_to_test->_features_bitmap[i]) { + return false; + } + } + return true; + } }; // CPU feature flags vector, can be affected by VM settings. @@ -1103,6 +1112,20 @@ public: static bool supports_tscinv_ext(void); static void initialize_cpu_information(void); + + static void get_cpu_features_name(void* features_buffer, stringStream& ss); + + // Returns names of features present in features_set1 but not in features_set2 + static void get_missing_features_name(void* features_set1, void* features_set2, stringStream& ss); + + // Returns number of bytes required to store cpu features representation + static int cpu_features_size(); + + // Stores cpu features representation in the provided buffer. This representation is arch dependent. + // Size of the buffer must be same as returned by cpu_features_size() + static void store_cpu_features(void* buf); + + static bool supports_features(void* features_to_test); }; #endif // CPU_X86_VM_VERSION_X86_HPP diff --git a/src/hotspot/share/code/aotCodeCache.cpp b/src/hotspot/share/code/aotCodeCache.cpp index f51c068f1e7..32a53691f3f 100644 --- a/src/hotspot/share/code/aotCodeCache.cpp +++ b/src/hotspot/share/code/aotCodeCache.cpp @@ -399,7 +399,7 @@ AOTCodeCache::~AOTCodeCache() { } } -void AOTCodeCache::Config::record() { +void AOTCodeCache::Config::record(uint cpu_features_offset) { _flags = 0; #ifdef ASSERT _flags |= debugVM; @@ -430,9 +430,50 @@ void AOTCodeCache::Config::record() { _compressedKlassShift = CompressedKlassPointers::shift(); _contendedPaddingWidth = ContendedPaddingWidth; _gc = (uint)Universe::heap()->kind(); + _cpu_features_offset = cpu_features_offset; } -bool AOTCodeCache::Config::verify() const { +bool AOTCodeCache::Config::verify_cpu_features(AOTCodeCache* cache) const { + LogStreamHandle(Debug, aot, codecache, init) log; + uint offset = _cpu_features_offset; + uint cpu_features_size = *(uint *)cache->addr(offset); + assert(cpu_features_size == (uint)VM_Version::cpu_features_size(), "must be"); + offset += sizeof(uint); + + void* cached_cpu_features_buffer = (void *)cache->addr(offset); + if (log.is_enabled()) { + ResourceMark rm; // required for stringStream::as_string() + stringStream ss; + VM_Version::get_cpu_features_name(cached_cpu_features_buffer, ss); + log.print_cr("CPU features recorded in AOTCodeCache: %s", ss.as_string()); + } + + if (VM_Version::supports_features(cached_cpu_features_buffer)) { + if (log.is_enabled()) { + ResourceMark rm; // required for stringStream::as_string() + stringStream ss; + char* runtime_cpu_features = NEW_RESOURCE_ARRAY(char, VM_Version::cpu_features_size()); + VM_Version::store_cpu_features(runtime_cpu_features); + VM_Version::get_missing_features_name(runtime_cpu_features, cached_cpu_features_buffer, ss); + if (!ss.is_empty()) { + log.print_cr("Additional runtime CPU features: %s", ss.as_string()); + } + } + } else { + if (log.is_enabled()) { + ResourceMark rm; // required for stringStream::as_string() + stringStream ss; + char* runtime_cpu_features = NEW_RESOURCE_ARRAY(char, VM_Version::cpu_features_size()); + VM_Version::store_cpu_features(runtime_cpu_features); + VM_Version::get_missing_features_name(cached_cpu_features_buffer, runtime_cpu_features, ss); + log.print_cr("AOT Code Cache disabled: required cpu features are missing: %s", ss.as_string()); + } + return false; + } + return true; +} + +bool AOTCodeCache::Config::verify(AOTCodeCache* cache) const { // First checks affect all cached AOT code #ifdef ASSERT if ((_flags & debugVM) == 0) { @@ -478,6 +519,9 @@ bool AOTCodeCache::Config::verify() const { AOTStubCaching = false; } + if (!verify_cpu_features(cache)) { + return false; + } return true; } @@ -679,6 +723,17 @@ extern "C" { } } +void AOTCodeCache::store_cpu_features(char*& buffer, uint buffer_size) { + uint* size_ptr = (uint *)buffer; + *size_ptr = buffer_size; + buffer += sizeof(uint); + + VM_Version::store_cpu_features(buffer); + log_debug(aot, codecache, exit)("CPU features recorded in AOTCodeCache: %s", VM_Version::features_string()); + buffer += buffer_size; + buffer = align_up(buffer, DATA_ALIGNMENT); +} + bool AOTCodeCache::finish_write() { if (!align_write()) { return false; @@ -698,23 +753,32 @@ bool AOTCodeCache::finish_write() { uint store_count = _store_entries_cnt; if (store_count > 0) { - uint header_size = (uint)align_up(sizeof(AOTCodeCache::Header), DATA_ALIGNMENT); + uint header_size = (uint)align_up(sizeof(AOTCodeCache::Header), DATA_ALIGNMENT); uint code_count = store_count; uint search_count = code_count * 2; uint search_size = search_count * sizeof(uint); uint entries_size = (uint)align_up(code_count * sizeof(AOTCodeEntry), DATA_ALIGNMENT); // In bytes // _write_position includes size of code and strings uint code_alignment = code_count * DATA_ALIGNMENT; // We align_up code size when storing it. - uint total_size = header_size + _write_position + code_alignment + search_size + entries_size; + uint cpu_features_size = VM_Version::cpu_features_size(); + uint total_cpu_features_size = sizeof(uint) + cpu_features_size; // sizeof(uint) to store cpu_features_size + uint total_size = header_size + _write_position + code_alignment + search_size + entries_size + + align_up(total_cpu_features_size, DATA_ALIGNMENT); assert(total_size < max_aot_code_size(), "AOT Code size (" UINT32_FORMAT " bytes) is greater than AOTCodeMaxSize(" UINT32_FORMAT " bytes).", total_size, max_aot_code_size()); - // Create ordered search table for entries [id, index]; - uint* search = NEW_C_HEAP_ARRAY(uint, search_count, mtCode); // Allocate in AOT Cache buffer char* buffer = (char *)AOTCacheAccess::allocate_aot_code_region(total_size + DATA_ALIGNMENT); char* start = align_up(buffer, DATA_ALIGNMENT); char* current = start + header_size; // Skip header + uint cpu_features_offset = current - start; + store_cpu_features(current, cpu_features_size); + assert(is_aligned(current, DATA_ALIGNMENT), "sanity check"); + assert(current < start + total_size, "sanity check"); + + // Create ordered search table for entries [id, index]; + uint* search = NEW_C_HEAP_ARRAY(uint, search_count, mtCode); + AOTCodeEntry* entries_address = _store_entries; // Pointer to latest entry uint adapters_count = 0; uint shared_blobs_count = 0; @@ -790,7 +854,7 @@ bool AOTCodeCache::finish_write() { header->init(size, (uint)strings_count, strings_offset, entries_count, new_entries_offset, adapters_count, shared_blobs_count, - C1_blobs_count, C2_blobs_count); + C1_blobs_count, C2_blobs_count, cpu_features_offset); log_info(aot, codecache, exit)("Wrote %d AOT code entries to AOT Code Cache", entries_count); } diff --git a/src/hotspot/share/code/aotCodeCache.hpp b/src/hotspot/share/code/aotCodeCache.hpp index 778ad34e448..45b4a15510d 100644 --- a/src/hotspot/share/code/aotCodeCache.hpp +++ b/src/hotspot/share/code/aotCodeCache.hpp @@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -185,10 +185,12 @@ protected: restrictContendedPadding = 128 }; uint _flags; + uint _cpu_features_offset; // offset in the cache where cpu features are stored public: - void record(); - bool verify() const; + void record(uint cpu_features_offset); + bool verify_cpu_features(AOTCodeCache* cache) const; + bool verify(AOTCodeCache* cache) const; }; class Header : public CHeapObj { @@ -206,14 +208,15 @@ protected: uint _shared_blobs_count; uint _C1_blobs_count; uint _C2_blobs_count; - Config _config; + Config _config; // must be the last element as there is trailing data stored immediately after Config public: void init(uint cache_size, uint strings_count, uint strings_offset, uint entries_count, uint entries_offset, uint adapters_count, uint shared_blobs_count, - uint C1_blobs_count, uint C2_blobs_count) { + uint C1_blobs_count, uint C2_blobs_count, + uint cpu_features_offset) { _version = AOT_CODE_VERSION; _cache_size = cache_size; _strings_count = strings_count; @@ -224,7 +227,7 @@ protected: _shared_blobs_count = shared_blobs_count; _C1_blobs_count = C1_blobs_count; _C2_blobs_count = C2_blobs_count; - _config.record(); + _config.record(cpu_features_offset); } @@ -239,8 +242,8 @@ protected: uint C2_blobs_count() const { return _C2_blobs_count; } bool verify(uint load_size) const; - bool verify_config() const { // Called after Universe initialized - return _config.verify(); + bool verify_config(AOTCodeCache* cache) const { // Called after Universe initialized + return _config.verify(cache); } }; @@ -320,6 +323,8 @@ public: AOTCodeEntry* find_entry(AOTCodeEntry::Kind kind, uint id); + void store_cpu_features(char*& buffer, uint buffer_size); + bool finish_write(); bool write_relocations(CodeBlob& code_blob); @@ -361,7 +366,7 @@ private: static bool open_cache(bool is_dumping, bool is_using); bool verify_config() { if (for_use()) { - return _load_header->verify_config(); + return _load_header->verify_config(this); } return true; } diff --git a/src/hotspot/share/runtime/abstract_vm_version.hpp b/src/hotspot/share/runtime/abstract_vm_version.hpp index 5a6b41506c7..17ade2c068d 100644 --- a/src/hotspot/share/runtime/abstract_vm_version.hpp +++ b/src/hotspot/share/runtime/abstract_vm_version.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 @@ -42,6 +42,7 @@ typedef enum { } VirtualizationType; class outputStream; +class stringStream; enum class vmIntrinsicID; // Abstract_VM_Version provides information about the VM. @@ -226,6 +227,21 @@ class Abstract_VM_Version: AllStatic { static const char* cpu_name(void); static const char* cpu_description(void); + + static void get_cpu_features_name(void* features_buffer, stringStream& ss) { return; } + + // Returns names of features present in features_set1 but not in features_set2 + static void get_missing_features_name(void* features_set1, void* features_set2, stringStream& ss) { return; } + + // Returns number of bytes required to store cpu features representation + static int cpu_features_size() { return 0; } + + // Stores arch dependent cpu features representation in the provided buffer. + // Size of the buffer must be same as returned by cpu_features_size() + static void store_cpu_features(void* buf) { return; } + + // features_to_test is an opaque object that stores arch specific representation of cpu features + static bool supports_features(void* features_to_test) { return false; }; }; #endif // SHARE_RUNTIME_ABSTRACT_VM_VERSION_HPP diff --git a/test/hotspot/jtreg/runtime/cds/appcds/aotCode/AOTCodeCPUFeatureIncompatibilityTest.java b/test/hotspot/jtreg/runtime/cds/appcds/aotCode/AOTCodeCPUFeatureIncompatibilityTest.java new file mode 100644 index 00000000000..8d1e190d1e3 --- /dev/null +++ b/test/hotspot/jtreg/runtime/cds/appcds/aotCode/AOTCodeCPUFeatureIncompatibilityTest.java @@ -0,0 +1,114 @@ +/* + * 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 CPU feature compatibility test for AOT Code Cache + * @requires vm.cds.supports.aot.code.caching + * @requires vm.compMode != "Xcomp" & vm.compMode != "Xint" + * @requires os.simpleArch == "x64" | os.simpleArch == "aarch64" + * @comment The test verifies AOT checks during VM startup and not code generation. + * No need to run it with -Xcomp. + * @library /test/lib /test/setup_aot + * @build AOTCodeCPUFeatureIncompatibilityTest JavacBenchApp + * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox + * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar app.jar + * JavacBenchApp + * JavacBenchApp$ClassFile + * JavacBenchApp$FileManager + * JavacBenchApp$SourceFile + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI AOTCodeCPUFeatureIncompatibilityTest + */ + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import jdk.test.lib.Platform; +import jdk.test.lib.cds.CDSAppTester; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; + +import jdk.test.whitebox.WhiteBox; +import jdk.test.whitebox.cpuinfo.CPUInfo; + +public class AOTCodeCPUFeatureIncompatibilityTest { + public static void main(String... args) throws Exception { + List cpuFeatures = CPUInfo.getFeatures(); + if (Platform.isX64()) { + // Minimum value of UseSSE required by JVM is 2. So the production run has to be executed with UseSSE=2. + // To simulate the case of incmpatible SSE feature, we can run this test only on system with higher SSE level (sse3 or above). + if (isSSE3Supported(cpuFeatures)) { + testIncompatibleFeature("-XX:UseSSE=2", "sse3"); + } + if (isAVXSupported(cpuFeatures)) { + testIncompatibleFeature("-XX:UseAVX=0", "avx"); + } + } + } + + // vmOption = command line option to disable CPU feature + // featureName = name of the CPU feature used by the JVM in the log messages + public static void testIncompatibleFeature(String vmOption, String featureName) throws Exception { + new CDSAppTester("AOTCodeCPUFeatureIncompatibilityTest") { + @Override + public String[] vmArgs(RunMode runMode) { + if (runMode == RunMode.PRODUCTION) { + return new String[] {vmOption, "-Xlog:aot+codecache+init=debug"}; + } + return new String[] {}; + } + @Override + public void checkExecution(OutputAnalyzer out, RunMode runMode) throws Exception { + if (runMode == RunMode.ASSEMBLY) { + out.shouldMatch("CPU features recorded in AOTCodeCache:.*" + featureName + ".*"); + } else if (runMode == RunMode.PRODUCTION) { + out.shouldMatch("AOT Code Cache disabled: required cpu features are missing:.*" + featureName + ".*"); + out.shouldContain("Unable to use AOT Code Cache"); + } + } + @Override + public String classpath(RunMode runMode) { + return "app.jar"; + } + @Override + public String[] appCommandLine(RunMode runMode) { + return new String[] { + "JavacBenchApp", "10" + }; + } + }.runAOTWorkflow("--two-step-training"); + } + + // Only used on x86-64 platform + static boolean isSSE3Supported(List cpuFeatures) { + return cpuFeatures.contains("sse3"); + } + + // Only used on x86-64 platform + static boolean isAVXSupported(List cpuFeatures) { + return cpuFeatures.contains("avx"); + } +}