diff --git a/make/autoconf/flags-cflags.m4 b/make/autoconf/flags-cflags.m4 index 5a9fdc57c74..639c3852212 100644 --- a/make/autoconf/flags-cflags.m4 +++ b/make/autoconf/flags-cflags.m4 @@ -69,22 +69,18 @@ AC_DEFUN([FLAGS_SETUP_DEBUG_SYMBOLS], # Debug prefix mapping if supported by compiler DEBUG_PREFIX_CFLAGS= - UTIL_ARG_WITH(NAME: native-debug-symbols-level, TYPE: string, - DEFAULT: "", - RESULT: DEBUG_SYMBOLS_LEVEL, + UTIL_ARG_WITH(NAME: native-debug-symbols-level, TYPE: literal, + DEFAULT: [auto], VALID_VALUES: [auto 1 2 3], + CHECK_AVAILABLE: [ + if test x$TOOLCHAIN_TYPE = xmicrosoft; then + AVAILABLE=false + fi + ], DESC: [set the native debug symbol level (GCC and Clang only)], - DEFAULT_DESC: [toolchain default]) - AC_SUBST(DEBUG_SYMBOLS_LEVEL) - - if test "x${TOOLCHAIN_TYPE}" = xgcc || \ - test "x${TOOLCHAIN_TYPE}" = xclang; then - DEBUG_SYMBOLS_LEVEL_FLAGS="-g" - if test "x${DEBUG_SYMBOLS_LEVEL}" != "x"; then - DEBUG_SYMBOLS_LEVEL_FLAGS="-g${DEBUG_SYMBOLS_LEVEL}" - FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${DEBUG_SYMBOLS_LEVEL_FLAGS}], - IF_FALSE: AC_MSG_ERROR("Debug info level ${DEBUG_SYMBOLS_LEVEL} is not supported")) - fi - fi + DEFAULT_DESC: [toolchain default], + IF_AUTO: [ + RESULT="" + ]) # Debug symbols if test "x$TOOLCHAIN_TYPE" = xgcc; then @@ -111,8 +107,8 @@ AC_DEFUN([FLAGS_SETUP_DEBUG_SYMBOLS], fi # Debug info level should follow the debug format to be effective. - CFLAGS_DEBUG_SYMBOLS="-gdwarf-4 ${DEBUG_SYMBOLS_LEVEL_FLAGS}" - ASFLAGS_DEBUG_SYMBOLS="${DEBUG_SYMBOLS_LEVEL_FLAGS}" + CFLAGS_DEBUG_SYMBOLS="-gdwarf-4 -g${NATIVE_DEBUG_SYMBOLS_LEVEL}" + ASFLAGS_DEBUG_SYMBOLS="-g${NATIVE_DEBUG_SYMBOLS_LEVEL}" elif test "x$TOOLCHAIN_TYPE" = xclang; then if test "x$ALLOW_ABSOLUTE_PATHS_IN_OUTPUT" = "xfalse"; then # Check if compiler supports -fdebug-prefix-map. If so, use that to make @@ -132,8 +128,8 @@ AC_DEFUN([FLAGS_SETUP_DEBUG_SYMBOLS], IF_FALSE: [GDWARF_FLAGS=""]) # Debug info level should follow the debug format to be effective. - CFLAGS_DEBUG_SYMBOLS="${GDWARF_FLAGS} ${DEBUG_SYMBOLS_LEVEL_FLAGS}" - ASFLAGS_DEBUG_SYMBOLS="${DEBUG_SYMBOLS_LEVEL_FLAGS}" + CFLAGS_DEBUG_SYMBOLS="${GDWARF_FLAGS} -g${NATIVE_DEBUG_SYMBOLS_LEVEL}" + ASFLAGS_DEBUG_SYMBOLS="-g${NATIVE_DEBUG_SYMBOLS_LEVEL}" elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then CFLAGS_DEBUG_SYMBOLS="-Z7" fi diff --git a/make/hotspot/lib/CompileGtest.gmk b/make/hotspot/lib/CompileGtest.gmk index 60912992134..327014b1e9d 100644 --- a/make/hotspot/lib/CompileGtest.gmk +++ b/make/hotspot/lib/CompileGtest.gmk @@ -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 @@ -61,7 +61,8 @@ $(eval $(call SetupJdkLibrary, BUILD_GTEST_LIBGTEST, \ INCLUDE_FILES := gtest-all.cc gmock-all.cc, \ DISABLED_WARNINGS_gcc := format-nonliteral maybe-uninitialized undef \ unused-result zero-as-null-pointer-constant, \ - DISABLED_WARNINGS_clang := format-nonliteral undef unused-result, \ + DISABLED_WARNINGS_clang := format-nonliteral undef unused-result \ + zero-as-null-pointer-constant, \ DISABLED_WARNINGS_microsoft := 4530, \ DEFAULT_CFLAGS := false, \ CFLAGS := $(JVM_CFLAGS) \ diff --git a/make/modules/jdk.security.auth/Lib.gmk b/make/modules/jdk.security.auth/Lib.gmk index 9ead32dbe12..96d609f08d6 100644 --- a/make/modules/jdk.security.auth/Lib.gmk +++ b/make/modules/jdk.security.auth/Lib.gmk @@ -31,13 +31,14 @@ include LibCommon.gmk ## Build libjaas ################################################################################ -$(eval $(call SetupJdkLibrary, BUILD_LIBJAAS, \ - NAME := jaas, \ - OPTIMIZATION := LOW, \ - EXTRA_HEADER_DIRS := java.base:libjava, \ - LIBS_windows := advapi32.lib mpr.lib netapi32.lib user32.lib, \ -)) - -TARGETS += $(BUILD_LIBJAAS) +ifeq ($(call isTargetOs, windows), true) + $(eval $(call SetupJdkLibrary, BUILD_LIBJAAS, \ + NAME := jaas, \ + OPTIMIZATION := LOW, \ + EXTRA_HEADER_DIRS := java.base:libjava, \ + LIBS_windows := advapi32.lib mpr.lib netapi32.lib user32.lib, \ + )) + TARGETS += $(BUILD_LIBJAAS) +endif ################################################################################ diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp index b8a9afc123f..27428a5c558 100644 --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp @@ -5782,6 +5782,9 @@ address MacroAssembler::arrays_equals(Register a1, Register a2, Register tmp3, // return false; bind(A_IS_NOT_NULL); ldrw(cnt1, Address(a1, length_offset)); + ldrw(tmp5, Address(a2, length_offset)); + cmp(cnt1, tmp5); + br(NE, DONE); // If lengths differ, return false // Increase loop counter by diff between base- and actual start-offset. addw(cnt1, cnt1, extra_length); lea(a1, Address(a1, start_offset)); @@ -5848,6 +5851,9 @@ address MacroAssembler::arrays_equals(Register a1, Register a2, Register tmp3, cbz(a1, DONE); ldrw(cnt1, Address(a1, length_offset)); cbz(a2, DONE); + ldrw(tmp5, Address(a2, length_offset)); + cmp(cnt1, tmp5); + br(NE, DONE); // If lengths differ, return false // Increase loop counter by diff between base- and actual start-offset. addw(cnt1, cnt1, extra_length); diff --git a/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp b/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp index 89ae6bc10e0..73b631029a0 100644 --- a/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.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. * Copyright (c) 2014, 2021, Red Hat Inc. All rights reserved. * Copyright (c) 2021, Azul Systems, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -722,22 +722,20 @@ void SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm, // Class initialization barrier for static methods entry_address[AdapterBlob::C2I_No_Clinit_Check] = nullptr; - if (VM_Version::supports_fast_class_init_checks()) { - Label L_skip_barrier; + assert(VM_Version::supports_fast_class_init_checks(), "sanity"); + Label L_skip_barrier; - { // Bypass the barrier for non-static methods - __ ldrh(rscratch1, Address(rmethod, Method::access_flags_offset())); - __ andsw(zr, rscratch1, JVM_ACC_STATIC); - __ br(Assembler::EQ, L_skip_barrier); // non-static - } + // Bypass the barrier for non-static methods + __ ldrh(rscratch1, Address(rmethod, Method::access_flags_offset())); + __ andsw(zr, rscratch1, JVM_ACC_STATIC); + __ br(Assembler::EQ, L_skip_barrier); // non-static - __ load_method_holder(rscratch2, rmethod); - __ clinit_barrier(rscratch2, rscratch1, &L_skip_barrier); - __ far_jump(RuntimeAddress(SharedRuntime::get_handle_wrong_method_stub())); + __ load_method_holder(rscratch2, rmethod); + __ clinit_barrier(rscratch2, rscratch1, &L_skip_barrier); + __ far_jump(RuntimeAddress(SharedRuntime::get_handle_wrong_method_stub())); - __ bind(L_skip_barrier); - entry_address[AdapterBlob::C2I_No_Clinit_Check] = __ pc(); - } + __ bind(L_skip_barrier); + entry_address[AdapterBlob::C2I_No_Clinit_Check] = __ pc(); BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler(); bs->c2i_entry_barrier(masm); @@ -1508,7 +1506,8 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm, // SVC, HVC, or SMC. Make it a NOP. __ nop(); - if (VM_Version::supports_fast_class_init_checks() && method->needs_clinit_barrier()) { + if (method->needs_clinit_barrier()) { + assert(VM_Version::supports_fast_class_init_checks(), "sanity"); Label L_skip_barrier; __ mov_metadata(rscratch2, method->method_holder()); // InstanceKlass* __ clinit_barrier(rscratch2, rscratch1, &L_skip_barrier); diff --git a/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp b/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp index cde142b39ac..07b469650f0 100644 --- a/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/templateTable_aarch64.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. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -2290,7 +2290,8 @@ void TemplateTable::resolve_cache_and_index_for_method(int byte_no, __ subs(zr, temp, (int) code); // have we resolved this bytecode? // Class initialization barrier for static methods - if (VM_Version::supports_fast_class_init_checks() && bytecode() == Bytecodes::_invokestatic) { + if (bytecode() == Bytecodes::_invokestatic) { + assert(VM_Version::supports_fast_class_init_checks(), "sanity"); __ br(Assembler::NE, L_clinit_barrier_slow); __ ldr(temp, Address(Rcache, in_bytes(ResolvedMethodEntry::method_offset()))); __ load_method_holder(temp, temp); @@ -2340,8 +2341,8 @@ void TemplateTable::resolve_cache_and_index_for_field(int byte_no, __ subs(zr, temp, (int) code); // have we resolved this bytecode? // Class initialization barrier for static fields - if (VM_Version::supports_fast_class_init_checks() && - (bytecode() == Bytecodes::_getstatic || bytecode() == Bytecodes::_putstatic)) { + if (bytecode() == Bytecodes::_getstatic || bytecode() == Bytecodes::_putstatic) { + assert(VM_Version::supports_fast_class_init_checks(), "sanity"); const Register field_holder = temp; __ br(Assembler::NE, L_clinit_barrier_slow); diff --git a/src/hotspot/cpu/arm/frame_arm.cpp b/src/hotspot/cpu/arm/frame_arm.cpp index 7a23296a3d4..f791fae7bd7 100644 --- a/src/hotspot/cpu/arm/frame_arm.cpp +++ b/src/hotspot/cpu/arm/frame_arm.cpp @@ -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 @@ -356,10 +356,10 @@ frame frame::sender_for_interpreter_frame(RegisterMap* map) const { bool frame::is_interpreted_frame_valid(JavaThread* thread) const { assert(is_interpreted_frame(), "Not an interpreted frame"); // These are reasonable sanity checks - if (fp() == 0 || (intptr_t(fp()) & (wordSize-1)) != 0) { + if (fp() == nullptr || (intptr_t(fp()) & (wordSize-1)) != 0) { return false; } - if (sp() == 0 || (intptr_t(sp()) & (wordSize-1)) != 0) { + if (sp() == nullptr || (intptr_t(sp()) & (wordSize-1)) != 0) { return false; } if (fp() + interpreter_frame_initial_sp_offset < sp()) { diff --git a/src/hotspot/cpu/arm/nativeInst_arm_32.cpp b/src/hotspot/cpu/arm/nativeInst_arm_32.cpp index 232294b246a..df780ac31a6 100644 --- a/src/hotspot/cpu/arm/nativeInst_arm_32.cpp +++ b/src/hotspot/cpu/arm/nativeInst_arm_32.cpp @@ -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 @@ -172,7 +172,7 @@ void NativeMovConstReg::set_data(intptr_t x, address pc) { address addr = oop_addr != nullptr ? (address)oop_addr : (address)metadata_addr; - if(pc == 0) { + if (pc == nullptr) { offset = addr - instruction_address() - 8; } else { offset = addr - pc - 8; @@ -228,7 +228,7 @@ void NativeMovConstReg::set_data(intptr_t x, address pc) { void NativeMovConstReg::set_pc_relative_offset(address addr, address pc) { int offset; - if (pc == 0) { + if (pc == nullptr) { offset = addr - instruction_address() - 8; } else { offset = addr - pc - 8; diff --git a/src/hotspot/cpu/arm/nativeInst_arm_32.hpp b/src/hotspot/cpu/arm/nativeInst_arm_32.hpp index 82385bf0244..2b52db89285 100644 --- a/src/hotspot/cpu/arm/nativeInst_arm_32.hpp +++ b/src/hotspot/cpu/arm/nativeInst_arm_32.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 @@ -371,7 +371,7 @@ class NativeMovConstReg: public NativeInstruction { public: intptr_t data() const; - void set_data(intptr_t x, address pc = 0); + void set_data(intptr_t x, address pc = nullptr); bool is_pc_relative() { return !is_movw(); } diff --git a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp index 4e427ace404..4eb2028f529 100644 --- a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp +++ b/src/hotspot/cpu/ppc/sharedRuntime_ppc.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) 2012, 2025 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -1237,26 +1237,24 @@ void SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm, // Class initialization barrier for static methods entry_address[AdapterBlob::C2I_No_Clinit_Check] = nullptr; - if (VM_Version::supports_fast_class_init_checks()) { - Label L_skip_barrier; + assert(VM_Version::supports_fast_class_init_checks(), "sanity"); + Label L_skip_barrier; - { // Bypass the barrier for non-static methods - __ lhz(R0, in_bytes(Method::access_flags_offset()), R19_method); - __ andi_(R0, R0, JVM_ACC_STATIC); - __ beq(CR0, L_skip_barrier); // non-static - } + // Bypass the barrier for non-static methods + __ lhz(R0, in_bytes(Method::access_flags_offset()), R19_method); + __ andi_(R0, R0, JVM_ACC_STATIC); + __ beq(CR0, L_skip_barrier); // non-static - Register klass = R11_scratch1; - __ load_method_holder(klass, R19_method); - __ clinit_barrier(klass, R16_thread, &L_skip_barrier /*L_fast_path*/); + Register klass = R11_scratch1; + __ load_method_holder(klass, R19_method); + __ clinit_barrier(klass, R16_thread, &L_skip_barrier /*L_fast_path*/); - __ load_const_optimized(klass, SharedRuntime::get_handle_wrong_method_stub(), R0); - __ mtctr(klass); - __ bctr(); + __ load_const_optimized(klass, SharedRuntime::get_handle_wrong_method_stub(), R0); + __ mtctr(klass); + __ bctr(); - __ bind(L_skip_barrier); - entry_address[AdapterBlob::C2I_No_Clinit_Check] = __ pc(); - } + __ bind(L_skip_barrier); + entry_address[AdapterBlob::C2I_No_Clinit_Check] = __ pc(); BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler(); bs->c2i_entry_barrier(masm, /* tmp register*/ ic_klass, /* tmp register*/ receiver_klass, /* tmp register*/ code); @@ -2210,7 +2208,8 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm, // -------------------------------------------------------------------------- vep_start_pc = (intptr_t)__ pc(); - if (VM_Version::supports_fast_class_init_checks() && method->needs_clinit_barrier()) { + if (method->needs_clinit_barrier()) { + assert(VM_Version::supports_fast_class_init_checks(), "sanity"); Label L_skip_barrier; Register klass = r_temp_1; // Notify OOP recorder (don't need the relocation) diff --git a/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp b/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp index 8d61ba1b2d7..8a3af748fa1 100644 --- a/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp +++ b/src/hotspot/cpu/ppc/templateTable_ppc_64.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. * Copyright (c) 2013, 2025 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -2199,7 +2199,8 @@ void TemplateTable::resolve_cache_and_index_for_method(int byte_no, Register Rca __ isync(); // Order load wrt. succeeding loads. // Class initialization barrier for static methods - if (VM_Version::supports_fast_class_init_checks() && bytecode() == Bytecodes::_invokestatic) { + if (bytecode() == Bytecodes::_invokestatic) { + assert(VM_Version::supports_fast_class_init_checks(), "sanity"); const Register method = Rscratch; const Register klass = Rscratch; @@ -2244,8 +2245,8 @@ void TemplateTable::resolve_cache_and_index_for_field(int byte_no, Register Rcac __ isync(); // Order load wrt. succeeding loads. // Class initialization barrier for static fields - if (VM_Version::supports_fast_class_init_checks() && - (bytecode() == Bytecodes::_getstatic || bytecode() == Bytecodes::_putstatic)) { + if (bytecode() == Bytecodes::_getstatic || bytecode() == Bytecodes::_putstatic) { + assert(VM_Version::supports_fast_class_init_checks(), "sanity"); const Register field_holder = R4_ARG2; // InterpreterRuntime::resolve_get_put sets field_holder and finally release-stores put_code. diff --git a/src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp b/src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp index eeb6fad1b59..8c343f6ab2b 100644 --- a/src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp +++ b/src/hotspot/cpu/riscv/sharedRuntime_riscv.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. * Copyright (c) 2014, 2020, Red Hat Inc. 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. @@ -213,7 +213,7 @@ void RegisterSaver::restore_live_registers(MacroAssembler* masm) { // Is vector's size (in bytes) bigger than a size saved by default? // riscv does not ovlerlay the floating-point registers on vector registers like aarch64. bool SharedRuntime::is_wide_vector(int size) { - return UseRVV; + return UseRVV && size > 0; } // --------------------------------------------------------------------------- @@ -637,22 +637,20 @@ void SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm, // Class initialization barrier for static methods entry_address[AdapterBlob::C2I_No_Clinit_Check] = nullptr; - if (VM_Version::supports_fast_class_init_checks()) { - Label L_skip_barrier; + assert(VM_Version::supports_fast_class_init_checks(), "sanity"); + Label L_skip_barrier; - { // Bypass the barrier for non-static methods - __ load_unsigned_short(t0, Address(xmethod, Method::access_flags_offset())); - __ test_bit(t1, t0, exact_log2(JVM_ACC_STATIC)); - __ beqz(t1, L_skip_barrier); // non-static - } + // Bypass the barrier for non-static methods + __ load_unsigned_short(t0, Address(xmethod, Method::access_flags_offset())); + __ test_bit(t1, t0, exact_log2(JVM_ACC_STATIC)); + __ beqz(t1, L_skip_barrier); // non-static - __ load_method_holder(t1, xmethod); - __ clinit_barrier(t1, t0, &L_skip_barrier); - __ far_jump(RuntimeAddress(SharedRuntime::get_handle_wrong_method_stub())); + __ load_method_holder(t1, xmethod); + __ clinit_barrier(t1, t0, &L_skip_barrier); + __ far_jump(RuntimeAddress(SharedRuntime::get_handle_wrong_method_stub())); - __ bind(L_skip_barrier); - entry_address[AdapterBlob::C2I_No_Clinit_Check] = __ pc(); - } + __ bind(L_skip_barrier); + entry_address[AdapterBlob::C2I_No_Clinit_Check] = __ pc(); BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler(); bs->c2i_entry_barrier(masm); @@ -1443,7 +1441,8 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm, __ nop(); // 4 bytes } - if (VM_Version::supports_fast_class_init_checks() && method->needs_clinit_barrier()) { + if (method->needs_clinit_barrier()) { + assert(VM_Version::supports_fast_class_init_checks(), "sanity"); Label L_skip_barrier; __ mov_metadata(t1, method->method_holder()); // InstanceKlass* __ clinit_barrier(t1, t0, &L_skip_barrier); diff --git a/src/hotspot/cpu/riscv/templateTable_riscv.cpp b/src/hotspot/cpu/riscv/templateTable_riscv.cpp index ca41583e4bc..5a3644f70bb 100644 --- a/src/hotspot/cpu/riscv/templateTable_riscv.cpp +++ b/src/hotspot/cpu/riscv/templateTable_riscv.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. * Copyright (c) 2014, Red Hat Inc. 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. @@ -2192,7 +2192,8 @@ void TemplateTable::resolve_cache_and_index_for_method(int byte_no, __ mv(t0, (int) code); // Class initialization barrier for static methods - if (VM_Version::supports_fast_class_init_checks() && bytecode() == Bytecodes::_invokestatic) { + if (bytecode() == Bytecodes::_invokestatic) { + assert(VM_Version::supports_fast_class_init_checks(), "sanity"); __ bne(temp, t0, L_clinit_barrier_slow); // have we resolved this bytecode? __ ld(temp, Address(Rcache, in_bytes(ResolvedMethodEntry::method_offset()))); __ load_method_holder(temp, temp); @@ -2243,8 +2244,8 @@ void TemplateTable::resolve_cache_and_index_for_field(int byte_no, __ mv(t0, (int) code); // have we resolved this bytecode? // Class initialization barrier for static fields - if (VM_Version::supports_fast_class_init_checks() && - (bytecode() == Bytecodes::_getstatic || bytecode() == Bytecodes::_putstatic)) { + if (bytecode() == Bytecodes::_getstatic || bytecode() == Bytecodes::_putstatic) { + assert(VM_Version::supports_fast_class_init_checks(), "sanity"); const Register field_holder = temp; __ bne(temp, t0, L_clinit_barrier_slow); diff --git a/src/hotspot/cpu/s390/sharedRuntime_s390.cpp b/src/hotspot/cpu/s390/sharedRuntime_s390.cpp index 5b6f7dcd984..00a830a80cd 100644 --- a/src/hotspot/cpu/s390/sharedRuntime_s390.cpp +++ b/src/hotspot/cpu/s390/sharedRuntime_s390.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. * Copyright (c) 2016, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -1567,7 +1567,8 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm, //--------------------------------------------------------------------- wrapper_VEPStart = __ offset(); - if (VM_Version::supports_fast_class_init_checks() && method->needs_clinit_barrier()) { + if (method->needs_clinit_barrier()) { + assert(VM_Version::supports_fast_class_init_checks(), "sanity"); Label L_skip_barrier; Register klass = Z_R1_scratch; // Notify OOP recorder (don't need the relocation) @@ -2378,24 +2379,22 @@ void SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm, // Class initialization barrier for static methods entry_address[AdapterBlob::C2I_No_Clinit_Check] = nullptr; - if (VM_Version::supports_fast_class_init_checks()) { - Label L_skip_barrier; + assert(VM_Version::supports_fast_class_init_checks(), "sanity"); + Label L_skip_barrier; - { // Bypass the barrier for non-static methods - __ testbit_ushort(Address(Z_method, Method::access_flags_offset()), JVM_ACC_STATIC_BIT); - __ z_bfalse(L_skip_barrier); // non-static - } + // Bypass the barrier for non-static methods + __ testbit_ushort(Address(Z_method, Method::access_flags_offset()), JVM_ACC_STATIC_BIT); + __ z_bfalse(L_skip_barrier); // non-static - Register klass = Z_R11; - __ load_method_holder(klass, Z_method); - __ clinit_barrier(klass, Z_thread, &L_skip_barrier /*L_fast_path*/); + Register klass = Z_R11; + __ load_method_holder(klass, Z_method); + __ clinit_barrier(klass, Z_thread, &L_skip_barrier /*L_fast_path*/); - __ load_const_optimized(klass, SharedRuntime::get_handle_wrong_method_stub()); - __ z_br(klass); + __ load_const_optimized(klass, SharedRuntime::get_handle_wrong_method_stub()); + __ z_br(klass); - __ bind(L_skip_barrier); - entry_address[AdapterBlob::C2I_No_Clinit_Check] = __ pc(); - } + __ bind(L_skip_barrier); + entry_address[AdapterBlob::C2I_No_Clinit_Check] = __ pc(); gen_c2i_adapter(masm, total_args_passed, comp_args_on_stack, sig_bt, regs, skip_fixup); return; diff --git a/src/hotspot/cpu/s390/templateTable_s390.cpp b/src/hotspot/cpu/s390/templateTable_s390.cpp index 4e8fdf275e4..647915ef4fa 100644 --- a/src/hotspot/cpu/s390/templateTable_s390.cpp +++ b/src/hotspot/cpu/s390/templateTable_s390.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. * Copyright (c) 2016, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -2377,7 +2377,8 @@ void TemplateTable::resolve_cache_and_index_for_method(int byte_no, __ z_cli(Address(Rcache, bc_offset), code); // Class initialization barrier for static methods - if (VM_Version::supports_fast_class_init_checks() && bytecode() == Bytecodes::_invokestatic) { + if (bytecode() == Bytecodes::_invokestatic) { + assert(VM_Version::supports_fast_class_init_checks(), "sanity"); const Register method = Z_R1_scratch; const Register klass = Z_R1_scratch; __ z_brne(L_clinit_barrier_slow); @@ -2427,8 +2428,8 @@ void TemplateTable::resolve_cache_and_index_for_field(int byte_no, __ z_cli(Address(cache, code_offset), code); // Class initialization barrier for static fields - if (VM_Version::supports_fast_class_init_checks() && - (bytecode() == Bytecodes::_getstatic || bytecode() == Bytecodes::_putstatic)) { + if (bytecode() == Bytecodes::_getstatic || bytecode() == Bytecodes::_putstatic) { + assert(VM_Version::supports_fast_class_init_checks(), "sanity"); const Register field_holder = index; __ z_brne(L_clinit_barrier_slow); diff --git a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp index 5a4a5b1809e..bbd43c1a0e8 100644 --- a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp +++ b/src/hotspot/cpu/x86/sharedRuntime_x86_64.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 @@ -1043,26 +1043,24 @@ void SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm, // Class initialization barrier for static methods entry_address[AdapterBlob::C2I_No_Clinit_Check] = nullptr; - if (VM_Version::supports_fast_class_init_checks()) { - Label L_skip_barrier; - Register method = rbx; + assert(VM_Version::supports_fast_class_init_checks(), "sanity"); + Label L_skip_barrier; + Register method = rbx; - { // Bypass the barrier for non-static methods - Register flags = rscratch1; - __ load_unsigned_short(flags, Address(method, Method::access_flags_offset())); - __ testl(flags, JVM_ACC_STATIC); - __ jcc(Assembler::zero, L_skip_barrier); // non-static - } + // Bypass the barrier for non-static methods + Register flags = rscratch1; + __ load_unsigned_short(flags, Address(method, Method::access_flags_offset())); + __ testl(flags, JVM_ACC_STATIC); + __ jcc(Assembler::zero, L_skip_barrier); // non-static - Register klass = rscratch1; - __ load_method_holder(klass, method); - __ clinit_barrier(klass, &L_skip_barrier /*L_fast_path*/); + Register klass = rscratch1; + __ load_method_holder(klass, method); + __ clinit_barrier(klass, &L_skip_barrier /*L_fast_path*/); - __ jump(RuntimeAddress(SharedRuntime::get_handle_wrong_method_stub())); // slow path + __ jump(RuntimeAddress(SharedRuntime::get_handle_wrong_method_stub())); // slow path - __ bind(L_skip_barrier); - entry_address[AdapterBlob::C2I_No_Clinit_Check] = __ pc(); - } + __ bind(L_skip_barrier); + entry_address[AdapterBlob::C2I_No_Clinit_Check] = __ pc(); BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler(); bs->c2i_entry_barrier(masm); @@ -1904,7 +1902,8 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm, int vep_offset = ((intptr_t)__ pc()) - start; - if (VM_Version::supports_fast_class_init_checks() && method->needs_clinit_barrier()) { + if (method->needs_clinit_barrier()) { + assert(VM_Version::supports_fast_class_init_checks(), "sanity"); Label L_skip_barrier; Register klass = r10; __ mov_metadata(klass, method->method_holder()); // InstanceKlass* @@ -3602,4 +3601,3 @@ RuntimeStub* SharedRuntime::generate_jfr_return_lease() { } #endif // INCLUDE_JFR - diff --git a/src/hotspot/cpu/x86/templateTable_x86.cpp b/src/hotspot/cpu/x86/templateTable_x86.cpp index 42392b84833..db7749ec482 100644 --- a/src/hotspot/cpu/x86/templateTable_x86.cpp +++ b/src/hotspot/cpu/x86/templateTable_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2216,7 +2216,8 @@ void TemplateTable::resolve_cache_and_index_for_method(int byte_no, __ cmpl(temp, code); // have we resolved this bytecode? // Class initialization barrier for static methods - if (VM_Version::supports_fast_class_init_checks() && bytecode() == Bytecodes::_invokestatic) { + if (bytecode() == Bytecodes::_invokestatic) { + assert(VM_Version::supports_fast_class_init_checks(), "sanity"); const Register method = temp; const Register klass = temp; @@ -2264,8 +2265,8 @@ void TemplateTable::resolve_cache_and_index_for_field(int byte_no, __ cmpl(temp, code); // have we resolved this bytecode? // Class initialization barrier for static fields - if (VM_Version::supports_fast_class_init_checks() && - (bytecode() == Bytecodes::_getstatic || bytecode() == Bytecodes::_putstatic)) { + if (bytecode() == Bytecodes::_getstatic || bytecode() == Bytecodes::_putstatic) { + assert(VM_Version::supports_fast_class_init_checks(), "sanity"); const Register field_holder = temp; __ jcc(Assembler::notEqual, L_clinit_barrier_slow); diff --git a/src/hotspot/os/bsd/memMapPrinter_macosx.cpp b/src/hotspot/os/bsd/memMapPrinter_macosx.cpp index 6fd08d63e85..30e258c9d2c 100644 --- a/src/hotspot/os/bsd/memMapPrinter_macosx.cpp +++ b/src/hotspot/os/bsd/memMapPrinter_macosx.cpp @@ -132,7 +132,7 @@ public: static const char* tagToStr(uint32_t user_tag) { switch (user_tag) { case 0: - return 0; + return nullptr; X1(MALLOC, malloc); X1(MALLOC_SMALL, malloc_small); X1(MALLOC_LARGE, malloc_large); diff --git a/src/hotspot/os/bsd/os_bsd.cpp b/src/hotspot/os/bsd/os_bsd.cpp index 667810bd6ca..0e21c2d1785 100644 --- a/src/hotspot/os/bsd/os_bsd.cpp +++ b/src/hotspot/os/bsd/os_bsd.cpp @@ -628,7 +628,7 @@ static void *thread_native_entry(Thread *thread) { log_info(os, thread)("Thread finished (tid: %zu, pthread id: %zu).", os::current_thread_id(), (uintx) pthread_self()); - return 0; + return nullptr; } bool os::create_thread(Thread* thread, ThreadType thr_type, @@ -1420,7 +1420,7 @@ int os::get_loaded_modules_info(os::LoadedModulesCallbackFunc callback, void *pa #elif defined(__APPLE__) for (uint32_t i = 1; i < _dyld_image_count(); i++) { // Value for top_address is returned as 0 since we don't have any information about module size - if (callback(_dyld_get_image_name(i), (address)_dyld_get_image_header(i), (address)0, param)) { + if (callback(_dyld_get_image_name(i), (address)_dyld_get_image_header(i), nullptr, param)) { return 1; } } diff --git a/src/hotspot/os/linux/cgroupSubsystem_linux.hpp b/src/hotspot/os/linux/cgroupSubsystem_linux.hpp index 8aafbf49c63..d083a9985c2 100644 --- a/src/hotspot/os/linux/cgroupSubsystem_linux.hpp +++ b/src/hotspot/os/linux/cgroupSubsystem_linux.hpp @@ -188,7 +188,7 @@ class CachedMetric : public CHeapObj{ volatile jlong _next_check_counter; public: CachedMetric() { - _metric = value_unlimited; + _metric = static_cast(value_unlimited); _next_check_counter = min_jlong; } bool should_check_metric() { diff --git a/src/hotspot/os/linux/osContainer_linux.cpp b/src/hotspot/os/linux/osContainer_linux.cpp index fe1dbc17239..b46263efd99 100644 --- a/src/hotspot/os/linux/osContainer_linux.cpp +++ b/src/hotspot/os/linux/osContainer_linux.cpp @@ -304,12 +304,13 @@ void OSContainer::print_container_metric(outputStream* st, const char* metrics, constexpr int longest_value = max_length - 11; // Max length - shortest "metric: " string ("cpu_quota: ") char value_str[longest_value + 1] = {}; os::snprintf_checked(value_str, longest_value, metric_fmt::fmt, value); - st->print("%s: %*s", metrics, max_length - static_cast(strlen(metrics)) - 2, value_str); // -2 for the ": " - if (unit[0] != '\0') { - st->print_cr(" %s", unit); - } else { - st->print_cr(""); - } + + const int pad_width = max_length - static_cast(strlen(metrics)) - 2; // -2 for the ": " + const char* unit_prefix = unit[0] != '\0' ? " " : ""; + + char line[128] = {}; + os::snprintf_checked(line, sizeof(line), "%s: %*s%s%s", metrics, pad_width, value_str, unit_prefix, unit); + st->print_cr("%s", line); } void OSContainer::print_container_helper(outputStream* st, MetricResult& res, const char* metrics) { diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp index 48529c6ce17..7190845a8ba 100644 --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -4963,9 +4963,14 @@ int os::open(const char *path, int oflag, int mode) { oflag |= O_CLOEXEC; int fd = ::open(path, oflag, mode); - if (fd == -1) return -1; + // No further checking is needed if open() returned an error or + // access mode is not read only. + if (fd == -1 || (oflag & O_ACCMODE) != O_RDONLY) { + return fd; + } - //If the open succeeded, the file might still be a directory + // If the open succeeded and is read only, the file might be a directory + // which the JVM doesn't allow to be read. { struct stat buf; int ret = ::fstat(fd, &buf); diff --git a/src/hotspot/os/posix/perfMemory_posix.cpp b/src/hotspot/os/posix/perfMemory_posix.cpp index 08a19270943..ce9c2a4f031 100644 --- a/src/hotspot/os/posix/perfMemory_posix.cpp +++ b/src/hotspot/os/posix/perfMemory_posix.cpp @@ -112,6 +112,10 @@ static void save_memory_to_file(char* addr, size_t size) { result = ::close(fd); if (result == OS_ERR) { warning("Could not close %s: %s\n", destfile, os::strerror(errno)); + } else { + if (!successful_write) { + remove(destfile); + } } } FREE_C_HEAP_ARRAY(char, destfile); @@ -949,6 +953,7 @@ static int create_sharedmem_file(const char* dirname, const char* filename, size warning("Insufficient space for shared memory file: %s/%s\n", dirname, filename); } result = OS_ERR; + remove(filename); break; } } diff --git a/src/hotspot/share/cds/archiveBuilder.cpp b/src/hotspot/share/cds/archiveBuilder.cpp index 6bbefea5cd9..328bed1ccfb 100644 --- a/src/hotspot/share/cds/archiveBuilder.cpp +++ b/src/hotspot/share/cds/archiveBuilder.cpp @@ -571,7 +571,12 @@ ArchiveBuilder::FollowMode ArchiveBuilder::get_follow_mode(MetaspaceClosure::Ref } if (is_excluded(klass)) { ResourceMark rm; - log_debug(cds, dynamic)("Skipping class (excluded): %s", klass->external_name()); + aot_log_trace(aot)("pointer set to null: class (excluded): %s", klass->external_name()); + return set_to_null; + } + if (klass->is_array_klass() && CDSConfig::is_dumping_dynamic_archive()) { + ResourceMark rm; + aot_log_trace(aot)("pointer set to null: array class not supported in dynamic region: %s", klass->external_name()); return set_to_null; } } diff --git a/src/hotspot/share/gc/g1/g1Arguments.cpp b/src/hotspot/share/gc/g1/g1Arguments.cpp index 58e76cdd43a..ffb06a7d822 100644 --- a/src/hotspot/share/gc/g1/g1Arguments.cpp +++ b/src/hotspot/share/gc/g1/g1Arguments.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. * Copyright (c) 2017, Red Hat, Inc. and/or its affiliates. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -209,6 +209,17 @@ void G1Arguments::initialize() { FLAG_SET_DEFAULT(GCTimeRatio, 24); } + // Do not interfere with GC-Pressure driven heap resizing unless the user + // explicitly sets otherwise. G1 heap sizing should be free to grow or shrink + // the heap based on GC pressure, rather than being forced to satisfy + // MinHeapFreeRatio or MaxHeapFreeRatio defaults that the user did not set. + if (FLAG_IS_DEFAULT(MinHeapFreeRatio)) { + FLAG_SET_DEFAULT(MinHeapFreeRatio, 0); + } + if (FLAG_IS_DEFAULT(MaxHeapFreeRatio)) { + FLAG_SET_DEFAULT(MaxHeapFreeRatio, 100); + } + // Below, we might need to calculate the pause time interval based on // the pause target. When we do so we are going to give G1 maximum // flexibility and allow it to do pauses when it needs to. So, we'll diff --git a/src/hotspot/share/gc/g1/g1BarrierSet.inline.hpp b/src/hotspot/share/gc/g1/g1BarrierSet.inline.hpp index ee2c1450d9b..794e5db0634 100644 --- a/src/hotspot/share/gc/g1/g1BarrierSet.inline.hpp +++ b/src/hotspot/share/gc/g1/g1BarrierSet.inline.hpp @@ -70,7 +70,11 @@ inline void G1BarrierSet::write_ref_field_pre(T* field) { template inline void G1BarrierSet::write_ref_field_post(T* field) { - volatile CardValue* byte = _card_table->byte_for(field); + // Make sure that the card table reference is read only once. Otherwise the compiler + // might reload that value in the two accesses below, that could cause writes to + // the wrong card table. + CardTable* card_table = AtomicAccess::load(&_card_table); + CardValue* byte = card_table->byte_for(field); if (*byte == G1CardTable::clean_card_val()) { *byte = G1CardTable::dirty_card_val(); } diff --git a/src/hotspot/share/gc/g1/g1BatchedTask.cpp b/src/hotspot/share/gc/g1/g1BatchedTask.cpp index 57558301541..1f082153476 100644 --- a/src/hotspot/share/gc/g1/g1BatchedTask.cpp +++ b/src/hotspot/share/gc/g1/g1BatchedTask.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 @@ -26,7 +26,6 @@ #include "gc/g1/g1BatchedTask.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1GCParPhaseTimesTracker.hpp" -#include "runtime/atomicAccess.hpp" #include "utilities/growableArray.hpp" void G1AbstractSubTask::record_work_item(uint worker_id, uint index, size_t count) { @@ -40,7 +39,7 @@ const char* G1AbstractSubTask::name() const { } bool G1BatchedTask::try_claim_serial_task(int& task) { - task = AtomicAccess::fetch_then_add(&_num_serial_tasks_done, 1); + task = _num_serial_tasks_done.fetch_then_add(1); return task < _serial_tasks.length(); } @@ -96,8 +95,8 @@ void G1BatchedTask::work(uint worker_id) { } G1BatchedTask::~G1BatchedTask() { - assert(AtomicAccess::load(&_num_serial_tasks_done) >= _serial_tasks.length(), - "Only %d tasks of %d claimed", AtomicAccess::load(&_num_serial_tasks_done), _serial_tasks.length()); + assert(_num_serial_tasks_done.load_relaxed() >= _serial_tasks.length(), + "Only %d tasks of %d claimed", _num_serial_tasks_done.load_relaxed(), _serial_tasks.length()); for (G1AbstractSubTask* task : _parallel_tasks) { delete task; diff --git a/src/hotspot/share/gc/g1/g1BatchedTask.hpp b/src/hotspot/share/gc/g1/g1BatchedTask.hpp index 020fda634e4..a6d2ef923c0 100644 --- a/src/hotspot/share/gc/g1/g1BatchedTask.hpp +++ b/src/hotspot/share/gc/g1/g1BatchedTask.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, 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 @@ -28,6 +28,7 @@ #include "gc/g1/g1GCPhaseTimes.hpp" #include "gc/shared/workerThread.hpp" #include "memory/allocation.hpp" +#include "runtime/atomic.hpp" template class GrowableArrayCHeap; @@ -120,7 +121,7 @@ public: // 5) ~T() // class G1BatchedTask : public WorkerTask { - volatile int _num_serial_tasks_done; + Atomic _num_serial_tasks_done; G1GCPhaseTimes* _phase_times; bool try_claim_serial_task(int& task); diff --git a/src/hotspot/share/gc/g1/g1CardTableClaimTable.cpp b/src/hotspot/share/gc/g1/g1CardTableClaimTable.cpp index e0cadbdd907..d8cabaa00a4 100644 --- a/src/hotspot/share/gc/g1/g1CardTableClaimTable.cpp +++ b/src/hotspot/share/gc/g1/g1CardTableClaimTable.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 @@ -44,20 +44,20 @@ G1CardTableClaimTable::~G1CardTableClaimTable() { void G1CardTableClaimTable::initialize(uint max_reserved_regions) { assert(_card_claims == nullptr, "Must not be initialized twice"); - _card_claims = NEW_C_HEAP_ARRAY(uint, max_reserved_regions, mtGC); + _card_claims = NEW_C_HEAP_ARRAY(Atomic, max_reserved_regions, mtGC); _max_reserved_regions = max_reserved_regions; reset_all_to_unclaimed(); } void G1CardTableClaimTable::reset_all_to_unclaimed() { for (uint i = 0; i < _max_reserved_regions; i++) { - _card_claims[i] = 0; + _card_claims[i].store_relaxed(0); } } void G1CardTableClaimTable::reset_all_to_claimed() { for (uint i = 0; i < _max_reserved_regions; i++) { - _card_claims[i] = (uint)G1HeapRegion::CardsPerRegion; + _card_claims[i].store_relaxed((uint)G1HeapRegion::CardsPerRegion); } } diff --git a/src/hotspot/share/gc/g1/g1CardTableClaimTable.hpp b/src/hotspot/share/gc/g1/g1CardTableClaimTable.hpp index 4f524b83f97..822ef45c722 100644 --- a/src/hotspot/share/gc/g1/g1CardTableClaimTable.hpp +++ b/src/hotspot/share/gc/g1/g1CardTableClaimTable.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,6 +27,7 @@ #include "gc/g1/g1CardTable.hpp" #include "memory/allocation.hpp" +#include "runtime/atomic.hpp" class G1HeapRegionClosure; @@ -45,7 +46,7 @@ class G1CardTableClaimTable : public CHeapObj { // Card table iteration claim values for every heap region, from 0 (completely unclaimed) // to (>=) G1HeapRegion::CardsPerRegion (completely claimed). - uint volatile* _card_claims; + Atomic* _card_claims; uint _cards_per_chunk; // For conversion between card index and chunk index. diff --git a/src/hotspot/share/gc/g1/g1CardTableClaimTable.inline.hpp b/src/hotspot/share/gc/g1/g1CardTableClaimTable.inline.hpp index d682f0d17ae..35b2484982c 100644 --- a/src/hotspot/share/gc/g1/g1CardTableClaimTable.inline.hpp +++ b/src/hotspot/share/gc/g1/g1CardTableClaimTable.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,26 +29,25 @@ #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1HeapRegion.inline.hpp" -#include "runtime/atomicAccess.hpp" bool G1CardTableClaimTable::has_unclaimed_cards(uint region) { assert(region < _max_reserved_regions, "Tried to access invalid region %u", region); - return AtomicAccess::load(&_card_claims[region]) < G1HeapRegion::CardsPerRegion; + return _card_claims[region].load_relaxed() < G1HeapRegion::CardsPerRegion; } void G1CardTableClaimTable::reset_to_unclaimed(uint region) { assert(region < _max_reserved_regions, "Tried to access invalid region %u", region); - AtomicAccess::store(&_card_claims[region], 0u); + _card_claims[region].store_relaxed(0u); } uint G1CardTableClaimTable::claim_cards(uint region, uint increment) { assert(region < _max_reserved_regions, "Tried to access invalid region %u", region); - return AtomicAccess::fetch_then_add(&_card_claims[region], increment, memory_order_relaxed); + return _card_claims[region].fetch_then_add(increment, memory_order_relaxed); } uint G1CardTableClaimTable::claim_chunk(uint region) { assert(region < _max_reserved_regions, "Tried to access invalid region %u", region); - return AtomicAccess::fetch_then_add(&_card_claims[region], cards_per_chunk(), memory_order_relaxed); + return _card_claims[region].fetch_then_add(cards_per_chunk(), memory_order_relaxed); } uint G1CardTableClaimTable::claim_all_cards(uint region) { diff --git a/src/hotspot/share/gc/g1/g1CodeRootSet.cpp b/src/hotspot/share/gc/g1/g1CodeRootSet.cpp index 60ad3a2af32..ca4487876b9 100644 --- a/src/hotspot/share/gc/g1/g1CodeRootSet.cpp +++ b/src/hotspot/share/gc/g1/g1CodeRootSet.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 @@ -28,7 +28,7 @@ #include "gc/g1/g1HeapRegion.hpp" #include "memory/allocation.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomicAccess.hpp" +#include "runtime/atomic.hpp" #include "utilities/concurrentHashTable.inline.hpp" #include "utilities/concurrentHashTableTasks.inline.hpp" @@ -60,7 +60,7 @@ class G1CodeRootSetHashTable : public CHeapObj { HashTable _table; HashTableScanTask _table_scanner; - size_t volatile _num_entries; + Atomic _num_entries; bool is_empty() const { return number_of_entries() == 0; } @@ -120,7 +120,7 @@ public: bool grow_hint = false; bool inserted = _table.insert(Thread::current(), lookup, method, &grow_hint); if (inserted) { - AtomicAccess::inc(&_num_entries); + _num_entries.add_then_fetch(1u); } if (grow_hint) { _table.grow(Thread::current()); @@ -131,7 +131,7 @@ public: HashTableLookUp lookup(method); bool removed = _table.remove(Thread::current(), lookup); if (removed) { - AtomicAccess::dec(&_num_entries); + _num_entries.sub_then_fetch(1u); } return removed; } @@ -182,7 +182,7 @@ public: guarantee(succeeded, "unable to clean table"); if (num_deleted != 0) { - size_t current_size = AtomicAccess::sub(&_num_entries, num_deleted); + size_t current_size = _num_entries.sub_then_fetch(num_deleted); shrink_to_match(current_size); } } @@ -226,7 +226,7 @@ public: size_t mem_size() { return sizeof(*this) + _table.get_mem_size(Thread::current()); } - size_t number_of_entries() const { return AtomicAccess::load(&_num_entries); } + size_t number_of_entries() const { return _num_entries.load_relaxed(); } }; uintx G1CodeRootSetHashTable::HashTableLookUp::get_hash() const { diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp index aff7166d391..8009df1fa6a 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -54,6 +54,7 @@ #include "memory/allocation.hpp" #include "memory/iterator.hpp" #include "memory/memRegion.hpp" +#include "runtime/atomic.hpp" #include "runtime/mutexLocker.hpp" #include "runtime/threadSMR.hpp" #include "utilities/bitMap.hpp" @@ -124,7 +125,7 @@ class G1JavaThreadsListClaimer : public StackObj { ThreadsListHandle _list; uint _claim_step; - volatile uint _cur_claim; + Atomic _cur_claim; // Attempts to claim _claim_step JavaThreads, returning an array of claimed // JavaThread* with count elements. Returns null (and a zero count) if there @@ -1267,7 +1268,6 @@ public: bool is_marked(oop obj) const; - inline static bool is_obj_filler(const oop obj); // Determine if an object is dead, given the object and also // the region to which the object belongs. inline bool is_obj_dead(const oop obj, const G1HeapRegion* hr) const; diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp b/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp index abd61e72d57..958b171444e 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,10 +38,10 @@ #include "gc/g1/g1Policy.hpp" #include "gc/g1/g1RegionPinCache.inline.hpp" #include "gc/g1/g1RemSet.hpp" +#include "gc/shared/collectedHeap.inline.hpp" #include "gc/shared/markBitMap.inline.hpp" #include "gc/shared/taskqueue.inline.hpp" #include "oops/stackChunkOop.hpp" -#include "runtime/atomicAccess.hpp" #include "runtime/threadSMR.inline.hpp" #include "utilities/bitMap.inline.hpp" @@ -53,10 +53,10 @@ inline bool G1STWIsAliveClosure::do_object_b(oop p) { inline JavaThread* const* G1JavaThreadsListClaimer::claim(uint& count) { count = 0; - if (AtomicAccess::load(&_cur_claim) >= _list.length()) { + if (_cur_claim.load_relaxed() >= _list.length()) { return nullptr; } - uint claim = AtomicAccess::fetch_then_add(&_cur_claim, _claim_step); + uint claim = _cur_claim.fetch_then_add(_claim_step); if (claim >= _list.length()) { return nullptr; } @@ -230,16 +230,11 @@ inline bool G1CollectedHeap::requires_barriers(stackChunkOop obj) const { return !heap_region_containing(obj)->is_young(); // is_in_young does an unnecessary null check } -inline bool G1CollectedHeap::is_obj_filler(const oop obj) { - Klass* k = obj->klass_without_asserts(); - return k == Universe::fillerArrayKlass() || k == vmClasses::FillerObject_klass(); -} - inline bool G1CollectedHeap::is_obj_dead(const oop obj, const G1HeapRegion* hr) const { assert(!hr->is_free(), "looking up obj " PTR_FORMAT " in Free region %u", p2i(obj), hr->hrm_index()); if (hr->is_in_parsable_area(obj)) { // This object is in the parsable part of the heap, live unless scrubbed. - return is_obj_filler(obj); + return is_filler_object(obj); } else { // From Remark until a region has been concurrently scrubbed, parts of the // region is not guaranteed to be parsable. Use the bitmap for liveness. diff --git a/src/hotspot/share/gc/g1/g1CollectionSetChooser.cpp b/src/hotspot/share/gc/g1/g1CollectionSetChooser.cpp index 954ca40a77f..d9496410c12 100644 --- a/src/hotspot/share/gc/g1/g1CollectionSetChooser.cpp +++ b/src/hotspot/share/gc/g1/g1CollectionSetChooser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ #include "gc/g1/g1CollectionSetChooser.hpp" #include "gc/g1/g1HeapRegionRemSet.inline.hpp" #include "gc/shared/space.hpp" -#include "runtime/atomicAccess.hpp" +#include "runtime/atomic.hpp" #include "utilities/quickSort.hpp" // Determine collection set candidates (from marking): For all regions determine @@ -50,7 +50,7 @@ class G1BuildCandidateRegionsTask : public WorkerTask { G1HeapRegion** _data; - uint volatile _cur_claim_idx; + Atomic _cur_claim_idx; static int compare_region_gc_efficiency(G1HeapRegion** rr1, G1HeapRegion** rr2) { G1HeapRegion* r1 = *rr1; @@ -105,7 +105,7 @@ class G1BuildCandidateRegionsTask : public WorkerTask { // Claim a new chunk, returning its bounds [from, to[. void claim_chunk(uint& from, uint& to) { - uint result = AtomicAccess::add(&_cur_claim_idx, _chunk_size); + uint result = _cur_claim_idx.add_then_fetch(_chunk_size); assert(_max_size > result - 1, "Array too small, is %u should be %u with chunk size %u.", _max_size, result, _chunk_size); @@ -121,14 +121,15 @@ class G1BuildCandidateRegionsTask : public WorkerTask { } void sort_by_gc_efficiency() { - if (_cur_claim_idx == 0) { + uint length = _cur_claim_idx.load_relaxed(); + if (length == 0) { return; } - for (uint i = _cur_claim_idx; i < _max_size; i++) { + for (uint i = length; i < _max_size; i++) { assert(_data[i] == nullptr, "must be"); } - qsort(_data, _cur_claim_idx, sizeof(_data[0]), (_sort_Fn)compare_region_gc_efficiency); - for (uint i = _cur_claim_idx; i < _max_size; i++) { + qsort(_data, length, sizeof(_data[0]), (_sort_Fn)compare_region_gc_efficiency); + for (uint i = length; i < _max_size; i++) { assert(_data[i] == nullptr, "must be"); } } diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp index 456d543fa10..52591f7ce5f 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,6 +51,9 @@ #include "gc/shared/gcTimer.hpp" #include "gc/shared/gcTraceTime.inline.hpp" #include "gc/shared/gcVMOperations.hpp" +#include "gc/shared/partialArraySplitter.inline.hpp" +#include "gc/shared/partialArrayState.hpp" +#include "gc/shared/partialArrayTaskStats.hpp" #include "gc/shared/referencePolicy.hpp" #include "gc/shared/suspendibleThreadSet.hpp" #include "gc/shared/taskqueue.inline.hpp" @@ -67,7 +70,6 @@ #include "nmt/memTracker.hpp" #include "oops/access.inline.hpp" #include "oops/oop.inline.hpp" -#include "runtime/atomicAccess.hpp" #include "runtime/globals_extension.hpp" #include "runtime/handles.inline.hpp" #include "runtime/java.hpp" @@ -76,6 +78,7 @@ #include "runtime/prefetch.inline.hpp" #include "runtime/threads.hpp" #include "utilities/align.hpp" +#include "utilities/checkedCast.hpp" #include "utilities/formatBuffer.hpp" #include "utilities/growableArray.hpp" #include "utilities/powerOfTwo.hpp" @@ -99,7 +102,7 @@ bool G1CMBitMapClosure::do_addr(HeapWord* const addr) { // We move that task's local finger along. _task->move_finger_to(addr); - _task->scan_task_entry(G1TaskQueueEntry::from_oop(cast_to_oop(addr))); + _task->process_entry(G1TaskQueueEntry(cast_to_oop(addr)), false /* stolen */); // we only partially drain the local queue and global stack _task->drain_local_queue(true); _task->drain_global_stack(true); @@ -148,25 +151,25 @@ bool G1CMMarkStack::initialize() { } G1CMMarkStack::TaskQueueEntryChunk* G1CMMarkStack::ChunkAllocator::allocate_new_chunk() { - if (_size >= _max_capacity) { + if (_size.load_relaxed() >= _max_capacity) { return nullptr; } - size_t cur_idx = AtomicAccess::fetch_then_add(&_size, 1u); + size_t cur_idx = _size.fetch_then_add(1u); if (cur_idx >= _max_capacity) { return nullptr; } size_t bucket = get_bucket(cur_idx); - if (AtomicAccess::load_acquire(&_buckets[bucket]) == nullptr) { + if (_buckets[bucket].load_acquire() == nullptr) { if (!_should_grow) { // Prefer to restart the CM. return nullptr; } MutexLocker x(G1MarkStackChunkList_lock, Mutex::_no_safepoint_check_flag); - if (AtomicAccess::load_acquire(&_buckets[bucket]) == nullptr) { + if (_buckets[bucket].load_acquire() == nullptr) { size_t desired_capacity = bucket_size(bucket) * 2; if (!try_expand_to(desired_capacity)) { return nullptr; @@ -175,7 +178,7 @@ G1CMMarkStack::TaskQueueEntryChunk* G1CMMarkStack::ChunkAllocator::allocate_new_ } size_t bucket_idx = get_bucket_index(cur_idx); - TaskQueueEntryChunk* result = ::new (&_buckets[bucket][bucket_idx]) TaskQueueEntryChunk; + TaskQueueEntryChunk* result = ::new (&_buckets[bucket].load_relaxed()[bucket_idx]) TaskQueueEntryChunk; result->next = nullptr; return result; } @@ -197,10 +200,10 @@ bool G1CMMarkStack::ChunkAllocator::initialize(size_t initial_capacity, size_t m _max_capacity = max_capacity; _num_buckets = get_bucket(_max_capacity) + 1; - _buckets = NEW_C_HEAP_ARRAY(TaskQueueEntryChunk*, _num_buckets, mtGC); + _buckets = NEW_C_HEAP_ARRAY(Atomic, _num_buckets, mtGC); for (size_t i = 0; i < _num_buckets; i++) { - _buckets[i] = nullptr; + _buckets[i].store_relaxed(nullptr); } size_t new_capacity = bucket_size(0); @@ -240,9 +243,9 @@ G1CMMarkStack::ChunkAllocator::~ChunkAllocator() { } for (size_t i = 0; i < _num_buckets; i++) { - if (_buckets[i] != nullptr) { - MmapArrayAllocator::free(_buckets[i], bucket_size(i)); - _buckets[i] = nullptr; + if (_buckets[i].load_relaxed() != nullptr) { + MmapArrayAllocator::free(_buckets[i].load_relaxed(), bucket_size(i)); + _buckets[i].store_relaxed(nullptr); } } @@ -259,7 +262,7 @@ bool G1CMMarkStack::ChunkAllocator::reserve(size_t new_capacity) { // and the new capacity (new_capacity). This step ensures that there are no gaps in the // array and that the capacity accurately reflects the reserved memory. for (; i <= highest_bucket; i++) { - if (AtomicAccess::load_acquire(&_buckets[i]) != nullptr) { + if (_buckets[i].load_acquire() != nullptr) { continue; // Skip over already allocated buckets. } @@ -279,7 +282,7 @@ bool G1CMMarkStack::ChunkAllocator::reserve(size_t new_capacity) { return false; } _capacity += bucket_capacity; - AtomicAccess::release_store(&_buckets[i], bucket_base); + _buckets[i].release_store(bucket_base); } return true; } @@ -490,6 +493,7 @@ G1ConcurrentMark::G1ConcurrentMark(G1CollectedHeap* g1h, _task_queues(new G1CMTaskQueueSet(_max_num_tasks)), _terminator(_max_num_tasks, _task_queues), + _partial_array_state_manager(new PartialArrayStateManager(_max_num_tasks)), _first_overflow_barrier_sync(), _second_overflow_barrier_sync(), @@ -556,6 +560,10 @@ G1ConcurrentMark::G1ConcurrentMark(G1CollectedHeap* g1h, reset_at_marking_complete(); } +PartialArrayStateManager* G1ConcurrentMark::partial_array_state_manager() const { + return _partial_array_state_manager; +} + void G1ConcurrentMark::reset() { _has_aborted = false; @@ -650,7 +658,26 @@ void G1ConcurrentMark::set_concurrency_and_phase(uint active_tasks, bool concurr } } +#if TASKQUEUE_STATS +void G1ConcurrentMark::print_and_reset_taskqueue_stats() { + + _task_queues->print_and_reset_taskqueue_stats("G1ConcurrentMark Oop Queue"); + + auto get_pa_stats = [&](uint i) { + return _tasks[i]->partial_array_task_stats(); + }; + + PartialArrayTaskStats::log_set(_max_num_tasks, get_pa_stats, + "G1ConcurrentMark Partial Array Task Stats"); + + for (uint i = 0; i < _max_num_tasks; ++i) { + get_pa_stats(i)->reset(); + } +} +#endif + void G1ConcurrentMark::reset_at_marking_complete() { + TASKQUEUE_STATS_ONLY(print_and_reset_taskqueue_stats()); // We set the global marking state to some default values when we're // not doing marking. reset_marking_for_restart(); @@ -804,11 +831,25 @@ void G1ConcurrentMark::cleanup_for_next_mark() { clear_bitmap(_concurrent_workers, true); + reset_partial_array_state_manager(); + // Repeat the asserts from above. guarantee(cm_thread()->in_progress(), "invariant"); guarantee(!_g1h->collector_state()->mark_or_rebuild_in_progress(), "invariant"); } +void G1ConcurrentMark::reset_partial_array_state_manager() { + for (uint i = 0; i < _max_num_tasks; ++i) { + _tasks[i]->unregister_partial_array_splitter(); + } + + partial_array_state_manager()->reset(); + + for (uint i = 0; i < _max_num_tasks; ++i) { + _tasks[i]->register_partial_array_splitter(); + } +} + void G1ConcurrentMark::clear_bitmap(WorkerThreads* workers) { assert_at_safepoint_on_vm_thread(); // To avoid fragmentation the full collection requesting to clear the bitmap @@ -1789,17 +1830,18 @@ public: { } void operator()(G1TaskQueueEntry task_entry) const { - if (task_entry.is_array_slice()) { - guarantee(_g1h->is_in_reserved(task_entry.slice()), "Slice " PTR_FORMAT " must be in heap.", p2i(task_entry.slice())); + if (task_entry.is_partial_array_state()) { + oop obj = task_entry.to_partial_array_state()->source(); + guarantee(_g1h->is_in_reserved(obj), "Partial Array " PTR_FORMAT " must be in heap.", p2i(obj)); return; } - guarantee(oopDesc::is_oop(task_entry.obj()), + guarantee(oopDesc::is_oop(task_entry.to_oop()), "Non-oop " PTR_FORMAT ", phase: %s, info: %d", - p2i(task_entry.obj()), _phase, _info); - G1HeapRegion* r = _g1h->heap_region_containing(task_entry.obj()); + p2i(task_entry.to_oop()), _phase, _info); + G1HeapRegion* r = _g1h->heap_region_containing(task_entry.to_oop()); guarantee(!(r->in_collection_set() || r->has_index_in_opt_cset()), "obj " PTR_FORMAT " from %s (%d) in region %u in (optional) collection set", - p2i(task_entry.obj()), _phase, _info, r->hrm_index()); + p2i(task_entry.to_oop()), _phase, _info, r->hrm_index()); } }; @@ -2055,6 +2097,17 @@ void G1CMTask::reset(G1CMBitMap* mark_bitmap) { _mark_stats_cache.reset(); } +void G1CMTask::register_partial_array_splitter() { + + ::new (&_partial_array_splitter) PartialArraySplitter(_cm->partial_array_state_manager(), + _cm->max_num_tasks(), + ObjArrayMarkingStride); +} + +void G1CMTask::unregister_partial_array_splitter() { + _partial_array_splitter.~PartialArraySplitter(); +} + bool G1CMTask::should_exit_termination() { if (!regular_clock_call()) { return true; @@ -2185,7 +2238,7 @@ bool G1CMTask::get_entries_from_global_stack() { if (task_entry.is_null()) { break; } - assert(task_entry.is_array_slice() || oopDesc::is_oop(task_entry.obj()), "Element " PTR_FORMAT " must be an array slice or oop", p2i(task_entry.obj())); + assert(task_entry.is_partial_array_state() || oopDesc::is_oop(task_entry.to_oop()), "Element " PTR_FORMAT " must be an array slice or oop", p2i(task_entry.to_oop())); bool success = _task_queue->push(task_entry); // We only call this when the local queue is empty or under a // given target limit. So, we do not expect this push to fail. @@ -2216,7 +2269,7 @@ void G1CMTask::drain_local_queue(bool partially) { G1TaskQueueEntry entry; bool ret = _task_queue->pop_local(entry); while (ret) { - scan_task_entry(entry); + process_entry(entry, false /* stolen */); if (_task_queue->size() <= target_size || has_aborted()) { ret = false; } else { @@ -2226,6 +2279,37 @@ void G1CMTask::drain_local_queue(bool partially) { } } +size_t G1CMTask::start_partial_array_processing(oop obj) { + assert(should_be_sliced(obj), "Must be an array object %d and large %zu", obj->is_objArray(), obj->size()); + + objArrayOop obj_array = objArrayOop(obj); + size_t array_length = obj_array->length(); + + size_t initial_chunk_size = _partial_array_splitter.start(_task_queue, obj_array, nullptr, array_length); + + // Mark objArray klass metadata + if (_cm_oop_closure->do_metadata()) { + _cm_oop_closure->do_klass(obj_array->klass()); + } + + process_array_chunk(obj_array, 0, initial_chunk_size); + + // Include object header size + return objArrayOopDesc::object_size(checked_cast(initial_chunk_size)); +} + +size_t G1CMTask::process_partial_array(const G1TaskQueueEntry& task, bool stolen) { + PartialArrayState* state = task.to_partial_array_state(); + // Access state before release by claim(). + objArrayOop obj = objArrayOop(state->source()); + + PartialArraySplitter::Claim claim = + _partial_array_splitter.claim(state, _task_queue, stolen); + + process_array_chunk(obj, claim._start, claim._end); + return heap_word_size((claim._end - claim._start) * heapOopSize); +} + void G1CMTask::drain_global_stack(bool partially) { if (has_aborted()) { return; @@ -2430,7 +2514,7 @@ void G1CMTask::attempt_stealing() { while (!has_aborted()) { G1TaskQueueEntry entry; if (_cm->try_stealing(_worker_id, entry)) { - scan_task_entry(entry); + process_entry(entry, true /* stolen */); // And since we're towards the end, let's totally drain the // local queue and global stack. @@ -2759,12 +2843,12 @@ G1CMTask::G1CMTask(uint worker_id, G1ConcurrentMark* cm, G1CMTaskQueue* task_queue, G1RegionMarkStats* mark_stats) : - _objArray_processor(this), _worker_id(worker_id), _g1h(G1CollectedHeap::heap()), _cm(cm), _mark_bitmap(nullptr), _task_queue(task_queue), + _partial_array_splitter(_cm->partial_array_state_manager(), _cm->max_num_tasks(), ObjArrayMarkingStride), _mark_stats_cache(mark_stats, G1RegionMarkStatsCache::RegionMarkStatsCacheSize), _calls(0), _time_target_ms(0.0), diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMark.hpp b/src/hotspot/share/gc/g1/g1ConcurrentMark.hpp index 752082ce629..52a1b133439 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMark.hpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,17 +26,20 @@ #define SHARE_GC_G1_G1CONCURRENTMARK_HPP #include "gc/g1/g1ConcurrentMarkBitMap.hpp" -#include "gc/g1/g1ConcurrentMarkObjArrayProcessor.hpp" #include "gc/g1/g1HeapRegionSet.hpp" #include "gc/g1/g1HeapVerifier.hpp" #include "gc/g1/g1RegionMarkStatsCache.hpp" #include "gc/shared/gcCause.hpp" +#include "gc/shared/partialArraySplitter.hpp" +#include "gc/shared/partialArrayState.hpp" +#include "gc/shared/partialArrayTaskStats.hpp" #include "gc/shared/taskqueue.hpp" #include "gc/shared/taskTerminator.hpp" #include "gc/shared/verifyOption.hpp" #include "gc/shared/workerThread.hpp" #include "gc/shared/workerUtils.hpp" #include "memory/allocation.hpp" +#include "runtime/atomic.hpp" #include "utilities/compilerWarnings.hpp" #include "utilities/numberSeq.hpp" @@ -53,41 +56,7 @@ class G1RegionToSpaceMapper; class G1SurvivorRegions; class ThreadClosure; -// This is a container class for either an oop or a continuation address for -// mark stack entries. Both are pushed onto the mark stack. -class G1TaskQueueEntry { -private: - void* _holder; - - static const uintptr_t ArraySliceBit = 1; - - G1TaskQueueEntry(oop obj) : _holder(obj) { - assert(_holder != nullptr, "Not allowed to set null task queue element"); - } - G1TaskQueueEntry(HeapWord* addr) : _holder((void*)((uintptr_t)addr | ArraySliceBit)) { } -public: - - G1TaskQueueEntry() : _holder(nullptr) { } - // Trivially copyable, for use in GenericTaskQueue. - - static G1TaskQueueEntry from_slice(HeapWord* what) { return G1TaskQueueEntry(what); } - static G1TaskQueueEntry from_oop(oop obj) { return G1TaskQueueEntry(obj); } - - oop obj() const { - assert(!is_array_slice(), "Trying to read array slice " PTR_FORMAT " as oop", p2i(_holder)); - return cast_to_oop(_holder); - } - - HeapWord* slice() const { - assert(is_array_slice(), "Trying to read oop " PTR_FORMAT " as array slice", p2i(_holder)); - return (HeapWord*)((uintptr_t)_holder & ~ArraySliceBit); - } - - bool is_oop() const { return !is_array_slice(); } - bool is_array_slice() const { return ((uintptr_t)_holder & ArraySliceBit) != 0; } - bool is_null() const { return _holder == nullptr; } -}; - +typedef ScannerTask G1TaskQueueEntry; typedef GenericTaskQueue G1CMTaskQueue; typedef GenericTaskQueueSet G1CMTaskQueueSet; @@ -172,9 +141,9 @@ private: size_t _capacity; size_t _num_buckets; bool _should_grow; - TaskQueueEntryChunk* volatile* _buckets; + Atomic* _buckets; char _pad0[DEFAULT_PADDING_SIZE]; - volatile size_t _size; + Atomic _size; char _pad4[DEFAULT_PADDING_SIZE - sizeof(size_t)]; size_t bucket_size(size_t bucket) { @@ -212,7 +181,7 @@ private: bool initialize(size_t initial_capacity, size_t max_capacity); void reset() { - _size = 0; + _size.store_relaxed(0); _should_grow = false; } @@ -411,6 +380,8 @@ class G1ConcurrentMark : public CHeapObj { G1CMTaskQueueSet* _task_queues; // Task queue set TaskTerminator _terminator; // For termination + PartialArrayStateManager* _partial_array_state_manager; + // Two sync barriers that are used to synchronize tasks when an // overflow occurs. The algorithm is the following. All tasks enter // the first one to ensure that they have all stopped manipulating @@ -488,6 +459,8 @@ class G1ConcurrentMark : public CHeapObj { // Prints all gathered CM-related statistics void print_stats(); + void print_and_reset_taskqueue_stats(); + HeapWord* finger() { return _finger; } bool concurrent() { return _concurrent; } uint active_tasks() { return _num_active_tasks; } @@ -556,14 +529,14 @@ public: // mark_in_bitmap call. Updates various statistics data. void add_to_liveness(uint worker_id, oop const obj, size_t size); // Did the last marking find a live object between bottom and TAMS? - bool contains_live_object(uint region) const { return _region_mark_stats[region]._live_words != 0; } + bool contains_live_object(uint region) const { return _region_mark_stats[region].live_words() != 0; } // Live bytes in the given region as determined by concurrent marking, i.e. the amount of // live bytes between bottom and TAMS. - size_t live_bytes(uint region) const { return _region_mark_stats[region]._live_words * HeapWordSize; } + size_t live_bytes(uint region) const { return _region_mark_stats[region].live_words() * HeapWordSize; } // Set live bytes for concurrent marking. - void set_live_bytes(uint region, size_t live_bytes) { _region_mark_stats[region]._live_words = live_bytes / HeapWordSize; } + void set_live_bytes(uint region, size_t live_bytes) { _region_mark_stats[region]._live_words.store_relaxed(live_bytes / HeapWordSize); } // Approximate number of incoming references found during marking. - size_t incoming_refs(uint region) const { return _region_mark_stats[region]._incoming_refs; } + size_t incoming_refs(uint region) const { return _region_mark_stats[region].incoming_refs(); } // Update the TAMS for the given region to the current top. inline void update_top_at_mark_start(G1HeapRegion* r); @@ -582,6 +555,8 @@ public: uint worker_id_offset() const { return _worker_id_offset; } + uint max_num_tasks() const {return _max_num_tasks; } + // Clear statistics gathered during the concurrent cycle for the given region after // it has been reclaimed. void clear_statistics(G1HeapRegion* r); @@ -631,6 +606,8 @@ public: // Calculates the number of concurrent GC threads to be used in the marking phase. uint calc_active_marking_workers(); + PartialArrayStateManager* partial_array_state_manager() const; + // Resets the global marking data structures, as well as the // task local ones; should be called during concurrent start. void reset(); @@ -642,6 +619,10 @@ public: // to be called concurrently to the mutator. It will yield to safepoint requests. void cleanup_for_next_mark(); + // Recycle the memory that has been requested by allocators associated with + // this manager. + void reset_partial_array_state_manager(); + // Clear the next marking bitmap during safepoint. void clear_bitmap(WorkerThreads* workers); @@ -732,14 +713,13 @@ private: refs_reached_period = 1024, }; - G1CMObjArrayProcessor _objArray_processor; - uint _worker_id; G1CollectedHeap* _g1h; G1ConcurrentMark* _cm; G1CMBitMap* _mark_bitmap; // the task queue of this task G1CMTaskQueue* _task_queue; + PartialArraySplitter _partial_array_splitter; G1RegionMarkStatsCache _mark_stats_cache; // Number of calls to this task @@ -850,13 +830,24 @@ private: // mark bitmap scan, and so needs to be pushed onto the mark stack. bool is_below_finger(oop obj, HeapWord* global_finger) const; - template void process_grey_task_entry(G1TaskQueueEntry task_entry); + template void process_grey_task_entry(G1TaskQueueEntry task_entry, bool stolen); + + static bool should_be_sliced(oop obj); + // Start processing the given objArrayOop by first pushing its continuations and + // then scanning the first chunk including the header. + size_t start_partial_array_processing(oop obj); + // Process the given continuation. Returns the number of words scanned. + size_t process_partial_array(const G1TaskQueueEntry& task, bool stolen); + // Apply the closure to the given range of elements in the objArray. + inline void process_array_chunk(objArrayOop obj, size_t start, size_t end); public: - // Apply the closure on the given area of the objArray. Return the number of words - // scanned. - inline size_t scan_objArray(objArrayOop obj, MemRegion mr); // Resets the task; should be called right at the beginning of a marking phase. void reset(G1CMBitMap* mark_bitmap); + // Register/unregister Partial Array Splitter Allocator with the PartialArrayStateManager. + // This allows us to discard memory arenas used for partial object array states at the end + // of a concurrent mark cycle. + void register_partial_array_splitter(); + void unregister_partial_array_splitter(); // Clears all the fields that correspond to a claimed region. void clear_region_fields(); @@ -912,7 +903,7 @@ public: inline bool deal_with_reference(T* p); // Scans an object and visits its children. - inline void scan_task_entry(G1TaskQueueEntry task_entry); + inline void process_entry(G1TaskQueueEntry task_entry, bool stolen); // Pushes an object on the local queue. inline void push(G1TaskQueueEntry task_entry); @@ -957,6 +948,11 @@ public: Pair flush_mark_stats_cache(); // Prints statistics associated with this task void print_stats(); +#if TASKQUEUE_STATS + PartialArrayTaskStats* partial_array_task_stats() { + return _partial_array_splitter.stats(); + } +#endif }; // Class that's used to to print out per-region liveness diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp b/src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp index 6f71012ff7c..fe72c68d4eb 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,6 @@ #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1ConcurrentMarkBitMap.inline.hpp" -#include "gc/g1/g1ConcurrentMarkObjArrayProcessor.inline.hpp" #include "gc/g1/g1HeapRegion.hpp" #include "gc/g1/g1HeapRegionRemSet.inline.hpp" #include "gc/g1/g1OopClosures.inline.hpp" @@ -39,6 +38,7 @@ #include "gc/shared/suspendibleThreadSet.hpp" #include "gc/shared/taskqueue.inline.hpp" #include "utilities/bitMap.inline.hpp" +#include "utilities/checkedCast.hpp" inline bool G1CMIsAliveClosure::do_object_b(oop obj) { // Check whether the passed in object is null. During discovery the referent @@ -107,13 +107,15 @@ inline void G1CMMarkStack::iterate(Fn fn) const { #endif // It scans an object and visits its children. -inline void G1CMTask::scan_task_entry(G1TaskQueueEntry task_entry) { process_grey_task_entry(task_entry); } +inline void G1CMTask::process_entry(G1TaskQueueEntry task_entry, bool stolen) { + process_grey_task_entry(task_entry, stolen); +} inline void G1CMTask::push(G1TaskQueueEntry task_entry) { - assert(task_entry.is_array_slice() || _g1h->is_in_reserved(task_entry.obj()), "invariant"); - assert(task_entry.is_array_slice() || !_g1h->is_on_master_free_list( - _g1h->heap_region_containing(task_entry.obj())), "invariant"); - assert(task_entry.is_array_slice() || _mark_bitmap->is_marked(cast_from_oop(task_entry.obj())), "invariant"); + assert(task_entry.is_partial_array_state() || _g1h->is_in_reserved(task_entry.to_oop()), "invariant"); + assert(task_entry.is_partial_array_state() || !_g1h->is_on_master_free_list( + _g1h->heap_region_containing(task_entry.to_oop())), "invariant"); + assert(task_entry.is_partial_array_state() || _mark_bitmap->is_marked(cast_from_oop(task_entry.to_oop())), "invariant"); if (!_task_queue->push(task_entry)) { // The local task queue looks full. We need to push some entries @@ -159,29 +161,34 @@ inline bool G1CMTask::is_below_finger(oop obj, HeapWord* global_finger) const { } template -inline void G1CMTask::process_grey_task_entry(G1TaskQueueEntry task_entry) { - assert(scan || (task_entry.is_oop() && task_entry.obj()->is_typeArray()), "Skipping scan of grey non-typeArray"); - assert(task_entry.is_array_slice() || _mark_bitmap->is_marked(cast_from_oop(task_entry.obj())), +inline void G1CMTask::process_grey_task_entry(G1TaskQueueEntry task_entry, bool stolen) { + assert(scan || (!task_entry.is_partial_array_state() && task_entry.to_oop()->is_typeArray()), "Skipping scan of grey non-typeArray"); + assert(task_entry.is_partial_array_state() || _mark_bitmap->is_marked(cast_from_oop(task_entry.to_oop())), "Any stolen object should be a slice or marked"); if (scan) { - if (task_entry.is_array_slice()) { - _words_scanned += _objArray_processor.process_slice(task_entry.slice()); + if (task_entry.is_partial_array_state()) { + _words_scanned += process_partial_array(task_entry, stolen); } else { - oop obj = task_entry.obj(); - if (G1CMObjArrayProcessor::should_be_sliced(obj)) { - _words_scanned += _objArray_processor.process_obj(obj); + oop obj = task_entry.to_oop(); + if (should_be_sliced(obj)) { + _words_scanned += start_partial_array_processing(obj); } else { - _words_scanned += obj->oop_iterate_size(_cm_oop_closure);; + _words_scanned += obj->oop_iterate_size(_cm_oop_closure); } } } check_limits(); } -inline size_t G1CMTask::scan_objArray(objArrayOop obj, MemRegion mr) { - obj->oop_iterate(_cm_oop_closure, mr); - return mr.word_size(); +inline bool G1CMTask::should_be_sliced(oop obj) { + return obj->is_objArray() && ((objArrayOop)obj)->length() >= (int)ObjArrayMarkingStride; +} + +inline void G1CMTask::process_array_chunk(objArrayOop obj, size_t start, size_t end) { + obj->oop_iterate_elements_range(_cm_oop_closure, + checked_cast(start), + checked_cast(end)); } inline void G1ConcurrentMark::update_top_at_mark_start(G1HeapRegion* r) { @@ -265,7 +272,7 @@ inline bool G1CMTask::make_reference_grey(oop obj) { // be pushed on the stack. So, some duplicate work, but no // correctness problems. if (is_below_finger(obj, global_finger)) { - G1TaskQueueEntry entry = G1TaskQueueEntry::from_oop(obj); + G1TaskQueueEntry entry(obj); if (obj->is_typeArray()) { // Immediately process arrays of primitive types, rather // than pushing on the mark stack. This keeps us from @@ -277,7 +284,7 @@ inline bool G1CMTask::make_reference_grey(oop obj) { // by only doing a bookkeeping update and avoiding the // actual scan of the object - a typeArray contains no // references, and the metadata is built-in. - process_grey_task_entry(entry); + process_grey_task_entry(entry, false /* stolen */); } else { push(entry); } diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMarkObjArrayProcessor.cpp b/src/hotspot/share/gc/g1/g1ConcurrentMarkObjArrayProcessor.cpp deleted file mode 100644 index 7f62e5527d5..00000000000 --- a/src/hotspot/share/gc/g1/g1ConcurrentMarkObjArrayProcessor.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2016, 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. - * - */ - -#include "gc/g1/g1CollectedHeap.inline.hpp" -#include "gc/g1/g1ConcurrentMark.inline.hpp" -#include "gc/g1/g1ConcurrentMarkObjArrayProcessor.inline.hpp" -#include "gc/g1/g1HeapRegion.inline.hpp" -#include "gc/shared/gc_globals.hpp" -#include "memory/memRegion.hpp" -#include "utilities/globalDefinitions.hpp" - -void G1CMObjArrayProcessor::push_array_slice(HeapWord* what) { - _task->push(G1TaskQueueEntry::from_slice(what)); -} - -size_t G1CMObjArrayProcessor::process_array_slice(objArrayOop obj, HeapWord* start_from, size_t remaining) { - size_t words_to_scan = MIN2(remaining, (size_t)ObjArrayMarkingStride); - - if (remaining > ObjArrayMarkingStride) { - push_array_slice(start_from + ObjArrayMarkingStride); - } - - // Then process current area. - MemRegion mr(start_from, words_to_scan); - return _task->scan_objArray(obj, mr); -} - -size_t G1CMObjArrayProcessor::process_obj(oop obj) { - assert(should_be_sliced(obj), "Must be an array object %d and large %zu", obj->is_objArray(), obj->size()); - - return process_array_slice(objArrayOop(obj), cast_from_oop(obj), objArrayOop(obj)->size()); -} - -size_t G1CMObjArrayProcessor::process_slice(HeapWord* slice) { - - // Find the start address of the objArrayOop. - // Shortcut the BOT access if the given address is from a humongous object. The BOT - // slide is fast enough for "smaller" objects in non-humongous regions, but is slower - // than directly using heap region table. - G1CollectedHeap* g1h = G1CollectedHeap::heap(); - G1HeapRegion* r = g1h->heap_region_containing(slice); - - HeapWord* const start_address = r->is_humongous() ? - r->humongous_start_region()->bottom() : - r->block_start(slice); - - assert(cast_to_oop(start_address)->is_objArray(), "Address " PTR_FORMAT " does not refer to an object array ", p2i(start_address)); - assert(start_address < slice, - "Object start address " PTR_FORMAT " must be smaller than decoded address " PTR_FORMAT, - p2i(start_address), - p2i(slice)); - - objArrayOop objArray = objArrayOop(cast_to_oop(start_address)); - - size_t already_scanned = pointer_delta(slice, start_address); - size_t remaining = objArray->size() - already_scanned; - - return process_array_slice(objArray, slice, remaining); -} diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMarkObjArrayProcessor.hpp b/src/hotspot/share/gc/g1/g1ConcurrentMarkObjArrayProcessor.hpp deleted file mode 100644 index c2737dbbda6..00000000000 --- a/src/hotspot/share/gc/g1/g1ConcurrentMarkObjArrayProcessor.hpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please 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_G1_G1CONCURRENTMARKOBJARRAYPROCESSOR_HPP -#define SHARE_GC_G1_G1CONCURRENTMARKOBJARRAYPROCESSOR_HPP - -#include "oops/oopsHierarchy.hpp" - -class G1CMTask; - -// Helper class to mark through large objArrays during marking in an efficient way. -// Instead of pushing large object arrays, we push continuations onto the -// mark stack. These continuations are identified by having their LSB set. -// This allows incremental processing of large objects. -class G1CMObjArrayProcessor { -private: - // Reference to the task for doing the actual work. - G1CMTask* _task; - - // Push the continuation at the given address onto the mark stack. - void push_array_slice(HeapWord* addr); - - // Process (apply the closure) on the given continuation of the given objArray. - size_t process_array_slice(objArrayOop const obj, HeapWord* start_from, size_t remaining); -public: - static bool should_be_sliced(oop obj); - - G1CMObjArrayProcessor(G1CMTask* task) : _task(task) { - } - - // Process the given continuation. Returns the number of words scanned. - size_t process_slice(HeapWord* slice); - // Start processing the given objArrayOop by scanning the header and pushing its - // continuation. - size_t process_obj(oop obj); -}; - -#endif // SHARE_GC_G1_G1CONCURRENTMARKOBJARRAYPROCESSOR_HPP diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMarkRemarkTasks.cpp b/src/hotspot/share/gc/g1/g1ConcurrentMarkRemarkTasks.cpp index fdef4214622..4eb11f6d8f6 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMarkRemarkTasks.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMarkRemarkTasks.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 @@ -30,7 +30,6 @@ #include "gc/g1/g1HeapRegionPrinter.hpp" #include "gc/g1/g1RemSetTrackingPolicy.hpp" #include "logging/log.hpp" -#include "runtime/atomicAccess.hpp" #include "runtime/mutexLocker.hpp" struct G1UpdateRegionLivenessAndSelectForRebuildTask::G1OnRegionClosure : public G1HeapRegionClosure { @@ -154,7 +153,7 @@ void G1UpdateRegionLivenessAndSelectForRebuildTask::work(uint worker_id) { G1OnRegionClosure on_region_cl(_g1h, _cm, &local_cleanup_list); _g1h->heap_region_par_iterate_from_worker_offset(&on_region_cl, &_hrclaimer, worker_id); - AtomicAccess::add(&_total_selected_for_rebuild, on_region_cl._num_selected_for_rebuild); + _total_selected_for_rebuild.add_then_fetch(on_region_cl._num_selected_for_rebuild); // Update the old/humongous region sets _g1h->remove_from_old_gen_sets(on_region_cl._num_old_regions_removed, diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMarkRemarkTasks.hpp b/src/hotspot/share/gc/g1/g1ConcurrentMarkRemarkTasks.hpp index 161f0b4b9f5..a256693ff1d 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMarkRemarkTasks.hpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMarkRemarkTasks.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,6 +29,7 @@ #include "gc/g1/g1HeapRegionManager.hpp" #include "gc/g1/g1HeapRegionSet.hpp" #include "gc/shared/workerThread.hpp" +#include "runtime/atomic.hpp" class G1CollectedHeap; class G1ConcurrentMark; @@ -41,7 +42,7 @@ class G1UpdateRegionLivenessAndSelectForRebuildTask : public WorkerTask { G1ConcurrentMark* _cm; G1HeapRegionClaimer _hrclaimer; - uint volatile _total_selected_for_rebuild; + Atomic _total_selected_for_rebuild; // Reclaimed empty regions G1FreeRegionList _cleanup_list; @@ -57,7 +58,9 @@ public: void work(uint worker_id) override; - uint total_selected_for_rebuild() const { return _total_selected_for_rebuild; } + uint total_selected_for_rebuild() const { + return _total_selected_for_rebuild.load_relaxed(); + } static uint desired_num_workers(uint num_regions); }; diff --git a/src/hotspot/share/gc/g1/g1FullCollector.cpp b/src/hotspot/share/gc/g1/g1FullCollector.cpp index 5ca5dcef001..7395df01760 100644 --- a/src/hotspot/share/gc/g1/g1FullCollector.cpp +++ b/src/hotspot/share/gc/g1/g1FullCollector.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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -116,8 +116,8 @@ G1FullCollector::G1FullCollector(G1CollectedHeap* heap, _num_workers(calc_active_workers()), _has_compaction_targets(false), _has_humongous(false), - _oop_queue_set(_num_workers), - _array_queue_set(_num_workers), + _marking_task_queues(_num_workers), + _partial_array_state_manager(nullptr), _preserved_marks_set(true), _serial_compaction_point(this, nullptr), _humongous_compaction_point(this, nullptr), @@ -140,23 +140,31 @@ G1FullCollector::G1FullCollector(G1CollectedHeap* heap, _compaction_tops[j] = nullptr; } + _partial_array_state_manager = new PartialArrayStateManager(_num_workers); + for (uint i = 0; i < _num_workers; i++) { _markers[i] = new G1FullGCMarker(this, i, _live_stats); _compaction_points[i] = new G1FullGCCompactionPoint(this, _preserved_marks_set.get(i)); - _oop_queue_set.register_queue(i, marker(i)->oop_stack()); - _array_queue_set.register_queue(i, marker(i)->objarray_stack()); + _marking_task_queues.register_queue(i, marker(i)->task_queue()); } + _serial_compaction_point.set_preserved_stack(_preserved_marks_set.get(0)); _humongous_compaction_point.set_preserved_stack(_preserved_marks_set.get(0)); _region_attr_table.initialize(heap->reserved(), G1HeapRegion::GrainBytes); } +PartialArrayStateManager* G1FullCollector::partial_array_state_manager() const { + return _partial_array_state_manager; +} + G1FullCollector::~G1FullCollector() { for (uint i = 0; i < _num_workers; i++) { delete _markers[i]; delete _compaction_points[i]; } + delete _partial_array_state_manager; + FREE_C_HEAP_ARRAY(G1FullGCMarker*, _markers); FREE_C_HEAP_ARRAY(G1FullGCCompactionPoint*, _compaction_points); FREE_C_HEAP_ARRAY(HeapWord*, _compaction_tops); @@ -279,8 +287,8 @@ public: uint index = (_tm == RefProcThreadModel::Single) ? 0 : worker_id; G1FullKeepAliveClosure keep_alive(_collector.marker(index)); BarrierEnqueueDiscoveredFieldClosure enqueue; - G1FollowStackClosure* complete_gc = _collector.marker(index)->stack_closure(); - _rp_task->rp_work(worker_id, &is_alive, &keep_alive, &enqueue, complete_gc); + G1MarkStackClosure* complete_marking = _collector.marker(index)->stack_closure(); + _rp_task->rp_work(worker_id, &is_alive, &keep_alive, &enqueue, complete_marking); } }; @@ -302,7 +310,7 @@ void G1FullCollector::phase1_mark_live_objects() { const ReferenceProcessorStats& stats = reference_processor()->process_discovered_references(task, _heap->workers(), pt); scope()->tracer()->report_gc_reference_stats(stats); pt.print_all_references(); - assert(marker(0)->oop_stack()->is_empty(), "Should be no oops on the stack"); + assert(marker(0)->task_queue()->is_empty(), "Should be no oops on the stack"); } { @@ -328,8 +336,7 @@ void G1FullCollector::phase1_mark_live_objects() { scope()->tracer()->report_object_count_after_gc(&_is_alive, _heap->workers()); } #if TASKQUEUE_STATS - oop_queue_set()->print_and_reset_taskqueue_stats("Oop Queue"); - array_queue_set()->print_and_reset_taskqueue_stats("ObjArrayOop Queue"); + marking_task_queues()->print_and_reset_taskqueue_stats("Marking Task Queue"); #endif } diff --git a/src/hotspot/share/gc/g1/g1FullCollector.hpp b/src/hotspot/share/gc/g1/g1FullCollector.hpp index ed8225fc004..28ecffad944 100644 --- a/src/hotspot/share/gc/g1/g1FullCollector.hpp +++ b/src/hotspot/share/gc/g1/g1FullCollector.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 @@ -79,8 +79,8 @@ class G1FullCollector : StackObj { bool _has_humongous; G1FullGCMarker** _markers; G1FullGCCompactionPoint** _compaction_points; - OopQueueSet _oop_queue_set; - ObjArrayTaskQueueSet _array_queue_set; + G1MarkTasksQueueSet _marking_task_queues; + PartialArrayStateManager* _partial_array_state_manager; PreservedMarksSet _preserved_marks_set; G1FullGCCompactionPoint _serial_compaction_point; G1FullGCCompactionPoint _humongous_compaction_point; @@ -113,8 +113,7 @@ public: uint workers() { return _num_workers; } G1FullGCMarker* marker(uint id) { return _markers[id]; } G1FullGCCompactionPoint* compaction_point(uint id) { return _compaction_points[id]; } - OopQueueSet* oop_queue_set() { return &_oop_queue_set; } - ObjArrayTaskQueueSet* array_queue_set() { return &_array_queue_set; } + G1MarkTasksQueueSet* marking_task_queues() { return &_marking_task_queues; } PreservedMarksSet* preserved_mark_set() { return &_preserved_marks_set; } G1FullGCCompactionPoint* serial_compaction_point() { return &_serial_compaction_point; } G1FullGCCompactionPoint* humongous_compaction_point() { return &_humongous_compaction_point; } @@ -122,9 +121,11 @@ public: ReferenceProcessor* reference_processor(); size_t live_words(uint region_index) const { assert(region_index < _heap->max_num_regions(), "sanity"); - return _live_stats[region_index]._live_words; + return _live_stats[region_index].live_words(); } + PartialArrayStateManager* partial_array_state_manager() const; + void before_marking_update_attribute_table(G1HeapRegion* hr); inline bool is_compacting(oop obj) const; diff --git a/src/hotspot/share/gc/g1/g1FullGCMarkTask.cpp b/src/hotspot/share/gc/g1/g1FullGCMarkTask.cpp index 52b0d04a500..f14e1108db8 100644 --- a/src/hotspot/share/gc/g1/g1FullGCMarkTask.cpp +++ b/src/hotspot/share/gc/g1/g1FullGCMarkTask.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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ G1FullGCMarkTask::G1FullGCMarkTask(G1FullCollector* collector) : G1FullGCTask("G1 Parallel Marking Task", collector), _root_processor(G1CollectedHeap::heap(), collector->workers()), - _terminator(collector->workers(), collector->array_queue_set()) { + _terminator(collector->workers(), collector->marking_task_queues()) { } void G1FullGCMarkTask::work(uint worker_id) { @@ -54,10 +54,9 @@ void G1FullGCMarkTask::work(uint worker_id) { } // Mark stack is populated, now process and drain it. - marker->complete_marking(collector()->oop_queue_set(), collector()->array_queue_set(), &_terminator); + marker->complete_marking(collector()->marking_task_queues(), &_terminator); // This is the point where the entire marking should have completed. - assert(marker->oop_stack()->is_empty(), "Marking should have completed"); - assert(marker->objarray_stack()->is_empty(), "Array marking should have completed"); + assert(marker->task_queue()->is_empty(), "Marking should have completed"); log_task("Marking task", worker_id, start); } diff --git a/src/hotspot/share/gc/g1/g1FullGCMarker.cpp b/src/hotspot/share/gc/g1/g1FullGCMarker.cpp index aa8f12a2d1b..2b0b78ac1ce 100644 --- a/src/hotspot/share/gc/g1/g1FullGCMarker.cpp +++ b/src/hotspot/share/gc/g1/g1FullGCMarker.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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ #include "classfile/classLoaderData.hpp" #include "classfile/classLoaderDataGraph.hpp" #include "gc/g1/g1FullGCMarker.inline.hpp" +#include "gc/shared/partialArraySplitter.inline.hpp" +#include "gc/shared/partialArrayState.hpp" #include "gc/shared/referenceProcessor.hpp" #include "gc/shared/taskTerminator.hpp" #include "gc/shared/verifyOption.hpp" @@ -36,8 +38,8 @@ G1FullGCMarker::G1FullGCMarker(G1FullCollector* collector, _collector(collector), _worker_id(worker_id), _bitmap(collector->mark_bitmap()), - _oop_stack(), - _objarray_stack(), + _task_queue(), + _partial_array_splitter(collector->partial_array_state_manager(), collector->workers(), ObjArrayMarkingStride), _mark_closure(worker_id, this, ClassLoaderData::_claim_stw_fullgc_mark, G1CollectedHeap::heap()->ref_processor_stw()), _stack_closure(this), _cld_closure(mark_closure(), ClassLoaderData::_claim_stw_fullgc_mark), @@ -47,24 +49,36 @@ G1FullGCMarker::G1FullGCMarker(G1FullCollector* collector, } G1FullGCMarker::~G1FullGCMarker() { - assert(is_empty(), "Must be empty at this point"); + assert(is_task_queue_empty(), "Must be empty at this point"); } -void G1FullGCMarker::complete_marking(OopQueueSet* oop_stacks, - ObjArrayTaskQueueSet* array_stacks, +void G1FullGCMarker::process_partial_array(PartialArrayState* state, bool stolen) { + // Access state before release by claim(). + objArrayOop obj_array = objArrayOop(state->source()); + PartialArraySplitter::Claim claim = + _partial_array_splitter.claim(state, task_queue(), stolen); + process_array_chunk(obj_array, claim._start, claim._end); +} + +void G1FullGCMarker::start_partial_array_processing(objArrayOop obj) { + mark_closure()->do_klass(obj->klass()); + // Don't push empty arrays to avoid unnecessary work. + size_t array_length = obj->length(); + if (array_length > 0) { + size_t initial_chunk_size = _partial_array_splitter.start(task_queue(), obj, nullptr, array_length); + process_array_chunk(obj, 0, initial_chunk_size); + } +} + +void G1FullGCMarker::complete_marking(G1ScannerTasksQueueSet* task_queues, TaskTerminator* terminator) { do { - follow_marking_stacks(); - ObjArrayTask steal_array; - if (array_stacks->steal(_worker_id, steal_array)) { - follow_array_chunk(objArrayOop(steal_array.obj()), steal_array.index()); - } else { - oop steal_oop; - if (oop_stacks->steal(_worker_id, steal_oop)) { - follow_object(steal_oop); - } + process_marking_stacks(); + ScannerTask stolen_task; + if (task_queues->steal(_worker_id, stolen_task)) { + dispatch_task(stolen_task, true); } - } while (!is_empty() || !terminator->offer_termination()); + } while (!is_task_queue_empty() || !terminator->offer_termination()); } void G1FullGCMarker::flush_mark_stats_cache() { diff --git a/src/hotspot/share/gc/g1/g1FullGCMarker.hpp b/src/hotspot/share/gc/g1/g1FullGCMarker.hpp index b1b750eae90..5973cc841c5 100644 --- a/src/hotspot/share/gc/g1/g1FullGCMarker.hpp +++ b/src/hotspot/share/gc/g1/g1FullGCMarker.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ #include "gc/g1/g1FullGCOopClosures.hpp" #include "gc/g1/g1OopClosures.hpp" #include "gc/g1/g1RegionMarkStatsCache.hpp" +#include "gc/shared/partialArraySplitter.hpp" +#include "gc/shared/partialArrayState.hpp" #include "gc/shared/stringdedup/stringDedup.hpp" #include "gc/shared/taskqueue.hpp" #include "memory/iterator.hpp" @@ -38,16 +40,15 @@ #include "utilities/growableArray.hpp" #include "utilities/stack.hpp" -typedef OverflowTaskQueue OopQueue; -typedef OverflowTaskQueue ObjArrayTaskQueue; -typedef GenericTaskQueueSet OopQueueSet; -typedef GenericTaskQueueSet ObjArrayTaskQueueSet; class G1CMBitMap; class G1FullCollector; class TaskTerminator; +typedef OverflowTaskQueue G1MarkTasksQueue; +typedef GenericTaskQueueSet G1MarkTasksQueueSet; + class G1FullGCMarker : public CHeapObj { G1FullCollector* _collector; @@ -56,56 +57,50 @@ class G1FullGCMarker : public CHeapObj { G1CMBitMap* _bitmap; // Mark stack - OopQueue _oop_stack; - ObjArrayTaskQueue _objarray_stack; + G1MarkTasksQueue _task_queue; + PartialArraySplitter _partial_array_splitter; // Marking closures G1MarkAndPushClosure _mark_closure; - G1FollowStackClosure _stack_closure; + G1MarkStackClosure _stack_closure; CLDToOopClosure _cld_closure; StringDedup::Requests _string_dedup_requests; G1RegionMarkStatsCache _mark_stats_cache; - inline bool is_empty(); - inline void push_objarray(oop obj, size_t index); + inline bool is_task_queue_empty(); inline bool mark_object(oop obj); // Marking helpers - inline void follow_object(oop obj); - inline void follow_array(objArrayOop array); - inline void follow_array_chunk(objArrayOop array, int index); + inline void process_array_chunk(objArrayOop obj, size_t start, size_t end); + inline void dispatch_task(const ScannerTask& task, bool stolen); + // Start processing the given objArrayOop by first pushing its continuations and + // then scanning the first chunk. + void start_partial_array_processing(objArrayOop obj); + // Process the given continuation. + void process_partial_array(PartialArrayState* state, bool stolen); inline void publish_and_drain_oop_tasks(); - // Try to publish all contents from the objArray task queue overflow stack to - // the shared objArray stack. - // Returns true and a valid task if there has not been enough space in the shared - // objArray stack, otherwise returns false and the task is invalid. - inline bool publish_or_pop_objarray_tasks(ObjArrayTask& task); - public: G1FullGCMarker(G1FullCollector* collector, uint worker_id, G1RegionMarkStats* mark_stats); ~G1FullGCMarker(); - // Stack getters - OopQueue* oop_stack() { return &_oop_stack; } - ObjArrayTaskQueue* objarray_stack() { return &_objarray_stack; } + G1MarkTasksQueue* task_queue() { return &_task_queue; } // Marking entry points template inline void mark_and_push(T* p); - inline void follow_marking_stacks(); - void complete_marking(OopQueueSet* oop_stacks, - ObjArrayTaskQueueSet* array_stacks, + inline void process_marking_stacks(); + void complete_marking(G1MarkTasksQueueSet* task_queues, TaskTerminator* terminator); // Closure getters CLDToOopClosure* cld_closure() { return &_cld_closure; } G1MarkAndPushClosure* mark_closure() { return &_mark_closure; } - G1FollowStackClosure* stack_closure() { return &_stack_closure; } + G1MarkStackClosure* stack_closure() { return &_stack_closure; } // Flush live bytes to regions void flush_mark_stats_cache(); diff --git a/src/hotspot/share/gc/g1/g1FullGCMarker.inline.hpp b/src/hotspot/share/gc/g1/g1FullGCMarker.inline.hpp index 398ef046bf5..a6f45abe005 100644 --- a/src/hotspot/share/gc/g1/g1FullGCMarker.inline.hpp +++ b/src/hotspot/share/gc/g1/g1FullGCMarker.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,6 +42,7 @@ #include "oops/access.inline.hpp" #include "oops/compressedOops.inline.hpp" #include "oops/oop.inline.hpp" +#include "utilities/checkedCast.hpp" #include "utilities/debug.hpp" inline bool G1FullGCMarker::mark_object(oop obj) { @@ -71,94 +72,55 @@ template inline void G1FullGCMarker::mark_and_push(T* p) { if (!CompressedOops::is_null(heap_oop)) { oop obj = CompressedOops::decode_not_null(heap_oop); if (mark_object(obj)) { - _oop_stack.push(obj); + _task_queue.push(ScannerTask(obj)); } assert(_bitmap->is_marked(obj), "Must be marked"); } } -inline bool G1FullGCMarker::is_empty() { - return _oop_stack.is_empty() && _objarray_stack.is_empty(); +inline bool G1FullGCMarker::is_task_queue_empty() { + return _task_queue.is_empty(); } -inline void G1FullGCMarker::push_objarray(oop obj, size_t index) { - ObjArrayTask task(obj, index); - assert(task.is_valid(), "bad ObjArrayTask"); - _objarray_stack.push(task); +inline void G1FullGCMarker::process_array_chunk(objArrayOop obj, size_t start, size_t end) { + obj->oop_iterate_elements_range(mark_closure(), + checked_cast(start), + checked_cast(end)); } -inline void G1FullGCMarker::follow_array(objArrayOop array) { - mark_closure()->do_klass(array->klass()); - // Don't push empty arrays to avoid unnecessary work. - if (array->length() > 0) { - push_objarray(array, 0); - } -} - -void G1FullGCMarker::follow_array_chunk(objArrayOop array, int index) { - const int len = array->length(); - const int beg_index = index; - assert(beg_index < len || len == 0, "index too large"); - - const int stride = MIN2(len - beg_index, (int) ObjArrayMarkingStride); - const int end_index = beg_index + stride; - - // Push the continuation first to allow more efficient work stealing. - if (end_index < len) { - push_objarray(array, end_index); - } - - array->oop_iterate_elements_range(mark_closure(), beg_index, end_index); -} - -inline void G1FullGCMarker::follow_object(oop obj) { - assert(_bitmap->is_marked(obj), "should be marked"); - if (obj->is_objArray()) { - // Handle object arrays explicitly to allow them to - // be split into chunks if needed. - follow_array((objArrayOop)obj); +inline void G1FullGCMarker::dispatch_task(const ScannerTask& task, bool stolen) { + if (task.is_partial_array_state()) { + assert(_bitmap->is_marked(task.to_partial_array_state()->source()), "should be marked"); + process_partial_array(task.to_partial_array_state(), stolen); } else { - obj->oop_iterate(mark_closure()); + oop obj = task.to_oop(); + assert(_bitmap->is_marked(obj), "should be marked"); + if (obj->is_objArray()) { + // Handle object arrays explicitly to allow them to + // be split into chunks if needed. + start_partial_array_processing((objArrayOop)obj); + } else { + obj->oop_iterate(mark_closure()); + } } } inline void G1FullGCMarker::publish_and_drain_oop_tasks() { - oop obj; - while (_oop_stack.pop_overflow(obj)) { - if (!_oop_stack.try_push_to_taskqueue(obj)) { - assert(_bitmap->is_marked(obj), "must be marked"); - follow_object(obj); + ScannerTask task; + while (_task_queue.pop_overflow(task)) { + if (!_task_queue.try_push_to_taskqueue(task)) { + dispatch_task(task, false); } } - while (_oop_stack.pop_local(obj)) { - assert(_bitmap->is_marked(obj), "must be marked"); - follow_object(obj); + while (_task_queue.pop_local(task)) { + dispatch_task(task, false); } } -inline bool G1FullGCMarker::publish_or_pop_objarray_tasks(ObjArrayTask& task) { - // It is desirable to move as much as possible work from the overflow queue to - // the shared queue as quickly as possible. - while (_objarray_stack.pop_overflow(task)) { - if (!_objarray_stack.try_push_to_taskqueue(task)) { - return true; - } - } - return false; -} - -void G1FullGCMarker::follow_marking_stacks() { +void G1FullGCMarker::process_marking_stacks() { do { - // First, drain regular oop stack. publish_and_drain_oop_tasks(); - - // Then process ObjArrays one at a time to avoid marking stack bloat. - ObjArrayTask task; - if (publish_or_pop_objarray_tasks(task) || - _objarray_stack.pop_local(task)) { - follow_array_chunk(objArrayOop(task.obj()), task.index()); - } - } while (!is_empty()); + } while (!is_task_queue_empty()); } #endif // SHARE_GC_G1_G1FULLGCMARKER_INLINE_HPP diff --git a/src/hotspot/share/gc/g1/g1FullGCOopClosures.cpp b/src/hotspot/share/gc/g1/g1FullGCOopClosures.cpp index d9cf64a3655..273508ea9e3 100644 --- a/src/hotspot/share/gc/g1/g1FullGCOopClosures.cpp +++ b/src/hotspot/share/gc/g1/g1FullGCOopClosures.cpp @@ -35,7 +35,7 @@ G1IsAliveClosure::G1IsAliveClosure(G1FullCollector* collector) : G1IsAliveClosure(collector, collector->mark_bitmap()) { } -void G1FollowStackClosure::do_void() { _marker->follow_marking_stacks(); } +void G1MarkStackClosure::do_void() { _marker->process_marking_stacks(); } void G1FullKeepAliveClosure::do_oop(oop* p) { do_oop_work(p); } void G1FullKeepAliveClosure::do_oop(narrowOop* p) { do_oop_work(p); } diff --git a/src/hotspot/share/gc/g1/g1FullGCOopClosures.hpp b/src/hotspot/share/gc/g1/g1FullGCOopClosures.hpp index 388f8032de4..08ed5f982e1 100644 --- a/src/hotspot/share/gc/g1/g1FullGCOopClosures.hpp +++ b/src/hotspot/share/gc/g1/g1FullGCOopClosures.hpp @@ -86,11 +86,11 @@ public: virtual ReferenceIterationMode reference_iteration_mode() { return DO_FIELDS; } }; -class G1FollowStackClosure: public VoidClosure { +class G1MarkStackClosure: public VoidClosure { G1FullGCMarker* _marker; public: - G1FollowStackClosure(G1FullGCMarker* marker) : _marker(marker) {} + G1MarkStackClosure(G1FullGCMarker* marker) : _marker(marker) {} virtual void do_void(); }; diff --git a/src/hotspot/share/gc/g1/g1ParallelCleaning.cpp b/src/hotspot/share/gc/g1/g1ParallelCleaning.cpp index 8d5e2a3239c..e3eabff5a50 100644 --- a/src/hotspot/share/gc/g1/g1ParallelCleaning.cpp +++ b/src/hotspot/share/gc/g1/g1ParallelCleaning.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 @@ -24,7 +24,6 @@ #include "gc/g1/g1ParallelCleaning.hpp" -#include "runtime/atomicAccess.hpp" #if INCLUDE_JVMCI #include "jvmci/jvmci.hpp" #endif @@ -35,11 +34,11 @@ JVMCICleaningTask::JVMCICleaningTask() : } bool JVMCICleaningTask::claim_cleaning_task() { - if (AtomicAccess::load(&_cleaning_claimed)) { + if (_cleaning_claimed.load_relaxed()) { return false; } - return !AtomicAccess::cmpxchg(&_cleaning_claimed, false, true); + return _cleaning_claimed.compare_set(false, true); } void JVMCICleaningTask::work(bool unloading_occurred) { diff --git a/src/hotspot/share/gc/g1/g1ParallelCleaning.hpp b/src/hotspot/share/gc/g1/g1ParallelCleaning.hpp index d8725cb110d..815b0883e16 100644 --- a/src/hotspot/share/gc/g1/g1ParallelCleaning.hpp +++ b/src/hotspot/share/gc/g1/g1ParallelCleaning.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 @@ -26,10 +26,13 @@ #define SHARE_GC_G1_G1PARALLELCLEANING_HPP #include "gc/shared/parallelCleaning.hpp" +#if INCLUDE_JVMCI +#include "runtime/atomic.hpp" +#endif #if INCLUDE_JVMCI class JVMCICleaningTask : public StackObj { - volatile bool _cleaning_claimed; + Atomic _cleaning_claimed; public: JVMCICleaningTask(); diff --git a/src/hotspot/share/gc/g1/g1Policy.cpp b/src/hotspot/share/gc/g1/g1Policy.cpp index 6eef6cbfa87..8818b477aae 100644 --- a/src/hotspot/share/gc/g1/g1Policy.cpp +++ b/src/hotspot/share/gc/g1/g1Policy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -203,8 +203,8 @@ void G1Policy::update_young_length_bounds(size_t pending_cards, size_t card_rs_l // allocation. // That is "fine" - at most this will schedule a GC (hopefully only a little) too // early or too late. - AtomicAccess::store(&_young_list_desired_length, new_young_list_desired_length); - AtomicAccess::store(&_young_list_target_length, new_young_list_target_length); + _young_list_desired_length.store_relaxed(new_young_list_desired_length); + _young_list_target_length.store_relaxed(new_young_list_target_length); } // Calculates desired young gen length. It is calculated from: @@ -943,7 +943,7 @@ void G1Policy::record_young_collection_end(bool concurrent_operation_is_full_mar phase_times()->sum_thread_work_items(G1GCPhaseTimes::MergePSS, G1GCPhaseTimes::MergePSSToYoungGenCards)); } - record_pause(this_pause, start_time_sec, end_time_sec, allocation_failure); + record_pause(this_pause, start_time_sec, end_time_sec); if (G1GCPauseTypeHelper::is_last_young_pause(this_pause)) { assert(!G1GCPauseTypeHelper::is_concurrent_start_pause(this_pause), @@ -1389,16 +1389,13 @@ void G1Policy::update_gc_pause_time_ratios(G1GCPauseType gc_type, double start_t void G1Policy::record_pause(G1GCPauseType gc_type, double start, - double end, - bool allocation_failure) { + double end) { // Manage the MMU tracker. For some reason it ignores Full GCs. if (gc_type != G1GCPauseType::FullGC) { _mmu_tracker->add_pause(start, end); } - if (!allocation_failure) { - update_gc_pause_time_ratios(gc_type, start, end); - } + update_gc_pause_time_ratios(gc_type, start, end); update_time_to_mixed_tracking(gc_type, start, end); diff --git a/src/hotspot/share/gc/g1/g1Policy.hpp b/src/hotspot/share/gc/g1/g1Policy.hpp index 72fdc6deb5b..9513c79869e 100644 --- a/src/hotspot/share/gc/g1/g1Policy.hpp +++ b/src/hotspot/share/gc/g1/g1Policy.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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,7 +35,7 @@ #include "gc/g1/g1RemSetTrackingPolicy.hpp" #include "gc/g1/g1YoungGenSizer.hpp" #include "gc/shared/gcCause.hpp" -#include "runtime/atomicAccess.hpp" +#include "runtime/atomic.hpp" #include "utilities/pair.hpp" #include "utilities/ticks.hpp" @@ -81,12 +81,9 @@ class G1Policy: public CHeapObj { // Desired young gen length without taking actually available free regions into // account. - volatile uint _young_list_desired_length; + Atomic _young_list_desired_length; // Actual target length given available free memory. - volatile uint _young_list_target_length; - // The max number of regions we can extend the eden by while the GC - // locker is active. This should be >= _young_list_target_length; - volatile uint _young_list_max_length; + Atomic _young_list_target_length; // The survivor rate groups below must be initialized after the predictor because they // indirectly use it through the "this" object passed to their constructor. @@ -275,8 +272,7 @@ private: // Record the given STW pause with the given start and end times (in s). void record_pause(G1GCPauseType gc_type, double start, - double end, - bool allocation_failure = false); + double end); void update_gc_pause_time_ratios(G1GCPauseType gc_type, double start_sec, double end_sec); @@ -363,8 +359,8 @@ public: // This must be called at the very beginning of an evacuation pause. void decide_on_concurrent_start_pause(); - uint young_list_desired_length() const { return AtomicAccess::load(&_young_list_desired_length); } - uint young_list_target_length() const { return AtomicAccess::load(&_young_list_target_length); } + uint young_list_desired_length() const { return _young_list_desired_length.load_relaxed(); } + uint young_list_target_length() const { return _young_list_target_length.load_relaxed(); } bool should_allocate_mutator_region() const; bool should_expand_on_mutator_allocation() const; diff --git a/src/hotspot/share/gc/g1/g1RegionMarkStatsCache.hpp b/src/hotspot/share/gc/g1/g1RegionMarkStatsCache.hpp index 3c1a6ed4667..4dcdd33846e 100644 --- a/src/hotspot/share/gc/g1/g1RegionMarkStatsCache.hpp +++ b/src/hotspot/share/gc/g1/g1RegionMarkStatsCache.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,7 @@ #include "memory/allocation.hpp" #include "oops/oop.hpp" +#include "runtime/atomic.hpp" #include "utilities/debug.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/pair.hpp" @@ -40,20 +41,23 @@ // * the number of incoming references found during marking. This is an approximate // value because we do not mark through all objects. struct G1RegionMarkStats { - size_t _live_words; - size_t _incoming_refs; + Atomic _live_words; + Atomic _incoming_refs; // Clear all members. void clear() { - _live_words = 0; - _incoming_refs = 0; + _live_words.store_relaxed(0); + _incoming_refs.store_relaxed(0); } // Clear all members after a marking overflow. Only needs to clear the number of // incoming references as all objects will be rescanned, while the live words are // gathered whenever a thread can mark an object, which is synchronized. void clear_during_overflow() { - _incoming_refs = 0; + _incoming_refs.store_relaxed(0); } + + size_t live_words() const { return _live_words.load_relaxed(); } + size_t incoming_refs() const { return _incoming_refs.load_relaxed(); } }; // Per-marking thread cache for the region mark statistics. @@ -112,12 +116,16 @@ public: void add_live_words(oop obj); void add_live_words(uint region_idx, size_t live_words) { G1RegionMarkStatsCacheEntry* const cur = find_for_add(region_idx); - cur->_stats._live_words += live_words; + // This method is only ever called single-threaded, so we do not need atomic + // update here. + cur->_stats._live_words.store_relaxed(cur->_stats.live_words() + live_words); } void inc_incoming_refs(uint region_idx) { G1RegionMarkStatsCacheEntry* const cur = find_for_add(region_idx); - cur->_stats._incoming_refs++; + // This method is only ever called single-threaded, so we do not need atomic + // update here. + cur->_stats._incoming_refs.store_relaxed(cur->_stats.incoming_refs() + 1u); } void reset(uint region_idx) { diff --git a/src/hotspot/share/gc/g1/g1RegionMarkStatsCache.inline.hpp b/src/hotspot/share/gc/g1/g1RegionMarkStatsCache.inline.hpp index 6b0ebb34e0d..71cd33e71ae 100644 --- a/src/hotspot/share/gc/g1/g1RegionMarkStatsCache.inline.hpp +++ b/src/hotspot/share/gc/g1/g1RegionMarkStatsCache.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,8 +27,6 @@ #include "gc/g1/g1RegionMarkStatsCache.hpp" -#include "runtime/atomicAccess.hpp" - inline G1RegionMarkStatsCache::G1RegionMarkStatsCacheEntry* G1RegionMarkStatsCache::find_for_add(uint region_idx) { uint const cache_idx = hash(region_idx); @@ -46,12 +44,12 @@ inline G1RegionMarkStatsCache::G1RegionMarkStatsCacheEntry* G1RegionMarkStatsCac inline void G1RegionMarkStatsCache::evict(uint idx) { G1RegionMarkStatsCacheEntry* cur = &_cache[idx]; - if (cur->_stats._live_words != 0) { - AtomicAccess::add(&_target[cur->_region_idx]._live_words, cur->_stats._live_words); + if (cur->_stats.live_words() != 0) { + _target[cur->_region_idx]._live_words.add_then_fetch(cur->_stats.live_words()); } - if (cur->_stats._incoming_refs != 0) { - AtomicAccess::add(&_target[cur->_region_idx]._incoming_refs, cur->_stats._incoming_refs); + if (cur->_stats.incoming_refs() != 0) { + _target[cur->_region_idx]._incoming_refs.add_then_fetch(cur->_stats.incoming_refs()); } cur->clear(); diff --git a/src/hotspot/share/gc/g1/g1YoungCollector.cpp b/src/hotspot/share/gc/g1/g1YoungCollector.cpp index fa5c617f1db..36cc44a8b7c 100644 --- a/src/hotspot/share/gc/g1/g1YoungCollector.cpp +++ b/src/hotspot/share/gc/g1/g1YoungCollector.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 @@ -58,6 +58,7 @@ #include "gc/shared/workerThread.hpp" #include "jfr/jfrEvents.hpp" #include "memory/resourceArea.hpp" +#include "runtime/atomic.hpp" #include "runtime/threads.hpp" #include "utilities/ticks.hpp" @@ -459,8 +460,8 @@ class G1PrepareEvacuationTask : public WorkerTask { G1CollectedHeap* _g1h; G1HeapRegionClaimer _claimer; - volatile uint _humongous_total; - volatile uint _humongous_candidates; + Atomic _humongous_total; + Atomic _humongous_candidates; G1MonotonicArenaMemoryStats _all_card_set_stats; @@ -481,19 +482,19 @@ public: } void add_humongous_candidates(uint candidates) { - AtomicAccess::add(&_humongous_candidates, candidates); + _humongous_candidates.add_then_fetch(candidates); } void add_humongous_total(uint total) { - AtomicAccess::add(&_humongous_total, total); + _humongous_total.add_then_fetch(total); } uint humongous_candidates() { - return _humongous_candidates; + return _humongous_candidates.load_relaxed(); } uint humongous_total() { - return _humongous_total; + return _humongous_total.load_relaxed(); } const G1MonotonicArenaMemoryStats all_card_set_stats() const { @@ -698,7 +699,7 @@ protected: virtual void evacuate_live_objects(G1ParScanThreadState* pss, uint worker_id) = 0; private: - volatile bool _pinned_regions_recorded; + Atomic _pinned_regions_recorded; public: G1EvacuateRegionsBaseTask(const char* name, @@ -722,7 +723,7 @@ public: G1ParScanThreadState* pss = _per_thread_states->state_for_worker(worker_id); pss->set_ref_discoverer(_g1h->ref_processor_stw()); - if (!AtomicAccess::cmpxchg(&_pinned_regions_recorded, false, true)) { + if (_pinned_regions_recorded.compare_set(false, true)) { record_pinned_regions(pss, worker_id); } scan_roots(pss, worker_id); diff --git a/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp b/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp index ec5d2393d8c..46d12df575c 100644 --- a/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp +++ b/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp @@ -46,6 +46,7 @@ #include "oops/access.inline.hpp" #include "oops/compressedOops.inline.hpp" #include "oops/oop.inline.hpp" +#include "runtime/atomic.hpp" #include "runtime/prefetch.inline.hpp" #include "runtime/threads.hpp" #include "runtime/threadSMR.hpp" @@ -759,7 +760,7 @@ class G1PostEvacuateCollectionSetCleanupTask2::FreeCollectionSetTask : public G1 const size_t* _surviving_young_words; uint _active_workers; G1EvacFailureRegions* _evac_failure_regions; - volatile uint _num_retained_regions; + Atomic _num_retained_regions; FreeCSetStats* worker_stats(uint worker) { return &_worker_stats[worker]; @@ -794,7 +795,7 @@ public: virtual ~FreeCollectionSetTask() { Ticks serial_time = Ticks::now(); - bool has_new_retained_regions = AtomicAccess::load(&_num_retained_regions) != 0; + bool has_new_retained_regions = _num_retained_regions.load_relaxed() != 0; if (has_new_retained_regions) { G1CollectionSetCandidates* candidates = _g1h->collection_set()->candidates(); candidates->sort_by_efficiency(); @@ -829,7 +830,7 @@ public: // Report per-region type timings. cl.report_timing(); - AtomicAccess::add(&_num_retained_regions, cl.num_retained_regions(), memory_order_relaxed); + _num_retained_regions.add_then_fetch(cl.num_retained_regions(), memory_order_relaxed); } }; diff --git a/src/hotspot/share/gc/parallel/psParallelCompact.cpp b/src/hotspot/share/gc/parallel/psParallelCompact.cpp index b1b07b4bc5c..bab72296d4c 100644 --- a/src/hotspot/share/gc/parallel/psParallelCompact.cpp +++ b/src/hotspot/share/gc/parallel/psParallelCompact.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 @@ -44,6 +44,7 @@ #include "gc/parallel/psStringDedup.hpp" #include "gc/parallel/psYoungGen.hpp" #include "gc/shared/classUnloadingContext.hpp" +#include "gc/shared/collectedHeap.inline.hpp" #include "gc/shared/fullGCForwarding.inline.hpp" #include "gc/shared/gcCause.hpp" #include "gc/shared/gcHeapSummary.hpp" @@ -932,6 +933,17 @@ void PSParallelCompact::summary_phase(bool should_do_max_compaction) } } +void PSParallelCompact::report_object_count_after_gc() { + GCTraceTime(Debug, gc, phases) tm("Report Object Count", &_gc_timer); + // The heap is compacted, all objects are iterable. However there may be + // filler objects in the heap which we should ignore. + class SkipFillerObjectClosure : public BoolObjectClosure { + public: + bool do_object_b(oop obj) override { return !CollectedHeap::is_filler_object(obj); } + } cl; + _gc_tracer.report_object_count_after_gc(&cl, &ParallelScavengeHeap::heap()->workers()); +} + bool PSParallelCompact::invoke(bool clear_all_soft_refs, bool should_do_max_compaction) { assert(SafepointSynchronize::is_at_safepoint(), "should be at safepoint"); assert(Thread::current() == (Thread*)VMThread::vm_thread(), @@ -1027,6 +1039,8 @@ bool PSParallelCompact::invoke(bool clear_all_soft_refs, bool should_do_max_comp heap->print_heap_change(pre_gc_values); + report_object_count_after_gc(); + // Track memory usage and detect low memory MemoryService::track_memory_usage(); heap->update_counters(); @@ -1274,10 +1288,6 @@ void PSParallelCompact::marking_phase(ParallelOldTracer *gc_tracer) { } } - { - GCTraceTime(Debug, gc, phases) tm("Report Object Count", &_gc_timer); - _gc_tracer.report_object_count_after_gc(is_alive_closure(), &ParallelScavengeHeap::heap()->workers()); - } #if TASKQUEUE_STATS ParCompactionManager::print_and_reset_taskqueue_stats(); #endif @@ -1835,8 +1845,7 @@ void PSParallelCompact::verify_filler_in_dense_prefix() { oop obj = cast_to_oop(cur_addr); oopDesc::verify(obj); if (!mark_bitmap()->is_marked(cur_addr)) { - Klass* k = cast_to_oop(cur_addr)->klass(); - assert(k == Universe::fillerArrayKlass() || k == vmClasses::FillerObject_klass(), "inv"); + assert(CollectedHeap::is_filler_object(cast_to_oop(cur_addr)), "inv"); } cur_addr += obj->size(); } diff --git a/src/hotspot/share/gc/parallel/psParallelCompact.hpp b/src/hotspot/share/gc/parallel/psParallelCompact.hpp index 2297d720b35..4ac9395d727 100644 --- a/src/hotspot/share/gc/parallel/psParallelCompact.hpp +++ b/src/hotspot/share/gc/parallel/psParallelCompact.hpp @@ -749,6 +749,7 @@ private: // Move objects to new locations. static void compact(); + static void report_object_count_after_gc(); // Add available regions to the stack and draining tasks to the task queue. static void prepare_region_draining_tasks(uint parallel_gc_threads); diff --git a/src/hotspot/share/gc/shared/c2/barrierSetC2.cpp b/src/hotspot/share/gc/shared/c2/barrierSetC2.cpp index c4eefee5f65..53577bad1d8 100644 --- a/src/hotspot/share/gc/shared/c2/barrierSetC2.cpp +++ b/src/hotspot/share/gc/shared/c2/barrierSetC2.cpp @@ -771,7 +771,7 @@ Node* BarrierSetC2::obj_allocate(PhaseMacroExpand* macro, Node* mem, Node* toobi // this will require extensive changes to the loop optimization in order to // prevent a degradation of the optimization. // See comment in memnode.hpp, around line 227 in class LoadPNode. - Node* tlab_end = macro->make_load(toobig_false, mem, tlab_end_adr, 0, TypeRawPtr::BOTTOM, T_ADDRESS); + Node* tlab_end = macro->make_load_raw(toobig_false, mem, tlab_end_adr, 0, TypeRawPtr::BOTTOM, T_ADDRESS); // Load the TLAB top. Node* old_tlab_top = new LoadPNode(toobig_false, mem, tlab_top_adr, TypeRawPtr::BOTTOM, TypeRawPtr::BOTTOM, MemNode::unordered); diff --git a/src/hotspot/share/gc/shared/collectedHeap.hpp b/src/hotspot/share/gc/shared/collectedHeap.hpp index 6f335b1cdf4..363ccf321b2 100644 --- a/src/hotspot/share/gc/shared/collectedHeap.hpp +++ b/src/hotspot/share/gc/shared/collectedHeap.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -309,6 +309,8 @@ protected: fill_with_object(start, pointer_delta(end, start), zap); } + inline static bool is_filler_object(oop obj); + virtual void fill_with_dummy_object(HeapWord* start, HeapWord* end, bool zap); static size_t min_dummy_object_size() { return oopDesc::header_size(); diff --git a/src/hotspot/share/gc/shared/collectedHeap.inline.hpp b/src/hotspot/share/gc/shared/collectedHeap.inline.hpp index c9d84f54449..194c1fe0bf2 100644 --- a/src/hotspot/share/gc/shared/collectedHeap.inline.hpp +++ b/src/hotspot/share/gc/shared/collectedHeap.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,9 @@ #include "gc/shared/collectedHeap.hpp" +#include "classfile/vmClasses.hpp" #include "gc/shared/memAllocator.hpp" +#include "memory/universe.hpp" #include "oops/oop.inline.hpp" #include "utilities/align.hpp" @@ -50,4 +52,9 @@ inline void CollectedHeap::add_vmthread_cpu_time(jlong time) { _vmthread_cpu_time += time; } +inline bool CollectedHeap::is_filler_object(oop obj) { + Klass* k = obj->klass_without_asserts(); + return k == Universe::fillerArrayKlass() || k == vmClasses::FillerObject_klass(); +} + #endif // SHARE_GC_SHARED_COLLECTEDHEAP_INLINE_HPP diff --git a/src/hotspot/share/gc/shared/taskqueue.hpp b/src/hotspot/share/gc/shared/taskqueue.hpp index 4334773a4e9..5c2fe4e5178 100644 --- a/src/hotspot/share/gc/shared/taskqueue.hpp +++ b/src/hotspot/share/gc/shared/taskqueue.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -641,6 +641,10 @@ public: return (raw_value() & PartialArrayTag) != 0; } + bool is_null() const { + return _p == nullptr; + } + oop* to_oop_ptr() const { return static_cast(decode(OopTag)); } diff --git a/src/hotspot/share/gc/shared/workerThread.cpp b/src/hotspot/share/gc/shared/workerThread.cpp index 7a9404a195a..e4831d25d26 100644 --- a/src/hotspot/share/gc/shared/workerThread.cpp +++ b/src/hotspot/share/gc/shared/workerThread.cpp @@ -96,8 +96,22 @@ void WorkerThreads::initialize_workers() { } } +bool WorkerThreads::allow_inject_creation_failure() const { + if (!is_init_completed()) { + // Never allow creation failures during VM init + return false; + } + + if (_created_workers == 0) { + // Never allow creation failures of the first worker, it will cause the VM to exit + return false; + } + + return true; +} + WorkerThread* WorkerThreads::create_worker(uint name_suffix) { - if (is_init_completed() && InjectGCWorkerCreationFailure) { + if (InjectGCWorkerCreationFailure && allow_inject_creation_failure()) { return nullptr; } diff --git a/src/hotspot/share/gc/shared/workerThread.hpp b/src/hotspot/share/gc/shared/workerThread.hpp index a1f7282abe4..003ce8a2959 100644 --- a/src/hotspot/share/gc/shared/workerThread.hpp +++ b/src/hotspot/share/gc/shared/workerThread.hpp @@ -104,6 +104,7 @@ public: WorkerThreads(const char* name, uint max_workers); void initialize_workers(); + bool allow_inject_creation_failure() const; uint max_workers() const { return _max_workers; } uint created_workers() const { return _created_workers; } diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.cpp index 7a8bd55c795..46d9f19d35f 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.cpp @@ -68,9 +68,9 @@ ShenandoahAdaptiveHeuristics::ShenandoahAdaptiveHeuristics(ShenandoahSpaceInfo* ShenandoahAdaptiveHeuristics::~ShenandoahAdaptiveHeuristics() {} -void ShenandoahAdaptiveHeuristics::choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset, - RegionData* data, size_t size, - size_t actual_free) { +size_t ShenandoahAdaptiveHeuristics::choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset, + RegionData* data, size_t size, + size_t actual_free) { size_t garbage_threshold = ShenandoahHeapRegion::region_size_bytes() * ShenandoahGarbageThreshold / 100; // The logic for cset selection in adaptive is as follows: @@ -124,6 +124,7 @@ void ShenandoahAdaptiveHeuristics::choose_collection_set_from_regiondata(Shenand cur_garbage = new_garbage; } } + return 0; } void ShenandoahAdaptiveHeuristics::record_cycle_start() { diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.hpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.hpp index 1ba18f37c2b..c4fdf819391 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.hpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.hpp @@ -108,9 +108,9 @@ public: virtual ~ShenandoahAdaptiveHeuristics(); - virtual void choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset, - RegionData* data, size_t size, - size_t actual_free) override; + virtual size_t choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset, + RegionData* data, size_t size, + size_t actual_free) override; virtual void record_cycle_start() override; virtual void record_success_concurrent() override; diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAggressiveHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAggressiveHeuristics.cpp index a833e39631c..990b59ec853 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAggressiveHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAggressiveHeuristics.cpp @@ -39,15 +39,16 @@ ShenandoahAggressiveHeuristics::ShenandoahAggressiveHeuristics(ShenandoahSpaceIn SHENANDOAH_ERGO_ENABLE_FLAG(ShenandoahEvacReserveOverflow); } -void ShenandoahAggressiveHeuristics::choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset, - RegionData* data, size_t size, - size_t free) { +size_t ShenandoahAggressiveHeuristics::choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset, + RegionData* data, size_t size, + size_t free) { for (size_t idx = 0; idx < size; idx++) { ShenandoahHeapRegion* r = data[idx].get_region(); if (r->garbage() > 0) { cset->add_region(r); } } + return 0; } bool ShenandoahAggressiveHeuristics::should_start_gc() { diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAggressiveHeuristics.hpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAggressiveHeuristics.hpp index 5075258f1ce..25c8635489f 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAggressiveHeuristics.hpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahAggressiveHeuristics.hpp @@ -35,9 +35,9 @@ class ShenandoahAggressiveHeuristics : public ShenandoahHeuristics { public: ShenandoahAggressiveHeuristics(ShenandoahSpaceInfo* space_info); - virtual void choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset, - RegionData* data, size_t size, - size_t free); + virtual size_t choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset, + RegionData* data, size_t size, + size_t free); virtual bool should_start_gc(); diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahCompactHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahCompactHeuristics.cpp index 28673b28612..09a8394a4b1 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahCompactHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahCompactHeuristics.cpp @@ -76,9 +76,9 @@ bool ShenandoahCompactHeuristics::should_start_gc() { return ShenandoahHeuristics::should_start_gc(); } -void ShenandoahCompactHeuristics::choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset, - RegionData* data, size_t size, - size_t actual_free) { +size_t ShenandoahCompactHeuristics::choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset, + RegionData* data, size_t size, + size_t actual_free) { // Do not select too large CSet that would overflow the available free space size_t max_cset = actual_free * 3 / 4; @@ -97,4 +97,5 @@ void ShenandoahCompactHeuristics::choose_collection_set_from_regiondata(Shenando cset->add_region(r); } } + return 0; } diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahCompactHeuristics.hpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahCompactHeuristics.hpp index 21ec99eabc0..4988d5d495d 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahCompactHeuristics.hpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahCompactHeuristics.hpp @@ -37,9 +37,9 @@ public: virtual bool should_start_gc(); - virtual void choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset, - RegionData* data, size_t size, - size_t actual_free); + virtual size_t choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset, + RegionData* data, size_t size, + size_t actual_free); virtual const char* name() { return "Compact"; } virtual bool is_diagnostic() { return false; } diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGenerationalHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGenerationalHeuristics.cpp index b14d72f249b..ee315ce5c7e 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGenerationalHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGenerationalHeuristics.cpp @@ -37,7 +37,7 @@ ShenandoahGenerationalHeuristics::ShenandoahGenerationalHeuristics(ShenandoahGen : ShenandoahAdaptiveHeuristics(generation), _generation(generation) { } -void ShenandoahGenerationalHeuristics::choose_collection_set(ShenandoahCollectionSet* collection_set) { +size_t ShenandoahGenerationalHeuristics::choose_collection_set(ShenandoahCollectionSet* collection_set) { assert(collection_set->is_empty(), "Must be empty"); auto heap = ShenandoahGenerationalHeap::heap(); @@ -168,16 +168,12 @@ void ShenandoahGenerationalHeuristics::choose_collection_set(ShenandoahCollectio byte_size_in_proper_unit(total_garbage), proper_unit_for_byte_size(total_garbage)); size_t immediate_percent = (total_garbage == 0) ? 0 : (immediate_garbage * 100 / total_garbage); - bool doing_promote_in_place = (humongous_regions_promoted + regular_regions_promoted_in_place > 0); - if (doing_promote_in_place || (preselected_candidates > 0) || (immediate_percent <= ShenandoahImmediateThreshold)) { - // Only young collections need to prime the collection set. - if (_generation->is_young()) { - heap->old_generation()->heuristics()->prime_collection_set(collection_set); - } + size_t add_regions_to_old = 0; + if (doing_promote_in_place || (preselected_candidates > 0) || (immediate_percent <= ShenandoahImmediateThreshold)) { // Call the subclasses to add young-gen regions into the collection set. - choose_collection_set_from_regiondata(collection_set, candidates, cand_idx, immediate_garbage + free); + add_regions_to_old = choose_collection_set_from_regiondata(collection_set, candidates, cand_idx, immediate_garbage + free); } if (collection_set->has_old_regions()) { @@ -194,6 +190,7 @@ void ShenandoahGenerationalHeuristics::choose_collection_set(ShenandoahCollectio regular_regions_promoted_free, immediate_regions, immediate_garbage); + return add_regions_to_old; } @@ -210,13 +207,6 @@ size_t ShenandoahGenerationalHeuristics::add_preselected_regions_to_collection_s assert(ShenandoahGenerationalHeap::heap()->is_tenurable(r), "Preselected regions must have tenure age"); // Entire region will be promoted, This region does not impact young-gen or old-gen evacuation reserve. // This region has been pre-selected and its impact on promotion reserve is already accounted for. - - // r->used() is r->garbage() + r->get_live_data_bytes() - // Since all live data in this region is being evacuated from young-gen, it is as if this memory - // is garbage insofar as young-gen is concerned. Counting this as garbage reduces the need to - // reclaim highly utilized young-gen regions just for the sake of finding min_garbage to reclaim - // within young-gen memory. - cur_young_garbage += r->garbage(); cset->add_region(r); } diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGenerationalHeuristics.hpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGenerationalHeuristics.hpp index 31c016bb4b7..9b4c93af9b4 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGenerationalHeuristics.hpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGenerationalHeuristics.hpp @@ -44,7 +44,7 @@ class ShenandoahGenerationalHeuristics : public ShenandoahAdaptiveHeuristics { public: explicit ShenandoahGenerationalHeuristics(ShenandoahGeneration* generation); - void choose_collection_set(ShenandoahCollectionSet* collection_set) override; + size_t choose_collection_set(ShenandoahCollectionSet* collection_set) override; protected: ShenandoahGeneration* _generation; diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGlobalHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGlobalHeuristics.cpp index 51805b205dd..f47371c14d5 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGlobalHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGlobalHeuristics.cpp @@ -24,6 +24,7 @@ */ #include "gc/shenandoah/heuristics/shenandoahGlobalHeuristics.hpp" +#include "gc/shenandoah/shenandoahAsserts.hpp" #include "gc/shenandoah/shenandoahCollectorPolicy.hpp" #include "gc/shenandoah/shenandoahGenerationalHeap.inline.hpp" #include "gc/shenandoah/shenandoahGlobalGeneration.hpp" @@ -35,13 +36,14 @@ ShenandoahGlobalHeuristics::ShenandoahGlobalHeuristics(ShenandoahGlobalGeneratio } -void ShenandoahGlobalHeuristics::choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset, - RegionData* data, size_t size, - size_t actual_free) { +size_t ShenandoahGlobalHeuristics::choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset, + RegionData* data, size_t size, + size_t actual_free) { // Better select garbage-first regions QuickSort::sort(data, (int) size, compare_by_garbage); choose_global_collection_set(cset, data, size, actual_free, 0 /* cur_young_garbage */); + return 0; } @@ -49,94 +51,212 @@ void ShenandoahGlobalHeuristics::choose_global_collection_set(ShenandoahCollecti const ShenandoahHeuristics::RegionData* data, size_t size, size_t actual_free, size_t cur_young_garbage) const { + shenandoah_assert_heaplocked_or_safepoint(); auto heap = ShenandoahGenerationalHeap::heap(); + auto free_set = heap->free_set(); size_t region_size_bytes = ShenandoahHeapRegion::region_size_bytes(); size_t capacity = heap->soft_max_capacity(); + size_t garbage_threshold = region_size_bytes * ShenandoahGarbageThreshold / 100; size_t ignore_threshold = region_size_bytes * ShenandoahIgnoreGarbageThreshold / 100; size_t young_evac_reserve = heap->young_generation()->get_evacuation_reserve(); + size_t original_young_evac_reserve = young_evac_reserve; size_t old_evac_reserve = heap->old_generation()->get_evacuation_reserve(); - size_t max_young_cset = (size_t) (young_evac_reserve / ShenandoahEvacWaste); - size_t young_cur_cset = 0; - size_t max_old_cset = (size_t) (old_evac_reserve / ShenandoahOldEvacWaste); - size_t old_cur_cset = 0; + size_t old_promo_reserve = heap->old_generation()->get_promoted_reserve(); - // Figure out how many unaffiliated young regions are dedicated to mutator and to evacuator. Allow the young - // collector's unaffiliated regions to be transferred to old-gen if old-gen has more easily reclaimed garbage - // than young-gen. At the end of this cycle, any excess regions remaining in old-gen will be transferred back - // to young. Do not transfer the mutator's unaffiliated regions to old-gen. Those must remain available - // to the mutator as it needs to be able to consume this memory during concurrent GC. - - size_t unaffiliated_young_regions = heap->young_generation()->free_unaffiliated_regions(); + size_t unaffiliated_young_regions = free_set->collector_unaffiliated_regions(); size_t unaffiliated_young_memory = unaffiliated_young_regions * region_size_bytes; + size_t unaffiliated_old_regions = free_set->old_collector_unaffiliated_regions(); + size_t unaffiliated_old_memory = unaffiliated_old_regions * region_size_bytes; - if (unaffiliated_young_memory > max_young_cset) { - size_t unaffiliated_mutator_memory = unaffiliated_young_memory - max_young_cset; - unaffiliated_young_memory -= unaffiliated_mutator_memory; - unaffiliated_young_regions = unaffiliated_young_memory / region_size_bytes; // round down - unaffiliated_young_memory = unaffiliated_young_regions * region_size_bytes; + // Figure out how many unaffiliated regions are dedicated to Collector and OldCollector reserves. Let these + // be shuffled between young and old generations in order to expedite evacuation of whichever regions have the + // most garbage, regardless of whether these garbage-first regions reside in young or old generation. + // Excess reserves will be transferred back to the mutator after collection set has been chosen. At the end + // of evacuation, any reserves not consumed by evacuation will also be transferred to the mutator free set. + + // Truncate reserves to only target unaffiliated memory + size_t shared_reserve_regions = 0; + if (young_evac_reserve > unaffiliated_young_memory) { + shared_reserve_regions += unaffiliated_young_regions; + } else { + size_t delta_regions = young_evac_reserve / region_size_bytes; + shared_reserve_regions += delta_regions; } + young_evac_reserve = 0; + size_t total_old_reserve = old_evac_reserve + old_promo_reserve; + if (total_old_reserve > unaffiliated_old_memory) { + // Give all the unaffiliated memory to the shared reserves. Leave the rest for promo reserve. + shared_reserve_regions += unaffiliated_old_regions; + old_promo_reserve = total_old_reserve - unaffiliated_old_memory; + } else { + size_t delta_regions = old_evac_reserve / region_size_bytes; + shared_reserve_regions += delta_regions; + } + old_evac_reserve = 0; + assert(shared_reserve_regions <= + (heap->young_generation()->free_unaffiliated_regions() + heap->old_generation()->free_unaffiliated_regions()), + "simple math"); - // We'll affiliate these unaffiliated regions with either old or young, depending on need. - max_young_cset -= unaffiliated_young_memory; + size_t shared_reserves = shared_reserve_regions * region_size_bytes; + size_t committed_from_shared_reserves = 0; - // Keep track of how many regions we plan to transfer from young to old. - size_t regions_transferred_to_old = 0; + size_t promo_bytes = 0; + size_t old_evac_bytes = 0; + size_t young_evac_bytes = 0; - size_t free_target = (capacity * ShenandoahMinFreeThreshold) / 100 + max_young_cset; + size_t consumed_by_promo = 0; // promo_bytes * ShenandoahPromoEvacWaste + size_t consumed_by_old_evac = 0; // old_evac_bytes * ShenandoahOldEvacWaste + size_t consumed_by_young_evac = 0; // young_evac_bytes * ShenandoahEvacWaste + + // Of the memory reclaimed by GC, some of this will need to be reserved for the next GC collection. Use the current + // young reserve as an approximation of the future Collector reserve requirement. Try to end with at least + // (capacity * ShenandoahMinFreeThreshold) / 100 bytes available to the mutator. + size_t free_target = (capacity * ShenandoahMinFreeThreshold) / 100 + original_young_evac_reserve; size_t min_garbage = (free_target > actual_free) ? (free_target - actual_free) : 0; - log_info(gc, ergo)("Adaptive CSet Selection for GLOBAL. Max Young Evacuation: %zu" - "%s, Max Old Evacuation: %zu%s, Max Either Evacuation: %zu%s, Actual Free: %zu%s.", - byte_size_in_proper_unit(max_young_cset), proper_unit_for_byte_size(max_young_cset), - byte_size_in_proper_unit(max_old_cset), proper_unit_for_byte_size(max_old_cset), - byte_size_in_proper_unit(unaffiliated_young_memory), proper_unit_for_byte_size(unaffiliated_young_memory), - byte_size_in_proper_unit(actual_free), proper_unit_for_byte_size(actual_free)); + size_t aged_regions_promoted = 0; + size_t young_regions_evacuated = 0; + size_t old_regions_evacuated = 0; + log_info(gc, ergo)("Adaptive CSet Selection for GLOBAL. Discretionary evacuation budget (for either old or young): %zu%s" + ", Actual Free: %zu%s.", + byte_size_in_proper_unit(shared_reserves), proper_unit_for_byte_size(shared_reserves), + byte_size_in_proper_unit(actual_free), proper_unit_for_byte_size(actual_free)); + + size_t cur_garbage = cur_young_garbage; for (size_t idx = 0; idx < size; idx++) { ShenandoahHeapRegion* r = data[idx].get_region(); assert(!cset->is_preselected(r->index()), "There should be no preselected regions during GLOBAL GC"); bool add_region = false; - if (r->is_old() || heap->is_tenurable(r)) { - size_t new_cset = old_cur_cset + r->get_live_data_bytes(); - if ((r->garbage() > garbage_threshold)) { - while ((new_cset > max_old_cset) && (unaffiliated_young_regions > 0)) { - unaffiliated_young_regions--; - regions_transferred_to_old++; - max_old_cset += region_size_bytes / ShenandoahOldEvacWaste; + size_t region_garbage = r->garbage(); + size_t new_garbage = cur_garbage + region_garbage; + bool add_regardless = (region_garbage > ignore_threshold) && (new_garbage < min_garbage); + size_t live_bytes = r->get_live_data_bytes(); + if (add_regardless || (region_garbage >= garbage_threshold)) { + if (r->is_old()) { + size_t anticipated_consumption = (size_t) (live_bytes * ShenandoahOldEvacWaste); + size_t new_old_consumption = consumed_by_old_evac + anticipated_consumption; + size_t new_old_evac_reserve = old_evac_reserve; + size_t proposed_old_region_expansion = 0; + while ((new_old_consumption > new_old_evac_reserve) && (committed_from_shared_reserves < shared_reserves)) { + committed_from_shared_reserves += region_size_bytes; + proposed_old_region_expansion++; + new_old_evac_reserve += region_size_bytes; } - } - if ((new_cset <= max_old_cset) && (r->garbage() > garbage_threshold)) { - add_region = true; - old_cur_cset = new_cset; - } - } else { - assert(r->is_young() && !heap->is_tenurable(r), "DeMorgan's law (assuming r->is_affiliated)"); - size_t new_cset = young_cur_cset + r->get_live_data_bytes(); - size_t region_garbage = r->garbage(); - size_t new_garbage = cur_young_garbage + region_garbage; - bool add_regardless = (region_garbage > ignore_threshold) && (new_garbage < min_garbage); - - if (add_regardless || (r->garbage() > garbage_threshold)) { - while ((new_cset > max_young_cset) && (unaffiliated_young_regions > 0)) { - unaffiliated_young_regions--; - max_young_cset += region_size_bytes / ShenandoahEvacWaste; + // If this region has free memory and we choose to place it in the collection set, its free memory is no longer + // available to hold promotion results. So we behave as if its free memory is consumed within the promotion reserve. + size_t anticipated_loss_from_promo_reserve = r->free(); + size_t new_promo_consumption = consumed_by_promo + anticipated_loss_from_promo_reserve; + size_t new_promo_reserve = old_promo_reserve; + while ((new_promo_consumption > new_promo_reserve) && (committed_from_shared_reserves < shared_reserves)) { + committed_from_shared_reserves += region_size_bytes; + proposed_old_region_expansion++; + new_promo_reserve += region_size_bytes; + } + if ((new_old_consumption <= new_old_evac_reserve) && (new_promo_consumption <= new_promo_reserve)) { + add_region = true; + old_evac_reserve = new_old_evac_reserve; + old_promo_reserve = new_promo_reserve; + old_evac_bytes += live_bytes; + consumed_by_old_evac = new_old_consumption; + consumed_by_promo = new_promo_consumption; + cur_garbage = new_garbage; + old_regions_evacuated++; + } else { + // We failed to sufficiently expand old so unwind proposed expansion + committed_from_shared_reserves -= proposed_old_region_expansion * region_size_bytes; + } + } else if (heap->is_tenurable(r)) { + size_t anticipated_consumption = (size_t) (live_bytes * ShenandoahPromoEvacWaste); + size_t new_promo_consumption = consumed_by_promo + anticipated_consumption; + size_t new_promo_reserve = old_promo_reserve; + size_t proposed_old_region_expansion = 0; + while ((new_promo_consumption > new_promo_reserve) && (committed_from_shared_reserves < shared_reserves)) { + committed_from_shared_reserves += region_size_bytes; + proposed_old_region_expansion++; + new_promo_reserve += region_size_bytes; + } + if (new_promo_consumption <= new_promo_reserve) { + add_region = true; + old_promo_reserve = new_promo_reserve; + promo_bytes += live_bytes; + consumed_by_promo = new_promo_consumption; + cur_garbage = new_garbage; + aged_regions_promoted++; + } else { + // We failed to sufficiently expand old so unwind proposed expansion + committed_from_shared_reserves -= proposed_old_region_expansion * region_size_bytes; + } + } else { + assert(r->is_young() && !heap->is_tenurable(r), "DeMorgan's law (assuming r->is_affiliated)"); + size_t anticipated_consumption = (size_t) (live_bytes * ShenandoahEvacWaste); + size_t new_young_evac_consumption = consumed_by_young_evac + anticipated_consumption; + size_t new_young_evac_reserve = young_evac_reserve; + size_t proposed_young_region_expansion = 0; + while ((new_young_evac_consumption > new_young_evac_reserve) && (committed_from_shared_reserves < shared_reserves)) { + committed_from_shared_reserves += region_size_bytes; + proposed_young_region_expansion++; + new_young_evac_reserve += region_size_bytes; + } + if (new_young_evac_consumption <= new_young_evac_reserve) { + add_region = true; + young_evac_reserve = new_young_evac_reserve; + young_evac_bytes += live_bytes; + consumed_by_young_evac = new_young_evac_consumption; + cur_garbage = new_garbage; + young_regions_evacuated++; + } else { + // We failed to sufficiently expand old so unwind proposed expansion + committed_from_shared_reserves -= proposed_young_region_expansion * region_size_bytes; } - } - if ((new_cset <= max_young_cset) && (add_regardless || (region_garbage > garbage_threshold))) { - add_region = true; - young_cur_cset = new_cset; - cur_young_garbage = new_garbage; } } if (add_region) { cset->add_region(r); } } - if (regions_transferred_to_old > 0) { - assert(young_evac_reserve > regions_transferred_to_old * region_size_bytes, "young reserve cannot be negative"); - heap->young_generation()->set_evacuation_reserve(young_evac_reserve - regions_transferred_to_old * region_size_bytes); - heap->old_generation()->set_evacuation_reserve(old_evac_reserve + regions_transferred_to_old * region_size_bytes); + + if (committed_from_shared_reserves < shared_reserves) { + // Give all the rest to promotion + old_promo_reserve += (shared_reserves - committed_from_shared_reserves); + // dead code: committed_from_shared_reserves = shared_reserves; } + + // Consider the effects of round-off: + // 1. We know that the sum over each evacuation mutiplied by Evacuation Waste is <= total evacuation reserve + // 2. However, the reserve for each individual evacuation may be rounded down. In the worst case, we will be over budget + // by the number of regions evacuated, since each region's reserve might be under-estimated by at most 1 + // 3. Likewise, if we take the sum of bytes evacuated and multiply this by the Evacuation Waste and then round down + // to nearest integer, the calculated reserve will underestimate the true reserve needs by at most 1. + // 4. This explains the adjustments to subtotals in the assert statements below. + assert(young_evac_bytes * ShenandoahEvacWaste <= young_evac_reserve + young_regions_evacuated, + "budget: %zu <= %zu", (size_t) (young_evac_bytes * ShenandoahEvacWaste), young_evac_reserve); + assert(old_evac_bytes * ShenandoahOldEvacWaste <= old_evac_reserve + old_regions_evacuated, + "budget: %zu <= %zu", (size_t) (old_evac_bytes * ShenandoahOldEvacWaste), old_evac_reserve); + assert(promo_bytes * ShenandoahPromoEvacWaste <= old_promo_reserve + aged_regions_promoted, + "budget: %zu <= %zu", (size_t) (promo_bytes * ShenandoahPromoEvacWaste), old_promo_reserve); + assert(young_evac_reserve + old_evac_reserve + old_promo_reserve <= + heap->young_generation()->get_evacuation_reserve() + heap->old_generation()->get_evacuation_reserve() + + heap->old_generation()->get_promoted_reserve(), "Exceeded budget"); + + if (heap->young_generation()->get_evacuation_reserve() < young_evac_reserve) { + size_t delta_bytes = young_evac_reserve - heap->young_generation()->get_evacuation_reserve(); + size_t delta_regions = delta_bytes / region_size_bytes; + size_t regions_to_transfer = MIN2(unaffiliated_old_regions, delta_regions); + log_info(gc)("Global GC moves %zu unaffiliated regions from old collector to young collector reserves", regions_to_transfer); + ssize_t negated_regions = -regions_to_transfer; + heap->free_set()->move_unaffiliated_regions_from_collector_to_old_collector(negated_regions); + } else if (heap->young_generation()->get_evacuation_reserve() > young_evac_reserve) { + size_t delta_bytes = heap->young_generation()->get_evacuation_reserve() - young_evac_reserve; + size_t delta_regions = delta_bytes / region_size_bytes; + size_t regions_to_transfer = MIN2(unaffiliated_young_regions, delta_regions); + log_info(gc)("Global GC moves %zu unaffiliated regions from young collector to old collector reserves", regions_to_transfer); + heap->free_set()->move_unaffiliated_regions_from_collector_to_old_collector(regions_to_transfer); + } + + heap->young_generation()->set_evacuation_reserve(young_evac_reserve); + heap->old_generation()->set_evacuation_reserve(old_evac_reserve); + heap->old_generation()->set_promoted_reserve(old_promo_reserve); } diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGlobalHeuristics.hpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGlobalHeuristics.hpp index 1f95f75c521..e0513f60da9 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGlobalHeuristics.hpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahGlobalHeuristics.hpp @@ -39,9 +39,9 @@ class ShenandoahGlobalHeuristics : public ShenandoahGenerationalHeuristics { public: ShenandoahGlobalHeuristics(ShenandoahGlobalGeneration* generation); - void choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset, - RegionData* data, size_t size, - size_t actual_free) override; + size_t choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset, + RegionData* data, size_t size, + size_t actual_free) override; private: void choose_global_collection_set(ShenandoahCollectionSet* cset, diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahHeuristics.cpp index eb740cfac61..aeb64b6f1df 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahHeuristics.cpp @@ -72,7 +72,7 @@ ShenandoahHeuristics::~ShenandoahHeuristics() { FREE_C_HEAP_ARRAY(RegionGarbage, _region_data); } -void ShenandoahHeuristics::choose_collection_set(ShenandoahCollectionSet* collection_set) { +size_t ShenandoahHeuristics::choose_collection_set(ShenandoahCollectionSet* collection_set) { ShenandoahHeap* heap = ShenandoahHeap::heap(); assert(collection_set->is_empty(), "Must be empty"); @@ -153,8 +153,8 @@ void ShenandoahHeuristics::choose_collection_set(ShenandoahCollectionSet* collec if (immediate_percent <= ShenandoahImmediateThreshold) { choose_collection_set_from_regiondata(collection_set, candidates, cand_idx, immediate_garbage + free); } - collection_set->summarize(total_garbage, immediate_garbage, immediate_regions); + return 0; } void ShenandoahHeuristics::record_cycle_start() { diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahHeuristics.hpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahHeuristics.hpp index fb8cfb36353..ae34a9743a9 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahHeuristics.hpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahHeuristics.hpp @@ -129,6 +129,13 @@ protected: #endif } + inline void update_livedata(size_t live) { + _region_union._live_data = live; +#ifdef ASSERT + _union_tag = is_live_data; +#endif + } + inline ShenandoahHeapRegion* get_region() const { assert(_union_tag != is_uninitialized, "Cannot fetch region from uninitialized RegionData"); return _region; @@ -176,9 +183,12 @@ protected: static int compare_by_garbage(RegionData a, RegionData b); - virtual void choose_collection_set_from_regiondata(ShenandoahCollectionSet* set, - RegionData* data, size_t data_size, - size_t free) = 0; + // This is a helper function to choose_collection_set(), returning the number of regions that need to be transferred to + // the old reserve from the young reserve in order to effectively evacuate the chosen collection set. In non-generational + // mode, the return value is 0. + virtual size_t choose_collection_set_from_regiondata(ShenandoahCollectionSet* set, + RegionData* data, size_t data_size, + size_t free) = 0; void adjust_penalty(intx step); @@ -226,7 +236,9 @@ public: virtual void record_requested_gc(); - virtual void choose_collection_set(ShenandoahCollectionSet* collection_set); + // Choose the collection set, returning the number of regions that need to be transferred to the old reserve from the young + // reserve in order to effectively evacuate the chosen collection set. In non-generational mode, the return value is 0. + virtual size_t choose_collection_set(ShenandoahCollectionSet* collection_set); virtual bool can_unload_classes(); diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahOldHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahOldHeuristics.cpp index 029a4dd98fb..f47d0cbe819 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahOldHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahOldHeuristics.cpp @@ -26,9 +26,11 @@ #include "gc/shenandoah/heuristics/shenandoahOldHeuristics.hpp" #include "gc/shenandoah/shenandoahCollectionSet.hpp" #include "gc/shenandoah/shenandoahCollectorPolicy.hpp" +#include "gc/shenandoah/shenandoahFreeSet.hpp" #include "gc/shenandoah/shenandoahGenerationalHeap.hpp" #include "gc/shenandoah/shenandoahHeapRegion.inline.hpp" #include "gc/shenandoah/shenandoahOldGeneration.hpp" +#include "gc/shenandoah/shenandoahYoungGeneration.hpp" #include "logging/log.hpp" #include "utilities/quickSort.hpp" @@ -77,18 +79,31 @@ ShenandoahOldHeuristics::ShenandoahOldHeuristics(ShenandoahOldGeneration* genera } bool ShenandoahOldHeuristics::prime_collection_set(ShenandoahCollectionSet* collection_set) { - if (unprocessed_old_collection_candidates() == 0) { - return false; - } + _mixed_evac_cset = collection_set; + _included_old_regions = 0; + _evacuated_old_bytes = 0; + _collected_old_bytes = 0; if (_old_generation->is_preparing_for_mark()) { // We have unprocessed old collection candidates, but the heuristic has given up on evacuating them. // This is most likely because they were _all_ pinned at the time of the last mixed evacuation (and // this in turn is most likely because there are just one or two candidate regions remaining). - log_info(gc, ergo)("Remaining " UINT32_FORMAT " old regions are being coalesced and filled", unprocessed_old_collection_candidates()); + log_info(gc, ergo)("Remaining " UINT32_FORMAT + " old regions are being coalesced and filled", unprocessed_old_collection_candidates()); return false; } + // Between consecutive mixed-evacuation cycles, the live data within each candidate region may change due to + // promotions and old-gen evacuations. Re-sort the candidate regions in order to first evacuate regions that have + // the smallest amount of live data. These are easiest to evacuate with least effort. Doing these first allows + // us to more quickly replenish free memory with empty regions. + for (uint i = _next_old_collection_candidate; i < _last_old_collection_candidate; i++) { + ShenandoahHeapRegion* r = _region_data[i].get_region(); + _region_data[i].update_livedata(r->get_mixed_candidate_live_data_bytes()); + } + QuickSort::sort(_region_data + _next_old_collection_candidate, unprocessed_old_collection_candidates(), + compare_by_live); + _first_pinned_candidate = NOT_FOUND; uint included_old_regions = 0; @@ -100,150 +115,44 @@ bool ShenandoahOldHeuristics::prime_collection_set(ShenandoahCollectionSet* coll // of memory that can still be evacuated. We address this by reducing the evacuation budget by the amount // of live memory in that region and by the amount of unallocated memory in that region if the evacuation // budget is constrained by availability of free memory. - const size_t old_evacuation_reserve = _old_generation->get_evacuation_reserve(); - const size_t old_evacuation_budget = (size_t) ((double) old_evacuation_reserve / ShenandoahOldEvacWaste); - size_t unfragmented_available = _old_generation->free_unaffiliated_regions() * ShenandoahHeapRegion::region_size_bytes(); - size_t fragmented_available; - size_t excess_fragmented_available; + _old_evacuation_reserve = _old_generation->get_evacuation_reserve(); + _old_evacuation_budget = (size_t) ((double) _old_evacuation_reserve / ShenandoahOldEvacWaste); - if (unfragmented_available > old_evacuation_budget) { - unfragmented_available = old_evacuation_budget; - fragmented_available = 0; - excess_fragmented_available = 0; + // fragmented_available is the amount of memory within partially consumed old regions that may be required to + // hold the results of old evacuations. If all of the memory required by the old evacuation reserve is available + // in unfragmented regions (unaffiliated old regions), then fragmented_available is zero because we do not need + // to evacuate into the existing partially consumed old regions. + + // if fragmented_available is non-zero, excess_fragmented_old_budget represents the amount of fragmented memory + // that is available within old, but is not required to hold the resuilts of old evacuation. As old-gen regions + // are added into the collection set, their free memory is subtracted from excess_fragmented_old_budget until the + // excess is exhausted. For old-gen regions subsequently added to the collection set, their free memory is + // subtracted from fragmented_available and from the old_evacuation_budget (since the budget decreases when this + // fragmented_available memory decreases). After fragmented_available has been exhausted, any further old regions + // selected for the cset do not further decrease the old_evacuation_budget because all further evacuation is targeted + // to unfragmented regions. + + size_t unaffiliated_available = _old_generation->free_unaffiliated_regions() * ShenandoahHeapRegion::region_size_bytes(); + if (unaffiliated_available > _old_evacuation_reserve) { + _unspent_unfragmented_old_budget = _old_evacuation_budget; + _unspent_fragmented_old_budget = 0; + _excess_fragmented_old_budget = 0; } else { - assert(_old_generation->available() >= old_evacuation_budget, "Cannot budget more than is available"); - fragmented_available = _old_generation->available() - unfragmented_available; - assert(fragmented_available + unfragmented_available >= old_evacuation_budget, "Budgets do not add up"); - if (fragmented_available + unfragmented_available > old_evacuation_budget) { - excess_fragmented_available = (fragmented_available + unfragmented_available) - old_evacuation_budget; - fragmented_available -= excess_fragmented_available; + assert(_old_generation->available() >= _old_evacuation_reserve, "Cannot reserve more than is available"); + size_t affiliated_available = _old_generation->available() - unaffiliated_available; + assert(affiliated_available + unaffiliated_available >= _old_evacuation_reserve, "Budgets do not add up"); + if (affiliated_available + unaffiliated_available > _old_evacuation_reserve) { + _excess_fragmented_old_budget = (affiliated_available + unaffiliated_available) - _old_evacuation_reserve; + affiliated_available -= _excess_fragmented_old_budget; } + _unspent_fragmented_old_budget = (size_t) ((double) affiliated_available / ShenandoahOldEvacWaste); + _unspent_unfragmented_old_budget = (size_t) ((double) unaffiliated_available / ShenandoahOldEvacWaste); } - size_t remaining_old_evacuation_budget = old_evacuation_budget; - log_debug(gc)("Choose old regions for mixed collection: old evacuation budget: %zu%s, candidates: %u", - byte_size_in_proper_unit(old_evacuation_budget), proper_unit_for_byte_size(old_evacuation_budget), + log_debug(gc)("Choose old regions for mixed collection: old evacuation budget: " PROPERFMT ", candidates: %u", + PROPERFMTARGS(_old_evacuation_budget), unprocessed_old_collection_candidates()); - - size_t lost_evacuation_capacity = 0; - - // The number of old-gen regions that were selected as candidates for collection at the end of the most recent old-gen - // concurrent marking phase and have not yet been collected is represented by unprocessed_old_collection_candidates(). - // Candidate regions are ordered according to increasing amount of live data. If there is not sufficient room to - // evacuate region N, then there is no need to even consider evacuating region N+1. - while (unprocessed_old_collection_candidates() > 0) { - // Old collection candidates are sorted in order of decreasing garbage contained therein. - ShenandoahHeapRegion* r = next_old_collection_candidate(); - if (r == nullptr) { - break; - } - assert(r->is_regular(), "There should be no humongous regions in the set of mixed-evac candidates"); - - // If region r is evacuated to fragmented memory (to free memory within a partially used region), then we need - // to decrease the capacity of the fragmented memory by the scaled loss. - - const size_t live_data_for_evacuation = r->get_live_data_bytes(); - size_t lost_available = r->free(); - - if ((lost_available > 0) && (excess_fragmented_available > 0)) { - if (lost_available < excess_fragmented_available) { - excess_fragmented_available -= lost_available; - lost_evacuation_capacity -= lost_available; - lost_available = 0; - } else { - lost_available -= excess_fragmented_available; - lost_evacuation_capacity -= excess_fragmented_available; - excess_fragmented_available = 0; - } - } - size_t scaled_loss = (size_t) ((double) lost_available / ShenandoahOldEvacWaste); - if ((lost_available > 0) && (fragmented_available > 0)) { - if (scaled_loss + live_data_for_evacuation < fragmented_available) { - fragmented_available -= scaled_loss; - scaled_loss = 0; - } else { - // We will have to allocate this region's evacuation memory from unfragmented memory, so don't bother - // to decrement scaled_loss - } - } - if (scaled_loss > 0) { - // We were not able to account for the lost free memory within fragmented memory, so we need to take this - // allocation out of unfragmented memory. Unfragmented memory does not need to account for loss of free. - if (live_data_for_evacuation > unfragmented_available) { - // There is no room to evacuate this region or any that come after it in within the candidates array. - log_debug(gc, cset)("Not enough unfragmented memory (%zu) to hold evacuees (%zu) from region: (%zu)", - unfragmented_available, live_data_for_evacuation, r->index()); - break; - } else { - unfragmented_available -= live_data_for_evacuation; - } - } else { - // Since scaled_loss == 0, we have accounted for the loss of free memory, so we can allocate from either - // fragmented or unfragmented available memory. Use up the fragmented memory budget first. - size_t evacuation_need = live_data_for_evacuation; - - if (evacuation_need > fragmented_available) { - evacuation_need -= fragmented_available; - fragmented_available = 0; - } else { - fragmented_available -= evacuation_need; - evacuation_need = 0; - } - if (evacuation_need > unfragmented_available) { - // There is no room to evacuate this region or any that come after it in within the candidates array. - log_debug(gc, cset)("Not enough unfragmented memory (%zu) to hold evacuees (%zu) from region: (%zu)", - unfragmented_available, live_data_for_evacuation, r->index()); - break; - } else { - unfragmented_available -= evacuation_need; - // dead code: evacuation_need == 0; - } - } - collection_set->add_region(r); - included_old_regions++; - evacuated_old_bytes += live_data_for_evacuation; - collected_old_bytes += r->garbage(); - consume_old_collection_candidate(); - } - - if (_first_pinned_candidate != NOT_FOUND) { - // Need to deal with pinned regions - slide_pinned_regions_to_front(); - } - decrease_unprocessed_old_collection_candidates_live_memory(evacuated_old_bytes); - if (included_old_regions > 0) { - log_info(gc, ergo)("Old-gen piggyback evac (" UINT32_FORMAT " regions, evacuating " PROPERFMT ", reclaiming: " PROPERFMT ")", - included_old_regions, PROPERFMTARGS(evacuated_old_bytes), PROPERFMTARGS(collected_old_bytes)); - } - - if (unprocessed_old_collection_candidates() == 0) { - // We have added the last of our collection candidates to a mixed collection. - // Any triggers that occurred during mixed evacuations may no longer be valid. They can retrigger if appropriate. - clear_triggers(); - - _old_generation->complete_mixed_evacuations(); - } else if (included_old_regions == 0) { - // We have candidates, but none were included for evacuation - are they all pinned? - // or did we just not have enough room for any of them in this collection set? - // We don't want a region with a stuck pin to prevent subsequent old collections, so - // if they are all pinned we transition to a state that will allow us to make these uncollected - // (pinned) regions parsable. - if (all_candidates_are_pinned()) { - log_info(gc, ergo)("All candidate regions " UINT32_FORMAT " are pinned", unprocessed_old_collection_candidates()); - _old_generation->abandon_mixed_evacuations(); - } else { - log_info(gc, ergo)("No regions selected for mixed collection. " - "Old evacuation budget: " PROPERFMT ", Remaining evacuation budget: " PROPERFMT - ", Lost capacity: " PROPERFMT - ", Next candidate: " UINT32_FORMAT ", Last candidate: " UINT32_FORMAT, - PROPERFMTARGS(old_evacuation_reserve), - PROPERFMTARGS(remaining_old_evacuation_budget), - PROPERFMTARGS(lost_evacuation_capacity), - _next_old_collection_candidate, _last_old_collection_candidate); - } - } - - return (included_old_regions > 0); + return add_old_regions_to_cset(); } bool ShenandoahOldHeuristics::all_candidates_are_pinned() { @@ -317,6 +226,187 @@ void ShenandoahOldHeuristics::slide_pinned_regions_to_front() { _next_old_collection_candidate = write_index + 1; } +bool ShenandoahOldHeuristics::add_old_regions_to_cset() { + if (unprocessed_old_collection_candidates() == 0) { + return false; + } + _first_pinned_candidate = NOT_FOUND; + + // The number of old-gen regions that were selected as candidates for collection at the end of the most recent old-gen + // concurrent marking phase and have not yet been collected is represented by unprocessed_old_collection_candidates(). + // Candidate regions are ordered according to increasing amount of live data. If there is not sufficient room to + // evacuate region N, then there is no need to even consider evacuating region N+1. + while (unprocessed_old_collection_candidates() > 0) { + // Old collection candidates are sorted in order of decreasing garbage contained therein. + ShenandoahHeapRegion* r = next_old_collection_candidate(); + if (r == nullptr) { + break; + } + assert(r->is_regular(), "There should be no humongous regions in the set of mixed-evac candidates"); + + // If region r is evacuated to fragmented memory (to free memory within a partially used region), then we need + // to decrease the capacity of the fragmented memory by the scaled loss. + + const size_t live_data_for_evacuation = r->get_live_data_bytes(); + size_t lost_available = r->free(); + + ssize_t fragmented_delta = 0; + ssize_t unfragmented_delta = 0; + ssize_t excess_delta = 0; + + // We must decrease our mixed-evacuation budgets proportional to the lost available memory. This memory that is no + // longer available was likely "promised" to promotions, so we must decrease our mixed evacuations now. + // (e.g. if we loose 14 bytes of available old memory, we must decrease the evacuation budget by 10 bytes.) + size_t scaled_loss = (size_t) (((double) lost_available) / ShenandoahOldEvacWaste); + if (lost_available > 0) { + // We need to subtract lost_available from our working evacuation budgets + if (scaled_loss < _excess_fragmented_old_budget) { + excess_delta -= scaled_loss; + _excess_fragmented_old_budget -= scaled_loss; + } else { + excess_delta -= _excess_fragmented_old_budget; + _excess_fragmented_old_budget = 0; + } + + if (scaled_loss < _unspent_fragmented_old_budget) { + _unspent_fragmented_old_budget -= scaled_loss; + fragmented_delta = -scaled_loss; + scaled_loss = 0; + } else { + scaled_loss -= _unspent_fragmented_old_budget; + fragmented_delta = -_unspent_fragmented_old_budget; + _unspent_fragmented_old_budget = 0; + } + + if (scaled_loss < _unspent_unfragmented_old_budget) { + _unspent_unfragmented_old_budget -= scaled_loss; + unfragmented_delta = -scaled_loss; + scaled_loss = 0; + } else { + scaled_loss -= _unspent_unfragmented_old_budget; + fragmented_delta = -_unspent_unfragmented_old_budget; + _unspent_unfragmented_old_budget = 0; + } + } + + // Allocate replica from unfragmented memory if that exists + size_t evacuation_need = live_data_for_evacuation; + if (evacuation_need < _unspent_unfragmented_old_budget) { + _unspent_unfragmented_old_budget -= evacuation_need; + } else { + if (_unspent_unfragmented_old_budget > 0) { + evacuation_need -= _unspent_unfragmented_old_budget; + unfragmented_delta -= _unspent_unfragmented_old_budget; + _unspent_unfragmented_old_budget = 0; + } + // Take the remaining allocation out of fragmented available + if (_unspent_fragmented_old_budget > evacuation_need) { + _unspent_fragmented_old_budget -= evacuation_need; + } else { + // We cannot add this region into the collection set. We're done. Undo the adjustments to available. + _unspent_fragmented_old_budget -= fragmented_delta; + _unspent_unfragmented_old_budget -= unfragmented_delta; + _excess_fragmented_old_budget -= excess_delta; + break; + } + } + _mixed_evac_cset->add_region(r); + _included_old_regions++; + _evacuated_old_bytes += live_data_for_evacuation; + _collected_old_bytes += r->garbage(); + consume_old_collection_candidate(); + } + return true; +} + +bool ShenandoahOldHeuristics::finalize_mixed_evacs() { + if (_first_pinned_candidate != NOT_FOUND) { + // Need to deal with pinned regions + slide_pinned_regions_to_front(); + } + decrease_unprocessed_old_collection_candidates_live_memory(_evacuated_old_bytes); + if (_included_old_regions > 0) { + log_info(gc)("Old-gen mixed evac (%zu regions, evacuating %zu%s, reclaiming: %zu%s)", + _included_old_regions, + byte_size_in_proper_unit(_evacuated_old_bytes), proper_unit_for_byte_size(_evacuated_old_bytes), + byte_size_in_proper_unit(_collected_old_bytes), proper_unit_for_byte_size(_collected_old_bytes)); + } + + if (unprocessed_old_collection_candidates() == 0) { + // We have added the last of our collection candidates to a mixed collection. + // Any triggers that occurred during mixed evacuations may no longer be valid. They can retrigger if appropriate. + clear_triggers(); + _old_generation->complete_mixed_evacuations(); + } else if (_included_old_regions == 0) { + // We have candidates, but none were included for evacuation - are they all pinned? + // or did we just not have enough room for any of them in this collection set? + // We don't want a region with a stuck pin to prevent subsequent old collections, so + // if they are all pinned we transition to a state that will allow us to make these uncollected + // (pinned) regions parsable. + if (all_candidates_are_pinned()) { + log_info(gc)("All candidate regions " UINT32_FORMAT " are pinned", unprocessed_old_collection_candidates()); + _old_generation->abandon_mixed_evacuations(); + } else { + log_info(gc)("No regions selected for mixed collection. " + "Old evacuation budget: " PROPERFMT ", Next candidate: " UINT32_FORMAT ", Last candidate: " UINT32_FORMAT, + PROPERFMTARGS(_old_evacuation_reserve), + _next_old_collection_candidate, _last_old_collection_candidate); + } + } + return (_included_old_regions > 0); +} + +bool ShenandoahOldHeuristics::top_off_collection_set(size_t &add_regions_to_old) { + if (unprocessed_old_collection_candidates() == 0) { + add_regions_to_old = 0; + return false; + } else { + ShenandoahYoungGeneration* young_generation = _heap->young_generation(); + size_t young_unaffiliated_regions = young_generation->free_unaffiliated_regions(); + size_t max_young_cset = young_generation->get_evacuation_reserve(); + + // We have budgeted to assure the live_bytes_in_tenurable_regions() get evacuated into old generation. Young reserves + // only for untenurable region evacuations. + size_t planned_young_evac = _mixed_evac_cset->get_live_bytes_in_untenurable_regions(); + size_t consumed_from_young_cset = (size_t) (planned_young_evac * ShenandoahEvacWaste); + + size_t region_size_bytes = ShenandoahHeapRegion::region_size_bytes(); + size_t regions_required_for_collector_reserve = (consumed_from_young_cset + region_size_bytes - 1) / region_size_bytes; + + assert(consumed_from_young_cset <= max_young_cset, "sanity"); + assert(max_young_cset <= young_unaffiliated_regions * region_size_bytes, "sanity"); + + size_t regions_for_old_expansion; + if (consumed_from_young_cset < max_young_cset) { + size_t excess_young_reserves = max_young_cset - consumed_from_young_cset; + // We can only transfer empty regions from young to old. Furthermore, we must be careful to assure that the young + // Collector reserve that remains after transfer is comprised entirely of empty (unaffiliated) regions. + size_t consumed_unaffiliated_regions = (consumed_from_young_cset + region_size_bytes - 1) / region_size_bytes; + size_t available_unaffiliated_regions = ((young_unaffiliated_regions > consumed_unaffiliated_regions)? + young_unaffiliated_regions - consumed_unaffiliated_regions: 0); + regions_for_old_expansion = MIN2(available_unaffiliated_regions, excess_young_reserves / region_size_bytes); + } else { + regions_for_old_expansion = 0; + } + if (regions_for_old_expansion > 0) { + log_info(gc)("Augmenting old-gen evacuation budget from unexpended young-generation reserve by %zu regions", + regions_for_old_expansion); + add_regions_to_old = regions_for_old_expansion; + size_t budget_supplement = region_size_bytes * regions_for_old_expansion; + size_t supplement_without_waste = (size_t) (((double) budget_supplement) / ShenandoahOldEvacWaste); + _old_evacuation_budget += supplement_without_waste; + _unspent_unfragmented_old_budget += supplement_without_waste; + _old_generation->augment_evacuation_reserve(budget_supplement); + young_generation->set_evacuation_reserve(max_young_cset - budget_supplement); + + return add_old_regions_to_cset(); + } else { + add_regions_to_old = 0; + return false; + } + } +} + void ShenandoahOldHeuristics::prepare_for_old_collections() { ShenandoahHeap* heap = ShenandoahHeap::heap(); @@ -325,7 +415,6 @@ void ShenandoahOldHeuristics::prepare_for_old_collections() { size_t immediate_garbage = 0; size_t immediate_regions = 0; size_t live_data = 0; - RegionData* candidates = _region_data; for (size_t i = 0; i < num_regions; i++) { ShenandoahHeapRegion* region = heap->get_region(i); @@ -344,10 +433,10 @@ void ShenandoahOldHeuristics::prepare_for_old_collections() { // else, regions that were promoted in place had 0 old live data at mark start if (region->is_regular() || region->is_regular_pinned()) { - // Only place regular or pinned regions with live data into the candidate set. - // Pinned regions cannot be evacuated, but we are not actually choosing candidates - // for the collection set here. That happens later during the next young GC cycle, - // by which time, the pinned region may no longer be pinned. + // Only place regular or pinned regions with live data into the candidate set. + // Pinned regions cannot be evacuated, but we are not actually choosing candidates + // for the collection set here. That happens later during the next young GC cycle, + // by which time, the pinned region may no longer be pinned. if (!region->has_live()) { assert(!region->is_pinned(), "Pinned region should have live (pinned) objects."); region->make_trash_immediate(); @@ -414,6 +503,8 @@ void ShenandoahOldHeuristics::prepare_for_old_collections() { ShenandoahHeapRegion* r = candidates[i].get_region(); size_t region_garbage = r->garbage(); size_t region_free = r->free(); + + r->capture_mixed_candidate_garbage(); candidates_garbage += region_garbage; unfragmented += region_free; } @@ -456,6 +547,8 @@ void ShenandoahOldHeuristics::prepare_for_old_collections() { r->index(), ShenandoahHeapRegion::region_state_to_string(r->state())); const size_t region_garbage = r->garbage(); const size_t region_free = r->free(); + + r->capture_mixed_candidate_garbage(); candidates_garbage += region_garbage; unfragmented += region_free; defrag_count++; @@ -546,6 +639,7 @@ unsigned int ShenandoahOldHeuristics::get_coalesce_and_fill_candidates(Shenandoa void ShenandoahOldHeuristics::abandon_collection_candidates() { _last_old_collection_candidate = 0; _next_old_collection_candidate = 0; + _live_bytes_in_unprocessed_candidates = 0; _last_old_region = 0; } @@ -790,8 +884,9 @@ bool ShenandoahOldHeuristics::is_experimental() { return true; } -void ShenandoahOldHeuristics::choose_collection_set_from_regiondata(ShenandoahCollectionSet* set, - ShenandoahHeuristics::RegionData* data, - size_t data_size, size_t free) { +size_t ShenandoahOldHeuristics::choose_collection_set_from_regiondata(ShenandoahCollectionSet* set, + ShenandoahHeuristics::RegionData* data, + size_t data_size, size_t free) { ShouldNotReachHere(); + return 0; } diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahOldHeuristics.hpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahOldHeuristics.hpp index f38194c1ee7..97a5b1ebf24 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahOldHeuristics.hpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahOldHeuristics.hpp @@ -102,6 +102,30 @@ private: size_t _fragmentation_first_old_region; size_t _fragmentation_last_old_region; + // State variables involved in construction of a mixed-evacuation collection set. These variables are initialized + // when client code invokes prime_collection_set(). They are consulted, and sometimes modified, when client code + // calls top_off_collection_set() to possibly expand the number of old-gen regions in a mixed evacuation cset, and by + // finalize_mixed_evacs(), which prepares the way for mixed evacuations to begin. + ShenandoahCollectionSet* _mixed_evac_cset; + size_t _evacuated_old_bytes; + size_t _collected_old_bytes; + size_t _included_old_regions; + size_t _old_evacuation_reserve; + size_t _old_evacuation_budget; + + // This represents the amount of memory that can be evacuated from old into initially empty regions during a mixed evacuation. + // This is the total amount of unfragmented free memory in old divided by ShenandoahOldEvacWaste. + size_t _unspent_unfragmented_old_budget; + + // This represents the amount of memory that can be evacuated from old into initially non-empty regions during a mixed + // evacuation. This is the total amount of initially fragmented free memory in old divided by ShenandoahOldEvacWaste. + size_t _unspent_fragmented_old_budget; + + // If there is more available memory in old than is required by the intended mixed evacuation, the amount of excess + // memory is represented by _excess_fragmented_old. To convert this value into a promotion budget, multiply by + // ShenandoahOldEvacWaste and divide by ShenandoahPromoWaste. + size_t _excess_fragmented_old_budget; + // 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 @@ -131,7 +155,15 @@ private: void set_trigger_if_old_is_overgrown(); protected: - void choose_collection_set_from_regiondata(ShenandoahCollectionSet* set, RegionData* data, size_t data_size, size_t free) override; + size_t + choose_collection_set_from_regiondata(ShenandoahCollectionSet* set, RegionData* data, size_t data_size, size_t free) override; + + // This internal helper routine adds as many mixed evacuation candidate regions as fit within the old-gen evacuation budget + // to the collection set. This may be called twice to prepare for any given mixed evacuation cycle, the first time with + // a conservative old evacuation budget, and the second time with a larger more aggressive old evacuation budget. Returns + // true iff we need to finalize mixed evacs. (If no regions are added to the collection set, there is no need to finalize + // mixed evacuations.) + bool add_old_regions_to_cset(); public: explicit ShenandoahOldHeuristics(ShenandoahOldGeneration* generation, ShenandoahGenerationalHeap* gen_heap); @@ -139,8 +171,22 @@ public: // Prepare for evacuation of old-gen regions by capturing the mark results of a recently completed concurrent mark pass. void prepare_for_old_collections(); - // Return true iff the collection set is primed with at least one old-gen region. - bool prime_collection_set(ShenandoahCollectionSet* set); + // Initialize instance variables to support the preparation of a mixed-evacuation collection set. Adds as many + // old candidate regions into the collection set as can fit within the iniital conservative old evacuation budget. + // Returns true iff we need to finalize mixed evacs. + bool prime_collection_set(ShenandoahCollectionSet* collection_set); + + // If young evacuation did not consume all of its available evacuation reserve, add as many additional mixed- + // evacuation candidate regions into the collection set as will fit within this excess repurposed reserved. + // Returns true iff we need to finalize mixed evacs. Upon return, the var parameter regions_to_xfer holds the + // number of regions to transfer from young to old. + bool top_off_collection_set(size_t &add_regions_to_old); + + // Having added all eligible mixed-evacuation candidates to the collection set, this function updates the total count + // of how much old-gen memory remains to be evacuated and adjusts the representation of old-gen regions that remain to + // be evacuated, giving special attention to regions that are currently pinned. It outputs relevant log messages and + // returns true iff the collection set holds at least one unpinned mixed evacuation candidate. + bool finalize_mixed_evacs(); // How many old-collection candidates have not yet been processed? uint unprocessed_old_collection_candidates() const; diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahPassiveHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahPassiveHeuristics.cpp index b5e9cc433ea..d4a38278161 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahPassiveHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahPassiveHeuristics.cpp @@ -50,9 +50,9 @@ bool ShenandoahPassiveHeuristics::should_degenerate_cycle() { return ShenandoahDegeneratedGC; } -void ShenandoahPassiveHeuristics::choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset, - RegionData* data, size_t size, - size_t actual_free) { +size_t ShenandoahPassiveHeuristics::choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset, + RegionData* data, size_t size, + size_t actual_free) { assert(ShenandoahDegeneratedGC, "This path is only taken for Degenerated GC"); // Do not select too large CSet that would overflow the available free space. @@ -76,4 +76,5 @@ void ShenandoahPassiveHeuristics::choose_collection_set_from_regiondata(Shenando cset->add_region(r); } } + return 0; } diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahPassiveHeuristics.hpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahPassiveHeuristics.hpp index be4e91b1800..7a64fad7cc9 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahPassiveHeuristics.hpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahPassiveHeuristics.hpp @@ -46,9 +46,9 @@ public: virtual bool should_degenerate_cycle(); - virtual void choose_collection_set_from_regiondata(ShenandoahCollectionSet* set, - RegionData* data, size_t data_size, - size_t free); + virtual size_t choose_collection_set_from_regiondata(ShenandoahCollectionSet* set, + RegionData* data, size_t data_size, + size_t free); virtual const char* name() { return "Passive"; } virtual bool is_diagnostic() { return true; } diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahStaticHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahStaticHeuristics.cpp index d4d66fef6a1..3843e434781 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahStaticHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahStaticHeuristics.cpp @@ -59,9 +59,9 @@ bool ShenandoahStaticHeuristics::should_start_gc() { return ShenandoahHeuristics::should_start_gc(); } -void ShenandoahStaticHeuristics::choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset, - RegionData* data, size_t size, - size_t free) { +size_t ShenandoahStaticHeuristics::choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset, + RegionData* data, size_t size, + size_t free) { size_t threshold = ShenandoahHeapRegion::region_size_bytes() * ShenandoahGarbageThreshold / 100; for (size_t idx = 0; idx < size; idx++) { @@ -70,4 +70,5 @@ void ShenandoahStaticHeuristics::choose_collection_set_from_regiondata(Shenandoa cset->add_region(r); } } + return 0; } diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahStaticHeuristics.hpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahStaticHeuristics.hpp index 24cb5547921..27dc3c8e0ae 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahStaticHeuristics.hpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahStaticHeuristics.hpp @@ -40,9 +40,9 @@ public: virtual bool should_start_gc(); - virtual void choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset, - RegionData* data, size_t size, - size_t free); + virtual size_t choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset, + RegionData* data, size_t size, + size_t free); virtual const char* name() { return "Static"; } virtual bool is_diagnostic() { return false; } diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahYoungHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahYoungHeuristics.cpp index 15d1058d7cd..01c3873df72 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahYoungHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahYoungHeuristics.cpp @@ -33,11 +33,11 @@ #include "utilities/quickSort.hpp" ShenandoahYoungHeuristics::ShenandoahYoungHeuristics(ShenandoahYoungGeneration* generation) - : ShenandoahGenerationalHeuristics(generation) { + : ShenandoahGenerationalHeuristics(generation) { } -void ShenandoahYoungHeuristics::choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset, +size_t ShenandoahYoungHeuristics::choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset, RegionData* data, size_t size, size_t actual_free) { // See comments in ShenandoahAdaptiveHeuristics::choose_collection_set_from_regiondata(): @@ -48,6 +48,8 @@ void ShenandoahYoungHeuristics::choose_collection_set_from_regiondata(Shenandoah // array before younger regions that typically contain more garbage. This is one reason why, // for example, we continue examining regions even after rejecting a region that has // more live data than we can evacuate. + ShenandoahGenerationalHeap* heap = ShenandoahGenerationalHeap::heap(); + bool need_to_finalize_mixed = heap->old_generation()->heuristics()->prime_collection_set(cset); // Better select garbage-first regions QuickSort::sort(data, (int) size, compare_by_garbage); @@ -55,6 +57,17 @@ void ShenandoahYoungHeuristics::choose_collection_set_from_regiondata(Shenandoah size_t cur_young_garbage = add_preselected_regions_to_collection_set(cset, data, size); choose_young_collection_set(cset, data, size, actual_free, cur_young_garbage); + + // Especially when young-gen trigger is expedited in order to finish mixed evacuations, there may not be + // enough consolidated garbage to make effective use of young-gen evacuation reserve. If there is still + // young-gen reserve available following selection of the young-gen collection set, see if we can use + // this memory to expand the old-gen evacuation collection set. + size_t add_regions_to_old; + need_to_finalize_mixed |= heap->old_generation()->heuristics()->top_off_collection_set(add_regions_to_old); + if (need_to_finalize_mixed) { + heap->old_generation()->heuristics()->finalize_mixed_evacs(); + } + return add_regions_to_old; } void ShenandoahYoungHeuristics::choose_young_collection_set(ShenandoahCollectionSet* cset, diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahYoungHeuristics.hpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahYoungHeuristics.hpp index b9d64059680..85587887663 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahYoungHeuristics.hpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahYoungHeuristics.hpp @@ -38,9 +38,9 @@ public: explicit ShenandoahYoungHeuristics(ShenandoahYoungGeneration* generation); - void choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset, - RegionData* data, size_t size, - size_t actual_free) override; + size_t choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset, + RegionData* data, size_t size, + size_t actual_free) override; bool should_start_gc() override; diff --git a/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.cpp b/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.cpp index e58a7f40796..c1c6b876d90 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.cpp @@ -50,6 +50,8 @@ ShenandoahCollectionSet::ShenandoahCollectionSet(ShenandoahHeap* heap, ReservedS _region_count(0), _old_garbage(0), _preselected_regions(nullptr), + _young_available_bytes_collected(0), + _old_available_bytes_collected(0), _current_index(0) { // The collection set map is reserved to cover the entire heap *and* zero addresses. @@ -104,6 +106,7 @@ void ShenandoahCollectionSet::add_region(ShenandoahHeapRegion* r) { } } else if (r->is_old()) { _old_bytes_to_evacuate += live; + _old_available_bytes_collected += free; _old_garbage += garbage; } @@ -140,6 +143,7 @@ void ShenandoahCollectionSet::clear() { _old_bytes_to_evacuate = 0; _young_available_bytes_collected = 0; + _old_available_bytes_collected = 0; _has_old_regions = false; } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.hpp b/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.hpp index a1b77baa2d3..c99271de1fb 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.hpp @@ -75,6 +75,10 @@ private: // should be subtracted from what's available. size_t _young_available_bytes_collected; + // When a region having memory available to be allocated is added to the collection set, the region's available memory + // should be subtracted from what's available. + size_t _old_available_bytes_collected; + shenandoah_padding(0); volatile size_t _current_index; shenandoah_padding(1); @@ -121,6 +125,9 @@ public: // Returns the amount of free bytes in young regions in the collection set. size_t get_young_available_bytes_collected() const { return _young_available_bytes_collected; } + // Returns the amount of free bytes in old regions in the collection set. + size_t get_old_available_bytes_collected() const { return _old_available_bytes_collected; } + // Returns the amount of garbage in old regions in the collection set. inline size_t get_old_garbage() const; diff --git a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.cpp b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.cpp index cee8727a3f4..364279deafe 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.cpp @@ -204,9 +204,8 @@ bool ShenandoahConcurrentGC::collect(GCCause::Cause cause) { return false; } - entry_concurrent_update_refs_prepare(heap); - // Perform update-refs phase. + entry_concurrent_update_refs_prepare(heap); if (ShenandoahVerify) { vmop_entry_init_update_refs(); } @@ -227,6 +226,7 @@ bool ShenandoahConcurrentGC::collect(GCCause::Cause cause) { // Update references freed up collection set, kick the cleanup to reclaim the space. entry_cleanup_complete(); } else { + _abbreviated = true; if (!entry_final_roots()) { assert(_degen_point != _degenerated_unset, "Need to know where to start degenerated cycle"); return false; @@ -235,7 +235,6 @@ bool ShenandoahConcurrentGC::collect(GCCause::Cause cause) { if (VerifyAfterGC) { vmop_entry_verify_final_roots(); } - _abbreviated = true; } // We defer generation resizing actions until after cset regions have been recycled. We do this even following an @@ -282,7 +281,6 @@ bool ShenandoahConcurrentGC::complete_abbreviated_cycle() { return true; } - void ShenandoahConcurrentGC::vmop_entry_init_mark() { ShenandoahHeap* const heap = ShenandoahHeap::heap(); TraceCollectorStats tcs(heap->monitoring_support()->stw_collection_counters()); @@ -536,6 +534,12 @@ void ShenandoahConcurrentGC::entry_cleanup_early() { // This phase does not use workers, no need for setup heap->try_inject_alloc_failure(); op_cleanup_early(); + if (!heap->is_evacuation_in_progress()) { + // This is an abbreviated cycle. Rebuild the freeset in order to establish reserves for the next GC cycle. Doing + // the rebuild ASAP also expedites availability of immediate trash, reducing the likelihood that we will degenerate + // during promote-in-place processing. + heap->rebuild_free_set(true /*concurrent*/); + } } void ShenandoahConcurrentGC::entry_evacuate() { diff --git a/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp b/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp index a8c97801824..c4fe9103fcb 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp @@ -326,7 +326,7 @@ void ShenandoahRegionPartitions::initialize_old_collector() { } void ShenandoahRegionPartitions::make_all_regions_unavailable() { - shenandoah_assert_heaplocked(); + shenandoah_assert_heaplocked_or_safepoint(); for (size_t partition_id = 0; partition_id < IntNumPartitions; partition_id++) { _membership[partition_id].clear_all(); _leftmosts[partition_id] = _max; @@ -439,6 +439,13 @@ void ShenandoahRegionPartitions::set_capacity_of(ShenandoahFreeSetPartitionId wh _available[int(which_partition)] = value - _used[int(which_partition)]; } +void ShenandoahRegionPartitions::set_used_by(ShenandoahFreeSetPartitionId which_partition, size_t value) { + shenandoah_assert_heaplocked(); + assert (which_partition < NumPartitions, "selected free set must be valid"); + _used[int(which_partition)] = value; + _available[int(which_partition)] = _capacity[int(which_partition)] - value; +} + void ShenandoahRegionPartitions::increase_capacity(ShenandoahFreeSetPartitionId which_partition, size_t bytes) { shenandoah_assert_heaplocked(); @@ -900,7 +907,7 @@ idx_t ShenandoahRegionPartitions::rightmost_empty(ShenandoahFreeSetPartitionId w #ifdef ASSERT -void ShenandoahRegionPartitions::assert_bounds(bool validate_totals) { +void ShenandoahRegionPartitions::assert_bounds() { size_t capacities[UIntNumPartitions]; size_t used[UIntNumPartitions]; @@ -936,7 +943,7 @@ void ShenandoahRegionPartitions::assert_bounds(bool validate_totals) { switch (partition) { case ShenandoahFreeSetPartitionId::NotFree: { - assert(!validate_totals || (capacity != _region_size_bytes), "Should not be retired if empty"); + assert(capacity != _region_size_bytes, "Should not be retired if empty"); ShenandoahHeapRegion* r = ShenandoahHeap::heap()->get_region(i); if (r->is_humongous()) { if (r->is_old()) { @@ -976,12 +983,12 @@ void ShenandoahRegionPartitions::assert_bounds(bool validate_totals) { case ShenandoahFreeSetPartitionId::Collector: case ShenandoahFreeSetPartitionId::OldCollector: { + ShenandoahHeapRegion* r = ShenandoahHeap::heap()->get_region(i); assert(capacity > 0, "free regions must have allocation capacity"); bool is_empty = (capacity == _region_size_bytes); regions[int(partition)]++; used[int(partition)] += _region_size_bytes - capacity; capacities[int(partition)] += _region_size_bytes; - if (i < leftmosts[int(partition)]) { leftmosts[int(partition)] = i; } @@ -1020,20 +1027,20 @@ void ShenandoahRegionPartitions::assert_bounds(bool validate_totals) { idx_t beg_off = leftmosts[int(ShenandoahFreeSetPartitionId::Mutator)]; idx_t end_off = rightmosts[int(ShenandoahFreeSetPartitionId::Mutator)]; assert (beg_off >= leftmost(ShenandoahFreeSetPartitionId::Mutator), - "Mutator free regions before the leftmost: %zd, bound %zd", + "Mutator free region before the leftmost: %zd, bound %zd", beg_off, leftmost(ShenandoahFreeSetPartitionId::Mutator)); assert (end_off <= rightmost(ShenandoahFreeSetPartitionId::Mutator), - "Mutator free regions past the rightmost: %zd, bound %zd", + "Mutator free region past the rightmost: %zd, bound %zd", end_off, rightmost(ShenandoahFreeSetPartitionId::Mutator)); beg_off = empty_leftmosts[int(ShenandoahFreeSetPartitionId::Mutator)]; end_off = empty_rightmosts[int(ShenandoahFreeSetPartitionId::Mutator)]; - assert (beg_off >= leftmost_empty(ShenandoahFreeSetPartitionId::Mutator), - "Mutator free empty regions before the leftmost: %zd, bound %zd", - beg_off, leftmost_empty(ShenandoahFreeSetPartitionId::Mutator)); - assert (end_off <= rightmost_empty(ShenandoahFreeSetPartitionId::Mutator), - "Mutator free empty regions past the rightmost: %zd, bound %zd", - end_off, rightmost_empty(ShenandoahFreeSetPartitionId::Mutator)); + assert (beg_off >= _leftmosts_empty[int(ShenandoahFreeSetPartitionId::Mutator)], + "free empty region (%zd) before the leftmost bound %zd", + beg_off, _leftmosts_empty[int(ShenandoahFreeSetPartitionId::Mutator)]); + assert (end_off <= _rightmosts_empty[int(ShenandoahFreeSetPartitionId::Mutator)], + "free empty region (%zd) past the rightmost bound %zd", + end_off, _rightmosts_empty[int(ShenandoahFreeSetPartitionId::Mutator)]); // Performance invariants. Failing these would not break the free partition, but performance would suffer. assert (leftmost(ShenandoahFreeSetPartitionId::Collector) <= _max, "leftmost in bounds: %zd < %zd", @@ -1053,20 +1060,20 @@ void ShenandoahRegionPartitions::assert_bounds(bool validate_totals) { beg_off = leftmosts[int(ShenandoahFreeSetPartitionId::Collector)]; end_off = rightmosts[int(ShenandoahFreeSetPartitionId::Collector)]; assert (beg_off >= leftmost(ShenandoahFreeSetPartitionId::Collector), - "Collector free regions before the leftmost: %zd, bound %zd", + "Collector free region before the leftmost: %zd, bound %zd", beg_off, leftmost(ShenandoahFreeSetPartitionId::Collector)); assert (end_off <= rightmost(ShenandoahFreeSetPartitionId::Collector), - "Collector free regions past the rightmost: %zd, bound %zd", + "Collector free region past the rightmost: %zd, bound %zd", end_off, rightmost(ShenandoahFreeSetPartitionId::Collector)); beg_off = empty_leftmosts[int(ShenandoahFreeSetPartitionId::Collector)]; end_off = empty_rightmosts[int(ShenandoahFreeSetPartitionId::Collector)]; assert (beg_off >= _leftmosts_empty[int(ShenandoahFreeSetPartitionId::Collector)], - "Collector free empty regions before the leftmost: %zd, bound %zd", - beg_off, leftmost_empty(ShenandoahFreeSetPartitionId::Collector)); + "Collector free empty region before the leftmost: %zd, bound %zd", + beg_off, _leftmosts_empty[int(ShenandoahFreeSetPartitionId::Collector)]); assert (end_off <= _rightmosts_empty[int(ShenandoahFreeSetPartitionId::Collector)], - "Collector free empty regions past the rightmost: %zd, bound %zd", - end_off, rightmost_empty(ShenandoahFreeSetPartitionId::Collector)); + "Collector free empty region past the rightmost: %zd, bound %zd", + end_off, _rightmosts_empty[int(ShenandoahFreeSetPartitionId::Collector)]); // Performance invariants. Failing these would not break the free partition, but performance would suffer. assert (leftmost(ShenandoahFreeSetPartitionId::OldCollector) <= _max, "OldCollector leftmost in bounds: %zd < %zd", @@ -1083,106 +1090,109 @@ void ShenandoahRegionPartitions::assert_bounds(bool validate_totals) { ShenandoahFreeSetPartitionId::OldCollector), "OldCollector rightmost region should be free: %zd", rightmost(ShenandoahFreeSetPartitionId::OldCollector)); + // Concurrent recycling of trash recycles a region (changing its state from is_trash to is_empty without the heap lock), + // If OldCollector partition is empty, leftmosts will both equal max, rightmosts will both equal zero. // Likewise for empty region partitions. beg_off = leftmosts[int(ShenandoahFreeSetPartitionId::OldCollector)]; end_off = rightmosts[int(ShenandoahFreeSetPartitionId::OldCollector)]; - assert (beg_off >= leftmost(ShenandoahFreeSetPartitionId::OldCollector), - "OldCollector free regions before the leftmost: %zd, bound %zd", + assert (beg_off >= leftmost(ShenandoahFreeSetPartitionId::OldCollector), "free regions before the leftmost: %zd, bound %zd", beg_off, leftmost(ShenandoahFreeSetPartitionId::OldCollector)); - assert (end_off <= rightmost(ShenandoahFreeSetPartitionId::OldCollector), - "OldCollector free regions past the rightmost: %zd, bound %zd", + assert (end_off <= rightmost(ShenandoahFreeSetPartitionId::OldCollector), "free regions past the rightmost: %zd, bound %zd", end_off, rightmost(ShenandoahFreeSetPartitionId::OldCollector)); beg_off = empty_leftmosts[int(ShenandoahFreeSetPartitionId::OldCollector)]; end_off = empty_rightmosts[int(ShenandoahFreeSetPartitionId::OldCollector)]; assert (beg_off >= _leftmosts_empty[int(ShenandoahFreeSetPartitionId::OldCollector)], - "OldCollector free empty regions before the leftmost: %zd, bound %zd", - beg_off, leftmost_empty(ShenandoahFreeSetPartitionId::OldCollector)); + "free empty region (%zd) before the leftmost bound %zd, region %s trash", + beg_off, _leftmosts_empty[int(ShenandoahFreeSetPartitionId::OldCollector)], + ((beg_off >= _max)? "out of bounds is not": + (ShenandoahHeap::heap()->get_region(_leftmosts_empty[int(ShenandoahFreeSetPartitionId::OldCollector)])->is_trash()? + "is": "is not"))); assert (end_off <= _rightmosts_empty[int(ShenandoahFreeSetPartitionId::OldCollector)], - "OldCollector free empty regions past the rightmost: %zd, bound %zd", - end_off, rightmost_empty(ShenandoahFreeSetPartitionId::OldCollector)); + "free empty region (%zd) past the rightmost bound %zd, region %s trash", + end_off, _rightmosts_empty[int(ShenandoahFreeSetPartitionId::OldCollector)], + ((end_off < 0)? "out of bounds is not" : + (ShenandoahHeap::heap()->get_region(_rightmosts_empty[int(ShenandoahFreeSetPartitionId::OldCollector)])->is_trash()? + "is": "is not"))); - if (validate_totals) { - // young_retired_regions need to be added to either Mutator or Collector partitions, 100% used. - // Give enough of young_retired_regions, young_retired_capacity, young_retired_user - // to the Mutator partition to top it off so that it matches the running totals. - // - // Give any remnants to the Collector partition. After topping off the Collector partition, its values - // should also match running totals. + // young_retired_regions need to be added to either Mutator or Collector partitions, 100% used. + // Give enough of young_retired_regions, young_retired_capacity, young_retired_user + // to the Mutator partition to top it off so that it matches the running totals. + // + // Give any remnants to the Collector partition. After topping off the Collector partition, its values + // should also match running totals. + assert(young_retired_regions * _region_size_bytes == young_retired_capacity, "sanity"); + assert(young_retired_capacity == young_retired_used, "sanity"); - assert(young_retired_regions * _region_size_bytes == young_retired_capacity, "sanity"); - assert(young_retired_capacity == young_retired_used, "sanity"); + assert(capacities[int(ShenandoahFreeSetPartitionId::OldCollector)] + == _capacity[int(ShenandoahFreeSetPartitionId::OldCollector)], "Old collector capacities must match (%zu != %zu)", + capacities[int(ShenandoahFreeSetPartitionId::OldCollector)], + _capacity[int(ShenandoahFreeSetPartitionId::OldCollector)]); + assert(used[int(ShenandoahFreeSetPartitionId::OldCollector)] + == _used[int(ShenandoahFreeSetPartitionId::OldCollector)], "Old collector used must match"); + assert(regions[int(ShenandoahFreeSetPartitionId::OldCollector)] + == _capacity[int(ShenandoahFreeSetPartitionId::OldCollector)] / _region_size_bytes, "Old collector regions must match"); + assert(_capacity[int(ShenandoahFreeSetPartitionId::OldCollector)] + >= _used[int(ShenandoahFreeSetPartitionId::OldCollector)], "Old Collector capacity must be >= used"); + assert(_available[int(ShenandoahFreeSetPartitionId::OldCollector)] == + (_capacity[int(ShenandoahFreeSetPartitionId::OldCollector)] - _used[int(ShenandoahFreeSetPartitionId::OldCollector)]), + "Old Collector available must equal capacity minus used"); + assert(_humongous_waste[int(ShenandoahFreeSetPartitionId::OldCollector)] == + humongous_waste[int(ShenandoahFreeSetPartitionId::OldCollector)], "Old Collector humongous waste must match"); + assert(_capacity[int(ShenandoahFreeSetPartitionId::Mutator)] >= capacities[int(ShenandoahFreeSetPartitionId::Mutator)], + "Capacity total must be >= counted tally"); + size_t mutator_capacity_shortfall = + _capacity[int(ShenandoahFreeSetPartitionId::Mutator)] - capacities[int(ShenandoahFreeSetPartitionId::Mutator)]; + assert(mutator_capacity_shortfall <= young_retired_capacity, "sanity"); + capacities[int(ShenandoahFreeSetPartitionId::Mutator)] += mutator_capacity_shortfall; + young_retired_capacity -= mutator_capacity_shortfall; + capacities[int(ShenandoahFreeSetPartitionId::Collector)] += young_retired_capacity; - assert(capacities[int(ShenandoahFreeSetPartitionId::OldCollector)] - == _capacity[int(ShenandoahFreeSetPartitionId::OldCollector)], "Old collector capacities must match"); - assert(used[int(ShenandoahFreeSetPartitionId::OldCollector)] - == _used[int(ShenandoahFreeSetPartitionId::OldCollector)], "Old collector used must match"); - assert(regions[int(ShenandoahFreeSetPartitionId::OldCollector)] - == _capacity[int(ShenandoahFreeSetPartitionId::OldCollector)] / _region_size_bytes, "Old collector regions must match"); - assert(_capacity[int(ShenandoahFreeSetPartitionId::OldCollector)] - >= _used[int(ShenandoahFreeSetPartitionId::OldCollector)], "Old Collector capacity must be >= used"); - assert(_available[int(ShenandoahFreeSetPartitionId::OldCollector)] == - (_capacity[int(ShenandoahFreeSetPartitionId::OldCollector)] - _used[int(ShenandoahFreeSetPartitionId::OldCollector)]), - "Old Collector available must equal capacity minus used"); - assert(_humongous_waste[int(ShenandoahFreeSetPartitionId::OldCollector)] == - humongous_waste[int(ShenandoahFreeSetPartitionId::OldCollector)], "Old Collector humongous waste must match"); + assert(_used[int(ShenandoahFreeSetPartitionId::Mutator)] >= used[int(ShenandoahFreeSetPartitionId::Mutator)], + "Used total must be >= counted tally"); + size_t mutator_used_shortfall = + _used[int(ShenandoahFreeSetPartitionId::Mutator)] - used[int(ShenandoahFreeSetPartitionId::Mutator)]; + assert(mutator_used_shortfall <= young_retired_used, "sanity"); + used[int(ShenandoahFreeSetPartitionId::Mutator)] += mutator_used_shortfall; + young_retired_used -= mutator_used_shortfall; + used[int(ShenandoahFreeSetPartitionId::Collector)] += young_retired_used; - assert(_capacity[int(ShenandoahFreeSetPartitionId::Mutator)] >= capacities[int(ShenandoahFreeSetPartitionId::Mutator)], - "Capacity total must be >= counted tally"); - size_t mutator_capacity_shortfall = - _capacity[int(ShenandoahFreeSetPartitionId::Mutator)] - capacities[int(ShenandoahFreeSetPartitionId::Mutator)]; - assert(mutator_capacity_shortfall <= young_retired_capacity, "sanity"); - capacities[int(ShenandoahFreeSetPartitionId::Mutator)] += mutator_capacity_shortfall; - young_retired_capacity -= mutator_capacity_shortfall; - capacities[int(ShenandoahFreeSetPartitionId::Collector)] += young_retired_capacity; + assert(_capacity[int(ShenandoahFreeSetPartitionId::Mutator)] / _region_size_bytes + >= regions[int(ShenandoahFreeSetPartitionId::Mutator)], "Region total must be >= counted tally"); + size_t mutator_regions_shortfall = (_capacity[int(ShenandoahFreeSetPartitionId::Mutator)] / _region_size_bytes + - regions[int(ShenandoahFreeSetPartitionId::Mutator)]); + assert(mutator_regions_shortfall <= young_retired_regions, "sanity"); + regions[int(ShenandoahFreeSetPartitionId::Mutator)] += mutator_regions_shortfall; + young_retired_regions -= mutator_regions_shortfall; + regions[int(ShenandoahFreeSetPartitionId::Collector)] += young_retired_regions; + assert(capacities[int(ShenandoahFreeSetPartitionId::Collector)] == _capacity[int(ShenandoahFreeSetPartitionId::Collector)], + "Collector capacities must match"); + assert(used[int(ShenandoahFreeSetPartitionId::Collector)] == _used[int(ShenandoahFreeSetPartitionId::Collector)], + "Collector used must match"); + assert(regions[int(ShenandoahFreeSetPartitionId::Collector)] + == _capacity[int(ShenandoahFreeSetPartitionId::Collector)] / _region_size_bytes, "Collector regions must match"); + assert(_capacity[int(ShenandoahFreeSetPartitionId::Collector)] >= _used[int(ShenandoahFreeSetPartitionId::Collector)], + "Collector Capacity must be >= used"); + assert(_available[int(ShenandoahFreeSetPartitionId::Collector)] == + (_capacity[int(ShenandoahFreeSetPartitionId::Collector)] - _used[int(ShenandoahFreeSetPartitionId::Collector)]), + "Collector Available must equal capacity minus used"); - assert(_used[int(ShenandoahFreeSetPartitionId::Mutator)] >= used[int(ShenandoahFreeSetPartitionId::Mutator)], - "Used total must be >= counted tally"); - size_t mutator_used_shortfall = - _used[int(ShenandoahFreeSetPartitionId::Mutator)] - used[int(ShenandoahFreeSetPartitionId::Mutator)]; - assert(mutator_used_shortfall <= young_retired_used, "sanity"); - used[int(ShenandoahFreeSetPartitionId::Mutator)] += mutator_used_shortfall; - young_retired_used -= mutator_used_shortfall; - used[int(ShenandoahFreeSetPartitionId::Collector)] += young_retired_used; - - assert(_capacity[int(ShenandoahFreeSetPartitionId::Mutator)] / _region_size_bytes - >= regions[int(ShenandoahFreeSetPartitionId::Mutator)], "Region total must be >= counted tally"); - size_t mutator_regions_shortfall = (_capacity[int(ShenandoahFreeSetPartitionId::Mutator)] / _region_size_bytes - - regions[int(ShenandoahFreeSetPartitionId::Mutator)]); - assert(mutator_regions_shortfall <= young_retired_regions, "sanity"); - regions[int(ShenandoahFreeSetPartitionId::Mutator)] += mutator_regions_shortfall; - young_retired_regions -= mutator_regions_shortfall; - regions[int(ShenandoahFreeSetPartitionId::Collector)] += young_retired_regions; - - assert(capacities[int(ShenandoahFreeSetPartitionId::Collector)] == _capacity[int(ShenandoahFreeSetPartitionId::Collector)], - "Collector capacities must match"); - assert(used[int(ShenandoahFreeSetPartitionId::Collector)] == _used[int(ShenandoahFreeSetPartitionId::Collector)], - "Collector used must match"); - assert(regions[int(ShenandoahFreeSetPartitionId::Collector)] - == _capacity[int(ShenandoahFreeSetPartitionId::Collector)] / _region_size_bytes, "Collector regions must match"); - assert(_capacity[int(ShenandoahFreeSetPartitionId::Collector)] >= _used[int(ShenandoahFreeSetPartitionId::Collector)], - "Collector Capacity must be >= used"); - assert(_available[int(ShenandoahFreeSetPartitionId::Collector)] == - (_capacity[int(ShenandoahFreeSetPartitionId::Collector)] - _used[int(ShenandoahFreeSetPartitionId::Collector)]), - "Collector Available must equal capacity minus used"); - - assert(capacities[int(ShenandoahFreeSetPartitionId::Mutator)] == _capacity[int(ShenandoahFreeSetPartitionId::Mutator)], - "Mutator capacities must match"); - assert(used[int(ShenandoahFreeSetPartitionId::Mutator)] == _used[int(ShenandoahFreeSetPartitionId::Mutator)], - "Mutator used must match"); - assert(regions[int(ShenandoahFreeSetPartitionId::Mutator)] - == _capacity[int(ShenandoahFreeSetPartitionId::Mutator)] / _region_size_bytes, "Mutator regions must match"); - assert(_capacity[int(ShenandoahFreeSetPartitionId::Mutator)] >= _used[int(ShenandoahFreeSetPartitionId::Mutator)], - "Mutator capacity must be >= used"); - assert(_available[int(ShenandoahFreeSetPartitionId::Mutator)] == - (_capacity[int(ShenandoahFreeSetPartitionId::Mutator)] - _used[int(ShenandoahFreeSetPartitionId::Mutator)]), - "Mutator available must equal capacity minus used"); - assert(_humongous_waste[int(ShenandoahFreeSetPartitionId::Mutator)] == young_humongous_waste, - "Mutator humongous waste must match"); - } + assert(capacities[int(ShenandoahFreeSetPartitionId::Mutator)] == _capacity[int(ShenandoahFreeSetPartitionId::Mutator)], + "Mutator capacities must match"); + assert(used[int(ShenandoahFreeSetPartitionId::Mutator)] == _used[int(ShenandoahFreeSetPartitionId::Mutator)], + "Mutator used must match"); + assert(regions[int(ShenandoahFreeSetPartitionId::Mutator)] + == _capacity[int(ShenandoahFreeSetPartitionId::Mutator)] / _region_size_bytes, "Mutator regions must match"); + assert(_capacity[int(ShenandoahFreeSetPartitionId::Mutator)] >= _used[int(ShenandoahFreeSetPartitionId::Mutator)], + "Mutator capacity must be >= used"); + assert(_available[int(ShenandoahFreeSetPartitionId::Mutator)] == + (_capacity[int(ShenandoahFreeSetPartitionId::Mutator)] - _used[int(ShenandoahFreeSetPartitionId::Mutator)]), + "Mutator available must equal capacity minus used"); + assert(_humongous_waste[int(ShenandoahFreeSetPartitionId::Mutator)] == young_humongous_waste, + "Mutator humongous waste must match"); } #endif @@ -1206,6 +1216,36 @@ ShenandoahFreeSet::ShenandoahFreeSet(ShenandoahHeap* heap, size_t max_regions) : clear_internal(); } +void ShenandoahFreeSet::move_unaffiliated_regions_from_collector_to_old_collector(ssize_t count) { + shenandoah_assert_heaplocked(); + size_t region_size_bytes = ShenandoahHeapRegion::region_size_bytes(); + + size_t old_capacity = _partitions.get_capacity(ShenandoahFreeSetPartitionId::OldCollector); + size_t collector_capacity = _partitions.get_capacity(ShenandoahFreeSetPartitionId::Collector); + if (count > 0) { + size_t ucount = count; + size_t bytes_moved = ucount * region_size_bytes; + assert(collector_capacity >= bytes_moved, "Cannot transfer"); + assert(_partitions.get_empty_region_counts(ShenandoahFreeSetPartitionId::Collector) >= ucount, + "Cannot transfer %zu of %zu", ucount, _partitions.get_empty_region_counts(ShenandoahFreeSetPartitionId::Collector)); + _partitions.decrease_empty_region_counts(ShenandoahFreeSetPartitionId::Collector, ucount); + _partitions.set_capacity_of(ShenandoahFreeSetPartitionId::Collector, collector_capacity - bytes_moved); + _partitions.set_capacity_of(ShenandoahFreeSetPartitionId::OldCollector, old_capacity + bytes_moved); + _partitions.increase_empty_region_counts(ShenandoahFreeSetPartitionId::OldCollector, ucount); + } else if (count < 0) { + size_t ucount = -count; + size_t bytes_moved = ucount * region_size_bytes; + assert(old_capacity >= bytes_moved, "Cannot transfer"); + assert(_partitions.get_empty_region_counts(ShenandoahFreeSetPartitionId::OldCollector) >= ucount, + "Cannot transfer %zu of %zu", ucount, _partitions.get_empty_region_counts(ShenandoahFreeSetPartitionId::OldCollector)); + _partitions.decrease_empty_region_counts(ShenandoahFreeSetPartitionId::OldCollector, ucount); + _partitions.set_capacity_of(ShenandoahFreeSetPartitionId::OldCollector, old_capacity - bytes_moved); + _partitions.set_capacity_of(ShenandoahFreeSetPartitionId::Collector, collector_capacity + bytes_moved); + _partitions.increase_empty_region_counts(ShenandoahFreeSetPartitionId::Collector, ucount); + } + // else, do nothing +} + // was pip_pad_bytes void ShenandoahFreeSet::add_promoted_in_place_region_to_old_collector(ShenandoahHeapRegion* region) { shenandoah_assert_heaplocked(); @@ -1261,7 +1301,7 @@ void ShenandoahFreeSet::add_promoted_in_place_region_to_old_collector(Shenandoah /* CollectorSizeChanged */ true, /* OldCollectorSizeChanged */ true, /* AffiliatedChangesAreYoungNeutral */ false, /* AffiliatedChangesAreGlobalNeutral */ true, /* UnaffiliatedChangesAreYoungNeutral */ true>(); - _partitions.assert_bounds(true); + _partitions.assert_bounds(); } template @@ -1496,9 +1536,12 @@ HeapWord* ShenandoahFreeSet::try_allocate_in(ShenandoahHeapRegion* r, Shenandoah return nullptr; } HeapWord* result = nullptr; + // We must call try_recycle_under_lock() even if !r->is_trash(). The reason is that if r is being recycled at this + // moment by a GC worker thread, it may appear to be not trash even though it has not yet been fully recycled. If + // we proceed without waiting for the worker to finish recycling the region, the worker thread may overwrite the + // region's affiliation with FREE after we set the region's affiliation to req.afiliation() below r->try_recycle_under_lock(); in_new_region = r->is_empty(); - if (in_new_region) { log_debug(gc, free)("Using new region (%zu) for %s (" PTR_FORMAT ").", r->index(), req.type_string(), p2i(&req)); @@ -1668,7 +1711,7 @@ HeapWord* ShenandoahFreeSet::try_allocate_in(ShenandoahHeapRegion* r, Shenandoah default: assert(false, "won't happen"); } - _partitions.assert_bounds(true); + _partitions.assert_bounds(); return result; } @@ -1799,6 +1842,7 @@ HeapWord* ShenandoahFreeSet::allocate_contiguous(ShenandoahAllocRequest& req, bo increase_bytes_allocated(waste_bytes); } } + _partitions.increase_used(ShenandoahFreeSetPartitionId::Mutator, total_used); increase_bytes_allocated(total_used); req.set_actual_size(words_size); @@ -1819,14 +1863,16 @@ HeapWord* ShenandoahFreeSet::allocate_contiguous(ShenandoahAllocRequest& req, bo /* CollectorSizeChanged */ false, /* OldCollectorSizeChanged */ false, /* AffiliatedChangesAreYoungNeutral */ false, /* AffiliatedChangesAreGlobalNeutral */ false, /* UnaffiliatedChangesAreYoungNeutral */ false>(); - _partitions.assert_bounds(true); + _partitions.assert_bounds(); return _heap->get_region(beg)->bottom(); } class ShenandoahRecycleTrashedRegionClosure final : public ShenandoahHeapRegionClosure { public: void heap_region_do(ShenandoahHeapRegion* r) { - r->try_recycle(); + if (r->is_trash()) { + r->try_recycle(); + } } bool is_thread_safe() { @@ -1861,7 +1907,7 @@ bool ShenandoahFreeSet::transfer_one_region_from_mutator_to_old_collector(size_t /* CollectorSizeChanged */ false, /* OldCollectorSizeChanged */ true, /* AffiliatedChangesAreYoungNeutral */ true, /* AffiliatedChangesAreGlobalNeutral */ true, /* UnaffiliatedChangesAreYoungNeutral */ false>(); - _partitions.assert_bounds(true); + _partitions.assert_bounds(); return true; } else { return false; @@ -1914,7 +1960,7 @@ bool ShenandoahFreeSet::flip_to_old_gc(ShenandoahHeapRegion* r) { /* CollectorSizeChanged */ false, /* OldCollectorSizeChanged */ true, /* AffiliatedChangesAreYoungNeutral */ true, /* AffiliatedChangesAreGlobalNeutral */ true, /* UnaffiliatedChangesAreYoungNeutral */ false>(); - _partitions.assert_bounds(true); + _partitions.assert_bounds(); // 4. Do not adjust capacities for generations, we just swapped the regions that have already // been accounted for. However, we should adjust the evacuation reserves as those may have changed. shenandoah_assert_heaplocked(); @@ -1945,7 +1991,7 @@ void ShenandoahFreeSet::flip_to_gc(ShenandoahHeapRegion* r) { /* CollectorSizeChanged */ true, /* OldCollectorSizeChanged */ false, /* AffiliatedChangesAreYoungNeutral */ true, /* AffiliatedChangesAreGlobalNeutral */ true, /* UnaffiliatedChangesAreYoungNeutral */ true>(); - _partitions.assert_bounds(true); + _partitions.assert_bounds(); // We do not ensure that the region is no longer trash, relying on try_allocate_in(), which always comes next, // to recycle trash before attempting to allocate anything in the region. } @@ -2025,16 +2071,23 @@ void ShenandoahFreeSet::find_regions_with_alloc_capacity(size_t &young_trashed_r for (size_t idx = 0; idx < num_regions; idx++) { ShenandoahHeapRegion* region = _heap->get_region(idx); if (region->is_trash()) { - // Trashed regions represent immediate garbage identified by final mark and regions that had been in the collection - // partition but have not yet been "cleaned up" following update refs. + // Trashed regions represent regions that had been in the collection set (or may have been identified as immediate garbage) + // but have not yet been "cleaned up". The cset regions are not "trashed" until we have finished update refs. if (region->is_old()) { + // We're going to place this region into the Mutator set. We increment old_trashed_regions because this count represents + // regions that the old generation is entitled to without any transfer from young. We do not place this region into + // the OldCollector partition at this time. Instead, we let reserve_regions() decide whether to place this region + // into the OldCollector partition. Deferring the decision allows reserve_regions() to more effectively pack the + // OldCollector regions into high-address memory. We do not adjust capacities of old and young generations at this + // time. At the end of finish_rebuild(), the capacities are adjusted based on the results of reserve_regions(). old_trashed_regions++; } else { assert(region->is_young(), "Trashed region should be old or young"); young_trashed_regions++; } } else if (region->is_old()) { - // count both humongous and regular regions, but don't count trash (cset) regions. + // We count humongous and regular regions as "old regions". We do not count trashed regions that are old. Those + // are counted (above) as old_trashed_regions. old_region_count++; if (first_old_region > idx) { first_old_region = idx; @@ -2048,7 +2101,7 @@ void ShenandoahFreeSet::find_regions_with_alloc_capacity(size_t &young_trashed_r size_t ac = alloc_capacity(region); if (ac >= PLAB::min_size() * HeapWordSize) { if (region->is_trash() || !region->is_old()) { - // Both young and old collected regions (trashed) are placed into the Mutator set + // Both young and old (possibly immediately) collected regions (trashed) are placed into the Mutator set _partitions.raw_assign_membership(idx, ShenandoahFreeSetPartitionId::Mutator); if (idx < mutator_leftmost) { mutator_leftmost = idx; @@ -2111,10 +2164,19 @@ void ShenandoahFreeSet::find_regions_with_alloc_capacity(size_t &young_trashed_r assert(_partitions.membership(idx) == ShenandoahFreeSetPartitionId::NotFree, "Region should have been retired"); size_t humongous_waste_bytes = 0; if (region->is_humongous_start()) { - oop obj = cast_to_oop(region->bottom()); - size_t byte_size = obj->size() * HeapWordSize; - size_t region_span = ShenandoahHeapRegion::required_regions(byte_size); - humongous_waste_bytes = region_span * ShenandoahHeapRegion::region_size_bytes() - byte_size; + // Since rebuild does not necessarily happen at a safepoint, a newly allocated humongous object may not have been + // fully initialized. Therefore, we cannot safely consult its header. + ShenandoahHeapRegion* last_of_humongous_continuation = region; + size_t next_idx; + for (next_idx = idx + 1; next_idx < num_regions; next_idx++) { + ShenandoahHeapRegion* humongous_cont_candidate = _heap->get_region(next_idx); + if (!humongous_cont_candidate->is_humongous_continuation()) { + break; + } + last_of_humongous_continuation = humongous_cont_candidate; + } + // For humongous regions, used() is established while holding the global heap lock so it is reliable here + humongous_waste_bytes = ShenandoahHeapRegion::region_size_bytes() - last_of_humongous_continuation->used(); } if (region->is_old()) { old_collector_used += region_size_bytes; @@ -2183,7 +2245,7 @@ void ShenandoahFreeSet::find_regions_with_alloc_capacity(size_t &young_trashed_r /* CollectorSizeChanged */ true, /* OldCollectorSizeChanged */ true, /* AffiliatedChangesAreYoungNeutral */ false, /* AffiliatedChangesAreGlobalNeutral */ false, /* UnaffiliatedChangesAreYoungNeutral */ false>(); - _partitions.assert_bounds(true); + _partitions.assert_bounds(); #ifdef ASSERT if (_heap->mode()->is_generational()) { assert(young_affiliated_regions() == _heap->young_generation()->get_affiliated_region_count(), "sanity"); @@ -2221,7 +2283,7 @@ void ShenandoahFreeSet::transfer_humongous_regions_from_mutator_to_old_collector /* CollectorSizeChanged */ false, /* OldCollectorSizeChanged */ true, /* AffiliatedChangesAreYoungNeutral */ false, /* AffiliatedChangesAreGlobalNeutral */ true, /* UnaffiliatedChangesAreYoungNeutral */ true>(); - _partitions.assert_bounds(true); + _partitions.assert_bounds(); // global_used is unaffected by this transfer // No need to adjust ranges because humongous regions are not allocatable @@ -2303,7 +2365,7 @@ void ShenandoahFreeSet::transfer_empty_regions_from_to(ShenandoahFreeSetPartitio /* UnaffiliatedChangesAreYoungNeutral */ true>(); } } - _partitions.assert_bounds(true); + _partitions.assert_bounds(); } // Returns number of regions transferred, adds transferred bytes to var argument bytes_transferred @@ -2370,7 +2432,7 @@ size_t ShenandoahFreeSet::transfer_empty_regions_from_collector_set_to_mutator_s /* AffiliatedChangesAreYoungNeutral */ true, /* AffiliatedChangesAreGlobalNeutral */ true, /* UnaffiliatedChangesAreYoungNeutral */ true>(); } - _partitions.assert_bounds(true); + _partitions.assert_bounds(); return transferred_regions; } @@ -2445,7 +2507,7 @@ transfer_non_empty_regions_from_collector_set_to_mutator_set(ShenandoahFreeSetPa /* AffiliatedChangesAreYoungNeutral */ true, /* AffiliatedChangesAreGlobalNeutral */ true, /* UnaffiliatedChangesAreYoungNeutral */ true>(); } - _partitions.assert_bounds(true); + _partitions.assert_bounds(); return transferred_regions; } @@ -2507,14 +2569,13 @@ void ShenandoahFreeSet::prepare_to_rebuild(size_t &young_trashed_regions, size_t first_old_region, last_old_region, old_region_count); } -void ShenandoahFreeSet::finish_rebuild(size_t young_trashed_regions, size_t old_trashed_regions, size_t old_region_count, - bool have_evacuation_reserves) { + +void ShenandoahFreeSet::finish_rebuild(size_t young_cset_regions, size_t old_cset_regions, size_t old_region_count) { shenandoah_assert_heaplocked(); size_t young_reserve(0), old_reserve(0); if (_heap->mode()->is_generational()) { - compute_young_and_old_reserves(young_trashed_regions, old_trashed_regions, have_evacuation_reserves, - young_reserve, old_reserve); + compute_young_and_old_reserves(young_cset_regions, old_cset_regions, young_reserve, old_reserve); } else { young_reserve = (_heap->max_capacity() / 100) * ShenandoahEvacReserve; old_reserve = 0; @@ -2531,8 +2592,41 @@ void ShenandoahFreeSet::finish_rebuild(size_t young_trashed_regions, size_t old_ // Release the rebuild lock now. What remains in this function is read-only rebuild_lock()->unlock(); - _partitions.assert_bounds(true); + _partitions.assert_bounds(); log_status(); + if (_heap->mode()->is_generational()) { + // Clear the region balance until it is adjusted in preparation for a subsequent GC cycle. + _heap->old_generation()->set_region_balance(0); + } +} + + +// Reduce old reserve (when there are insufficient resources to satisfy the original request). +void ShenandoahFreeSet::reduce_old_reserve(size_t adjusted_old_reserve, size_t requested_old_reserve) { + ShenandoahOldGeneration* const old_generation = _heap->old_generation(); + size_t requested_promoted_reserve = old_generation->get_promoted_reserve(); + size_t requested_old_evac_reserve = old_generation->get_evacuation_reserve(); + assert(adjusted_old_reserve < requested_old_reserve, "Only allow reduction"); + assert(requested_promoted_reserve + requested_old_evac_reserve >= adjusted_old_reserve, "Sanity"); + size_t delta = requested_old_reserve - adjusted_old_reserve; + + if (requested_promoted_reserve >= delta) { + requested_promoted_reserve -= delta; + old_generation->set_promoted_reserve(requested_promoted_reserve); + } else { + delta -= requested_promoted_reserve; + requested_promoted_reserve = 0; + requested_old_evac_reserve -= delta; + old_generation->set_promoted_reserve(requested_promoted_reserve); + old_generation->set_evacuation_reserve(requested_old_evac_reserve); + } +} + +// Reduce young reserve (when there are insufficient resources to satisfy the original request). +void ShenandoahFreeSet::reduce_young_reserve(size_t adjusted_young_reserve, size_t requested_young_reserve) { + ShenandoahYoungGeneration* const young_generation = _heap->young_generation(); + assert(adjusted_young_reserve < requested_young_reserve, "Only allow reduction"); + young_generation->set_evacuation_reserve(adjusted_young_reserve); } /** @@ -2549,7 +2643,6 @@ void ShenandoahFreeSet::finish_rebuild(size_t young_trashed_regions, size_t old_ * this value should computed by ShenandoahGenerationalHeap::compute_old_generation_balance(). */ void ShenandoahFreeSet::compute_young_and_old_reserves(size_t young_trashed_regions, size_t old_trashed_regions, - bool have_evacuation_reserves, size_t& young_reserve_result, size_t& old_reserve_result) const { shenandoah_assert_generational(); shenandoah_assert_heaplocked(); @@ -2566,6 +2659,15 @@ void ShenandoahFreeSet::compute_young_and_old_reserves(size_t young_trashed_regi old_available += old_trashed_regions * region_size_bytes; young_unaffiliated_regions += young_trashed_regions; + assert(young_capacity >= young_generation->used(), + "Young capacity (%zu) must exceed used (%zu)", young_capacity, young_generation->used()); + + size_t young_available = young_capacity - young_generation->used(); + young_available += young_trashed_regions * region_size_bytes; + + assert(young_available >= young_unaffiliated_regions * region_size_bytes, "sanity"); + assert(old_available >= old_unaffiliated_regions * region_size_bytes, "sanity"); + // Consult old-region balance to make adjustments to current generation capacities and availability. // The generation region transfers take place after we rebuild. old_region_balance represents number of regions // to transfer from old to young. @@ -2585,6 +2687,7 @@ void ShenandoahFreeSet::compute_young_and_old_reserves(size_t young_trashed_regi ssize_t xfer_bytes = old_region_balance * checked_cast(region_size_bytes); old_available -= xfer_bytes; old_unaffiliated_regions -= old_region_balance; + young_available += xfer_bytes; young_capacity += xfer_bytes; young_unaffiliated_regions += old_region_balance; } @@ -2593,41 +2696,22 @@ void ShenandoahFreeSet::compute_young_and_old_reserves(size_t young_trashed_regi // promotions and evacuations. The partition between which old memory is reserved for evacuation and // which is reserved for promotion is enforced using thread-local variables that prescribe intentions for // each PLAB's available memory. - if (have_evacuation_reserves) { - // We are rebuilding at the end of final mark, having already established evacuation budgets for this GC pass. - const size_t promoted_reserve = old_generation->get_promoted_reserve(); - const size_t old_evac_reserve = old_generation->get_evacuation_reserve(); - young_reserve_result = young_generation->get_evacuation_reserve(); - old_reserve_result = promoted_reserve + old_evac_reserve; - if (old_reserve_result > old_available) { - // Try to transfer memory from young to old. - size_t old_deficit = old_reserve_result - old_available; - size_t old_region_deficit = (old_deficit + region_size_bytes - 1) / region_size_bytes; - if (young_unaffiliated_regions < old_region_deficit) { - old_region_deficit = young_unaffiliated_regions; - } - young_unaffiliated_regions -= old_region_deficit; - old_unaffiliated_regions += old_region_deficit; - old_region_balance -= old_region_deficit; - old_generation->set_region_balance(old_region_balance); - } - } else { - // We are rebuilding at end of GC, so we set aside budgets specified on command line (or defaults) - young_reserve_result = (young_capacity * ShenandoahEvacReserve) / 100; - // The auto-sizer has already made old-gen large enough to hold all anticipated evacuations and promotions. - // Affiliated old-gen regions are already in the OldCollector free set. Add in the relevant number of - // unaffiliated regions. - old_reserve_result = old_available; - } + const size_t promoted_reserve = old_generation->get_promoted_reserve(); + const size_t old_evac_reserve = old_generation->get_evacuation_reserve(); + young_reserve_result = young_generation->get_evacuation_reserve(); + old_reserve_result = promoted_reserve + old_evac_reserve; + assert(old_reserve_result + young_reserve_result <= old_available + young_available, + "Cannot reserve (%zu + %zu + %zu) more than is available: %zu + %zu", + promoted_reserve, old_evac_reserve, young_reserve_result, old_available, young_available); // Old available regions that have less than PLAB::min_size() of available memory are not placed into the OldCollector // free set. Because of this, old_available may not have enough memory to represent the intended reserve. Adjust // the reserve downward to account for this possibility. This loss is part of the reason why the original budget // was adjusted with ShenandoahOldEvacWaste and ShenandoahOldPromoWaste multipliers. if (old_reserve_result > - _partitions.capacity_of(ShenandoahFreeSetPartitionId::OldCollector) + old_unaffiliated_regions * region_size_bytes) { + _partitions.available_in(ShenandoahFreeSetPartitionId::OldCollector) + old_unaffiliated_regions * region_size_bytes) { old_reserve_result = - _partitions.capacity_of(ShenandoahFreeSetPartitionId::OldCollector) + old_unaffiliated_regions * region_size_bytes; + _partitions.available_in(ShenandoahFreeSetPartitionId::OldCollector) + old_unaffiliated_regions * region_size_bytes; } if (young_reserve_result > young_unaffiliated_regions * region_size_bytes) { @@ -2791,19 +2875,17 @@ void ShenandoahFreeSet::reserve_regions(size_t to_reserve, size_t to_reserve_old ShenandoahFreeSetPartitionId p = _partitions.membership(idx); size_t ac = alloc_capacity(r); assert(ac != region_size_bytes, "Empty regions should be in Mutator partion at entry to reserve_regions"); - if (p == ShenandoahFreeSetPartitionId::Collector) { - if (ac != region_size_bytes) { - young_used_regions++; - young_used_bytes = region_size_bytes - ac; - } - // else, unaffiliated region has no used - } else if (p == ShenandoahFreeSetPartitionId::OldCollector) { - if (ac != region_size_bytes) { - old_used_regions++; - old_used_bytes = region_size_bytes - ac; - } - // else, unaffiliated region has no used - } else if (p == ShenandoahFreeSetPartitionId::NotFree) { + assert(p != ShenandoahFreeSetPartitionId::Collector, "Collector regions must be converted from Mutator regions"); + if (p == ShenandoahFreeSetPartitionId::OldCollector) { + assert(!r->is_empty(), "Empty regions should be in Mutator partition at entry to reserve_regions"); + old_used_regions++; + old_used_bytes = region_size_bytes - ac; + // This region is within the range for OldCollector partition, as established by find_regions_with_alloc_capacity() + assert((_partitions.leftmost(ShenandoahFreeSetPartitionId::OldCollector) <= idx) && + (_partitions.rightmost(ShenandoahFreeSetPartitionId::OldCollector) >= idx), + "find_regions_with_alloc_capacity() should have established this is in range"); + } else { + assert(p == ShenandoahFreeSetPartitionId::NotFree, "sanity"); // This region has been retired if (r->is_old()) { old_used_regions++; @@ -2813,21 +2895,6 @@ void ShenandoahFreeSet::reserve_regions(size_t to_reserve, size_t to_reserve_old young_used_regions++; young_used_bytes += region_size_bytes - ac; } - } else { - assert(p == ShenandoahFreeSetPartitionId::OldCollector, "Not mutator and not NotFree, so must be OldCollector"); - assert(!r->is_empty(), "Empty regions should be in Mutator partition at entry to reserve_regions"); - if (idx < old_collector_low_idx) { - old_collector_low_idx = idx; - } - if (idx > old_collector_high_idx) { - old_collector_high_idx = idx; - } - if (idx < old_collector_empty_low_idx) { - old_collector_empty_low_idx = idx; - } - if (idx > old_collector_empty_high_idx) { - old_collector_empty_high_idx = idx; - } } } } @@ -2856,14 +2923,14 @@ void ShenandoahFreeSet::reserve_regions(size_t to_reserve, size_t to_reserve_old _partitions.increase_used(ShenandoahFreeSetPartitionId::OldCollector, used_to_old_collector); } - _partitions.expand_interval_if_range_modifies_either_boundary(ShenandoahFreeSetPartitionId::Collector, - collector_low_idx, collector_high_idx, - collector_empty_low_idx, collector_empty_high_idx); + _partitions.establish_interval(ShenandoahFreeSetPartitionId::Mutator, + mutator_low_idx, mutator_high_idx, mutator_empty_low_idx, mutator_empty_high_idx); + _partitions.establish_interval(ShenandoahFreeSetPartitionId::Collector, + collector_low_idx, collector_high_idx, collector_empty_low_idx, collector_empty_high_idx); + _partitions.expand_interval_if_range_modifies_either_boundary(ShenandoahFreeSetPartitionId::OldCollector, old_collector_low_idx, old_collector_high_idx, old_collector_empty_low_idx, old_collector_empty_high_idx); - _partitions.establish_interval(ShenandoahFreeSetPartitionId::Mutator, - mutator_low_idx, mutator_high_idx, mutator_empty_low_idx, mutator_empty_high_idx); recompute_total_used(); @@ -2872,17 +2939,22 @@ void ShenandoahFreeSet::reserve_regions(size_t to_reserve, size_t to_reserve_old /* CollectorSizeChanged */ true, /* OldCollectorSizeChanged */ true, /* AffiliatedChangesAreYoungNeutral */ false, /* AffiliatedChangesAreGlobalNeutral */ false, /* UnaffiliatedChangesAreYoungNeutral */ false>(); - _partitions.assert_bounds(true); + _partitions.assert_bounds(); if (LogTarget(Info, gc, free)::is_enabled()) { size_t old_reserve = _partitions.available_in(ShenandoahFreeSetPartitionId::OldCollector); if (old_reserve < to_reserve_old) { log_info(gc, free)("Wanted " PROPERFMT " for old reserve, but only reserved: " PROPERFMT, PROPERFMTARGS(to_reserve_old), PROPERFMTARGS(old_reserve)); + assert(_heap->mode()->is_generational(), "to_old_reserve > 0 implies generational mode"); + reduce_old_reserve(old_reserve, to_reserve_old); } size_t reserve = _partitions.available_in(ShenandoahFreeSetPartitionId::Collector); if (reserve < to_reserve) { + if (_heap->mode()->is_generational()) { + reduce_young_reserve(reserve, to_reserve); + } log_info(gc, free)("Wanted " PROPERFMT " for young reserve, but only reserved: " PROPERFMT, - PROPERFMTARGS(to_reserve), PROPERFMTARGS(reserve)); + PROPERFMTARGS(to_reserve), PROPERFMTARGS(reserve)); } } } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.hpp b/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.hpp index 364637740f2..4e0aea80a9b 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.hpp @@ -224,6 +224,10 @@ public: void transfer_used_capacity_from_to(ShenandoahFreeSetPartitionId from_partition, ShenandoahFreeSetPartitionId to_partition, size_t regions); + // For recycled region r in the OldCollector partition but possibly not within the interval for empty OldCollector regions, + // expand the empty interval to include this region. + inline void adjust_interval_for_recycled_old_region_under_lock(ShenandoahHeapRegion* r); + const char* partition_membership_name(idx_t idx) const; // Return the index of the next available region >= start_index, or maximum_regions if not found. @@ -373,12 +377,7 @@ public: inline void set_capacity_of(ShenandoahFreeSetPartitionId which_partition, size_t value); - inline void set_used_by(ShenandoahFreeSetPartitionId which_partition, size_t value) { - shenandoah_assert_heaplocked(); - assert (which_partition < NumPartitions, "selected free set must be valid"); - _used[int(which_partition)] = value; - _available[int(which_partition)] = _capacity[int(which_partition)] - value; - } + inline void set_used_by(ShenandoahFreeSetPartitionId which_partition, size_t value); inline size_t count(ShenandoahFreeSetPartitionId which_partition) const { return _region_counts[int(which_partition)]; } @@ -402,7 +401,7 @@ public: // idx >= leftmost && // idx <= rightmost // } - void assert_bounds(bool validate_totals) NOT_DEBUG_RETURN; + void assert_bounds() NOT_DEBUG_RETURN; }; // Publicly, ShenandoahFreeSet represents memory that is available to mutator threads. The public capacity(), used(), @@ -634,7 +633,11 @@ private: void establish_old_collector_alloc_bias(); size_t get_usable_free_words(size_t free_bytes) const; + void reduce_young_reserve(size_t adjusted_young_reserve, size_t requested_young_reserve); + void reduce_old_reserve(size_t adjusted_old_reserve, size_t requested_old_reserve); + void log_freeset_stats(ShenandoahFreeSetPartitionId partition_id, LogStream& ls); + // log status, assuming lock has already been acquired by the caller. void log_status(); @@ -685,35 +688,46 @@ public: return _total_global_used; } - size_t global_unaffiliated_regions() { + // A negative argument results in moving from old_collector to collector + void move_unaffiliated_regions_from_collector_to_old_collector(ssize_t regions); + + inline size_t global_unaffiliated_regions() { return _global_unaffiliated_regions; } - size_t young_unaffiliated_regions() { + inline size_t young_unaffiliated_regions() { return _young_unaffiliated_regions; } - size_t old_unaffiliated_regions() { + inline size_t collector_unaffiliated_regions() { + return _partitions.get_empty_region_counts(ShenandoahFreeSetPartitionId::Collector); + } + + inline size_t old_collector_unaffiliated_regions() { return _partitions.get_empty_region_counts(ShenandoahFreeSetPartitionId::OldCollector); } - size_t young_affiliated_regions() { + inline size_t old_unaffiliated_regions() { + return _partitions.get_empty_region_counts(ShenandoahFreeSetPartitionId::OldCollector); + } + + inline size_t young_affiliated_regions() { return _young_affiliated_regions; } - size_t old_affiliated_regions() { + inline size_t old_affiliated_regions() { return _old_affiliated_regions; } - size_t global_affiliated_regions() { + inline size_t global_affiliated_regions() { return _global_affiliated_regions; } - size_t total_young_regions() { + inline size_t total_young_regions() { return _total_young_regions; } - size_t total_old_regions() { + inline size_t total_old_regions() { return _partitions.get_capacity(ShenandoahFreeSetPartitionId::OldCollector) / ShenandoahHeapRegion::region_size_bytes(); } @@ -725,36 +739,27 @@ public: // Examine the existing free set representation, capturing the current state into var arguments: // - // young_cset_regions is the number of regions currently in the young cset if we are starting to evacuate, or zero - // old_cset_regions is the number of regions currently in the old cset if we are starting a mixed evacuation, or zero + // young_trashed_regions is the number of trashed regions (immediate garbage at final mark, cset regions after update refs) + // old_trashed_regions is the number of trashed regions + // (immediate garbage at final old mark, cset regions after update refs for mixed evac) // first_old_region is the index of the first region that is part of the OldCollector set // last_old_region is the index of the last region that is part of the OldCollector set // old_region_count is the number of regions in the OldCollector set that have memory available to be allocated - void prepare_to_rebuild(size_t &young_cset_regions, size_t &old_cset_regions, + void prepare_to_rebuild(size_t &young_trashed_regions, size_t &old_trashed_regions, size_t &first_old_region, size_t &last_old_region, size_t &old_region_count); // At the end of final mark, but before we begin evacuating, heuristics calculate how much memory is required to - // hold the results of evacuating to young-gen and to old-gen, and have_evacuation_reserves should be true. - // These quantities, stored as reserves for their respective generations, are consulted prior to rebuilding - // the free set (ShenandoahFreeSet) in preparation for evacuation. When the free set is rebuilt, we make sure - // to reserve sufficient memory in the collector and old_collector sets to hold evacuations. + // hold the results of evacuating to young-gen and to old-gen. These quantities, stored in reserves for their + // respective generations, are consulted prior to rebuilding the free set (ShenandoahFreeSet) in preparation for + // evacuation. When the free set is rebuilt, we make sure to reserve sufficient memory in the collector and + // old_collector sets to hold evacuations. Likewise, at the end of update refs, we rebuild the free set in order + // to set aside reserves to be consumed during the next GC cycle. // - // We also rebuild the free set at the end of GC, as we prepare to idle GC until the next trigger. In this case, - // have_evacuation_reserves is false because we don't yet know how much memory will need to be evacuated in the - // next GC cycle. When have_evacuation_reserves is false, the free set rebuild operation reserves for the collector - // and old_collector sets based on alternative mechanisms, such as ShenandoahEvacReserve, ShenandoahOldEvacReserve, and - // ShenandoahOldCompactionReserve. In a future planned enhancement, the reserve for old_collector set when the - // evacuation reserves are unknown, is based in part on anticipated promotion as determined by analysis of live data - // found during the previous GC pass which is one less than the current tenure age. - // - // young_cset_regions is the number of regions currently in the young cset if we are starting to evacuate, or zero - // old_cset_regions is the number of regions currently in the old cset if we are starting a mixed evacuation, or zero + // young_trashed_regions is the number of trashed regions (immediate garbage at final mark, cset regions after update refs) + // old_trashed_regions is the number of trashed regions + // (immediate garbage at final old mark, cset regions after update refs for mixed evac) // num_old_regions is the number of old-gen regions that have available memory for further allocations (excluding old cset) - // have_evacuation_reserves is true iff the desired values of young-gen and old-gen evacuation reserves and old-gen - // promotion reserve have been precomputed (and can be obtained by invoking - // ->get_evacuation_reserve() or old_gen->get_promoted_reserve() - void finish_rebuild(size_t young_cset_regions, size_t old_cset_regions, size_t num_old_regions, - bool have_evacuation_reserves = false); + void finish_rebuild(size_t young_trashed_regions, size_t old_trashed_regions, size_t num_old_regions); // When a region is promoted in place, we add the region's available memory if it is greater than plab_min_size() // into the old collector partition by invoking this method. @@ -806,9 +811,18 @@ public: return _partitions.available_in_locked_for_rebuild(ShenandoahFreeSetPartitionId::Mutator); } + // Use this version of available() if the heap lock is held. + inline size_t available_locked() const { + return _partitions.available_in(ShenandoahFreeSetPartitionId::Mutator); + } + inline size_t total_humongous_waste() const { return _total_humongous_waste; } - inline size_t humongous_waste_in_mutator() const { return _partitions.humongous_waste(ShenandoahFreeSetPartitionId::Mutator); } - inline size_t humongous_waste_in_old() const { return _partitions.humongous_waste(ShenandoahFreeSetPartitionId::OldCollector); } + inline size_t humongous_waste_in_mutator() const { + return _partitions.humongous_waste(ShenandoahFreeSetPartitionId::Mutator); + } + inline size_t humongous_waste_in_old() const { + return _partitions.humongous_waste(ShenandoahFreeSetPartitionId::OldCollector); + } void decrease_humongous_waste_for_regular_bypass(ShenandoahHeapRegion* r, size_t waste); @@ -874,7 +888,7 @@ public: // Reserve space for evacuations, with regions reserved for old evacuations placed to the right // of regions reserved of young evacuations. - void compute_young_and_old_reserves(size_t young_cset_regions, size_t old_cset_regions, bool have_evacuation_reserves, + void compute_young_and_old_reserves(size_t young_cset_regions, size_t old_cset_regions, size_t &young_reserve_result, size_t &old_reserve_result) const; }; diff --git a/src/hotspot/share/gc/shenandoah/shenandoahFullGC.cpp b/src/hotspot/share/gc/shenandoah/shenandoahFullGC.cpp index fa3a7a42209..3c92750cc0c 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahFullGC.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahFullGC.cpp @@ -522,6 +522,7 @@ public: void heap_region_do(ShenandoahHeapRegion* r) override { if (r->is_trash()) { r->try_recycle_under_lock(); + // No need to adjust_interval_for_recycled_old_region. That will be taken care of during freeset rebuild. } if (r->is_cset()) { // Leave affiliation unchanged @@ -966,6 +967,7 @@ public: if (r->is_trash()) { live = 0; r->try_recycle_under_lock(); + // No need to adjust_interval_for_recycled_old_region. That will be taken care of during freeset rebuild. } else { if (r->is_old()) { ShenandoahGenerationalFullGC::account_for_region(r, _old_regions, _old_usage, _old_humongous_waste); @@ -1113,16 +1115,16 @@ void ShenandoahFullGC::phase5_epilog() { ShenandoahPostCompactClosure post_compact; heap->heap_region_iterate(&post_compact); heap->collection_set()->clear(); - size_t young_cset_regions, old_cset_regions, first_old, last_old, num_old; - ShenandoahFreeSet* free_set = heap->free_set(); { - free_set->prepare_to_rebuild(young_cset_regions, old_cset_regions, first_old, last_old, num_old); + ShenandoahFreeSet* free_set = heap->free_set(); + size_t young_trashed_regions, old_trashed_regions, first_old, last_old, num_old; + free_set->prepare_to_rebuild(young_trashed_regions, old_trashed_regions, first_old, last_old, num_old); // We also do not expand old generation size following Full GC because we have scrambled age populations and // no longer have objects separated by age into distinct regions. if (heap->mode()->is_generational()) { ShenandoahGenerationalFullGC::compute_balances(); } - free_set->finish_rebuild(young_cset_regions, old_cset_regions, num_old); + free_set->finish_rebuild(young_trashed_regions, old_trashed_regions, num_old); } // Set mark incomplete because the marking bitmaps have been reset except pinned regions. _generation->set_mark_incomplete(); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahGeneration.cpp b/src/hotspot/share/gc/shenandoah/shenandoahGeneration.cpp index a5d8cca458d..cdc7e1a328a 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahGeneration.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahGeneration.cpp @@ -250,6 +250,7 @@ void ShenandoahGeneration::compute_evacuation_budgets(ShenandoahHeap* const heap ShenandoahOldGeneration* const old_generation = heap->old_generation(); ShenandoahYoungGeneration* const young_generation = heap->young_generation(); + const size_t region_size_bytes = ShenandoahHeapRegion::region_size_bytes(); // During initialization and phase changes, it is more likely that fewer objects die young and old-gen // memory is not yet full (or is in the process of being replaced). During these times especially, it @@ -263,15 +264,15 @@ void ShenandoahGeneration::compute_evacuation_budgets(ShenandoahHeap* const heap // First priority is to reclaim the easy garbage out of young-gen. - // maximum_young_evacuation_reserve is upper bound on memory to be evacuated out of young - const size_t maximum_young_evacuation_reserve = (young_generation->max_capacity() * ShenandoahEvacReserve) / 100; - size_t young_evacuation_reserve = MIN2(maximum_young_evacuation_reserve, young_generation->available_with_reserve()); + // maximum_young_evacuation_reserve is upper bound on memory to be evacuated into young Collector Reserve. This is + // bounded at the end of previous GC cycle, based on available memory and balancing of evacuation to old and young. + size_t maximum_young_evacuation_reserve = young_generation->get_evacuation_reserve(); // maximum_old_evacuation_reserve is an upper bound on memory evacuated from old and evacuated to old (promoted), // clamped by the old generation space available. // // Here's the algebra. - // Let SOEP = ShenandoahOldEvacRatioPercent, + // Let SOEP = ShenandoahOldEvacPercent, // OE = old evac, // YE = young evac, and // TE = total evac = OE + YE @@ -283,12 +284,14 @@ void ShenandoahGeneration::compute_evacuation_budgets(ShenandoahHeap* const heap // => OE = YE*SOEP/(100-SOEP) // We have to be careful in the event that SOEP is set to 100 by the user. - assert(ShenandoahOldEvacRatioPercent <= 100, "Error"); + assert(ShenandoahOldEvacPercent <= 100, "Error"); const size_t old_available = old_generation->available(); - const size_t maximum_old_evacuation_reserve = (ShenandoahOldEvacRatioPercent == 100) ? - old_available : MIN2((maximum_young_evacuation_reserve * ShenandoahOldEvacRatioPercent) / (100 - ShenandoahOldEvacRatioPercent), + const size_t maximum_old_evacuation_reserve = (ShenandoahOldEvacPercent == 100) ? + old_available : MIN2((maximum_young_evacuation_reserve * ShenandoahOldEvacPercent) / (100 - ShenandoahOldEvacPercent), old_available); + // In some cases, maximum_old_reserve < old_available (when limited by ShenandoahOldEvacPercent) + // This limit affects mixed evacuations, but does not affect promotions. // Second priority is to reclaim garbage out of old-gen if there are old-gen collection candidates. Third priority // is to promote as much as we have room to promote. However, if old-gen memory is in short supply, this means young @@ -305,10 +308,8 @@ void ShenandoahGeneration::compute_evacuation_budgets(ShenandoahHeap* const heap // evacuation and update-refs, we give emphasis to reclaiming garbage first, wherever that garbage is found. // Global GC will adjust generation sizes to accommodate the collection set it chooses. - // Set old_promo_reserve to enforce that no regions are preselected for promotion. Such regions typically - // have relatively high memory utilization. We still call select_aged_regions() because this will prepare for - // promotions in place, if relevant. - old_promo_reserve = 0; + // Use remnant of old_available to hold promotions. + old_promo_reserve = old_available - maximum_old_evacuation_reserve; // Dedicate all available old memory to old_evacuation reserve. This may be small, because old-gen is only // expanded based on an existing mixed evacuation workload at the end of the previous GC cycle. We'll expand @@ -319,43 +320,48 @@ void ShenandoahGeneration::compute_evacuation_budgets(ShenandoahHeap* const heap // mixed evacuation, reserve all of this memory for compaction of old-gen and do not promote. Prioritize compaction // over promotion in order to defragment OLD so that it will be better prepared to efficiently receive promoted memory. old_evacuation_reserve = maximum_old_evacuation_reserve; - old_promo_reserve = 0; + old_promo_reserve = old_available - maximum_old_evacuation_reserve; } else { // Make all old-evacuation memory for promotion, but if we can't use it all for promotion, we'll allow some evacuation. - old_evacuation_reserve = 0; + old_evacuation_reserve = old_available - maximum_old_evacuation_reserve; old_promo_reserve = maximum_old_evacuation_reserve; } assert(old_evacuation_reserve <= old_available, "Error"); + // We see too many old-evacuation failures if we force ourselves to evacuate into regions that are not initially empty. // So we limit the old-evacuation reserve to unfragmented memory. Even so, old-evacuation is free to fill in nooks and // crannies within existing partially used regions and it generally tries to do so. - const size_t old_free_unfragmented = old_generation->free_unaffiliated_regions() * ShenandoahHeapRegion::region_size_bytes(); + const size_t old_free_unfragmented = old_generation->free_unaffiliated_regions() * region_size_bytes; if (old_evacuation_reserve > old_free_unfragmented) { const size_t delta = old_evacuation_reserve - old_free_unfragmented; old_evacuation_reserve -= delta; - // Let promo consume fragments of old-gen memory if not global - if (!is_global()) { - old_promo_reserve += delta; - } + // Let promo consume fragments of old-gen memory + old_promo_reserve += delta; } - // Preselect regions for promotion by evacuation (obtaining the live data to seed promoted_reserve), - // and identify regions that will promote in place. These use the tenuring threshold. - const size_t consumed_by_advance_promotion = select_aged_regions(old_promo_reserve); - assert(consumed_by_advance_promotion <= maximum_old_evacuation_reserve, "Cannot promote more than available old-gen memory"); + // If is_global(), we let garbage-first heuristic determine cset membership. Otherwise, we give priority + // to tenurable regions by preselecting regions for promotion by evacuation (obtaining the live data to seed promoted_reserve). + // This also identifies regions that will be promoted in place. These use the tenuring threshold. + const size_t consumed_by_advance_promotion = select_aged_regions(is_global()? 0: old_promo_reserve); + assert(consumed_by_advance_promotion <= old_promo_reserve, "Do not promote more than budgeted"); + + // The young evacuation reserve can be no larger than young_unaffiliated. Planning to evacuate into partially consumed + // young regions is doomed to failure if any of those partially consumed regions is selected for the collection set. + size_t young_unaffiliated = young_generation->free_unaffiliated_regions() * region_size_bytes; // If any regions have been selected for promotion in place, this has the effect of decreasing available within mutator // and collector partitions, due to padding of remnant memory within each promoted in place region. This will affect // young_evacuation_reserve but not old_evacuation_reserve or consumed_by_advance_promotion. So recompute. - young_evacuation_reserve = MIN2(young_evacuation_reserve, young_generation->available_with_reserve()); + size_t young_evacuation_reserve = MIN2(maximum_young_evacuation_reserve, young_unaffiliated); // Note that unused old_promo_reserve might not be entirely consumed_by_advance_promotion. Do not transfer this // to old_evacuation_reserve because this memory is likely very fragmented, and we do not want to increase the likelihood - // of old evacuation failure. + // of old evacuation failure. Leave this memory in the promoted reserve as it may be targeted by opportunistic + // promotions (found during evacuation of young regions). young_generation->set_evacuation_reserve(young_evacuation_reserve); old_generation->set_evacuation_reserve(old_evacuation_reserve); - old_generation->set_promoted_reserve(consumed_by_advance_promotion); + old_generation->set_promoted_reserve(old_promo_reserve); // There is no need to expand OLD because all memory used here was set aside at end of previous GC, except in the // case of a GLOBAL gc. During choose_collection_set() of GLOBAL, old will be expanded on demand. @@ -363,8 +369,8 @@ void ShenandoahGeneration::compute_evacuation_budgets(ShenandoahHeap* const heap // Having chosen the collection set, adjust the budgets for generational mode based on its composition. Note // that young_generation->available() now knows about recently discovered immediate garbage. -// -void ShenandoahGeneration::adjust_evacuation_budgets(ShenandoahHeap* const heap, ShenandoahCollectionSet* const collection_set) { +void ShenandoahGeneration::adjust_evacuation_budgets(ShenandoahHeap* const heap, + ShenandoahCollectionSet* const collection_set, size_t add_regions_to_old) { shenandoah_assert_generational(); // We may find that old_evacuation_reserve and/or loaned_for_young_evacuation are not fully consumed, in which case we may // be able to increase regions_available_to_loan @@ -398,7 +404,8 @@ void ShenandoahGeneration::adjust_evacuation_budgets(ShenandoahHeap* const heap, // Leave old_evac_reserve as previously configured } else if (old_evacuated_committed < old_evacuation_reserve) { // This happens if the old-gen collection consumes less than full budget. - log_debug(gc, cset)("Shrinking old evac reserve to match old_evac_commited: " PROPERFMT, PROPERFMTARGS(old_evacuated_committed)); + log_debug(gc, cset)("Shrinking old evac reserve to match old_evac_commited: " PROPERFMT, + PROPERFMTARGS(old_evacuated_committed)); old_evacuation_reserve = old_evacuated_committed; old_generation->set_evacuation_reserve(old_evacuation_reserve); } @@ -409,11 +416,17 @@ void ShenandoahGeneration::adjust_evacuation_budgets(ShenandoahHeap* const heap, size_t young_evacuated = collection_set->get_live_bytes_in_untenurable_regions(); size_t young_evacuated_reserve_used = (size_t) (ShenandoahEvacWaste * double(young_evacuated)); - size_t total_young_available = young_generation->available_with_reserve(); - assert(young_evacuated_reserve_used <= total_young_available, "Cannot evacuate more than is available in young"); + size_t total_young_available = young_generation->available_with_reserve() - add_regions_to_old * region_size_bytes;; + assert(young_evacuated_reserve_used <= total_young_available, "Cannot evacuate (%zu) more than is available in young (%zu)", + young_evacuated_reserve_used, total_young_available); young_generation->set_evacuation_reserve(young_evacuated_reserve_used); - size_t old_available = old_generation->available(); + // We have not yet rebuilt the free set. Some of the memory that is thought to be avaiable within old may no + // longer be available if that memory had been free within regions that were selected for the collection set. + // Make the necessary adjustments to old_available. + size_t old_available = + old_generation->available() + add_regions_to_old * region_size_bytes - collection_set->get_old_available_bytes_collected(); + // Now that we've established the collection set, we know how much memory is really required by old-gen for evacuation // and promotion reserves. Try shrinking OLD now in case that gives us a bit more runway for mutator allocations during // evac and update phases. @@ -422,21 +435,27 @@ void ShenandoahGeneration::adjust_evacuation_budgets(ShenandoahHeap* const heap, if (old_available < old_consumed) { // This can happen due to round-off errors when adding the results of truncated integer arithmetic. // We've already truncated old_evacuated_committed. Truncate young_advance_promoted_reserve_used here. + assert(young_advance_promoted_reserve_used <= (33 * (old_available - old_evacuated_committed)) / 32, "Round-off errors should be less than 3.125%%, committed: %zu, reserved: %zu", young_advance_promoted_reserve_used, old_available - old_evacuated_committed); - young_advance_promoted_reserve_used = old_available - old_evacuated_committed; + if (old_available > old_evacuated_committed) { + young_advance_promoted_reserve_used = old_available - old_evacuated_committed; + } else { + young_advance_promoted_reserve_used = 0; + old_evacuated_committed = old_available; + } + // TODO: reserve for full promotion reserve, not just for advance (preselected) promotion old_consumed = old_evacuated_committed + young_advance_promoted_reserve_used; } assert(old_available >= old_consumed, "Cannot consume (%zu) more than is available (%zu)", old_consumed, old_available); size_t excess_old = old_available - old_consumed; - size_t unaffiliated_old_regions = old_generation->free_unaffiliated_regions(); + size_t unaffiliated_old_regions = old_generation->free_unaffiliated_regions() + add_regions_to_old; size_t unaffiliated_old = unaffiliated_old_regions * region_size_bytes; - assert(old_available >= unaffiliated_old, - "Unaffiliated old (%zu is %zu * %zu) is a subset of old available (%zu)", - unaffiliated_old, unaffiliated_old_regions, region_size_bytes, old_available); + assert(unaffiliated_old >= old_evacuated_committed, "Do not evacuate (%zu) more than unaffiliated old (%zu)", + old_evacuated_committed, unaffiliated_old); // Make sure old_evac_committed is unaffiliated if (old_evacuated_committed > 0) { @@ -454,20 +473,22 @@ void ShenandoahGeneration::adjust_evacuation_budgets(ShenandoahHeap* const heap, } // If we find that OLD has excess regions, give them back to YOUNG now to reduce likelihood we run out of allocation - // runway during evacuation and update-refs. - size_t regions_to_xfer = 0; + // runway during evacuation and update-refs. We may make further adjustments to balance. + ssize_t add_regions_to_young = 0; if (excess_old > unaffiliated_old) { // we can give back unaffiliated_old (all of unaffiliated is excess) if (unaffiliated_old_regions > 0) { - regions_to_xfer = unaffiliated_old_regions; + add_regions_to_young = unaffiliated_old_regions; } } else if (unaffiliated_old_regions > 0) { // excess_old < unaffiliated old: we can give back MIN(excess_old/region_size_bytes, unaffiliated_old_regions) size_t excess_regions = excess_old / region_size_bytes; - regions_to_xfer = MIN2(excess_regions, unaffiliated_old_regions); + add_regions_to_young = MIN2(excess_regions, unaffiliated_old_regions); } - if (regions_to_xfer > 0) { - excess_old -= regions_to_xfer * region_size_bytes; + + if (add_regions_to_young > 0) { + assert(excess_old >= add_regions_to_young * region_size_bytes, "Cannot xfer more than excess old"); + excess_old -= add_regions_to_young * region_size_bytes; log_debug(gc, ergo)("Before start of evacuation, total_promotion reserve is young_advance_promoted_reserve: %zu " "plus excess: old: %zu", young_advance_promoted_reserve_used, excess_old); } @@ -475,6 +496,7 @@ void ShenandoahGeneration::adjust_evacuation_budgets(ShenandoahHeap* const heap, // Add in the excess_old memory to hold unanticipated promotions, if any. If there are more unanticipated // promotions than fit in reserved memory, they will be deferred until a future GC pass. size_t total_promotion_reserve = young_advance_promoted_reserve_used + excess_old; + old_generation->set_promoted_reserve(total_promotion_reserve); old_generation->reset_promoted_expended(); } @@ -782,17 +804,13 @@ void ShenandoahGeneration::prepare_regions_and_collection_set(bool concurrent) { ShenandoahCollectionSetPreselector preselector(collection_set, heap->num_regions()); // Find the amount that will be promoted, regions that will be promoted in - // place, and preselect older regions that will be promoted by evacuation. + // place, and preselected older regions that will be promoted by evacuation. compute_evacuation_budgets(heap); - // Choose the collection set, including the regions preselected above for - // promotion into the old generation. - _heuristics->choose_collection_set(collection_set); - if (!collection_set->is_empty()) { - // only make use of evacuation budgets when we are evacuating - adjust_evacuation_budgets(heap, collection_set); - } - + // Choose the collection set, including the regions preselected above for promotion into the old generation. + size_t add_regions_to_old = _heuristics->choose_collection_set(collection_set); + // Even if collection_set->is_empty(), we want to adjust budgets, making reserves available to mutator. + adjust_evacuation_budgets(heap, collection_set, add_regions_to_old); if (is_global()) { // We have just chosen a collection set for a global cycle. The mark bitmap covering old regions is complete, so // the remembered set scan can use that to avoid walking into garbage. When the next old mark begins, we will @@ -816,17 +834,16 @@ void ShenandoahGeneration::prepare_regions_and_collection_set(bool concurrent) { ShenandoahPhaseTimings::degen_gc_final_rebuild_freeset); ShenandoahHeapLocker locker(heap->lock()); - // We are preparing for evacuation. At this time, we ignore cset region tallies. - size_t young_cset_regions, old_cset_regions, first_old, last_old, num_old; - _free_set->prepare_to_rebuild(young_cset_regions, old_cset_regions, first_old, last_old, num_old); - + // We are preparing for evacuation. + size_t young_trashed_regions, old_trashed_regions, first_old, last_old, num_old; + _free_set->prepare_to_rebuild(young_trashed_regions, old_trashed_regions, first_old, last_old, num_old); if (heap->mode()->is_generational()) { ShenandoahGenerationalHeap* gen_heap = ShenandoahGenerationalHeap::heap(); - gen_heap->compute_old_generation_balance(young_cset_regions, old_cset_regions); + size_t allocation_runway = + gen_heap->young_generation()->heuristics()->bytes_of_allocation_runway_before_gc_trigger(young_trashed_regions); + gen_heap->compute_old_generation_balance(allocation_runway, old_trashed_regions, young_trashed_regions); } - - // Free set construction uses reserve quantities, because they are known to be valid here - _free_set->finish_rebuild(young_cset_regions, old_cset_regions, num_old, true); + _free_set->finish_rebuild(young_trashed_regions, old_trashed_regions, num_old); } } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahGeneration.hpp b/src/hotspot/share/gc/shenandoah/shenandoahGeneration.hpp index 06cf132f946..d49e3bed5f8 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahGeneration.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahGeneration.hpp @@ -63,9 +63,10 @@ private: // Compute evacuation budgets prior to choosing collection set. void compute_evacuation_budgets(ShenandoahHeap* heap); - // Adjust evacuation budgets after choosing collection set. + // Adjust evacuation budgets after choosing collection set. The argument regions_to_xfer represents regions to be + // transfered to old based on decisions made in top_off_collection_set() void adjust_evacuation_budgets(ShenandoahHeap* heap, - ShenandoahCollectionSet* collection_set); + ShenandoahCollectionSet* collection_set, size_t regions_to_xfer); // Preselect for possible inclusion into the collection set exactly the most // garbage-dense regions, including those that satisfy criteria 1 & 2 below, @@ -144,6 +145,22 @@ private: virtual void prepare_gc(); // Called during final mark, chooses collection set, rebuilds free set. + // Upon return from prepare_regions_and_collection_set(), certain parameters have been established to govern the + // evacuation efforts that are about to begin. In particular: + // + // old_generation->get_promoted_reserve() represents the amount of memory within old-gen's available memory that has + // been set aside to hold objects promoted from young-gen memory. This represents an estimated percentage + // of the live young-gen memory within the collection set. If there is more data ready to be promoted than + // can fit within this reserve, the promotion of some objects will be deferred until a subsequent evacuation + // pass. + // + // old_generation->get_evacuation_reserve() represents the amount of memory within old-gen's available memory that has been + // set aside to hold objects evacuated from the old-gen collection set. + // + // young_generation->get_evacuation_reserve() represents the amount of memory within young-gen's available memory that has + // been set aside to hold objects evacuated from the young-gen collection set. Conservatively, this value + // equals the entire amount of live young-gen memory within the collection set, even though some of this memory + // will likely be promoted. virtual void prepare_regions_and_collection_set(bool concurrent); // Cancel marking (used by Full collect and when cancelling cycle). diff --git a/src/hotspot/share/gc/shenandoah/shenandoahGenerationalFullGC.cpp b/src/hotspot/share/gc/shenandoah/shenandoahGenerationalFullGC.cpp index 78672ee10a5..1b11c696d18 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahGenerationalFullGC.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahGenerationalFullGC.cpp @@ -55,9 +55,6 @@ void ShenandoahGenerationalFullGC::prepare() { // Since we may arrive here from degenerated GC failure of either young or old, establish generation as GLOBAL. heap->set_active_generation(heap->global_generation()); - // No need for old_gen->increase_used() as this was done when plabs were allocated. - heap->reset_generation_reserves(); - // Full GC supersedes any marking or coalescing in old generation. heap->old_generation()->cancel_gc(); } @@ -156,8 +153,11 @@ void ShenandoahGenerationalFullGC::compute_balances() { // In case this Full GC resulted from degeneration, clear the tally on anticipated promotion. heap->old_generation()->set_promotion_potential(0); - // Invoke this in case we are able to transfer memory from OLD to YOUNG. - heap->compute_old_generation_balance(0, 0); + + // Invoke this in case we are able to transfer memory from OLD to YOUNG + size_t allocation_runway = + heap->young_generation()->heuristics()->bytes_of_allocation_runway_before_gc_trigger(0L); + heap->compute_old_generation_balance(allocation_runway, 0, 0); } ShenandoahPrepareForGenerationalCompactionObjectClosure::ShenandoahPrepareForGenerationalCompactionObjectClosure(PreservedMarks* preserved_marks, diff --git a/src/hotspot/share/gc/shenandoah/shenandoahGenerationalHeap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahGenerationalHeap.cpp index fa78e02e6af..36ea0b9e497 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahGenerationalHeap.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahGenerationalHeap.cpp @@ -299,9 +299,9 @@ oop ShenandoahGenerationalHeap::try_evacuate_object(oop p, Thread* thread, uint alloc_from_lab = false; } // else, we leave copy equal to nullptr, signaling a promotion failure below if appropriate. - // We choose not to promote objects smaller than PLAB::min_size() by way of shared allocations, as this is too + // We choose not to promote objects smaller than size_threshold by way of shared allocations as this is too // costly. Instead, we'll simply "evacuate" to young-gen memory (using a GCLAB) and will promote in a future - // evacuation pass. This condition is denoted by: is_promotion && has_plab && (size <= PLAB::min_size()) + // evacuation pass. This condition is denoted by: is_promotion && has_plab && (size <= size_threshhold). } #ifdef ASSERT } @@ -576,19 +576,18 @@ void ShenandoahGenerationalHeap::retire_plab(PLAB* plab) { // Make sure old-generation is large enough, but no larger than is necessary, to hold mixed evacuations // and promotions, if we anticipate either. Any deficit is provided by the young generation, subject to -// xfer_limit, and any surplus is transferred to the young generation. -// -// xfer_limit is the maximum we're able to transfer from young to old based on either: -// 1. an assumption that we will be able to replenish memory "borrowed" from young at the end of collection, or -// 2. there is sufficient excess in the allocation runway during GC idle cycles -void ShenandoahGenerationalHeap::compute_old_generation_balance(size_t old_xfer_limit, size_t old_cset_regions) { - +// mutator_xfer_limit, and any surplus is transferred to the young generation. mutator_xfer_limit is +// the maximum we're able to transfer from young to old. This is called at the end of GC, as we prepare +// for the idle span that precedes the next GC. +void ShenandoahGenerationalHeap::compute_old_generation_balance(size_t mutator_xfer_limit, + size_t old_trashed_regions, size_t young_trashed_regions) { + shenandoah_assert_heaplocked(); // We can limit the old reserve to the size of anticipated promotions: // max_old_reserve is an upper bound on memory evacuated from old and promoted to old, // clamped by the old generation space available. // // Here's the algebra. - // Let SOEP = ShenandoahOldEvacRatioPercent, + // Let SOEP = ShenandoahOldEvacPercent, // OE = old evac, // YE = young evac, and // TE = total evac = OE + YE @@ -600,81 +599,171 @@ void ShenandoahGenerationalHeap::compute_old_generation_balance(size_t old_xfer_ // => OE = YE*SOEP/(100-SOEP) // We have to be careful in the event that SOEP is set to 100 by the user. - assert(ShenandoahOldEvacRatioPercent <= 100, "Error"); - const size_t old_available = old_generation()->available(); - // The free set will reserve this amount of memory to hold young evacuations - const size_t young_reserve = (young_generation()->max_capacity() * ShenandoahEvacReserve) / 100; - - // In the case that ShenandoahOldEvacRatioPercent equals 100, max_old_reserve is limited only by xfer_limit. - - const double bound_on_old_reserve = old_available + old_xfer_limit + young_reserve; - const double max_old_reserve = ((ShenandoahOldEvacRatioPercent == 100)? bound_on_old_reserve: - MIN2(double(young_reserve * ShenandoahOldEvacRatioPercent) - / double(100 - ShenandoahOldEvacRatioPercent), bound_on_old_reserve)); - + assert(ShenandoahOldEvacPercent <= 100, "Error"); const size_t region_size_bytes = ShenandoahHeapRegion::region_size_bytes(); + ShenandoahOldGeneration* old_gen = old_generation(); + size_t old_capacity = old_gen->max_capacity(); + size_t old_usage = old_gen->used(); // includes humongous waste + size_t old_available = ((old_capacity >= old_usage)? old_capacity - old_usage: 0) + old_trashed_regions * region_size_bytes; + + ShenandoahYoungGeneration* young_gen = young_generation(); + size_t young_capacity = young_gen->max_capacity(); + size_t young_usage = young_gen->used(); // includes humongous waste + size_t young_available = ((young_capacity >= young_usage)? young_capacity - young_usage: 0); + size_t freeset_available = free_set()->available_locked(); + if (young_available > freeset_available) { + young_available = freeset_available; + } + young_available += young_trashed_regions * region_size_bytes; + + // The free set will reserve this amount of memory to hold young evacuations (initialized to the ideal reserve) + size_t young_reserve = (young_generation()->max_capacity() * ShenandoahEvacReserve) / 100; + + // If ShenandoahOldEvacPercent equals 100, max_old_reserve is limited only by mutator_xfer_limit and young_reserve + const size_t bound_on_old_reserve = ((old_available + mutator_xfer_limit + young_reserve) * ShenandoahOldEvacPercent) / 100; + size_t proposed_max_old = ((ShenandoahOldEvacPercent == 100)? + bound_on_old_reserve: + MIN2((young_reserve * ShenandoahOldEvacPercent) / (100 - ShenandoahOldEvacPercent), + bound_on_old_reserve)); + if (young_reserve > young_available) { + young_reserve = young_available; + } + // Decide how much old space we should reserve for a mixed collection - double reserve_for_mixed = 0; - if (old_generation()->has_unprocessed_collection_candidates()) { + size_t reserve_for_mixed = 0; + const size_t old_fragmented_available = + old_available - (old_generation()->free_unaffiliated_regions() + old_trashed_regions) * region_size_bytes; + + if (old_fragmented_available > proposed_max_old) { + // After we've promoted regions in place, there may be an abundance of old-fragmented available memory, + // even more than the desired percentage for old reserve. We cannot transfer these fragmented regions back + // to young. Instead we make the best of the situation by using this fragmented memory for both promotions + // and evacuations. + proposed_max_old = old_fragmented_available; + } + size_t reserve_for_promo = old_fragmented_available; + const size_t max_old_reserve = proposed_max_old; + const size_t mixed_candidate_live_memory = old_generation()->unprocessed_collection_candidates_live_memory(); + const bool doing_mixed = (mixed_candidate_live_memory > 0); + if (doing_mixed) { // We want this much memory to be unfragmented in order to reliably evacuate old. This is conservative because we // may not evacuate the entirety of unprocessed candidates in a single mixed evacuation. - const double max_evac_need = - (double(old_generation()->unprocessed_collection_candidates_live_memory()) * ShenandoahOldEvacWaste); + const size_t max_evac_need = (size_t) (mixed_candidate_live_memory * ShenandoahOldEvacWaste); assert(old_available >= old_generation()->free_unaffiliated_regions() * region_size_bytes, "Unaffiliated available must be less than total available"); - const double old_fragmented_available = - double(old_available - old_generation()->free_unaffiliated_regions() * region_size_bytes); - reserve_for_mixed = max_evac_need + old_fragmented_available; - if (reserve_for_mixed > max_old_reserve) { - reserve_for_mixed = max_old_reserve; + + // We prefer to evacuate all of mixed into unfragmented memory, and will expand old in order to do so, unless + // we already have too much fragmented available memory in old. + reserve_for_mixed = max_evac_need; + if (reserve_for_mixed + reserve_for_promo > max_old_reserve) { + // In this case, we'll allow old-evac to target some of the fragmented old memory. + size_t excess_reserves = (reserve_for_mixed + reserve_for_promo) - max_old_reserve; + if (reserve_for_promo > excess_reserves) { + reserve_for_promo -= excess_reserves; + } else { + excess_reserves -= reserve_for_promo; + reserve_for_promo = 0; + reserve_for_mixed -= excess_reserves; + } } } - // Decide how much space we should reserve for promotions from young - size_t reserve_for_promo = 0; + // Decide how much additional space we should reserve for promotions from young. We give priority to mixed evacations + // over promotions. const size_t promo_load = old_generation()->get_promotion_potential(); const bool doing_promotions = promo_load > 0; if (doing_promotions) { - // We're promoting and have a bound on the maximum amount that can be promoted - assert(max_old_reserve >= reserve_for_mixed, "Sanity"); - const size_t available_for_promotions = max_old_reserve - reserve_for_mixed; - reserve_for_promo = MIN2((size_t)(promo_load * ShenandoahPromoEvacWaste), available_for_promotions); + // We've already set aside all of the fragmented available memory within old-gen to represent old objects + // to be promoted from young generation. promo_load represents the memory that we anticipate to be promoted + // from regions that have reached tenure age. In the ideal, we will always use fragmented old-gen memory + // to hold individually promoted objects and will use unfragmented old-gen memory to represent the old-gen + // evacuation workloa. + + // We're promoting and have an estimate of memory to be promoted from aged regions + assert(max_old_reserve >= (reserve_for_mixed + reserve_for_promo), "Sanity"); + const size_t available_for_additional_promotions = max_old_reserve - (reserve_for_mixed + reserve_for_promo); + size_t promo_need = (size_t)(promo_load * ShenandoahPromoEvacWaste); + if (promo_need > reserve_for_promo) { + reserve_for_promo += MIN2(promo_need - reserve_for_promo, available_for_additional_promotions); + } + // We've already reserved all the memory required for the promo_load, and possibly more. The excess + // can be consumed by objects promoted from regions that have not yet reached tenure age. } - // This is the total old we want to ideally reserve - const size_t old_reserve = reserve_for_mixed + reserve_for_promo; - assert(old_reserve <= max_old_reserve, "cannot reserve more than max for old evacuations"); + // This is the total old we want to reserve (initialized to the ideal reserve) + size_t old_reserve = reserve_for_mixed + reserve_for_promo; // We now check if the old generation is running a surplus or a deficit. - const size_t max_old_available = old_generation()->available() + old_cset_regions * region_size_bytes; - if (max_old_available >= old_reserve) { - // We are running a surplus, so the old region surplus can go to young - const size_t old_surplus = (max_old_available - old_reserve) / region_size_bytes; - const size_t unaffiliated_old_regions = old_generation()->free_unaffiliated_regions() + old_cset_regions; - const size_t old_region_surplus = MIN2(old_surplus, unaffiliated_old_regions); - old_generation()->set_region_balance(checked_cast(old_region_surplus)); - } else { - // We are running a deficit which we'd like to fill from young. - // Ignore that this will directly impact young_generation()->max_capacity(), - // indirectly impacting young_reserve and old_reserve. These computations are conservative. - // Note that deficit is rounded up by one region. - const size_t old_need = (old_reserve - max_old_available + region_size_bytes - 1) / region_size_bytes; - const size_t max_old_region_xfer = old_xfer_limit / region_size_bytes; + size_t old_region_deficit = 0; + size_t old_region_surplus = 0; - // Round down the regions we can transfer from young to old. If we're running short - // on young-gen memory, we restrict the xfer. Old-gen collection activities will be - // curtailed if the budget is restricted. - const size_t old_region_deficit = MIN2(old_need, max_old_region_xfer); + size_t mutator_region_xfer_limit = mutator_xfer_limit / region_size_bytes; + // align the mutator_xfer_limit on region size + mutator_xfer_limit = mutator_region_xfer_limit * region_size_bytes; + + if (old_available >= old_reserve) { + // We are running a surplus, so the old region surplus can go to young + const size_t old_surplus = old_available - old_reserve; + old_region_surplus = old_surplus / region_size_bytes; + const size_t unaffiliated_old_regions = old_generation()->free_unaffiliated_regions() + old_trashed_regions; + old_region_surplus = MIN2(old_region_surplus, unaffiliated_old_regions); + old_generation()->set_region_balance(checked_cast(old_region_surplus)); + } else if (old_available + mutator_xfer_limit >= old_reserve) { + // Mutator's xfer limit is sufficient to satisfy our need: transfer all memory from there + size_t old_deficit = old_reserve - old_available; + old_region_deficit = (old_deficit + region_size_bytes - 1) / region_size_bytes; + old_generation()->set_region_balance(0 - checked_cast(old_region_deficit)); + } else { + // We'll try to xfer from both mutator excess and from young collector reserve + size_t available_reserves = old_available + young_reserve + mutator_xfer_limit; + size_t old_entitlement = (available_reserves * ShenandoahOldEvacPercent) / 100; + + // Round old_entitlement down to nearest multiple of regions to be transferred to old + size_t entitled_xfer = old_entitlement - old_available; + entitled_xfer = region_size_bytes * (entitled_xfer / region_size_bytes); + size_t unaffiliated_young_regions = young_generation()->free_unaffiliated_regions(); + size_t unaffiliated_young_memory = unaffiliated_young_regions * region_size_bytes; + if (entitled_xfer > unaffiliated_young_memory) { + entitled_xfer = unaffiliated_young_memory; + } + old_entitlement = old_available + entitled_xfer; + if (old_entitlement < old_reserve) { + // There's not enough memory to satisfy our desire. Scale back our old-gen intentions. + size_t budget_overrun = old_reserve - old_entitlement;; + if (reserve_for_promo > budget_overrun) { + reserve_for_promo -= budget_overrun; + old_reserve -= budget_overrun; + } else { + budget_overrun -= reserve_for_promo; + reserve_for_promo = 0; + reserve_for_mixed = (reserve_for_mixed > budget_overrun)? reserve_for_mixed - budget_overrun: 0; + old_reserve = reserve_for_promo + reserve_for_mixed; + } + } + + // Because of adjustments above, old_reserve may be smaller now than it was when we tested the branch + // condition above: "(old_available + mutator_xfer_limit >= old_reserve) + // Therefore, we do NOT know that: mutator_xfer_limit < old_reserve - old_available + + size_t old_deficit = old_reserve - old_available; + old_region_deficit = (old_deficit + region_size_bytes - 1) / region_size_bytes; + + // Shrink young_reserve to account for loan to old reserve + const size_t reserve_xfer_regions = old_region_deficit - mutator_region_xfer_limit; + young_reserve -= reserve_xfer_regions * region_size_bytes; old_generation()->set_region_balance(0 - checked_cast(old_region_deficit)); } -} -void ShenandoahGenerationalHeap::reset_generation_reserves() { - ShenandoahHeapLocker locker(lock()); - young_generation()->set_evacuation_reserve(0); - old_generation()->set_evacuation_reserve(0); - old_generation()->set_promoted_reserve(0); + assert(old_region_deficit == 0 || old_region_surplus == 0, "Only surplus or deficit, never both"); + assert(young_reserve + reserve_for_mixed + reserve_for_promo <= old_available + young_available, + "Cannot reserve more memory than is available: %zu + %zu + %zu <= %zu + %zu", + young_reserve, reserve_for_mixed, reserve_for_promo, old_available, young_available); + + // deficit/surplus adjustments to generation sizes will precede rebuild + young_generation()->set_evacuation_reserve(young_reserve); + old_generation()->set_evacuation_reserve(reserve_for_mixed); + old_generation()->set_promoted_reserve(reserve_for_promo); } void ShenandoahGenerationalHeap::coalesce_and_fill_old_regions(bool concurrent) { @@ -1015,10 +1104,6 @@ void ShenandoahGenerationalHeap::final_update_refs_update_region_states() { void ShenandoahGenerationalHeap::complete_degenerated_cycle() { shenandoah_assert_heaplocked_or_safepoint(); - // In case degeneration interrupted concurrent evacuation or update references, we need to clean up - // transient state. Otherwise, these actions have no effect. - reset_generation_reserves(); - if (!old_generation()->is_parsable()) { ShenandoahGCPhase phase(ShenandoahPhaseTimings::degen_gc_coalesce_and_fill); coalesce_and_fill_old_regions(false); @@ -1036,7 +1121,6 @@ void ShenandoahGenerationalHeap::complete_concurrent_cycle() { // throw off the heuristics. entry_global_coalesce_and_fill(); } - reset_generation_reserves(); } void ShenandoahGenerationalHeap::entry_global_coalesce_and_fill() { diff --git a/src/hotspot/share/gc/shenandoah/shenandoahGenerationalHeap.hpp b/src/hotspot/share/gc/shenandoah/shenandoahGenerationalHeap.hpp index a2ae4a68cd0..719bae52a83 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahGenerationalHeap.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahGenerationalHeap.hpp @@ -136,7 +136,7 @@ public: void reset_generation_reserves(); // Computes the optimal size for the old generation, represented as a surplus or deficit of old regions - void compute_old_generation_balance(size_t old_xfer_limit, size_t old_cset_regions); + void compute_old_generation_balance(size_t old_xfer_limit, size_t old_trashed_regions, size_t young_trashed_regions); // Balances generations, coalesces and fills old regions if necessary void complete_degenerated_cycle(); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp index 683e2959a92..ef99bd98c93 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp @@ -425,20 +425,29 @@ jint ShenandoahHeap::initialize() { _affiliations[i] = ShenandoahAffiliation::FREE; } + + if (mode()->is_generational()) { + size_t young_reserve = (soft_max_capacity() * ShenandoahEvacReserve) / 100; + young_generation()->set_evacuation_reserve(young_reserve); + old_generation()->set_evacuation_reserve((size_t) 0); + old_generation()->set_promoted_reserve((size_t) 0); + } + _free_set = new ShenandoahFreeSet(this, _num_regions); post_initialize_heuristics(); + // We are initializing free set. We ignore cset region tallies. - size_t young_cset_regions, old_cset_regions, first_old, last_old, num_old; - _free_set->prepare_to_rebuild(young_cset_regions, old_cset_regions, first_old, last_old, num_old); + size_t young_trashed_regions, old_trashed_regions, first_old, last_old, num_old; + _free_set->prepare_to_rebuild(young_trashed_regions, old_trashed_regions, first_old, last_old, num_old); if (mode()->is_generational()) { ShenandoahGenerationalHeap* gen_heap = ShenandoahGenerationalHeap::heap(); // We cannot call // gen_heap->young_generation()->heuristics()->bytes_of_allocation_runway_before_gc_trigger(young_cset_regions) // until after the heap is fully initialized. So we make up a safe value here. size_t allocation_runway = InitialHeapSize / 2; - gen_heap->compute_old_generation_balance(allocation_runway, old_cset_regions); + gen_heap->compute_old_generation_balance(allocation_runway, old_trashed_regions, young_trashed_regions); } - _free_set->finish_rebuild(young_cset_regions, old_cset_regions, num_old); + _free_set->finish_rebuild(young_trashed_regions, old_trashed_regions, num_old); } if (AlwaysPreTouch) { @@ -2521,13 +2530,10 @@ void ShenandoahHeap::final_update_refs_update_region_states() { parallel_heap_region_iterate(&cl); } -void ShenandoahHeap::rebuild_free_set(bool concurrent) { - ShenandoahGCPhase phase(concurrent ? - ShenandoahPhaseTimings::final_update_refs_rebuild_freeset : - ShenandoahPhaseTimings::degen_gc_final_update_refs_rebuild_freeset); +void ShenandoahHeap::rebuild_free_set_within_phase() { ShenandoahHeapLocker locker(lock()); - size_t young_cset_regions, old_cset_regions, first_old_region, last_old_region, old_region_count; - _free_set->prepare_to_rebuild(young_cset_regions, old_cset_regions, first_old_region, last_old_region, old_region_count); + size_t young_trashed_regions, old_trashed_regions, first_old_region, last_old_region, old_region_count; + _free_set->prepare_to_rebuild(young_trashed_regions, old_trashed_regions, first_old_region, last_old_region, old_region_count); // If there are no old regions, first_old_region will be greater than last_old_region assert((first_old_region > last_old_region) || ((last_old_region + 1 - first_old_region >= old_region_count) && @@ -2546,19 +2552,11 @@ void ShenandoahHeap::rebuild_free_set(bool concurrent) { // available for transfer to old. Note that transfer of humongous regions does not impact available. ShenandoahGenerationalHeap* gen_heap = ShenandoahGenerationalHeap::heap(); size_t allocation_runway = - gen_heap->young_generation()->heuristics()->bytes_of_allocation_runway_before_gc_trigger(young_cset_regions); - gen_heap->compute_old_generation_balance(allocation_runway, old_cset_regions); - - // Total old_available may have been expanded to hold anticipated promotions. We trigger if the fragmented available - // memory represents more than 16 regions worth of data. Note that fragmentation may increase when we promote regular - // regions in place when many of these regular regions have an abundant amount of available memory within them. - // Fragmentation will decrease as promote-by-copy consumes the available memory within these partially consumed regions. - // - // We consider old-gen to have excessive fragmentation if more than 12.5% of old-gen is free memory that resides - // within partially consumed regions of memory. + gen_heap->young_generation()->heuristics()->bytes_of_allocation_runway_before_gc_trigger(young_trashed_regions); + gen_heap->compute_old_generation_balance(allocation_runway, old_trashed_regions, young_trashed_regions); } // Rebuild free set based on adjusted generation sizes. - _free_set->finish_rebuild(young_cset_regions, old_cset_regions, old_region_count); + _free_set->finish_rebuild(young_trashed_regions, old_trashed_regions, old_region_count); if (mode()->is_generational()) { ShenandoahGenerationalHeap* gen_heap = ShenandoahGenerationalHeap::heap(); @@ -2567,6 +2565,13 @@ void ShenandoahHeap::rebuild_free_set(bool concurrent) { } } +void ShenandoahHeap::rebuild_free_set(bool concurrent) { + ShenandoahGCPhase phase(concurrent ? + ShenandoahPhaseTimings::final_update_refs_rebuild_freeset : + ShenandoahPhaseTimings::degen_gc_final_update_refs_rebuild_freeset); + rebuild_free_set_within_phase(); +} + bool ShenandoahHeap::is_bitmap_slice_committed(ShenandoahHeapRegion* r, bool skip_self) { size_t slice = r->index() / _bitmap_regions_per_slice; diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp index 65e3803627c..174001170f4 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp @@ -481,7 +481,9 @@ private: void rendezvous_threads(const char* name); void recycle_trash(); public: + // The following two functions rebuild the free set at the end of GC, in preparation for an idle phase. void rebuild_free_set(bool concurrent); + void rebuild_free_set_within_phase(); void notify_gc_progress(); void notify_gc_no_progress(); size_t get_gc_no_progress_count() const; diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp index 3cd5cdd2ec3..6bb8382de0a 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp @@ -75,6 +75,7 @@ ShenandoahHeapRegion::ShenandoahHeapRegion(HeapWord* start, size_t index, bool c _plab_allocs(0), _live_data(0), _critical_pins(0), + _mixed_candidate_garbage_words(0), _update_watermark(start), _age(0), #ifdef SHENANDOAH_CENSUS_NOISE @@ -565,6 +566,7 @@ void ShenandoahHeapRegion::recycle_internal() { assert(_recycling.is_set() && is_trash(), "Wrong state"); ShenandoahHeap* heap = ShenandoahHeap::heap(); + _mixed_candidate_garbage_words = 0; set_top(bottom()); clear_live_data(); reset_alloc_metadata(); @@ -593,6 +595,8 @@ void ShenandoahHeapRegion::try_recycle_under_lock() { _recycling.unset(); } else { // Ensure recycling is unset before returning to mutator to continue memory allocation. + // Otherwise, the mutator might see region as fully recycled and might change its affiliation only to have + // the racing GC worker thread overwrite its affiliation to FREE. while (_recycling.is_set()) { if (os::is_MP()) { SpinPause(); @@ -603,6 +607,8 @@ void ShenandoahHeapRegion::try_recycle_under_lock() { } } +// Note that return from try_recycle() does not mean the region has been recycled. It only means that +// some GC worker thread has taken responsibility to recycle the region, eventually. void ShenandoahHeapRegion::try_recycle() { shenandoah_assert_not_heaplocked(); if (is_trash() && _recycling.try_set()) { diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.hpp b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.hpp index cf0dc5476d0..9da2816e2c9 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.hpp @@ -43,6 +43,7 @@ class ShenandoahHeapRegion { friend class VMStructs; friend class ShenandoahHeapRegionStateConstant; private: + /* Region state is described by a state machine. Transitions are guarded by heap lock, which allows changing the state of several regions atomically. @@ -259,6 +260,8 @@ private: volatile size_t _live_data; volatile size_t _critical_pins; + size_t _mixed_candidate_garbage_words; + HeapWord* volatile _update_watermark; uint _age; @@ -398,6 +401,14 @@ public: // above TAMS. inline size_t get_live_data_words() const; + inline size_t get_mixed_candidate_live_data_bytes() const; + inline size_t get_mixed_candidate_live_data_words() const; + + inline void capture_mixed_candidate_garbage(); + + // Returns garbage by calculating difference between used and get_live_data_words. The value returned is only + // meaningful immediately following completion of marking. If there have been subsequent allocations in this region, + // use a different approach to determine garbage, such as (used() - get_mixed_candidate_live_data_bytes()) inline size_t garbage() const; void print_on(outputStream* st) const; diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.inline.hpp b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.inline.hpp index b9304ee9daa..be982433885 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.inline.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.inline.hpp @@ -163,6 +163,23 @@ inline size_t ShenandoahHeapRegion::get_live_data_bytes() const { return get_live_data_words() * HeapWordSize; } +inline size_t ShenandoahHeapRegion::get_mixed_candidate_live_data_bytes() const { + shenandoah_assert_heaplocked_or_safepoint(); + assert(used() >= _mixed_candidate_garbage_words * HeapWordSize, "used must exceed garbage"); + return used() - _mixed_candidate_garbage_words * HeapWordSize; +} + +inline size_t ShenandoahHeapRegion::get_mixed_candidate_live_data_words() const { + shenandoah_assert_heaplocked_or_safepoint(); + assert(used() >= _mixed_candidate_garbage_words * HeapWordSize, "used must exceed garbage"); + return used() / HeapWordSize - _mixed_candidate_garbage_words; +} + +inline void ShenandoahHeapRegion::capture_mixed_candidate_garbage() { + shenandoah_assert_heaplocked_or_safepoint(); + _mixed_candidate_garbage_words = garbage() / HeapWordSize; +} + inline bool ShenandoahHeapRegion::has_live() const { return get_live_data_words() != 0; } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahOldGC.cpp b/src/hotspot/share/gc/shenandoah/shenandoahOldGC.cpp index a44a831ef3d..ff441a0c868 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahOldGC.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahOldGC.cpp @@ -128,8 +128,6 @@ bool ShenandoahOldGC::collect(GCCause::Cause cause) { // the space. This would be the last action if there is nothing to evacuate. entry_cleanup_early(); - heap->free_set()->log_status_under_lock(); - assert(!heap->is_concurrent_strong_root_in_progress(), "No evacuations during old gc."); // We must execute this vm operation if we completed final mark. We cannot @@ -138,7 +136,10 @@ bool ShenandoahOldGC::collect(GCCause::Cause cause) { // collection. heap->concurrent_final_roots(); - size_t allocation_runway = heap->young_generation()->heuristics()->bytes_of_allocation_runway_before_gc_trigger(0); - heap->compute_old_generation_balance(allocation_runway, 0); + // After concurrent old marking finishes, we reclaim immediate garbage. Further, we may also want to expand OLD in order + // to make room for anticipated promotions and/or for mixed evacuations. Mixed evacuations are especially likely to + // follow the end of OLD marking. + heap->rebuild_free_set_within_phase(); + heap->free_set()->log_status_under_lock(); return true; } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahOldGeneration.cpp b/src/hotspot/share/gc/shenandoah/shenandoahOldGeneration.cpp index c795eda3d96..aed768b9db1 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahOldGeneration.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahOldGeneration.cpp @@ -427,8 +427,7 @@ void ShenandoahOldGeneration::prepare_regions_and_collection_set(bool concurrent ShenandoahGenerationalHeap* gen_heap = ShenandoahGenerationalHeap::heap(); size_t allocation_runway = gen_heap->young_generation()->heuristics()->bytes_of_allocation_runway_before_gc_trigger(young_trash_regions); - gen_heap->compute_old_generation_balance(allocation_runway, old_trash_regions); - + gen_heap->compute_old_generation_balance(allocation_runway, old_trash_regions, young_trash_regions); heap->free_set()->finish_rebuild(young_trash_regions, old_trash_regions, num_old); } } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahOldGeneration.hpp b/src/hotspot/share/gc/shenandoah/shenandoahOldGeneration.hpp index 90c1458ac97..633d2c9f617 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahOldGeneration.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahOldGeneration.hpp @@ -66,8 +66,8 @@ private: // remaining in a PLAB when it is retired. size_t _promoted_expended; - // Represents the quantity of live bytes we expect to promote during the next evacuation - // cycle. This value is used by the young heuristic to trigger mixed collections. + // Represents the quantity of live bytes we expect to promote during the next GC cycle, either by + // evacuation or by promote-in-place. This value is used by the young heuristic to trigger mixed collections. // It is also used when computing the optimum size for the old generation. size_t _promotion_potential; diff --git a/src/hotspot/share/gc/shenandoah/shenandoahScanRemembered.cpp b/src/hotspot/share/gc/shenandoah/shenandoahScanRemembered.cpp index a3c96a7d53b..05af25f13ad 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahScanRemembered.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahScanRemembered.cpp @@ -243,8 +243,7 @@ HeapWord* ShenandoahCardCluster::first_object_start(const size_t card_index, con #ifdef ASSERT assert(ShenandoahHeap::heap()->mode()->is_generational(), "Do not use in non-generational mode"); assert(region->is_old(), "Do not use for young regions"); - // For HumongousRegion:s it's more efficient to jump directly to the - // start region. + // For humongous regions it's more efficient to jump directly to the start region. assert(!region->is_humongous(), "Use region->humongous_start_region() instead"); #endif diff --git a/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp b/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp index 543df2422c0..0cc6d4c6ed4 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp @@ -420,7 +420,14 @@ public: // span is the total memory affiliated with these stats (some of which is in use and other is available) size_t span() const { return _regions * ShenandoahHeapRegion::region_size_bytes(); } - size_t non_trashed_span() const { return (_regions - _trashed_regions) * ShenandoahHeapRegion::region_size_bytes(); } + size_t non_trashed_span() const { + assert(_regions >= _trashed_regions, "sanity"); + return (_regions - _trashed_regions) * ShenandoahHeapRegion::region_size_bytes(); + } + size_t non_trashed_committed() const { + assert(_committed >= _trashed_regions * ShenandoahHeapRegion::region_size_bytes(), "sanity"); + return _committed - (_trashed_regions * ShenandoahHeapRegion::region_size_bytes()); + } }; class ShenandoahGenerationStatsClosure : public ShenandoahHeapRegionClosure { diff --git a/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp b/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp index 254483d1923..3eb1a06a911 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp @@ -400,27 +400,20 @@ "reserve/waste is incorrect, at the risk that application " \ "runs out of memory too early.") \ \ - product(uintx, ShenandoahOldEvacRatioPercent, 75, EXPERIMENTAL, \ - "The maximum proportion of evacuation from old-gen memory, " \ - "expressed as a percentage. The default value 75 denotes that " \ - "no more than 75% of the collection set evacuation workload may " \ - "be towards evacuation of old-gen heap regions. This limits both "\ - "the promotion of aged regions and the compaction of existing " \ - "old regions. A value of 75 denotes that the total evacuation " \ - "work may increase to up to four times the young gen evacuation " \ - "work. A larger value allows quicker promotion and allows " \ - "a smaller number of mixed evacuations to process " \ - "the entire list of old-gen collection candidates at the cost " \ - "of an increased disruption of the normal cadence of young-gen " \ - "collections. A value of 100 allows a mixed evacuation to " \ - "focus entirely on old-gen memory, allowing no young-gen " \ - "regions to be collected, likely resulting in subsequent " \ - "allocation failures because the allocation pool is not " \ - "replenished. A value of 0 allows a mixed evacuation to " \ - "focus entirely on young-gen memory, allowing no old-gen " \ - "regions to be collected, likely resulting in subsequent " \ - "promotion failures and triggering of stop-the-world full GC " \ - "events.") \ + product(uintx, ShenandoahOldEvacPercent, 75, EXPERIMENTAL, \ + "The maximum evacuation to old-gen expressed as a percent of " \ + "the total live memory within the collection set. With the " \ + "default setting, if collection set evacuates X, no more than " \ + "75% of X may hold objects evacuated from old or promoted to " \ + "old from young. A value of 100 allows the entire collection " \ + "set to be comprised of old-gen regions and young regions that " \ + "have reached the tenure age. Larger values allow fewer mixed " \ + "evacuations to reclaim all the garbage from old. Smaller " \ + "values result in less variation in GC cycle times between " \ + "young vs. mixed cycles. A value of 0 prevents mixed " \ + "evacations from running and blocks promotion of aged regions " \ + "by evacuation. Setting the value to 0 does not prevent " \ + "regions from being promoted in place.") \ range(0,100) \ \ product(bool, ShenandoahEvacTracking, false, DIAGNOSTIC, \ diff --git a/src/hotspot/share/interpreter/bytecodeTracer.cpp b/src/hotspot/share/interpreter/bytecodeTracer.cpp index f9980e389e2..69fc93b6c0f 100644 --- a/src/hotspot/share/interpreter/bytecodeTracer.cpp +++ b/src/hotspot/share/interpreter/bytecodeTracer.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 @@ -192,18 +192,20 @@ void BytecodeTracer::trace_interpreter(const methodHandle& method, address bcp, } #endif -void BytecodeTracer::print_method_codes(const methodHandle& method, int from, int to, outputStream* st, int flags) { +void BytecodeTracer::print_method_codes(const methodHandle& method, int from, int to, outputStream* st, int flags, bool buffered) { BytecodePrinter method_printer(flags); BytecodeStream s(method); s.set_interval(from, to); - // Keep output to st coherent: collect all lines and print at once. ResourceMark rm; stringStream ss; + outputStream* out = buffered ? &ss : st; while (s.next() >= 0) { - method_printer.trace(method, s.bcp(), &ss); + method_printer.trace(method, s.bcp(), out); + } + if (buffered) { + st->print("%s", ss.as_string()); } - st->print("%s", ss.as_string()); } void BytecodePrinter::print_constant(int cp_index, outputStream* st) { diff --git a/src/hotspot/share/interpreter/bytecodeTracer.hpp b/src/hotspot/share/interpreter/bytecodeTracer.hpp index b32e55abbcf..e199a2b7ea2 100644 --- a/src/hotspot/share/interpreter/bytecodeTracer.hpp +++ b/src/hotspot/share/interpreter/bytecodeTracer.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 @@ -39,7 +39,7 @@ class BytecodeClosure; class BytecodeTracer: AllStatic { public: NOT_PRODUCT(static void trace_interpreter(const methodHandle& method, address bcp, uintptr_t tos, uintptr_t tos2, outputStream* st = tty);) - static void print_method_codes(const methodHandle& method, int from, int to, outputStream* st, int flags); + static void print_method_codes(const methodHandle& method, int from, int to, outputStream* st, int flags, bool buffered = true); }; #endif // SHARE_INTERPRETER_BYTECODETRACER_HPP diff --git a/src/hotspot/share/jfr/utilities/jfrSet.hpp b/src/hotspot/share/jfr/utilities/jfrSet.hpp index 3d394d10d8b..c443434800a 100644 --- a/src/hotspot/share/jfr/utilities/jfrSet.hpp +++ b/src/hotspot/share/jfr/utilities/jfrSet.hpp @@ -26,6 +26,7 @@ #define SHARE_JFR_UTILITIES_JFRSET_HPP #include "cppstdlib/new.hpp" +#include "cppstdlib/type_traits.hpp" #include "jfr/utilities/jfrTypes.hpp" #include "memory/allocation.hpp" @@ -110,7 +111,14 @@ class JfrSetStorage : public AnyObj { } void clear() { - memset(_table, 0, _table_size * sizeof(K)); + for (unsigned i = 0; i < _table_size; ++i) { + if constexpr (std::is_copy_assignable_v) { + _table[i] = K{}; + } else { + _table[i].~K(); + ::new (&_table[i]) K{}; + } + } } }; diff --git a/src/hotspot/share/oops/method.cpp b/src/hotspot/share/oops/method.cpp index 1a2e5f0bee4..949441585d8 100644 --- a/src/hotspot/share/oops/method.cpp +++ b/src/hotspot/share/oops/method.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 @@ -1898,15 +1898,15 @@ void Method::print_name(outputStream* st) const { #endif // !PRODUCT || INCLUDE_JVMTI -void Method::print_codes_on(outputStream* st, int flags) const { - print_codes_on(0, code_size(), st, flags); +void Method::print_codes_on(outputStream* st, int flags, bool buffered) const { + print_codes_on(0, code_size(), st, flags, buffered); } -void Method::print_codes_on(int from, int to, outputStream* st, int flags) const { +void Method::print_codes_on(int from, int to, outputStream* st, int flags, bool buffered) const { Thread *thread = Thread::current(); ResourceMark rm(thread); methodHandle mh (thread, (Method*)this); - BytecodeTracer::print_method_codes(mh, from, to, st, flags); + BytecodeTracer::print_method_codes(mh, from, to, st, flags, buffered); } CompressedLineNumberReadStream::CompressedLineNumberReadStream(u_char* buffer) : CompressedReadStream(buffer) { diff --git a/src/hotspot/share/oops/method.hpp b/src/hotspot/share/oops/method.hpp index 4592cb8a8c0..add8e59b2be 100644 --- a/src/hotspot/share/oops/method.hpp +++ b/src/hotspot/share/oops/method.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 @@ -466,8 +466,8 @@ public: // prints byte codes void print_codes(int flags = 0) const { print_codes_on(tty, flags); } - void print_codes_on(outputStream* st, int flags = 0) const; - void print_codes_on(int from, int to, outputStream* st, int flags = 0) const; + void print_codes_on(outputStream* st, int flags = 0, bool buffered = true) const; + void print_codes_on(int from, int to, outputStream* st, int flags = 0, bool buffered = true) const; // method parameters bool has_method_parameters() const diff --git a/src/hotspot/share/opto/addnode.hpp b/src/hotspot/share/opto/addnode.hpp index 4151ab5d065..6128de00efb 100644 --- a/src/hotspot/share/opto/addnode.hpp +++ b/src/hotspot/share/opto/addnode.hpp @@ -226,8 +226,11 @@ public: Base, // Base oop, for GC purposes Address, // Actually address, derived from base Offset } ; // Offset added to address - AddPNode( Node *base, Node *ptr, Node *off ) : Node(nullptr,base,ptr,off) { + AddPNode(Node *base, Node *ptr, Node *off) : Node(nullptr,base,ptr,off) { init_class_id(Class_AddP); + assert((ptr->bottom_type() == Type::TOP) || + ((base == Compile::current()->top()) == (ptr->bottom_type()->make_ptr()->isa_oopptr() == nullptr)), + "base input only needed for heap addresses"); } virtual int Opcode() const; virtual Node* Identity(PhaseGVN* phase); diff --git a/src/hotspot/share/opto/callnode.cpp b/src/hotspot/share/opto/callnode.cpp index fac8596173f..9b3d7b38d15 100644 --- a/src/hotspot/share/opto/callnode.cpp +++ b/src/hotspot/share/opto/callnode.cpp @@ -1737,11 +1737,11 @@ void AllocateNode::compute_MemBar_redundancy(ciMethod* initializer) _is_allocation_MemBar_redundant = true; } } -Node *AllocateNode::make_ideal_mark(PhaseGVN *phase, Node* obj, Node* control, Node* mem) { +Node *AllocateNode::make_ideal_mark(PhaseGVN* phase, Node* control, Node* mem) { Node* mark_node = nullptr; if (UseCompactObjectHeaders) { Node* klass_node = in(AllocateNode::KlassNode); - Node* proto_adr = phase->transform(new AddPNode(klass_node, klass_node, phase->MakeConX(in_bytes(Klass::prototype_header_offset())))); + Node* proto_adr = phase->transform(new AddPNode(phase->C->top(), klass_node, phase->MakeConX(in_bytes(Klass::prototype_header_offset())))); mark_node = LoadNode::make(*phase, control, mem, proto_adr, TypeRawPtr::BOTTOM, TypeX_X, TypeX_X->basic_type(), MemNode::unordered); } else { // For now only enable fast locking for non-array types diff --git a/src/hotspot/share/opto/callnode.hpp b/src/hotspot/share/opto/callnode.hpp index 0bb064efc43..41d0c9f5aac 100644 --- a/src/hotspot/share/opto/callnode.hpp +++ b/src/hotspot/share/opto/callnode.hpp @@ -1101,7 +1101,7 @@ public: void compute_MemBar_redundancy(ciMethod* initializer); bool is_allocation_MemBar_redundant() { return _is_allocation_MemBar_redundant; } - Node* make_ideal_mark(PhaseGVN *phase, Node* obj, Node* control, Node* mem); + Node* make_ideal_mark(PhaseGVN* phase, Node* control, Node* mem); NOT_PRODUCT(virtual void dump_spec(outputStream* st) const;) }; diff --git a/src/hotspot/share/opto/castnode.cpp b/src/hotspot/share/opto/castnode.cpp index 998b6a79903..2ebbdd7cdb3 100644 --- a/src/hotspot/share/opto/castnode.cpp +++ b/src/hotspot/share/opto/castnode.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 @@ -392,8 +392,8 @@ Node* CastLLNode::Ideal(PhaseGVN* phase, bool can_reshape) { if (t != Type::TOP && t_in != Type::TOP) { const TypeLong* tl = t->is_long(); const TypeLong* t_in_l = t_in->is_long(); - assert(tl->_lo >= t_in_l->_lo && tl->_hi <= t_in_l->_hi, "CastLL type should be narrower than or equal to the type of its input"); - assert((tl != t_in_l) == (tl->_lo > t_in_l->_lo || tl->_hi < t_in_l->_hi), "if type differs then this nodes's type must be narrower"); + assert(t_in_l->contains(tl), "CastLL type should be narrower than or equal to the type of its input"); + assert((tl != t_in_l) == t_in_l->strictly_contains(tl), "if type differs then this nodes's type must be narrower"); if (tl != t_in_l) { const TypeInt* ti = TypeInt::make(checked_cast(tl->_lo), checked_cast(tl->_hi), tl->_widen); Node* castii = phase->transform(new CastIINode(in(0), in1->in(1), ti)); diff --git a/src/hotspot/share/opto/escape.cpp b/src/hotspot/share/opto/escape.cpp index 792384b1ec1..357c91e8eb5 100644 --- a/src/hotspot/share/opto/escape.cpp +++ b/src/hotspot/share/opto/escape.cpp @@ -3772,9 +3772,9 @@ Node* ConnectionGraph::get_addp_base(Node *addp) { // | | // AddP ( base == address ) // - // case #6. Constant Pool, ThreadLocal, CastX2P or + // case #6. Constant Pool, ThreadLocal, CastX2P, Klass, OSR buffer buf or // Raw object's field reference: - // {ConP, ThreadLocal, CastX2P, raw Load} + // {ConP, ThreadLocal, CastX2P, raw Load, Parm0} // top | // \ | // AddP ( base == top ) @@ -3816,7 +3816,9 @@ Node* ConnectionGraph::get_addp_base(Node *addp) { int opcode = uncast_base->Opcode(); assert(opcode == Op_ConP || opcode == Op_ThreadLocal || opcode == Op_CastX2P || uncast_base->is_DecodeNarrowPtr() || + (_igvn->C->is_osr_compilation() && uncast_base->is_Parm() && uncast_base->as_Parm()->_con == TypeFunc::Parms)|| (uncast_base->is_Mem() && (uncast_base->bottom_type()->isa_rawptr() != nullptr)) || + (uncast_base->is_Mem() && (uncast_base->bottom_type()->isa_klassptr() != nullptr)) || is_captured_store_address(addp), "sanity"); } } @@ -4411,7 +4413,6 @@ void ConnectionGraph::split_unique_types(GrowableArray &alloc_worklist, uint new_index_start = (uint) _compile->num_alias_types(); VectorSet visited; ideal_nodes.clear(); // Reset for use with set_map/get_map. - uint unique_old = _compile->unique(); // Phase 1: Process possible allocations from alloc_worklist. // Create instance types for the CheckCastPP for allocations where possible. diff --git a/src/hotspot/share/opto/graphKit.cpp b/src/hotspot/share/opto/graphKit.cpp index 71ae8fe44a7..3d127322439 100644 --- a/src/hotspot/share/opto/graphKit.cpp +++ b/src/hotspot/share/opto/graphKit.cpp @@ -1489,8 +1489,7 @@ Node* GraphKit::must_be_not_null(Node* value, bool do_replace_in_map) { } Node *if_f = _gvn.transform(new IfFalseNode(iff)); Node *frame = _gvn.transform(new ParmNode(C->start(), TypeFunc::FramePtr)); - Node* halt = _gvn.transform(new HaltNode(if_f, frame, "unexpected null in intrinsic")); - C->root()->add_req(halt); + halt(if_f, frame, "unexpected null in intrinsic"); Node *if_t = _gvn.transform(new IfTrueNode(iff)); set_control(if_t); return cast_not_null(value, do_replace_in_map); @@ -2073,6 +2072,12 @@ void GraphKit::increment_counter(Node* counter_addr) { store_to_memory(ctrl, counter_addr, incr, T_LONG, MemNode::unordered); } +void GraphKit::halt(Node* ctrl, Node* frameptr, const char* reason, bool generate_code_in_product) { + Node* halt = new HaltNode(ctrl, frameptr, reason + PRODUCT_ONLY(COMMA generate_code_in_product)); + halt = _gvn.transform(halt); + root()->add_req(halt); +} //------------------------------uncommon_trap---------------------------------- // Bail out to the interpreter in mid-method. Implemented by calling the @@ -2195,11 +2200,15 @@ Node* GraphKit::uncommon_trap(int trap_request, // The debug info is the only real input to this call. // Halt-and-catch fire here. The above call should never return! - HaltNode* halt = new HaltNode(control(), frameptr(), "uncommon trap returned which should never happen" - PRODUCT_ONLY(COMMA /*reachable*/false)); - _gvn.set_type_bottom(halt); - root()->add_req(halt); - + // We only emit code for the HaltNode in debug, which is enough for + // verifying correctness. In product, we don't want to emit it so + // that we can save on code space. HaltNode often get folded because + // the compiler can prove that the unreachable path is dead. But we + // cannot generally expect that for uncommon traps, which are often + // reachable and occasionally taken. + halt(control(), frameptr(), + "uncommon trap returned which should never happen", + false /* don't emit code in product */); stop_and_kill_map(); return call; } @@ -2734,7 +2743,7 @@ Node* Phase::gen_subtype_check(Node* subklass, Node* superklass, Node** ctrl, No // will always succeed. We could leave a dependency behind to ensure this. // First load the super-klass's check-offset - Node *p1 = gvn.transform(new AddPNode(superklass, superklass, gvn.MakeConX(in_bytes(Klass::super_check_offset_offset())))); + Node *p1 = gvn.transform(new AddPNode(C->top(), superklass, gvn.MakeConX(in_bytes(Klass::super_check_offset_offset())))); Node* m = C->immutable_memory(); Node *chk_off = gvn.transform(new LoadINode(nullptr, m, p1, gvn.type(p1)->is_ptr(), TypeInt::INT, MemNode::unordered)); int cacheoff_con = in_bytes(Klass::secondary_super_cache_offset()); @@ -2752,7 +2761,7 @@ Node* Phase::gen_subtype_check(Node* subklass, Node* superklass, Node** ctrl, No #ifdef _LP64 chk_off_X = gvn.transform(new ConvI2LNode(chk_off_X)); #endif - Node *p2 = gvn.transform(new AddPNode(subklass,subklass,chk_off_X)); + Node* p2 = gvn.transform(new AddPNode(C->top(), subklass, chk_off_X)); // For some types like interfaces the following loadKlass is from a 1-word // cache which is mutable so can't use immutable memory. Other // types load from the super-class display table which is immutable. @@ -3589,7 +3598,7 @@ Node* GraphKit::get_layout_helper(Node* klass_node, jint& constant_value) { } } constant_value = Klass::_lh_neutral_value; // put in a known value - Node* lhp = basic_plus_adr(klass_node, klass_node, in_bytes(Klass::layout_helper_offset())); + Node* lhp = basic_plus_adr(top(), klass_node, in_bytes(Klass::layout_helper_offset())); return make_load(nullptr, lhp, TypeInt::INT, T_INT, MemNode::unordered); } diff --git a/src/hotspot/share/opto/graphKit.hpp b/src/hotspot/share/opto/graphKit.hpp index 56e9a949e6f..0537d31ae36 100644 --- a/src/hotspot/share/opto/graphKit.hpp +++ b/src/hotspot/share/opto/graphKit.hpp @@ -709,6 +709,8 @@ class GraphKit : public Phase { void increment_counter(address counter_addr); // increment a debug counter void increment_counter(Node* counter_addr); // increment a debug counter + void halt(Node* ctrl, Node* frameptr, const char* reason, bool generate_code_in_product = true); + // Bail out to the interpreter right now // The optional klass is the one causing the trap. // The optional reason is debug information written to the compile log. diff --git a/src/hotspot/share/opto/library_call.cpp b/src/hotspot/share/opto/library_call.cpp index 2c2a7c020b8..e481833c816 100644 --- a/src/hotspot/share/opto/library_call.cpp +++ b/src/hotspot/share/opto/library_call.cpp @@ -3000,7 +3000,7 @@ bool LibraryCallKit::inline_unsafe_allocate() { // Note: The argument might still be an illegal value like // Serializable.class or Object[].class. The runtime will handle it. // But we must make an explicit check for initialization. - Node* insp = basic_plus_adr(kls, in_bytes(InstanceKlass::init_state_offset())); + Node* insp = basic_plus_adr(top(), kls, in_bytes(InstanceKlass::init_state_offset())); // Use T_BOOLEAN for InstanceKlass::_init_state so the compiler // can generate code to load it as unsigned byte. Node* inst = make_load(nullptr, insp, TypeInt::UBYTE, T_BOOLEAN, MemNode::acquire); @@ -3048,7 +3048,7 @@ bool LibraryCallKit::inline_native_vthread_start_transition(address funcAddr, co IdealKit ideal(this); Node* thread = ideal.thread(); - Node* jt_addr = basic_plus_adr(thread, in_bytes(JavaThread::is_in_vthread_transition_offset())); + Node* jt_addr = basic_plus_adr(top(), thread, in_bytes(JavaThread::is_in_vthread_transition_offset())); Node* vt_addr = basic_plus_adr(vt_oop, java_lang_Thread::is_in_vthread_transition_offset()); access_store_at(nullptr, jt_addr, _gvn.type(jt_addr)->is_ptr(), ideal.ConI(1), TypeInt::BOOL, T_BOOLEAN, IN_NATIVE | MO_UNORDERED); access_store_at(nullptr, vt_addr, _gvn.type(vt_addr)->is_ptr(), ideal.ConI(1), TypeInt::BOOL, T_BOOLEAN, IN_NATIVE | MO_UNORDERED); @@ -3089,7 +3089,7 @@ bool LibraryCallKit::inline_native_vthread_end_transition(address funcAddr, cons ideal.sync_kit(this); } ideal.else_(); { Node* thread = ideal.thread(); - Node* jt_addr = basic_plus_adr(thread, in_bytes(JavaThread::is_in_vthread_transition_offset())); + Node* jt_addr = basic_plus_adr(top(), thread, in_bytes(JavaThread::is_in_vthread_transition_offset())); Node* vt_addr = basic_plus_adr(vt_oop, java_lang_Thread::is_in_vthread_transition_offset()); sync_kit(ideal); @@ -3115,7 +3115,7 @@ bool LibraryCallKit::inline_native_notify_jvmti_sync() { // unconditionally update the is_disable_suspend bit in current JavaThread Node* thread = ideal.thread(); Node* arg = _gvn.transform(argument(0)); // argument for notification - Node* addr = basic_plus_adr(thread, in_bytes(JavaThread::is_disable_suspend_offset())); + Node* addr = basic_plus_adr(top(), thread, in_bytes(JavaThread::is_disable_suspend_offset())); const TypePtr *addr_type = _gvn.type(addr)->isa_ptr(); sync_kit(ideal); @@ -3689,7 +3689,7 @@ void LibraryCallKit::extend_setCurrentThread(Node* jt, Node* thread) { IfNode* iff_thread_not_equal_carrierThread = create_and_map_if(control(), test_thread_not_equal_carrierThread, PROB_FAIR, COUNT_UNKNOWN); - Node* vthread_offset = basic_plus_adr(jt, in_bytes(THREAD_LOCAL_OFFSET_JFR + VTHREAD_OFFSET_JFR)); + Node* vthread_offset = basic_plus_adr(top(), jt, in_bytes(THREAD_LOCAL_OFFSET_JFR + VTHREAD_OFFSET_JFR)); // False branch, is carrierThread. Node* thread_equal_carrierThread = _gvn.transform(new IfFalseNode(iff_thread_not_equal_carrierThread)); @@ -3714,7 +3714,7 @@ void LibraryCallKit::extend_setCurrentThread(Node* jt, Node* thread) { Node* tid = load_field_from_object(thread, "tid", "J"); // Store the vthread tid to the jfr thread local. - Node* thread_id_offset = basic_plus_adr(jt, in_bytes(THREAD_LOCAL_OFFSET_JFR + VTHREAD_ID_OFFSET_JFR)); + Node* thread_id_offset = basic_plus_adr(top(), jt, in_bytes(THREAD_LOCAL_OFFSET_JFR + VTHREAD_ID_OFFSET_JFR)); Node* tid_memory = store_to_memory(control(), thread_id_offset, tid, T_LONG, MemNode::unordered, true); // Branch is_excluded to conditionalize updating the epoch . @@ -3736,7 +3736,7 @@ void LibraryCallKit::extend_setCurrentThread(Node* jt, Node* thread) { Node* epoch = _gvn.transform(new AndINode(epoch_raw, _gvn.transform(epoch_mask))); // Store the vthread epoch to the jfr thread local. - Node* vthread_epoch_offset = basic_plus_adr(jt, in_bytes(THREAD_LOCAL_OFFSET_JFR + VTHREAD_EPOCH_OFFSET_JFR)); + Node* vthread_epoch_offset = basic_plus_adr(top(), jt, in_bytes(THREAD_LOCAL_OFFSET_JFR + VTHREAD_EPOCH_OFFSET_JFR)); Node* included_memory = store_to_memory(control(), vthread_epoch_offset, epoch, T_CHAR, MemNode::unordered, true); RegionNode* excluded_rgn = new RegionNode(PATH_LIMIT); @@ -3759,7 +3759,7 @@ void LibraryCallKit::extend_setCurrentThread(Node* jt, Node* thread) { set_all_memory(excluded_mem); // Store the vthread exclusion state to the jfr thread local. - Node* thread_local_excluded_offset = basic_plus_adr(jt, in_bytes(THREAD_LOCAL_OFFSET_JFR + VTHREAD_EXCLUDED_OFFSET_JFR)); + Node* thread_local_excluded_offset = basic_plus_adr(top(), jt, in_bytes(THREAD_LOCAL_OFFSET_JFR + VTHREAD_EXCLUDED_OFFSET_JFR)); store_to_memory(control(), thread_local_excluded_offset, _gvn.transform(exclusion), T_BOOLEAN, MemNode::unordered, true); // Store release @@ -3814,7 +3814,7 @@ bool LibraryCallKit::inline_native_setCurrentThread() { // Change the _monitor_owner_id of the JavaThread Node* tid = load_field_from_object(arr, "tid", "J"); - Node* monitor_owner_id_offset = basic_plus_adr(thread, in_bytes(JavaThread::monitor_owner_id_offset())); + Node* monitor_owner_id_offset = basic_plus_adr(top(), thread, in_bytes(JavaThread::monitor_owner_id_offset())); store_to_memory(control(), monitor_owner_id_offset, tid, T_LONG, MemNode::unordered, true); JFR_ONLY(extend_setCurrentThread(thread, arr);) @@ -3956,7 +3956,7 @@ bool LibraryCallKit::inline_native_Continuation_pinning(bool unpin) { //---------------------------load_mirror_from_klass---------------------------- // Given a klass oop, load its java mirror (a java.lang.Class oop). Node* LibraryCallKit::load_mirror_from_klass(Node* klass) { - Node* p = basic_plus_adr(klass, in_bytes(Klass::java_mirror_offset())); + Node* p = basic_plus_adr(top(), klass, in_bytes(Klass::java_mirror_offset())); Node* load = make_load(nullptr, p, TypeRawPtr::NOTNULL, T_ADDRESS, MemNode::unordered); // mirror = ((OopHandle)mirror)->resolve(); return access_load(load, TypeInstPtr::MIRROR, T_OBJECT, IN_NATIVE); @@ -3996,7 +3996,7 @@ Node* LibraryCallKit::generate_klass_flags_guard(Node* kls, int modifier_mask, i ByteSize offset, const Type* type, BasicType bt) { // Branch around if the given klass has the given modifier bit set. // Like generate_guard, adds a new path onto the region. - Node* modp = basic_plus_adr(kls, in_bytes(offset)); + Node* modp = basic_plus_adr(top(), kls, in_bytes(offset)); Node* mods = make_load(nullptr, modp, type, bt, MemNode::unordered); Node* mask = intcon(modifier_mask); Node* bits = intcon(modifier_bits); @@ -4130,7 +4130,7 @@ bool LibraryCallKit::inline_native_Class_query(vmIntrinsics::ID id) { phi->add_req(null()); } // If we fall through, it's a plain class. Get its _super. - p = basic_plus_adr(kls, in_bytes(Klass::super_offset())); + p = basic_plus_adr(top(), kls, in_bytes(Klass::super_offset())); kls = _gvn.transform(LoadKlassNode::make(_gvn, immutable_memory(), p, TypeRawPtr::BOTTOM, TypeInstKlassPtr::OBJECT_OR_NULL)); null_ctl = top(); kls = null_check_oop(kls, &null_ctl); @@ -4668,7 +4668,7 @@ Node* LibraryCallKit::generate_virtual_guard(Node* obj_klass, int entry_offset = in_bytes(Klass::vtable_start_offset()) + vtable_index*vtableEntry::size_in_bytes() + in_bytes(vtableEntry::method_offset()); - Node* entry_addr = basic_plus_adr(obj_klass, entry_offset); + Node* entry_addr = basic_plus_adr(top(), obj_klass, entry_offset); Node* target_call = make_load(nullptr, entry_addr, TypePtr::NOTNULL, T_ADDRESS, MemNode::unordered); // Compare the target method with the expected method (e.g., Object.hashCode). diff --git a/src/hotspot/share/opto/loopopts.cpp b/src/hotspot/share/opto/loopopts.cpp index 9e3d4681e7c..1855263539b 100644 --- a/src/hotspot/share/opto/loopopts.cpp +++ b/src/hotspot/share/opto/loopopts.cpp @@ -1922,11 +1922,6 @@ bool PhaseIdealLoop::ctrl_of_all_uses_out_of_loop(const Node* n, Node* n_ctrl, I if (u->is_Opaque1()) { return false; // Found loop limit, bugfix for 4677003 } - // We can't reuse tags in PhaseIdealLoop::dom_lca_for_get_late_ctrl_internal() so make sure calls to - // get_late_ctrl_with_anti_dep() use their own tag - _dom_lca_tags_round++; - assert(_dom_lca_tags_round != 0, "shouldn't wrap around"); - if (u->is_Phi()) { for (uint j = 1; j < u->req(); ++j) { if (u->in(j) == n && !ctrl_of_use_out_of_loop(n, n_ctrl, n_loop, u->in(0)->in(j))) { @@ -1960,6 +1955,11 @@ bool PhaseIdealLoop::would_sink_below_pre_loop_exit(IdealLoopTree* n_loop, Node* bool PhaseIdealLoop::ctrl_of_use_out_of_loop(const Node* n, Node* n_ctrl, IdealLoopTree* n_loop, Node* ctrl) { if (n->is_Load()) { + // We can't reuse tags in PhaseIdealLoop::dom_lca_for_get_late_ctrl_internal() so make sure each call to + // get_late_ctrl_with_anti_dep() uses its own tag + _dom_lca_tags_round++; + assert(_dom_lca_tags_round != 0, "shouldn't wrap around"); + ctrl = get_late_ctrl_with_anti_dep(n->as_Load(), n_ctrl, ctrl); } IdealLoopTree *u_loop = get_loop(ctrl); diff --git a/src/hotspot/share/opto/macro.cpp b/src/hotspot/share/opto/macro.cpp index 4df03714376..56262d226fc 100644 --- a/src/hotspot/share/opto/macro.cpp +++ b/src/hotspot/share/opto/macro.cpp @@ -1198,8 +1198,8 @@ bool PhaseMacroExpand::eliminate_boxing_node(CallStaticJavaNode *boxing) { } -Node* PhaseMacroExpand::make_load(Node* ctl, Node* mem, Node* base, int offset, const Type* value_type, BasicType bt) { - Node* adr = basic_plus_adr(base, offset); +Node* PhaseMacroExpand::make_load_raw(Node* ctl, Node* mem, Node* base, int offset, const Type* value_type, BasicType bt) { + Node* adr = basic_plus_adr(top(), base, offset); const TypePtr* adr_type = adr->bottom_type()->is_ptr(); Node* value = LoadNode::make(_igvn, ctl, mem, adr, adr_type, value_type, bt, MemNode::unordered); transform_later(value); @@ -1207,8 +1207,8 @@ Node* PhaseMacroExpand::make_load(Node* ctl, Node* mem, Node* base, int offset, } -Node* PhaseMacroExpand::make_store(Node* ctl, Node* mem, Node* base, int offset, Node* value, BasicType bt) { - Node* adr = basic_plus_adr(base, offset); +Node* PhaseMacroExpand::make_store_raw(Node* ctl, Node* mem, Node* base, int offset, Node* value, BasicType bt) { + Node* adr = basic_plus_adr(top(), base, offset); mem = StoreNode::make(_igvn, ctl, mem, adr, nullptr, value, bt, MemNode::unordered); transform_later(mem); return mem; @@ -1753,20 +1753,20 @@ PhaseMacroExpand::initialize_object(AllocateNode* alloc, Node* size_in_bytes) { InitializeNode* init = alloc->initialization(); // Store the klass & mark bits - Node* mark_node = alloc->make_ideal_mark(&_igvn, object, control, rawmem); + Node* mark_node = alloc->make_ideal_mark(&_igvn, control, rawmem); if (!mark_node->is_Con()) { transform_later(mark_node); } - rawmem = make_store(control, rawmem, object, oopDesc::mark_offset_in_bytes(), mark_node, TypeX_X->basic_type()); + rawmem = make_store_raw(control, rawmem, object, oopDesc::mark_offset_in_bytes(), mark_node, TypeX_X->basic_type()); if (!UseCompactObjectHeaders) { - rawmem = make_store(control, rawmem, object, oopDesc::klass_offset_in_bytes(), klass_node, T_METADATA); + rawmem = make_store_raw(control, rawmem, object, oopDesc::klass_offset_in_bytes(), klass_node, T_METADATA); } int header_size = alloc->minimum_header_size(); // conservatively small // Array length if (length != nullptr) { // Arrays need length field - rawmem = make_store(control, rawmem, object, arrayOopDesc::length_offset_in_bytes(), length, T_INT); + rawmem = make_store_raw(control, rawmem, object, arrayOopDesc::length_offset_in_bytes(), length, T_INT); // conservatively small header size: header_size = arrayOopDesc::base_offset_in_bytes(T_BYTE); if (_igvn.type(klass_node)->isa_aryklassptr()) { // we know the exact header size in most cases: @@ -1792,6 +1792,7 @@ PhaseMacroExpand::initialize_object(AllocateNode* alloc, if (!(UseTLAB && ZeroTLAB)) { rawmem = ClearArrayNode::clear_memory(control, rawmem, object, header_size, size_in_bytes, + true, &_igvn); } } else { @@ -1946,7 +1947,7 @@ Node* PhaseMacroExpand::prefetch_allocation(Node* i_o, Node*& needgc_false, uint step_size = AllocatePrefetchStepSize; uint distance = AllocatePrefetchDistance; for ( intx i = 0; i < lines; i++ ) { - prefetch_adr = new AddPNode( old_eden_top, new_eden_top, + prefetch_adr = new AddPNode( top(), new_eden_top, _igvn.MakeConX(distance) ); transform_later(prefetch_adr); prefetch = new PrefetchAllocationNode( i_o, prefetch_adr ); diff --git a/src/hotspot/share/opto/macro.hpp b/src/hotspot/share/opto/macro.hpp index c899bed567c..0f8d8fb5172 100644 --- a/src/hotspot/share/opto/macro.hpp +++ b/src/hotspot/share/opto/macro.hpp @@ -58,10 +58,10 @@ public: _igvn.register_new_node_with_optimizer(n); return n; } - Node* make_load( Node* ctl, Node* mem, Node* base, int offset, - const Type* value_type, BasicType bt); - Node* make_store(Node* ctl, Node* mem, Node* base, int offset, - Node* value, BasicType bt); + Node* make_load_raw(Node* ctl, Node* mem, Node* base, int offset, + const Type* value_type, BasicType bt); + Node* make_store_raw(Node* ctl, Node* mem, Node* base, int offset, + Node* value, BasicType bt); Node* make_leaf_call(Node* ctrl, Node* mem, const TypeFunc* call_type, address call_addr, @@ -144,11 +144,10 @@ private: Node* slice_idx, Node* slice_len, Node* dest_size); - bool generate_block_arraycopy(Node** ctrl, MergeMemNode** mem, Node* io, + bool generate_block_arraycopy(Node** ctrl, MergeMemNode** mem, const TypePtr* adr_type, BasicType basic_elem_type, - AllocateNode* alloc, - Node* src, Node* src_offset, + Node* src, Node* src_offset, Node* dest, Node* dest_offset, Node* dest_size, bool dest_uninitialized); MergeMemNode* generate_slow_arraycopy(ArrayCopyNode *ac, diff --git a/src/hotspot/share/opto/macroArrayCopy.cpp b/src/hotspot/share/opto/macroArrayCopy.cpp index fb4a1842a36..0719ffc45a5 100644 --- a/src/hotspot/share/opto/macroArrayCopy.cpp +++ b/src/hotspot/share/opto/macroArrayCopy.cpp @@ -384,7 +384,6 @@ Node* PhaseMacroExpand::generate_arraycopy(ArrayCopyNode *ac, AllocateArrayNode* transform_later(slow_region); } - Node* original_dest = dest; bool dest_needs_zeroing = false; bool acopy_to_uninitialized = false; @@ -424,7 +423,6 @@ Node* PhaseMacroExpand::generate_arraycopy(ArrayCopyNode *ac, AllocateArrayNode* // No zeroing elimination needed here. alloc = nullptr; acopy_to_uninitialized = false; - //original_dest = dest; //dest_needs_zeroing = false; } @@ -557,10 +555,9 @@ Node* PhaseMacroExpand::generate_arraycopy(ArrayCopyNode *ac, AllocateArrayNode* MergeMemNode* local_mem = MergeMemNode::make(mem); transform_later(local_mem); - didit = generate_block_arraycopy(&local_ctrl, &local_mem, local_io, - adr_type, basic_elem_type, alloc, - src, src_offset, dest, dest_offset, - dest_size, acopy_to_uninitialized); + didit = generate_block_arraycopy(&local_ctrl, &local_mem, adr_type, + basic_elem_type, src, src_offset, + dest, dest_offset, dest_size, acopy_to_uninitialized); if (didit) { // Present the results of the block-copying fast call. result_region->init_req(bcopy_path, local_ctrl); @@ -641,7 +638,7 @@ Node* PhaseMacroExpand::generate_arraycopy(ArrayCopyNode *ac, AllocateArrayNode* // (At this point we can assume disjoint_bases, since types differ.) int ek_offset = in_bytes(ObjArrayKlass::element_klass_offset()); - Node* p1 = basic_plus_adr(dest_klass, ek_offset); + Node* p1 = basic_plus_adr(top(), dest_klass, ek_offset); Node* n1 = LoadKlassNode::make(_igvn, C->immutable_memory(), p1, TypeRawPtr::BOTTOM); Node* dest_elem_klass = transform_later(n1); Node* cv = generate_checkcast_arraycopy(&local_ctrl, &local_mem, @@ -918,12 +915,12 @@ void PhaseMacroExpand::generate_clear_array(Node* ctrl, MergeMemNode* merge_mem, if (start_con >= 0 && end_con >= 0) { // Constant start and end. Simple. mem = ClearArrayNode::clear_memory(ctrl, mem, dest, - start_con, end_con, &_igvn); + start_con, end_con, false, &_igvn); } else if (start_con >= 0 && dest_size != top()) { // Constant start, pre-rounded end after the tail of the array. Node* end = dest_size; mem = ClearArrayNode::clear_memory(ctrl, mem, dest, - start_con, end, &_igvn); + start_con, end, false, &_igvn); } else if (start_con >= 0 && slice_len != top()) { // Constant start, non-constant end. End needs rounding up. // End offset = round_up(abase + ((slice_idx_con + slice_len) << scale), 8) @@ -936,7 +933,7 @@ void PhaseMacroExpand::generate_clear_array(Node* ctrl, MergeMemNode* merge_mem, end = transform_later(new AddXNode(end, MakeConX(end_base)) ); end = transform_later(new AndXNode(end, MakeConX(~end_round)) ); mem = ClearArrayNode::clear_memory(ctrl, mem, dest, - start_con, end, &_igvn); + start_con, end, false, &_igvn); } else if (start_con < 0 && dest_size != top()) { // Non-constant start, pre-rounded end after the tail of the array. // This is almost certainly a "round-to-end" operation. @@ -970,7 +967,7 @@ void PhaseMacroExpand::generate_clear_array(Node* ctrl, MergeMemNode* merge_mem, } Node* end = dest_size; // pre-rounded mem = ClearArrayNode::clear_memory(ctrl, mem, dest, - start, end, &_igvn); + start, end, false, &_igvn); } else { // Non-constant start, unrounded non-constant end. // (Nobody zeroes a random midsection of an array using this routine.) @@ -981,11 +978,10 @@ void PhaseMacroExpand::generate_clear_array(Node* ctrl, MergeMemNode* merge_mem, merge_mem->set_memory_at(alias_idx, mem); } -bool PhaseMacroExpand::generate_block_arraycopy(Node** ctrl, MergeMemNode** mem, Node* io, +bool PhaseMacroExpand::generate_block_arraycopy(Node** ctrl, MergeMemNode** mem, const TypePtr* adr_type, BasicType basic_elem_type, - AllocateNode* alloc, - Node* src, Node* src_offset, + Node* src, Node* src_offset, Node* dest, Node* dest_offset, Node* dest_size, bool dest_uninitialized) { // See if there is an advantage from block transfer. @@ -1133,7 +1129,7 @@ Node* PhaseMacroExpand::generate_checkcast_arraycopy(Node** ctrl, MergeMemNode** // look in each non-null element's class, at the desired klass's // super_check_offset, for the desired klass. int sco_offset = in_bytes(Klass::super_check_offset_offset()); - Node* p3 = basic_plus_adr(dest_elem_klass, sco_offset); + Node* p3 = basic_plus_adr(top(), dest_elem_klass, sco_offset); Node* n3 = new LoadINode(nullptr, *mem /*memory(p3)*/, p3, _igvn.type(p3)->is_ptr(), TypeInt::INT, MemNode::unordered); Node* check_offset = ConvI2X(transform_later(n3)); Node* check_value = dest_elem_klass; diff --git a/src/hotspot/share/opto/matcher.hpp b/src/hotspot/share/opto/matcher.hpp index a071cff9e3c..9579af84f24 100644 --- a/src/hotspot/share/opto/matcher.hpp +++ b/src/hotspot/share/opto/matcher.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 @@ -327,6 +327,8 @@ public: // e.g. Op_ vector nodes and other intrinsics while guarding with vlen static bool match_rule_supported_vector(int opcode, int vlen, BasicType bt); + // Returns true if the platform efficiently implements the given masked vector + // operation using predicate features, false otherwise. static bool match_rule_supported_vector_masked(int opcode, int vlen, BasicType bt); // Determines if a vector operation needs to be partially implemented with a mask diff --git a/src/hotspot/share/opto/memnode.cpp b/src/hotspot/share/opto/memnode.cpp index 0d4fb6791a4..7f152eddd65 100644 --- a/src/hotspot/share/opto/memnode.cpp +++ b/src/hotspot/share/opto/memnode.cpp @@ -2563,7 +2563,13 @@ Node* LoadNode::klass_identity_common(PhaseGVN* phase) { ) { int mirror_field = in_bytes(Klass::java_mirror_offset()); if (tkls->offset() == mirror_field) { - return adr2->in(AddPNode::Base); +#ifdef ASSERT + const TypeKlassPtr* tkls2 = phase->type(adr2->in(AddPNode::Address))->is_klassptr(); + assert(tkls2->offset() == 0, "not a load of java_mirror"); +#endif + assert(adr2->in(AddPNode::Base)->is_top(), "not an off heap load"); + assert(adr2->in(AddPNode::Offset)->find_intptr_t_con(-1) == in_bytes(Klass::java_mirror_offset()), "incorrect offset"); + return adr2->in(AddPNode::Address); } } } @@ -4112,18 +4118,27 @@ bool ClearArrayNode::step_through(Node** np, uint instance_id, PhaseValues* phas return true; } +Node* ClearArrayNode::make_address(Node* dest, Node* offset, bool raw_base, PhaseGVN* phase) { + Node* base = dest; + if (raw_base) { + // May be called as part of the initialization of a just allocated object + base = phase->C->top(); + } + return phase->transform(new AddPNode(base, dest, offset)); +} + //----------------------------clear_memory------------------------------------- // Generate code to initialize object storage to zero. Node* ClearArrayNode::clear_memory(Node* ctl, Node* mem, Node* dest, intptr_t start_offset, Node* end_offset, + bool raw_base, PhaseGVN* phase) { intptr_t offset = start_offset; int unit = BytesPerLong; if ((offset % unit) != 0) { - Node* adr = new AddPNode(dest, dest, phase->MakeConX(offset)); - adr = phase->transform(adr); + Node* adr = make_address(dest, phase->MakeConX(offset), raw_base, phase); const TypePtr* atp = TypeRawPtr::BOTTOM; mem = StoreNode::make(*phase, ctl, mem, adr, atp, phase->zerocon(T_INT), T_INT, MemNode::unordered); mem = phase->transform(mem); @@ -4132,12 +4147,13 @@ Node* ClearArrayNode::clear_memory(Node* ctl, Node* mem, Node* dest, assert((offset % unit) == 0, ""); // Initialize the remaining stuff, if any, with a ClearArray. - return clear_memory(ctl, mem, dest, phase->MakeConX(offset), end_offset, phase); + return clear_memory(ctl, mem, dest, phase->MakeConX(offset), end_offset, raw_base, phase); } Node* ClearArrayNode::clear_memory(Node* ctl, Node* mem, Node* dest, Node* start_offset, Node* end_offset, + bool raw_base, PhaseGVN* phase) { if (start_offset == end_offset) { // nothing to do @@ -4157,7 +4173,7 @@ Node* ClearArrayNode::clear_memory(Node* ctl, Node* mem, Node* dest, // Bulk clear double-words Node* zsize = phase->transform(new SubXNode(zend, zbase) ); - Node* adr = phase->transform(new AddPNode(dest, dest, start_offset) ); + Node* adr = make_address(dest, start_offset, raw_base, phase); mem = new ClearArrayNode(ctl, mem, zsize, adr, false); return phase->transform(mem); } @@ -4165,6 +4181,7 @@ Node* ClearArrayNode::clear_memory(Node* ctl, Node* mem, Node* dest, Node* ClearArrayNode::clear_memory(Node* ctl, Node* mem, Node* dest, intptr_t start_offset, intptr_t end_offset, + bool raw_base, PhaseGVN* phase) { if (start_offset == end_offset) { // nothing to do @@ -4178,11 +4195,10 @@ Node* ClearArrayNode::clear_memory(Node* ctl, Node* mem, Node* dest, } if (done_offset > start_offset) { mem = clear_memory(ctl, mem, dest, - start_offset, phase->MakeConX(done_offset), phase); + start_offset, phase->MakeConX(done_offset), raw_base, phase); } if (done_offset < end_offset) { // emit the final 32-bit store - Node* adr = new AddPNode(dest, dest, phase->MakeConX(done_offset)); - adr = phase->transform(adr); + Node* adr = make_address(dest, phase->MakeConX(done_offset), raw_base, phase); const TypePtr* atp = TypeRawPtr::BOTTOM; mem = StoreNode::make(*phase, ctl, mem, adr, atp, phase->zerocon(T_INT), T_INT, MemNode::unordered); mem = phase->transform(mem); @@ -5389,6 +5405,7 @@ Node* InitializeNode::complete_stores(Node* rawctl, Node* rawmem, Node* rawptr, zeroes_done = align_down(zeroes_done, BytesPerInt); rawmem = ClearArrayNode::clear_memory(rawctl, rawmem, rawptr, zeroes_done, zeroes_needed, + true, phase); zeroes_done = zeroes_needed; if (zsize > InitArrayShortSize && ++big_init_gaps > 2) @@ -5447,7 +5464,7 @@ Node* InitializeNode::complete_stores(Node* rawctl, Node* rawmem, Node* rawptr, } if (zeroes_done < size_limit) { rawmem = ClearArrayNode::clear_memory(rawctl, rawmem, rawptr, - zeroes_done, size_in_bytes, phase); + zeroes_done, size_in_bytes, true, phase); } } diff --git a/src/hotspot/share/opto/memnode.hpp b/src/hotspot/share/opto/memnode.hpp index e84556528e6..249df51beb9 100644 --- a/src/hotspot/share/opto/memnode.hpp +++ b/src/hotspot/share/opto/memnode.hpp @@ -1072,6 +1072,7 @@ public: class ClearArrayNode: public Node { private: bool _is_large; + static Node* make_address(Node* dest, Node* offset, bool raw_base, PhaseGVN* phase); public: ClearArrayNode( Node *ctrl, Node *arymem, Node *word_cnt, Node *base, bool is_large) : Node(ctrl,arymem,word_cnt,base), _is_large(is_large) { @@ -1099,14 +1100,17 @@ public: static Node* clear_memory(Node* control, Node* mem, Node* dest, intptr_t start_offset, intptr_t end_offset, + bool raw_base, PhaseGVN* phase); static Node* clear_memory(Node* control, Node* mem, Node* dest, intptr_t start_offset, Node* end_offset, + bool raw_base, PhaseGVN* phase); static Node* clear_memory(Node* control, Node* mem, Node* dest, Node* start_offset, Node* end_offset, + bool raw_base, PhaseGVN* phase); // Return allocation input memory edge if it is different instance // or itself if it is the one we are looking for. diff --git a/src/hotspot/share/opto/node.hpp b/src/hotspot/share/opto/node.hpp index f1d9785a746..5ddc4236b3e 100644 --- a/src/hotspot/share/opto/node.hpp +++ b/src/hotspot/share/opto/node.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) 2024, 2025, Alibaba Group Holding Limited. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -845,7 +845,8 @@ public: Flag_has_swapped_edges = 1ULL << 11, Flag_is_scheduled = 1ULL << 12, Flag_is_expensive = 1ULL << 13, - Flag_is_predicated_vector = 1ULL << 14, + Flag_is_predicated_vector = 1ULL << 14, // Marked on a vector node that has an additional + // mask input controlling the lane operations. Flag_for_post_loop_opts_igvn = 1ULL << 15, Flag_for_merge_stores_igvn = 1ULL << 16, Flag_is_removed_by_peephole = 1ULL << 17, diff --git a/src/hotspot/share/opto/parse.hpp b/src/hotspot/share/opto/parse.hpp index 19b302a8924..397a7796f88 100644 --- a/src/hotspot/share/opto/parse.hpp +++ b/src/hotspot/share/opto/parse.hpp @@ -442,7 +442,7 @@ class Parse : public GraphKit { SafePointNode* create_entry_map(); // OSR helpers - Node *fetch_interpreter_state(int index, BasicType bt, Node *local_addrs, Node *local_addrs_base); + Node *fetch_interpreter_state(int index, BasicType bt, Node* local_addrs); Node* check_interpreter_type(Node* l, const Type* type, SafePointNode* &bad_type_exit); void load_interpreter_state(Node* osr_buf); diff --git a/src/hotspot/share/opto/parse1.cpp b/src/hotspot/share/opto/parse1.cpp index 7aa96d2ace3..2f699650037 100644 --- a/src/hotspot/share/opto/parse1.cpp +++ b/src/hotspot/share/opto/parse1.cpp @@ -103,10 +103,9 @@ void Parse::print_statistics() { // on stack replacement. Node *Parse::fetch_interpreter_state(int index, BasicType bt, - Node *local_addrs, - Node *local_addrs_base) { + Node* local_addrs) { Node *mem = memory(Compile::AliasIdxRaw); - Node *adr = basic_plus_adr( local_addrs_base, local_addrs, -index*wordSize ); + Node *adr = basic_plus_adr(top(), local_addrs, -index*wordSize); Node *ctl = control(); // Very similar to LoadNode::make, except we handle un-aligned longs and @@ -121,7 +120,7 @@ Node *Parse::fetch_interpreter_state(int index, case T_DOUBLE: { // Since arguments are in reverse order, the argument address 'adr' // refers to the back half of the long/double. Recompute adr. - adr = basic_plus_adr(local_addrs_base, local_addrs, -(index+1)*wordSize); + adr = basic_plus_adr(top(), local_addrs, -(index+1)*wordSize); if (Matcher::misaligned_doubles_ok) { l = (bt == T_DOUBLE) ? (Node*)new LoadDNode(ctl, mem, adr, TypeRawPtr::BOTTOM, Type::DOUBLE, MemNode::unordered) @@ -220,7 +219,7 @@ void Parse::load_interpreter_state(Node* osr_buf) { // Commute monitors from interpreter frame to compiler frame. assert(jvms()->monitor_depth() == 0, "should be no active locks at beginning of osr"); int mcnt = osr_block->flow()->monitor_count(); - Node *monitors_addr = basic_plus_adr(osr_buf, osr_buf, (max_locals+mcnt*2-1)*wordSize); + Node *monitors_addr = basic_plus_adr(top(), osr_buf, (max_locals+mcnt*2-1)*wordSize); for (index = 0; index < mcnt; index++) { // Make a BoxLockNode for the monitor. BoxLockNode* osr_box = new BoxLockNode(next_monitor()); @@ -241,9 +240,9 @@ void Parse::load_interpreter_state(Node* osr_buf) { // Displaced headers and locked objects are interleaved in the // temp OSR buffer. We only copy the locked objects out here. // Fetch the locked object from the OSR temp buffer and copy to our fastlock node. - Node *lock_object = fetch_interpreter_state(index*2, T_OBJECT, monitors_addr, osr_buf); + Node *lock_object = fetch_interpreter_state(index*2, T_OBJECT, monitors_addr); // Try and copy the displaced header to the BoxNode - Node *displaced_hdr = fetch_interpreter_state((index*2) + 1, T_ADDRESS, monitors_addr, osr_buf); + Node *displaced_hdr = fetch_interpreter_state((index*2) + 1, T_ADDRESS, monitors_addr); store_to_memory(control(), box, displaced_hdr, T_ADDRESS, MemNode::unordered); @@ -271,7 +270,7 @@ void Parse::load_interpreter_state(Node* osr_buf) { } // Extract the needed locals from the interpreter frame. - Node *locals_addr = basic_plus_adr(osr_buf, osr_buf, (max_locals-1)*wordSize); + Node *locals_addr = basic_plus_adr(top(), osr_buf, (max_locals-1)*wordSize); // find all the locals that the interpreter thinks contain live oops const ResourceBitMap live_oops = method()->live_local_oops_at_bci(osr_bci()); @@ -318,7 +317,7 @@ void Parse::load_interpreter_state(Node* osr_buf) { // really for T_OBJECT types so correct it. bt = T_OBJECT; } - Node *value = fetch_interpreter_state(index, bt, locals_addr, osr_buf); + Node *value = fetch_interpreter_state(index, bt, locals_addr); set_local(index, value); } @@ -1229,8 +1228,7 @@ void Parse::do_method_entry() { Node* not_subtype_ctrl = gen_subtype_check(receiver_obj, holder_klass); assert(!stopped(), "not a subtype"); - Node* halt = _gvn.transform(new HaltNode(not_subtype_ctrl, frameptr(), "failed receiver subtype check")); - C->root()->add_req(halt); + halt(not_subtype_ctrl, frameptr(), "failed receiver subtype check"); } } #endif // ASSERT @@ -2129,7 +2127,7 @@ void Parse::call_register_finalizer() { Node* klass_addr = basic_plus_adr( receiver, receiver, oopDesc::klass_offset_in_bytes() ); Node* klass = _gvn.transform(LoadKlassNode::make(_gvn, immutable_memory(), klass_addr, TypeInstPtr::KLASS)); - Node* access_flags_addr = basic_plus_adr(klass, klass, in_bytes(Klass::misc_flags_offset())); + Node* access_flags_addr = basic_plus_adr(top(), klass, in_bytes(Klass::misc_flags_offset())); Node* access_flags = make_load(nullptr, access_flags_addr, TypeInt::UBYTE, T_BOOLEAN, MemNode::unordered); Node* mask = _gvn.transform(new AndINode(access_flags, intcon(KlassFlags::_misc_has_finalizer))); diff --git a/src/hotspot/share/opto/parseHelper.cpp b/src/hotspot/share/opto/parseHelper.cpp index 1a1cea05454..2e8fca68a8d 100644 --- a/src/hotspot/share/opto/parseHelper.cpp +++ b/src/hotspot/share/opto/parseHelper.cpp @@ -220,7 +220,7 @@ void Parse::array_store_check() { // Extract the array element class int element_klass_offset = in_bytes(ObjArrayKlass::element_klass_offset()); - Node* p2 = basic_plus_adr(array_klass, array_klass, element_klass_offset); + Node* p2 = basic_plus_adr(top(), array_klass, element_klass_offset); Node* a_e_klass = _gvn.transform(LoadKlassNode::make(_gvn, immutable_memory(), p2, tak)); assert(array_klass->is_Con() == a_e_klass->is_Con() || StressReflectiveCode, "a constant array type must come with a constant element type"); diff --git a/src/hotspot/share/opto/subtypenode.cpp b/src/hotspot/share/opto/subtypenode.cpp index b58194b87d2..8e4c7d829a7 100644 --- a/src/hotspot/share/opto/subtypenode.cpp +++ b/src/hotspot/share/opto/subtypenode.cpp @@ -182,7 +182,7 @@ bool SubTypeCheckNode::verify(PhaseGVN* phase) { return verify_helper(phase, load_klass(phase), cached_t); } case Compile::SSC_full_test: { - Node* p1 = phase->transform(new AddPNode(superklass, superklass, phase->MakeConX(in_bytes(Klass::super_check_offset_offset())))); + Node* p1 = phase->transform(new AddPNode(C->top(), superklass, phase->MakeConX(in_bytes(Klass::super_check_offset_offset())))); Node* chk_off = phase->transform(new LoadINode(nullptr, C->immutable_memory(), p1, phase->type(p1)->is_ptr(), TypeInt::INT, MemNode::unordered)); record_for_cleanup(chk_off, phase); @@ -194,7 +194,7 @@ bool SubTypeCheckNode::verify(PhaseGVN* phase) { #ifdef _LP64 chk_off_X = phase->transform(new ConvI2LNode(chk_off_X)); #endif - Node* p2 = phase->transform(new AddPNode(subklass, subklass, chk_off_X)); + Node* p2 = phase->transform(new AddPNode(C->top(), subklass, chk_off_X)); Node* nkls = phase->transform(LoadKlassNode::make(*phase, C->immutable_memory(), p2, phase->type(p2)->is_ptr(), TypeInstKlassPtr::OBJECT_OR_NULL)); return verify_helper(phase, nkls, cached_t); diff --git a/src/hotspot/share/opto/type.cpp b/src/hotspot/share/opto/type.cpp index ecb8c2c1cd8..c637737eef9 100644 --- a/src/hotspot/share/opto/type.cpp +++ b/src/hotspot/share/opto/type.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 @@ -1816,6 +1816,13 @@ bool TypeInt::contains(const TypeInt* t) const { return TypeIntHelper::int_type_is_subset(this, t); } +#ifdef ASSERT +bool TypeInt::strictly_contains(const TypeInt* t) const { + assert(!_is_dual && !t->_is_dual, "dual types should only be used for join calculation"); + return TypeIntHelper::int_type_is_subset(this, t) && !TypeIntHelper::int_type_is_equal(this, t); +} +#endif // ASSERT + const Type* TypeInt::xmeet(const Type* t) const { return TypeIntHelper::int_type_xmeet(this, t); } @@ -1944,6 +1951,13 @@ bool TypeLong::contains(const TypeLong* t) const { return TypeIntHelper::int_type_is_subset(this, t); } +#ifdef ASSERT +bool TypeLong::strictly_contains(const TypeLong* t) const { + assert(!_is_dual && !t->_is_dual, "dual types should only be used for join calculation"); + return TypeIntHelper::int_type_is_subset(this, t) && !TypeIntHelper::int_type_is_equal(this, t); +} +#endif // ASSERT + const Type* TypeLong::xmeet(const Type* t) const { return TypeIntHelper::int_type_xmeet(this, t); } @@ -2443,6 +2457,12 @@ const TypeVect* TypeVect::make(BasicType elem_bt, uint length, bool is_mask) { return nullptr; } +// Create a vector mask type with the given element basic type and length. +// - Returns "TypeVectMask" (PVectMask) for platforms that support the predicate +// feature and it is implemented properly in the backend, allowing the mask to +// be stored in a predicate/mask register. +// - Returns a normal vector type "TypeVectA ~ TypeVectZ" (NVectMask) otherwise, +// where the vector mask is stored in a vector register. const TypeVect* TypeVect::makemask(BasicType elem_bt, uint length) { if (Matcher::has_predicated_vectors() && Matcher::match_rule_supported_vector_masked(Op_VectorLoadMask, length, elem_bt)) { diff --git a/src/hotspot/share/opto/type.hpp b/src/hotspot/share/opto/type.hpp index 285b4984cd1..135f37f7267 100644 --- a/src/hotspot/share/opto/type.hpp +++ b/src/hotspot/share/opto/type.hpp @@ -812,6 +812,11 @@ public: bool contains(jint i) const; bool contains(const TypeInt* t) const; +#ifdef ASSERT + // Check whether t is a proper subset (i.e. a subset that is not equal to the superset) of this + bool strictly_contains(const TypeInt* t) const; +#endif // ASSERT + virtual bool is_finite() const; // Has a finite value virtual const Type* xmeet(const Type* t) const; @@ -897,6 +902,11 @@ public: bool contains(jlong i) const; bool contains(const TypeLong* t) const; +#ifdef ASSERT + // Check whether t is a proper subset (i.e. a subset that is not equal to the superset) of this + bool strictly_contains(const TypeLong* t) const; +#endif // ASSERT + // Check for positive 32-bit value. int is_positive_int() const { return _lo >= 0 && _hi <= (jlong)max_jint; } @@ -1018,7 +1028,7 @@ public: }; //------------------------------TypeVect--------------------------------------- -// Class of Vector Types +// Basic class of vector (mask) types. class TypeVect : public Type { const BasicType _elem_bt; // Vector's element type const uint _length; // Elements in vector (power of 2) @@ -1058,6 +1068,16 @@ public: #endif }; +// TypeVect subclasses representing vectors or vector masks with "BVectMask" or "NVectMask" +// layout (see vectornode.hpp for detailed notes on vector mask representations), mapped +// to vector registers and distinguished by vector register size: +// +// - TypeVectA: Scalable vector type (variable size, e.g., AArch64 SVE, RISC-V RVV) +// - TypeVectS: 32-bit vector type +// - TypeVectD: 64-bit vector type +// - TypeVectX: 128-bit vector type +// - TypeVectY: 256-bit vector type +// - TypeVectZ: 512-bit vector type class TypeVectA : public TypeVect { friend class TypeVect; TypeVectA(BasicType elem_bt, uint length) : TypeVect(VectorA, elem_bt, length) {} @@ -1088,6 +1108,9 @@ class TypeVectZ : public TypeVect { TypeVectZ(BasicType elem_bt, uint length) : TypeVect(VectorZ, elem_bt, length) {} }; +// Class of TypeVectMask, representing vector masks with "PVectMask" layout (see +// vectornode.hpp for detailed notes on vector mask representations), mapped to +// dedicated hardware predicate/mask registers. class TypeVectMask : public TypeVect { public: friend class TypeVect; diff --git a/src/hotspot/share/opto/vectorIntrinsics.cpp b/src/hotspot/share/opto/vectorIntrinsics.cpp index b48b5f2cd05..65d54e076b6 100644 --- a/src/hotspot/share/opto/vectorIntrinsics.cpp +++ b/src/hotspot/share/opto/vectorIntrinsics.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 @@ -25,6 +25,7 @@ #include "ci/ciSymbols.hpp" #include "classfile/vmSymbols.hpp" #include "opto/library_call.hpp" +#include "opto/rootnode.hpp" #include "opto/runtime.hpp" #include "opto/vectornode.hpp" #include "prims/vectorSupport.hpp" @@ -73,6 +74,11 @@ static bool is_vector_mask(ciKlass* klass) { return klass->is_subclass_of(ciEnv::current()->vector_VectorMask_klass()); } +static Node* trace_vector(Node* operation) { + VectorNode::trace_new_vector(operation, "VectorAPI"); + return operation; +} + bool LibraryCallKit::arch_supports_vector_rotate(int opc, int num_elem, BasicType elem_bt, VectorMaskUseType mask_use_type, bool has_scalar_args) { bool is_supported = true; @@ -457,7 +463,7 @@ bool LibraryCallKit::inline_vector_nary_operation(int n) { } default: fatal("unsupported arity: %d", n); } - + trace_vector(operation); if (is_masked_op && mask != nullptr) { if (use_predicate) { operation->add_req(mask); @@ -465,7 +471,7 @@ bool LibraryCallKit::inline_vector_nary_operation(int n) { } else { operation->add_flag(Node::Flag_is_predicated_using_blend); operation = gvn().transform(operation); - operation = new VectorBlendNode(opd1, operation, mask); + operation = trace_vector(new VectorBlendNode(opd1, operation, mask)); } } operation = gvn().transform(operation); @@ -626,7 +632,7 @@ bool LibraryCallKit::inline_vector_mask_operation() { mask_vec = gvn().transform(VectorStoreMaskNode::make(gvn(), mask_vec, elem_bt, num_elem)); } const Type* maskoper_ty = mopc == Op_VectorMaskToLong ? (const Type*)TypeLong::LONG : (const Type*)TypeInt::INT; - Node* maskoper = gvn().transform(VectorMaskOpNode::make(mask_vec, maskoper_ty, mopc)); + Node* maskoper = gvn().transform(trace_vector(VectorMaskOpNode::make(mask_vec, maskoper_ty, mopc))); if (mopc != Op_VectorMaskToLong) { maskoper = ConvI2L(maskoper); } @@ -709,10 +715,10 @@ bool LibraryCallKit::inline_vector_frombits_coerced() { if (opc == Op_VectorLongToMask) { const TypeVect* vt = TypeVect::makemask(elem_bt, num_elem); if (Matcher::mask_op_prefers_predicate(opc, vt)) { - broadcast = gvn().transform(new VectorLongToMaskNode(elem, vt)); + broadcast = gvn().transform(trace_vector(new VectorLongToMaskNode(elem, vt))); } else { const TypeVect* mvt = TypeVect::make(T_BOOLEAN, num_elem); - broadcast = gvn().transform(new VectorLongToMaskNode(elem, mvt)); + broadcast = gvn().transform(trace_vector(new VectorLongToMaskNode(elem, mvt))); broadcast = gvn().transform(new VectorLoadMaskNode(broadcast, vt)); } } else { @@ -740,7 +746,7 @@ bool LibraryCallKit::inline_vector_frombits_coerced() { } default: fatal("%s", type2name(elem_bt)); } - broadcast = VectorNode::scalar2vector(elem, num_elem, elem_bt, is_mask); + broadcast = trace_vector(VectorNode::scalar2vector(elem, num_elem, elem_bt, is_mask)); broadcast = gvn().transform(broadcast); } @@ -926,22 +932,22 @@ bool LibraryCallKit::inline_vector_mem_operation(bool is_store) { if (is_mask) { val = gvn().transform(VectorStoreMaskNode::make(gvn(), val, elem_bt, num_elem)); } - Node* vstore = gvn().transform(StoreVectorNode::make(0, control(), memory(addr), addr, addr_type, val, store_num_elem)); + Node* vstore = gvn().transform(trace_vector(StoreVectorNode::make(0, control(), memory(addr), addr, addr_type, val, store_num_elem))); set_memory(vstore, addr_type); } else { // When using byte array, we need to load as byte then reinterpret the value. Otherwise, do a simple vector load. Node* vload = nullptr; if (mismatched_ms) { - vload = gvn().transform(LoadVectorNode::make(0, control(), memory(addr), addr, addr_type, mem_num_elem, mem_elem_bt)); + vload = gvn().transform(trace_vector(LoadVectorNode::make(0, control(), memory(addr), addr, addr_type, mem_num_elem, mem_elem_bt))); const TypeVect* to_vect_type = TypeVect::make(elem_bt, num_elem); vload = gvn().transform(new VectorReinterpretNode(vload, vload->bottom_type()->is_vect(), to_vect_type)); } else { // Special handle for masks if (is_mask) { - vload = gvn().transform(LoadVectorNode::make(0, control(), memory(addr), addr, addr_type, num_elem, T_BOOLEAN)); + vload = gvn().transform(trace_vector(LoadVectorNode::make(0, control(), memory(addr), addr, addr_type, num_elem, T_BOOLEAN))); vload = gvn().transform(new VectorLoadMaskNode(vload, TypeVect::makemask(elem_bt, num_elem))); } else { - vload = gvn().transform(LoadVectorNode::make(0, control(), memory(addr), addr, addr_type, num_elem, elem_bt)); + vload = gvn().transform(trace_vector(LoadVectorNode::make(0, control(), memory(addr), addr, addr_type, num_elem, elem_bt))); } } Node* box = box_vector(vload, vbox_type, elem_bt, num_elem); @@ -1139,7 +1145,7 @@ bool LibraryCallKit::inline_vector_mem_masked_operation(bool is_store) { const TypeVect* to_mask_type = TypeVect::makemask(mem_elem_bt, mem_num_elem); mask = gvn().transform(new VectorReinterpretNode(mask, from_mask_type, to_mask_type)); } - Node* vstore = gvn().transform(new StoreVectorMaskedNode(control(), memory(addr), addr, val, addr_type, mask)); + Node* vstore = gvn().transform(trace_vector(new StoreVectorMaskedNode(control(), memory(addr), addr, val, addr_type, mask))); set_memory(vstore, addr_type); } else { Node* vload = nullptr; @@ -1154,13 +1160,13 @@ bool LibraryCallKit::inline_vector_mem_masked_operation(bool is_store) { if (supports_predicate) { // Generate masked load vector node if predicate feature is supported. const TypeVect* vt = TypeVect::make(mem_elem_bt, mem_num_elem); - vload = gvn().transform(new LoadVectorMaskedNode(control(), memory(addr), addr, addr_type, vt, mask)); + vload = gvn().transform(trace_vector(new LoadVectorMaskedNode(control(), memory(addr), addr, addr_type, vt, mask))); } else { // Use the vector blend to implement the masked load vector. The biased elements are zeros. Node* zero = gvn().transform(gvn().zerocon(mem_elem_bt)); zero = gvn().transform(VectorNode::scalar2vector(zero, mem_num_elem, mem_elem_bt)); - vload = gvn().transform(LoadVectorNode::make(0, control(), memory(addr), addr, addr_type, mem_num_elem, mem_elem_bt)); - vload = gvn().transform(new VectorBlendNode(zero, vload, mask)); + vload = gvn().transform(trace_vector(LoadVectorNode::make(0, control(), memory(addr), addr, addr_type, mem_num_elem, mem_elem_bt))); + vload = gvn().transform(trace_vector(new VectorBlendNode(zero, vload, mask))); } if (mismatched_ms) { @@ -1364,17 +1370,17 @@ bool LibraryCallKit::inline_vector_gather_scatter(bool is_scatter) { Node* vstore = nullptr; if (mask != nullptr) { - vstore = gvn().transform(new StoreVectorScatterMaskedNode(control(), memory(addr), addr, addr_type, val, indexes, mask)); + vstore = gvn().transform(trace_vector(new StoreVectorScatterMaskedNode(control(), memory(addr), addr, addr_type, val, indexes, mask))); } else { - vstore = gvn().transform(new StoreVectorScatterNode(control(), memory(addr), addr, addr_type, val, indexes)); + vstore = gvn().transform(trace_vector(new StoreVectorScatterNode(control(), memory(addr), addr, addr_type, val, indexes))); } set_memory(vstore, addr_type); } else { Node* vload = nullptr; if (mask != nullptr) { - vload = gvn().transform(new LoadVectorGatherMaskedNode(control(), memory(addr), addr, addr_type, vector_type, indexes, mask)); + vload = gvn().transform(trace_vector(new LoadVectorGatherMaskedNode(control(), memory(addr), addr, addr_type, vector_type, indexes, mask))); } else { - vload = gvn().transform(new LoadVectorGatherNode(control(), memory(addr), addr, addr_type, vector_type, indexes)); + vload = gvn().transform(trace_vector(new LoadVectorGatherNode(control(), memory(addr), addr, addr_type, vector_type, indexes))); } Node* box = box_vector(vload, vbox_type, elem_bt, num_elem); set_result(box); @@ -1492,7 +1498,7 @@ bool LibraryCallKit::inline_vector_reduction() { // Make an unordered Reduction node. This affects only AddReductionVF/VD and MulReductionVF/VD, // as these operations are allowed to be associative (not requiring strict order) in VectorAPI. - value = ReductionNode::make(opc, nullptr, init, value, elem_bt, /* requires_strict_order */ false); + value = trace_vector(ReductionNode::make(opc, nullptr, init, value, elem_bt, /* requires_strict_order */ false)); if (mask != nullptr && use_predicate) { value->add_req(mask); @@ -1584,7 +1590,7 @@ bool LibraryCallKit::inline_vector_test() { return false; // operand unboxing failed } - Node* cmp = gvn().transform(new VectorTestNode(opd1, opd2, booltest)); + Node* cmp = gvn().transform(trace_vector(new VectorTestNode(opd1, opd2, booltest))); BoolTest::mask test = Matcher::vectortest_mask(booltest == BoolTest::overflow, opd1->bottom_type()->isa_vectmask(), num_elem); Node* bol = gvn().transform(new BoolNode(cmp, test)); @@ -1652,7 +1658,7 @@ bool LibraryCallKit::inline_vector_blend() { return false; // operand unboxing failed } - Node* blend = gvn().transform(new VectorBlendNode(v1, v2, mask)); + Node* blend = gvn().transform(trace_vector(new VectorBlendNode(v1, v2, mask))); Node* box = box_vector(blend, vbox_type, elem_bt, num_elem); set_result(box); @@ -1747,6 +1753,7 @@ bool LibraryCallKit::inline_vector_compare() { const TypeVect* vmask_type = TypeVect::makemask(mask_bt, num_elem); Node* operation = new VectorMaskCmpNode(pred, v1, v2, pred_node, vmask_type); + trace_vector(operation); if (is_masked_op) { if (use_predicate) { @@ -1886,6 +1893,7 @@ bool LibraryCallKit::inline_vector_rearrange() { } Node* rearrange = new VectorRearrangeNode(v1, shuffle); + trace_vector(rearrange); if (is_masked_op) { if (use_predicate) { rearrange->add_req(mask); @@ -2033,6 +2041,7 @@ bool LibraryCallKit::inline_vector_select_from() { // and finally rearrange Node* rearrange = new VectorRearrangeNode(v2, shuffle); + trace_vector(rearrange); if (is_masked_op) { if (use_predicate) { // masked rearrange is supported so use that directly @@ -2192,6 +2201,7 @@ bool LibraryCallKit::inline_vector_broadcast_int() { } Node* operation = VectorNode::make(opc, opd1, opd2, num_elem, elem_bt); + trace_vector(operation); if (is_masked_op && mask != nullptr) { if (use_predicate) { operation->add_req(mask); @@ -2330,6 +2340,21 @@ bool LibraryCallKit::inline_vector_convert() { Node* op = opd1; if (is_cast) { assert(!is_mask || num_elem_from == num_elem_to, "vector mask cast needs the same elem num"); + + // Make sure the precondition of VectorCastNode::opcode holds: we can only have + // unsigned casts for integral types (excluding long). VectorAPI code is not + // expected to violate this at runtime, but we may compile unreachable code + // where such impossible combinations arise. + if (is_ucast && (!is_integral_type(elem_bt_from) || elem_bt_from == T_LONG)) { + // Halt-and-catch fire here. This condition should never happen at runtime. + stringStream ss; + ss.print("impossible combination: unsigned vector cast from %s", type2name(elem_bt_from)); + halt(control(), frameptr(), ss.as_string(C->comp_arena())); + stop_and_kill_map(); + log_if_needed(" ** impossible combination: unsigned cast from %s", type2name(elem_bt_from)); + return true; + } + int cast_vopc = VectorCastNode::opcode(-1, elem_bt_from, !is_ucast); // Make sure that vector cast is implemented to particular type/size combination if it is @@ -2354,7 +2379,7 @@ bool LibraryCallKit::inline_vector_convert() { return false; } - op = gvn().transform(VectorCastNode::make(cast_vopc, op, elem_bt_to, num_elem_for_cast)); + op = gvn().transform(trace_vector(VectorCastNode::make(cast_vopc, op, elem_bt_to, num_elem_for_cast))); // Now ensure that the destination gets properly resized to needed size. op = gvn().transform(new VectorReinterpretNode(op, op->bottom_type()->is_vect(), dst_type)); } else if (num_elem_from > num_elem_to) { @@ -2375,7 +2400,7 @@ bool LibraryCallKit::inline_vector_convert() { const TypeVect* resize_type = TypeVect::make(elem_bt_from, num_elem_for_resize); op = gvn().transform(new VectorReinterpretNode(op, src_type, resize_type)); - op = gvn().transform(VectorCastNode::make(cast_vopc, op, elem_bt_to, num_elem_to)); + op = gvn().transform(trace_vector(VectorCastNode::make(cast_vopc, op, elem_bt_to, num_elem_to))); } else { // num_elem_from == num_elem_to if (is_mask) { // Make sure that cast for vector mask is implemented to particular type/size combination. @@ -2384,16 +2409,16 @@ bool LibraryCallKit::inline_vector_convert() { num_elem_to, type2name(elem_bt_to), is_mask); return false; } - op = gvn().transform(new VectorMaskCastNode(op, dst_type)); + op = gvn().transform(trace_vector(new VectorMaskCastNode(op, dst_type))); } else { // Since input and output number of elements match, and since we know this vector size is // supported, simply do a cast with no resize needed. - op = gvn().transform(VectorCastNode::make(cast_vopc, op, elem_bt_to, num_elem_to)); + op = gvn().transform(trace_vector(VectorCastNode::make(cast_vopc, op, elem_bt_to, num_elem_to))); } } } else if (!Type::equals(src_type, dst_type)) { assert(!is_cast, "must be reinterpret"); - op = gvn().transform(new VectorReinterpretNode(op, src_type, dst_type)); + op = gvn().transform(trace_vector(new VectorReinterpretNode(op, src_type, dst_type))); } const TypeInstPtr* vbox_type_to = TypeInstPtr::make_exact(TypePtr::NotNull, vbox_klass_to); @@ -2478,7 +2503,7 @@ bool LibraryCallKit::inline_vector_insert() { default: fatal("%s", type2name(elem_bt)); break; } - Node* operation = gvn().transform(VectorInsertNode::make(opd, insert_val, idx->get_con(), gvn())); + Node* operation = gvn().transform(trace_vector(VectorInsertNode::make(opd, insert_val, idx->get_con(), gvn()))); Node* vbox = box_vector(operation, vbox_type, elem_bt, num_elem); set_result(vbox); @@ -2536,7 +2561,7 @@ bool LibraryCallKit::inline_vector_extract() { if (opd == nullptr) { return false; } - opd = gvn().transform(VectorStoreMaskNode::make(gvn(), opd, elem_bt, num_elem)); + opd = gvn().transform(trace_vector(VectorStoreMaskNode::make(gvn(), opd, elem_bt, num_elem))); opd = gvn().transform(new ExtractUBNode(opd, pos)); opd = gvn().transform(new ConvI2LNode(opd)); } else if (arch_supports_vector(Op_VectorMaskToLong, num_elem, elem_bt, VecMaskUseLoad)) { @@ -2546,7 +2571,7 @@ bool LibraryCallKit::inline_vector_extract() { } // VectorMaskToLongNode requires the input is either a mask or a vector with BOOLEAN type. if (!Matcher::mask_op_prefers_predicate(Op_VectorMaskToLong, opd->bottom_type()->is_vect())) { - opd = gvn().transform(VectorStoreMaskNode::make(gvn(), opd, elem_bt, num_elem)); + opd = gvn().transform(trace_vector(VectorStoreMaskNode::make(gvn(), opd, elem_bt, num_elem))); } // ((toLong() >>> pos) & 1L opd = gvn().transform(new VectorMaskToLongNode(opd, TypeLong::LONG)); @@ -2664,8 +2689,8 @@ static Node* LowerSelectFromTwoVectorOperation(PhaseGVN& phase, Node* index_vec, vmask_type = TypeVect::makemask(elem_bt, num_elem); mask = phase.transform(new VectorMaskCastNode(mask, vmask_type)); - Node* p1 = phase.transform(new VectorRearrangeNode(src1, wrapped_index_vec)); - Node* p2 = phase.transform(new VectorRearrangeNode(src2, wrapped_index_vec)); + Node* p1 = phase.transform(trace_vector(new VectorRearrangeNode(src1, wrapped_index_vec))); + Node* p2 = phase.transform(trace_vector(new VectorRearrangeNode(src2, wrapped_index_vec))); return new VectorBlendNode(p2, p1, mask); } @@ -2783,7 +2808,7 @@ bool LibraryCallKit::inline_vector_select_from_two_vectors() { Node* wrap_mask = gvn().makecon(TypeInteger::make(indexRangeMask, indexRangeMask, Type::WidenMin, index_elem_bt != T_LONG ? T_INT : index_elem_bt)); Node* wrap_mask_vec = gvn().transform(VectorNode::scalar2vector(wrap_mask, num_elem, index_elem_bt, false)); opd1 = gvn().transform(VectorNode::make(Op_AndV, opd1, wrap_mask_vec, opd1->bottom_type()->is_vect())); - operation = gvn().transform(VectorNode::make(Op_SelectFromTwoVector, opd1, opd2, opd3, vt)); + operation = gvn().transform(trace_vector(VectorNode::make(Op_SelectFromTwoVector, opd1, opd2, opd3, vt))); } // Wrap it up in VectorBox to keep object type information. @@ -2868,7 +2893,7 @@ bool LibraryCallKit::inline_vector_compress_expand() { } const TypeVect* vt = TypeVect::make(elem_bt, num_elem, opc == Op_CompressM); - Node* operation = gvn().transform(VectorNode::make(opc, opd1, mask, vt)); + Node* operation = gvn().transform(trace_vector(VectorNode::make(opc, opd1, mask, vt))); // Wrap it up in VectorBox to keep object type information. const TypeInstPtr* box_type = opc == Op_CompressM ? mbox_type : vbox_type; @@ -3001,12 +3026,12 @@ bool LibraryCallKit::inline_index_vector() { default: fatal("%s", type2name(elem_bt)); } scale = gvn().transform(VectorNode::scalar2vector(scale, num_elem, elem_bt)); - index = gvn().transform(VectorNode::make(vmul_op, index, scale, vt)); + index = gvn().transform(trace_vector(VectorNode::make(vmul_op, index, scale, vt))); } // Add "opd" if addition is needed. if (needs_add) { - index = gvn().transform(VectorNode::make(vadd_op, opd, index, vt)); + index = gvn().transform(trace_vector(VectorNode::make(vadd_op, opd, index, vt))); } Node* vbox = box_vector(index, vbox_type, elem_bt, num_elem); set_result(vbox); @@ -3123,7 +3148,7 @@ bool LibraryCallKit::inline_index_partially_in_upper_range() { // Compute the vector mask with "mask = iota < indexLimit". ConINode* pred_node = (ConINode*)gvn().makecon(TypeInt::make(BoolTest::lt)); const TypeVect* vmask_type = TypeVect::makemask(elem_bt, num_elem); - mask = gvn().transform(new VectorMaskCmpNode(BoolTest::lt, iota, indexLimit, pred_node, vmask_type)); + mask = gvn().transform(trace_vector(new VectorMaskCmpNode(BoolTest::lt, iota, indexLimit, pred_node, vmask_type))); } Node* vbox = box_vector(mask, box_type, elem_bt, num_elem); set_result(vbox); diff --git a/src/hotspot/share/opto/vectornode.hpp b/src/hotspot/share/opto/vectornode.hpp index dc7aa13cf36..b1976d8f0db 100644 --- a/src/hotspot/share/opto/vectornode.hpp +++ b/src/hotspot/share/opto/vectornode.hpp @@ -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 @@ -33,7 +33,63 @@ #include "opto/opcodes.hpp" #include "prims/vectorSupport.hpp" -//------------------------------VectorNode------------------------------------- +//=======================Notes-for-VectorMask-Representation======================= +// +// There are three distinct representations for vector masks based on platform and +// use scenarios: +// +// - BVectMask: Platform-independent mask stored in a vector register with 8-bit +// lanes containing 1/0 values. The corresponding type is TypeVectA ~ TypeVectZ. +// +// - NVectMask: Platform-specific mask stored in vector registers with N-bit lanes, +// where all bits in each lane are either set (true) or unset (false). Generated +// on architectures without predicate/mask feature, such as AArch64 NEON, x86 +// AVX2, etc. The corresponding type is TypeVectA ~ TypeVectZ. +// +// - PVectMask: Platform-specific mask stored in predicate/mask registers. Generated +// on architectures with predicate/mask feature, such as AArch64 SVE, x86 AVX-512, +// and RISC-V Vector Extension (RVV). The corresponding type is TypeVectMask. +// +// NVectMask and PVectMask encode element data type and vector length information. +// They are the primary mask representations used in most mask and masked vector +// operations. BVectMask primarily represents mask values loaded from or stored to +// Java boolean memory (mask backing storage). VectorLoadMask/VectorStoreMask nodes +// are needed to transform it to/from P/NVectMask. It is also used in certain mask +// operations (e.g. VectorMaskOpNode). +// +//=========================Notes-for-Masked-Vector-Nodes=========================== +// +// Each lane-wise and cross-lane (reduction) ALU node supports both non-masked +// and masked operations. +// +// Currently masked vector nodes are only used to implement the Vector API's masked +// operations (which might also be used for auto-vectorization in future), such as: +// Vector lanewise(VectorOperators.Binary op, Vector v, VectorMask m) +// +// They are generated during intrinsification for Vector API, only on architectures +// that support the relevant predicated instructions. The compiler uses +// "Matcher::match_rule_supported_vector_masked()" to check whether the current +// platform supports the predicated/masked vector instructions for an operation. It +// generates the masked vector node for the operation if supported. Otherwise, it +// generates the unpredicated vector node and implements the masked operation with +// the help of a VectorBlendNode. Please see more details from API intrinsification +// in vectorIntrinsics.cpp. +// +// To differentiate the masked and non-masked nodes, flag "Flag_is_predicated_vector" +// is set for the masked version. Meanwhile, there is an additional mask input for +// the masked nodes. +// +// For example: +// - Non-masked version: +// in1 in2 +// \ / +// AddVBNode +// +// - Masked version (with "Flag_is_predicated_vector" being set): +// in1 in2 mask +// \ | / +// AddVBNode + // Vector Operation class VectorNode : public TypeNode { public: @@ -103,6 +159,8 @@ class VectorNode : public TypeNode { static bool implemented(int opc, uint vlen, BasicType bt); static bool is_shift(Node* n); static bool is_vshift_cnt(Node* n); + // Returns true if the lower vlen bits (bits [0, vlen-1]) of the long value + // are all 1s or all 0s, indicating a "mask all" or "mask none" pattern. static bool is_maskall_type(const TypeLong* type, int vlen); static bool is_muladds2i(const Node* n); static bool is_roundopD(Node* n); @@ -176,7 +234,6 @@ class SaturatingVectorNode : public VectorNode { bool is_unsigned() { return _is_unsigned; } }; -//------------------------------AddVBNode-------------------------------------- // Vector add byte class AddVBNode : public VectorNode { public: @@ -184,7 +241,6 @@ class AddVBNode : public VectorNode { virtual int Opcode() const; }; -//------------------------------AddVSNode-------------------------------------- // Vector add char/short class AddVSNode : public VectorNode { public: @@ -192,7 +248,6 @@ class AddVSNode : public VectorNode { virtual int Opcode() const; }; -//------------------------------AddVINode-------------------------------------- // Vector add int class AddVINode : public VectorNode { public: @@ -200,7 +255,6 @@ class AddVINode : public VectorNode { virtual int Opcode() const; }; -//------------------------------AddVLNode-------------------------------------- // Vector add long class AddVLNode : public VectorNode { public: @@ -208,7 +262,6 @@ public: virtual int Opcode() const; }; -//------------------------------AddVHFNode-------------------------------------- // Vector add float class AddVHFNode : public VectorNode { public: @@ -216,7 +269,6 @@ public: virtual int Opcode() const; }; -//------------------------------AddVFNode-------------------------------------- // Vector add float class AddVFNode : public VectorNode { public: @@ -224,7 +276,6 @@ public: virtual int Opcode() const; }; -//------------------------------AddVDNode-------------------------------------- // Vector add double class AddVDNode : public VectorNode { public: @@ -232,7 +283,6 @@ public: virtual int Opcode() const; }; -//------------------------------ReductionNode------------------------------------ // Perform reduction of a vector class ReductionNode : public Node { private: @@ -294,7 +344,6 @@ class ReductionNode : public Node { #endif }; -//------------------------------AddReductionVINode-------------------------------------- // Vector add byte, short and int as a reduction class AddReductionVINode : public ReductionNode { public: @@ -302,7 +351,6 @@ public: virtual int Opcode() const; }; -//------------------------------AddReductionVLNode-------------------------------------- // Vector add long as a reduction class AddReductionVLNode : public ReductionNode { public: @@ -310,7 +358,6 @@ public: virtual int Opcode() const; }; -//------------------------------AddReductionVFNode-------------------------------------- // Vector add float as a reduction class AddReductionVFNode : public ReductionNode { private: @@ -337,7 +384,6 @@ public: virtual uint size_of() const { return sizeof(*this); } }; -//------------------------------AddReductionVDNode-------------------------------------- // Vector add double as a reduction class AddReductionVDNode : public ReductionNode { private: @@ -364,7 +410,6 @@ public: virtual uint size_of() const { return sizeof(*this); } }; -//------------------------------SubVBNode-------------------------------------- // Vector subtract byte class SubVBNode : public VectorNode { public: @@ -372,7 +417,6 @@ class SubVBNode : public VectorNode { virtual int Opcode() const; }; -//------------------------------SubVSNode-------------------------------------- // Vector subtract short class SubVSNode : public VectorNode { public: @@ -380,7 +424,6 @@ class SubVSNode : public VectorNode { virtual int Opcode() const; }; -//------------------------------SubVINode-------------------------------------- // Vector subtract int class SubVINode : public VectorNode { public: @@ -388,7 +431,6 @@ class SubVINode : public VectorNode { virtual int Opcode() const; }; -//------------------------------SubVLNode-------------------------------------- // Vector subtract long class SubVLNode : public VectorNode { public: @@ -396,7 +438,6 @@ class SubVLNode : public VectorNode { virtual int Opcode() const; }; -//------------------------------SaturatingAddVNode----------------------------- // Vector saturating addition. class SaturatingAddVNode : public SaturatingVectorNode { public: @@ -404,7 +445,6 @@ class SaturatingAddVNode : public SaturatingVectorNode { virtual int Opcode() const; }; -//------------------------------SaturatingSubVNode----------------------------- // Vector saturating subtraction. class SaturatingSubVNode : public SaturatingVectorNode { public: @@ -412,7 +452,6 @@ class SaturatingSubVNode : public SaturatingVectorNode { virtual int Opcode() const; }; -//------------------------------SubVHFNode-------------------------------------- // Vector subtract half float class SubVHFNode : public VectorNode { public: @@ -420,8 +459,6 @@ public: virtual int Opcode() const; }; - -//------------------------------SubVFNode-------------------------------------- // Vector subtract float class SubVFNode : public VectorNode { public: @@ -429,7 +466,6 @@ class SubVFNode : public VectorNode { virtual int Opcode() const; }; -//------------------------------SubVDNode-------------------------------------- // Vector subtract double class SubVDNode : public VectorNode { public: @@ -437,7 +473,6 @@ class SubVDNode : public VectorNode { virtual int Opcode() const; }; -//------------------------------MulVBNode-------------------------------------- // Vector multiply byte class MulVBNode : public VectorNode { public: @@ -445,7 +480,6 @@ class MulVBNode : public VectorNode { virtual int Opcode() const; }; -//------------------------------MulVSNode-------------------------------------- // Vector multiply short class MulVSNode : public VectorNode { public: @@ -453,7 +487,6 @@ class MulVSNode : public VectorNode { virtual int Opcode() const; }; -//------------------------------MulVINode-------------------------------------- // Vector multiply int class MulVINode : public VectorNode { public: @@ -461,7 +494,6 @@ class MulVINode : public VectorNode { virtual int Opcode() const; }; -//------------------------------MulVLNode-------------------------------------- // Vector multiply long class MulVLNode : public VectorNode { public: @@ -473,7 +505,6 @@ public: bool has_uint_inputs() const; }; -//------------------------------MulVFNode-------------------------------------- // Vector multiply half float class MulVHFNode : public VectorNode { public: @@ -481,7 +512,6 @@ public: virtual int Opcode() const; }; -//------------------------------MulVFNode-------------------------------------- // Vector multiply float class MulVFNode : public VectorNode { public: @@ -489,7 +519,6 @@ public: virtual int Opcode() const; }; -//------------------------------MulVDNode-------------------------------------- // Vector multiply double class MulVDNode : public VectorNode { public: @@ -497,7 +526,6 @@ public: virtual int Opcode() const; }; -//------------------------------MulAddVS2VINode-------------------------------- // Vector multiply shorts to int and add adjacent ints. class MulAddVS2VINode : public VectorNode { public: @@ -505,7 +533,6 @@ class MulAddVS2VINode : public VectorNode { virtual int Opcode() const; }; -//------------------------------FmaVNode-------------------------------------- // Vector fused-multiply-add class FmaVNode : public VectorNode { public: @@ -515,7 +542,6 @@ public: virtual Node* Ideal(PhaseGVN* phase, bool can_reshape); }; -//------------------------------FmaVDNode-------------------------------------- // Vector fused-multiply-add double class FmaVDNode : public FmaVNode { public: @@ -523,7 +549,6 @@ public: virtual int Opcode() const; }; -//------------------------------FmaVFNode-------------------------------------- // Vector fused-multiply-add float class FmaVFNode : public FmaVNode { public: @@ -531,7 +556,6 @@ public: virtual int Opcode() const; }; -//------------------------------FmaVHFNode------------------------------------- // Vector fused-multiply-add half-precision float class FmaVHFNode : public FmaVNode { public: @@ -539,7 +563,6 @@ public: virtual int Opcode() const; }; -//------------------------------MulReductionVINode-------------------------------------- // Vector multiply byte, short and int as a reduction class MulReductionVINode : public ReductionNode { public: @@ -547,7 +570,6 @@ public: virtual int Opcode() const; }; -//------------------------------MulReductionVLNode-------------------------------------- // Vector multiply int as a reduction class MulReductionVLNode : public ReductionNode { public: @@ -555,7 +577,6 @@ public: virtual int Opcode() const; }; -//------------------------------MulReductionVFNode-------------------------------------- // Vector multiply float as a reduction class MulReductionVFNode : public ReductionNode { // True if mul reduction operation for floats requires strict ordering. @@ -581,7 +602,6 @@ public: virtual uint size_of() const { return sizeof(*this); } }; -//------------------------------MulReductionVDNode-------------------------------------- // Vector multiply double as a reduction class MulReductionVDNode : public ReductionNode { // True if mul reduction operation for doubles requires strict ordering. @@ -607,7 +627,6 @@ public: virtual uint size_of() const { return sizeof(*this); } }; -//------------------------------DivVHFNode------------------------------------- // Vector divide half float class DivVHFNode : public VectorNode { public: @@ -615,7 +634,6 @@ public: virtual int Opcode() const; }; -//------------------------------DivVFNode-------------------------------------- // Vector divide float class DivVFNode : public VectorNode { public: @@ -623,7 +641,6 @@ class DivVFNode : public VectorNode { virtual int Opcode() const; }; -//------------------------------DivVDNode-------------------------------------- // Vector Divide double class DivVDNode : public VectorNode { public: @@ -631,7 +648,6 @@ class DivVDNode : public VectorNode { virtual int Opcode() const; }; -//------------------------------AbsVBNode-------------------------------------- // Vector Abs byte class AbsVBNode : public VectorNode { public: @@ -639,7 +655,6 @@ public: virtual int Opcode() const; }; -//------------------------------AbsVSNode-------------------------------------- // Vector Abs short class AbsVSNode : public VectorNode { public: @@ -647,7 +662,6 @@ public: virtual int Opcode() const; }; -//------------------------------MinVNode-------------------------------------- // Vector Min class MinVNode : public VectorNode { public: @@ -655,7 +669,6 @@ public: virtual int Opcode() const; }; -//------------------------------MinVHFNode------------------------------------ // Vector Min for half floats class MinVHFNode : public VectorNode { public: @@ -663,7 +676,6 @@ public: virtual int Opcode() const; }; -//------------------------------MaxVHFNode------------------------------------ // Vector Max for half floats class MaxVHFNode : public VectorNode { public: @@ -671,6 +683,7 @@ public: virtual int Opcode() const; }; +// Vector Unsigned Min class UMinVNode : public VectorNode { public: UMinVNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1, in2 ,vt) { @@ -681,8 +694,6 @@ class UMinVNode : public VectorNode { virtual int Opcode() const; }; - -//------------------------------MaxVNode-------------------------------------- // Vector Max class MaxVNode : public VectorNode { public: @@ -690,6 +701,7 @@ class MaxVNode : public VectorNode { virtual int Opcode() const; }; +// Vector Unsigned Max class UMaxVNode : public VectorNode { public: UMaxVNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1, in2, vt) { @@ -700,7 +712,6 @@ class UMaxVNode : public VectorNode { virtual int Opcode() const; }; -//------------------------------AbsVINode-------------------------------------- // Vector Abs int class AbsVINode : public VectorNode { public: @@ -708,7 +719,6 @@ class AbsVINode : public VectorNode { virtual int Opcode() const; }; -//------------------------------AbsVLNode-------------------------------------- // Vector Abs long class AbsVLNode : public VectorNode { public: @@ -716,7 +726,6 @@ public: virtual int Opcode() const; }; -//------------------------------AbsVFNode-------------------------------------- // Vector Abs float class AbsVFNode : public VectorNode { public: @@ -724,7 +733,6 @@ class AbsVFNode : public VectorNode { virtual int Opcode() const; }; -//------------------------------AbsVDNode-------------------------------------- // Vector Abs double class AbsVDNode : public VectorNode { public: @@ -732,7 +740,6 @@ class AbsVDNode : public VectorNode { virtual int Opcode() const; }; -//------------------------------NegVNode--------------------------------------- // Vector Neg parent class (not for code generation). class NegVNode : public VectorNode { public: @@ -746,7 +753,6 @@ class NegVNode : public VectorNode { Node* degenerate_integral_negate(PhaseGVN* phase, bool is_predicated); }; -//------------------------------NegVINode-------------------------------------- // Vector Neg byte/short/int class NegVINode : public NegVNode { public: @@ -754,7 +760,6 @@ class NegVINode : public NegVNode { virtual int Opcode() const; }; -//------------------------------NegVLNode-------------------------------------- // Vector Neg long class NegVLNode : public NegVNode { public: @@ -762,7 +767,6 @@ class NegVLNode : public NegVNode { virtual int Opcode() const; }; -//------------------------------NegVFNode-------------------------------------- // Vector Neg float class NegVFNode : public NegVNode { public: @@ -770,7 +774,6 @@ class NegVFNode : public NegVNode { virtual int Opcode() const; }; -//------------------------------NegVDNode-------------------------------------- // Vector Neg double class NegVDNode : public NegVNode { public: @@ -778,7 +781,6 @@ class NegVDNode : public NegVNode { virtual int Opcode() const; }; -//------------------------------PopCountVINode--------------------------------- // Vector popcount integer bits class PopCountVINode : public VectorNode { public: @@ -786,7 +788,6 @@ class PopCountVINode : public VectorNode { virtual int Opcode() const; }; -//------------------------------PopCountVLNode--------------------------------- // Vector popcount long bits class PopCountVLNode : public VectorNode { public: @@ -796,7 +797,6 @@ class PopCountVLNode : public VectorNode { virtual int Opcode() const; }; -//------------------------------SqrtVHFNode------------------------------------- // Vector Sqrt half-precision float class SqrtVHFNode : public VectorNode { public: @@ -804,14 +804,13 @@ public: virtual int Opcode() const; }; -//------------------------------SqrtVFNode-------------------------------------- // Vector Sqrt float class SqrtVFNode : public VectorNode { public: SqrtVFNode(Node* in, const TypeVect* vt) : VectorNode(in,vt) {} virtual int Opcode() const; }; -//------------------------------RoundDoubleVNode-------------------------------- + // Vector round double class RoundDoubleModeVNode : public VectorNode { public: @@ -819,7 +818,6 @@ class RoundDoubleModeVNode : public VectorNode { virtual int Opcode() const; }; -//------------------------------SqrtVDNode-------------------------------------- // Vector Sqrt double class SqrtVDNode : public VectorNode { public: @@ -827,8 +825,7 @@ class SqrtVDNode : public VectorNode { virtual int Opcode() const; }; -//------------------------------ShiftVNode----------------------------------- -// Class ShiftV functionality. This covers the common behaviors for all kinds +// Class ShiftV functionality. This covers the common behaviors for all kinds // of vector shifts. class ShiftVNode : public VectorNode { private: @@ -848,7 +845,6 @@ class ShiftVNode : public VectorNode { virtual uint size_of() const { return sizeof(ShiftVNode); } }; -//------------------------------LShiftVBNode----------------------------------- // Vector left shift bytes class LShiftVBNode : public ShiftVNode { public: @@ -857,7 +853,6 @@ class LShiftVBNode : public ShiftVNode { virtual int Opcode() const; }; -//------------------------------LShiftVSNode----------------------------------- // Vector left shift shorts class LShiftVSNode : public ShiftVNode { public: @@ -866,7 +861,6 @@ class LShiftVSNode : public ShiftVNode { virtual int Opcode() const; }; -//------------------------------LShiftVINode----------------------------------- // Vector left shift ints class LShiftVINode : public ShiftVNode { public: @@ -875,7 +869,6 @@ class LShiftVINode : public ShiftVNode { virtual int Opcode() const; }; -//------------------------------LShiftVLNode----------------------------------- // Vector left shift longs class LShiftVLNode : public ShiftVNode { public: @@ -884,7 +877,6 @@ class LShiftVLNode : public ShiftVNode { virtual int Opcode() const; }; -//------------------------------RShiftVBNode----------------------------------- // Vector right arithmetic (signed) shift bytes class RShiftVBNode : public ShiftVNode { public: @@ -893,7 +885,6 @@ class RShiftVBNode : public ShiftVNode { virtual int Opcode() const; }; -//------------------------------RShiftVSNode----------------------------------- // Vector right arithmetic (signed) shift shorts class RShiftVSNode : public ShiftVNode { public: @@ -902,7 +893,6 @@ class RShiftVSNode : public ShiftVNode { virtual int Opcode() const; }; -//------------------------------RShiftVINode----------------------------------- // Vector right arithmetic (signed) shift ints class RShiftVINode : public ShiftVNode { public: @@ -911,7 +901,6 @@ class RShiftVINode : public ShiftVNode { virtual int Opcode() const; }; -//------------------------------RShiftVLNode----------------------------------- // Vector right arithmetic (signed) shift longs class RShiftVLNode : public ShiftVNode { public: @@ -920,7 +909,6 @@ class RShiftVLNode : public ShiftVNode { virtual int Opcode() const; }; -//------------------------------URShiftVBNode---------------------------------- // Vector right logical (unsigned) shift bytes class URShiftVBNode : public ShiftVNode { public: @@ -929,7 +917,6 @@ class URShiftVBNode : public ShiftVNode { virtual int Opcode() const; }; -//------------------------------URShiftVSNode---------------------------------- // Vector right logical (unsigned) shift shorts class URShiftVSNode : public ShiftVNode { public: @@ -938,7 +925,6 @@ class URShiftVSNode : public ShiftVNode { virtual int Opcode() const; }; -//------------------------------URShiftVINode---------------------------------- // Vector right logical (unsigned) shift ints class URShiftVINode : public ShiftVNode { public: @@ -947,7 +933,6 @@ class URShiftVINode : public ShiftVNode { virtual int Opcode() const; }; -//------------------------------URShiftVLNode---------------------------------- // Vector right logical (unsigned) shift longs class URShiftVLNode : public ShiftVNode { public: @@ -956,7 +941,6 @@ class URShiftVLNode : public ShiftVNode { virtual int Opcode() const; }; -//------------------------------LShiftCntVNode--------------------------------- // Vector left shift count class LShiftCntVNode : public VectorNode { public: @@ -964,7 +948,6 @@ class LShiftCntVNode : public VectorNode { virtual int Opcode() const; }; -//------------------------------RShiftCntVNode--------------------------------- // Vector right shift count class RShiftCntVNode : public VectorNode { public: @@ -972,7 +955,6 @@ class RShiftCntVNode : public VectorNode { virtual int Opcode() const; }; -//------------------------------AndVNode--------------------------------------- // Vector and integer class AndVNode : public VectorNode { public: @@ -981,7 +963,6 @@ class AndVNode : public VectorNode { virtual Node* Identity(PhaseGVN* phase); }; -//------------------------------AndReductionVNode-------------------------------------- // Vector and byte, short, int, long as a reduction class AndReductionVNode : public ReductionNode { public: @@ -989,8 +970,7 @@ class AndReductionVNode : public ReductionNode { virtual int Opcode() const; }; -//------------------------------OrVNode--------------------------------------- -// Vector or byte, short, int, long as a reduction +// Vector or integer class OrVNode : public VectorNode { public: OrVNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {} @@ -998,15 +978,13 @@ class OrVNode : public VectorNode { virtual Node* Identity(PhaseGVN* phase); }; -//------------------------------OrReductionVNode-------------------------------------- -// Vector xor byte, short, int, long as a reduction +// Vector or byte, short, int, long as a reduction class OrReductionVNode : public ReductionNode { public: OrReductionVNode(Node* ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {} virtual int Opcode() const; }; -//------------------------------XorVNode--------------------------------------- // Vector xor integer class XorVNode : public VectorNode { public: @@ -1016,15 +994,13 @@ class XorVNode : public VectorNode { Node* Ideal_XorV_VectorMaskCmp(PhaseGVN* phase, bool can_reshape); }; -//------------------------------XorReductionVNode-------------------------------------- -// Vector and int, long as a reduction +// Vector xor byte, short, int, long as a reduction class XorReductionVNode : public ReductionNode { public: XorReductionVNode(Node* ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {} virtual int Opcode() const; }; -//------------------------------MinReductionVNode-------------------------------------- // Vector min byte, short, int, long, float, double as a reduction class MinReductionVNode : public ReductionNode { public: @@ -1032,15 +1008,13 @@ public: virtual int Opcode() const; }; -//------------------------------MaxReductionVNode-------------------------------------- -// Vector min byte, short, int, long, float, double as a reduction +// Vector max byte, short, int, long, float, double as a reduction class MaxReductionVNode : public ReductionNode { public: MaxReductionVNode(Node* ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {} virtual int Opcode() const; }; -//------------------------------CompressVNode-------------------------------------- // Vector compress class CompressVNode: public VectorNode { public: @@ -1051,6 +1025,7 @@ class CompressVNode: public VectorNode { virtual int Opcode() const; }; +// Vector mask compress class CompressMNode: public VectorNode { public: CompressMNode(Node* mask, const TypeVect* vt) : @@ -1060,7 +1035,6 @@ class CompressMNode: public VectorNode { virtual int Opcode() const; }; -//------------------------------ExpandVNode-------------------------------------- // Vector expand class ExpandVNode: public VectorNode { public: @@ -1073,7 +1047,6 @@ class ExpandVNode: public VectorNode { //================================= M E M O R Y =============================== -//------------------------------LoadVectorNode--------------------------------- // Load Vector from memory class LoadVectorNode : public LoadNode { private: @@ -1115,7 +1088,6 @@ class LoadVectorNode : public LoadNode { #endif }; -//------------------------------LoadVectorGatherNode------------------------------ // Load Vector from memory via index map class LoadVectorGatherNode : public LoadVectorNode { public: @@ -1138,7 +1110,6 @@ class LoadVectorGatherNode : public LoadVectorNode { } }; -//------------------------------StoreVectorNode-------------------------------- // Store Vector to memory class StoreVectorNode : public StoreNode { private: @@ -1180,9 +1151,7 @@ class StoreVectorNode : public StoreNode { #endif }; -//------------------------------StoreVectorScatterNode------------------------------ // Store Vector into memory via index map - class StoreVectorScatterNode : public StoreVectorNode { public: enum { Indices = 4 }; @@ -1200,7 +1169,6 @@ class StoreVectorNode : public StoreNode { virtual Node* indices() const { return in(Indices); } }; -//------------------------------StoreVectorMaskedNode-------------------------------- // Store Vector to memory under the influence of a predicate register(mask). class StoreVectorMaskedNode : public StoreVectorNode { public: @@ -1221,7 +1189,6 @@ class StoreVectorMaskedNode : public StoreVectorNode { virtual Node* mask() const { return in(Mask); } }; -//------------------------------LoadVectorMaskedNode-------------------------------- // Load Vector from memory under the influence of a predicate register(mask). class LoadVectorMaskedNode : public LoadVectorNode { public: @@ -1245,7 +1212,6 @@ class LoadVectorMaskedNode : public LoadVectorNode { } }; -//-------------------------------LoadVectorGatherMaskedNode--------------------------------- // Load Vector from memory via index map under the influence of a predicate register(mask). class LoadVectorGatherMaskedNode : public LoadVectorNode { public: @@ -1268,7 +1234,6 @@ class LoadVectorGatherMaskedNode : public LoadVectorNode { } }; -//------------------------------StoreVectorScatterMaskedNode-------------------------------- // Store Vector into memory via index map under the influence of a predicate register(mask). class StoreVectorScatterMaskedNode : public StoreVectorNode { public: @@ -1312,7 +1277,6 @@ public: virtual const Type *bottom_type() const { return in(1)->bottom_type(); } }; -//------------------------------VectorCmpMaskedNode-------------------------------- // Vector Comparison under the influence of a predicate register(mask). class VectorCmpMaskedNode : public TypeNode { public: @@ -1325,7 +1289,8 @@ class VectorCmpMaskedNode : public TypeNode { virtual int Opcode() const; }; -//------------------------------VectorMaskGenNode---------------------------------- +// Generate a vector mask based on the given length. Lanes with indices in +// [0, length) are set to true, while the remaining lanes are set to false. class VectorMaskGenNode : public TypeNode { public: VectorMaskGenNode(Node* length, const Type* ty): TypeNode(ty, 2) { @@ -1338,7 +1303,8 @@ class VectorMaskGenNode : public TypeNode { static Node* make(Node* length, BasicType vmask_bt, int vmask_len); }; -//------------------------------VectorMaskOpNode----------------------------------- +// Base class for certain vector mask operations. The supported input mask can +// be either "BVectMask" or "PVectMask" depending on the platform. class VectorMaskOpNode : public TypeNode { private: int _mopc; @@ -1359,6 +1325,7 @@ class VectorMaskOpNode : public TypeNode { static Node* make(Node* mask, const Type* ty, int mopc); }; +// Count the number of true (set) lanes in the vector mask. class VectorMaskTrueCountNode : public VectorMaskOpNode { public: VectorMaskTrueCountNode(Node* mask, const Type* ty): @@ -1366,6 +1333,8 @@ class VectorMaskTrueCountNode : public VectorMaskOpNode { virtual int Opcode() const; }; +// Returns the index of the first true (set) lane in the vector mask. +// If no lanes are set, returns the vector length. class VectorMaskFirstTrueNode : public VectorMaskOpNode { public: VectorMaskFirstTrueNode(Node* mask, const Type* ty): @@ -1373,6 +1342,8 @@ class VectorMaskFirstTrueNode : public VectorMaskOpNode { virtual int Opcode() const; }; +// Returns the index of the last true (set) lane in the vector mask. +// If no lanes are set, returns -1 . class VectorMaskLastTrueNode : public VectorMaskOpNode { public: VectorMaskLastTrueNode(Node* mask, const Type* ty): @@ -1380,6 +1351,10 @@ class VectorMaskLastTrueNode : public VectorMaskOpNode { virtual int Opcode() const; }; +// Pack the mask lane values into a long value, supporting at most the +// first 64 lanes. Each mask lane is packed into one bit in the long +// value, ordered from the least significant bit to the most significant +// bit. class VectorMaskToLongNode : public VectorMaskOpNode { public: VectorMaskToLongNode(Node* mask, const Type* ty): @@ -1391,6 +1366,9 @@ class VectorMaskToLongNode : public VectorMaskOpNode { virtual Node* Identity(PhaseGVN* phase); }; +// Unpack bits from a long value into vector mask lane values. Each bit +// in the long value is unpacked into one mask lane, ordered from the +// least significant bit to the sign bit. class VectorLongToMaskNode : public VectorNode { public: VectorLongToMaskNode(Node* mask, const TypeVect* ty): @@ -1400,36 +1378,40 @@ class VectorLongToMaskNode : public VectorNode { virtual Node* Ideal(PhaseGVN* phase, bool can_reshape); }; -//-------------------------- Vector mask broadcast ----------------------------------- +// Broadcast a scalar value to all lanes of a vector mask. All lanes are set +// to true if the input value is non-zero, or false if the input value is +// zero. This node is only used to generate a mask with "PVectMask" layout. class MaskAllNode : public VectorNode { public: MaskAllNode(Node* in, const TypeVect* vt) : VectorNode(in, vt) {} virtual int Opcode() const; }; -//--------------------------- Vector mask logical and -------------------------------- +// Perform a bitwise AND operation between two vector masks. This node is +// only used for vector masks with "PVectMask" layout. class AndVMaskNode : public AndVNode { public: AndVMaskNode(Node* in1, Node* in2, const TypeVect* vt) : AndVNode(in1, in2, vt) {} virtual int Opcode() const; }; -//--------------------------- Vector mask logical or --------------------------------- +// Perform a bitwise OR operation between two vector masks. This node is +// only used for vector masks with "PVectMask" layout. class OrVMaskNode : public OrVNode { public: OrVMaskNode(Node* in1, Node* in2, const TypeVect* vt) : OrVNode(in1, in2, vt) {} virtual int Opcode() const; }; -//--------------------------- Vector mask logical xor -------------------------------- +// Perform a bitwise XOR operation between two vector masks. This node is +// only used for vector masks with "PVectMask" layout. class XorVMaskNode : public XorVNode { public: XorVMaskNode(Node* in1, Node* in2, const TypeVect* vt) : XorVNode(in1, in2, vt) {} virtual int Opcode() const; }; -//=========================Promote_Scalar_to_Vector============================ - +// Replicate a scalar value to all lanes of a vector. class ReplicateNode : public VectorNode { public: ReplicateNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) { @@ -1439,7 +1421,7 @@ class ReplicateNode : public VectorNode { virtual int Opcode() const; }; -//======================Populate_Indices_into_a_Vector========================= +// Populate indices into a vector. class PopulateIndexNode : public VectorNode { public: PopulateIndexNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1, in2, vt) {} @@ -1448,7 +1430,6 @@ class PopulateIndexNode : public VectorNode { //========================Pack_Scalars_into_a_Vector=========================== -//------------------------------PackNode--------------------------------------- // Pack parent class (not for code generation). class PackNode : public VectorNode { public: @@ -1466,7 +1447,6 @@ class PackNode : public VectorNode { static PackNode* make(Node* s, uint vlen, BasicType bt); }; -//------------------------------PackBNode-------------------------------------- // Pack byte scalars into vector class PackBNode : public PackNode { public: @@ -1474,7 +1454,6 @@ class PackBNode : public PackNode { virtual int Opcode() const; }; -//------------------------------PackSNode-------------------------------------- // Pack short scalars into a vector class PackSNode : public PackNode { public: @@ -1483,7 +1462,6 @@ class PackSNode : public PackNode { virtual int Opcode() const; }; -//------------------------------PackINode-------------------------------------- // Pack integer scalars into a vector class PackINode : public PackNode { public: @@ -1492,7 +1470,6 @@ class PackINode : public PackNode { virtual int Opcode() const; }; -//------------------------------PackLNode-------------------------------------- // Pack long scalars into a vector class PackLNode : public PackNode { public: @@ -1501,7 +1478,6 @@ class PackLNode : public PackNode { virtual int Opcode() const; }; -//------------------------------Pack2LNode------------------------------------- // Pack 2 long scalars into a vector class Pack2LNode : public PackNode { public: @@ -1509,7 +1485,6 @@ class Pack2LNode : public PackNode { virtual int Opcode() const; }; -//------------------------------PackFNode-------------------------------------- // Pack float scalars into vector class PackFNode : public PackNode { public: @@ -1518,7 +1493,6 @@ class PackFNode : public PackNode { virtual int Opcode() const; }; -//------------------------------PackDNode-------------------------------------- // Pack double scalars into a vector class PackDNode : public PackNode { public: @@ -1527,7 +1501,6 @@ class PackDNode : public PackNode { virtual int Opcode() const; }; -//------------------------------Pack2DNode------------------------------------- // Pack 2 double scalars into a vector class Pack2DNode : public PackNode { public: @@ -1535,7 +1508,10 @@ class Pack2DNode : public PackNode { virtual int Opcode() const; }; - +// Load the IOTA constant vector containing sequential indices starting from 0 +// and incrementing by 1 up to "VLENGTH - 1". So far, the first input is an int +// constant 0. For example, a 128-bit vector with int (32-bit) elements produces +// a vector like "[0, 1, 2, 3]". class VectorLoadConstNode : public VectorNode { public: VectorLoadConstNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {} @@ -1544,8 +1520,7 @@ class VectorLoadConstNode : public VectorNode { //========================Extract_Scalar_from_Vector=========================== -//------------------------------ExtractNode------------------------------------ -// Extract a scalar from a vector at position "pos" +// The base class for all extract nodes. class ExtractNode : public Node { public: ExtractNode(Node* src, Node* pos) : Node(nullptr, src, pos) {} @@ -1554,8 +1529,7 @@ class ExtractNode : public Node { static int opcode(BasicType bt); }; -//------------------------------ExtractBNode----------------------------------- -// Extract a byte from a vector at position "pos" +// Extract a byte from a vector at position "pos". class ExtractBNode : public ExtractNode { public: ExtractBNode(Node* src, Node* pos) : ExtractNode(src, pos) {} @@ -1564,8 +1538,7 @@ class ExtractBNode : public ExtractNode { virtual uint ideal_reg() const { return Op_RegI; } }; -//------------------------------ExtractUBNode---------------------------------- -// Extract a boolean from a vector at position "pos" +// Extract a boolean from a vector at position "pos". class ExtractUBNode : public ExtractNode { public: ExtractUBNode(Node* src, Node* pos) : ExtractNode(src, pos) {} @@ -1574,8 +1547,7 @@ class ExtractUBNode : public ExtractNode { virtual uint ideal_reg() const { return Op_RegI; } }; -//------------------------------ExtractCNode----------------------------------- -// Extract a char from a vector at position "pos" +// Extract a char from a vector at position "pos". class ExtractCNode : public ExtractNode { public: ExtractCNode(Node* src, Node* pos) : ExtractNode(src, pos) {} @@ -1584,8 +1556,7 @@ class ExtractCNode : public ExtractNode { virtual uint ideal_reg() const { return Op_RegI; } }; -//------------------------------ExtractSNode----------------------------------- -// Extract a short from a vector at position "pos" +// Extract a short from a vector at position "pos". class ExtractSNode : public ExtractNode { public: ExtractSNode(Node* src, Node* pos) : ExtractNode(src, pos) {} @@ -1594,8 +1565,7 @@ class ExtractSNode : public ExtractNode { virtual uint ideal_reg() const { return Op_RegI; } }; -//------------------------------ExtractINode----------------------------------- -// Extract an int from a vector at position "pos" +// Extract an int from a vector at position "pos". class ExtractINode : public ExtractNode { public: ExtractINode(Node* src, Node* pos) : ExtractNode(src, pos) {} @@ -1604,8 +1574,7 @@ class ExtractINode : public ExtractNode { virtual uint ideal_reg() const { return Op_RegI; } }; -//------------------------------ExtractLNode----------------------------------- -// Extract a long from a vector at position "pos" +// Extract a long from a vector at position "pos". class ExtractLNode : public ExtractNode { public: ExtractLNode(Node* src, Node* pos) : ExtractNode(src, pos) {} @@ -1614,8 +1583,7 @@ class ExtractLNode : public ExtractNode { virtual uint ideal_reg() const { return Op_RegL; } }; -//------------------------------ExtractFNode----------------------------------- -// Extract a float from a vector at position "pos" +// Extract a float from a vector at position "pos". class ExtractFNode : public ExtractNode { public: ExtractFNode(Node* src, Node* pos) : ExtractNode(src, pos) {} @@ -1624,8 +1592,7 @@ class ExtractFNode : public ExtractNode { virtual uint ideal_reg() const { return Op_RegF; } }; -//------------------------------ExtractDNode----------------------------------- -// Extract a double from a vector at position "pos" +// Extract a double from a vector at position "pos". class ExtractDNode : public ExtractNode { public: ExtractDNode(Node* src, Node* pos) : ExtractNode(src, pos) {} @@ -1634,7 +1601,6 @@ class ExtractDNode : public ExtractNode { virtual uint ideal_reg() const { return Op_RegD; } }; -//------------------------------MacroLogicVNode------------------------------- // Vector logical operations packing node. class MacroLogicVNode : public VectorNode { private: @@ -1653,6 +1619,8 @@ public: Node* mask, uint truth_table, const TypeVect* vt); }; +// Compare two vectors lane-wise using the specified predicate and produce a +// vector mask. class VectorMaskCmpNode : public VectorNode { private: BoolTest::mask _predicate; @@ -1697,6 +1665,8 @@ class VectorMaskWrapperNode : public VectorNode { Node* vector_mask() const { return in(2); } }; +// Test whether all or any lanes in the first input vector mask is true, +// based on the specified predicate. class VectorTestNode : public CmpNode { private: BoolTest::mask _predicate; @@ -1719,6 +1689,9 @@ class VectorTestNode : public CmpNode { } }; +// Blend two vectors based on a vector mask. For each lane, select the value +// from the first input vector (vec1) if the corresponding mask lane is set, +// otherwise select from the second input vector (vec2). class VectorBlendNode : public VectorNode { public: VectorBlendNode(Node* vec1, Node* vec2, Node* mask) @@ -1732,11 +1705,14 @@ class VectorBlendNode : public VectorNode { Node* vec_mask() const { return in(3); } }; +// Rearrange lane elements from a source vector under the control of a shuffle +// (indexes) vector. Each lane in the shuffle vector specifies which lane from +// the source vector to select for the corresponding output lane. All indexes +// are in the range [0, VLENGTH). class VectorRearrangeNode : public VectorNode { public: VectorRearrangeNode(Node* vec1, Node* shuffle) : VectorNode(vec1, shuffle, vec1->bottom_type()->is_vect()) { - // assert(mask->is_VectorMask(), "VectorBlendNode requires that third argument be a mask"); } virtual int Opcode() const; @@ -1744,9 +1720,12 @@ class VectorRearrangeNode : public VectorNode { Node* vec_shuffle() const { return in(2); } }; - -// Select elements from two source vectors based on the wrapped indexes held in -// the first vector. +// Select lane elements from two source vectors ("src1" and "src2") under the +// control of an "indexes" vector. The two source vectors are logically concatenated +// to form a table of 2*VLENGTH elements, where src1 occupies indices [0, VLENGTH) +// and src2 occupies indices [VLENGTH, 2*VLENGTH). Each lane in the "indexes" +// vector specifies which element from this table to select for the corresponding +// output lane. class SelectFromTwoVectorNode : public VectorNode { public: SelectFromTwoVectorNode(Node* indexes, Node* src1, Node* src2, const TypeVect* vt) @@ -1758,13 +1737,19 @@ public: virtual int Opcode() const; }; -// The target may not directly support the rearrange operation for an element type. In those cases, -// we can transform the rearrange into a different element type. For example, on x86 before AVX512, -// there is no rearrange instruction for short elements, what we will then do is to transform the -// shuffle vector into one that we can do byte rearrange such that it would provide the same -// result. This could have been done in VectorRearrangeNode during code emission but we eagerly -// expand this out because it is often the case that an index vector is reused in many rearrange -// operations. This allows the index preparation to be GVN-ed as well as hoisted out of loops, etc. +// Transform a shuffle vector when the target does not directly support rearrange +// operations for the original element type. In such cases, the rearrange can be +// transformed to use a different element type. +// +// For example, on x86 before AVX512, there are no rearrange instructions for short +// elements. The shuffle vector is transformed into one suitable for byte rearrange +// that produces the same result. This could have been done in VectorRearrangeNode +// during code emission, but we eagerly expand it out because shuffle vectors are +// often reused in many rearrange operations. This allows the transformation to be +// GVN-ed and hoisted out of loops. +// +// Input: Original shuffle vector (indices for the desired element type) +// Output: Transformed shuffle vector (indices for the supported element type) class VectorLoadShuffleNode : public VectorNode { public: VectorLoadShuffleNode(Node* in, const TypeVect* vt) @@ -1773,6 +1758,8 @@ class VectorLoadShuffleNode : public VectorNode { virtual int Opcode() const; }; +// Convert a "BVectMask" into a platform-specific vector mask (either "NVectMask" +// or "PVectMask"). class VectorLoadMaskNode : public VectorNode { public: VectorLoadMaskNode(Node* in, const TypeVect* vt) : VectorNode(in, vt) { @@ -1784,6 +1771,8 @@ class VectorLoadMaskNode : public VectorNode { Node* Ideal(PhaseGVN* phase, bool can_reshape); }; +// Convert a platform-specific vector mask (either "NVectMask" or "PVectMask") +// into a "BVectMask". class VectorStoreMaskNode : public VectorNode { protected: VectorStoreMaskNode(Node* in1, ConINode* in2, const TypeVect* vt) : VectorNode(in1, in2, vt) {} @@ -1795,6 +1784,8 @@ class VectorStoreMaskNode : public VectorNode { static VectorStoreMaskNode* make(PhaseGVN& gvn, Node* in, BasicType in_type, uint num_elem); }; +// Lane-wise type cast a vector mask to the given vector type. The vector length +// of the input and output must be the same. class VectorMaskCastNode : public VectorNode { public: VectorMaskCastNode(Node* in, const TypeVect* vt) : VectorNode(in, vt) { @@ -1831,6 +1822,8 @@ class VectorReinterpretNode : public VectorNode { virtual int Opcode() const; }; +// Lane-wise type cast a vector to the given vector type. This is the base +// class for all vector type cast operations. class VectorCastNode : public VectorNode { public: VectorCastNode(Node* in, const TypeVect* vt) : VectorNode(in, vt) {} @@ -1843,6 +1836,7 @@ class VectorCastNode : public VectorNode { virtual Node* Identity(PhaseGVN* phase); }; +// Cast a byte vector to the given vector type. class VectorCastB2XNode : public VectorCastNode { public: VectorCastB2XNode(Node* in, const TypeVect* vt) : VectorCastNode(in, vt) { @@ -1851,6 +1845,7 @@ class VectorCastB2XNode : public VectorCastNode { virtual int Opcode() const; }; +// Cast a short vector to the given vector type. class VectorCastS2XNode : public VectorCastNode { public: VectorCastS2XNode(Node* in, const TypeVect* vt) : VectorCastNode(in, vt) { @@ -1859,6 +1854,7 @@ class VectorCastS2XNode : public VectorCastNode { virtual int Opcode() const; }; +// Cast an int vector to the given vector type. class VectorCastI2XNode : public VectorCastNode { public: VectorCastI2XNode(Node* in, const TypeVect* vt) : VectorCastNode(in, vt) { @@ -1867,6 +1863,7 @@ class VectorCastI2XNode : public VectorCastNode { virtual int Opcode() const; }; +// Cast a long vector to the given vector type. class VectorCastL2XNode : public VectorCastNode { public: VectorCastL2XNode(Node* in, const TypeVect* vt) : VectorCastNode(in, vt) { @@ -1875,6 +1872,7 @@ class VectorCastL2XNode : public VectorCastNode { virtual int Opcode() const; }; +// Cast a float vector to the given vector type. class VectorCastF2XNode : public VectorCastNode { public: VectorCastF2XNode(Node* in, const TypeVect* vt) : VectorCastNode(in, vt) { @@ -1883,6 +1881,7 @@ class VectorCastF2XNode : public VectorCastNode { virtual int Opcode() const; }; +// Cast a double vector to the given vector type. class VectorCastD2XNode : public VectorCastNode { public: VectorCastD2XNode(Node* in, const TypeVect* vt) : VectorCastNode(in, vt) { @@ -1891,6 +1890,7 @@ class VectorCastD2XNode : public VectorCastNode { virtual int Opcode() const; }; +// Cast a half float vector to float vector type. class VectorCastHF2FNode : public VectorCastNode { public: VectorCastHF2FNode(Node* in, const TypeVect* vt) : VectorCastNode(in, vt) { @@ -1899,6 +1899,7 @@ class VectorCastHF2FNode : public VectorCastNode { virtual int Opcode() const; }; +// Cast a float vector to a half float vector type. class VectorCastF2HFNode : public VectorCastNode { public: VectorCastF2HFNode(Node* in, const TypeVect* vt) : VectorCastNode(in, vt) { @@ -1907,8 +1908,12 @@ class VectorCastF2HFNode : public VectorCastNode { virtual int Opcode() const; }; -// So far, VectorUCastNode can only be used in Vector API unsigned extensions -// between integral types. E.g., extending byte to float is not supported now. +// Unsigned vector cast operations can only be used in unsigned (zero) +// extensions between integral types so far. E.g., extending byte to +// float is not supported now. + +// Unsigned cast a byte vector to the given vector type with short, int, +// or long element type. class VectorUCastB2XNode : public VectorCastNode { public: VectorUCastB2XNode(Node* in, const TypeVect* vt) : VectorCastNode(in, vt) { @@ -1920,6 +1925,8 @@ class VectorUCastB2XNode : public VectorCastNode { virtual int Opcode() const; }; +// Unsigned cast a short vector to the given vector type with int or long +// element type. class VectorUCastS2XNode : public VectorCastNode { public: VectorUCastS2XNode(Node* in, const TypeVect* vt) : VectorCastNode(in, vt) { @@ -1930,6 +1937,7 @@ class VectorUCastS2XNode : public VectorCastNode { virtual int Opcode() const; }; +// Unsigned cast an int vector to the given vector type with long element type. class VectorUCastI2XNode : public VectorCastNode { public: VectorUCastI2XNode(Node* in, const TypeVect* vt) : VectorCastNode(in, vt) { @@ -1939,6 +1947,7 @@ class VectorUCastI2XNode : public VectorCastNode { virtual int Opcode() const; }; +// Vector round float to nearest integer. class RoundVFNode : public VectorNode { public: RoundVFNode(Node* in, const TypeVect* vt) :VectorNode(in, vt) { @@ -1947,6 +1956,7 @@ class RoundVFNode : public VectorNode { virtual int Opcode() const; }; +// Vector round double to nearest integer. class RoundVDNode : public VectorNode { public: RoundVDNode(Node* in, const TypeVect* vt) : VectorNode(in, vt) { @@ -1955,6 +1965,7 @@ class RoundVDNode : public VectorNode { virtual int Opcode() const; }; +// Insert a new value into a vector lane at the specified position. class VectorInsertNode : public VectorNode { public: VectorInsertNode(Node* vsrc, Node* new_val, ConINode* pos, const TypeVect* vt) : VectorNode(vsrc, new_val, (Node*)pos, vt) { @@ -1968,6 +1979,9 @@ class VectorInsertNode : public VectorNode { static Node* make(Node* vec, Node* new_val, int position, PhaseGVN& gvn); }; +// Box a vector value into a Vector API object (e.g., IntMaxVector). +// This is a macro node that gets expanded during vector optimization +// phase. class VectorBoxNode : public Node { private: const TypeInstPtr* const _box_type; @@ -1995,6 +2009,8 @@ class VectorBoxNode : public Node { static const TypeFunc* vec_box_type(const TypeInstPtr* box_type); }; +// Allocate storage for boxing a vector value. This is used during vector +// box expansion. class VectorBoxAllocateNode : public CallStaticJavaNode { public: VectorBoxAllocateNode(Compile* C, const TypeInstPtr* vbox_type) @@ -2009,6 +2025,9 @@ class VectorBoxAllocateNode : public CallStaticJavaNode { #endif // !PRODUCT }; +// Unbox a Vector API object (e.g., IntMaxVector) to extract the underlying +// vector value. This is a macro node expanded during vector optimization +// phase. class VectorUnboxNode : public VectorNode { protected: uint size_of() const { return sizeof(*this); } @@ -2027,6 +2046,7 @@ class VectorUnboxNode : public VectorNode { Node* Ideal(PhaseGVN* phase, bool can_reshape); }; +// Lane-wise right rotation of the first input by the second input. class RotateRightVNode : public VectorNode { public: RotateRightVNode(Node* in1, Node* in2, const TypeVect* vt) @@ -2036,6 +2056,7 @@ public: Node* Ideal(PhaseGVN* phase, bool can_reshape); }; +// Lane-wise left rotation of the first input by the second input. class RotateLeftVNode : public VectorNode { public: RotateLeftVNode(Node* in1, Node* in2, const TypeVect* vt) @@ -2045,6 +2066,7 @@ public: Node* Ideal(PhaseGVN* phase, bool can_reshape); }; +// Count the number of leading zeros in each lane of the input. class CountLeadingZerosVNode : public VectorNode { public: CountLeadingZerosVNode(Node* in, const TypeVect* vt) @@ -2056,6 +2078,7 @@ class CountLeadingZerosVNode : public VectorNode { virtual int Opcode() const; }; +// Count the number of trailing zeros in each lane of the input. class CountTrailingZerosVNode : public VectorNode { public: CountTrailingZerosVNode(Node* in, const TypeVect* vt) @@ -2067,6 +2090,7 @@ class CountTrailingZerosVNode : public VectorNode { virtual int Opcode() const; }; +// Reverse the bits within each lane (e.g., 0b10110010 becomes 0b01001101). class ReverseVNode : public VectorNode { public: ReverseVNode(Node* in, const TypeVect* vt) @@ -2076,6 +2100,7 @@ public: virtual int Opcode() const; }; +// Reverse the byte order within each lane (e.g., 0x12345678 becomes 0x78563412). class ReverseBytesVNode : public VectorNode { public: ReverseBytesVNode(Node* in, const TypeVect* vt) @@ -2085,6 +2110,7 @@ public: virtual int Opcode() const; }; +// Vector signum float. class SignumVFNode : public VectorNode { public: SignumVFNode(Node* in1, Node* zero, Node* one, const TypeVect* vt) @@ -2093,6 +2119,7 @@ public: virtual int Opcode() const; }; +// Vector signum double. class SignumVDNode : public VectorNode { public: SignumVDNode(Node* in1, Node* zero, Node* one, const TypeVect* vt) @@ -2101,6 +2128,8 @@ public: virtual int Opcode() const; }; +// Compress (extract and pack) bits in each lane of the first input +// based on the mask input. class CompressBitsVNode : public VectorNode { public: CompressBitsVNode(Node* in, Node* mask, const TypeVect* vt) @@ -2108,6 +2137,8 @@ public: virtual int Opcode() const; }; +// Expand (deposit) bits in each lane of the first input based on the +// mask input. class ExpandBitsVNode : public VectorNode { public: ExpandBitsVNode(Node* in, Node* mask, const TypeVect* vt) diff --git a/src/hotspot/share/runtime/handshake.cpp b/src/hotspot/share/runtime/handshake.cpp index 89b02717a7a..b54068d65d6 100644 --- a/src/hotspot/share/runtime/handshake.cpp +++ b/src/hotspot/share/runtime/handshake.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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -521,8 +521,8 @@ HandshakeOperation* HandshakeState::get_op_for_self(bool allow_suspend, bool che assert(_lock.owned_by_self(), "Lock must be held"); assert(allow_suspend || !check_async_exception, "invalid case"); #if INCLUDE_JVMTI - if (allow_suspend && _handshakee->is_disable_suspend()) { - // filter out suspend operations while JavaThread is in disable_suspend mode + if (allow_suspend && (_handshakee->is_disable_suspend() || _handshakee->is_vthread_transition_disabler())) { + // filter out suspend operations while JavaThread can not be suspended allow_suspend = false; } #endif diff --git a/src/hotspot/share/runtime/javaThread.cpp b/src/hotspot/share/runtime/javaThread.cpp index 4ee9a9dfd79..e73347f35d8 100644 --- a/src/hotspot/share/runtime/javaThread.cpp +++ b/src/hotspot/share/runtime/javaThread.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) 2021, Azul Systems, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -499,7 +499,7 @@ JavaThread::JavaThread(MemTag mem_tag) : _suspend_resume_manager(this, &_handshake._lock), _is_in_vthread_transition(false), - DEBUG_ONLY(_is_vthread_transition_disabler(false) COMMA) + JVMTI_ONLY(_is_vthread_transition_disabler(false) COMMA) DEBUG_ONLY(_is_disabler_at_start(false) COMMA) _popframe_preserved_args(nullptr), @@ -1165,11 +1165,13 @@ void JavaThread::set_is_in_vthread_transition(bool val) { AtomicAccess::store(&_is_in_vthread_transition, val); } -#ifdef ASSERT +#if INCLUDE_JVMTI void JavaThread::set_is_vthread_transition_disabler(bool val) { _is_vthread_transition_disabler = val; } +#endif +#ifdef ASSERT void JavaThread::set_is_disabler_at_start(bool val) { _is_disabler_at_start = val; } @@ -1183,7 +1185,9 @@ void JavaThread::set_is_disabler_at_start(bool val) { // bool JavaThread::java_suspend(bool register_vthread_SR) { // Suspending a vthread transition disabler can cause deadlocks. - assert(!is_vthread_transition_disabler(), "no suspend allowed for vthread transition disablers"); + // The HandshakeState::has_operation does not allow such suspends. + // But the suspender thread is an exclusive transition disablers, so there can't be other disabers here. + JVMTI_ONLY(assert(!is_vthread_transition_disabler(), "suspender thread is an exclusive transition disabler");) guarantee(Thread::is_JavaThread_protected(/* target */ this), "target JavaThread is not protected in calling context."); diff --git a/src/hotspot/share/runtime/javaThread.hpp b/src/hotspot/share/runtime/javaThread.hpp index d4c12887e10..1aae37c0697 100644 --- a/src/hotspot/share/runtime/javaThread.hpp +++ b/src/hotspot/share/runtime/javaThread.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) 2021, Azul Systems, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -734,14 +734,14 @@ public: private: bool _is_in_vthread_transition; // thread is in virtual thread mount state transition - DEBUG_ONLY(bool _is_vthread_transition_disabler;) // thread currently disabled vthread transitions + JVMTI_ONLY(bool _is_vthread_transition_disabler;) // thread currently disabled vthread transitions DEBUG_ONLY(bool _is_disabler_at_start;) // thread at process of disabling vthread transitions public: bool is_in_vthread_transition() const; void set_is_in_vthread_transition(bool val); + JVMTI_ONLY(bool is_vthread_transition_disabler() const { return _is_vthread_transition_disabler; }) + JVMTI_ONLY(void set_is_vthread_transition_disabler(bool val);) #ifdef ASSERT - bool is_vthread_transition_disabler() const { return _is_vthread_transition_disabler; } - void set_is_vthread_transition_disabler(bool val); bool is_disabler_at_start() const { return _is_disabler_at_start; } void set_is_disabler_at_start(bool val); #endif diff --git a/src/hotspot/share/runtime/mountUnmountDisabler.cpp b/src/hotspot/share/runtime/mountUnmountDisabler.cpp index 8635eeb2dcc..65a82d6c563 100644 --- a/src/hotspot/share/runtime/mountUnmountDisabler.cpp +++ b/src/hotspot/share/runtime/mountUnmountDisabler.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 @@ -129,7 +129,8 @@ bool MountUnmountDisabler::is_start_transition_disabled(JavaThread* thread, oop int base_disable_count = notify_jvmti_events() ? 1 : 0; return java_lang_Thread::vthread_transition_disable_count(vthread) > 0 || global_vthread_transition_disable_count() > base_disable_count - JVMTI_ONLY(|| (JvmtiVTSuspender::is_vthread_suspended(java_lang_Thread::thread_id(vthread)) || thread->is_suspended())); + JVMTI_ONLY(|| (!thread->is_vthread_transition_disabler() && + (JvmtiVTSuspender::is_vthread_suspended(java_lang_Thread::thread_id(vthread)) || thread->is_suspended()))); } void MountUnmountDisabler::start_transition(JavaThread* current, oop vthread, bool is_mount, bool is_thread_end) { @@ -294,7 +295,7 @@ MountUnmountDisabler::disable_transition_for_one() { // carrierThread to float up. // This pairs with the release barrier in end_transition(). OrderAccess::acquire(); - DEBUG_ONLY(JavaThread::current()->set_is_vthread_transition_disabler(true);) + JVMTI_ONLY(JavaThread::current()->set_is_vthread_transition_disabler(true);) } // disable transitions for all virtual threads @@ -335,7 +336,7 @@ MountUnmountDisabler::disable_transition_for_all() { // carrierThread to float up. // This pairs with the release barrier in end_transition(). OrderAccess::acquire(); - DEBUG_ONLY(thread->set_is_vthread_transition_disabler(true);) + JVMTI_ONLY(JavaThread::current()->set_is_vthread_transition_disabler(true);) DEBUG_ONLY(thread->set_is_disabler_at_start(false);) } @@ -358,14 +359,12 @@ MountUnmountDisabler::enable_transition_for_one() { if (java_lang_Thread::vthread_transition_disable_count(_vthread()) == 0) { ml.notify_all(); } - DEBUG_ONLY(JavaThread::current()->set_is_vthread_transition_disabler(false);) + JVMTI_ONLY(JavaThread::current()->set_is_vthread_transition_disabler(false);) } // enable transitions for all virtual threads void MountUnmountDisabler::enable_transition_for_all() { - JavaThread* thread = JavaThread::current(); - // End of the critical section. If some target was unmounted, we need a // release barrier before decrementing _global_vthread_transition_disable_count // to make sure any memory operations executed by the disabler are visible to @@ -384,7 +383,7 @@ MountUnmountDisabler::enable_transition_for_all() { if (global_vthread_transition_disable_count() == base_disable_count || _is_exclusive) { ml.notify_all(); } - DEBUG_ONLY(thread->set_is_vthread_transition_disabler(false);) + JVMTI_ONLY(JavaThread::current()->set_is_vthread_transition_disabler(false);) } int MountUnmountDisabler::global_vthread_transition_disable_count() { diff --git a/src/hotspot/share/runtime/suspendResumeManager.cpp b/src/hotspot/share/runtime/suspendResumeManager.cpp index 067579b6386..3408d763e57 100644 --- a/src/hotspot/share/runtime/suspendResumeManager.cpp +++ b/src/hotspot/share/runtime/suspendResumeManager.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 @@ -130,6 +130,7 @@ void SuspendResumeManager::do_owner_suspend() { assert(_state_lock->owned_by_self(), "Lock must be held"); assert(!_target->has_last_Java_frame() || _target->frame_anchor()->walkable(), "should have walkable stack"); assert(_target->thread_state() == _thread_blocked, "Caller should have transitioned to _thread_blocked"); + JVMTI_ONLY(assert(!_target->is_vthread_transition_disabler(), "attempt to suspend a vthread transition disabler");) while (is_suspended()) { log_trace(thread, suspend)("JavaThread:" INTPTR_FORMAT " suspended", p2i(_target)); diff --git a/src/hotspot/share/runtime/vframeArray.cpp b/src/hotspot/share/runtime/vframeArray.cpp index a68a0adf299..9f1c082ed8f 100644 --- a/src/hotspot/share/runtime/vframeArray.cpp +++ b/src/hotspot/share/runtime/vframeArray.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 @@ -491,6 +491,15 @@ void vframeArrayElement::unpack_on_stack(int caller_actual_parameters, #ifndef PRODUCT if (PrintDeoptimizationDetails) { + const bool print_codes = WizardMode && Verbose; + ResourceMark rm(thread); + stringStream codes_ss; + if (print_codes) { + // print_codes_on() may acquire MDOExtraData_lock (rank nosafepoint-1). + // To keep the lock acquisition order correct, call it before taking tty_lock. + // Avoid double buffering: set buffered=false. + method()->print_codes_on(&codes_ss, 0, false); + } ttyLocker ttyl; tty->print_cr("[%d. Interpreted Frame]", ++unpack_counter); iframe()->print_on(tty); @@ -500,7 +509,9 @@ void vframeArrayElement::unpack_on_stack(int caller_actual_parameters, RegisterMap::WalkContinuation::skip); vframe* f = vframe::new_vframe(iframe(), &map, thread); f->print(); - if (WizardMode && Verbose) method()->print_codes(); + if (print_codes) { + tty->print("%s", codes_ss.as_string()); + } tty->cr(); } #endif // !PRODUCT diff --git a/src/hotspot/share/utilities/debug.cpp b/src/hotspot/share/utilities/debug.cpp index 0e1ca1efb98..504b923237e 100644 --- a/src/hotspot/share/utilities/debug.cpp +++ b/src/hotspot/share/utilities/debug.cpp @@ -429,10 +429,8 @@ extern "C" DEBUGEXPORT void pp(void* p) { tty->print_cr("null"); return; } - if (Universe::heap()->is_in(p)) { - oop obj = cast_to_oop(p); - obj->print(); - } else { + + if (!Universe::heap()->print_location(tty, p)) { // Ask NMT about this pointer. // GDB note: We will be using SafeFetch to access the supposed malloc header. If the address is // not readable, this will generate a signal. That signal will trip up the debugger: gdb will diff --git a/src/java.base/share/classes/java/lang/VirtualThread.java b/src/java.base/share/classes/java/lang/VirtualThread.java index 93862db9105..5526618c67b 100644 --- a/src/java.base/share/classes/java/lang/VirtualThread.java +++ b/src/java.base/share/classes/java/lang/VirtualThread.java @@ -620,9 +620,12 @@ final class VirtualThread extends BaseVirtualThread { // Object.wait if (s == WAITING || s == TIMED_WAITING) { int newState; + boolean blocked; boolean interruptible = interruptibleWait; if (s == WAITING) { setState(newState = WAIT); + // may have been notified while in transition + blocked = notified && compareAndSetState(WAIT, BLOCKED); } else { // For timed-wait, a timeout task is scheduled to execute. The timeout // task will change the thread state to UNBLOCKED and submit the thread @@ -637,22 +640,22 @@ final class VirtualThread extends BaseVirtualThread { byte seqNo = ++timedWaitSeqNo; timeoutTask = schedule(() -> waitTimeoutExpired(seqNo), timeout, MILLISECONDS); setState(newState = TIMED_WAIT); + // May have been notified while in transition. This must be done while + // holding the monitor to avoid changing the state of a new timed wait call. + blocked = notified && compareAndSetState(TIMED_WAIT, BLOCKED); } } - // may have been notified while in transition to wait state - if (notified && compareAndSetState(newState, BLOCKED)) { - // may have even been unblocked already + if (blocked) { + // may have been unblocked already if (blockPermit && compareAndSetState(BLOCKED, UNBLOCKED)) { - submitRunContinuation(); + lazySubmitRunContinuation(); + } + } else { + // may have been interrupted while in transition to wait state + if (interruptible && interrupted && compareAndSetState(newState, UNBLOCKED)) { + lazySubmitRunContinuation(); } - return; - } - - // may have been interrupted while in transition to wait state - if (interruptible && interrupted && compareAndSetState(newState, UNBLOCKED)) { - submitRunContinuation(); - return; } return; } diff --git a/src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java b/src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java index 30b6df0073e..087d2cc23a9 100644 --- a/src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java +++ b/src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.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 @@ -188,13 +188,17 @@ public final class SwitchBootstraps { String invocationName, MethodType invocationType, Object... labels) { + requireNonNull(lookup); + requireNonNull(invocationType); + requireNonNull(labels); + Class selectorType = invocationType.parameterType(0); if (invocationType.parameterCount() != 2 || (!invocationType.returnType().equals(int.class)) || !invocationType.parameterType(1).equals(int.class)) throw new IllegalArgumentException("Illegal invocation type " + invocationType); - for (Object l : labels) { // implicit null-check + for (Object l : labels) { verifyLabel(l, selectorType); } @@ -292,6 +296,10 @@ public final class SwitchBootstraps { String invocationName, MethodType invocationType, Object... labels) { + requireNonNull(lookup); + requireNonNull(invocationType); + requireNonNull(labels); + if (invocationType.parameterCount() != 2 || (!invocationType.returnType().equals(int.class)) || invocationType.parameterType(0).isPrimitive() @@ -299,7 +307,7 @@ public final class SwitchBootstraps { || !invocationType.parameterType(1).equals(int.class)) throw new IllegalArgumentException("Illegal invocation type " + invocationType); - labels = labels.clone(); // implicit null check + labels = labels.clone(); Class enumClass = invocationType.parameterType(0); boolean constantsOnly = true; @@ -307,7 +315,7 @@ public final class SwitchBootstraps { for (int i = 0; i < len; i++) { Object convertedLabel = - convertEnumConstants(lookup, enumClass, labels[i]); + convertEnumConstants(enumClass, labels[i]); labels[i] = convertedLabel; if (constantsOnly) constantsOnly = convertedLabel instanceof EnumDesc; @@ -331,7 +339,7 @@ public final class SwitchBootstraps { return new ConstantCallSite(target); } - private static > Object convertEnumConstants(MethodHandles.Lookup lookup, Class enumClassTemplate, Object label) { + private static > Object convertEnumConstants(Class enumClassTemplate, Object label) { if (label == null) { throw new IllegalArgumentException("null label found"); } diff --git a/src/java.base/share/classes/java/nio/file/SecureDirectoryStream.java b/src/java.base/share/classes/java/nio/file/SecureDirectoryStream.java index 4348c60f5e2..92a292bbac6 100644 --- a/src/java.base/share/classes/java/nio/file/SecureDirectoryStream.java +++ b/src/java.base/share/classes/java/nio/file/SecureDirectoryStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2024, 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 @@ -185,8 +185,8 @@ public interface SecureDirectoryStream /** * Move a file from this directory to another directory. * - *

This method works in a similar manner to {@link Files#move move} - * method when the {@link StandardCopyOption#ATOMIC_MOVE ATOMIC_MOVE} option + *

This method works in a similar manner to {@link Files#move Files.move} + * when the {@link StandardCopyOption#ATOMIC_MOVE ATOMIC_MOVE} option * is specified. That is, this method moves a file as an atomic file system * operation. If the {@code srcpath} parameter is an {@link Path#isAbsolute * absolute} path then it locates the source file. If the parameter is a @@ -194,14 +194,15 @@ public interface SecureDirectoryStream * the {@code targetpath} parameter is absolute then it locates the target * file (the {@code targetdir} parameter is ignored). If the parameter is * a relative path it is located relative to the open directory identified - * by the {@code targetdir} parameter. In all cases, if the target file - * exists then it is implementation specific if it is replaced or this - * method fails. + * by the {@code targetdir} parameter, unless {@code targetdir} is + * {@code null}, in which case it is located relative to the current + * working directory. In all cases, if the target file exists then it is + * implementation specific if it is replaced or this method fails. * * @param srcpath * the name of the file to move * @param targetdir - * the destination directory + * the destination directory; can be {@code null} * @param targetpath * the name to give the file in the destination directory * diff --git a/src/java.base/share/classes/java/time/ZonedDateTime.java b/src/java.base/share/classes/java/time/ZonedDateTime.java index 57dc98d5c68..b1ffe7b87d6 100644 --- a/src/java.base/share/classes/java/time/ZonedDateTime.java +++ b/src/java.base/share/classes/java/time/ZonedDateTime.java @@ -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 @@ -2207,7 +2207,10 @@ public final class ZonedDateTime * Outputs this date-time as a {@code String}, such as * {@code 2007-12-03T10:15:30+01:00[Europe/Paris]}. *

- * The format consists of the {@code LocalDateTime} followed by the {@code ZoneOffset}. + * The format consists of the output of {@link LocalDateTime#toString()}, + * followed by the output of {@link ZoneOffset#toString()}. + * If the time has zero seconds and/or nanoseconds, they are + * omitted to produce the shortest representation. * If the {@code ZoneId} is not the same as the offset, then the ID is output. * The output is compatible with ISO-8601 if the offset and ID are the same, * and the seconds in the offset are zero. diff --git a/src/java.base/share/classes/java/util/concurrent/CopyOnWriteArraySet.java b/src/java.base/share/classes/java/util/concurrent/CopyOnWriteArraySet.java index cef1682b0b1..abc9fdb348c 100644 --- a/src/java.base/share/classes/java/util/concurrent/CopyOnWriteArraySet.java +++ b/src/java.base/share/classes/java/util/concurrent/CopyOnWriteArraySet.java @@ -35,6 +35,13 @@ package java.util.concurrent; +import jdk.internal.misc.Unsafe; + +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectStreamException; +import java.io.Serial; +import java.io.StreamCorruptedException; import java.util.AbstractSet; import java.util.Collection; import java.util.Iterator; @@ -445,4 +452,38 @@ public class CopyOnWriteArraySet extends AbstractSet return Spliterators.spliterator (al.getArray(), Spliterator.IMMUTABLE | Spliterator.DISTINCT); } + + /** + * De-serialization without data not supported for this class. + */ + @Serial + private void readObjectNoData() throws ObjectStreamException { + throw new StreamCorruptedException("Deserialized CopyOnWriteArraySet requires data"); + } + + /** + * Reconstitutes the {@code CopyOnWriteArraySet} instance from a stream + * (that is, deserializes it). + * @throws StreamCorruptedException if the object read from the stream is invalid. + */ + @Serial + private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { + CopyOnWriteArrayList newAl; // Set during the duplicate check + + @SuppressWarnings("unchecked") + CopyOnWriteArrayList inAl = (CopyOnWriteArrayList) in.readFields().get("al", null); + + if (inAl == null + || inAl.getClass() != CopyOnWriteArrayList.class + || (newAl = new CopyOnWriteArrayList<>()).addAllAbsent(inAl) != inAl.size()) { + throw new StreamCorruptedException("Content is invalid"); + } + + final Unsafe U = Unsafe.getUnsafe(); + U.putReference( + this, + U.objectFieldOffset(CopyOnWriteArraySet.class, "al"), + newAl + ); + } } diff --git a/src/java.base/share/classes/module-info.java b/src/java.base/share/classes/module-info.java index 70a79390828..d20f6311bca 100644 --- a/src/java.base/share/classes/module-info.java +++ b/src/java.base/share/classes/module-info.java @@ -274,7 +274,8 @@ module java.base { jdk.httpserver, jdk.jlink, jdk.jpackage, - jdk.net; + jdk.net, + jdk.security.auth; exports sun.net to java.net.http, jdk.naming.dns; diff --git a/src/java.base/share/classes/sun/security/provider/certpath/URICertStore.java b/src/java.base/share/classes/sun/security/provider/certpath/URICertStore.java index 28729a56dbd..3e1fc8db164 100644 --- a/src/java.base/share/classes/sun/security/provider/certpath/URICertStore.java +++ b/src/java.base/share/classes/sun/security/provider/certpath/URICertStore.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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,6 +29,7 @@ import java.io.InputStream; import java.io.IOException; import java.net.HttpURLConnection; import java.net.URI; +import java.net.URISyntaxException; import java.net.URLConnection; import java.security.InvalidAlgorithmParameterException; import java.security.NoSuchAlgorithmException; @@ -48,8 +49,11 @@ import java.security.cert.X509CRL; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.LinkedHashSet; import java.util.List; import java.util.Locale; +import java.util.Optional; +import java.util.Set; import sun.security.x509.AccessDescription; import sun.security.x509.GeneralNameInterface; @@ -58,6 +62,8 @@ import sun.security.util.Cache; import sun.security.util.Debug; import sun.security.util.SecurityProperties; +import javax.security.auth.x500.X500Principal; + /** * A CertStore that retrieves Certificates or * CRLs from a URI, for example, as specified in an X.509 @@ -182,6 +188,166 @@ class URICertStore extends CertStoreSpi { return timeoutVal; } + /** + * Enumeration for the allowed schemes we support when following a + * URI from an authorityInfoAccess extension on a certificate. + */ + private enum AllowedScheme { + HTTP(HttpFtpRuleMatcher.HTTP), + HTTPS(HttpFtpRuleMatcher.HTTPS), + LDAP(LdapRuleMatcher.LDAP), + LDAPS(LdapRuleMatcher.LDAPS), + FTP(HttpFtpRuleMatcher.FTP); + + final URIRuleMatcher ruleMatcher; + + AllowedScheme(URIRuleMatcher matcher) { + ruleMatcher = matcher; + } + + /** + * Return an {@code AllowedScheme} based on a case-insensitive match + * @param name the scheme name to be matched + * @return the {@code AllowedScheme} that corresponds to the + * {@code name} provided, or null if there is no match. + */ + static AllowedScheme nameOf(String name) { + if (name == null) { + return null; + } + + try { + return AllowedScheme.valueOf(name.toUpperCase(Locale.ROOT)); + } catch (IllegalArgumentException _) { + return null; + } + } + } + + private static Set CA_ISS_URI_FILTERS = null; + private static final boolean CA_ISS_ALLOW_ANY; + + static { + boolean allowAny = false; + try { + if (Builder.USE_AIA) { + CA_ISS_URI_FILTERS = new LinkedHashSet<>(); + String aiaPropVal = Optional.ofNullable( + SecurityProperties.getOverridableProperty( + "com.sun.security.allowedAIALocations")). + map(String::trim).orElse(""); + if (aiaPropVal.equalsIgnoreCase("any")) { + allowAny = true; + if (debug != null) { + debug.println("allowedAIALocations: Warning: " + + "Allow-All URI filtering enabled!"); + } + } else { + // Load all the valid rules from the Security property + if (!aiaPropVal.isEmpty()) { + String[] aiaUriStrs = aiaPropVal.trim().split("\\s+"); + addCaIssUriFilters(aiaUriStrs); + } + + if (CA_ISS_URI_FILTERS.isEmpty()) { + if (debug != null) { + debug.println("allowedAIALocations: Warning: " + + "No valid filters found. Deny-all URI " + + "filtering is active."); + } + } + } + } + } finally { + CA_ISS_ALLOW_ANY = allowAny; + } + } + + /** + * Populate the filter collection from the list of AIA CA issuer URIs + * found in the {@code com.sun.security.allowedAIALocations} security + * or system property. + * + * @param aiaUriStrs array containing String URI filters + */ + private static void addCaIssUriFilters(String[] aiaUriStrs) { + for (String aiaStr : aiaUriStrs) { + if (aiaStr != null && !aiaStr.isEmpty()) { + try { + AllowedScheme scheme; + URI aiaUri = new URI(aiaStr).normalize(); + // It must be absolute and non-opaque + if (!aiaUri.isAbsolute() || aiaUri.isOpaque()) { + if (debug != null) { + debug.println("allowedAIALocations: Skipping " + + "non-absolute or opaque URI " + aiaUri); + } + } else if (aiaUri.getHost() == null) { + // We do not allow rules with URIs that omit a hostname + // or address. + if (debug != null) { + debug.println("allowedAIALocations: Skipping " + + "URI rule with no hostname or address: " + + aiaUri); + } + } else if ((scheme = AllowedScheme.nameOf( + aiaUri.getScheme())) != null) { + // When it is an LDAP type, we can check the path + // portion (the DN) for proper structure and reject + // the rule early if it isn't correct. + if (scheme == AllowedScheme.LDAP || + scheme == AllowedScheme.LDAPS) { + try { + new X500Principal(aiaUri.getPath(). + replaceFirst("^/+", "")); + } catch (IllegalArgumentException iae) { + if (debug != null) { + debug.println("allowedAIALocations: " + + "Skipping LDAP rule: " + iae); + } + continue; + } + } + + // When a URI has a non-null query or fragment + // warn the user upon adding the rule that those + // components will be ignored + if (aiaUri.getQuery() != null) { + if (debug != null) { + debug.println("allowedAIALocations: " + + "Rule will ignore non-null query"); + } + } + if (aiaUri.getFragment() != null) { + if (debug != null) { + debug.println("allowedAIALocations: " + + "Rule will ignore non-null fragment"); + } + } + + CA_ISS_URI_FILTERS.add(aiaUri); + if (debug != null) { + debug.println("allowedAIALocations: Added " + + aiaUri + " to URI filters"); + } + } else { + if (debug != null) { + debug.println("allowedAIALocations: Disallowed " + + "filter URI scheme: " + + aiaUri.getScheme()); + } + } + } catch (URISyntaxException urise) { + if (debug != null) { + debug.println("allowedAIALocations: Skipping " + + "filter URI entry " + aiaStr + + ": parse failure at index " + urise.getIndex()); + } + } + } + } + } + /** * Creates a URICertStore. * @@ -244,6 +410,39 @@ class URICertStore extends CertStoreSpi { return null; } URI uri = ((URIName) gn).getURI(); + + // Before performing any instantiation make sure that + // the URI passes any filtering rules. This processing should + // only occur if the com.sun.security.enableAIAcaIssuers is true + // and the "any" rule has not been specified. + if (Builder.USE_AIA && !CA_ISS_ALLOW_ANY) { + URI normAIAUri = uri.normalize(); + AllowedScheme scheme = AllowedScheme.nameOf(normAIAUri.getScheme()); + + if (scheme == null) { + if (debug != null) { + debug.println("allowedAIALocations: No matching ruleset " + + "for scheme " + normAIAUri.getScheme()); + } + return null; + } + + // Go through each of the filter rules and see if any will + // make a positive match against the caIssuer URI. If nothing + // matches then we won't instantiate a URICertStore. + if (CA_ISS_URI_FILTERS.stream().noneMatch(rule -> + scheme.ruleMatcher.matchRule(rule, normAIAUri))) { + if (debug != null) { + debug.println("allowedAIALocations: Warning - " + + "The caIssuer URI " + normAIAUri + + " in the AuthorityInfoAccess extension is denied " + + "access. Use the com.sun.security.allowedAIALocations" + + " security/system property to allow access."); + } + return null; + } + } + try { return URICertStore.getInstance(new URICertStoreParameters(uri)); } catch (Exception ex) { @@ -270,7 +469,7 @@ class URICertStore extends CertStoreSpi { @Override @SuppressWarnings("unchecked") public synchronized Collection engineGetCertificates - (CertSelector selector) throws CertStoreException { + (CertSelector selector) throws CertStoreException { if (ldap) { // caching mechanism, see the class description for more info. @@ -462,4 +661,159 @@ class URICertStore extends CertStoreSpi { super(spi, p, type, params); } } + + /** + * URIRuleMatcher - abstract base class for the rule sets used for + * various URI schemes. + */ + static abstract class URIRuleMatcher { + protected final int wellKnownPort; + + protected URIRuleMatcher(int port) { + wellKnownPort = port; + } + + /** + * Attempt to match the scheme, host and port between a filter + * rule URI and a URI coming from an AIA extension. + * + * @param filterRule the filter rule to match against + * @param caIssuer the AIA URI being compared + * @return true if the scheme, host and port numbers match, false if + * any of the components do not match. If a port number is omitted in + * either the filter rule or AIA URI, the well-known port for that + * scheme is used in the comparison. + */ + boolean schemeHostPortCheck(URI filterRule, URI caIssuer) { + if (!filterRule.getScheme().equalsIgnoreCase( + caIssuer.getScheme())) { + return false; + } else if (!filterRule.getHost().equalsIgnoreCase( + caIssuer.getHost())) { + return false; + } else { + try { + // Check for port matching, taking into consideration + // default ports + int fPort = (filterRule.getPort() == -1) ? wellKnownPort : + filterRule.getPort(); + int caiPort = (caIssuer.getPort() == -1) ? wellKnownPort : + caIssuer.getPort(); + if (fPort != caiPort) { + return false; + } + } catch (IllegalArgumentException iae) { + return false; + } + } + return true; + } + + /** + * Attempt to match an AIA URI against a specific filter rule. The + * specific rules to apply are implementation dependent. + * + * @param filterRule the filter rule to match against + * @param caIssuer the AIA URI being compared + * @return true if all matching rules pass, false if any fail. + */ + abstract boolean matchRule(URI filterRule, URI caIssuer); + } + + static class HttpFtpRuleMatcher extends URIRuleMatcher { + static final HttpFtpRuleMatcher HTTP = new HttpFtpRuleMatcher(80); + static final HttpFtpRuleMatcher HTTPS = new HttpFtpRuleMatcher(443); + static final HttpFtpRuleMatcher FTP = new HttpFtpRuleMatcher(21); + + private HttpFtpRuleMatcher(int port) { + super(port); + } + + @Override + boolean matchRule(URI filterRule, URI caIssuer) { + // Check for scheme/host/port matching + if (!schemeHostPortCheck(filterRule, caIssuer)) { + return false; + } + + // Check the path component to make sure the filter is at + // least a root of the AIA caIssuer URI's path. It must be + // a case-sensitive match for all platforms. + if (!isRootOf(filterRule, caIssuer)) { + if (debug != null) { + debug.println("allowedAIALocations: Match failed: " + + "AIA URI is not within the rule's path hierarchy."); + } + return false; + } + return true; + } + + /** + * Performs a hierarchical containment check, ensuring that the + * base URI's path is a root component of the candidate path. The + * path comparison is case-sensitive. If the base path ends in a + * slash (/) then all candidate paths that begin with the base + * path are allowed. If it does not end in a slash, then it is + * assumed that the leaf node in the base path is a file component + * and both paths must match exactly. + * + * @param base the URI that contains the root path + * @param candidate the URI that contains the path being evaluated + * @return true if {@code candidate} is a child path of {@code base}, + * false otherwise. + */ + private static boolean isRootOf(URI base, URI candidate) { + // Note: The URIs have already been normalized at this point and + // HTTP URIs cannot have null paths. If it's an empty path + // then consider the path to be "/". + String basePath = Optional.of(base.getPath()). + filter(p -> !p.isEmpty()).orElse("/"); + String candPath = Optional.of(candidate.getPath()). + filter(p -> !p.isEmpty()).orElse("/"); + return (basePath.endsWith("/")) ? candPath.startsWith(basePath) : + candPath.equals(basePath); + } + } + + static class LdapRuleMatcher extends URIRuleMatcher { + static final LdapRuleMatcher LDAP = new LdapRuleMatcher(389); + static final LdapRuleMatcher LDAPS = new LdapRuleMatcher(636); + + private LdapRuleMatcher(int port) { + super(port); + } + + @Override + boolean matchRule(URI filterRule, URI caIssuer) { + // Check for scheme/host/port matching + if (!schemeHostPortCheck(filterRule, caIssuer)) { + return false; + } + + // Obtain the base DN component and compare + try { + X500Principal filterBaseDn = new X500Principal( + filterRule.getPath().replaceFirst("^/+", "")); + X500Principal caIssBaseDn = new X500Principal( + caIssuer.getPath().replaceFirst("^/+", "")); + if (!filterBaseDn.equals(caIssBaseDn)) { + if (debug != null) { + debug.println("allowedAIALocations: Match failed: " + + "Base DN mismatch (" + filterBaseDn + " vs " + + caIssBaseDn + ")"); + } + return false; + } + } catch (IllegalArgumentException iae) { + if (debug != null) { + debug.println("allowedAIALocations: Match failed on DN: " + + iae); + } + return false; + } + + return true; + } + } } diff --git a/src/java.base/share/classes/sun/security/ssl/DHasKEM.java b/src/java.base/share/classes/sun/security/ssl/DHasKEM.java new file mode 100644 index 00000000000..763013f280c --- /dev/null +++ b/src/java.base/share/classes/sun/security/ssl/DHasKEM.java @@ -0,0 +1,254 @@ +/* + * 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.security.ssl; + +import sun.security.util.ArrayUtil; +import sun.security.util.CurveDB; +import sun.security.util.ECUtil; +import sun.security.util.NamedCurve; + +import javax.crypto.DecapsulateException; +import javax.crypto.KEM; +import javax.crypto.KEMSpi; +import javax.crypto.KeyAgreement; +import javax.crypto.SecretKey; +import java.io.IOException; +import java.math.BigInteger; +import java.security.*; +import java.security.interfaces.ECKey; +import java.security.interfaces.ECPublicKey; +import java.security.interfaces.XECKey; +import java.security.interfaces.XECPublicKey; +import java.security.spec.AlgorithmParameterSpec; +import java.security.spec.ECPoint; +import java.security.spec.ECPublicKeySpec; +import java.security.spec.InvalidKeySpecException; +import java.security.spec.KeySpec; +import java.security.spec.NamedParameterSpec; +import java.security.spec.XECPublicKeySpec; +import java.util.Arrays; + +/** + * The DHasKEM class presents a KEM abstraction layer over traditional + * DH-based key exchange, which can be used for either straight + * ECDH/XDH or TLS hybrid key exchanges. + * + * This class can be alongside standard full post-quantum KEMs + * when hybrid implementations are required. + */ +public class DHasKEM implements KEMSpi { + + @Override + public EncapsulatorSpi engineNewEncapsulator( + PublicKey publicKey, AlgorithmParameterSpec spec, + SecureRandom secureRandom) throws InvalidKeyException { + return new Handler(publicKey, null, secureRandom); + } + + @Override + public DecapsulatorSpi engineNewDecapsulator(PrivateKey privateKey, + AlgorithmParameterSpec spec) throws InvalidKeyException { + return new Handler(null, privateKey, null); + } + + private static final class Handler + implements KEMSpi.EncapsulatorSpi, KEMSpi.DecapsulatorSpi { + private final PublicKey pkR; + private final PrivateKey skR; + private final SecureRandom sr; + private final Params params; + + Handler(PublicKey pk, PrivateKey sk, SecureRandom sr) + throws InvalidKeyException { + this.pkR = pk; + this.skR = sk; + this.sr = sr; + this.params = paramsFromKey(pk == null ? sk : pk); + } + + @Override + public KEM.Encapsulated engineEncapsulate(int from, int to, + String algorithm) { + KeyPair kpE = params.generateKeyPair(sr); + PrivateKey skE = kpE.getPrivate(); + PublicKey pkE = kpE.getPublic(); + byte[] pkEm = params.SerializePublicKey(pkE); + try { + SecretKey dh = params.DH(algorithm, skE, pkR); + return new KEM.Encapsulated( + sub(dh, from, to), + pkEm, null); + } catch (Exception e) { + throw new ProviderException("internal error", e); + } + } + + @Override + public int engineSecretSize() { + return params.secretLen; + } + + @Override + public int engineEncapsulationSize() { + return params.publicKeyLen; + } + + @Override + public SecretKey engineDecapsulate(byte[] encapsulation, int from, + int to, String algorithm) throws DecapsulateException { + if (encapsulation.length != params.publicKeyLen) { + throw new DecapsulateException("incorrect encapsulation size"); + } + try { + PublicKey pkE = params.DeserializePublicKey(encapsulation); + SecretKey dh = params.DH(algorithm, skR, pkE); + return sub(dh, from, to); + } catch (IOException | InvalidKeyException e) { + throw new DecapsulateException("Cannot decapsulate", e); + } catch (Exception e) { + throw new ProviderException("internal error", e); + } + } + + private SecretKey sub(SecretKey key, int from, int to) { + if (from == 0 && to == params.secretLen) { + return key; + } + + // Key slicing should never happen. Otherwise, there might be + // a programming error. + throw new AssertionError( + "Unexpected key slicing: from=" + from + ", to=" + to); + } + + // This KEM is designed to be able to represent every ECDH and XDH + private Params paramsFromKey(Key k) throws InvalidKeyException { + if (k instanceof ECKey eckey) { + if (ECUtil.equals(eckey.getParams(), CurveDB.P_256)) { + return Params.P256; + } else if (ECUtil.equals(eckey.getParams(), CurveDB.P_384)) { + return Params.P384; + } else if (ECUtil.equals(eckey.getParams(), CurveDB.P_521)) { + return Params.P521; + } + } else if (k instanceof XECKey xkey + && xkey.getParams() instanceof NamedParameterSpec ns) { + if (ns.getName().equalsIgnoreCase( + NamedParameterSpec.X25519.getName())) { + return Params.X25519; + } else if (ns.getName().equalsIgnoreCase( + NamedParameterSpec.X448.getName())) { + return Params.X448; + } + } + throw new InvalidKeyException("Unsupported key"); + } + } + + private enum Params { + + P256(32, 2 * 32 + 1, + "ECDH", "EC", CurveDB.P_256), + + P384(48, 2 * 48 + 1, + "ECDH", "EC", CurveDB.P_384), + + P521(66, 2 * 66 + 1, + "ECDH", "EC", CurveDB.P_521), + + X25519(32, 32, + "XDH", "XDH", NamedParameterSpec.X25519), + + X448(56, 56, + "XDH", "XDH", NamedParameterSpec.X448); + + private final int secretLen; + private final int publicKeyLen; + private final String kaAlgorithm; + private final String keyAlgorithm; + private final AlgorithmParameterSpec spec; + + Params(int secretLen, int publicKeyLen, String kaAlgorithm, + String keyAlgorithm, AlgorithmParameterSpec spec) { + this.spec = spec; + this.secretLen = secretLen; + this.publicKeyLen = publicKeyLen; + this.kaAlgorithm = kaAlgorithm; + this.keyAlgorithm = keyAlgorithm; + } + + private boolean isEC() { + return this == P256 || this == P384 || this == P521; + } + + private KeyPair generateKeyPair(SecureRandom sr) { + try { + KeyPairGenerator g = KeyPairGenerator.getInstance(keyAlgorithm); + g.initialize(spec, sr); + return g.generateKeyPair(); + } catch (Exception e) { + throw new ProviderException("internal error", e); + } + } + + private byte[] SerializePublicKey(PublicKey k) { + if (isEC()) { + ECPoint w = ((ECPublicKey) k).getW(); + return ECUtil.encodePoint(w, ((NamedCurve) spec).getCurve()); + } else { + byte[] uArray = ((XECPublicKey) k).getU().toByteArray(); + ArrayUtil.reverse(uArray); + return Arrays.copyOf(uArray, publicKeyLen); + } + } + + private PublicKey DeserializePublicKey(byte[] data) throws + IOException, NoSuchAlgorithmException, + InvalidKeySpecException { + KeySpec keySpec; + if (isEC()) { + NamedCurve curve = (NamedCurve) this.spec; + keySpec = new ECPublicKeySpec( + ECUtil.decodePoint(data, curve.getCurve()), curve); + } else { + data = data.clone(); + ArrayUtil.reverse(data); + keySpec = new XECPublicKeySpec( + this.spec, new BigInteger(1, data)); + } + return KeyFactory.getInstance(keyAlgorithm). + generatePublic(keySpec); + } + + private SecretKey DH(String alg, PrivateKey skE, PublicKey pkR) + throws NoSuchAlgorithmException, InvalidKeyException { + KeyAgreement ka = KeyAgreement.getInstance(kaAlgorithm); + ka.init(skE); + ka.doPhase(pkR, true); + return ka.generateSecret(alg); + } + } +} diff --git a/src/java.base/share/classes/sun/security/ssl/Hybrid.java b/src/java.base/share/classes/sun/security/ssl/Hybrid.java new file mode 100644 index 00000000000..e3e2cfa0b23 --- /dev/null +++ b/src/java.base/share/classes/sun/security/ssl/Hybrid.java @@ -0,0 +1,474 @@ +/* + * 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.security.ssl; + +import sun.security.util.ArrayUtil; +import sun.security.util.CurveDB; +import sun.security.util.ECUtil; +import sun.security.util.RawKeySpec; +import sun.security.x509.X509Key; + +import javax.crypto.DecapsulateException; +import javax.crypto.KEM; +import javax.crypto.KEMSpi; +import javax.crypto.SecretKey; +import java.math.BigInteger; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidKeyException; +import java.security.Key; +import java.security.KeyFactory; +import java.security.KeyFactorySpi; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.KeyPairGeneratorSpi; +import java.security.NoSuchAlgorithmException; +import java.security.PrivateKey; +import java.security.ProviderException; +import java.security.PublicKey; +import java.security.SecureRandom; +import java.security.spec.*; +import java.util.Arrays; +import java.util.Locale; + +// The Hybrid class wraps two underlying algorithms (left and right sides) +// in a single TLS hybrid named group. +// It implements: +// - Hybrid KeyPair generation +// - Hybrid KeyFactory for decoding concatenated hybrid public keys +// - Hybrid KEM implementation for performing encapsulation and +// decapsulation over two underlying algorithms (traditional +// algorithm and post-quantum KEM algorithm) + +public class Hybrid { + + public static final NamedParameterSpec X25519_MLKEM768 = + new NamedParameterSpec("X25519MLKEM768"); + + public static final NamedParameterSpec SECP256R1_MLKEM768 = + new NamedParameterSpec("SecP256r1MLKEM768"); + + public static final NamedParameterSpec SECP384R1_MLKEM1024 = + new NamedParameterSpec("SecP384r1MLKEM1024"); + + private static AlgorithmParameterSpec getSpec(String name) { + if (name.startsWith("secp")) { + return new ECGenParameterSpec(name); + } else { + return new NamedParameterSpec(name); + } + } + + private static KeyPairGenerator getKeyPairGenerator(String name) throws + NoSuchAlgorithmException { + if (name.startsWith("secp")) { + name = "EC"; + } + return KeyPairGenerator.getInstance(name); + } + + private static KeyFactory getKeyFactory(String name) throws + NoSuchAlgorithmException { + if (name.startsWith("secp")) { + name = "EC"; + } + return KeyFactory.getInstance(name); + } + + /** + * Returns a KEM instance for each side of the hybrid algorithm. + * For traditional key exchange algorithms, we use the DH-based KEM + * implementation provided by DHasKEM class. + * For ML-KEM post-quantum algorithms, we obtain a KEM instance + * with "ML-KEM". This is done to work with 3rd-party providers that + * only have "ML-KEM" KEM algorithm. + */ + private static KEM getKEM(String name) throws NoSuchAlgorithmException { + if (name.startsWith("secp") || name.equals("X25519")) { + return KEM.getInstance("DH", HybridProvider.PROVIDER); + } else { + return KEM.getInstance("ML-KEM"); + } + } + + public static class KeyPairGeneratorImpl extends KeyPairGeneratorSpi { + private final KeyPairGenerator left; + private final KeyPairGenerator right; + private final AlgorithmParameterSpec leftSpec; + private final AlgorithmParameterSpec rightSpec; + + public KeyPairGeneratorImpl(String leftAlg, String rightAlg) + throws NoSuchAlgorithmException { + left = getKeyPairGenerator(leftAlg); + right = getKeyPairGenerator(rightAlg); + leftSpec = getSpec(leftAlg); + rightSpec = getSpec(rightAlg); + } + + @Override + public void initialize(AlgorithmParameterSpec params, + SecureRandom random) + throws InvalidAlgorithmParameterException { + left.initialize(leftSpec, random); + right.initialize(rightSpec, random); + } + + @Override + public void initialize(int keysize, SecureRandom random) { + // NO-OP (do nothing) + } + + @Override + public KeyPair generateKeyPair() { + var kp1 = left.generateKeyPair(); + var kp2 = right.generateKeyPair(); + return new KeyPair( + new PublicKeyImpl("Hybrid", kp1.getPublic(), + kp2.getPublic()), + new PrivateKeyImpl("Hybrid", kp1.getPrivate(), + kp2.getPrivate())); + } + } + + public static class KeyFactoryImpl extends KeyFactorySpi { + private final KeyFactory left; + private final KeyFactory right; + private final int leftlen; + private final String leftname; + private final String rightname; + + public KeyFactoryImpl(String left, String right) + throws NoSuchAlgorithmException { + this.left = getKeyFactory(left); + this.right = getKeyFactory(right); + this.leftlen = leftPublicLength(left); + this.leftname = left; + this.rightname = right; + } + + @Override + protected PublicKey engineGeneratePublic(KeySpec keySpec) + throws InvalidKeySpecException { + if (keySpec == null) { + throw new InvalidKeySpecException("keySpec must not be null"); + } + + if (keySpec instanceof RawKeySpec rks) { + byte[] key = rks.getKeyArr(); + if (key == null) { + throw new InvalidKeySpecException( + "RawkeySpec contains null key data"); + } + if (key.length <= leftlen) { + throw new InvalidKeySpecException( + "Hybrid key length " + key.length + + " is too short and its left key length is " + + leftlen); + } + + byte[] leftKeyBytes = Arrays.copyOfRange(key, 0, leftlen); + byte[] rightKeyBytes = Arrays.copyOfRange(key, leftlen, + key.length); + PublicKey leftKey, rightKey; + + try { + if (leftname.startsWith("secp")) { + var curve = CurveDB.lookup(leftname); + var ecSpec = new ECPublicKeySpec( + ECUtil.decodePoint(leftKeyBytes, + curve.getCurve()), curve); + leftKey = left.generatePublic(ecSpec); + } else if (leftname.startsWith("ML-KEM")) { + leftKey = left.generatePublic(new RawKeySpec( + leftKeyBytes)); + } else { + throw new InvalidKeySpecException("Unsupported left" + + " algorithm" + leftname); + } + + if (rightname.equals("X25519")) { + ArrayUtil.reverse(rightKeyBytes); + var xecSpec = new XECPublicKeySpec( + new NamedParameterSpec(rightname), + new BigInteger(1, rightKeyBytes)); + rightKey = right.generatePublic(xecSpec); + } else if (rightname.startsWith("ML-KEM")) { + rightKey = right.generatePublic(new RawKeySpec( + rightKeyBytes)); + } else { + throw new InvalidKeySpecException("Unsupported right" + + " algorithm: " + rightname); + } + + return new PublicKeyImpl("Hybrid", leftKey, rightKey); + } catch (Exception e) { + throw new InvalidKeySpecException("Failed to decode " + + "hybrid key", e); + } + } + + throw new InvalidKeySpecException( + "KeySpec type:" + + keySpec.getClass().getName() + " not supported"); + } + + private static int leftPublicLength(String name) { + return switch (name.toLowerCase(Locale.ROOT)) { + case "secp256r1" -> 65; + case "secp384r1" -> 97; + case "ml-kem-768" -> 1184; + default -> throw new IllegalArgumentException( + "Unknown named group: " + name); + }; + } + + @Override + protected PrivateKey engineGeneratePrivate(KeySpec keySpec) throws + InvalidKeySpecException { + throw new UnsupportedOperationException(); + } + + @Override + protected T engineGetKeySpec(Key key, + Class keySpec) throws InvalidKeySpecException { + throw new UnsupportedOperationException(); + } + + @Override + protected Key engineTranslateKey(Key key) throws InvalidKeyException { + throw new UnsupportedOperationException(); + } + } + + public static class KEMImpl implements KEMSpi { + private final KEM left; + private final KEM right; + + public KEMImpl(String left, String right) + throws NoSuchAlgorithmException { + this.left = getKEM(left); + this.right = getKEM(right); + } + + @Override + public EncapsulatorSpi engineNewEncapsulator(PublicKey publicKey, + AlgorithmParameterSpec spec, SecureRandom secureRandom) throws + InvalidAlgorithmParameterException, InvalidKeyException { + if (publicKey instanceof PublicKeyImpl pk) { + return new Handler(left.newEncapsulator(pk.left, secureRandom), + right.newEncapsulator(pk.right, secureRandom), + null, null); + } + throw new InvalidKeyException(); + } + + @Override + public DecapsulatorSpi engineNewDecapsulator(PrivateKey privateKey, + AlgorithmParameterSpec spec) + throws InvalidAlgorithmParameterException, InvalidKeyException { + if (privateKey instanceof PrivateKeyImpl pk) { + return new Handler(null, null, left.newDecapsulator(pk.left), + right.newDecapsulator(pk.right)); + } + throw new InvalidKeyException(); + } + } + + private static byte[] concat(byte[]... inputs) { + int outLen = 0; + for (byte[] in : inputs) { + outLen += in.length; + } + byte[] out = new byte[outLen]; + int pos = 0; + for (byte[] in : inputs) { + System.arraycopy(in, 0, out, pos, in.length); + pos += in.length; + } + return out; + } + + private record Handler(KEM.Encapsulator le, KEM.Encapsulator re, + KEM.Decapsulator ld, KEM.Decapsulator rd) + implements KEMSpi.EncapsulatorSpi, KEMSpi.DecapsulatorSpi { + @Override + public KEM.Encapsulated engineEncapsulate(int from, int to, + String algorithm) { + int expectedSecretSize = engineSecretSize(); + if (!(from == 0 && to == expectedSecretSize)) { + throw new IllegalArgumentException( + "Invalid range for encapsulation: from = " + from + + " to = " + to + ", expected total secret size = " + + expectedSecretSize); + } + + var left = le.encapsulate(); + var right = re.encapsulate(); + return new KEM.Encapsulated( + new SecretKeyImpl(left.key(), right.key()), + concat(left.encapsulation(), right.encapsulation()), + null); + } + + @Override + public int engineSecretSize() { + if (le != null) { + return le.secretSize() + re.secretSize(); + } else { + return ld.secretSize() + rd.secretSize(); + } + } + + @Override + public int engineEncapsulationSize() { + if (le != null) { + return le.encapsulationSize() + re.encapsulationSize(); + } else { + return ld.encapsulationSize() + rd.encapsulationSize(); + } + } + + @Override + public SecretKey engineDecapsulate(byte[] encapsulation, int from, + int to, String algorithm) throws DecapsulateException { + int expectedEncSize = engineEncapsulationSize(); + if (encapsulation.length != expectedEncSize) { + throw new IllegalArgumentException( + "Invalid key encapsulation message length: " + + encapsulation.length + + ", expected = " + expectedEncSize); + } + + int expectedSecretSize = engineSecretSize(); + if (!(from == 0 && to == expectedSecretSize)) { + throw new IllegalArgumentException( + "Invalid range for decapsulation: from = " + from + + " to = " + to + ", expected total secret size = " + + expectedSecretSize); + } + + var left = Arrays.copyOf(encapsulation, ld.encapsulationSize()); + var right = Arrays.copyOfRange(encapsulation, + ld.encapsulationSize(), encapsulation.length); + return new SecretKeyImpl( + ld.decapsulate(left), + rd.decapsulate(right) + ); + } + } + + // Package-private + record SecretKeyImpl(SecretKey k1, SecretKey k2) + implements SecretKey { + @Override + public String getAlgorithm() { + return "Generic"; + } + + @Override + public String getFormat() { + return null; + } + + @Override + public byte[] getEncoded() { + return null; + } + } + + /** + * Hybrid public key combines two underlying public keys (left and right). + * Public keys can be transmitted/encoded because the hybrid protocol + * requires the public component to be sent. + */ + // Package-private + record PublicKeyImpl(String algorithm, PublicKey left, + PublicKey right) implements PublicKey { + @Override + public String getAlgorithm() { + return algorithm; + } + + // getFormat() returns "RAW" as hybrid key uses RAW concatenation + // of underlying encodings. + @Override + public String getFormat() { + return "RAW"; + } + + // getEncoded() returns the concatenation of the encoded bytes of the + // left and right public keys. + @Override + public byte[] getEncoded() { + return concat(onlyKey(left), onlyKey(right)); + } + + static byte[] onlyKey(PublicKey key) { + if (key instanceof X509Key xk) { + return xk.getKeyAsBytes(); + } + + // Fallback for 3rd-party providers + if (!"X.509".equalsIgnoreCase(key.getFormat())) { + throw new ProviderException("Invalid public key encoding " + + "format"); + } + var xk = new X509Key(); + try { + xk.decode(key.getEncoded()); + } catch (InvalidKeyException e) { + throw new ProviderException("Invalid public key encoding", e); + } + return xk.getKeyAsBytes(); + } + } + + /** + * Hybrid private key combines two underlying private keys (left and right). + * It is for internal use only. The private keys should never be exported. + */ + private record PrivateKeyImpl(String algorithm, PrivateKey left, + PrivateKey right) implements PrivateKey { + + @Override + public String getAlgorithm() { + return algorithm; + } + + // getFormat() returns null because there is no standard + // format for a hybrid private key. + @Override + public String getFormat() { + return null; + } + + // getEncoded() returns an empty byte array because there is no + // standard encoding format for a hybrid private key. + @Override + public byte[] getEncoded() { + return null; + } + } +} diff --git a/src/java.base/share/classes/sun/security/ssl/HybridProvider.java b/src/java.base/share/classes/sun/security/ssl/HybridProvider.java new file mode 100644 index 00000000000..c77d6f66273 --- /dev/null +++ b/src/java.base/share/classes/sun/security/ssl/HybridProvider.java @@ -0,0 +1,130 @@ +/* + * 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.security.ssl; + +import java.security.Provider; +import java.security.NoSuchAlgorithmException; +import java.util.List; +import java.util.Map; + +import static sun.security.util.SecurityConstants.PROVIDER_VER; + +// This is an internal provider used in the JSSE code for DH-as-KEM +// and Hybrid KEM support. It doesn't actually get installed in the +// system's list of security providers that is searched at runtime. +// JSSE loads this provider internally. +// It registers Hybrid KeyPairGenerator, KeyFactory, and KEM +// implementations for hybrid named groups as Provider services. + +public class HybridProvider { + + public static final Provider PROVIDER = new ProviderImpl(); + + private static final class ProviderImpl extends Provider { + @java.io.Serial + private static final long serialVersionUID = 0L; + + ProviderImpl() { + super("HybridAndDHAsKEM", PROVIDER_VER, + "Hybrid and DHAsKEM provider"); + put("KEM.DH", DHasKEM.class.getName()); + + // Hybrid KeyPairGenerator/KeyFactory/KEM + + // The order of shares in the concatenation for group name + // X25519MLKEM768 has been reversed as per the current + // draft RFC. + var attrs = Map.of("name", "X25519MLKEM768", "left", "ML-KEM-768", + "right", "X25519"); + putService(new HybridService(this, "KeyPairGenerator", + "X25519MLKEM768", + "sun.security.ssl.Hybrid$KeyPairGeneratorImpl", + null, attrs)); + putService(new HybridService(this, "KEM", + "X25519MLKEM768", + "sun.security.ssl.Hybrid$KEMImpl", + null, attrs)); + putService(new HybridService(this, "KeyFactory", + "X25519MLKEM768", + "sun.security.ssl.Hybrid$KeyFactoryImpl", + null, attrs)); + + attrs = Map.of("name", "SecP256r1MLKEM768", "left", "secp256r1", + "right", "ML-KEM-768"); + putService(new HybridService(this, "KeyPairGenerator", + "SecP256r1MLKEM768", + "sun.security.ssl.Hybrid$KeyPairGeneratorImpl", + null, attrs)); + putService(new HybridService(this, "KEM", + "SecP256r1MLKEM768", + "sun.security.ssl.Hybrid$KEMImpl", + null, attrs)); + putService(new HybridService(this, "KeyFactory", + "SecP256r1MLKEM768", + "sun.security.ssl.Hybrid$KeyFactoryImpl", + null, attrs)); + + attrs = Map.of("name", "SecP384r1MLKEM1024", "left", "secp384r1", + "right", "ML-KEM-1024"); + putService(new HybridService(this, "KeyPairGenerator", + "SecP384r1MLKEM1024", + "sun.security.ssl.Hybrid$KeyPairGeneratorImpl", + null, attrs)); + putService(new HybridService(this, "KEM", + "SecP384r1MLKEM1024", + "sun.security.ssl.Hybrid$KEMImpl", + null, attrs)); + putService(new HybridService(this, "KeyFactory", + "SecP384r1MLKEM1024", + "sun.security.ssl.Hybrid$KeyFactoryImpl", + null, attrs)); + } + } + + private static class HybridService extends Provider.Service { + + HybridService(Provider p, String type, String algo, String cn, + List aliases, Map attrs) { + super(p, type, algo, cn, aliases, attrs); + } + + @Override + public Object newInstance(Object ctrParamObj) + throws NoSuchAlgorithmException { + String type = getType(); + return switch (type) { + case "KeyPairGenerator" -> new Hybrid.KeyPairGeneratorImpl( + getAttribute("left"), getAttribute("right")); + case "KeyFactory" -> new Hybrid.KeyFactoryImpl( + getAttribute("left"), getAttribute("right")); + case "KEM" -> new Hybrid.KEMImpl( + getAttribute("left"), getAttribute("right")); + default -> throw new NoSuchAlgorithmException( + "Unexpected value: " + type); + }; + } + } +} diff --git a/src/java.base/share/classes/sun/security/ssl/JsseJce.java b/src/java.base/share/classes/sun/security/ssl/JsseJce.java index 3ffc2d84168..1e610eeab1d 100644 --- a/src/java.base/share/classes/sun/security/ssl/JsseJce.java +++ b/src/java.base/share/classes/sun/security/ssl/JsseJce.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2022, 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 @@ -165,7 +165,6 @@ final class JsseJce { static { boolean mediator = true; try { - Signature.getInstance(SIGNATURE_ECDSA); Signature.getInstance(SIGNATURE_RAWECDSA); KeyAgreement.getInstance("ECDH"); KeyFactory.getInstance("EC"); diff --git a/src/java.base/share/classes/sun/security/ssl/KAKeyDerivation.java b/src/java.base/share/classes/sun/security/ssl/KAKeyDerivation.java index 623f83f547a..af62faf4706 100644 --- a/src/java.base/share/classes/sun/security/ssl/KAKeyDerivation.java +++ b/src/java.base/share/classes/sun/security/ssl/KAKeyDerivation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 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 @@ -24,7 +24,10 @@ */ package sun.security.ssl; +import sun.security.util.RawKeySpec; + import javax.crypto.KDF; +import javax.crypto.KEM; import javax.crypto.KeyAgreement; import javax.crypto.SecretKey; import javax.crypto.spec.HKDFParameterSpec; @@ -32,9 +35,11 @@ import javax.net.ssl.SSLHandshakeException; import java.io.IOException; import java.security.GeneralSecurityException; +import java.security.KeyFactory; import java.security.PrivateKey; +import java.security.Provider; import java.security.PublicKey; -import java.security.spec.AlgorithmParameterSpec; +import java.security.SecureRandom; import sun.security.util.KeyUtil; /** @@ -46,15 +51,32 @@ public class KAKeyDerivation implements SSLKeyDerivation { private final HandshakeContext context; private final PrivateKey localPrivateKey; private final PublicKey peerPublicKey; + private final byte[] keyshare; + private final Provider provider; + // Constructor called by Key Agreement KAKeyDerivation(String algorithmName, HandshakeContext context, PrivateKey localPrivateKey, PublicKey peerPublicKey) { + this(algorithmName, null, context, localPrivateKey, + peerPublicKey, null); + } + + // When the constructor called by KEM: store the client's public key or the + // encapsulated message in keyshare. + KAKeyDerivation(String algorithmName, + NamedGroup namedGroup, + HandshakeContext context, + PrivateKey localPrivateKey, + PublicKey peerPublicKey, + byte[] keyshare) { this.algorithmName = algorithmName; this.context = context; this.localPrivateKey = localPrivateKey; this.peerPublicKey = peerPublicKey; + this.keyshare = keyshare; + this.provider = (namedGroup != null) ? namedGroup.getProvider() : null; } @Override @@ -94,22 +116,15 @@ public class KAKeyDerivation implements SSLKeyDerivation { } } - /** - * Handle the TLSv1.3 objects, which use the HKDF algorithms. - */ - private SecretKey t13DeriveKey(String type) - throws IOException { - SecretKey sharedSecret = null; + private SecretKey deriveHandshakeSecret(String label, + SecretKey sharedSecret) + throws GeneralSecurityException, IOException { SecretKey earlySecret = null; SecretKey saltSecret = null; - try { - KeyAgreement ka = KeyAgreement.getInstance(algorithmName); - ka.init(localPrivateKey); - ka.doPhase(peerPublicKey, true); - sharedSecret = ka.generateSecret("TlsPremasterSecret"); - CipherSuite.HashAlg hashAlg = context.negotiatedCipherSuite.hashAlg; - SSLKeyDerivation kd = context.handshakeKeyDerivation; + CipherSuite.HashAlg hashAlg = context.negotiatedCipherSuite.hashAlg; + SSLKeyDerivation kd = context.handshakeKeyDerivation; + try { if (kd == null) { // No PSK is in use. // If PSK is not in use, Early Secret will still be // HKDF-Extract(0, 0). @@ -129,12 +144,90 @@ public class KAKeyDerivation implements SSLKeyDerivation { // the handshake secret key derivation (below) as it may not // work with the "sharedSecret" obj. KDF hkdf = KDF.getInstance(hashAlg.hkdfAlgorithm); - return hkdf.deriveKey(type, HKDFParameterSpec.ofExtract() - .addSalt(saltSecret).addIKM(sharedSecret).extractOnly()); + var spec = HKDFParameterSpec.ofExtract().addSalt(saltSecret); + if (sharedSecret instanceof Hybrid.SecretKeyImpl hsk) { + spec = spec.addIKM(hsk.k1()).addIKM(hsk.k2()); + } else { + spec = spec.addIKM(sharedSecret); + } + + return hkdf.deriveKey(label, spec.extractOnly()); + } finally { + KeyUtil.destroySecretKeys(earlySecret, saltSecret); + } + } + /** + * This method is called by the server to perform KEM encapsulation. + * It uses the client's public key (sent by the client as a keyshare) + * to encapsulate a shared secret and returns the encapsulated message. + * + * Package-private, used from KeyShareExtension.SHKeyShareProducer:: + * produce(). + */ + KEM.Encapsulated encapsulate(String algorithm, SecureRandom random) + throws IOException { + SecretKey sharedSecret = null; + + if (keyshare == null) { + throw new IOException("No keyshare available for KEM " + + "encapsulation"); + } + + try { + KeyFactory kf = (provider != null) ? + KeyFactory.getInstance(algorithmName, provider) : + KeyFactory.getInstance(algorithmName); + var pk = kf.generatePublic(new RawKeySpec(keyshare)); + + KEM kem = (provider != null) ? + KEM.getInstance(algorithmName, provider) : + KEM.getInstance(algorithmName); + KEM.Encapsulator e = kem.newEncapsulator(pk, random); + KEM.Encapsulated enc = e.encapsulate(); + sharedSecret = enc.key(); + + SecretKey derived = deriveHandshakeSecret(algorithm, sharedSecret); + + return new KEM.Encapsulated(derived, enc.encapsulation(), null); } catch (GeneralSecurityException gse) { throw new SSLHandshakeException("Could not generate secret", gse); } finally { - KeyUtil.destroySecretKeys(sharedSecret, earlySecret, saltSecret); + KeyUtil.destroySecretKeys(sharedSecret); + } + } + + /** + * Handle the TLSv1.3 objects, which use the HKDF algorithms. + */ + private SecretKey t13DeriveKey(String type) + throws IOException { + SecretKey sharedSecret = null; + + try { + if (keyshare != null) { + // Using KEM: called by the client after receiving the KEM + // ciphertext (keyshare) from the server in ServerHello. + // The client decapsulates it using its private key. + KEM kem = (provider != null) + ? KEM.getInstance(algorithmName, provider) + : KEM.getInstance(algorithmName); + var decapsulator = kem.newDecapsulator(localPrivateKey); + sharedSecret = decapsulator.decapsulate( + keyshare, 0, decapsulator.secretSize(), + "Generic"); + } else { + // Using traditional DH-style Key Agreement + KeyAgreement ka = KeyAgreement.getInstance(algorithmName); + ka.init(localPrivateKey); + ka.doPhase(peerPublicKey, true); + sharedSecret = ka.generateSecret("Generic"); + } + + return deriveHandshakeSecret(type, sharedSecret); + } catch (GeneralSecurityException gse) { + throw new SSLHandshakeException("Could not generate secret", gse); + } finally { + KeyUtil.destroySecretKeys(sharedSecret); } } } diff --git a/src/java.base/share/classes/sun/security/ssl/KEMKeyExchange.java b/src/java.base/share/classes/sun/security/ssl/KEMKeyExchange.java new file mode 100644 index 00000000000..fb8de6cb104 --- /dev/null +++ b/src/java.base/share/classes/sun/security/ssl/KEMKeyExchange.java @@ -0,0 +1,223 @@ +/* + * 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package sun.security.ssl; + +import java.io.IOException; +import java.security.GeneralSecurityException; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.PrivateKey; +import java.security.Provider; +import java.security.ProviderException; +import java.security.PublicKey; +import java.security.SecureRandom; +import java.security.spec.NamedParameterSpec; +import javax.crypto.SecretKey; + +import sun.security.ssl.NamedGroup.NamedGroupSpec; +import sun.security.x509.X509Key; + +/** + * Specifics for single or hybrid Key exchanges based on KEM + */ +final class KEMKeyExchange { + + static final SSLKeyAgreementGenerator kemKAGenerator + = new KEMKAGenerator(); + + static final class KEMCredentials implements NamedGroupCredentials { + + final NamedGroup namedGroup; + // Unlike other credentials, we directly store the key share + // value here, no need to convert to a key + private final byte[] keyshare; + + KEMCredentials(byte[] keyshare, NamedGroup namedGroup) { + this.keyshare = keyshare; + this.namedGroup = namedGroup; + } + + // For KEM, server performs encapsulation and the resulting + // encapsulated message becomes the key_share value sent to + // the client. It is not a public key, so no PublicKey object + // to return. + @Override + public PublicKey getPublicKey() { + throw new UnsupportedOperationException( + "KEMCredentials stores raw keyshare, not a PublicKey"); + } + + public byte[] getKeyShare() { + return keyshare; + } + + @Override + public NamedGroup getNamedGroup() { + return namedGroup; + } + + /** + * Instantiates a KEMCredentials object + */ + static KEMCredentials valueOf(NamedGroup namedGroup, + byte[] encodedPoint) { + + if (namedGroup.spec != NamedGroupSpec.NAMED_GROUP_KEM) { + throw new RuntimeException( + "Credentials decoding: Not KEM named group"); + } + + if (encodedPoint == null || encodedPoint.length == 0) { + return null; + } + + return new KEMCredentials(encodedPoint, namedGroup); + } + } + + private static class KEMPossession implements SSLPossession { + private final NamedGroup namedGroup; + + public KEMPossession(NamedGroup ng) { + this.namedGroup = ng; + } + public NamedGroup getNamedGroup() { + return namedGroup; + } + } + + static final class KEMReceiverPossession extends KEMPossession { + + private final PrivateKey privateKey; + private final PublicKey publicKey; + + KEMReceiverPossession(NamedGroup namedGroup, SecureRandom random) { + super(namedGroup); + String algName = null; + try { + // For KEM: This receiver side (client) generates a key pair. + algName = ((NamedParameterSpec)namedGroup.keAlgParamSpec). + getName(); + Provider provider = namedGroup.getProvider(); + KeyPairGenerator kpg = (provider != null) ? + KeyPairGenerator.getInstance(algName, provider) : + KeyPairGenerator.getInstance(algName); + + kpg.initialize(namedGroup.keAlgParamSpec, random); + KeyPair kp = kpg.generateKeyPair(); + privateKey = kp.getPrivate(); + publicKey = kp.getPublic(); + } catch (GeneralSecurityException e) { + throw new RuntimeException( + "Could not generate keypair for algorithm: " + + algName, e); + } + } + + @Override + public byte[] encode() { + if (publicKey instanceof X509Key xk) { + return xk.getKeyAsBytes(); + } else if (publicKey instanceof Hybrid.PublicKeyImpl hk) { + return hk.getEncoded(); + } + throw new ProviderException("Unsupported key type: " + publicKey); + } + + // Package-private + PublicKey getPublicKey() { + return publicKey; + } + + // Package-private + PrivateKey getPrivateKey() { + return privateKey; + } + } + + static final class KEMSenderPossession extends KEMPossession { + + private SecretKey key; + private final SecureRandom random; + + KEMSenderPossession(NamedGroup namedGroup, SecureRandom random) { + super(namedGroup); + this.random = random; + } + + // Package-private + SecureRandom getRandom() { + return random; + } + + // Package-private + SecretKey getKey() { + return key; + } + + // Package-private + void setKey(SecretKey key) { + this.key = key; + } + + @Override + public byte[] encode() { + throw new UnsupportedOperationException("encode() not supported"); + } + } + + private static final class KEMKAGenerator + implements SSLKeyAgreementGenerator { + + // Prevent instantiation of this class. + private KEMKAGenerator() { + // blank + } + + @Override + public SSLKeyDerivation createKeyDerivation( + HandshakeContext context) throws IOException { + for (SSLPossession poss : context.handshakePossessions) { + if (poss instanceof KEMReceiverPossession kposs) { + NamedGroup ng = kposs.getNamedGroup(); + for (SSLCredentials cred : context.handshakeCredentials) { + if (cred instanceof KEMCredentials kcred && + ng.equals(kcred.namedGroup)) { + String name = ((NamedParameterSpec) + ng.keAlgParamSpec).getName(); + return new KAKeyDerivation(name, ng, context, + kposs.getPrivateKey(), null, + kcred.getKeyShare()); + } + } + } + } + context.conContext.fatal(Alert.HANDSHAKE_FAILURE, + "No suitable KEM key agreement " + + "parameters negotiated"); + return null; + } + } +} 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 8d785f7515a..0d2cbb8f529 100644 --- a/src/java.base/share/classes/sun/security/ssl/KeyShareExtension.java +++ b/src/java.base/share/classes/sun/security/ssl/KeyShareExtension.java @@ -27,8 +27,11 @@ package sun.security.ssl; import java.io.IOException; import java.nio.ByteBuffer; +import java.security.AlgorithmConstraints; import java.security.CryptoPrimitive; import java.security.GeneralSecurityException; +import java.security.spec.AlgorithmParameterSpec; +import java.security.spec.NamedParameterSpec; import java.text.MessageFormat; import java.util.*; import javax.net.ssl.SSLProtocolException; @@ -297,7 +300,9 @@ final class KeyShareExtension { // update the context chc.handshakePossessions.add(pos); // May need more possession types in the future. - if (pos instanceof NamedGroupPossession) { + if (pos instanceof NamedGroupPossession || + pos instanceof + KEMKeyExchange.KEMReceiverPossession) { return pos.encode(); } } @@ -358,24 +363,16 @@ final class KeyShareExtension { try { SSLCredentials kaCred = ng.decodeCredentials(entry.keyExchange); - if (shc.algorithmConstraints != null && - kaCred instanceof - NamedGroupCredentials namedGroupCredentials) { - if (!shc.algorithmConstraints.permits( - EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), - namedGroupCredentials.getPublicKey())) { - if (SSLLogger.isOn() && - SSLLogger.isOn("ssl,handshake")) { - SSLLogger.warning( + + if (!isCredentialPermitted(shc.algorithmConstraints, + kaCred)) { + if (SSLLogger.isOn() && + SSLLogger.isOn("ssl,handshake")) { + SSLLogger.warning( "key share entry of " + ng + " does not " + - " comply with algorithm constraints"); - } - - kaCred = null; + "comply with algorithm constraints"); } - } - - if (kaCred != null) { + } else { credentials.add(kaCred); } } catch (GeneralSecurityException ex) { @@ -513,7 +510,8 @@ final class KeyShareExtension { @Override public byte[] produce(ConnectionContext context, HandshakeMessage message) throws IOException { - // The producing happens in client side only. + // The producing happens in server side only. + ServerHandshakeContext shc = (ServerHandshakeContext)context; // In response to key_share request only @@ -571,7 +569,9 @@ final class KeyShareExtension { SSLPossession[] poses = ke.createPossessions(shc); for (SSLPossession pos : poses) { - if (!(pos instanceof NamedGroupPossession)) { + if (!(pos instanceof NamedGroupPossession || + pos instanceof + KEMKeyExchange.KEMSenderPossession)) { // May need more possession types in the future. continue; } @@ -579,7 +579,34 @@ final class KeyShareExtension { // update the context shc.handshakeKeyExchange = ke; shc.handshakePossessions.add(pos); - keyShare = new KeyShareEntry(ng.id, pos.encode()); + + // For KEM, perform encapsulation using the client’s public + // key (KEMCredentials). The resulting encapsulated message + // becomes the key_share value sent to the client. The + // shared secret derived from encapsulation is stored in + // the KEMSenderPossession for later use in the TLS key + // schedule. + + // SSLKeyExchange.createPossessions() returns at most one + // key-agreement possession or one KEMSenderPossession + // per handshake. + if (pos instanceof KEMKeyExchange.KEMSenderPossession xp) { + if (cd instanceof KEMKeyExchange.KEMCredentials kcred + && ng.equals(kcred.namedGroup)) { + String name = ((NamedParameterSpec) + ng.keAlgParamSpec).getName(); + KAKeyDerivation handshakeKD = new KAKeyDerivation( + name, ng, shc, null, null, + kcred.getKeyShare()); + var encaped = handshakeKD.encapsulate( + "TlsHandshakeSecret", xp.getRandom()); + xp.setKey(encaped.key()); + keyShare = new KeyShareEntry(ng.id, + encaped.encapsulation()); + } + } else { + keyShare = new KeyShareEntry(ng.id, pos.encode()); + } break; } @@ -663,19 +690,13 @@ final class KeyShareExtension { try { SSLCredentials kaCred = ng.decodeCredentials(keyShare.keyExchange); - if (chc.algorithmConstraints != null && - kaCred instanceof - NamedGroupCredentials namedGroupCredentials) { - if (!chc.algorithmConstraints.permits( - EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), - namedGroupCredentials.getPublicKey())) { - chc.conContext.fatal(Alert.INSUFFICIENT_SECURITY, - "key share entry of " + ng + " does not " + - " comply with algorithm constraints"); - } - } - if (kaCred != null) { + if (!isCredentialPermitted(chc.algorithmConstraints, + kaCred)) { + chc.conContext.fatal(Alert.INSUFFICIENT_SECURITY, + "key share entry of " + ng + " does not " + + "comply with algorithm constraints"); + } else { credentials = kaCred; } } catch (GeneralSecurityException ex) { @@ -696,6 +717,34 @@ final class KeyShareExtension { } } + private static boolean isCredentialPermitted( + AlgorithmConstraints constraints, + SSLCredentials cred) { + + if (constraints == null) return true; + if (cred == null) return false; + + if (cred instanceof NamedGroupCredentials namedGroupCred) { + if (namedGroupCred instanceof KEMKeyExchange.KEMCredentials + kemCred) { + AlgorithmParameterSpec paramSpec = kemCred.getNamedGroup(). + keAlgParamSpec; + String algName = (paramSpec instanceof NamedParameterSpec nps) ? + nps.getName() : null; + return algName != null && constraints.permits( + EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), + algName, + null); + } else { + return constraints.permits( + EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), + namedGroupCred.getPublicKey()); + } + } + + return true; + } + /** * The absence processing if the extension is not present in * the ServerHello handshake message. 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 877236ebfad..02524e67656 100644 --- a/src/java.base/share/classes/sun/security/ssl/NamedGroup.java +++ b/src/java.base/share/classes/sun/security/ssl/NamedGroup.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 @@ -30,10 +30,12 @@ import java.security.spec.AlgorithmParameterSpec; import java.security.spec.ECParameterSpec; import java.security.spec.InvalidParameterSpecException; import java.security.spec.NamedParameterSpec; +import java.util.Arrays; import java.util.Collections; import java.util.EnumSet; import java.util.List; import java.util.ArrayList; +import java.util.Objects; import java.util.Set; import javax.crypto.KeyAgreement; import javax.crypto.spec.DHParameterSpec; @@ -214,6 +216,39 @@ enum NamedGroup { ProtocolVersion.PROTOCOLS_TO_13, PredefinedDHParameterSpecs.ffdheParams.get(8192)), + ML_KEM_512(0x0200, "MLKEM512", + NamedGroupSpec.NAMED_GROUP_KEM, + ProtocolVersion.PROTOCOLS_OF_13, + null), + + ML_KEM_768(0x0201, "MLKEM768", + NamedGroupSpec.NAMED_GROUP_KEM, + ProtocolVersion.PROTOCOLS_OF_13, + null), + + ML_KEM_1024(0x0202, "MLKEM1024", + NamedGroupSpec.NAMED_GROUP_KEM, + ProtocolVersion.PROTOCOLS_OF_13, + null), + + X25519MLKEM768(0x11ec, "X25519MLKEM768", + NamedGroupSpec.NAMED_GROUP_KEM, + ProtocolVersion.PROTOCOLS_OF_13, + Hybrid.X25519_MLKEM768, + HybridProvider.PROVIDER), + + SECP256R1MLKEM768(0x11eb, "SecP256r1MLKEM768", + NamedGroupSpec.NAMED_GROUP_KEM, + ProtocolVersion.PROTOCOLS_OF_13, + Hybrid.SECP256R1_MLKEM768, + HybridProvider.PROVIDER), + + SECP384R1MLKEM1024(0x11ed, "SecP384r1MLKEM1024", + NamedGroupSpec.NAMED_GROUP_KEM, + ProtocolVersion.PROTOCOLS_OF_13, + Hybrid.SECP384R1_MLKEM1024, + HybridProvider.PROVIDER), + // Elliptic Curves (RFC 4492) // // arbitrary prime and characteristic-2 curves @@ -234,22 +269,33 @@ enum NamedGroup { final AlgorithmParameterSpec keAlgParamSpec; final AlgorithmParameters keAlgParams; final boolean isAvailable; + final Provider defaultProvider; // performance optimization private static final Set KEY_AGREEMENT_PRIMITIVE_SET = Collections.unmodifiableSet(EnumSet.of(CryptoPrimitive.KEY_AGREEMENT)); - // Constructor used for all NamedGroup types NamedGroup(int id, String name, NamedGroupSpec namedGroupSpec, ProtocolVersion[] supportedProtocols, AlgorithmParameterSpec keAlgParamSpec) { + this(id, name, namedGroupSpec, supportedProtocols, keAlgParamSpec, + null); + } + + // Constructor used for all NamedGroup types + NamedGroup(int id, String name, + NamedGroupSpec namedGroupSpec, + ProtocolVersion[] supportedProtocols, + AlgorithmParameterSpec keAlgParamSpec, + Provider defaultProvider) { this.id = id; this.name = name; this.spec = namedGroupSpec; this.algorithm = namedGroupSpec.algorithm; this.supportedProtocols = supportedProtocols; this.keAlgParamSpec = keAlgParamSpec; + this.defaultProvider = defaultProvider; // Check if it is a supported named group. AlgorithmParameters algParams = null; @@ -266,16 +312,28 @@ enum NamedGroup { // Check the specific algorithm parameters. if (mediator) { try { - algParams = - AlgorithmParameters.getInstance(namedGroupSpec.algorithm); - algParams.init(keAlgParamSpec); + // Skip AlgorithmParameters for KEMs (not supported) + // Check KEM's availability via KeyFactory + if (namedGroupSpec == NamedGroupSpec.NAMED_GROUP_KEM) { + if (defaultProvider == null) { + KeyFactory.getInstance(name); + } else { + KeyFactory.getInstance(name, defaultProvider); + } + } else { + // ECDHE or others: use AlgorithmParameters as before + algParams = AlgorithmParameters.getInstance( + namedGroupSpec.algorithm); + algParams.init(keAlgParamSpec); + } } catch (InvalidParameterSpecException | NoSuchAlgorithmException exp) { if (namedGroupSpec != NamedGroupSpec.NAMED_GROUP_XDH) { mediator = false; if (SSLLogger.isOn() && SSLLogger.isOn("ssl,handshake")) { SSLLogger.warning( - "No AlgorithmParameters for " + name, exp); + "No AlgorithmParameters or KeyFactory for " + name, + exp); } } else { // Please remove the following code if the XDH/X25519/X448 @@ -307,6 +365,10 @@ enum NamedGroup { this.keAlgParams = mediator ? algParams : null; } + Provider getProvider() { + return defaultProvider; + } + // // The next set of methods search & retrieve NamedGroups. // @@ -403,10 +465,9 @@ enum NamedGroup { AlgorithmConstraints constraints, NamedGroupSpec type) { boolean hasFFDHEGroups = false; - for (String ng : sslConfig.namedGroups) { - NamedGroup namedGroup = NamedGroup.nameOf(ng); - if (namedGroup != null && - namedGroup.isAvailable && namedGroup.spec == type) { + for (NamedGroup namedGroup : + SupportedGroups.getGroupsFromConfig(sslConfig)) { + if (namedGroup.isAvailable && namedGroup.spec == type) { if (namedGroup.isPermitted(constraints)) { return true; } @@ -441,8 +502,8 @@ enum NamedGroup { // Is the named group supported? static boolean isEnabled(SSLConfiguration sslConfig, NamedGroup namedGroup) { - for (String ng : sslConfig.namedGroups) { - if (namedGroup.name.equalsIgnoreCase(ng)) { + for (NamedGroup ng : SupportedGroups.getGroupsFromConfig(sslConfig)) { + if (namedGroup.equals(ng)) { return true; } } @@ -456,12 +517,10 @@ enum NamedGroup { SSLConfiguration sslConfig, ProtocolVersion negotiatedProtocol, AlgorithmConstraints constraints, NamedGroupSpec[] types) { - for (String name : sslConfig.namedGroups) { - NamedGroup ng = NamedGroup.nameOf(name); - if (ng != null && ng.isAvailable && - (NamedGroupSpec.arrayContains(types, ng.spec)) && - ng.isAvailable(negotiatedProtocol) && - ng.isPermitted(constraints)) { + for (NamedGroup ng : SupportedGroups.getGroupsFromConfig(sslConfig)) { + if (ng.isAvailable && NamedGroupSpec.arrayContains(types, ng.spec) + && ng.isAvailable(negotiatedProtocol) + && ng.isPermitted(constraints)) { return ng; } } @@ -545,6 +604,10 @@ enum NamedGroup { return spec.decodeCredentials(this, encoded); } + SSLPossession createPossession(boolean isClient, SecureRandom random) { + return spec.createPossession(this, isClient, random); + } + SSLPossession createPossession(SecureRandom random) { return spec.createPossession(this, random); } @@ -566,6 +629,11 @@ enum NamedGroup { SSLKeyDerivation createKeyDerivation( HandshakeContext hc) throws IOException; + + default SSLPossession createPossession(NamedGroup ng, boolean isClient, + SecureRandom random) { + return createPossession(ng, random); + } } enum NamedGroupSpec implements NamedGroupScheme { @@ -578,6 +646,10 @@ enum NamedGroup { // Finite Field Groups (XDH) NAMED_GROUP_XDH("XDH", XDHScheme.instance), + // Post-Quantum Cryptography (PQC) KEM groups + // Currently used for hybrid named groups + NAMED_GROUP_KEM("KEM", KEMScheme.instance), + // arbitrary prime and curves (ECDHE) NAMED_GROUP_ARBITRARY("EC", null), @@ -634,6 +706,15 @@ enum NamedGroup { return null; } + public SSLPossession createPossession( + NamedGroup ng, boolean isClient, SecureRandom random) { + if (scheme != null) { + return scheme.createPossession(ng, isClient, random); + } + + return null; + } + @Override public SSLPossession createPossession( NamedGroup ng, SecureRandom random) { @@ -739,19 +820,128 @@ enum NamedGroup { } } + private static class KEMScheme implements NamedGroupScheme { + private static final KEMScheme instance = new KEMScheme(); + + @Override + public byte[] encodePossessionPublicKey(NamedGroupPossession poss) { + return poss.encode(); + } + + @Override + public SSLCredentials decodeCredentials(NamedGroup ng, + byte[] encoded) throws IOException, GeneralSecurityException { + return KEMKeyExchange.KEMCredentials.valueOf(ng, encoded); + } + + @Override + public SSLPossession createPossession(NamedGroup ng, + SecureRandom random) { + // Must call createPossession with isClient + throw new UnsupportedOperationException(); + } + + @Override + public SSLPossession createPossession( + NamedGroup ng, boolean isClient, SecureRandom random) { + return isClient + ? new KEMKeyExchange.KEMReceiverPossession(ng, random) + : new KEMKeyExchange.KEMSenderPossession(ng, random); + } + + @Override + public SSLKeyDerivation createKeyDerivation( + HandshakeContext hc) throws IOException { + return KEMKeyExchange.kemKAGenerator.createKeyDerivation(hc); + } + } + + // Inner class encapsulating supported named groups. static final class SupportedGroups { - // the supported named groups, non-null immutable list + + // Default named groups. + private static final NamedGroup[] defaultGroups = new NamedGroup[]{ + // Hybrid key agreement + X25519MLKEM768, + + // Primary XDH (RFC 7748) curves + X25519, + + // Primary NIST Suite B curves + SECP256_R1, + SECP384_R1, + SECP521_R1, + + // Secondary XDH curves + X448, + + // FFDHE (RFC 7919) + FFDHE_2048, + FFDHE_3072, + FFDHE_4096, + FFDHE_6144, + FFDHE_8192 + }; + + // Filter default groups names against default constraints. + // Those are the values being displayed to the user with + // "java -XshowSettings:security:tls" command. + private static final String[] defaultNames = Arrays.stream( + defaultGroups) + .filter(ng -> ng.isAvailable) + .filter(ng -> ng.isPermitted(SSLAlgorithmConstraints.DEFAULT)) + .map(ng -> ng.name) + .toArray(String[]::new); + + private static final NamedGroup[] customizedGroups = + getCustomizedNamedGroups(); + + // Note: user-passed groups are not being filtered against default + // algorithm constraints here. They will be displayed as-is. + private static final String[] customizedNames = + customizedGroups == null ? + null : Arrays.stream(customizedGroups) + .map(ng -> ng.name) + .toArray(String[]::new); + + // Named group names for SSLConfiguration. static final String[] namedGroups; static { - // The value of the System Property defines a list of enabled named - // groups in preference order, separated with comma. For example: - // - // jdk.tls.namedGroups="secp521r1, secp256r1, ffdhe2048" - // - // If the System Property is not defined or the value is empty, the - // default groups and preferences will be used. + if (customizedNames != null) { + namedGroups = customizedNames; + } else { + if (defaultNames.length == 0) { + SSLLogger.logWarning("ssl", "No default named groups"); + } + namedGroups = defaultNames; + } + } + + // Avoid the group lookup for default and customized groups. + static NamedGroup[] getGroupsFromConfig(SSLConfiguration sslConfig) { + if (sslConfig.namedGroups == defaultNames) { + return defaultGroups; + } else if (sslConfig.namedGroups == customizedNames) { + return customizedGroups; + } else { + return Arrays.stream(sslConfig.namedGroups) + .map(NamedGroup::nameOf) + .filter(Objects::nonNull) + .toArray(NamedGroup[]::new); + } + } + + // The value of the System Property defines a list of enabled named + // groups in preference order, separated with comma. For example: + // + // jdk.tls.namedGroups="secp521r1, secp256r1, ffdhe2048" + // + // If the System Property is not defined or the value is empty, the + // default groups and preferences will be used. + private static NamedGroup[] getCustomizedNamedGroups() { String property = System.getProperty("jdk.tls.namedGroups"); + if (property != null && !property.isEmpty()) { // remove double quote marks from beginning/end of the property if (property.length() > 1 && property.charAt(0) == '"' && @@ -760,63 +950,25 @@ enum NamedGroup { } } - ArrayList groupList; if (property != null && !property.isEmpty()) { - String[] groups = property.split(","); - groupList = new ArrayList<>(groups.length); - for (String group : groups) { - group = group.trim(); - if (!group.isEmpty()) { - NamedGroup namedGroup = nameOf(group); - if (namedGroup != null) { - if (namedGroup.isAvailable) { - groupList.add(namedGroup.name); - } - } // ignore unknown groups - } - } + NamedGroup[] ret = Arrays.stream(property.split(",")) + .map(String::trim) + .map(NamedGroup::nameOf) + .filter(Objects::nonNull) + .filter(ng -> ng.isAvailable) + .toArray(NamedGroup[]::new); - if (groupList.isEmpty()) { + if (ret.length == 0) { throw new IllegalArgumentException( "System property jdk.tls.namedGroups(" + - property + ") contains no supported named groups"); - } - } else { // default groups - NamedGroup[] groups = new NamedGroup[] { - - // Primary XDH (RFC 7748) curves - X25519, - - // Primary NIST Suite B curves - SECP256_R1, - SECP384_R1, - SECP521_R1, - - // Secondary XDH curves - X448, - - // FFDHE (RFC 7919) - FFDHE_2048, - FFDHE_3072, - FFDHE_4096, - FFDHE_6144, - FFDHE_8192, - }; - - groupList = new ArrayList<>(groups.length); - for (NamedGroup group : groups) { - if (group.isAvailable) { - groupList.add(group.name); - } + property + + ") contains no supported named groups"); } - if (groupList.isEmpty() && - SSLLogger.isOn() && SSLLogger.isOn("ssl")) { - SSLLogger.warning("No default named groups"); - } + return ret; } - namedGroups = groupList.toArray(new String[0]); + return null; } } } diff --git a/src/java.base/share/classes/sun/security/ssl/SSLKeyExchange.java b/src/java.base/share/classes/sun/security/ssl/SSLKeyExchange.java index 22a44590ce3..263308f0659 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLKeyExchange.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLKeyExchange.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -570,7 +570,9 @@ final class SSLKeyExchange implements SSLKeyAgreementGenerator, @Override public SSLPossession createPossession(HandshakeContext hc) { - return namedGroup.createPossession(hc.sslContext.getSecureRandom()); + return namedGroup.createPossession( + hc instanceof ClientHandshakeContext, + hc.sslContext.getSecureRandom()); } @Override 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 76c266a628a..0567c861e18 100644 --- a/src/java.base/share/classes/sun/security/ssl/ServerHello.java +++ b/src/java.base/share/classes/sun/security/ssl/ServerHello.java @@ -565,6 +565,34 @@ final class ServerHello { clientHello); shc.serverHelloRandom = shm.serverRandom; + // For key derivation, we will either use the traditional Key + // Agreement (KA) model or the Key Encapsulation Mechanism (KEM) + // model, depending on what key exchange group is used. + // + // For KA flows, the server first receives the client's share, + // then generates its key share, and finally comes here. + // However, this is changed for KEM: the server + // must perform both actions — derive the secret and generate + // the key encapsulation message at the same time during + // encapsulation in SHKeyShareProducer. + // + // Traditional Key Agreement (KA): + // - Both peers generate a key share and exchange it. + // - Each peer computes a shared secret sometime after + // receiving the other's key share. + // + // Key Encapsulation Mechanism (KEM): + // The client publishes a public key via a KeyShareExtension, + // which the server uses to: + // + // - generate the shared secret + // - encapsulate the message which is sent to the client in + // another KeyShareExtension + // + // The derived shared secret must be stored in a + // KEMSenderPossession so it can be retrieved for handshake + // traffic secret derivation later. + // Produce extensions for ServerHello handshake message. SSLExtension[] serverHelloExtensions = shc.sslConfig.getEnabledExtensions( @@ -590,9 +618,26 @@ final class ServerHello { "Not negotiated key shares"); } - SSLKeyDerivation handshakeKD = ke.createKeyDerivation(shc); - SecretKey handshakeSecret = handshakeKD.deriveKey( - "TlsHandshakeSecret"); + SecretKey handshakeSecret = null; + + // For KEM, the shared secret has already been generated and + // stored in the server’s possession (KEMSenderPossession) + // during encapsulation in SHKeyShareProducer. + // + // Only one key share is selected by the server, so at most one + // possession will contain the pre-derived shared secret. + for (var pos : shc.handshakePossessions) { + if (pos instanceof KEMKeyExchange.KEMSenderPossession xp) { + handshakeSecret = xp.getKey(); + break; + } + } + + if (handshakeSecret == null) { + SSLKeyDerivation handshakeKD = ke.createKeyDerivation(shc); + handshakeSecret = handshakeKD.deriveKey( + "TlsHandshakeSecret"); + } SSLTrafficKeyDerivation kdg = SSLTrafficKeyDerivation.valueOf(shc.negotiatedProtocol); diff --git a/src/java.base/share/classes/sun/security/util/CryptoAlgorithmConstraints.java b/src/java.base/share/classes/sun/security/util/CryptoAlgorithmConstraints.java index a8649106a38..ad3beab350f 100644 --- a/src/java.base/share/classes/sun/security/util/CryptoAlgorithmConstraints.java +++ b/src/java.base/share/classes/sun/security/util/CryptoAlgorithmConstraints.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 @@ -82,8 +82,10 @@ public class CryptoAlgorithmConstraints extends AbstractAlgorithmConstraints { CryptoAlgorithmConstraints(String propertyName) { super(null); disabledServices = getAlgorithms(propertyName, true); - debug("Before " + Arrays.deepToString(disabledServices.toArray())); - for (String dk : disabledServices) { + String[] entries = disabledServices.toArray(new String[0]); + debug("Before " + Arrays.deepToString(entries)); + + for (String dk : entries) { int idx = dk.indexOf("."); if (idx < 1 || idx == dk.length() - 1) { // wrong syntax: missing "." or empty service or algorithm diff --git a/src/java.base/share/classes/sun/security/x509/X509Key.java b/src/java.base/share/classes/sun/security/x509/X509Key.java index c83e06f651e..1cfe3f9d95d 100644 --- a/src/java.base/share/classes/sun/security/x509/X509Key.java +++ b/src/java.base/share/classes/sun/security/x509/X509Key.java @@ -104,6 +104,10 @@ public class X509Key implements PublicKey, DerEncoder { return (BitArray)bitStringKey.clone(); } + public byte[] getKeyAsBytes() { + return bitStringKey.toByteArray(); + } + /** * Construct X.509 subject public key from a DER value. If * the runtime environment is configured with a specific class for diff --git a/src/java.base/share/conf/security/java.security b/src/java.base/share/conf/security/java.security index b5cbce413b2..9a81ba86268 100644 --- a/src/java.base/share/conf/security/java.security +++ b/src/java.base/share/conf/security/java.security @@ -1655,3 +1655,48 @@ jdk.tls.alpnCharset=ISO_8859_1 # withEncryption method. # jdk.epkcs8.defaultAlgorithm=PBEWithHmacSHA256AndAES_128 + +# +# X.509 AuthorityInfoAccess caIssuer URI Filtering +# +# This property defines a whitespace-separated list of filters that +# are applied to URIs found in the authorityInfoAccess extension in +# X.509 certificates. Any caIssuers URIs in X.509 certificates are only +# followed when the com.sun.security.enableAIAcaIssuers System property is +# enabled and the filter allows the URI. By default this property imposes a +# deny-all ruleset. This property may be overridden by a System property +# of the same name. +# +# The filters must take the form of absolute, hierarchical URIs as defined by +# the java.net.URI class. Additionally, only the following protocols are +# allowed as filters: http, https, ldap and ftp. +# See RFC 5280, section 4.2.2.1 for details about the types of URIs allowed for +# the extension and their specific requirements. +# The filter matching rules are applied to each CA issuer URI as follows: +# 1. The scheme must match (case-insensitive). +# 2. A hostname or address must be specified in the filter URI. It must match +# the host or address in the caIssuers URI (case-insensitive). No name +# resolution is performed on hostnames to match IP addresses. +# 3. The port number must match. For filter and caIssuer URIs, when a port +# number is omitted, the well-known port for that scheme will be used in the +# comparison. +# 4. For hierarchical filesystem schemes (e.g. http[s], ftp): +# a. The normalized path portion of the filter URI is matched in a +# case-sensitive manner. If the final component of the path does not end +# in a slash (/), it is considered to be a file path component and must +# be an exact match of the caIssuer's URI file path component. If the +# final filter component ends in a slash, then it must either match or be +# a prefix of the caIssuer's URI path component (e.g. a filter path of +# /ab/cd/ will match a caIssuer path of /ab/cd/, /ab/cd/ef and +# /ab/cd/ef/ghi). +# b. Query strings will be ignored in filter rules and caIssuer URIs. +# c. Fragments will be ignored in filter rules and caIssuer URIs. +# 5. For ldap URIs: +# a. The base DN must be an exact match (case-insensitive). +# b. Any query string in the rule, if specified, is ignored. +# 6. A single value "any" (case-insensitive) will create an allow-all rule. +# +# As an example, here is a valid filter policy consisting of two rules: +# com.sun.security.allowedAIALocations=http://some.company.com/cacert \ +# ldap://ldap.company.com/dc=company,dc=com?caCertificate;binary +com.sun.security.allowedAIALocations= diff --git a/src/java.base/share/native/libjli/java.c b/src/java.base/share/native/libjli/java.c index 6072bff50c6..4621ab588d1 100644 --- a/src/java.base/share/native/libjli/java.c +++ b/src/java.base/share/native/libjli/java.c @@ -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 @@ -1505,6 +1505,7 @@ InitializeJVM(JavaVM **pvm, JNIEnv **penv, InvocationFunctions *ifn) r = ifn->CreateJavaVM(pvm, (void **)penv, &args); JLI_MemFree(options); + options = NULL; return r == JNI_OK; } @@ -2203,6 +2204,7 @@ FreeKnownVMs() knownVMs[i].name = NULL; } JLI_MemFree(knownVMs); + knownVMs = NULL; } /* @@ -2276,8 +2278,9 @@ ShowSplashScreen() (void)UnsetEnv(SPLASH_JAR_ENV_ENTRY); JLI_MemFree(splash_jar_entry); + splash_jar_entry = NULL; JLI_MemFree(splash_file_entry); - + splash_file_entry = NULL; } static const char* GetFullVersion() diff --git a/src/java.base/unix/classes/sun/nio/fs/UnixSecureDirectoryStream.java b/src/java.base/unix/classes/sun/nio/fs/UnixSecureDirectoryStream.java index 5c0693870e6..bafcd06d9e7 100644 --- a/src/java.base/unix/classes/sun/nio/fs/UnixSecureDirectoryStream.java +++ b/src/java.base/unix/classes/sun/nio/fs/UnixSecureDirectoryStream.java @@ -202,21 +202,21 @@ class UnixSecureDirectoryStream { UnixPath from = getName(fromObj); UnixPath to = getName(toObj); - if (dir == null) - throw new NullPointerException(); - if (!(dir instanceof UnixSecureDirectoryStream)) + if (dir != null && !(dir instanceof UnixSecureDirectoryStream)) throw new ProviderMismatchException(); UnixSecureDirectoryStream that = (UnixSecureDirectoryStream)dir; + int todfd = that != null ? that.dfd : AT_FDCWD; // lock ordering doesn't matter this.ds.readLock().lock(); try { - that.ds.readLock().lock(); + if (that != null) + that.ds.readLock().lock(); try { - if (!this.ds.isOpen() || !that.ds.isOpen()) + if (!this.ds.isOpen() || (that != null && !that.ds.isOpen())) throw new ClosedDirectoryStreamException(); try { - renameat(this.dfd, from.asByteArray(), that.dfd, to.asByteArray()); + renameat(this.dfd, from.asByteArray(), todfd, to.asByteArray()); } catch (UnixException x) { if (x.errno() == EXDEV) { throw new AtomicMoveNotSupportedException( @@ -225,7 +225,8 @@ class UnixSecureDirectoryStream x.rethrowAsIOException(from, to); } } finally { - that.ds.readLock().unlock(); + if (that != null) + that.ds.readLock().unlock(); } } finally { this.ds.readLock().unlock(); diff --git a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDesktopPeer.java b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDesktopPeer.java index a4ec0767298..cc0e253f23b 100644 --- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDesktopPeer.java +++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDesktopPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -34,7 +34,10 @@ import java.awt.peer.DesktopPeer; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; +import java.lang.annotation.Native; import java.net.URI; +import java.nio.file.Files; +import java.nio.file.Path; /** @@ -44,6 +47,12 @@ import java.net.URI; */ public final class CDesktopPeer implements DesktopPeer { + @Native private static final int OPEN = 0; + @Native private static final int BROWSE = 1; + @Native private static final int EDIT = 2; + @Native private static final int PRINT = 3; + @Native private static final int MAIL = 4; + @Override public boolean isSupported(Action action) { return true; @@ -51,27 +60,27 @@ public final class CDesktopPeer implements DesktopPeer { @Override public void open(File file) throws IOException { - this.lsOpenFile(file, false); + this.lsOpenFile(file, OPEN); } @Override public void edit(File file) throws IOException { - this.lsOpenFile(file, false); + this.lsOpenFile(file, EDIT); } @Override public void print(File file) throws IOException { - this.lsOpenFile(file, true); + this.lsOpenFile(file, PRINT); } @Override public void mail(URI uri) throws IOException { - this.lsOpen(uri); + this.lsOpen(uri, MAIL); } @Override public void browse(URI uri) throws IOException { - this.lsOpen(uri); + this.lsOpen(uri, BROWSE); } @Override @@ -162,24 +171,44 @@ public final class CDesktopPeer implements DesktopPeer { } } - private void lsOpen(URI uri) throws IOException { - int status = _lsOpenURI(uri.toString()); + private void lsOpen(URI uri, int action) throws IOException { + int status = _lsOpenURI(uri.toString(), action); if (status != 0 /* noErr */) { - throw new IOException("Failed to mail or browse " + uri + ". Error code: " + status); + String actionString = (action == MAIL) ? "mail" : "browse"; + throw new IOException("Failed to " + actionString + " " + uri + + ". Error code: " + status); } } - private void lsOpenFile(File file, boolean print) throws IOException { - int status = _lsOpenFile(file.getCanonicalPath(), print); + private void lsOpenFile(File file, int action) throws IOException { + int status = -1; + Path tmpFile = null; + String tmpTxtPath = null; + try { + if (action == EDIT) { + tmpFile = Files.createTempFile("TmpFile", ".txt"); + tmpTxtPath = tmpFile.toAbsolutePath().toString(); + } + status = _lsOpenFile(file.getCanonicalPath(), action, tmpTxtPath); + } catch (Exception e) { + throw new IOException("Failed to create tmp file: ", e); + } finally { + if (tmpFile != null) { + Files.deleteIfExists(tmpFile); + } + } if (status != 0 /* noErr */) { - throw new IOException("Failed to open, edit or print " + file + ". Error code: " + status); + String actionString = (action == OPEN) ? "open" + : (action == EDIT) ? "edit" : "print"; + throw new IOException("Failed to " + actionString + " " + file + + ". Error code: " + status); } } - private static native int _lsOpenURI(String uri); + private static native int _lsOpenURI(String uri, int action); - private static native int _lsOpenFile(String path, boolean print); + private static native int _lsOpenFile(String path, int action, String tmpTxtPath); } diff --git a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java index 979eeb36239..508b1a843ef 100644 --- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java +++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.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 @@ -355,20 +355,9 @@ public final class CPrinterJob extends RasterPrinterJob { validateDestination(destinationAttr); } - /* Get the range of pages we are to print. If the - * last page to print is unknown, then we print to - * the end of the document. Note that firstPage - * and lastPage are 0 based page indices. - */ - + // Note that firstPage is 0 based page index. int firstPage = getFirstPage(); - int lastPage = getLastPage(); - if(lastPage == Pageable.UNKNOWN_NUMBER_OF_PAGES) { - int totalPages = mDocument.getNumberOfPages(); - if (totalPages != Pageable.UNKNOWN_NUMBER_OF_PAGES) { - lastPage = mDocument.getNumberOfPages() - 1; - } - } + int totalPages = mDocument.getNumberOfPages(); try { synchronized (this) { @@ -393,7 +382,7 @@ public final class CPrinterJob extends RasterPrinterJob { try { // Fire off the print rendering loop on the AppKit thread, and don't have // it wait and block this thread. - if (printLoop(false, firstPage, lastPage)) { + if (printLoop(false, firstPage, totalPages)) { // Start a secondary loop on EDT until printing operation is finished or cancelled printingLoop.enter(); } @@ -407,7 +396,7 @@ public final class CPrinterJob extends RasterPrinterJob { onEventThread = false; try { - printLoop(true, firstPage, lastPage); + printLoop(true, firstPage, totalPages); } catch (Exception e) { e.printStackTrace(); } @@ -417,7 +406,6 @@ public final class CPrinterJob extends RasterPrinterJob { } if (++loopi < prMembers.length) { firstPage = prMembers[loopi][0]-1; - lastPage = prMembers[loopi][1] -1; } } while (loopi < prMembers.length); } finally { @@ -693,7 +681,7 @@ public final class CPrinterJob extends RasterPrinterJob { } } - private native boolean printLoop(boolean waitUntilDone, int firstPage, int lastPage) throws PrinterException; + private native boolean printLoop(boolean waitUntilDone, int firstPage, int totalPages) throws PrinterException; private PageFormat getPageFormat(int pageIndex) { // This is called from the native side. 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 7555c7990c4..e1841c9398c 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, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -27,27 +27,60 @@ #import "JNIUtilities.h" #import #import +#import "sun_lwawt_macosx_CDesktopPeer.h" /* * Class: sun_lwawt_macosx_CDesktopPeer * Method: _lsOpenURI - * Signature: (Ljava/lang/String;)I; + * Signature: (Ljava/lang/String;I)I */ JNIEXPORT jint JNICALL Java_sun_lwawt_macosx_CDesktopPeer__1lsOpenURI -(JNIEnv *env, jclass clz, jstring uri) +(JNIEnv *env, jclass clz, jstring uri, jint action) { - OSStatus status = noErr; + __block OSStatus status = noErr; JNI_COCOA_ENTER(env); - // I would love to use NSWorkspace here, but it's not thread safe. Why? I don't know. - // So we use LaunchServices directly. + NSURL *urlToOpen = [NSURL URLWithString:JavaStringToNSString(env, uri)]; + NSURL *appURI = nil; - NSURL *url = [NSURL URLWithString:JavaStringToNSString(env, uri)]; + if (action == sun_lwawt_macosx_CDesktopPeer_BROWSE) { + // To get the defaultBrowser + NSURL *httpsURL = [NSURL URLWithString:@"https://"]; + NSWorkspace *workspace = [NSWorkspace sharedWorkspace]; + appURI = [workspace URLForApplicationToOpenURL:httpsURL]; + } else if (action == sun_lwawt_macosx_CDesktopPeer_MAIL) { + // To get the default mailer + NSURL *mailtoURL = [NSURL URLWithString:@"mailto://"]; + NSWorkspace *workspace = [NSWorkspace sharedWorkspace]; + appURI = [workspace URLForApplicationToOpenURL:mailtoURL]; + } - LSLaunchFlags flags = kLSLaunchDefaults; + if (appURI == nil) { + return -1; + } - LSApplicationParameters params = {0, flags, NULL, NULL, NULL, NULL, NULL}; - status = LSOpenURLsWithRole((CFArrayRef)[NSArray arrayWithObject:url], kLSRolesAll, NULL, ¶ms, NULL, 0); + // Prepare NSOpenConfig object + NSArray *urls = @[urlToOpen]; + NSWorkspaceOpenConfiguration *configuration = [NSWorkspaceOpenConfiguration configuration]; + configuration.activates = YES; // To bring app to foreground + configuration.promptsUserIfNeeded = YES; // To allow macOS desktop prompts + + // dispatch semaphores used to wait for the completion handler to update and return status + dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); + dispatch_time_t timeout = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(NSEC_PER_SEC)); // 1 second timeout + + // Asynchronous call to openURL + [[NSWorkspace sharedWorkspace] openURLs:urls + withApplicationAtURL:appURI + configuration:configuration + completionHandler:^(NSRunningApplication *app, NSError *error) { + if (error) { + status = (OSStatus) error.code; + } + dispatch_semaphore_signal(semaphore); + }]; + + dispatch_semaphore_wait(semaphore, timeout); JNI_COCOA_EXIT(env); return status; @@ -56,32 +89,73 @@ JNI_COCOA_EXIT(env); /* * Class: sun_lwawt_macosx_CDesktopPeer * Method: _lsOpenFile - * Signature: (Ljava/lang/String;Z)I; + * Signature: (Ljava/lang/String;I;Ljava/lang/String;)I; */ JNIEXPORT jint JNICALL Java_sun_lwawt_macosx_CDesktopPeer__1lsOpenFile -(JNIEnv *env, jclass clz, jstring jpath, jboolean print) +(JNIEnv *env, jclass clz, jstring jpath, jint action, jstring jtmpTxtPath) { - OSStatus status = noErr; + __block OSStatus status = noErr; JNI_COCOA_ENTER(env); - // I would love to use NSWorkspace here, but it's not thread safe. Why? I don't know. - // So we use LaunchServices directly. - NSString *path = NormalizedPathNSStringFromJavaString(env, jpath); - - NSURL *url = [NSURL fileURLWithPath:(NSString *)path]; + NSURL *urlToOpen = [NSURL fileURLWithPath:(NSString *)path]; // This byzantine workaround is necessary, or else directories won't open in Finder - url = (NSURL *)CFURLCreateWithFileSystemPath(NULL, (CFStringRef)[url path], kCFURLPOSIXPathStyle, false); + urlToOpen = (NSURL *)CFURLCreateWithFileSystemPath(NULL, (CFStringRef)[urlToOpen path], + kCFURLPOSIXPathStyle, false); - LSLaunchFlags flags = kLSLaunchDefaults; - if (print) flags |= kLSLaunchAndPrint; + NSWorkspace *workspace = [NSWorkspace sharedWorkspace]; + NSURL *appURI = [workspace URLForApplicationToOpenURL:urlToOpen]; + NSURL *defaultTerminalApp = [workspace URLForApplicationToOpenURL:[NSURL URLWithString:@"file:///bin/sh"]]; - LSApplicationParameters params = {0, flags, NULL, NULL, NULL, NULL, NULL}; - status = LSOpenURLsWithRole((CFArrayRef)[NSArray arrayWithObject:url], kLSRolesAll, NULL, ¶ms, NULL, 0); - [url release]; + // Prepare NSOpenConfig object + NSArray *urls = @[urlToOpen]; + NSWorkspaceOpenConfiguration *configuration = [NSWorkspaceOpenConfiguration configuration]; + configuration.activates = YES; // To bring app to foreground + configuration.promptsUserIfNeeded = YES; // To allow macOS desktop prompts + + // pre-checks for open/print/edit before calling openURLs API + if (action == sun_lwawt_macosx_CDesktopPeer_OPEN + || action == sun_lwawt_macosx_CDesktopPeer_PRINT) { + if (appURI == nil + || [[urlToOpen absoluteString] containsString:[appURI absoluteString]] + || [[defaultTerminalApp absoluteString] containsString:[appURI absoluteString]]) { + return -1; + } + // Additionally set forPrinting=TRUE for print + if (action == sun_lwawt_macosx_CDesktopPeer_PRINT) { + configuration.forPrinting = YES; + } + } else if (action == sun_lwawt_macosx_CDesktopPeer_EDIT) { + if (appURI == nil + || [[urlToOpen absoluteString] containsString:[appURI absoluteString]]) { + return -1; + } + // for EDIT: if (defaultApp = TerminalApp) then set appURI = DefaultTextEditor + if ([[defaultTerminalApp absoluteString] containsString:[appURI absoluteString]]) { + NSString *path = NormalizedPathNSStringFromJavaString(env, jtmpTxtPath); + NSURL *tempFilePath = [NSURL fileURLWithPath:(NSString *)path]; + appURI = [workspace URLForApplicationToOpenURL:tempFilePath]; + } + } + + // dispatch semaphores used to wait for the completion handler to update and return status + dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); + dispatch_time_t timeout = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(NSEC_PER_SEC)); // 1 second timeout + + // Asynchronous call - openURLs:withApplicationAtURL + [[NSWorkspace sharedWorkspace] openURLs:urls + withApplicationAtURL:appURI + configuration:configuration + completionHandler:^(NSRunningApplication *app, NSError *error) { + if (error) { + status = (OSStatus) error.code; + } + dispatch_semaphore_signal(semaphore); + }]; + + dispatch_semaphore_wait(semaphore, timeout); JNI_COCOA_EXIT(env); return status; } - diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/CPrinterJob.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/CPrinterJob.m index 9cc0a18564f..555a2746f43 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/CPrinterJob.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/CPrinterJob.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 @@ -656,7 +656,7 @@ JNI_COCOA_EXIT(env); * Signature: ()V */ JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_CPrinterJob_printLoop - (JNIEnv *env, jobject jthis, jboolean blocks, jint firstPage, jint lastPage) + (JNIEnv *env, jobject jthis, jboolean blocks, jint firstPage, jint totalPages) { AWT_ASSERT_NOT_APPKIT_THREAD; @@ -672,14 +672,14 @@ JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_CPrinterJob_printLoop JNI_COCOA_ENTER(env); // Get the first page's PageFormat for setting things up (This introduces // and is a facet of the same problem in Radar 2818593/2708932). - jobject page = (*env)->CallObjectMethod(env, jthis, jm_getPageFormat, 0); // AWT_THREADING Safe (!appKit) + jobject page = (*env)->CallObjectMethod(env, jthis, jm_getPageFormat, firstPage); // AWT_THREADING Safe (!appKit) CHECK_EXCEPTION(); if (page != NULL) { jobject pageFormatArea = (*env)->CallObjectMethod(env, jthis, jm_getPageFormatArea, page); // AWT_THREADING Safe (!appKit) CHECK_EXCEPTION(); PrinterView* printerView = [[PrinterView alloc] initWithFrame:JavaToNSRect(env, pageFormatArea) withEnv:env withPrinterJob:jthis]; - [printerView setFirstPage:firstPage lastPage:lastPage]; + [printerView setTotalPages:totalPages]; GET_NSPRINTINFO_METHOD_RETURN(NO) NSPrintInfo* printInfo = (NSPrintInfo*)jlong_to_ptr((*env)->CallLongMethod(env, jthis, sjm_getNSPrintInfo)); // AWT_THREADING Safe (known object) diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterView.h b/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterView.h index 43472bee920..95a8055cdb0 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterView.h +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, 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 @@ -32,12 +32,12 @@ jobject fCurPainter; jobject fCurPeekGraphics; - jint fFirstPage, fLastPage; + jint fTotalPages; } - (id)initWithFrame:(NSRect)aRect withEnv:(JNIEnv*)env withPrinterJob:(jobject)printerJob; -- (void)setFirstPage:(jint)firstPage lastPage:(jint)lastPage; +- (void)setTotalPages:(jint)totalPages; - (void)releaseReferences:(JNIEnv*)env; diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterView.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterView.m index d19948d9f0f..f219e8082b4 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterView.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/PrinterView.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 @@ -72,9 +72,8 @@ static jclass sjc_PAbortEx = NULL; } } -- (void)setFirstPage:(jint)firstPage lastPage:(jint)lastPage { - fFirstPage = firstPage; - fLastPage = lastPage; +- (void)setTotalPages:(jint)totalPages { + fTotalPages = totalPages; } - (void)drawRect:(NSRect)aRect @@ -156,15 +155,15 @@ static jclass sjc_PAbortEx = NULL; return NO; } - aRange->location = fFirstPage + 1; + aRange->location = 1; - if (fLastPage == java_awt_print_Pageable_UNKNOWN_NUMBER_OF_PAGES) + if (fTotalPages == java_awt_print_Pageable_UNKNOWN_NUMBER_OF_PAGES) { aRange->length = NSIntegerMax; } else { - aRange->length = (fLastPage + 1) - fFirstPage; + aRange->length = fTotalPages; } return YES; diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/NavigableTextAccessibility.h b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/NavigableTextAccessibility.h index ebf314c7394..9a528879a5d 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/NavigableTextAccessibility.h +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/NavigableTextAccessibility.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2026, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, JetBrains s.r.o.. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -29,5 +29,6 @@ @interface NavigableTextAccessibility : CommonComponentAccessibility @property(readonly) BOOL accessibleIsPasswordText; +@property BOOL announceEditUpdates; @end diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/NavigableTextAccessibility.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/NavigableTextAccessibility.m index 138d502f10f..8e241e65b96 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/NavigableTextAccessibility.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/NavigableTextAccessibility.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2026, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, JetBrains s.r.o.. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -60,6 +60,22 @@ static jmethodID sjm_getAccessibleEditableText = NULL; return [fJavaRole isEqualToString:@"passwordtext"]; } +- (id)init { + self = [super init]; + if (self) { + _announceEditUpdates = YES; + } + return self; +} + +- (void)suppressEditUpdates { + _announceEditUpdates = NO; +} + +- (void)resumeEditUpdates { + _announceEditUpdates = YES; +} + // NSAccessibilityElement protocol methods - (NSRect)accessibilityFrameForRange:(NSRange)range @@ -117,6 +133,9 @@ static jmethodID sjm_getAccessibleEditableText = NULL; - (NSString *)accessibilityStringForRange:(NSRange)range { + if (!_announceEditUpdates) { + return @""; + } JNIEnv *env = [ThreadUtilities getJNIEnv]; GET_CACCESSIBLETEXT_CLASS_RETURN(nil); DECLARE_STATIC_METHOD_RETURN(jm_getStringForRange, sjc_CAccessibleText, "getStringForRange", @@ -306,6 +325,12 @@ static jmethodID sjm_getAccessibleEditableText = NULL; return [super accessibilityParent]; } +- (void)postSelectedTextChanged +{ + [super postSelectedTextChanged]; + [self resumeEditUpdates]; +} + /* * Other text methods - (NSRange)accessibilitySharedCharacterRange; diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/SpinboxAccessibility.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/SpinboxAccessibility.m index 4dac6bd93f9..0cec7f3eb2c 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/SpinboxAccessibility.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/SpinboxAccessibility.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 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 @@ -24,6 +24,7 @@ */ #import "SpinboxAccessibility.h" +#import "ThreadUtilities.h" #define INCREMENT 0 #define DECREMENT 1 @@ -44,7 +45,15 @@ - (id _Nullable)accessibilityValue { - return [super accessibilityValue]; + id val = [super accessibilityValue]; + NSArray *clist = [super accessibilityChildren]; + for (NSUInteger i = 0; i < [clist count]; i++) { + id child = [clist objectAtIndex:i]; + if ([child conformsToProtocol:@protocol(NSAccessibilityNavigableStaticText)]) { + val = [child accessibilityValue]; + } + } + return val; } - (BOOL)accessibilityPerformIncrement @@ -68,4 +77,18 @@ return [super accessibilityParent]; } +- (void)postValueChanged +{ + AWT_ASSERT_APPKIT_THREAD; + NSAccessibilityPostNotification(self, NSAccessibilityValueChangedNotification); + NSArray *clist = [super accessibilityChildren]; + for (NSUInteger i = 0; i < [clist count]; i++) { + id child = [clist objectAtIndex:i]; + if ([child conformsToProtocol:@protocol(NSAccessibilityNavigableStaticText)]) { + NSAccessibilityPostNotification(child, NSAccessibilityLayoutChangedNotification); + [child suppressEditUpdates]; + } + } +} + @end diff --git a/src/java.desktop/share/classes/javax/print/PrintServiceLookup.java b/src/java.desktop/share/classes/javax/print/PrintServiceLookup.java index 15a7fbbaa00..ee3f6a449b7 100644 --- a/src/java.desktop/share/classes/javax/print/PrintServiceLookup.java +++ b/src/java.desktop/share/classes/javax/print/PrintServiceLookup.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 @@ -32,7 +32,6 @@ import java.util.ServiceLoader; import javax.print.attribute.AttributeSet; -import sun.awt.AppContext; /** * Implementations of this class provide lookup services for print services @@ -58,35 +57,14 @@ public abstract class PrintServiceLookup { protected PrintServiceLookup() {} /** - * Contains a lists of services. + * The list of lookup services. */ - static class Services { - - /** - * The list of lookup services. - */ - private ArrayList listOfLookupServices = null; - - /** - * The list of registered services. - */ - private ArrayList registeredServices = null; - } + private static ArrayList listOfLookupServices = null; /** - * Returns the services from the current appcontext. - * - * @return the services + * The list of registered services. */ - private static Services getServicesForContext() { - Services services = - (Services)AppContext.getAppContext().get(Services.class); - if (services == null) { - services = new Services(); - AppContext.getAppContext().put(Services.class, services); - } - return services; - } + private static ArrayList registeredServices = null; /** * Returns the list of lookup services. @@ -94,7 +72,7 @@ public abstract class PrintServiceLookup { * @return the list of lookup services */ private static ArrayList getListOfLookupServices() { - return getServicesForContext().listOfLookupServices; + return listOfLookupServices; } /** @@ -103,8 +81,7 @@ public abstract class PrintServiceLookup { * @return the list of lookup services */ private static ArrayList initListOfLookupServices() { - ArrayList listOfLookupServices = new ArrayList<>(); - getServicesForContext().listOfLookupServices = listOfLookupServices; + listOfLookupServices = new ArrayList<>(); return listOfLookupServices; } @@ -114,7 +91,7 @@ public abstract class PrintServiceLookup { * @return the list of registered services */ private static ArrayList getRegisteredServices() { - return getServicesForContext().registeredServices; + return registeredServices; } /** @@ -123,8 +100,7 @@ public abstract class PrintServiceLookup { * @return the list of registered services */ private static ArrayList initRegisteredServices() { - ArrayList registeredServices = new ArrayList<>(); - getServicesForContext().registeredServices = registeredServices; + registeredServices = new ArrayList<>(); return registeredServices; } diff --git a/src/java.desktop/share/classes/javax/print/StreamPrintServiceFactory.java b/src/java.desktop/share/classes/javax/print/StreamPrintServiceFactory.java index 7d696f14a94..2667587e9b2 100644 --- a/src/java.desktop/share/classes/javax/print/StreamPrintServiceFactory.java +++ b/src/java.desktop/share/classes/javax/print/StreamPrintServiceFactory.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 @@ -33,8 +33,6 @@ import java.util.ServiceLoader; import javax.print.attribute.PrintRequestAttributeSet; -import sun.awt.AppContext; - /** * A {@code StreamPrintServiceFactory} is the factory for * {@link StreamPrintService} instances, which can print to an output stream in @@ -63,24 +61,20 @@ public abstract class StreamPrintServiceFactory { static class Services { /** - * The list of factories which will be stored per appcontext. + * The list of factories. */ private ArrayList listOfFactories = null; } + private static final Services SERVICES = new Services(); + /** - * Returns the services from the current appcontext. + * Returns the singleton Services instance. * * @return the services */ private static Services getServices() { - Services services = - (Services)AppContext.getAppContext().get(Services.class); - if (services == null) { - services = new Services(); - AppContext.getAppContext().put(Services.class, services); - } - return services; + return SERVICES; } /** diff --git a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java index a6d2a448186..8c7ac94b04e 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java @@ -452,78 +452,54 @@ public class BasicOptionPaneUI extends OptionPaneUI { } else if ((nl = s.indexOf('\n')) >= 0) { nll = 1; } - if (s.contains("")) { - /* line break in html text is done by
tag - * and not by /n so it's incorrect to address newline - * same as non-html text. - * Text between tags are extracted - * and rendered as JLabel text - */ - int index1 = s.indexOf(""); - int index2 = s.indexOf(""); - String str = ""; - if (index2 >= 0) { - str = s.substring(index2 + "".length()); - s = s.substring(index1, index2 + + "".length()); + if (nl >= 0) { + // break up newlines + if (nl == 0) { + JPanel breakPanel = new JPanel() { + public Dimension getPreferredSize() { + Font f = getFont(); + + if (f != null) { + return new Dimension(1, f.getSize() + 2); + } + return new Dimension(0, 0); + } + }; + breakPanel.setName("OptionPane.break"); + addMessageComponents(container, cons, breakPanel, maxll, + true); + } else { + addMessageComponents(container, cons, s.substring(0, nl), + maxll, false); } - JLabel label; - label = new JLabel(s, JLabel.LEADING); + // Prevent recursion of more than + // 200 successive newlines in a message + // and indicate message is truncated via ellipsis + if (recursionCount++ > 200) { + recursionCount = 0; + addMessageComponents(container, cons, new String("..."), + maxll, false); + return; + } + addMessageComponents(container, cons, s.substring(nl + nll), maxll, + false); + + } else if (len > maxll) { + Container c = Box.createVerticalBox(); + c.setName("OptionPane.verticalBox"); + burstStringInto(c, s, maxll); + addMessageComponents(container, cons, c, maxll, true); + + } else { + JLabel label = new JLabel(); if (Boolean.TRUE.equals( - this.optionPane.getClientProperty("html.disable"))) { + optionPane.getClientProperty("html.disable"))) { label.putClientProperty("html.disable", true); } + label.setText(s); label.setName("OptionPane.label"); configureMessageLabel(label); addMessageComponents(container, cons, label, maxll, true); - if (!str.isEmpty()) { - addMessageComponents(container, cons, str, maxll, false); - } - } else { - if (nl >= 0) { - // break up newlines - if (nl == 0) { - JPanel breakPanel = new JPanel() { - public Dimension getPreferredSize() { - Font f = getFont(); - - if (f != null) { - return new Dimension(1, f.getSize() + 2); - } - return new Dimension(0, 0); - } - }; - breakPanel.setName("OptionPane.break"); - addMessageComponents(container, cons, breakPanel, maxll, - true); - } else { - addMessageComponents(container, cons, s.substring(0, nl), - maxll, false); - } - // Prevent recursion of more than - // 200 successive newlines in a message - // and indicate message is truncated via ellipsis - if (recursionCount++ > 200) { - recursionCount = 0; - addMessageComponents(container, cons, new String("..."), - maxll, false); - return; - } - addMessageComponents(container, cons, s.substring(nl + nll), maxll, - false); - - } else if (len > maxll) { - Container c = Box.createVerticalBox(); - c.setName("OptionPane.verticalBox"); - burstStringInto(c, s, maxll); - addMessageComponents(container, cons, c, maxll, true); - - } else { - JLabel label; - label = new JLabel(s, JLabel.LEADING); - label.setName("OptionPane.label"); - configureMessageLabel(label); - addMessageComponents(container, cons, label, maxll, true); - } } } } diff --git a/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java b/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java index 03e04d1c1a7..59cee1e12ee 100644 --- a/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java +++ b/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, 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 @@ -62,9 +62,6 @@ import javax.accessibility.*; import javax.print.attribute.*; -import sun.awt.AppContext; - - import sun.swing.PrintingStatus; import sun.swing.SwingUtilities2; import sun.swing.text.TextComponentPrintable; @@ -1097,22 +1094,16 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A return getKeymapTable().get(nm); } - private static HashMap getKeymapTable() { - synchronized (KEYMAP_TABLE) { - AppContext appContext = AppContext.getAppContext(); - @SuppressWarnings("unchecked") - HashMap keymapTable = - (HashMap)appContext.get(KEYMAP_TABLE); - if (keymapTable == null) { - keymapTable = new HashMap(17); - appContext.put(KEYMAP_TABLE, keymapTable); - //initialize default keymap - Keymap binding = addKeymap(DEFAULT_KEYMAP, null); - binding.setDefaultAction(new - DefaultEditorKit.DefaultKeyTypedAction()); - } - return keymapTable; + private static HashMap keymapTable; + + private static synchronized HashMap getKeymapTable() { + if (keymapTable == null) { + keymapTable = new HashMap(17); + //initialize default keymap + Keymap binding = addKeymap(DEFAULT_KEYMAP, null); + binding.setDefaultAction(new DefaultEditorKit.DefaultKeyTypedAction()); } + return keymapTable; } /** @@ -1653,7 +1644,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A public void removeNotify() { super.removeNotify(); if (getFocusedComponent() == this) { - AppContext.getAppContext().remove(FOCUSED_COMPONENT); + focusedComponent = null; } } @@ -4084,13 +4075,14 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A } } + private static JTextComponent focusedComponent; + /** * Returns the JTextComponent that most recently had focus. The returned * value may currently have focus. */ static final JTextComponent getFocusedComponent() { - return (JTextComponent)AppContext.getAppContext(). - get(FOCUSED_COMPONENT); + return focusedComponent; } @SuppressWarnings("deprecation") @@ -4105,9 +4097,6 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A return modifiers; } - private static final Object KEYMAP_TABLE = - new StringBuilder("JTextComponent_KeymapTable"); - // // member variables used for on-the-spot input method // editing style support @@ -4438,9 +4427,6 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A } } - private static final Object FOCUSED_COMPONENT = - new StringBuilder("JTextComponent_FocusedComponent"); - /** * The default keymap that will be shared by all * JTextComponent instances unless they @@ -4493,8 +4479,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A // --- FocusListener methods ----------------------------------- public void focusGained(FocusEvent fe) { - AppContext.getAppContext().put(FOCUSED_COMPONENT, - fe.getSource()); + focusedComponent = (JTextComponent)fe.getSource(); } public void focusLost(FocusEvent fe) { diff --git a/src/java.desktop/share/classes/javax/swing/text/LayoutQueue.java b/src/java.desktop/share/classes/javax/swing/text/LayoutQueue.java index 6801a84da5b..1a4e7315eb4 100644 --- a/src/java.desktop/share/classes/javax/swing/text/LayoutQueue.java +++ b/src/java.desktop/share/classes/javax/swing/text/LayoutQueue.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, 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 @@ -25,7 +25,6 @@ package javax.swing.text; import java.util.Vector; -import sun.awt.AppContext; /** * A queue of text layout tasks. @@ -36,11 +35,11 @@ import sun.awt.AppContext; */ public class LayoutQueue { - private static final Object DEFAULT_QUEUE = new Object(); - private Vector tasks; private Thread worker; + private static LayoutQueue defaultQueue; + /** * Construct a layout queue. */ @@ -53,15 +52,10 @@ public class LayoutQueue { * @return the default layout queue */ public static LayoutQueue getDefaultQueue() { - AppContext ac = AppContext.getAppContext(); - synchronized (DEFAULT_QUEUE) { - LayoutQueue defaultQueue = (LayoutQueue) ac.get(DEFAULT_QUEUE); - if (defaultQueue == null) { - defaultQueue = new LayoutQueue(); - ac.put(DEFAULT_QUEUE, defaultQueue); - } - return defaultQueue; + if (defaultQueue == null) { + defaultQueue = new LayoutQueue(); } + return defaultQueue; } /** @@ -70,9 +64,7 @@ public class LayoutQueue { * @param q the new queue. */ public static void setDefaultQueue(LayoutQueue q) { - synchronized (DEFAULT_QUEUE) { - AppContext.getAppContext().put(DEFAULT_QUEUE, q); - } + defaultQueue = q; } /** diff --git a/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java b/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java index 53ceea32668..b5b75e1067b 100644 --- a/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java +++ b/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, 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 @@ -92,7 +92,6 @@ import javax.swing.text.ViewFactory; import javax.swing.text.html.parser.ParserDelegator; import sun.swing.SwingAccessor; -import sun.awt.AppContext; import static java.nio.charset.StandardCharsets.ISO_8859_1; @@ -432,11 +431,7 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible { * @param s a StyleSheet */ public void setStyleSheet(StyleSheet s) { - if (s == null) { - AppContext.getAppContext().remove(DEFAULT_STYLES_KEY); - } else { - AppContext.getAppContext().put(DEFAULT_STYLES_KEY, s); - } + defaultStyles = s; } /** @@ -448,12 +443,8 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible { * @return the StyleSheet */ public StyleSheet getStyleSheet() { - AppContext appContext = AppContext.getAppContext(); - StyleSheet defaultStyles = (StyleSheet) appContext.get(DEFAULT_STYLES_KEY); - if (defaultStyles == null) { defaultStyles = new StyleSheet(); - appContext.put(DEFAULT_STYLES_KEY, defaultStyles); try (InputStream is = HTMLEditorKit.getResourceAsStream(DEFAULT_CSS); InputStreamReader isr = new InputStreamReader(is, ISO_8859_1); Reader r = new BufferedReader(isr)) @@ -692,6 +683,7 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible { private static final ViewFactory defaultFactory = new HTMLFactory(); MutableAttributeSet input; + private static StyleSheet defaultStyles = null; private static final Object DEFAULT_STYLES_KEY = new Object(); private LinkController linkHandler = new LinkController(); private static Parser defaultParser = null; diff --git a/src/java.desktop/share/classes/javax/swing/text/html/parser/DTD.java b/src/java.desktop/share/classes/javax/swing/text/html/parser/DTD.java index e9999c679eb..d3a4fa76306 100644 --- a/src/java.desktop/share/classes/javax/swing/text/html/parser/DTD.java +++ b/src/java.desktop/share/classes/javax/swing/text/html/parser/DTD.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,6 @@ package javax.swing.text.html.parser; -import sun.awt.AppContext; - import java.io.PrintStream; import java.io.File; import java.io.FileInputStream; @@ -403,11 +401,6 @@ class DTD implements DTDConstants { return name; } - /** - * The hashtable key of DTDs in AppContext. - */ - private static final Object DTD_HASH_KEY = new Object(); - /** * Put a name and appropriate DTD to hashtable. * @@ -415,7 +408,7 @@ class DTD implements DTDConstants { * @param dtd the DTD */ public static void putDTDHash(String name, DTD dtd) { - getDtdHash().put(name, dtd); + DTD_MAP.put(name, dtd); } /** @@ -430,27 +423,14 @@ class DTD implements DTDConstants { */ public static DTD getDTD(String name) throws IOException { name = name.toLowerCase(); - DTD dtd = getDtdHash().get(name); + DTD dtd = DTD_MAP.get(name); if (dtd == null) dtd = new DTD(name); return dtd; } - private static Hashtable getDtdHash() { - AppContext appContext = AppContext.getAppContext(); - - @SuppressWarnings("unchecked") - Hashtable result = (Hashtable) appContext.get(DTD_HASH_KEY); - - if (result == null) { - result = new Hashtable(); - - appContext.put(DTD_HASH_KEY, result); - } - - return result; - } + private static final Hashtable DTD_MAP = new Hashtable(); /** * Recreates a DTD from an archived format. diff --git a/src/java.desktop/share/classes/javax/swing/text/html/parser/Element.java b/src/java.desktop/share/classes/javax/swing/text/html/parser/Element.java index cf8ea622c9b..8dd00373636 100644 --- a/src/java.desktop/share/classes/javax/swing/text/html/parser/Element.java +++ b/src/java.desktop/share/classes/javax/swing/text/html/parser/Element.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,6 @@ package javax.swing.text.html.parser; import java.io.Serializable; import java.util.BitSet; import java.util.Map; -import sun.awt.AppContext; /** * An element as described in a DTD using the ELEMENT construct. @@ -107,17 +106,14 @@ public final class Element implements DTDConstants, Serializable { this.name = name; this.index = index; if (index > getMaxIndex()) { - AppContext.getAppContext().put(MAX_INDEX_KEY, index); + maxIndex = index; } } - private static final Object MAX_INDEX_KEY = new Object(); + private static int maxIndex = 0; static int getMaxIndex() { - Integer value = (Integer) AppContext.getAppContext().get(MAX_INDEX_KEY); - return (value != null) - ? value.intValue() - : 0; + return maxIndex; } /** diff --git a/src/java.desktop/share/classes/javax/swing/text/html/parser/ParserDelegator.java b/src/java.desktop/share/classes/javax/swing/text/html/parser/ParserDelegator.java index 2d541abc06f..6971f313558 100644 --- a/src/java.desktop/share/classes/javax/swing/text/html/parser/ParserDelegator.java +++ b/src/java.desktop/share/classes/javax/swing/text/html/parser/ParserDelegator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,6 @@ */ package javax.swing.text.html.parser; -import sun.awt.AppContext; - import javax.swing.text.html.HTMLEditorKit; import java.io.BufferedInputStream; import java.io.IOException; @@ -52,7 +50,8 @@ import java.io.Serializable; */ @SuppressWarnings("serial") // Same-version serialization only public class ParserDelegator extends HTMLEditorKit.Parser implements Serializable { - private static final Object DTD_KEY = new Object(); + + private static DTD dtd = null; /** * Sets the default DTD. @@ -62,10 +61,6 @@ public class ParserDelegator extends HTMLEditorKit.Parser implements Serializabl } private static synchronized DTD getDefaultDTD() { - AppContext appContext = AppContext.getAppContext(); - - DTD dtd = (DTD) appContext.get(DTD_KEY); - if (dtd == null) { DTD _dtd = null; // (PENDING) Hate having to hard code! @@ -77,10 +72,7 @@ public class ParserDelegator extends HTMLEditorKit.Parser implements Serializabl System.out.println("Throw an exception: could not get default dtd: " + nm); } dtd = createDTD(_dtd, nm); - - appContext.put(DTD_KEY, dtd); } - return dtd; } diff --git a/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java b/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java index 1bebf379997..9815d657eee 100644 --- a/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java +++ b/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -1898,14 +1898,16 @@ public final class SunGraphics2D protected void validateCompClip() { int origClipState = clipState; - if (usrClip == null) { + final Shape clip = usrClip; + + if (clip == null) { clipState = CLIP_DEVICE; clipRegion = devClip; - } else if (usrClip instanceof Rectangle2D) { + } else if (clip instanceof Rectangle2D rect2d) { clipState = CLIP_RECTANGULAR; - clipRegion = devClip.getIntersection((Rectangle2D) usrClip); + clipRegion = devClip.getIntersection(rect2d); } else { - PathIterator cpi = usrClip.getPathIterator(null); + PathIterator cpi = clip.getPathIterator(null); int[] box = new int[4]; ShapeSpanIterator sr = LoopPipe.getFillSSI(this); try { diff --git a/src/java.desktop/share/classes/sun/java2d/pipe/SpanClipRenderer.java b/src/java.desktop/share/classes/sun/java2d/pipe/SpanClipRenderer.java index 62d1f119f33..69c4954cac4 100644 --- a/src/java.desktop/share/classes/sun/java2d/pipe/SpanClipRenderer.java +++ b/src/java.desktop/share/classes/sun/java2d/pipe/SpanClipRenderer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -27,6 +27,8 @@ package sun.java2d.pipe; import java.awt.Rectangle; import java.awt.Shape; + +import sun.java2d.InvalidPipeException; import sun.java2d.SunGraphics2D; /** @@ -67,7 +69,9 @@ public class SpanClipRenderer implements CompositePipe public Object startSequence(SunGraphics2D sg, Shape s, Rectangle devR, int[] abox) { RegionIterator ri = sg.clipRegion.getIterator(); - + if (ri.region.isRectangular()) { + throw new InvalidPipeException("Invalid clip data"); + } return new SCRcontext(ri, outpipe.startSequence(sg, s, devR, abox)); } diff --git a/src/java.desktop/share/legal/libpng.md b/src/java.desktop/share/legal/libpng.md index 8899491c6c0..80d12248ec4 100644 --- a/src/java.desktop/share/legal/libpng.md +++ b/src/java.desktop/share/legal/libpng.md @@ -1,4 +1,4 @@ -## libpng v1.6.51 +## libpng v1.6.54 ### libpng License

@@ -9,8 +9,8 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
 PNG Reference Library License version 2
 ---------------------------------------
 
-Copyright (C) 1995-2025 The PNG Reference Library Authors.
-Copyright (C) 2018-2025 Cosmin Truta
+Copyright (C) 1995-2026 The PNG Reference Library Authors.
+Copyright (C) 2018-2026 Cosmin Truta
 Copyright (C) 1998-2018 Glenn Randers-Pehrson
 Copyright (C) 1996-1997 Andreas Dilger
 Copyright (C) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -158,6 +158,7 @@ This is the list of PNG Reference Library ("libpng") Contributing
 Authors, for copyright and licensing purposes.
 
  * Adam Richter
+ * Alexander Smorkalov
  * Andreas Dilger
  * Chris Blume
  * Cosmin Truta
@@ -179,6 +180,7 @@ Authors, for copyright and licensing purposes.
  * Mike Klein
  * Pascal Massimino
  * Paul Schmidt
+ * Petr Simecek
  * Philippe Antoine
  * Qiang Zhou
  * Sam Bushell
@@ -209,6 +211,8 @@ Authors, for copyright and licensing purposes.
     - ZhangLixia (张利霞)
  * Samsung Group
     - Filip Wasil
+ * SpacemiT Hangzhou Technology, Co.
+    - Liang Junzhao (梁俊钊)
 
 The build projects, the build scripts, the test scripts, and other
 files in the "projects", "scripts" and "tests" directories, have
diff --git a/src/java.desktop/share/native/libawt/awt/image/awt_ImageRep.c b/src/java.desktop/share/native/libawt/awt/image/awt_ImageRep.c
index 6079b9e76b8..3cb2df0e0e9 100644
--- a/src/java.desktop/share/native/libawt/awt/image/awt_ImageRep.c
+++ b/src/java.desktop/share/native/libawt/awt/image/awt_ImageRep.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, 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
@@ -227,7 +227,7 @@ Java_sun_awt_image_ImageRepresentation_setICMpixels(JNIEnv *env, jclass cls,
     /* Release the locked arrays */
     (*env)->ReleasePrimitiveArrayCritical(env, jlut, srcLUT,  JNI_ABORT);
     (*env)->ReleasePrimitiveArrayCritical(env, jpix, srcData, JNI_ABORT);
-    (*env)->ReleasePrimitiveArrayCritical(env, jdata, dstData, JNI_ABORT);
+    (*env)->ReleasePrimitiveArrayCritical(env, jdata, dstData, 0);
 
     return JNI_TRUE;
 }
@@ -385,7 +385,7 @@ Java_sun_awt_image_ImageRepresentation_setDiffICM(JNIEnv *env, jclass cls,
     }
 
     (*env)->ReleasePrimitiveArrayCritical(env, jpix, srcData, JNI_ABORT);
-    (*env)->ReleasePrimitiveArrayCritical(env, jdata, dstData, JNI_ABORT);
+    (*env)->ReleasePrimitiveArrayCritical(env, jdata, dstData, 0);
 
     return JNI_TRUE;
 }
diff --git a/src/java.desktop/share/native/libmlib_image/mlib_ImageConvMxN_Fp.c b/src/java.desktop/share/native/libmlib_image/mlib_ImageConvMxN_Fp.c
index fa9a186d6d7..bc2df9b0b1a 100644
--- a/src/java.desktop/share/native/libmlib_image/mlib_ImageConvMxN_Fp.c
+++ b/src/java.desktop/share/native/libmlib_image/mlib_ImageConvMxN_Fp.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -76,6 +76,7 @@
 #include "mlib_ImageCheck.h"
 #include "mlib_SysMath.h"
 #include "mlib_ImageConv.h"
+#include "safe_math.h"
 
 /***************************************************************/
 static void mlib_ImageConvMxNMulAdd_F32(mlib_f32       *dst,
@@ -272,6 +273,9 @@ mlib_status mlib_convMxNext_f32(mlib_image       *dst,
   mlib_s32 nch = mlib_ImageGetChannels(dst);
   mlib_s32 i, j, j1, k;
 
+  if (!SAFE_TO_MULT(3, wid_e) || !SAFE_TO_ADD(3 * wid_e, m)) {
+    return MLIB_FAILURE;
+  }
   if (3 * wid_e + m > 1024) {
     dsa = mlib_malloc((3 * wid_e + m) * sizeof(mlib_d64));
 
@@ -629,6 +633,9 @@ mlib_status mlib_convMxNext_d64(mlib_image       *dst,
   mlib_s32 nch = mlib_ImageGetChannels(dst);
   mlib_s32 i, j, j1, k;
 
+  if (!SAFE_TO_MULT(3, wid_e) || !SAFE_TO_ADD(3 * wid_e, m)) {
+    return MLIB_FAILURE;
+  }
   if (3 * wid_e + m > 1024) {
     dsa = mlib_malloc((3 * wid_e + m) * sizeof(mlib_d64));
 
diff --git a/src/java.desktop/share/native/libmlib_image/mlib_ImageConvMxN_ext.c b/src/java.desktop/share/native/libmlib_image/mlib_ImageConvMxN_ext.c
index ee15935dcfe..5869b0a54af 100644
--- a/src/java.desktop/share/native/libmlib_image/mlib_ImageConvMxN_ext.c
+++ b/src/java.desktop/share/native/libmlib_image/mlib_ImageConvMxN_ext.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -82,6 +82,7 @@
 
 #include "mlib_image.h"
 #include "mlib_ImageConv.h"
+#include "safe_math.h"
 
 /***************************************************************/
 static void mlib_ImageConvMxNMulAdd_S32(mlib_d64       *dst,
@@ -229,6 +230,9 @@ mlib_status mlib_convMxNext_s32(mlib_image       *dst,
 
   /* internal buffer */
 
+  if (!SAFE_TO_MULT(3, wid_e) || !SAFE_TO_ADD(3 * wid_e, m)) {
+    return MLIB_FAILURE;
+  }
   if (3 * wid_e + m > 1024) {
     dsa = mlib_malloc((3 * wid_e + m) * sizeof(mlib_d64));
 
diff --git a/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_16ext.c b/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_16ext.c
index 57486b1cae5..00469d25719 100644
--- a/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_16ext.c
+++ b/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_16ext.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
 #include "mlib_image.h"
 #include "mlib_ImageConv.h"
 #include "mlib_c_ImageConv.h"
+#include "safe_math.h"
 
 /*
  * This define switches between functions of different data types
@@ -260,8 +261,14 @@ static mlib_status mlib_ImageConv1xN_ext(mlib_image       *dst,
   if (max_hsize > hgt) max_hsize = hgt;
 
   shgt = hgt + (n - 1);
+  if (!SAFE_TO_ADD(max_hsize, (n - 1))) {
+    return MLIB_FAILURE;
+  }
   smax_hsize = max_hsize + (n - 1);
 
+  if (!SAFE_TO_ADD(smax_hsize, 1) || !SAFE_TO_MULT(2, (smax_hsize + 1))) {
+    return MLIB_FAILURE;
+  }
   bsize = 2 * (smax_hsize + 1);
 
   if (bsize > BUFF_SIZE) {
@@ -509,8 +516,16 @@ mlib_status CONV_FUNC_MxN
     FREE_AND_RETURN_STATUS;
   }
 
+  if (!SAFE_TO_ADD(wid, (m - 1))) {
+    status = MLIB_FAILURE;
+    FREE_AND_RETURN_STATUS;
+  }
   swid = wid + (m - 1);
 
+  if (!SAFE_TO_MULT((n + 3), swid)) {
+    status = MLIB_FAILURE;
+    FREE_AND_RETURN_STATUS;
+  }
   bsize = (n + 3)*swid;
 
   if ((bsize > BUFF_SIZE) || (n > MAX_N)) {
@@ -919,8 +934,14 @@ mlib_status CONV_FUNC_MxN_I
   chan1 = nchannel;
   chan2 = chan1 + chan1;
 
+  if (!SAFE_TO_ADD(wid, (m - 1))) {
+    return MLIB_FAILURE;
+  }
   swid = wid + (m - 1);
 
+  if (!SAFE_TO_MULT((n + 2), swid)) {
+    return MLIB_FAILURE;
+  }
   bsize = (n + 2)*swid;
 
   if ((bsize > BUFF_SIZE) || (n > MAX_N)) {
diff --git a/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_16nw.c b/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_16nw.c
index 3b6985b7876..2e035d12453 100644
--- a/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_16nw.c
+++ b/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_16nw.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,7 @@
 
 #include "mlib_image.h"
 #include "mlib_c_ImageConv.h"
+#include "safe_math.h"
 
 /*
   This define switches between functions of different data types
@@ -466,6 +467,10 @@ mlib_status CONV_FUNC(MxN)(mlib_image       *dst,
     FREE_AND_RETURN_STATUS;
   }
 
+  if (!SAFE_TO_MULT((n + 3), wid)) {
+    status = MLIB_FAILURE;
+    FREE_AND_RETURN_STATUS;
+  }
   bsize = (n + 3)*wid;
 
   if ((bsize > BUFF_SIZE) || (n > MAX_N)) {
diff --git a/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_32nw.c b/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_32nw.c
index 380ed044878..bb264d9dcd2 100644
--- a/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_32nw.c
+++ b/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_32nw.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
 
 #include "mlib_image.h"
 #include "mlib_ImageConv.h"
+#include "safe_math.h"
 
 /***************************************************************/
 #define CACHE_SIZE (64*1024)
@@ -335,6 +336,10 @@ mlib_status CONV_FUNC(MxN)(mlib_image       *dst,
     FREE_AND_RETURN_STATUS;
   }
 
+  if (!SAFE_TO_MULT((n + 2), wid)) {
+    status = MLIB_FAILURE;
+    FREE_AND_RETURN_STATUS;
+  }
   bsize = (n + 2)*wid;
 
   if ((bsize > BUFF_SIZE) || (n > MAX_N)) {
diff --git a/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_8ext.c b/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_8ext.c
index c8b58e6f138..136d5a2b814 100644
--- a/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_8ext.c
+++ b/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_8ext.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
 #include "mlib_image.h"
 #include "mlib_ImageConv.h"
 #include "mlib_c_ImageConv.h"
+#include "safe_math.h"
 
 /*
  * This define switches between functions of different data types
@@ -245,8 +246,14 @@ static mlib_status mlib_ImageConv1xN_ext(mlib_image       *dst,
   if (max_hsize > hgt) max_hsize = hgt;
 
   shgt = hgt + (n - 1);
+  if (!SAFE_TO_ADD(max_hsize, (n - 1))) {
+    return MLIB_FAILURE;
+  }
   smax_hsize = max_hsize + (n - 1);
 
+  if (!SAFE_TO_ADD(smax_hsize, 1) || !SAFE_TO_MULT(2, (smax_hsize + 1))) {
+    return MLIB_FAILURE;
+  }
   bsize = 2 * (smax_hsize + 1);
 
   if (bsize > BUFF_SIZE) {
@@ -494,8 +501,16 @@ mlib_status CONV_FUNC_MxN
     FREE_AND_RETURN_STATUS;
   }
 
+  if (!SAFE_TO_ADD(wid, (m - 1))) {
+    status = MLIB_FAILURE;
+    FREE_AND_RETURN_STATUS;
+  }
   swid = wid + (m - 1);
 
+  if (!SAFE_TO_MULT((n + 3), swid)) {
+    status = MLIB_FAILURE;
+    FREE_AND_RETURN_STATUS;
+  }
   bsize = (n + 3)*swid;
 
   if ((bsize > BUFF_SIZE) || (n > MAX_N)) {
@@ -904,8 +919,14 @@ mlib_status CONV_FUNC_MxN_I
   chan1 = nchannel;
   chan2 = chan1 + chan1;
 
+  if (!SAFE_TO_ADD(wid, (m - 1))) {
+    return MLIB_FAILURE;
+  }
   swid = wid + (m - 1);
 
+  if (!SAFE_TO_MULT((n + 2), swid)) {
+    return MLIB_FAILURE;
+  }
   bsize = (n + 2)*swid;
 
   if ((bsize > BUFF_SIZE) || (n > MAX_N)) {
diff --git a/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_8nw.c b/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_8nw.c
index f65fda45c58..c144404b0f4 100644
--- a/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_8nw.c
+++ b/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_8nw.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
 #include "mlib_image.h"
 #include "mlib_ImageConv.h"
 #include "mlib_c_ImageConv.h"
+#include "safe_math.h"
 
 /*
   This define switches between functions of different data types
@@ -467,6 +468,10 @@ mlib_status CONV_FUNC(MxN)(mlib_image       *dst,
     FREE_AND_RETURN_STATUS;
   }
 
+  if (!SAFE_TO_MULT((n + 3), wid)) {
+    status = MLIB_FAILURE;
+    FREE_AND_RETURN_STATUS;
+  }
   bsize = (n + 3)*wid;
 
   if ((bsize > BUFF_SIZE) || (n > MAX_N)) {
diff --git a/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_u16ext.c b/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_u16ext.c
index b2757979a84..81a06f2fc28 100644
--- a/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_u16ext.c
+++ b/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_u16ext.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
 #include "mlib_image.h"
 #include "mlib_ImageConv.h"
 #include "mlib_c_ImageConv.h"
+#include "safe_math.h"
 
 /*
  * This define switches between functions of different data types
@@ -270,8 +271,14 @@ static mlib_status mlib_ImageConv1xN_ext(mlib_image       *dst,
   if (max_hsize > hgt) max_hsize = hgt;
 
   shgt = hgt + (n - 1);
+  if (!SAFE_TO_ADD(max_hsize, (n - 1))) {
+    return MLIB_FAILURE;
+  }
   smax_hsize = max_hsize + (n - 1);
 
+  if (!SAFE_TO_ADD(smax_hsize, 1) || !SAFE_TO_MULT(2, (smax_hsize + 1))) {
+    return MLIB_FAILURE;
+  }
   bsize = 2 * (smax_hsize + 1);
 
   if (bsize > BUFF_SIZE) {
@@ -519,8 +526,16 @@ mlib_status CONV_FUNC_MxN
     FREE_AND_RETURN_STATUS;
   }
 
+  if (!SAFE_TO_ADD(wid, (m - 1))) {
+    status = MLIB_FAILURE;
+    FREE_AND_RETURN_STATUS;
+  }
   swid = wid + (m - 1);
 
+  if (!SAFE_TO_MULT((n + 3), swid)) {
+    status = MLIB_FAILURE;
+    FREE_AND_RETURN_STATUS;
+  }
   bsize = (n + 3)*swid;
 
   if ((bsize > BUFF_SIZE) || (n > MAX_N)) {
@@ -927,8 +942,14 @@ mlib_status CONV_FUNC_MxN_I
   chan1 = nchannel;
   chan2 = chan1 + chan1;
 
+  if (!SAFE_TO_ADD(wid, (m - 1))) {
+    return MLIB_FAILURE;
+  }
   swid = wid + (m - 1);
 
+  if (!SAFE_TO_MULT((n + 2), swid)) {
+    return MLIB_FAILURE;
+  }
   bsize = (n + 2)*swid;
 
   if ((bsize > BUFF_SIZE) || (n > MAX_N)) {
diff --git a/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_u16nw.c b/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_u16nw.c
index a3234cf8959..49412c7d7ef 100644
--- a/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_u16nw.c
+++ b/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_u16nw.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,7 @@
 
 #include "mlib_image.h"
 #include "mlib_c_ImageConv.h"
+#include "safe_math.h"
 
 /*
   This define switches between functions of different data types
@@ -466,6 +467,10 @@ mlib_status CONV_FUNC(MxN)(mlib_image       *dst,
     FREE_AND_RETURN_STATUS;
   }
 
+  if (!SAFE_TO_MULT((n + 3), wid)) {
+    status = MLIB_FAILURE;
+    FREE_AND_RETURN_STATUS;
+  }
   bsize = (n + 3)*wid;
 
   if ((bsize > BUFF_SIZE) || (n > MAX_N)) {
diff --git a/src/java.desktop/share/native/libmlib_image/mlib_ImageLookUp_Bit.c b/src/java.desktop/share/native/libmlib_image/mlib_ImageLookUp_Bit.c
index 2e77c20aa57..cfd5e3e671e 100644
--- a/src/java.desktop/share/native/libmlib_image/mlib_ImageLookUp_Bit.c
+++ b/src/java.desktop/share/native/libmlib_image/mlib_ImageLookUp_Bit.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,6 +50,7 @@
 
 #include "mlib_image.h"
 #include "mlib_ImageLookUp.h"
+#include "safe_math.h"
 
 /***************************************************************/
 #define MAX_WIDTH  512
@@ -302,6 +303,9 @@ mlib_status mlib_ImageLookUp_Bit_U8_2(const mlib_u8 *src,
   mlib_u8  *buff = (mlib_u8*)buff_lcl, *buffs;
   mlib_u32 val0, val1;
 
+  if (!SAFE_TO_MULT(xsize, 2)) {
+    return MLIB_FAILURE;
+  }
   size = xsize * 2;
 
   if (size > MAX_WIDTH) {
@@ -440,6 +444,9 @@ mlib_status mlib_ImageLookUp_Bit_U8_3(const mlib_u8 *src,
   mlib_u8  *buff = (mlib_u8*)buff_lcl, *buffs;
   mlib_u32 l0, h0, v0, l1, h1, v1, l2, h2, v2;
 
+  if (!SAFE_TO_MULT(3, xsize)) {
+    return MLIB_FAILURE;
+  }
   size = 3 * xsize;
 
   if (size > MAX_WIDTH) {
@@ -583,6 +590,9 @@ mlib_status mlib_ImageLookUp_Bit_U8_4(const mlib_u8 *src,
   mlib_u8  *buff = (mlib_u8*)buff_lcl, *buffs;
   mlib_u32 l, h;
 
+  if (!SAFE_TO_MULT(xsize, 4)) {
+    return MLIB_FAILURE;
+  }
   size = xsize * 4;
 
   if (size > MAX_WIDTH) {
diff --git a/src/java.desktop/share/native/libmlib_image/mlib_ImageScanPoly.c b/src/java.desktop/share/native/libmlib_image/mlib_ImageScanPoly.c
index a6f4cfdd36e..72adc212af6 100644
--- a/src/java.desktop/share/native/libmlib_image/mlib_ImageScanPoly.c
+++ b/src/java.desktop/share/native/libmlib_image/mlib_ImageScanPoly.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -101,6 +101,11 @@ mlib_status mlib_AffineEdges(mlib_affine_param *param,
     return MLIB_FAILURE;
   }
 
+  int intSize = sizeof(mlib_s32);
+  if (!SAFE_TO_MULT(dstHeight, intSize) ||
+      !SAFE_TO_ADD(dstHeight * intSize, 7)) {
+    return MLIB_FAILURE;
+  }
   bsize0 = (dstHeight * sizeof(mlib_s32) + 7) & ~7;
 
   if (lineAddr == NULL) {
@@ -109,6 +114,10 @@ mlib_status mlib_AffineEdges(mlib_affine_param *param,
 
   param->buff_malloc = NULL;
 
+  if (!SAFE_TO_MULT(4, bsize0) || !SAFE_TO_ADD(4 * bsize0, bsize1)) {
+    return MLIB_FAILURE;
+  }
+
   if ((4 * bsize0 + bsize1) > buff_size) {
     buff = param->buff_malloc = mlib_malloc(4 * bsize0 + bsize1);
 
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES b/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES
index 2478fd0fc08..3bb1baecd23 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES
@@ -6304,6 +6304,33 @@ Version 1.6.51 [November 21, 2025]
   Added GitHub Actions workflows for automated testing.
   Performed various refactorings and cleanups.
 
+Version 1.6.52 [December 3, 2025]
+  Fixed CVE-2025-66293 (high severity):
+    Out-of-bounds read in `png_image_read_composite`.
+    (Reported by flyfish101 .)
+  Fixed the Paeth filter handling in the RISC-V RVV implementation.
+    (Reported by Filip Wasil; fixed by Liang Junzhao.)
+  Improved the performance of the RISC-V RVV implementation.
+    (Contributed by Liang Junzhao.)
+  Added allocation failure fuzzing to oss-fuzz.
+    (Contributed by Philippe Antoine.)
+
+Version 1.6.53 [December 5, 2025]
+  Fixed a build failure on RISC-V RVV caused by a misspelled intrinsic.
+    (Contributed by Alexander Smorkalov.)
+  Fixed a build failure with CMake 4.1 or newer, on Windows, when using
+    Visual C++ without MASM installed.
+
+Version 1.6.54 [January 12, 2026]
+  Fixed CVE-2026-22695 (medium severity):
+    Heap buffer over-read in `png_image_read_direct_scaled.
+    (Reported and fixed by Petr Simecek.)
+  Fixed CVE-2026-22801 (medium severity):
+    Integer truncation causing heap buffer over-read in `png_image_write_*`.
+  Implemented various improvements in oss-fuzz.
+    (Contributed by Philippe Antoine.)
+
+
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
 Subscription is required; visit
 https://lists.sourceforge.net/lists/listinfo/png-mng-implement
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/LICENSE b/src/java.desktop/share/native/libsplashscreen/libpng/LICENSE
index ea6df986cb6..1b765ae9f96 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/LICENSE
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/LICENSE
@@ -4,8 +4,8 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
 PNG Reference Library License version 2
 ---------------------------------------
 
- * Copyright (c) 1995-2025 The PNG Reference Library Authors.
- * Copyright (c) 2018-2025 Cosmin Truta.
+ * Copyright (c) 1995-2026 The PNG Reference Library Authors.
+ * Copyright (c) 2018-2026 Cosmin Truta.
  * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
  * Copyright (c) 1996-1997 Andreas Dilger.
  * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/README b/src/java.desktop/share/native/libsplashscreen/libpng/README
index 5ea329ee3da..63d1376edf7 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/README
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/README
@@ -1,4 +1,4 @@
-README for libpng version 1.6.51
+README for libpng version 1.6.54
 ================================
 
 See the note about version numbers near the top of `png.h`.
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/png.c b/src/java.desktop/share/native/libsplashscreen/libpng/png.c
index 7d85e7c8d5f..5636b4a754e 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/png.c
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/png.c
@@ -29,7 +29,7 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Copyright (c) 2018-2025 Cosmin Truta
+ * Copyright (c) 2018-2026 Cosmin Truta
  * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
  * Copyright (c) 1996-1997 Andreas Dilger
  * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -42,7 +42,7 @@
 #include "pngpriv.h"
 
 /* Generate a compiler error if there is an old png.h in the search path. */
-typedef png_libpng_version_1_6_51 Your_png_h_is_not_version_1_6_51;
+typedef png_libpng_version_1_6_54 Your_png_h_is_not_version_1_6_54;
 
 /* Sanity check the chunks definitions - PNG_KNOWN_CHUNKS from pngpriv.h and the
  * corresponding macro definitions.  This causes a compile time failure if
@@ -130,7 +130,8 @@ png_sig_cmp(png_const_bytep sig, size_t start, size_t num_to_check)
 #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
 /* Function to allocate memory for zlib */
 PNG_FUNCTION(voidpf /* PRIVATE */,
-png_zalloc,(voidpf png_ptr, uInt items, uInt size),PNG_ALLOCATED)
+png_zalloc,(voidpf png_ptr, uInt items, uInt size),
+    PNG_ALLOCATED)
 {
    png_alloc_size_t num_bytes = size;
 
@@ -286,7 +287,8 @@ png_user_version_check(png_structrp png_ptr, png_const_charp user_png_ver)
 PNG_FUNCTION(png_structp /* PRIVATE */,
 png_create_png_struct,(png_const_charp user_png_ver, png_voidp error_ptr,
     png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
-    png_malloc_ptr malloc_fn, png_free_ptr free_fn),PNG_ALLOCATED)
+    png_malloc_ptr malloc_fn, png_free_ptr free_fn),
+    PNG_ALLOCATED)
 {
    png_struct create_struct;
 #  ifdef PNG_SETJMP_SUPPORTED
@@ -390,7 +392,8 @@ png_create_png_struct,(png_const_charp user_png_ver, png_voidp error_ptr,
 
 /* Allocate the memory for an info_struct for the application. */
 PNG_FUNCTION(png_infop,PNGAPI
-png_create_info_struct,(png_const_structrp png_ptr),PNG_ALLOCATED)
+png_create_info_struct,(png_const_structrp png_ptr),
+    PNG_ALLOCATED)
 {
    png_inforp info_ptr;
 
@@ -846,8 +849,8 @@ png_get_copyright(png_const_structrp png_ptr)
    return PNG_STRING_COPYRIGHT
 #else
    return PNG_STRING_NEWLINE \
-      "libpng version 1.6.51" PNG_STRING_NEWLINE \
-      "Copyright (c) 2018-2025 Cosmin Truta" PNG_STRING_NEWLINE \
+      "libpng version 1.6.54" PNG_STRING_NEWLINE \
+      "Copyright (c) 2018-2026 Cosmin Truta" PNG_STRING_NEWLINE \
       "Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \
       PNG_STRING_NEWLINE \
       "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
@@ -2286,8 +2289,8 @@ PNG_FP_End:
 int
 png_check_fp_string(png_const_charp string, size_t size)
 {
-   int        state=0;
-   size_t char_index=0;
+   int state = 0;
+   size_t char_index = 0;
 
    if (png_check_fp_number(string, size, &state, &char_index) != 0 &&
       (char_index == size || string[char_index] == 0))
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/png.h b/src/java.desktop/share/native/libsplashscreen/libpng/png.h
index d39ff73552c..ab8876a9626 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/png.h
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/png.h
@@ -29,9 +29,9 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * libpng version 1.6.51
+ * libpng version 1.6.54
  *
- * Copyright (c) 2018-2025 Cosmin Truta
+ * Copyright (c) 2018-2026 Cosmin Truta
  * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
  * Copyright (c) 1996-1997 Andreas Dilger
  * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -43,7 +43,7 @@
  *   libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
  *   libpng versions 0.97, January 1998, through 1.6.35, July 2018:
  *     Glenn Randers-Pehrson
- *   libpng versions 1.6.36, December 2018, through 1.6.51, November 2025:
+ *   libpng versions 1.6.36, December 2018, through 1.6.54, January 2026:
  *     Cosmin Truta
  *   See also "Contributing Authors", below.
  */
@@ -55,8 +55,8 @@
  * PNG Reference Library License version 2
  * ---------------------------------------
  *
- *  * Copyright (c) 1995-2025 The PNG Reference Library Authors.
- *  * Copyright (c) 2018-2025 Cosmin Truta.
+ *  * Copyright (c) 1995-2026 The PNG Reference Library Authors.
+ *  * Copyright (c) 2018-2026 Cosmin Truta.
  *  * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
  *  * Copyright (c) 1996-1997 Andreas Dilger.
  *  * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -267,7 +267,7 @@
  *    ...
  *    1.5.30                  15    10530  15.so.15.30[.0]
  *    ...
- *    1.6.51                  16    10651  16.so.16.51[.0]
+ *    1.6.54                  16    10654  16.so.16.54[.0]
  *
  *    Henceforth the source version will match the shared-library major and
  *    minor numbers; the shared-library major version number will be used for
@@ -303,7 +303,7 @@
  */
 
 /* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.6.51"
+#define PNG_LIBPNG_VER_STRING "1.6.54"
 #define PNG_HEADER_VERSION_STRING " libpng version " PNG_LIBPNG_VER_STRING "\n"
 
 /* The versions of shared library builds should stay in sync, going forward */
@@ -314,7 +314,7 @@
 /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
 #define PNG_LIBPNG_VER_MAJOR   1
 #define PNG_LIBPNG_VER_MINOR   6
-#define PNG_LIBPNG_VER_RELEASE 51
+#define PNG_LIBPNG_VER_RELEASE 54
 
 /* This should be zero for a public release, or non-zero for a
  * development version.
@@ -345,7 +345,7 @@
  * From version 1.0.1 it is:
  * XXYYZZ, where XX=major, YY=minor, ZZ=release
  */
-#define PNG_LIBPNG_VER 10651 /* 1.6.51 */
+#define PNG_LIBPNG_VER 10654 /* 1.6.54 */
 
 /* Library configuration: these options cannot be changed after
  * the library has been built.
@@ -455,7 +455,7 @@ extern "C" {
 /* This triggers a compiler error in png.c, if png.c and png.h
  * do not agree upon the version number.
  */
-typedef char* png_libpng_version_1_6_51;
+typedef char *png_libpng_version_1_6_54;
 
 /* Basic control structions.  Read libpng-manual.txt or libpng.3 for more info.
  *
@@ -814,17 +814,22 @@ typedef png_row_info * * png_row_infopp;
  * modify the buffer it is passed. The 'read' function, on the other hand, is
  * expected to return the read data in the buffer.
  */
-typedef PNG_CALLBACK(void, *png_error_ptr, (png_structp, png_const_charp));
-typedef PNG_CALLBACK(void, *png_rw_ptr, (png_structp, png_bytep, size_t));
-typedef PNG_CALLBACK(void, *png_flush_ptr, (png_structp));
-typedef PNG_CALLBACK(void, *png_read_status_ptr, (png_structp, png_uint_32,
-    int));
-typedef PNG_CALLBACK(void, *png_write_status_ptr, (png_structp, png_uint_32,
-    int));
+typedef PNG_CALLBACK(void, *png_error_ptr,
+   (png_structp, png_const_charp));
+typedef PNG_CALLBACK(void, *png_rw_ptr,
+   (png_structp, png_bytep, size_t));
+typedef PNG_CALLBACK(void, *png_flush_ptr,
+   (png_structp));
+typedef PNG_CALLBACK(void, *png_read_status_ptr,
+   (png_structp, png_uint_32, int));
+typedef PNG_CALLBACK(void, *png_write_status_ptr,
+   (png_structp, png_uint_32, int));
 
 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
-typedef PNG_CALLBACK(void, *png_progressive_info_ptr, (png_structp, png_infop));
-typedef PNG_CALLBACK(void, *png_progressive_end_ptr, (png_structp, png_infop));
+typedef PNG_CALLBACK(void, *png_progressive_info_ptr,
+   (png_structp, png_infop));
+typedef PNG_CALLBACK(void, *png_progressive_end_ptr,
+   (png_structp, png_infop));
 
 /* The following callback receives png_uint_32 row_number, int pass for the
  * png_bytep data of the row.  When transforming an interlaced image the
@@ -836,19 +841,19 @@ typedef PNG_CALLBACK(void, *png_progressive_end_ptr, (png_structp, png_infop));
  * find the output pixel (x,y) given an interlaced sub-image pixel
  * (row,col,pass).  (See below for these macros.)
  */
-typedef PNG_CALLBACK(void, *png_progressive_row_ptr, (png_structp, png_bytep,
-    png_uint_32, int));
+typedef PNG_CALLBACK(void, *png_progressive_row_ptr,
+   (png_structp, png_bytep, png_uint_32, int));
 #endif
 
 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
     defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
-typedef PNG_CALLBACK(void, *png_user_transform_ptr, (png_structp, png_row_infop,
-    png_bytep));
+typedef PNG_CALLBACK(void, *png_user_transform_ptr,
+   (png_structp, png_row_infop, png_bytep));
 #endif
 
 #ifdef PNG_USER_CHUNKS_SUPPORTED
-typedef PNG_CALLBACK(int, *png_user_chunk_ptr, (png_structp,
-    png_unknown_chunkp));
+typedef PNG_CALLBACK(int, *png_user_chunk_ptr,
+   (png_structp, png_unknown_chunkp));
 #endif
 #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
 /* not used anywhere */
@@ -906,9 +911,10 @@ PNG_FUNCTION(void, (PNGCAPI *png_longjmp_ptr), (jmp_buf, int), typedef);
  * ignores the first argument) should be completely compatible with the
  * following.
  */
-typedef PNG_CALLBACK(png_voidp, *png_malloc_ptr, (png_structp,
-    png_alloc_size_t));
-typedef PNG_CALLBACK(void, *png_free_ptr, (png_structp, png_voidp));
+typedef PNG_CALLBACK(png_voidp, *png_malloc_ptr,
+   (png_structp, png_alloc_size_t));
+typedef PNG_CALLBACK(void, *png_free_ptr,
+   (png_structp, png_voidp));
 
 /* Section 4: exported functions
  * Here are the function definitions most commonly used.  This is not
@@ -940,20 +946,22 @@ typedef PNG_CALLBACK(void, *png_free_ptr, (png_structp, png_voidp));
  */
 
 /* Returns the version number of the library */
-PNG_EXPORT(1, png_uint_32, png_access_version_number, (void));
+PNG_EXPORT(1, png_uint_32, png_access_version_number,
+   (void));
 
 /* Tell lib we have already handled the first  magic bytes.
  * Handling more than 8 bytes from the beginning of the file is an error.
  */
-PNG_EXPORT(2, void, png_set_sig_bytes, (png_structrp png_ptr, int num_bytes));
+PNG_EXPORT(2, void, png_set_sig_bytes,
+   (png_structrp png_ptr, int num_bytes));
 
 /* Check sig[start] through sig[start + num_to_check - 1] to see if it's a
  * PNG file.  Returns zero if the supplied bytes match the 8-byte PNG
  * signature, and non-zero otherwise.  Having num_to_check == 0 or
  * start > 7 will always fail (i.e. return non-zero).
  */
-PNG_EXPORT(3, int, png_sig_cmp, (png_const_bytep sig, size_t start,
-    size_t num_to_check));
+PNG_EXPORT(3, int, png_sig_cmp,
+   (png_const_bytep sig, size_t start, size_t num_to_check));
 
 /* Simple signature checking function.  This is the same as calling
  * png_check_sig(sig, n) := (png_sig_cmp(sig, 0, n) == 0).
@@ -962,21 +970,21 @@ PNG_EXPORT(3, int, png_sig_cmp, (png_const_bytep sig, size_t start,
 
 /* Allocate and initialize png_ptr struct for reading, and any other memory. */
 PNG_EXPORTA(4, png_structp, png_create_read_struct,
-    (png_const_charp user_png_ver, png_voidp error_ptr,
-    png_error_ptr error_fn, png_error_ptr warn_fn),
-    PNG_ALLOCATED);
+   (png_const_charp user_png_ver,
+    png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn),
+   PNG_ALLOCATED);
 
 /* Allocate and initialize png_ptr struct for writing, and any other memory */
 PNG_EXPORTA(5, png_structp, png_create_write_struct,
-    (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn,
-    png_error_ptr warn_fn),
-    PNG_ALLOCATED);
+   (png_const_charp user_png_ver,
+    png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn),
+   PNG_ALLOCATED);
 
 PNG_EXPORT(6, size_t, png_get_compression_buffer_size,
-    (png_const_structrp png_ptr));
+   (png_const_structrp png_ptr));
 
-PNG_EXPORT(7, void, png_set_compression_buffer_size, (png_structrp png_ptr,
-    size_t size));
+PNG_EXPORT(7, void, png_set_compression_buffer_size,
+   (png_structrp png_ptr, size_t size));
 
 /* Moved from pngconf.h in 1.4.0 and modified to ensure setjmp/longjmp
  * match up.
@@ -989,8 +997,8 @@ PNG_EXPORT(7, void, png_set_compression_buffer_size, (png_structrp png_ptr,
  * allocated by the library - the call will return NULL on a mismatch
  * indicating an ABI mismatch.
  */
-PNG_EXPORT(8, jmp_buf*, png_set_longjmp_fn, (png_structrp png_ptr,
-    png_longjmp_ptr longjmp_fn, size_t jmp_buf_size));
+PNG_EXPORT(8, jmp_buf*, png_set_longjmp_fn,
+   (png_structrp png_ptr, png_longjmp_ptr longjmp_fn, size_t jmp_buf_size));
 #  define png_jmpbuf(png_ptr) \
       (*png_set_longjmp_fn((png_ptr), longjmp, (sizeof (jmp_buf))))
 #else
@@ -1002,67 +1010,77 @@ PNG_EXPORT(8, jmp_buf*, png_set_longjmp_fn, (png_structrp png_ptr,
  * will use it; otherwise it will call PNG_ABORT().  This function was
  * added in libpng-1.5.0.
  */
-PNG_EXPORTA(9, void, png_longjmp, (png_const_structrp png_ptr, int val),
-    PNG_NORETURN);
+PNG_EXPORTA(9, void, png_longjmp,
+   (png_const_structrp png_ptr, int val),
+   PNG_NORETURN);
 
 #ifdef PNG_READ_SUPPORTED
 /* Reset the compression stream */
-PNG_EXPORTA(10, int, png_reset_zstream, (png_structrp png_ptr), PNG_DEPRECATED);
+PNG_EXPORTA(10, int, png_reset_zstream,
+   (png_structrp png_ptr),
+   PNG_DEPRECATED);
 #endif
 
 /* New functions added in libpng-1.0.2 (not enabled by default until 1.2.0) */
 #ifdef PNG_USER_MEM_SUPPORTED
 PNG_EXPORTA(11, png_structp, png_create_read_struct_2,
-    (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn,
-    png_error_ptr warn_fn,
+   (png_const_charp user_png_ver,
+    png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn,
     png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn),
-    PNG_ALLOCATED);
+   PNG_ALLOCATED);
 PNG_EXPORTA(12, png_structp, png_create_write_struct_2,
-    (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn,
-    png_error_ptr warn_fn,
+   (png_const_charp user_png_ver,
+    png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn,
     png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn),
-    PNG_ALLOCATED);
+   PNG_ALLOCATED);
 #endif
 
 /* Write the PNG file signature. */
-PNG_EXPORT(13, void, png_write_sig, (png_structrp png_ptr));
+PNG_EXPORT(13, void, png_write_sig,
+   (png_structrp png_ptr));
 
 /* Write a PNG chunk - size, type, (optional) data, CRC. */
-PNG_EXPORT(14, void, png_write_chunk, (png_structrp png_ptr, png_const_bytep
-    chunk_name, png_const_bytep data, size_t length));
+PNG_EXPORT(14, void, png_write_chunk,
+   (png_structrp png_ptr,
+    png_const_bytep chunk_name, png_const_bytep data, size_t length));
 
 /* Write the start of a PNG chunk - length and chunk name. */
-PNG_EXPORT(15, void, png_write_chunk_start, (png_structrp png_ptr,
+PNG_EXPORT(15, void, png_write_chunk_start,
+   (png_structrp png_ptr,
     png_const_bytep chunk_name, png_uint_32 length));
 
 /* Write the data of a PNG chunk started with png_write_chunk_start(). */
-PNG_EXPORT(16, void, png_write_chunk_data, (png_structrp png_ptr,
+PNG_EXPORT(16, void, png_write_chunk_data,
+   (png_structrp png_ptr,
     png_const_bytep data, size_t length));
 
 /* Finish a chunk started with png_write_chunk_start() (includes CRC). */
-PNG_EXPORT(17, void, png_write_chunk_end, (png_structrp png_ptr));
+PNG_EXPORT(17, void, png_write_chunk_end,
+   (png_structrp png_ptr));
 
 /* Allocate and initialize the info structure */
-PNG_EXPORTA(18, png_infop, png_create_info_struct, (png_const_structrp png_ptr),
-    PNG_ALLOCATED);
+PNG_EXPORTA(18, png_infop, png_create_info_struct,
+   (png_const_structrp png_ptr),
+   PNG_ALLOCATED);
 
 /* DEPRECATED: this function allowed init structures to be created using the
  * default allocation method (typically malloc).  Use is deprecated in 1.6.0 and
  * the API will be removed in the future.
  */
-PNG_EXPORTA(19, void, png_info_init_3, (png_infopp info_ptr,
-    size_t png_info_struct_size), PNG_DEPRECATED);
+PNG_EXPORTA(19, void, png_info_init_3,
+   (png_infopp info_ptr, size_t png_info_struct_size),
+   PNG_DEPRECATED);
 
 /* Writes all the PNG information before the image. */
 PNG_EXPORT(20, void, png_write_info_before_PLTE,
-    (png_structrp png_ptr, png_const_inforp info_ptr));
+   (png_structrp png_ptr, png_const_inforp info_ptr));
 PNG_EXPORT(21, void, png_write_info,
-    (png_structrp png_ptr, png_const_inforp info_ptr));
+   (png_structrp png_ptr, png_const_inforp info_ptr));
 
 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
 /* Read the information before the actual image data. */
 PNG_EXPORT(22, void, png_read_info,
-    (png_structrp png_ptr, png_inforp info_ptr));
+   (png_structrp png_ptr, png_inforp info_ptr));
 #endif
 
 #ifdef PNG_TIME_RFC1123_SUPPORTED
@@ -1072,45 +1090,54 @@ PNG_EXPORT(22, void, png_read_info,
     */
 #if PNG_LIBPNG_VER < 10700
 /* To do: remove this from libpng17 (and from libpng17/png.c and pngstruct.h) */
-PNG_EXPORTA(23, png_const_charp, png_convert_to_rfc1123, (png_structrp png_ptr,
-    png_const_timep ptime),PNG_DEPRECATED);
+PNG_EXPORTA(23, png_const_charp, png_convert_to_rfc1123,
+   (png_structrp png_ptr, png_const_timep ptime),
+   PNG_DEPRECATED);
 #endif
-PNG_EXPORT(241, int, png_convert_to_rfc1123_buffer, (char out[29],
-    png_const_timep ptime));
+PNG_EXPORT(241, int, png_convert_to_rfc1123_buffer,
+   (char out[29], png_const_timep ptime));
 #endif
 
 #ifdef PNG_CONVERT_tIME_SUPPORTED
 /* Convert from a struct tm to png_time */
-PNG_EXPORT(24, void, png_convert_from_struct_tm, (png_timep ptime,
-    const struct tm * ttime));
+PNG_EXPORT(24, void, png_convert_from_struct_tm,
+   (png_timep ptime, const struct tm * ttime));
 
 /* Convert from time_t to png_time.  Uses gmtime() */
-PNG_EXPORT(25, void, png_convert_from_time_t, (png_timep ptime, time_t ttime));
+PNG_EXPORT(25, void, png_convert_from_time_t,
+   (png_timep ptime, time_t ttime));
 #endif /* CONVERT_tIME */
 
 #ifdef PNG_READ_EXPAND_SUPPORTED
 /* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */
-PNG_EXPORT(26, void, png_set_expand, (png_structrp png_ptr));
-PNG_EXPORT(27, void, png_set_expand_gray_1_2_4_to_8, (png_structrp png_ptr));
-PNG_EXPORT(28, void, png_set_palette_to_rgb, (png_structrp png_ptr));
-PNG_EXPORT(29, void, png_set_tRNS_to_alpha, (png_structrp png_ptr));
+PNG_EXPORT(26, void, png_set_expand,
+   (png_structrp png_ptr));
+PNG_EXPORT(27, void, png_set_expand_gray_1_2_4_to_8,
+   (png_structrp png_ptr));
+PNG_EXPORT(28, void, png_set_palette_to_rgb,
+   (png_structrp png_ptr));
+PNG_EXPORT(29, void, png_set_tRNS_to_alpha,
+   (png_structrp png_ptr));
 #endif
 
 #ifdef PNG_READ_EXPAND_16_SUPPORTED
 /* Expand to 16-bit channels, forces conversion of palette to RGB and expansion
  * of a tRNS chunk if present.
  */
-PNG_EXPORT(221, void, png_set_expand_16, (png_structrp png_ptr));
+PNG_EXPORT(221, void, png_set_expand_16,
+   (png_structrp png_ptr));
 #endif
 
 #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
 /* Use blue, green, red order for pixels. */
-PNG_EXPORT(30, void, png_set_bgr, (png_structrp png_ptr));
+PNG_EXPORT(30, void, png_set_bgr,
+   (png_structrp png_ptr));
 #endif
 
 #ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
 /* Expand the grayscale to 24-bit RGB if necessary. */
-PNG_EXPORT(31, void, png_set_gray_to_rgb, (png_structrp png_ptr));
+PNG_EXPORT(31, void, png_set_gray_to_rgb,
+   (png_structrp png_ptr));
 #endif
 
 #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
@@ -1120,18 +1147,20 @@ PNG_EXPORT(31, void, png_set_gray_to_rgb, (png_structrp png_ptr));
 #define PNG_ERROR_ACTION_ERROR 3
 #define PNG_RGB_TO_GRAY_DEFAULT (-1)/*for red/green coefficients*/
 
-PNG_FP_EXPORT(32, void, png_set_rgb_to_gray, (png_structrp png_ptr,
+PNG_FP_EXPORT(32, void, png_set_rgb_to_gray,
+   (png_structrp png_ptr,
     int error_action, double red, double green))
-PNG_FIXED_EXPORT(33, void, png_set_rgb_to_gray_fixed, (png_structrp png_ptr,
+PNG_FIXED_EXPORT(33, void, png_set_rgb_to_gray_fixed,
+   (png_structrp png_ptr,
     int error_action, png_fixed_point red, png_fixed_point green))
 
-PNG_EXPORT(34, png_byte, png_get_rgb_to_gray_status, (png_const_structrp
-    png_ptr));
+PNG_EXPORT(34, png_byte, png_get_rgb_to_gray_status,
+   (png_const_structrp png_ptr));
 #endif
 
 #ifdef PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED
-PNG_EXPORT(35, void, png_build_grayscale_palette, (int bit_depth,
-    png_colorp palette));
+PNG_EXPORT(35, void, png_build_grayscale_palette,
+   (int bit_depth, png_colorp palette));
 #endif
 
 #ifdef PNG_READ_ALPHA_MODE_SUPPORTED
@@ -1176,10 +1205,10 @@ PNG_EXPORT(35, void, png_build_grayscale_palette, (int bit_depth,
 #define PNG_ALPHA_OPTIMIZED     2 /* 'PNG' for opaque pixels, else 'STANDARD' */
 #define PNG_ALPHA_BROKEN        3 /* the alpha channel is gamma encoded */
 
-PNG_FP_EXPORT(227, void, png_set_alpha_mode, (png_structrp png_ptr, int mode,
-    double output_gamma))
-PNG_FIXED_EXPORT(228, void, png_set_alpha_mode_fixed, (png_structrp png_ptr,
-    int mode, png_fixed_point output_gamma))
+PNG_FP_EXPORT(227, void, png_set_alpha_mode,
+   (png_structrp png_ptr, int mode, double output_gamma))
+PNG_FIXED_EXPORT(228, void, png_set_alpha_mode_fixed,
+   (png_structrp png_ptr, int mode, png_fixed_point output_gamma))
 #endif
 
 #if defined(PNG_GAMMA_SUPPORTED) || defined(PNG_READ_ALPHA_MODE_SUPPORTED)
@@ -1269,51 +1298,57 @@ PNG_FIXED_EXPORT(228, void, png_set_alpha_mode_fixed, (png_structrp png_ptr,
  */
 
 #ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
-PNG_EXPORT(36, void, png_set_strip_alpha, (png_structrp png_ptr));
+PNG_EXPORT(36, void, png_set_strip_alpha,
+   (png_structrp png_ptr));
 #endif
 
 #if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \
     defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
-PNG_EXPORT(37, void, png_set_swap_alpha, (png_structrp png_ptr));
+PNG_EXPORT(37, void, png_set_swap_alpha,
+   (png_structrp png_ptr));
 #endif
 
 #if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \
     defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
-PNG_EXPORT(38, void, png_set_invert_alpha, (png_structrp png_ptr));
+PNG_EXPORT(38, void, png_set_invert_alpha,
+   (png_structrp png_ptr));
 #endif
 
 #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
 /* Add a filler byte to 8-bit or 16-bit Gray or 24-bit or 48-bit RGB images. */
-PNG_EXPORT(39, void, png_set_filler, (png_structrp png_ptr, png_uint_32 filler,
-    int flags));
+PNG_EXPORT(39, void, png_set_filler,
+   (png_structrp png_ptr, png_uint_32 filler, int flags));
 /* The values of the PNG_FILLER_ defines should NOT be changed */
 #  define PNG_FILLER_BEFORE 0
 #  define PNG_FILLER_AFTER 1
 /* Add an alpha byte to 8-bit or 16-bit Gray or 24-bit or 48-bit RGB images. */
-PNG_EXPORT(40, void, png_set_add_alpha, (png_structrp png_ptr,
-    png_uint_32 filler, int flags));
+PNG_EXPORT(40, void, png_set_add_alpha,
+   (png_structrp png_ptr, png_uint_32 filler, int flags));
 #endif /* READ_FILLER || WRITE_FILLER */
 
 #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
 /* Swap bytes in 16-bit depth files. */
-PNG_EXPORT(41, void, png_set_swap, (png_structrp png_ptr));
+PNG_EXPORT(41, void, png_set_swap,
+   (png_structrp png_ptr));
 #endif
 
 #if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
 /* Use 1 byte per pixel in 1, 2, or 4-bit depth files. */
-PNG_EXPORT(42, void, png_set_packing, (png_structrp png_ptr));
+PNG_EXPORT(42, void, png_set_packing,
+   (png_structrp png_ptr));
 #endif
 
 #if defined(PNG_READ_PACKSWAP_SUPPORTED) || \
     defined(PNG_WRITE_PACKSWAP_SUPPORTED)
 /* Swap packing order of pixels in bytes. */
-PNG_EXPORT(43, void, png_set_packswap, (png_structrp png_ptr));
+PNG_EXPORT(43, void, png_set_packswap,
+   (png_structrp png_ptr));
 #endif
 
 #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
 /* Converts files to legal bit depths. */
-PNG_EXPORT(44, void, png_set_shift, (png_structrp png_ptr, png_const_color_8p
-    true_bits));
+PNG_EXPORT(44, void, png_set_shift,
+   (png_structrp png_ptr, png_const_color_8p true_bits));
 #endif
 
 #if defined(PNG_READ_INTERLACING_SUPPORTED) || \
@@ -1324,12 +1359,14 @@ PNG_EXPORT(44, void, png_set_shift, (png_structrp png_ptr, png_const_color_8p
  * necessary to call png_read_row or png_read_rows png_get_image_height
  * times for each pass.
 */
-PNG_EXPORT(45, int, png_set_interlace_handling, (png_structrp png_ptr));
+PNG_EXPORT(45, int, png_set_interlace_handling,
+   (png_structrp png_ptr));
 #endif
 
 #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
 /* Invert monochrome files */
-PNG_EXPORT(46, void, png_set_invert_mono, (png_structrp png_ptr));
+PNG_EXPORT(46, void, png_set_invert_mono,
+   (png_structrp png_ptr));
 #endif
 
 #ifdef PNG_READ_BACKGROUND_SUPPORTED
@@ -1338,10 +1375,12 @@ PNG_EXPORT(46, void, png_set_invert_mono, (png_structrp png_ptr));
  * read.  Doing so will result in unexpected behavior and possible warnings or
  * errors if the PNG file contains a bKGD chunk.
  */
-PNG_FP_EXPORT(47, void, png_set_background, (png_structrp png_ptr,
+PNG_FP_EXPORT(47, void, png_set_background,
+   (png_structrp png_ptr,
     png_const_color_16p background_color, int background_gamma_code,
     int need_expand, double background_gamma))
-PNG_FIXED_EXPORT(215, void, png_set_background_fixed, (png_structrp png_ptr,
+PNG_FIXED_EXPORT(215, void, png_set_background_fixed,
+   (png_structrp png_ptr,
     png_const_color_16p background_color, int background_gamma_code,
     int need_expand, png_fixed_point background_gamma))
 #endif
@@ -1354,20 +1393,23 @@ PNG_FIXED_EXPORT(215, void, png_set_background_fixed, (png_structrp png_ptr,
 
 #ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
 /* Scale a 16-bit depth file down to 8-bit, accurately. */
-PNG_EXPORT(229, void, png_set_scale_16, (png_structrp png_ptr));
+PNG_EXPORT(229, void, png_set_scale_16,
+   (png_structrp png_ptr));
 #endif
 
 #ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
 #define PNG_READ_16_TO_8_SUPPORTED /* Name prior to 1.5.4 */
 /* Strip the second byte of information from a 16-bit depth file. */
-PNG_EXPORT(48, void, png_set_strip_16, (png_structrp png_ptr));
+PNG_EXPORT(48, void, png_set_strip_16,
+   (png_structrp png_ptr));
 #endif
 
 #ifdef PNG_READ_QUANTIZE_SUPPORTED
 /* Turn on quantizing, and reduce the palette to the number of colors
  * available.
  */
-PNG_EXPORT(49, void, png_set_quantize, (png_structrp png_ptr,
+PNG_EXPORT(49, void, png_set_quantize,
+   (png_structrp png_ptr,
     png_colorp palette, int num_palette, int maximum_colors,
     png_const_uint_16p histogram, int full_quantize));
 #endif
@@ -1389,82 +1431,92 @@ PNG_EXPORT(49, void, png_set_quantize, (png_structrp png_ptr,
  * API (floating point or fixed.)  Notice, however, that the 'file_gamma' value
  * is the inverse of a 'screen gamma' value.
  */
-PNG_FP_EXPORT(50, void, png_set_gamma, (png_structrp png_ptr,
+PNG_FP_EXPORT(50, void, png_set_gamma,
+   (png_structrp png_ptr,
     double screen_gamma, double override_file_gamma))
-PNG_FIXED_EXPORT(208, void, png_set_gamma_fixed, (png_structrp png_ptr,
+PNG_FIXED_EXPORT(208, void, png_set_gamma_fixed,
+   (png_structrp png_ptr,
     png_fixed_point screen_gamma, png_fixed_point override_file_gamma))
 #endif
 
 #ifdef PNG_WRITE_FLUSH_SUPPORTED
 /* Set how many lines between output flushes - 0 for no flushing */
-PNG_EXPORT(51, void, png_set_flush, (png_structrp png_ptr, int nrows));
+PNG_EXPORT(51, void, png_set_flush,
+   (png_structrp png_ptr, int nrows));
 /* Flush the current PNG output buffer */
-PNG_EXPORT(52, void, png_write_flush, (png_structrp png_ptr));
+PNG_EXPORT(52, void, png_write_flush,
+   (png_structrp png_ptr));
 #endif
 
 /* Optional update palette with requested transformations */
-PNG_EXPORT(53, void, png_start_read_image, (png_structrp png_ptr));
+PNG_EXPORT(53, void, png_start_read_image,
+   (png_structrp png_ptr));
 
 /* Optional call to update the users info structure */
-PNG_EXPORT(54, void, png_read_update_info, (png_structrp png_ptr,
-    png_inforp info_ptr));
+PNG_EXPORT(54, void, png_read_update_info,
+   (png_structrp png_ptr, png_inforp info_ptr));
 
 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
 /* Read one or more rows of image data. */
-PNG_EXPORT(55, void, png_read_rows, (png_structrp png_ptr, png_bytepp row,
+PNG_EXPORT(55, void, png_read_rows,
+   (png_structrp png_ptr, png_bytepp row,
     png_bytepp display_row, png_uint_32 num_rows));
 #endif
 
 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
 /* Read a row of data. */
-PNG_EXPORT(56, void, png_read_row, (png_structrp png_ptr, png_bytep row,
-    png_bytep display_row));
+PNG_EXPORT(56, void, png_read_row,
+   (png_structrp png_ptr, png_bytep row, png_bytep display_row));
 #endif
 
 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
 /* Read the whole image into memory at once. */
-PNG_EXPORT(57, void, png_read_image, (png_structrp png_ptr, png_bytepp image));
+PNG_EXPORT(57, void, png_read_image,
+   (png_structrp png_ptr, png_bytepp image));
 #endif
 
 /* Write a row of image data */
-PNG_EXPORT(58, void, png_write_row, (png_structrp png_ptr,
-    png_const_bytep row));
+PNG_EXPORT(58, void, png_write_row,
+   (png_structrp png_ptr, png_const_bytep row));
 
 /* Write a few rows of image data: (*row) is not written; however, the type
  * is declared as writeable to maintain compatibility with previous versions
  * of libpng and to allow the 'display_row' array from read_rows to be passed
  * unchanged to write_rows.
  */
-PNG_EXPORT(59, void, png_write_rows, (png_structrp png_ptr, png_bytepp row,
-    png_uint_32 num_rows));
+PNG_EXPORT(59, void, png_write_rows,
+   (png_structrp png_ptr, png_bytepp row, png_uint_32 num_rows));
 
 /* Write the image data */
-PNG_EXPORT(60, void, png_write_image, (png_structrp png_ptr, png_bytepp image));
+PNG_EXPORT(60, void, png_write_image,
+   (png_structrp png_ptr, png_bytepp image));
 
 /* Write the end of the PNG file. */
-PNG_EXPORT(61, void, png_write_end, (png_structrp png_ptr,
-    png_inforp info_ptr));
+PNG_EXPORT(61, void, png_write_end,
+   (png_structrp png_ptr, png_inforp info_ptr));
 
 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
 /* Read the end of the PNG file. */
-PNG_EXPORT(62, void, png_read_end, (png_structrp png_ptr, png_inforp info_ptr));
+PNG_EXPORT(62, void, png_read_end,
+   (png_structrp png_ptr, png_inforp info_ptr));
 #endif
 
 /* Free any memory associated with the png_info_struct */
-PNG_EXPORT(63, void, png_destroy_info_struct, (png_const_structrp png_ptr,
-    png_infopp info_ptr_ptr));
+PNG_EXPORT(63, void, png_destroy_info_struct,
+   (png_const_structrp png_ptr, png_infopp info_ptr_ptr));
 
 /* Free any memory associated with the png_struct and the png_info_structs */
-PNG_EXPORT(64, void, png_destroy_read_struct, (png_structpp png_ptr_ptr,
+PNG_EXPORT(64, void, png_destroy_read_struct,
+   (png_structpp png_ptr_ptr,
     png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr));
 
 /* Free any memory associated with the png_struct and the png_info_structs */
-PNG_EXPORT(65, void, png_destroy_write_struct, (png_structpp png_ptr_ptr,
-    png_infopp info_ptr_ptr));
+PNG_EXPORT(65, void, png_destroy_write_struct,
+   (png_structpp png_ptr_ptr, png_infopp info_ptr_ptr));
 
 /* Set the libpng method of handling chunk CRC errors */
-PNG_EXPORT(66, void, png_set_crc_action, (png_structrp png_ptr, int crit_action,
-    int ancil_action));
+PNG_EXPORT(66, void, png_set_crc_action,
+   (png_structrp png_ptr, int crit_action, int ancil_action));
 
 /* Values for png_set_crc_action() say how to handle CRC errors in
  * ancillary and critical chunks, and whether to use the data contained
@@ -1494,8 +1546,8 @@ PNG_EXPORT(66, void, png_set_crc_action, (png_structrp png_ptr, int crit_action,
 /* Set the filtering method(s) used by libpng.  Currently, the only valid
  * value for "method" is 0.
  */
-PNG_EXPORT(67, void, png_set_filter, (png_structrp png_ptr, int method,
-    int filters));
+PNG_EXPORT(67, void, png_set_filter,
+   (png_structrp png_ptr, int method, int filters));
 #endif /* WRITE */
 
 /* Flags for png_set_filter() to say which filters to use.  The flags
@@ -1524,11 +1576,14 @@ PNG_EXPORT(67, void, png_set_filter, (png_structrp png_ptr, int method,
 
 #ifdef PNG_WRITE_SUPPORTED
 #ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* DEPRECATED */
-PNG_FP_EXPORT(68, void, png_set_filter_heuristics, (png_structrp png_ptr,
-    int heuristic_method, int num_weights, png_const_doublep filter_weights,
+PNG_FP_EXPORT(68, void, png_set_filter_heuristics,
+   (png_structrp png_ptr,
+    int heuristic_method, int num_weights,
+    png_const_doublep filter_weights,
     png_const_doublep filter_costs))
 PNG_FIXED_EXPORT(209, void, png_set_filter_heuristics_fixed,
-    (png_structrp png_ptr, int heuristic_method, int num_weights,
+   (png_structrp png_ptr,
+    int heuristic_method, int num_weights,
     png_const_fixed_point_p filter_weights,
     png_const_fixed_point_p filter_costs))
 #endif /* WRITE_WEIGHTED_FILTER */
@@ -1547,44 +1602,44 @@ PNG_FIXED_EXPORT(209, void, png_set_filter_heuristics_fixed,
  * these values may not correspond directly to the zlib compression levels.
  */
 #ifdef PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED
-PNG_EXPORT(69, void, png_set_compression_level, (png_structrp png_ptr,
-    int level));
+PNG_EXPORT(69, void, png_set_compression_level,
+   (png_structrp png_ptr, int level));
 
-PNG_EXPORT(70, void, png_set_compression_mem_level, (png_structrp png_ptr,
-    int mem_level));
+PNG_EXPORT(70, void, png_set_compression_mem_level,
+   (png_structrp png_ptr, int mem_level));
 
-PNG_EXPORT(71, void, png_set_compression_strategy, (png_structrp png_ptr,
-    int strategy));
+PNG_EXPORT(71, void, png_set_compression_strategy,
+   (png_structrp png_ptr, int strategy));
 
 /* If PNG_WRITE_OPTIMIZE_CMF_SUPPORTED is defined, libpng will use a
  * smaller value of window_bits if it can do so safely.
  */
-PNG_EXPORT(72, void, png_set_compression_window_bits, (png_structrp png_ptr,
-    int window_bits));
+PNG_EXPORT(72, void, png_set_compression_window_bits,
+   (png_structrp png_ptr, int window_bits));
 
-PNG_EXPORT(73, void, png_set_compression_method, (png_structrp png_ptr,
-    int method));
+PNG_EXPORT(73, void, png_set_compression_method,
+   (png_structrp png_ptr, int method));
 #endif /* WRITE_CUSTOMIZE_COMPRESSION */
 
 #ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
 /* Also set zlib parameters for compressing non-IDAT chunks */
-PNG_EXPORT(222, void, png_set_text_compression_level, (png_structrp png_ptr,
-    int level));
+PNG_EXPORT(222, void, png_set_text_compression_level,
+   (png_structrp png_ptr, int level));
 
-PNG_EXPORT(223, void, png_set_text_compression_mem_level, (png_structrp png_ptr,
-    int mem_level));
+PNG_EXPORT(223, void, png_set_text_compression_mem_level,
+   (png_structrp png_ptr, int mem_level));
 
-PNG_EXPORT(224, void, png_set_text_compression_strategy, (png_structrp png_ptr,
-    int strategy));
+PNG_EXPORT(224, void, png_set_text_compression_strategy,
+   (png_structrp png_ptr, int strategy));
 
 /* If PNG_WRITE_OPTIMIZE_CMF_SUPPORTED is defined, libpng will use a
  * smaller value of window_bits if it can do so safely.
  */
 PNG_EXPORT(225, void, png_set_text_compression_window_bits,
-    (png_structrp png_ptr, int window_bits));
+   (png_structrp png_ptr, int window_bits));
 
-PNG_EXPORT(226, void, png_set_text_compression_method, (png_structrp png_ptr,
-    int method));
+PNG_EXPORT(226, void, png_set_text_compression_method,
+   (png_structrp png_ptr, int method));
 #endif /* WRITE_CUSTOMIZE_ZTXT_COMPRESSION */
 #endif /* WRITE */
 
@@ -1599,7 +1654,8 @@ PNG_EXPORT(226, void, png_set_text_compression_method, (png_structrp png_ptr,
 
 #ifdef PNG_STDIO_SUPPORTED
 /* Initialize the input/output for the PNG file to the default functions. */
-PNG_EXPORT(74, void, png_init_io, (png_structrp png_ptr, FILE *fp));
+PNG_EXPORT(74, void, png_init_io,
+   (png_structrp png_ptr, FILE *fp));
 #endif
 
 /* Replace the (error and abort), and warning functions with user
@@ -1610,11 +1666,13 @@ PNG_EXPORT(74, void, png_init_io, (png_structrp png_ptr, FILE *fp));
  * default function will be used.
  */
 
-PNG_EXPORT(75, void, png_set_error_fn, (png_structrp png_ptr,
+PNG_EXPORT(75, void, png_set_error_fn,
+   (png_structrp png_ptr,
     png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn));
 
 /* Return the user pointer associated with the error functions */
-PNG_EXPORT(76, png_voidp, png_get_error_ptr, (png_const_structrp png_ptr));
+PNG_EXPORT(76, png_voidp, png_get_error_ptr,
+   (png_const_structrp png_ptr));
 
 /* Replace the default data output functions with a user supplied one(s).
  * If buffered output is not used, then output_flush_fn can be set to NULL.
@@ -1626,47 +1684,54 @@ PNG_EXPORT(76, png_voidp, png_get_error_ptr, (png_const_structrp png_ptr));
  * default flush function, which uses the standard *FILE structure, will
  * be used.
  */
-PNG_EXPORT(77, void, png_set_write_fn, (png_structrp png_ptr, png_voidp io_ptr,
+PNG_EXPORT(77, void, png_set_write_fn,
+   (png_structrp png_ptr,
+    png_voidp io_ptr,
     png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn));
 
 /* Replace the default data input function with a user supplied one. */
-PNG_EXPORT(78, void, png_set_read_fn, (png_structrp png_ptr, png_voidp io_ptr,
-    png_rw_ptr read_data_fn));
+PNG_EXPORT(78, void, png_set_read_fn,
+   (png_structrp png_ptr,
+    png_voidp io_ptr, png_rw_ptr read_data_fn));
 
 /* Return the user pointer associated with the I/O functions */
-PNG_EXPORT(79, png_voidp, png_get_io_ptr, (png_const_structrp png_ptr));
+PNG_EXPORT(79, png_voidp, png_get_io_ptr,
+   (png_const_structrp png_ptr));
 
-PNG_EXPORT(80, void, png_set_read_status_fn, (png_structrp png_ptr,
-    png_read_status_ptr read_row_fn));
+PNG_EXPORT(80, void, png_set_read_status_fn,
+   (png_structrp png_ptr, png_read_status_ptr read_row_fn));
 
-PNG_EXPORT(81, void, png_set_write_status_fn, (png_structrp png_ptr,
-    png_write_status_ptr write_row_fn));
+PNG_EXPORT(81, void, png_set_write_status_fn,
+   (png_structrp png_ptr, png_write_status_ptr write_row_fn));
 
 #ifdef PNG_USER_MEM_SUPPORTED
 /* Replace the default memory allocation functions with user supplied one(s). */
-PNG_EXPORT(82, void, png_set_mem_fn, (png_structrp png_ptr, png_voidp mem_ptr,
-    png_malloc_ptr malloc_fn, png_free_ptr free_fn));
+PNG_EXPORT(82, void, png_set_mem_fn,
+   (png_structrp png_ptr,
+    png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn));
 /* Return the user pointer associated with the memory functions */
-PNG_EXPORT(83, png_voidp, png_get_mem_ptr, (png_const_structrp png_ptr));
+PNG_EXPORT(83, png_voidp, png_get_mem_ptr,
+   (png_const_structrp png_ptr));
 #endif
 
 #ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
-PNG_EXPORT(84, void, png_set_read_user_transform_fn, (png_structrp png_ptr,
-    png_user_transform_ptr read_user_transform_fn));
+PNG_EXPORT(84, void, png_set_read_user_transform_fn,
+   (png_structrp png_ptr, png_user_transform_ptr read_user_transform_fn));
 #endif
 
 #ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
-PNG_EXPORT(85, void, png_set_write_user_transform_fn, (png_structrp png_ptr,
-    png_user_transform_ptr write_user_transform_fn));
+PNG_EXPORT(85, void, png_set_write_user_transform_fn,
+   (png_structrp png_ptr, png_user_transform_ptr write_user_transform_fn));
 #endif
 
 #ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
-PNG_EXPORT(86, void, png_set_user_transform_info, (png_structrp png_ptr,
-    png_voidp user_transform_ptr, int user_transform_depth,
-    int user_transform_channels));
+PNG_EXPORT(86, void, png_set_user_transform_info,
+   (png_structrp png_ptr,
+    png_voidp user_transform_ptr,
+    int user_transform_depth, int user_transform_channels));
 /* Return the user pointer associated with the user transform functions */
 PNG_EXPORT(87, png_voidp, png_get_user_transform_ptr,
-    (png_const_structrp png_ptr));
+   (png_const_structrp png_ptr));
 #endif
 
 #ifdef PNG_USER_TRANSFORM_INFO_SUPPORTED
@@ -1681,8 +1746,10 @@ PNG_EXPORT(87, png_voidp, png_get_user_transform_ptr,
  * find the output pixel (x,y) given an interlaced sub-image pixel
  * (row,col,pass).  (See below for these macros.)
  */
-PNG_EXPORT(217, png_uint_32, png_get_current_row_number, (png_const_structrp));
-PNG_EXPORT(218, png_byte, png_get_current_pass_number, (png_const_structrp));
+PNG_EXPORT(217, png_uint_32, png_get_current_row_number,
+   (png_const_structrp));
+PNG_EXPORT(218, png_byte, png_get_current_pass_number,
+   (png_const_structrp));
 #endif
 
 #ifdef PNG_READ_USER_CHUNKS_SUPPORTED
@@ -1705,28 +1772,32 @@ PNG_EXPORT(218, png_byte, png_get_current_pass_number, (png_const_structrp));
  * See "INTERACTION WITH USER CHUNK CALLBACKS" below for important notes about
  * how this behavior will change in libpng 1.7
  */
-PNG_EXPORT(88, void, png_set_read_user_chunk_fn, (png_structrp png_ptr,
+PNG_EXPORT(88, void, png_set_read_user_chunk_fn,
+   (png_structrp png_ptr,
     png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn));
 #endif
 
 #ifdef PNG_USER_CHUNKS_SUPPORTED
-PNG_EXPORT(89, png_voidp, png_get_user_chunk_ptr, (png_const_structrp png_ptr));
+PNG_EXPORT(89, png_voidp, png_get_user_chunk_ptr,
+   (png_const_structrp png_ptr));
 #endif
 
 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
 /* Sets the function callbacks for the push reader, and a pointer to a
  * user-defined structure available to the callback functions.
  */
-PNG_EXPORT(90, void, png_set_progressive_read_fn, (png_structrp png_ptr,
+PNG_EXPORT(90, void, png_set_progressive_read_fn,
+   (png_structrp png_ptr,
     png_voidp progressive_ptr, png_progressive_info_ptr info_fn,
     png_progressive_row_ptr row_fn, png_progressive_end_ptr end_fn));
 
 /* Returns the user pointer associated with the push read functions */
 PNG_EXPORT(91, png_voidp, png_get_progressive_ptr,
-    (png_const_structrp png_ptr));
+   (png_const_structrp png_ptr));
 
 /* Function to be called when data becomes available */
-PNG_EXPORT(92, void, png_process_data, (png_structrp png_ptr,
+PNG_EXPORT(92, void, png_process_data,
+   (png_structrp png_ptr,
     png_inforp info_ptr, png_bytep buffer, size_t buffer_size));
 
 /* A function which may be called *only* within png_process_data to stop the
@@ -1736,7 +1807,8 @@ PNG_EXPORT(92, void, png_process_data, (png_structrp png_ptr,
  * 'save' is set to true the routine will first save all the pending data and
  * will always return 0.
  */
-PNG_EXPORT(219, size_t, png_process_data_pause, (png_structrp, int save));
+PNG_EXPORT(219, size_t, png_process_data_pause,
+   (png_structrp, int save));
 
 /* A function which may be called *only* outside (after) a call to
  * png_process_data.  It returns the number of bytes of data to skip in the
@@ -1744,45 +1816,53 @@ PNG_EXPORT(219, size_t, png_process_data_pause, (png_structrp, int save));
  * application must skip than number of bytes of input data and pass the
  * following data to the next call to png_process_data.
  */
-PNG_EXPORT(220, png_uint_32, png_process_data_skip, (png_structrp));
+PNG_EXPORT(220, png_uint_32, png_process_data_skip,
+   (png_structrp));
 
 /* Function that combines rows.  'new_row' is a flag that should come from
  * the callback and be non-NULL if anything needs to be done; the library
  * stores its own version of the new data internally and ignores the passed
  * in value.
  */
-PNG_EXPORT(93, void, png_progressive_combine_row, (png_const_structrp png_ptr,
+PNG_EXPORT(93, void, png_progressive_combine_row,
+   (png_const_structrp png_ptr,
     png_bytep old_row, png_const_bytep new_row));
 #endif /* PROGRESSIVE_READ */
 
-PNG_EXPORTA(94, png_voidp, png_malloc, (png_const_structrp png_ptr,
-    png_alloc_size_t size), PNG_ALLOCATED);
+PNG_EXPORTA(94, png_voidp, png_malloc,
+   (png_const_structrp png_ptr, png_alloc_size_t size),
+   PNG_ALLOCATED);
 /* Added at libpng version 1.4.0 */
-PNG_EXPORTA(95, png_voidp, png_calloc, (png_const_structrp png_ptr,
-    png_alloc_size_t size), PNG_ALLOCATED);
+PNG_EXPORTA(95, png_voidp, png_calloc,
+   (png_const_structrp png_ptr, png_alloc_size_t size),
+   PNG_ALLOCATED);
 
 /* Added at libpng version 1.2.4 */
-PNG_EXPORTA(96, png_voidp, png_malloc_warn, (png_const_structrp png_ptr,
-    png_alloc_size_t size), PNG_ALLOCATED);
+PNG_EXPORTA(96, png_voidp, png_malloc_warn,
+   (png_const_structrp png_ptr, png_alloc_size_t size),
+   PNG_ALLOCATED);
 
 /* Frees a pointer allocated by png_malloc() */
-PNG_EXPORT(97, void, png_free, (png_const_structrp png_ptr, png_voidp ptr));
+PNG_EXPORT(97, void, png_free,
+   (png_const_structrp png_ptr, png_voidp ptr));
 
 /* Free data that was allocated internally */
-PNG_EXPORT(98, void, png_free_data, (png_const_structrp png_ptr,
-    png_inforp info_ptr, png_uint_32 free_me, int num));
+PNG_EXPORT(98, void, png_free_data,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    png_uint_32 free_me, int num));
 
 /* Reassign the responsibility for freeing existing data, whether allocated
  * by libpng or by the application; this works on the png_info structure passed
  * in, without changing the state for other png_info structures.
  */
-PNG_EXPORT(99, void, png_data_freer, (png_const_structrp png_ptr,
-    png_inforp info_ptr, int freer, png_uint_32 mask));
+PNG_EXPORT(99, void, png_data_freer,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    int freer, png_uint_32 mask));
 
 /* Assignments for png_data_freer */
 #define PNG_DESTROY_WILL_FREE_DATA 1
-#define PNG_SET_WILL_FREE_DATA 1
-#define PNG_USER_WILL_FREE_DATA 2
+#define PNG_SET_WILL_FREE_DATA     1
+#define PNG_USER_WILL_FREE_DATA    2
 /* Flags for png_ptr->free_me and info_ptr->free_me */
 #define PNG_FREE_HIST 0x0008U
 #define PNG_FREE_ICCP 0x0010U
@@ -1802,36 +1882,42 @@ PNG_EXPORT(99, void, png_data_freer, (png_const_structrp png_ptr,
 #define PNG_FREE_MUL  0x4220U /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */
 
 #ifdef PNG_USER_MEM_SUPPORTED
-PNG_EXPORTA(100, png_voidp, png_malloc_default, (png_const_structrp png_ptr,
-    png_alloc_size_t size), PNG_ALLOCATED PNG_DEPRECATED);
-PNG_EXPORTA(101, void, png_free_default, (png_const_structrp png_ptr,
-    png_voidp ptr), PNG_DEPRECATED);
+PNG_EXPORTA(100, png_voidp, png_malloc_default,
+   (png_const_structrp png_ptr, png_alloc_size_t size),
+   PNG_ALLOCATED PNG_DEPRECATED);
+PNG_EXPORTA(101, void, png_free_default,
+   (png_const_structrp png_ptr, png_voidp ptr),
+   PNG_DEPRECATED);
 #endif
 
 #ifdef PNG_ERROR_TEXT_SUPPORTED
 /* Fatal error in PNG image of libpng - can't continue */
-PNG_EXPORTA(102, void, png_error, (png_const_structrp png_ptr,
-    png_const_charp error_message), PNG_NORETURN);
+PNG_EXPORTA(102, void, png_error,
+   (png_const_structrp png_ptr, png_const_charp error_message),
+   PNG_NORETURN);
 
 /* The same, but the chunk name is prepended to the error string. */
-PNG_EXPORTA(103, void, png_chunk_error, (png_const_structrp png_ptr,
-    png_const_charp error_message), PNG_NORETURN);
+PNG_EXPORTA(103, void, png_chunk_error,
+   (png_const_structrp png_ptr, png_const_charp error_message),
+   PNG_NORETURN);
 
 #else
 /* Fatal error in PNG image of libpng - can't continue */
-PNG_EXPORTA(104, void, png_err, (png_const_structrp png_ptr), PNG_NORETURN);
+PNG_EXPORTA(104, void, png_err,
+   (png_const_structrp png_ptr),
+   PNG_NORETURN);
 #  define png_error(s1,s2) png_err(s1)
 #  define png_chunk_error(s1,s2) png_err(s1)
 #endif
 
 #ifdef PNG_WARNINGS_SUPPORTED
 /* Non-fatal error in libpng.  Can continue, but may have a problem. */
-PNG_EXPORT(105, void, png_warning, (png_const_structrp png_ptr,
-    png_const_charp warning_message));
+PNG_EXPORT(105, void, png_warning,
+   (png_const_structrp png_ptr, png_const_charp warning_message));
 
 /* Non-fatal error in libpng, chunk name is prepended to message. */
-PNG_EXPORT(106, void, png_chunk_warning, (png_const_structrp png_ptr,
-    png_const_charp warning_message));
+PNG_EXPORT(106, void, png_chunk_warning,
+   (png_const_structrp png_ptr, png_const_charp warning_message));
 #else
 #  define png_warning(s1,s2) ((void)(s1))
 #  define png_chunk_warning(s1,s2) ((void)(s1))
@@ -1840,17 +1926,17 @@ PNG_EXPORT(106, void, png_chunk_warning, (png_const_structrp png_ptr,
 #ifdef PNG_BENIGN_ERRORS_SUPPORTED
 /* Benign error in libpng.  Can continue, but may have a problem.
  * User can choose whether to handle as a fatal error or as a warning. */
-PNG_EXPORT(107, void, png_benign_error, (png_const_structrp png_ptr,
-    png_const_charp warning_message));
+PNG_EXPORT(107, void, png_benign_error,
+   (png_const_structrp png_ptr, png_const_charp warning_message));
 
 #ifdef PNG_READ_SUPPORTED
 /* Same, chunk name is prepended to message (only during read) */
-PNG_EXPORT(108, void, png_chunk_benign_error, (png_const_structrp png_ptr,
-    png_const_charp warning_message));
+PNG_EXPORT(108, void, png_chunk_benign_error,
+   (png_const_structrp png_ptr, png_const_charp warning_message));
 #endif
 
 PNG_EXPORT(109, void, png_set_benign_errors,
-    (png_structrp png_ptr, int allowed));
+   (png_structrp png_ptr, int allowed));
 #else
 #  ifdef PNG_ALLOW_BENIGN_ERRORS
 #    define png_benign_error png_warning
@@ -1874,169 +1960,181 @@ PNG_EXPORT(109, void, png_set_benign_errors,
  * png_info_struct.
  */
 /* Returns "flag" if chunk data is valid in info_ptr. */
-PNG_EXPORT(110, png_uint_32, png_get_valid, (png_const_structrp png_ptr,
-    png_const_inforp info_ptr, png_uint_32 flag));
+PNG_EXPORT(110, png_uint_32, png_get_valid,
+   (png_const_structrp png_ptr, png_const_inforp info_ptr, png_uint_32 flag));
 
 /* Returns number of bytes needed to hold a transformed row. */
-PNG_EXPORT(111, size_t, png_get_rowbytes, (png_const_structrp png_ptr,
-    png_const_inforp info_ptr));
+PNG_EXPORT(111, size_t, png_get_rowbytes,
+   (png_const_structrp png_ptr, png_const_inforp info_ptr));
 
 #ifdef PNG_INFO_IMAGE_SUPPORTED
 /* Returns row_pointers, which is an array of pointers to scanlines that was
  * returned from png_read_png().
  */
-PNG_EXPORT(112, png_bytepp, png_get_rows, (png_const_structrp png_ptr,
-    png_const_inforp info_ptr));
+PNG_EXPORT(112, png_bytepp, png_get_rows,
+   (png_const_structrp png_ptr, png_const_inforp info_ptr));
 
 /* Set row_pointers, which is an array of pointers to scanlines for use
  * by png_write_png().
  */
-PNG_EXPORT(113, void, png_set_rows, (png_const_structrp png_ptr,
-    png_inforp info_ptr, png_bytepp row_pointers));
+PNG_EXPORT(113, void, png_set_rows,
+   (png_const_structrp png_ptr, png_inforp info_ptr, png_bytepp row_pointers));
 #endif
 
 /* Returns number of color channels in image. */
-PNG_EXPORT(114, png_byte, png_get_channels, (png_const_structrp png_ptr,
-    png_const_inforp info_ptr));
+PNG_EXPORT(114, png_byte, png_get_channels,
+   (png_const_structrp png_ptr, png_const_inforp info_ptr));
 
 #ifdef PNG_EASY_ACCESS_SUPPORTED
 /* Returns image width in pixels. */
-PNG_EXPORT(115, png_uint_32, png_get_image_width, (png_const_structrp png_ptr,
-    png_const_inforp info_ptr));
+PNG_EXPORT(115, png_uint_32, png_get_image_width,
+   (png_const_structrp png_ptr, png_const_inforp info_ptr));
 
 /* Returns image height in pixels. */
-PNG_EXPORT(116, png_uint_32, png_get_image_height, (png_const_structrp png_ptr,
-    png_const_inforp info_ptr));
+PNG_EXPORT(116, png_uint_32, png_get_image_height,
+   (png_const_structrp png_ptr, png_const_inforp info_ptr));
 
 /* Returns image bit_depth. */
-PNG_EXPORT(117, png_byte, png_get_bit_depth, (png_const_structrp png_ptr,
-    png_const_inforp info_ptr));
+PNG_EXPORT(117, png_byte, png_get_bit_depth,
+   (png_const_structrp png_ptr, png_const_inforp info_ptr));
 
 /* Returns image color_type. */
-PNG_EXPORT(118, png_byte, png_get_color_type, (png_const_structrp png_ptr,
-    png_const_inforp info_ptr));
+PNG_EXPORT(118, png_byte, png_get_color_type,
+   (png_const_structrp png_ptr, png_const_inforp info_ptr));
 
 /* Returns image filter_type. */
-PNG_EXPORT(119, png_byte, png_get_filter_type, (png_const_structrp png_ptr,
-    png_const_inforp info_ptr));
+PNG_EXPORT(119, png_byte, png_get_filter_type,
+   (png_const_structrp png_ptr, png_const_inforp info_ptr));
 
 /* Returns image interlace_type. */
-PNG_EXPORT(120, png_byte, png_get_interlace_type, (png_const_structrp png_ptr,
-    png_const_inforp info_ptr));
+PNG_EXPORT(120, png_byte, png_get_interlace_type,
+   (png_const_structrp png_ptr, png_const_inforp info_ptr));
 
 /* Returns image compression_type. */
-PNG_EXPORT(121, png_byte, png_get_compression_type, (png_const_structrp png_ptr,
-    png_const_inforp info_ptr));
+PNG_EXPORT(121, png_byte, png_get_compression_type,
+   (png_const_structrp png_ptr, png_const_inforp info_ptr));
 
 /* Returns image resolution in pixels per meter, from pHYs chunk data. */
 PNG_EXPORT(122, png_uint_32, png_get_pixels_per_meter,
-    (png_const_structrp png_ptr, png_const_inforp info_ptr));
+   (png_const_structrp png_ptr, png_const_inforp info_ptr));
 PNG_EXPORT(123, png_uint_32, png_get_x_pixels_per_meter,
-    (png_const_structrp png_ptr, png_const_inforp info_ptr));
+   (png_const_structrp png_ptr, png_const_inforp info_ptr));
 PNG_EXPORT(124, png_uint_32, png_get_y_pixels_per_meter,
-    (png_const_structrp png_ptr, png_const_inforp info_ptr));
+   (png_const_structrp png_ptr, png_const_inforp info_ptr));
 
 /* Returns pixel aspect ratio, computed from pHYs chunk data.  */
 PNG_FP_EXPORT(125, float, png_get_pixel_aspect_ratio,
-    (png_const_structrp png_ptr, png_const_inforp info_ptr))
+   (png_const_structrp png_ptr, png_const_inforp info_ptr))
 PNG_FIXED_EXPORT(210, png_fixed_point, png_get_pixel_aspect_ratio_fixed,
-    (png_const_structrp png_ptr, png_const_inforp info_ptr))
+   (png_const_structrp png_ptr, png_const_inforp info_ptr))
 
 /* Returns image x, y offset in pixels or microns, from oFFs chunk data. */
 PNG_EXPORT(126, png_int_32, png_get_x_offset_pixels,
-    (png_const_structrp png_ptr, png_const_inforp info_ptr));
+   (png_const_structrp png_ptr, png_const_inforp info_ptr));
 PNG_EXPORT(127, png_int_32, png_get_y_offset_pixels,
-    (png_const_structrp png_ptr, png_const_inforp info_ptr));
+   (png_const_structrp png_ptr, png_const_inforp info_ptr));
 PNG_EXPORT(128, png_int_32, png_get_x_offset_microns,
-    (png_const_structrp png_ptr, png_const_inforp info_ptr));
+   (png_const_structrp png_ptr, png_const_inforp info_ptr));
 PNG_EXPORT(129, png_int_32, png_get_y_offset_microns,
-    (png_const_structrp png_ptr, png_const_inforp info_ptr));
+   (png_const_structrp png_ptr, png_const_inforp info_ptr));
 
 #endif /* EASY_ACCESS */
 
 #ifdef PNG_READ_SUPPORTED
 /* Returns pointer to signature string read from PNG header */
-PNG_EXPORT(130, png_const_bytep, png_get_signature, (png_const_structrp png_ptr,
-    png_const_inforp info_ptr));
+PNG_EXPORT(130, png_const_bytep, png_get_signature,
+   (png_const_structrp png_ptr, png_const_inforp info_ptr));
 #endif
 
 #ifdef PNG_bKGD_SUPPORTED
-PNG_EXPORT(131, png_uint_32, png_get_bKGD, (png_const_structrp png_ptr,
-    png_inforp info_ptr, png_color_16p *background));
+PNG_EXPORT(131, png_uint_32, png_get_bKGD,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    png_color_16p *background));
 #endif
 
 #ifdef PNG_bKGD_SUPPORTED
-PNG_EXPORT(132, void, png_set_bKGD, (png_const_structrp png_ptr,
-    png_inforp info_ptr, png_const_color_16p background));
+PNG_EXPORT(132, void, png_set_bKGD,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    png_const_color_16p background));
 #endif
 
 #ifdef PNG_cHRM_SUPPORTED
-PNG_FP_EXPORT(133, png_uint_32, png_get_cHRM, (png_const_structrp png_ptr,
-    png_const_inforp info_ptr, double *white_x, double *white_y, double *red_x,
-    double *red_y, double *green_x, double *green_y, double *blue_x,
-    double *blue_y))
-PNG_FP_EXPORT(230, png_uint_32, png_get_cHRM_XYZ, (png_const_structrp png_ptr,
-    png_const_inforp info_ptr, double *red_X, double *red_Y, double *red_Z,
-    double *green_X, double *green_Y, double *green_Z, double *blue_X,
-    double *blue_Y, double *blue_Z))
+PNG_FP_EXPORT(133, png_uint_32, png_get_cHRM,
+   (png_const_structrp png_ptr, png_const_inforp info_ptr,
+    double *white_x, double *white_y,
+    double *red_x, double *red_y,
+    double *green_x, double *green_y,
+    double *blue_x, double *blue_y))
+PNG_FP_EXPORT(230, png_uint_32, png_get_cHRM_XYZ,
+   (png_const_structrp png_ptr, png_const_inforp info_ptr,
+    double *red_X, double *red_Y, double *red_Z,
+    double *green_X, double *green_Y, double *green_Z,
+    double *blue_X, double *blue_Y, double *blue_Z))
 PNG_FIXED_EXPORT(134, png_uint_32, png_get_cHRM_fixed,
-    (png_const_structrp png_ptr, png_const_inforp info_ptr,
+   (png_const_structrp png_ptr, png_const_inforp info_ptr,
     png_fixed_point *int_white_x, png_fixed_point *int_white_y,
     png_fixed_point *int_red_x, png_fixed_point *int_red_y,
     png_fixed_point *int_green_x, png_fixed_point *int_green_y,
     png_fixed_point *int_blue_x, png_fixed_point *int_blue_y))
 PNG_FIXED_EXPORT(231, png_uint_32, png_get_cHRM_XYZ_fixed,
-    (png_const_structrp png_ptr, png_const_inforp info_ptr,
+   (png_const_structrp png_ptr, png_const_inforp info_ptr,
     png_fixed_point *int_red_X, png_fixed_point *int_red_Y,
-    png_fixed_point *int_red_Z, png_fixed_point *int_green_X,
-    png_fixed_point *int_green_Y, png_fixed_point *int_green_Z,
+    png_fixed_point *int_red_Z,
+    png_fixed_point *int_green_X, png_fixed_point *int_green_Y,
+    png_fixed_point *int_green_Z,
     png_fixed_point *int_blue_X, png_fixed_point *int_blue_Y,
     png_fixed_point *int_blue_Z))
 #endif
 
 #ifdef PNG_cHRM_SUPPORTED
-PNG_FP_EXPORT(135, void, png_set_cHRM, (png_const_structrp png_ptr,
-    png_inforp info_ptr,
-    double white_x, double white_y, double red_x, double red_y, double green_x,
-    double green_y, double blue_x, double blue_y))
-PNG_FP_EXPORT(232, void, png_set_cHRM_XYZ, (png_const_structrp png_ptr,
-    png_inforp info_ptr, double red_X, double red_Y, double red_Z,
-    double green_X, double green_Y, double green_Z, double blue_X,
-    double blue_Y, double blue_Z))
-PNG_FIXED_EXPORT(136, void, png_set_cHRM_fixed, (png_const_structrp png_ptr,
-    png_inforp info_ptr, png_fixed_point int_white_x,
-    png_fixed_point int_white_y, png_fixed_point int_red_x,
-    png_fixed_point int_red_y, png_fixed_point int_green_x,
-    png_fixed_point int_green_y, png_fixed_point int_blue_x,
-    png_fixed_point int_blue_y))
-PNG_FIXED_EXPORT(233, void, png_set_cHRM_XYZ_fixed, (png_const_structrp png_ptr,
-    png_inforp info_ptr, png_fixed_point int_red_X, png_fixed_point int_red_Y,
-    png_fixed_point int_red_Z, png_fixed_point int_green_X,
-    png_fixed_point int_green_Y, png_fixed_point int_green_Z,
+PNG_FP_EXPORT(135, void, png_set_cHRM,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    double white_x, double white_y,
+    double red_x, double red_y,
+    double green_x, double green_y,
+    double blue_x, double blue_y))
+PNG_FP_EXPORT(232, void, png_set_cHRM_XYZ,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    double red_X, double red_Y, double red_Z,
+    double green_X, double green_Y, double green_Z,
+    double blue_X, double blue_Y, double blue_Z))
+PNG_FIXED_EXPORT(136, void, png_set_cHRM_fixed,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    png_fixed_point int_white_x, png_fixed_point int_white_y,
+    png_fixed_point int_red_x, png_fixed_point int_red_y,
+    png_fixed_point int_green_x, png_fixed_point int_green_y,
+    png_fixed_point int_blue_x, png_fixed_point int_blue_y))
+PNG_FIXED_EXPORT(233, void, png_set_cHRM_XYZ_fixed,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    png_fixed_point int_red_X, png_fixed_point int_red_Y,
+    png_fixed_point int_red_Z,
+    png_fixed_point int_green_X, png_fixed_point int_green_Y,
+    png_fixed_point int_green_Z,
     png_fixed_point int_blue_X, png_fixed_point int_blue_Y,
     png_fixed_point int_blue_Z))
 #endif
 
 #ifdef PNG_cICP_SUPPORTED
-PNG_EXPORT(250, png_uint_32, png_get_cICP, (png_const_structrp png_ptr,
-    png_const_inforp info_ptr, png_bytep colour_primaries,
-    png_bytep transfer_function, png_bytep matrix_coefficients,
-    png_bytep video_full_range_flag));
+PNG_EXPORT(250, png_uint_32, png_get_cICP,
+   (png_const_structrp png_ptr, png_const_inforp info_ptr,
+    png_bytep colour_primaries, png_bytep transfer_function,
+    png_bytep matrix_coefficients, png_bytep video_full_range_flag));
 #endif
 
 #ifdef PNG_cICP_SUPPORTED
-PNG_EXPORT(251, void, png_set_cICP, (png_const_structrp png_ptr,
-    png_inforp info_ptr, png_byte colour_primaries,
-    png_byte transfer_function, png_byte matrix_coefficients,
-    png_byte video_full_range_flag));
+PNG_EXPORT(251, void, png_set_cICP,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    png_byte colour_primaries, png_byte transfer_function,
+    png_byte matrix_coefficients, png_byte video_full_range_flag));
 #endif
 
 #ifdef PNG_cLLI_SUPPORTED
-PNG_FP_EXPORT(252, png_uint_32, png_get_cLLI, (png_const_structrp png_ptr,
-         png_const_inforp info_ptr, double *maximum_content_light_level,
-         double *maximum_frame_average_light_level))
+PNG_FP_EXPORT(252, png_uint_32, png_get_cLLI,
+   (png_const_structrp png_ptr, png_const_inforp info_ptr,
+    double *maximum_content_light_level,
+    double *maximum_frame_average_light_level))
 PNG_FIXED_EXPORT(253, png_uint_32, png_get_cLLI_fixed,
-    (png_const_structrp png_ptr, png_const_inforp info_ptr,
+   (png_const_structrp png_ptr, png_const_inforp info_ptr,
     /* The values below are in cd/m2 (nits) and are scaled by 10,000; not
      * 100,000 as in the case of png_fixed_point.
      */
@@ -2045,11 +2143,12 @@ PNG_FIXED_EXPORT(253, png_uint_32, png_get_cLLI_fixed,
 #endif
 
 #ifdef PNG_cLLI_SUPPORTED
-PNG_FP_EXPORT(254, void, png_set_cLLI, (png_const_structrp png_ptr,
-         png_inforp info_ptr, double maximum_content_light_level,
-         double maximum_frame_average_light_level))
-PNG_FIXED_EXPORT(255, void, png_set_cLLI_fixed, (png_const_structrp png_ptr,
-    png_inforp info_ptr,
+PNG_FP_EXPORT(254, void, png_set_cLLI,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    double maximum_content_light_level,
+    double maximum_frame_average_light_level))
+PNG_FIXED_EXPORT(255, void, png_set_cLLI_fixed,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
     /* The values below are in cd/m2 (nits) and are scaled by 10,000; not
      * 100,000 as in the case of png_fixed_point.
      */
@@ -2058,64 +2157,73 @@ PNG_FIXED_EXPORT(255, void, png_set_cLLI_fixed, (png_const_structrp png_ptr,
 #endif
 
 #ifdef PNG_eXIf_SUPPORTED
-PNG_EXPORT(246, png_uint_32, png_get_eXIf, (png_const_structrp png_ptr,
-    png_inforp info_ptr, png_bytep *exif));
-PNG_EXPORT(247, void, png_set_eXIf, (png_const_structrp png_ptr,
-    png_inforp info_ptr, png_bytep exif));
+PNG_EXPORT(246, png_uint_32, png_get_eXIf,
+   (png_const_structrp png_ptr, png_inforp info_ptr, png_bytep *exif));
+PNG_EXPORT(247, void, png_set_eXIf,
+   (png_const_structrp png_ptr, png_inforp info_ptr, png_bytep exif));
 
-PNG_EXPORT(248, png_uint_32, png_get_eXIf_1, (png_const_structrp png_ptr,
-    png_const_inforp info_ptr, png_uint_32 *num_exif, png_bytep *exif));
-PNG_EXPORT(249, void, png_set_eXIf_1, (png_const_structrp png_ptr,
-    png_inforp info_ptr, png_uint_32 num_exif, png_bytep exif));
+PNG_EXPORT(248, png_uint_32, png_get_eXIf_1,
+   (png_const_structrp png_ptr, png_const_inforp info_ptr,
+    png_uint_32 *num_exif, png_bytep *exif));
+PNG_EXPORT(249, void, png_set_eXIf_1,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    png_uint_32 num_exif, png_bytep exif));
 #endif
 
 #ifdef PNG_gAMA_SUPPORTED
-PNG_FP_EXPORT(137, png_uint_32, png_get_gAMA, (png_const_structrp png_ptr,
-    png_const_inforp info_ptr, double *file_gamma))
+PNG_FP_EXPORT(137, png_uint_32, png_get_gAMA,
+   (png_const_structrp png_ptr, png_const_inforp info_ptr,
+    double *file_gamma))
 PNG_FIXED_EXPORT(138, png_uint_32, png_get_gAMA_fixed,
-    (png_const_structrp png_ptr, png_const_inforp info_ptr,
+   (png_const_structrp png_ptr, png_const_inforp info_ptr,
     png_fixed_point *int_file_gamma))
 #endif
 
 #ifdef PNG_gAMA_SUPPORTED
-PNG_FP_EXPORT(139, void, png_set_gAMA, (png_const_structrp png_ptr,
-    png_inforp info_ptr, double file_gamma))
-PNG_FIXED_EXPORT(140, void, png_set_gAMA_fixed, (png_const_structrp png_ptr,
-    png_inforp info_ptr, png_fixed_point int_file_gamma))
+PNG_FP_EXPORT(139, void, png_set_gAMA,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    double file_gamma))
+PNG_FIXED_EXPORT(140, void, png_set_gAMA_fixed,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    png_fixed_point int_file_gamma))
 #endif
 
 #ifdef PNG_hIST_SUPPORTED
-PNG_EXPORT(141, png_uint_32, png_get_hIST, (png_const_structrp png_ptr,
-    png_inforp info_ptr, png_uint_16p *hist));
-PNG_EXPORT(142, void, png_set_hIST, (png_const_structrp png_ptr,
-    png_inforp info_ptr, png_const_uint_16p hist));
+PNG_EXPORT(141, png_uint_32, png_get_hIST,
+   (png_const_structrp png_ptr, png_inforp info_ptr, png_uint_16p *hist));
+PNG_EXPORT(142, void, png_set_hIST,
+   (png_const_structrp png_ptr, png_inforp info_ptr, png_const_uint_16p hist));
 #endif
 
-PNG_EXPORT(143, png_uint_32, png_get_IHDR, (png_const_structrp png_ptr,
-    png_const_inforp info_ptr, png_uint_32 *width, png_uint_32 *height,
-    int *bit_depth, int *color_type, int *interlace_method,
-    int *compression_method, int *filter_method));
+PNG_EXPORT(143, png_uint_32, png_get_IHDR,
+   (png_const_structrp png_ptr, png_const_inforp info_ptr,
+    png_uint_32 *width, png_uint_32 *height,
+    int *bit_depth, int *color_type,
+    int *interlace_method, int *compression_method, int *filter_method));
 
-PNG_EXPORT(144, void, png_set_IHDR, (png_const_structrp png_ptr,
-    png_inforp info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth,
-    int color_type, int interlace_method, int compression_method,
-    int filter_method));
+PNG_EXPORT(144, void, png_set_IHDR,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    png_uint_32 width, png_uint_32 height,
+    int bit_depth, int color_type,
+    int interlace_method, int compression_method, int filter_method));
 
 #ifdef PNG_mDCV_SUPPORTED
-PNG_FP_EXPORT(256, png_uint_32, png_get_mDCV, (png_const_structrp png_ptr,
-    png_const_inforp info_ptr,
+PNG_FP_EXPORT(256, png_uint_32, png_get_mDCV,
+   (png_const_structrp png_ptr, png_const_inforp info_ptr,
     /* The chromaticities of the mastering display.  As cHRM, but independent of
      * the encoding endpoints in cHRM, or cICP, or iCCP.  These values will
      * always be in the range 0 to 1.3107.
      */
-    double *white_x, double *white_y, double *red_x, double *red_y,
-    double *green_x, double *green_y, double *blue_x, double *blue_y,
+    double *white_x, double *white_y,
+    double *red_x, double *red_y,
+    double *green_x, double *green_y,
+    double *blue_x, double *blue_y,
     /* Mastering display luminance in cd/m2 (nits). */
     double *mastering_display_maximum_luminance,
     double *mastering_display_minimum_luminance))
 
 PNG_FIXED_EXPORT(257, png_uint_32, png_get_mDCV_fixed,
-    (png_const_structrp png_ptr, png_const_inforp info_ptr,
+   (png_const_structrp png_ptr, png_const_inforp info_ptr,
     png_fixed_point *int_white_x, png_fixed_point *int_white_y,
     png_fixed_point *int_red_x, png_fixed_point *int_red_y,
     png_fixed_point *int_green_x, png_fixed_point *int_green_y,
@@ -2128,19 +2236,21 @@ PNG_FIXED_EXPORT(257, png_uint_32, png_get_mDCV_fixed,
 #endif
 
 #ifdef PNG_mDCV_SUPPORTED
-PNG_FP_EXPORT(258, void, png_set_mDCV, (png_const_structrp png_ptr,
-    png_inforp info_ptr,
+PNG_FP_EXPORT(258, void, png_set_mDCV,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
     /* The chromaticities of the mastering display.  As cHRM, but independent of
      * the encoding endpoints in cHRM, or cICP, or iCCP.
      */
-    double white_x, double white_y, double red_x, double red_y, double green_x,
-    double green_y, double blue_x, double blue_y,
+    double white_x, double white_y,
+    double red_x, double red_y,
+    double green_x, double green_y,
+    double blue_x, double blue_y,
     /* Mastering display luminance in cd/m2 (nits). */
     double mastering_display_maximum_luminance,
     double mastering_display_minimum_luminance))
 
-PNG_FIXED_EXPORT(259, void, png_set_mDCV_fixed, (png_const_structrp png_ptr,
-    png_inforp info_ptr,
+PNG_FIXED_EXPORT(259, void, png_set_mDCV_fixed,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
     /* The admissible range of these values is not the full range of a PNG
      * fixed point value.  Negative values cannot be encoded and the maximum
      * value is about 1.3 */
@@ -2156,95 +2266,107 @@ PNG_FIXED_EXPORT(259, void, png_set_mDCV_fixed, (png_const_structrp png_ptr,
 #endif
 
 #ifdef PNG_oFFs_SUPPORTED
-PNG_EXPORT(145, png_uint_32, png_get_oFFs, (png_const_structrp png_ptr,
-   png_const_inforp info_ptr, png_int_32 *offset_x, png_int_32 *offset_y,
-   int *unit_type));
+PNG_EXPORT(145, png_uint_32, png_get_oFFs,
+   (png_const_structrp png_ptr, png_const_inforp info_ptr,
+    png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type));
 #endif
 
 #ifdef PNG_oFFs_SUPPORTED
-PNG_EXPORT(146, void, png_set_oFFs, (png_const_structrp png_ptr,
-    png_inforp info_ptr, png_int_32 offset_x, png_int_32 offset_y,
-    int unit_type));
+PNG_EXPORT(146, void, png_set_oFFs,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    png_int_32 offset_x, png_int_32 offset_y, int unit_type));
 #endif
 
 #ifdef PNG_pCAL_SUPPORTED
-PNG_EXPORT(147, png_uint_32, png_get_pCAL, (png_const_structrp png_ptr,
-    png_inforp info_ptr, png_charp *purpose, png_int_32 *X0,
-    png_int_32 *X1, int *type, int *nparams, png_charp *units,
-    png_charpp *params));
+PNG_EXPORT(147, png_uint_32, png_get_pCAL,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    png_charp *purpose, png_int_32 *X0, png_int_32 *X1,
+    int *type, int *nparams, png_charp *units, png_charpp *params));
 #endif
 
 #ifdef PNG_pCAL_SUPPORTED
-PNG_EXPORT(148, void, png_set_pCAL, (png_const_structrp png_ptr,
-    png_inforp info_ptr, png_const_charp purpose, png_int_32 X0, png_int_32 X1,
+PNG_EXPORT(148, void, png_set_pCAL,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    png_const_charp purpose, png_int_32 X0, png_int_32 X1,
     int type, int nparams, png_const_charp units, png_charpp params));
 #endif
 
 #ifdef PNG_pHYs_SUPPORTED
-PNG_EXPORT(149, png_uint_32, png_get_pHYs, (png_const_structrp png_ptr,
-    png_const_inforp info_ptr, png_uint_32 *res_x, png_uint_32 *res_y,
-    int *unit_type));
+PNG_EXPORT(149, png_uint_32, png_get_pHYs,
+   (png_const_structrp png_ptr, png_const_inforp info_ptr,
+    png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type));
 #endif
 
 #ifdef PNG_pHYs_SUPPORTED
-PNG_EXPORT(150, void, png_set_pHYs, (png_const_structrp png_ptr,
-    png_inforp info_ptr, png_uint_32 res_x, png_uint_32 res_y, int unit_type));
+PNG_EXPORT(150, void, png_set_pHYs,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    png_uint_32 res_x, png_uint_32 res_y, int unit_type));
 #endif
 
-PNG_EXPORT(151, png_uint_32, png_get_PLTE, (png_const_structrp png_ptr,
-   png_inforp info_ptr, png_colorp *palette, int *num_palette));
+PNG_EXPORT(151, png_uint_32, png_get_PLTE,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    png_colorp *palette, int *num_palette));
 
-PNG_EXPORT(152, void, png_set_PLTE, (png_structrp png_ptr,
-    png_inforp info_ptr, png_const_colorp palette, int num_palette));
+PNG_EXPORT(152, void, png_set_PLTE,
+   (png_structrp png_ptr, png_inforp info_ptr,
+    png_const_colorp palette, int num_palette));
 
 #ifdef PNG_sBIT_SUPPORTED
-PNG_EXPORT(153, png_uint_32, png_get_sBIT, (png_const_structrp png_ptr,
-    png_inforp info_ptr, png_color_8p *sig_bit));
+PNG_EXPORT(153, png_uint_32, png_get_sBIT,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    png_color_8p *sig_bit));
 #endif
 
 #ifdef PNG_sBIT_SUPPORTED
-PNG_EXPORT(154, void, png_set_sBIT, (png_const_structrp png_ptr,
-    png_inforp info_ptr, png_const_color_8p sig_bit));
+PNG_EXPORT(154, void, png_set_sBIT,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    png_const_color_8p sig_bit));
 #endif
 
 #ifdef PNG_sRGB_SUPPORTED
-PNG_EXPORT(155, png_uint_32, png_get_sRGB, (png_const_structrp png_ptr,
-    png_const_inforp info_ptr, int *file_srgb_intent));
+PNG_EXPORT(155, png_uint_32, png_get_sRGB,
+   (png_const_structrp png_ptr, png_const_inforp info_ptr,
+    int *file_srgb_intent));
 #endif
 
 #ifdef PNG_sRGB_SUPPORTED
-PNG_EXPORT(156, void, png_set_sRGB, (png_const_structrp png_ptr,
-    png_inforp info_ptr, int srgb_intent));
-PNG_EXPORT(157, void, png_set_sRGB_gAMA_and_cHRM, (png_const_structrp png_ptr,
-    png_inforp info_ptr, int srgb_intent));
+PNG_EXPORT(156, void, png_set_sRGB,
+   (png_const_structrp png_ptr, png_inforp info_ptr, int srgb_intent));
+PNG_EXPORT(157, void, png_set_sRGB_gAMA_and_cHRM,
+   (png_const_structrp png_ptr, png_inforp info_ptr, int srgb_intent));
 #endif
 
 #ifdef PNG_iCCP_SUPPORTED
-PNG_EXPORT(158, png_uint_32, png_get_iCCP, (png_const_structrp png_ptr,
-    png_inforp info_ptr, png_charpp name, int *compression_type,
+PNG_EXPORT(158, png_uint_32, png_get_iCCP,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    png_charpp name, int *compression_type,
     png_bytepp profile, png_uint_32 *proflen));
 #endif
 
 #ifdef PNG_iCCP_SUPPORTED
-PNG_EXPORT(159, void, png_set_iCCP, (png_const_structrp png_ptr,
-    png_inforp info_ptr, png_const_charp name, int compression_type,
+PNG_EXPORT(159, void, png_set_iCCP,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    png_const_charp name, int compression_type,
     png_const_bytep profile, png_uint_32 proflen));
 #endif
 
 #ifdef PNG_sPLT_SUPPORTED
-PNG_EXPORT(160, int, png_get_sPLT, (png_const_structrp png_ptr,
-    png_inforp info_ptr, png_sPLT_tpp entries));
+PNG_EXPORT(160, int, png_get_sPLT,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    png_sPLT_tpp entries));
 #endif
 
 #ifdef PNG_sPLT_SUPPORTED
-PNG_EXPORT(161, void, png_set_sPLT, (png_const_structrp png_ptr,
-    png_inforp info_ptr, png_const_sPLT_tp entries, int nentries));
+PNG_EXPORT(161, void, png_set_sPLT,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    png_const_sPLT_tp entries, int nentries));
 #endif
 
 #ifdef PNG_TEXT_SUPPORTED
 /* png_get_text also returns the number of text chunks in *num_text */
-PNG_EXPORT(162, int, png_get_text, (png_const_structrp png_ptr,
-    png_inforp info_ptr, png_textp *text_ptr, int *num_text));
+PNG_EXPORT(162, int, png_get_text,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    png_textp *text_ptr, int *num_text));
 #endif
 
 /* Note while png_set_text() will accept a structure whose text,
@@ -2255,35 +2377,41 @@ PNG_EXPORT(162, int, png_get_text, (png_const_structrp png_ptr,
  */
 
 #ifdef PNG_TEXT_SUPPORTED
-PNG_EXPORT(163, void, png_set_text, (png_const_structrp png_ptr,
-    png_inforp info_ptr, png_const_textp text_ptr, int num_text));
+PNG_EXPORT(163, void, png_set_text,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    png_const_textp text_ptr, int num_text));
 #endif
 
 #ifdef PNG_tIME_SUPPORTED
-PNG_EXPORT(164, png_uint_32, png_get_tIME, (png_const_structrp png_ptr,
-    png_inforp info_ptr, png_timep *mod_time));
+PNG_EXPORT(164, png_uint_32, png_get_tIME,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    png_timep *mod_time));
 #endif
 
 #ifdef PNG_tIME_SUPPORTED
-PNG_EXPORT(165, void, png_set_tIME, (png_const_structrp png_ptr,
-    png_inforp info_ptr, png_const_timep mod_time));
+PNG_EXPORT(165, void, png_set_tIME,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    png_const_timep mod_time));
 #endif
 
 #ifdef PNG_tRNS_SUPPORTED
-PNG_EXPORT(166, png_uint_32, png_get_tRNS, (png_const_structrp png_ptr,
-    png_inforp info_ptr, png_bytep *trans_alpha, int *num_trans,
+PNG_EXPORT(166, png_uint_32, png_get_tRNS,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    png_bytep *trans_alpha, int *num_trans,
     png_color_16p *trans_color));
 #endif
 
 #ifdef PNG_tRNS_SUPPORTED
-PNG_EXPORT(167, void, png_set_tRNS, (png_structrp png_ptr,
-    png_inforp info_ptr, png_const_bytep trans_alpha, int num_trans,
+PNG_EXPORT(167, void, png_set_tRNS,
+   (png_structrp png_ptr, png_inforp info_ptr,
+    png_const_bytep trans_alpha, int num_trans,
     png_const_color_16p trans_color));
 #endif
 
 #ifdef PNG_sCAL_SUPPORTED
-PNG_FP_EXPORT(168, png_uint_32, png_get_sCAL, (png_const_structrp png_ptr,
-    png_const_inforp info_ptr, int *unit, double *width, double *height))
+PNG_FP_EXPORT(168, png_uint_32, png_get_sCAL,
+   (png_const_structrp png_ptr, png_const_inforp info_ptr,
+    int *unit, double *width, double *height))
 #if defined(PNG_FLOATING_ARITHMETIC_SUPPORTED) || \
    defined(PNG_FLOATING_POINT_SUPPORTED)
 /* NOTE: this API is currently implemented using floating point arithmetic,
@@ -2292,21 +2420,22 @@ PNG_FP_EXPORT(168, png_uint_32, png_get_sCAL, (png_const_structrp png_ptr,
  * is highly recommended that png_get_sCAL_s be used instead.
  */
 PNG_FIXED_EXPORT(214, png_uint_32, png_get_sCAL_fixed,
-    (png_const_structrp png_ptr, png_const_inforp info_ptr, int *unit,
-    png_fixed_point *width, png_fixed_point *height))
+   (png_const_structrp png_ptr, png_const_inforp info_ptr,
+    int *unit, png_fixed_point *width, png_fixed_point *height))
 #endif
 PNG_EXPORT(169, png_uint_32, png_get_sCAL_s,
-    (png_const_structrp png_ptr, png_const_inforp info_ptr, int *unit,
-    png_charpp swidth, png_charpp sheight));
+   (png_const_structrp png_ptr, png_const_inforp info_ptr,
+    int *unit, png_charpp swidth, png_charpp sheight));
 
-PNG_FP_EXPORT(170, void, png_set_sCAL, (png_const_structrp png_ptr,
-    png_inforp info_ptr, int unit, double width, double height))
-PNG_FIXED_EXPORT(213, void, png_set_sCAL_fixed, (png_const_structrp png_ptr,
-   png_inforp info_ptr, int unit, png_fixed_point width,
-   png_fixed_point height))
-PNG_EXPORT(171, void, png_set_sCAL_s, (png_const_structrp png_ptr,
-    png_inforp info_ptr, int unit,
-    png_const_charp swidth, png_const_charp sheight));
+PNG_FP_EXPORT(170, void, png_set_sCAL,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    int unit, double width, double height))
+PNG_FIXED_EXPORT(213, void, png_set_sCAL_fixed,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    int unit, png_fixed_point width, png_fixed_point height))
+PNG_EXPORT(171, void, png_set_sCAL_s,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    int unit, png_const_charp swidth, png_const_charp sheight));
 #endif /* sCAL */
 
 #ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
@@ -2409,7 +2538,8 @@ PNG_EXPORT(171, void, png_set_sCAL_s, (png_const_structrp png_ptr,
  *    be processed by libpng.
  */
 #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
-PNG_EXPORT(172, void, png_set_keep_unknown_chunks, (png_structrp png_ptr,
+PNG_EXPORT(172, void, png_set_keep_unknown_chunks,
+   (png_structrp png_ptr,
     int keep, png_const_bytep chunk_list, int num_chunks));
 #endif /* HANDLE_AS_UNKNOWN */
 
@@ -2417,14 +2547,14 @@ PNG_EXPORT(172, void, png_set_keep_unknown_chunks, (png_structrp png_ptr,
  * the result is therefore true (non-zero) if special handling is required,
  * false for the default handling.
  */
-PNG_EXPORT(173, int, png_handle_as_unknown, (png_const_structrp png_ptr,
-    png_const_bytep chunk_name));
+PNG_EXPORT(173, int, png_handle_as_unknown,
+   (png_const_structrp png_ptr, png_const_bytep chunk_name));
 #endif /* SET_UNKNOWN_CHUNKS */
 
 #ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
-PNG_EXPORT(174, void, png_set_unknown_chunks, (png_const_structrp png_ptr,
-    png_inforp info_ptr, png_const_unknown_chunkp unknowns,
-    int num_unknowns));
+PNG_EXPORT(174, void, png_set_unknown_chunks,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    png_const_unknown_chunkp unknowns, int num_unknowns));
    /* NOTE: prior to 1.6.0 this routine set the 'location' field of the added
     * unknowns to the location currently stored in the png_struct.  This is
     * invariably the wrong value on write.  To fix this call the following API
@@ -2435,43 +2565,47 @@ PNG_EXPORT(174, void, png_set_unknown_chunks, (png_const_structrp png_ptr,
     */
 
 PNG_EXPORT(175, void, png_set_unknown_chunk_location,
-    (png_const_structrp png_ptr, png_inforp info_ptr, int chunk, int location));
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    int chunk, int location));
 
-PNG_EXPORT(176, int, png_get_unknown_chunks, (png_const_structrp png_ptr,
-    png_inforp info_ptr, png_unknown_chunkpp entries));
+PNG_EXPORT(176, int, png_get_unknown_chunks,
+   (png_const_structrp png_ptr, png_inforp info_ptr,
+    png_unknown_chunkpp entries));
 #endif
 
 /* Png_free_data() will turn off the "valid" flag for anything it frees.
  * If you need to turn it off for a chunk that your application has freed,
  * you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK);
  */
-PNG_EXPORT(177, void, png_set_invalid, (png_const_structrp png_ptr,
-    png_inforp info_ptr, int mask));
+PNG_EXPORT(177, void, png_set_invalid,
+   (png_const_structrp png_ptr, png_inforp info_ptr, int mask));
 
 #ifdef PNG_INFO_IMAGE_SUPPORTED
 /* The "params" pointer is currently not used and is for future expansion. */
 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
-PNG_EXPORT(178, void, png_read_png, (png_structrp png_ptr, png_inforp info_ptr,
+PNG_EXPORT(178, void, png_read_png,
+   (png_structrp png_ptr, png_inforp info_ptr,
     int transforms, png_voidp params));
 #endif
 #ifdef PNG_WRITE_SUPPORTED
-PNG_EXPORT(179, void, png_write_png, (png_structrp png_ptr, png_inforp info_ptr,
+PNG_EXPORT(179, void, png_write_png,
+   (png_structrp png_ptr, png_inforp info_ptr,
     int transforms, png_voidp params));
 #endif
 #endif
 
 PNG_EXPORT(180, png_const_charp, png_get_copyright,
-    (png_const_structrp png_ptr));
+   (png_const_structrp png_ptr));
 PNG_EXPORT(181, png_const_charp, png_get_header_ver,
-    (png_const_structrp png_ptr));
+   (png_const_structrp png_ptr));
 PNG_EXPORT(182, png_const_charp, png_get_header_version,
-    (png_const_structrp png_ptr));
+   (png_const_structrp png_ptr));
 PNG_EXPORT(183, png_const_charp, png_get_libpng_ver,
-    (png_const_structrp png_ptr));
+   (png_const_structrp png_ptr));
 
 #ifdef PNG_MNG_FEATURES_SUPPORTED
-PNG_EXPORT(184, png_uint_32, png_permit_mng_features, (png_structrp png_ptr,
-    png_uint_32 mng_features_permitted));
+PNG_EXPORT(184, png_uint_32, png_permit_mng_features,
+   (png_structrp png_ptr, png_uint_32 mng_features_permitted));
 #endif
 
 /* For use in png_set_keep_unknown, added to version 1.2.6 */
@@ -2485,71 +2619,74 @@ PNG_EXPORT(184, png_uint_32, png_permit_mng_features, (png_structrp png_ptr,
  * messages before passing them to the error or warning handler.
  */
 #ifdef PNG_ERROR_NUMBERS_SUPPORTED
-PNG_EXPORT(185, void, png_set_strip_error_numbers, (png_structrp png_ptr,
-    png_uint_32 strip_mode));
+PNG_EXPORT(185, void, png_set_strip_error_numbers,
+   (png_structrp png_ptr, png_uint_32 strip_mode));
 #endif
 
 /* Added in libpng-1.2.6 */
 #ifdef PNG_SET_USER_LIMITS_SUPPORTED
-PNG_EXPORT(186, void, png_set_user_limits, (png_structrp png_ptr,
+PNG_EXPORT(186, void, png_set_user_limits,
+   (png_structrp png_ptr,
     png_uint_32 user_width_max, png_uint_32 user_height_max));
 PNG_EXPORT(187, png_uint_32, png_get_user_width_max,
-    (png_const_structrp png_ptr));
+   (png_const_structrp png_ptr));
 PNG_EXPORT(188, png_uint_32, png_get_user_height_max,
-    (png_const_structrp png_ptr));
+   (png_const_structrp png_ptr));
 /* Added in libpng-1.4.0 */
-PNG_EXPORT(189, void, png_set_chunk_cache_max, (png_structrp png_ptr,
-    png_uint_32 user_chunk_cache_max));
+PNG_EXPORT(189, void, png_set_chunk_cache_max,
+   (png_structrp png_ptr, png_uint_32 user_chunk_cache_max));
 PNG_EXPORT(190, png_uint_32, png_get_chunk_cache_max,
-    (png_const_structrp png_ptr));
+   (png_const_structrp png_ptr));
 /* Added in libpng-1.4.1 */
-PNG_EXPORT(191, void, png_set_chunk_malloc_max, (png_structrp png_ptr,
-    png_alloc_size_t user_chunk_cache_max));
+PNG_EXPORT(191, void, png_set_chunk_malloc_max,
+   (png_structrp png_ptr, png_alloc_size_t user_chunk_cache_max));
 PNG_EXPORT(192, png_alloc_size_t, png_get_chunk_malloc_max,
-    (png_const_structrp png_ptr));
+   (png_const_structrp png_ptr));
 #endif
 
 #if defined(PNG_INCH_CONVERSIONS_SUPPORTED)
 PNG_EXPORT(193, png_uint_32, png_get_pixels_per_inch,
-    (png_const_structrp png_ptr, png_const_inforp info_ptr));
+   (png_const_structrp png_ptr, png_const_inforp info_ptr));
 
 PNG_EXPORT(194, png_uint_32, png_get_x_pixels_per_inch,
-    (png_const_structrp png_ptr, png_const_inforp info_ptr));
+   (png_const_structrp png_ptr, png_const_inforp info_ptr));
 
 PNG_EXPORT(195, png_uint_32, png_get_y_pixels_per_inch,
-    (png_const_structrp png_ptr, png_const_inforp info_ptr));
+   (png_const_structrp png_ptr, png_const_inforp info_ptr));
 
 PNG_FP_EXPORT(196, float, png_get_x_offset_inches,
-    (png_const_structrp png_ptr, png_const_inforp info_ptr))
+   (png_const_structrp png_ptr, png_const_inforp info_ptr))
 #ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */
 PNG_FIXED_EXPORT(211, png_fixed_point, png_get_x_offset_inches_fixed,
-    (png_const_structrp png_ptr, png_const_inforp info_ptr))
+   (png_const_structrp png_ptr, png_const_inforp info_ptr))
 #endif
 
-PNG_FP_EXPORT(197, float, png_get_y_offset_inches, (png_const_structrp png_ptr,
-    png_const_inforp info_ptr))
+PNG_FP_EXPORT(197, float, png_get_y_offset_inches,
+   (png_const_structrp png_ptr, png_const_inforp info_ptr))
 #ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */
 PNG_FIXED_EXPORT(212, png_fixed_point, png_get_y_offset_inches_fixed,
-    (png_const_structrp png_ptr, png_const_inforp info_ptr))
+   (png_const_structrp png_ptr, png_const_inforp info_ptr))
 #endif
 
 #  ifdef PNG_pHYs_SUPPORTED
-PNG_EXPORT(198, png_uint_32, png_get_pHYs_dpi, (png_const_structrp png_ptr,
-    png_const_inforp info_ptr, png_uint_32 *res_x, png_uint_32 *res_y,
-    int *unit_type));
+PNG_EXPORT(198, png_uint_32, png_get_pHYs_dpi,
+   (png_const_structrp png_ptr, png_const_inforp info_ptr,
+    png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type));
 #  endif /* pHYs */
 #endif  /* INCH_CONVERSIONS */
 
 /* Added in libpng-1.4.0 */
 #ifdef PNG_IO_STATE_SUPPORTED
-PNG_EXPORT(199, png_uint_32, png_get_io_state, (png_const_structrp png_ptr));
+PNG_EXPORT(199, png_uint_32, png_get_io_state,
+   (png_const_structrp png_ptr));
 
 /* Removed from libpng 1.6; use png_get_io_chunk_type. */
-PNG_REMOVED(200, png_const_bytep, png_get_io_chunk_name, (png_structrp png_ptr),
-    PNG_DEPRECATED)
+PNG_REMOVED(200, png_const_bytep, png_get_io_chunk_name,
+   (png_structrp png_ptr),
+   PNG_DEPRECATED)
 
 PNG_EXPORT(216, png_uint_32, png_get_io_chunk_type,
-    (png_const_structrp png_ptr));
+   (png_const_structrp png_ptr));
 
 /* The flags returned by png_get_io_state() are the following: */
 #  define PNG_IO_NONE        0x0000   /* no I/O at this moment */
@@ -2674,21 +2811,26 @@ PNG_EXPORT(216, png_uint_32, png_get_io_chunk_type,
 #endif /* READ_COMPOSITE_NODIV */
 
 #ifdef PNG_READ_INT_FUNCTIONS_SUPPORTED
-PNG_EXPORT(201, png_uint_32, png_get_uint_32, (png_const_bytep buf));
-PNG_EXPORT(202, png_uint_16, png_get_uint_16, (png_const_bytep buf));
-PNG_EXPORT(203, png_int_32, png_get_int_32, (png_const_bytep buf));
+PNG_EXPORT(201, png_uint_32, png_get_uint_32,
+   (png_const_bytep buf));
+PNG_EXPORT(202, png_uint_16, png_get_uint_16,
+   (png_const_bytep buf));
+PNG_EXPORT(203, png_int_32, png_get_int_32,
+   (png_const_bytep buf));
 #endif
 
-PNG_EXPORT(204, png_uint_32, png_get_uint_31, (png_const_structrp png_ptr,
-    png_const_bytep buf));
+PNG_EXPORT(204, png_uint_32, png_get_uint_31,
+   (png_const_structrp png_ptr, png_const_bytep buf));
 /* No png_get_int_16 -- may be added if there's a real need for it. */
 
 /* Place a 32-bit number into a buffer in PNG byte order (big-endian). */
 #ifdef PNG_WRITE_INT_FUNCTIONS_SUPPORTED
-PNG_EXPORT(205, void, png_save_uint_32, (png_bytep buf, png_uint_32 i));
+PNG_EXPORT(205, void, png_save_uint_32,
+   (png_bytep buf, png_uint_32 i));
 #endif
 #ifdef PNG_SAVE_INT_32_SUPPORTED
-PNG_EXPORT(206, void, png_save_int_32, (png_bytep buf, png_int_32 i));
+PNG_EXPORT(206, void, png_save_int_32,
+   (png_bytep buf, png_int_32 i));
 #endif
 
 /* Place a 16-bit number into a buffer in PNG byte order.
@@ -2696,7 +2838,8 @@ PNG_EXPORT(206, void, png_save_int_32, (png_bytep buf, png_int_32 i));
  * just to avoid potential problems on pre-ANSI C compilers.
  */
 #ifdef PNG_WRITE_INT_FUNCTIONS_SUPPORTED
-PNG_EXPORT(207, void, png_save_uint_16, (png_bytep buf, unsigned int i));
+PNG_EXPORT(207, void, png_save_uint_16,
+   (png_bytep buf, unsigned int i));
 /* No png_save_int_16 -- may be added if there's a real need for it. */
 #endif
 
@@ -2743,10 +2886,10 @@ PNG_EXPORT(207, void, png_save_uint_16, (png_bytep buf, unsigned int i));
 
 #ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
 PNG_EXPORT(242, void, png_set_check_for_invalid_index,
-    (png_structrp png_ptr, int allowed));
+   (png_structrp png_ptr, int allowed));
 #  ifdef PNG_GET_PALETTE_MAX_SUPPORTED
-PNG_EXPORT(243, int, png_get_palette_max, (png_const_structp png_ptr,
-    png_const_infop info_ptr));
+PNG_EXPORT(243, int, png_get_palette_max,
+   (png_const_structp png_ptr, png_const_infop info_ptr));
 #  endif
 #endif /* CHECK_FOR_INVALID_INDEX */
 
@@ -3110,24 +3253,25 @@ typedef struct
  * the png_controlp field 'opaque' to NULL (or, safer, memset the whole thing.)
  */
 #ifdef PNG_STDIO_SUPPORTED
-PNG_EXPORT(234, int, png_image_begin_read_from_file, (png_imagep image,
-   const char *file_name));
+PNG_EXPORT(234, int, png_image_begin_read_from_file,
+   (png_imagep image, const char *file_name));
    /* The named file is opened for read and the image header is filled in
     * from the PNG header in the file.
     */
 
-PNG_EXPORT(235, int, png_image_begin_read_from_stdio, (png_imagep image,
-   FILE *file));
+PNG_EXPORT(235, int, png_image_begin_read_from_stdio,
+   (png_imagep image, FILE *file));
    /* The PNG header is read from the stdio FILE object. */
 #endif /* STDIO */
 
-PNG_EXPORT(236, int, png_image_begin_read_from_memory, (png_imagep image,
-   png_const_voidp memory, size_t size));
+PNG_EXPORT(236, int, png_image_begin_read_from_memory,
+   (png_imagep image, png_const_voidp memory, size_t size));
    /* The PNG header is read from the given memory buffer. */
 
-PNG_EXPORT(237, int, png_image_finish_read, (png_imagep image,
-   png_const_colorp background, void *buffer, png_int_32 row_stride,
-   void *colormap));
+PNG_EXPORT(237, int, png_image_finish_read,
+   (png_imagep image,
+    png_const_colorp background, void *buffer, png_int_32 row_stride,
+    void *colormap));
    /* Finish reading the image into the supplied buffer and clean up the
     * png_image structure.
     *
@@ -3160,7 +3304,8 @@ PNG_EXPORT(237, int, png_image_finish_read, (png_imagep image,
     * written to the colormap; this may be less than the original value.
     */
 
-PNG_EXPORT(238, void, png_image_free, (png_imagep image));
+PNG_EXPORT(238, void, png_image_free,
+   (png_imagep image));
    /* Free any data allocated by libpng in image->opaque, setting the pointer to
     * NULL.  May be called at any time after the structure is initialized.
     */
@@ -3184,14 +3329,16 @@ PNG_EXPORT(238, void, png_image_free, (png_imagep image));
  * colormap_entries: set to the number of entries in the color-map (0 to 256)
  */
 #ifdef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
-PNG_EXPORT(239, int, png_image_write_to_file, (png_imagep image,
-   const char *file, int convert_to_8bit, const void *buffer,
-   png_int_32 row_stride, const void *colormap));
+PNG_EXPORT(239, int, png_image_write_to_file,
+   (png_imagep image,
+    const char *file, int convert_to_8bit, const void *buffer,
+    png_int_32 row_stride, const void *colormap));
    /* Write the image to the named file. */
 
-PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file,
-   int convert_to_8_bit, const void *buffer, png_int_32 row_stride,
-   const void *colormap));
+PNG_EXPORT(240, int, png_image_write_to_stdio,
+   (png_imagep image,
+    FILE *file, int convert_to_8_bit, const void *buffer,
+    png_int_32 row_stride, const void *colormap));
    /* Write the image to the given FILE object. */
 #endif /* SIMPLIFIED_WRITE_STDIO */
 
@@ -3216,9 +3363,11 @@ PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file,
  * notices) you need to use one of the other APIs.
  */
 
-PNG_EXPORT(245, int, png_image_write_to_memory, (png_imagep image, void *memory,
-   png_alloc_size_t * PNG_RESTRICT memory_bytes, int convert_to_8_bit,
-   const void *buffer, png_int_32 row_stride, const void *colormap));
+PNG_EXPORT(245, int, png_image_write_to_memory,
+   (png_imagep image,
+    void *memory, png_alloc_size_t * PNG_RESTRICT memory_bytes,
+    int convert_to_8_bit,
+    const void *buffer, png_int_32 row_stride, const void *colormap));
    /* Write the image to the given memory buffer.  The function both writes the
     * whole PNG data stream to *memory and updates *memory_bytes with the count
     * of bytes written.
@@ -3394,7 +3543,7 @@ PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option,
  * one to use is one more than this.)
  */
 #ifdef PNG_EXPORT_LAST_ORDINAL
-  PNG_EXPORT_LAST_ORDINAL(259);
+   PNG_EXPORT_LAST_ORDINAL(259);
 #endif
 
 #ifdef __cplusplus
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h b/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h
index 4bc5f7bb468..959c604edbc 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h
@@ -29,9 +29,9 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * libpng version 1.6.51
+ * libpng version 1.6.54
  *
- * Copyright (c) 2018-2025 Cosmin Truta
+ * Copyright (c) 2018-2026 Cosmin Truta
  * Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson
  * Copyright (c) 1996-1997 Andreas Dilger
  * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngerror.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngerror.c
index 44c86ebfef9..324d1951a52 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngerror.c
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngerror.c
@@ -78,7 +78,8 @@ png_error,(png_const_structrp png_ptr, png_const_charp error_message),
 }
 #else
 PNG_FUNCTION(void,PNGAPI
-png_err,(png_const_structrp png_ptr),PNG_NORETURN)
+png_err,(png_const_structrp png_ptr),
+    PNG_NORETURN)
 {
    /* Prior to 1.5.2 the error_fn received a NULL pointer, expressed
     * erroneously as '\0', instead of the empty string "".  This was
@@ -405,8 +406,8 @@ static const char png_digit[16] = {
 };
 
 static void /* PRIVATE */
-png_format_buffer(png_const_structrp png_ptr, png_charp buffer, png_const_charp
-    error_message)
+png_format_buffer(png_const_structrp png_ptr, png_charp buffer,
+    png_const_charp error_message)
 {
    png_uint_32 chunk_name = png_ptr->chunk_name;
    int iout = 0, ishift = 24;
@@ -485,8 +486,8 @@ png_chunk_warning(png_const_structrp png_ptr, png_const_charp warning_message)
 #ifdef PNG_READ_SUPPORTED
 #ifdef PNG_BENIGN_ERRORS_SUPPORTED
 void PNGAPI
-png_chunk_benign_error(png_const_structrp png_ptr, png_const_charp
-    error_message)
+png_chunk_benign_error(png_const_structrp png_ptr,
+    png_const_charp error_message)
 {
    if ((png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN) != 0)
       png_chunk_warning(png_ptr, error_message);
@@ -543,7 +544,8 @@ png_chunk_report(png_const_structrp png_ptr, png_const_charp message, int error)
 #ifdef PNG_ERROR_TEXT_SUPPORTED
 #ifdef PNG_FLOATING_POINT_SUPPORTED
 PNG_FUNCTION(void,
-png_fixed_error,(png_const_structrp png_ptr, png_const_charp name),PNG_NORETURN)
+png_fixed_error,(png_const_structrp png_ptr, png_const_charp name),
+    PNG_NORETURN)
 {
 #  define fixed_message "fixed point overflow in "
 #  define fixed_message_ln ((sizeof fixed_message)-1)
@@ -696,7 +698,8 @@ png_default_error,(png_const_structrp png_ptr, png_const_charp error_message),
 }
 
 PNG_FUNCTION(void,PNGAPI
-png_longjmp,(png_const_structrp png_ptr, int val),PNG_NORETURN)
+png_longjmp,(png_const_structrp png_ptr, int val),
+    PNG_NORETURN)
 {
 #ifdef PNG_SETJMP_SUPPORTED
    if (png_ptr != NULL && png_ptr->longjmp_fn != NULL &&
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngget.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngget.c
index ed2e7f886f5..a5bdcd1b524 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngget.c
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngget.c
@@ -151,8 +151,8 @@ png_get_compression_type(png_const_structrp png_ptr, png_const_inforp info_ptr)
 }
 
 png_uint_32 PNGAPI
-png_get_x_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp
-   info_ptr)
+png_get_x_pixels_per_meter(png_const_structrp png_ptr,
+    png_const_inforp info_ptr)
 {
 #ifdef PNG_pHYs_SUPPORTED
    png_debug(1, "in png_get_x_pixels_per_meter");
@@ -172,8 +172,8 @@ png_get_x_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp
 }
 
 png_uint_32 PNGAPI
-png_get_y_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp
-    info_ptr)
+png_get_y_pixels_per_meter(png_const_structrp png_ptr,
+    png_const_inforp info_ptr)
 {
 #ifdef PNG_pHYs_SUPPORTED
    png_debug(1, "in png_get_y_pixels_per_meter");
@@ -215,8 +215,8 @@ png_get_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp info_ptr)
 
 #ifdef PNG_FLOATING_POINT_SUPPORTED
 float PNGAPI
-png_get_pixel_aspect_ratio(png_const_structrp png_ptr, png_const_inforp
-   info_ptr)
+png_get_pixel_aspect_ratio(png_const_structrp png_ptr,
+    png_const_inforp info_ptr)
 {
 #ifdef PNG_READ_pHYs_SUPPORTED
    png_debug(1, "in png_get_pixel_aspect_ratio");
@@ -766,7 +766,6 @@ png_get_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
    }
 
    return 0;
-
 }
 #endif
 
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h b/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h
index 4cfae474751..b413b510acf 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h
@@ -31,9 +31,9 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  */
-/* libpng version 1.6.51 */
+/* libpng version 1.6.54 */
 
-/* Copyright (c) 2018-2025 Cosmin Truta */
+/* Copyright (c) 2018-2026 Cosmin Truta */
 /* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson */
 
 /* This code is released under the libpng license. */
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngmem.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngmem.c
index 12b71bcbc02..8ec703616ec 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngmem.c
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngmem.c
@@ -75,7 +75,8 @@ png_destroy_png_struct(png_structrp png_ptr)
  * have the ability to do that.
  */
 PNG_FUNCTION(png_voidp,PNGAPI
-png_calloc,(png_const_structrp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
+png_calloc,(png_const_structrp png_ptr, png_alloc_size_t size),
+    PNG_ALLOCATED)
 {
    png_voidp ret;
 
@@ -147,7 +148,8 @@ png_malloc_array_checked(png_const_structrp png_ptr, int nelements,
 
 PNG_FUNCTION(png_voidp /* PRIVATE */,
 png_malloc_array,(png_const_structrp png_ptr, int nelements,
-    size_t element_size),PNG_ALLOCATED)
+    size_t element_size),
+    PNG_ALLOCATED)
 {
    if (nelements <= 0 || element_size == 0)
       png_error(png_ptr, "internal error: array alloc");
@@ -157,7 +159,8 @@ png_malloc_array,(png_const_structrp png_ptr, int nelements,
 
 PNG_FUNCTION(png_voidp /* PRIVATE */,
 png_realloc_array,(png_const_structrp png_ptr, png_const_voidp old_array,
-    int old_elements, int add_elements, size_t element_size),PNG_ALLOCATED)
+    int old_elements, int add_elements, size_t element_size),
+    PNG_ALLOCATED)
 {
    /* These are internal errors: */
    if (add_elements <= 0 || element_size == 0 || old_elements < 0 ||
@@ -196,7 +199,8 @@ png_realloc_array,(png_const_structrp png_ptr, png_const_voidp old_array,
  * function png_malloc_default is also provided.
  */
 PNG_FUNCTION(png_voidp,PNGAPI
-png_malloc,(png_const_structrp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
+png_malloc,(png_const_structrp png_ptr, png_alloc_size_t size),
+    PNG_ALLOCATED)
 {
    png_voidp ret;
 
@@ -270,7 +274,8 @@ png_free(png_const_structrp png_ptr, png_voidp ptr)
 }
 
 PNG_FUNCTION(void,PNGAPI
-png_free_default,(png_const_structrp png_ptr, png_voidp ptr),PNG_DEPRECATED)
+png_free_default,(png_const_structrp png_ptr, png_voidp ptr),
+    PNG_DEPRECATED)
 {
    if (png_ptr == NULL || ptr == NULL)
       return;
@@ -284,8 +289,8 @@ png_free_default,(png_const_structrp png_ptr, png_voidp ptr),PNG_DEPRECATED)
  * of allocating and freeing memory.
  */
 void PNGAPI
-png_set_mem_fn(png_structrp png_ptr, png_voidp mem_ptr, png_malloc_ptr
-  malloc_fn, png_free_ptr free_fn)
+png_set_mem_fn(png_structrp png_ptr, png_voidp mem_ptr,
+    png_malloc_ptr malloc_fn, png_free_ptr free_fn)
 {
    if (png_ptr != NULL)
    {
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngpriv.h b/src/java.desktop/share/native/libsplashscreen/libpng/pngpriv.h
index dcd005efb34..ee91f58d4ba 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngpriv.h
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngpriv.h
@@ -1104,15 +1104,17 @@ extern "C" {
  */
 /* Zlib support */
 #define PNG_UNEXPECTED_ZLIB_RETURN (-7)
-PNG_INTERNAL_FUNCTION(void, png_zstream_error,(png_structrp png_ptr, int ret),
+PNG_INTERNAL_FUNCTION(void, png_zstream_error,
+   (png_structrp png_ptr, int ret),
    PNG_EMPTY);
    /* Used by the zlib handling functions to ensure that z_stream::msg is always
     * set before they return.
     */
 
 #ifdef PNG_WRITE_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_free_buffer_list,(png_structrp png_ptr,
-   png_compression_bufferp *list),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_free_buffer_list,
+   (png_structrp png_ptr, png_compression_bufferp *list),
+   PNG_EMPTY);
    /* Free the buffer list used by the compressed write code. */
 #endif
 
@@ -1124,22 +1126,25 @@ PNG_INTERNAL_FUNCTION(void,png_free_buffer_list,(png_structrp png_ptr,
    defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)) || \
    (defined(PNG_sCAL_SUPPORTED) && \
    defined(PNG_FLOATING_ARITHMETIC_SUPPORTED))
-PNG_INTERNAL_FUNCTION(png_fixed_point,png_fixed,(png_const_structrp png_ptr,
-   double fp, png_const_charp text),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(png_fixed_point, png_fixed,
+   (png_const_structrp png_ptr, double fp, png_const_charp text),
+   PNG_EMPTY);
 #endif
 
 #if defined(PNG_FLOATING_POINT_SUPPORTED) && \
    !defined(PNG_FIXED_POINT_MACRO_SUPPORTED) && \
    (defined(PNG_cLLI_SUPPORTED) || defined(PNG_mDCV_SUPPORTED))
-PNG_INTERNAL_FUNCTION(png_uint_32,png_fixed_ITU,(png_const_structrp png_ptr,
-   double fp, png_const_charp text),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(png_uint_32, png_fixed_ITU,
+   (png_const_structrp png_ptr, double fp, png_const_charp text),
+   PNG_EMPTY);
 #endif
 
 /* Check the user version string for compatibility, returns false if the version
  * numbers aren't compatible.
  */
-PNG_INTERNAL_FUNCTION(int,png_user_version_check,(png_structrp png_ptr,
-   png_const_charp user_png_ver),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(int, png_user_version_check,
+   (png_structrp png_ptr, png_const_charp user_png_ver),
+   PNG_EMPTY);
 
 #ifdef PNG_READ_SUPPORTED /* should only be used on read */
 /* Security: read limits on the largest allocations while reading a PNG.  This
@@ -1164,24 +1169,28 @@ PNG_INTERNAL_FUNCTION(int,png_user_version_check,(png_structrp png_ptr,
  * does, however, call the application provided allocator and that could call
  * png_error (although that would be a bug in the application implementation.)
  */
-PNG_INTERNAL_FUNCTION(png_voidp,png_malloc_base,(png_const_structrp png_ptr,
-   png_alloc_size_t size),PNG_ALLOCATED);
+PNG_INTERNAL_FUNCTION(png_voidp, png_malloc_base,
+   (png_const_structrp png_ptr, png_alloc_size_t size),
+   PNG_ALLOCATED);
 
 #if defined(PNG_TEXT_SUPPORTED) || defined(PNG_sPLT_SUPPORTED) ||\
    defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED)
 /* Internal array allocator, outputs no error or warning messages on failure,
  * just returns NULL.
  */
-PNG_INTERNAL_FUNCTION(png_voidp,png_malloc_array,(png_const_structrp png_ptr,
-   int nelements, size_t element_size),PNG_ALLOCATED);
+PNG_INTERNAL_FUNCTION(png_voidp, png_malloc_array,
+   (png_const_structrp png_ptr, int nelements, size_t element_size),
+   PNG_ALLOCATED);
 
 /* The same but an existing array is extended by add_elements.  This function
  * also memsets the new elements to 0 and copies the old elements.  The old
  * array is not freed or altered.
  */
-PNG_INTERNAL_FUNCTION(png_voidp,png_realloc_array,(png_const_structrp png_ptr,
-   png_const_voidp array, int old_elements, int add_elements,
-   size_t element_size),PNG_ALLOCATED);
+PNG_INTERNAL_FUNCTION(png_voidp, png_realloc_array,
+   (png_const_structrp png_ptr,
+    png_const_voidp array, int old_elements, int add_elements,
+    size_t element_size),
+   PNG_ALLOCATED);
 #endif /* text, sPLT or unknown chunks */
 
 /* Magic to create a struct when there is no struct to call the user supplied
@@ -1190,84 +1199,106 @@ PNG_INTERNAL_FUNCTION(png_voidp,png_realloc_array,(png_const_structrp png_ptr,
  * restriction so libpng has to assume that the 'free' handler, at least, might
  * call png_error.
  */
-PNG_INTERNAL_FUNCTION(png_structp,png_create_png_struct,
-   (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn,
-    png_error_ptr warn_fn, png_voidp mem_ptr, png_malloc_ptr malloc_fn,
-    png_free_ptr free_fn),PNG_ALLOCATED);
+PNG_INTERNAL_FUNCTION(png_structp, png_create_png_struct,
+   (png_const_charp user_png_ver,
+    png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn,
+    png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn),
+   PNG_ALLOCATED);
 
 /* Free memory from internal libpng struct */
-PNG_INTERNAL_FUNCTION(void,png_destroy_png_struct,(png_structrp png_ptr),
+PNG_INTERNAL_FUNCTION(void, png_destroy_png_struct,
+   (png_structrp png_ptr),
    PNG_EMPTY);
 
 /* Free an allocated jmp_buf (always succeeds) */
-PNG_INTERNAL_FUNCTION(void,png_free_jmpbuf,(png_structrp png_ptr),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_free_jmpbuf,
+   (png_structrp png_ptr),
+   PNG_EMPTY);
 
 /* Function to allocate memory for zlib.  PNGAPI is disallowed. */
-PNG_INTERNAL_FUNCTION(voidpf,png_zalloc,(voidpf png_ptr, uInt items, uInt size),
+PNG_INTERNAL_FUNCTION(voidpf, png_zalloc,
+   (voidpf png_ptr, uInt items, uInt size),
    PNG_ALLOCATED);
 
 /* Function to free memory for zlib.  PNGAPI is disallowed. */
-PNG_INTERNAL_FUNCTION(void,png_zfree,(voidpf png_ptr, voidpf ptr),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_zfree,
+   (voidpf png_ptr, voidpf ptr),
+   PNG_EMPTY);
 
 /* Next four functions are used internally as callbacks.  PNGCBAPI is required
  * but not PNG_EXPORT.  PNGAPI added at libpng version 1.2.3, changed to
  * PNGCBAPI at 1.5.0
  */
 
-PNG_INTERNAL_FUNCTION(void PNGCBAPI,png_default_read_data,(png_structp png_ptr,
-    png_bytep data, size_t length),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void PNGCBAPI, png_default_read_data,
+   (png_structp png_ptr, png_bytep data, size_t length),
+   PNG_EMPTY);
 
 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
-PNG_INTERNAL_FUNCTION(void PNGCBAPI,png_push_fill_buffer,(png_structp png_ptr,
-    png_bytep buffer, size_t length),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void PNGCBAPI, png_push_fill_buffer,
+   (png_structp png_ptr, png_bytep buffer, size_t length),
+   PNG_EMPTY);
 #endif
 
-PNG_INTERNAL_FUNCTION(void PNGCBAPI,png_default_write_data,(png_structp png_ptr,
-    png_bytep data, size_t length),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void PNGCBAPI, png_default_write_data,
+   (png_structp png_ptr, png_bytep data, size_t length),
+   PNG_EMPTY);
 
 #ifdef PNG_WRITE_FLUSH_SUPPORTED
 #  ifdef PNG_STDIO_SUPPORTED
-PNG_INTERNAL_FUNCTION(void PNGCBAPI,png_default_flush,(png_structp png_ptr),
+PNG_INTERNAL_FUNCTION(void PNGCBAPI, png_default_flush,
+   (png_structp png_ptr),
    PNG_EMPTY);
 #  endif
 #endif
 
 /* Reset the CRC variable */
-PNG_INTERNAL_FUNCTION(void,png_reset_crc,(png_structrp png_ptr),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_reset_crc,
+   (png_structrp png_ptr),
+   PNG_EMPTY);
 
 /* Write the "data" buffer to whatever output you are using */
-PNG_INTERNAL_FUNCTION(void,png_write_data,(png_structrp png_ptr,
-    png_const_bytep data, size_t length),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_write_data,
+   (png_structrp png_ptr, png_const_bytep data, size_t length),
+   PNG_EMPTY);
 
 /* Read and check the PNG file signature */
-PNG_INTERNAL_FUNCTION(void,png_read_sig,(png_structrp png_ptr,
-   png_inforp info_ptr),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_sig,
+   (png_structrp png_ptr, png_inforp info_ptr),
+   PNG_EMPTY);
 
 /* Read the chunk header (length + type name) */
-PNG_INTERNAL_FUNCTION(png_uint_32,png_read_chunk_header,(png_structrp png_ptr),
+PNG_INTERNAL_FUNCTION(png_uint_32, png_read_chunk_header,
+   (png_structrp png_ptr),
    PNG_EMPTY);
 
 /* Read data from whatever input you are using into the "data" buffer */
-PNG_INTERNAL_FUNCTION(void,png_read_data,(png_structrp png_ptr, png_bytep data,
-    size_t length),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_data,
+   (png_structrp png_ptr, png_bytep data, size_t length),
+   PNG_EMPTY);
 
 /* Read bytes into buf, and update png_ptr->crc */
-PNG_INTERNAL_FUNCTION(void,png_crc_read,(png_structrp png_ptr, png_bytep buf,
-    png_uint_32 length),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_crc_read,
+   (png_structrp png_ptr, png_bytep buf, png_uint_32 length),
+   PNG_EMPTY);
 
 /* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */
-PNG_INTERNAL_FUNCTION(int,png_crc_finish,(png_structrp png_ptr,
-   png_uint_32 skip),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(int, png_crc_finish,
+   (png_structrp png_ptr, png_uint_32 skip),
+   PNG_EMPTY);
 
 /* Calculate the CRC over a section of data.  Note that we are only
  * passing a maximum of 64K on systems that have this as a memory limit,
  * since this is the maximum buffer size we can specify.
  */
-PNG_INTERNAL_FUNCTION(void,png_calculate_crc,(png_structrp png_ptr,
-   png_const_bytep ptr, size_t length),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_calculate_crc,
+   (png_structrp png_ptr, png_const_bytep ptr, size_t length),
+   PNG_EMPTY);
 
 #ifdef PNG_WRITE_FLUSH_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_flush,(png_structrp png_ptr),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_flush,
+   (png_structrp png_ptr),
+   PNG_EMPTY);
 #endif
 
 /* Write various chunks */
@@ -1275,68 +1306,86 @@ PNG_INTERNAL_FUNCTION(void,png_flush,(png_structrp png_ptr),PNG_EMPTY);
 /* Write the IHDR chunk, and update the png_struct with the necessary
  * information.
  */
-PNG_INTERNAL_FUNCTION(void,png_write_IHDR,(png_structrp png_ptr,
-   png_uint_32 width, png_uint_32 height, int bit_depth, int color_type,
-   int compression_method, int filter_method, int interlace_method),PNG_EMPTY);
-
-PNG_INTERNAL_FUNCTION(void,png_write_PLTE,(png_structrp png_ptr,
-   png_const_colorp palette, png_uint_32 num_pal),PNG_EMPTY);
-
-PNG_INTERNAL_FUNCTION(void,png_compress_IDAT,(png_structrp png_ptr,
-   png_const_bytep row_data, png_alloc_size_t row_data_length, int flush),
+PNG_INTERNAL_FUNCTION(void, png_write_IHDR,
+   (png_structrp png_ptr,
+    png_uint_32 width, png_uint_32 height, int bit_depth, int color_type,
+    int compression_method, int filter_method, int interlace_method),
    PNG_EMPTY);
 
-PNG_INTERNAL_FUNCTION(void,png_write_IEND,(png_structrp png_ptr),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_write_PLTE,
+   (png_structrp png_ptr,
+    png_const_colorp palette, png_uint_32 num_pal),
+   PNG_EMPTY);
+
+PNG_INTERNAL_FUNCTION(void, png_compress_IDAT,
+   (png_structrp png_ptr,
+    png_const_bytep row_data, png_alloc_size_t row_data_length, int flush),
+   PNG_EMPTY);
+
+PNG_INTERNAL_FUNCTION(void, png_write_IEND,
+   (png_structrp png_ptr),
+   PNG_EMPTY);
 
 #ifdef PNG_WRITE_gAMA_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_write_gAMA_fixed,(png_structrp png_ptr,
-    png_fixed_point file_gamma),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_write_gAMA_fixed,
+   (png_structrp png_ptr, png_fixed_point file_gamma),
+   PNG_EMPTY);
 #endif
 
 #ifdef PNG_WRITE_sBIT_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_write_sBIT,(png_structrp png_ptr,
-    png_const_color_8p sbit, int color_type),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_write_sBIT,
+   (png_structrp png_ptr, png_const_color_8p sbit, int color_type),
+   PNG_EMPTY);
 #endif
 
 #ifdef PNG_WRITE_cHRM_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_write_cHRM_fixed,(png_structrp png_ptr,
-    const png_xy *xy), PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_write_cHRM_fixed,
+   (png_structrp png_ptr, const png_xy *xy),
+   PNG_EMPTY);
    /* The xy value must have been previously validated */
 #endif
 
 #ifdef PNG_WRITE_cICP_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_write_cICP,(png_structrp png_ptr,
+PNG_INTERNAL_FUNCTION(void, png_write_cICP,
+   (png_structrp png_ptr,
     png_byte colour_primaries, png_byte transfer_function,
-    png_byte matrix_coefficients, png_byte video_full_range_flag), PNG_EMPTY);
+    png_byte matrix_coefficients, png_byte video_full_range_flag),
+   PNG_EMPTY);
 #endif
 
 #ifdef PNG_WRITE_cLLI_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_write_cLLI_fixed,(png_structrp png_ptr,
-   png_uint_32 maxCLL, png_uint_32 maxFALL), PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_write_cLLI_fixed,
+   (png_structrp png_ptr, png_uint_32 maxCLL, png_uint_32 maxFALL),
+   PNG_EMPTY);
 #endif
 
 #ifdef PNG_WRITE_mDCV_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_write_mDCV_fixed,(png_structrp png_ptr,
-   png_uint_16 red_x, png_uint_16 red_y,
-   png_uint_16 green_x, png_uint_16 green_y,
-   png_uint_16 blue_x, png_uint_16 blue_y,
-   png_uint_16 white_x, png_uint_16 white_y,
-   png_uint_32 maxDL, png_uint_32 minDL), PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_write_mDCV_fixed,
+   (png_structrp png_ptr,
+    png_uint_16 red_x, png_uint_16 red_y,
+    png_uint_16 green_x, png_uint_16 green_y,
+    png_uint_16 blue_x, png_uint_16 blue_y,
+    png_uint_16 white_x, png_uint_16 white_y,
+    png_uint_32 maxDL, png_uint_32 minDL),
+   PNG_EMPTY);
 #endif
 
 #ifdef PNG_WRITE_sRGB_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_write_sRGB,(png_structrp png_ptr,
-    int intent),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_write_sRGB,
+   (png_structrp png_ptr, int intent),
+   PNG_EMPTY);
 #endif
 
 #ifdef PNG_WRITE_eXIf_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_write_eXIf,(png_structrp png_ptr,
-    png_bytep exif, int num_exif),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_write_eXIf,
+   (png_structrp png_ptr, png_bytep exif, int num_exif),
+   PNG_EMPTY);
 #endif
 
 #ifdef PNG_WRITE_iCCP_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_write_iCCP,(png_structrp png_ptr,
-   png_const_charp name, png_const_bytep profile, png_uint_32 proflen),
+PNG_INTERNAL_FUNCTION(void, png_write_iCCP,
+   (png_structrp png_ptr,
+    png_const_charp name, png_const_bytep profile, png_uint_32 proflen),
    PNG_EMPTY);
    /* Writes a previously 'set' profile.  The profile argument is **not**
     * compressed.
@@ -1344,82 +1393,106 @@ PNG_INTERNAL_FUNCTION(void,png_write_iCCP,(png_structrp png_ptr,
 #endif
 
 #ifdef PNG_WRITE_sPLT_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_write_sPLT,(png_structrp png_ptr,
-    png_const_sPLT_tp palette),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_write_sPLT,
+   (png_structrp png_ptr, png_const_sPLT_tp palette),
+   PNG_EMPTY);
 #endif
 
 #ifdef PNG_WRITE_tRNS_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_write_tRNS,(png_structrp png_ptr,
+PNG_INTERNAL_FUNCTION(void, png_write_tRNS,
+   (png_structrp png_ptr,
     png_const_bytep trans, png_const_color_16p values, int number,
-    int color_type),PNG_EMPTY);
+    int color_type),
+   PNG_EMPTY);
 #endif
 
 #ifdef PNG_WRITE_bKGD_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_write_bKGD,(png_structrp png_ptr,
-    png_const_color_16p values, int color_type),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_write_bKGD,
+   (png_structrp png_ptr, png_const_color_16p values, int color_type),
+   PNG_EMPTY);
 #endif
 
 #ifdef PNG_WRITE_hIST_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_write_hIST,(png_structrp png_ptr,
-    png_const_uint_16p hist, int num_hist),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_write_hIST,
+   (png_structrp png_ptr, png_const_uint_16p hist, int num_hist),
+   PNG_EMPTY);
 #endif
 
 /* Chunks that have keywords */
 #ifdef PNG_WRITE_tEXt_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_write_tEXt,(png_structrp png_ptr,
-   png_const_charp key, png_const_charp text, size_t text_len),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_write_tEXt,
+   (png_structrp png_ptr,
+    png_const_charp key, png_const_charp text, size_t text_len),
+   PNG_EMPTY);
 #endif
 
 #ifdef PNG_WRITE_zTXt_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_write_zTXt,(png_structrp png_ptr, png_const_charp
-    key, png_const_charp text, int compression),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_write_zTXt,
+   (png_structrp png_ptr,
+    png_const_charp key, png_const_charp text, int compression),
+   PNG_EMPTY);
 #endif
 
 #ifdef PNG_WRITE_iTXt_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_write_iTXt,(png_structrp png_ptr,
+PNG_INTERNAL_FUNCTION(void, png_write_iTXt,
+   (png_structrp png_ptr,
     int compression, png_const_charp key, png_const_charp lang,
-    png_const_charp lang_key, png_const_charp text),PNG_EMPTY);
+    png_const_charp lang_key, png_const_charp text),
+   PNG_EMPTY);
 #endif
 
 #ifdef PNG_TEXT_SUPPORTED  /* Added at version 1.0.14 and 1.2.4 */
-PNG_INTERNAL_FUNCTION(int,png_set_text_2,(png_const_structrp png_ptr,
-    png_inforp info_ptr, png_const_textp text_ptr, int num_text),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(int, png_set_text_2,
+   (png_const_structrp png_ptr,
+    png_inforp info_ptr, png_const_textp text_ptr, int num_text),
+   PNG_EMPTY);
 #endif
 
 #ifdef PNG_WRITE_oFFs_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_write_oFFs,(png_structrp png_ptr,
-    png_int_32 x_offset, png_int_32 y_offset, int unit_type),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_write_oFFs,
+   (png_structrp png_ptr,
+    png_int_32 x_offset, png_int_32 y_offset, int unit_type),
+   PNG_EMPTY);
 #endif
 
 #ifdef PNG_WRITE_pCAL_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_write_pCAL,(png_structrp png_ptr,
-    png_charp purpose, png_int_32 X0, png_int_32 X1, int type, int nparams,
-    png_const_charp units, png_charpp params),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_write_pCAL,
+   (png_structrp png_ptr,
+    png_charp purpose, png_int_32 X0, png_int_32 X1,
+    int type, int nparams, png_const_charp units, png_charpp params),
+   PNG_EMPTY);
 #endif
 
 #ifdef PNG_WRITE_pHYs_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_write_pHYs,(png_structrp png_ptr,
+PNG_INTERNAL_FUNCTION(void, png_write_pHYs,
+   (png_structrp png_ptr,
     png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit,
-    int unit_type),PNG_EMPTY);
+    int unit_type),
+   PNG_EMPTY);
 #endif
 
 #ifdef PNG_WRITE_tIME_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_write_tIME,(png_structrp png_ptr,
-    png_const_timep mod_time),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_write_tIME,
+   (png_structrp png_ptr, png_const_timep mod_time),
+   PNG_EMPTY);
 #endif
 
 #ifdef PNG_WRITE_sCAL_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_write_sCAL_s,(png_structrp png_ptr,
-    int unit, png_const_charp width, png_const_charp height),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_write_sCAL_s,
+   (png_structrp png_ptr,
+    int unit, png_const_charp width, png_const_charp height),
+   PNG_EMPTY);
 #endif
 
 /* Called when finished processing a row of data */
-PNG_INTERNAL_FUNCTION(void,png_write_finish_row,(png_structrp png_ptr),
-    PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_write_finish_row,
+   (png_structrp png_ptr),
+   PNG_EMPTY);
 
 /* Internal use only.   Called before first row of data */
-PNG_INTERNAL_FUNCTION(void,png_write_start_row,(png_structrp png_ptr),
-    PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_write_start_row,
+   (png_structrp png_ptr),
+   PNG_EMPTY);
 
 /* Combine a row of data, dealing with alpha, etc. if requested.  'row' is an
  * array of png_ptr->width pixels.  If the image is not interlaced or this
@@ -1447,8 +1520,9 @@ PNG_INTERNAL_FUNCTION(void,png_write_start_row,(png_structrp png_ptr),
 #ifndef PNG_USE_COMPILE_TIME_MASKS
 #  define PNG_USE_COMPILE_TIME_MASKS 1
 #endif
-PNG_INTERNAL_FUNCTION(void,png_combine_row,(png_const_structrp png_ptr,
-    png_bytep row, int display),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_combine_row,
+   (png_const_structrp png_ptr, png_bytep row, int display),
+   PNG_EMPTY);
 
 #ifdef PNG_READ_INTERLACING_SUPPORTED
 /* Expand an interlaced row: the 'row_info' describes the pass data that has
@@ -1457,170 +1531,230 @@ PNG_INTERNAL_FUNCTION(void,png_combine_row,(png_const_structrp png_ptr,
  * the pixels are *replicated* to the intervening space.  This is essential for
  * the correct operation of png_combine_row, above.
  */
-PNG_INTERNAL_FUNCTION(void,png_do_read_interlace,(png_row_infop row_info,
-    png_bytep row, int pass, png_uint_32 transformations),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_do_read_interlace,
+   (png_row_infop row_info,
+    png_bytep row, int pass, png_uint_32 transformations),
+   PNG_EMPTY);
 #endif
 
 /* GRR TO DO (2.0 or whenever):  simplify other internal calling interfaces */
 
 #ifdef PNG_WRITE_INTERLACING_SUPPORTED
 /* Grab pixels out of a row for an interlaced pass */
-PNG_INTERNAL_FUNCTION(void,png_do_write_interlace,(png_row_infop row_info,
-    png_bytep row, int pass),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_do_write_interlace,
+   (png_row_infop row_info, png_bytep row, int pass),
+   PNG_EMPTY);
 #endif
 
 /* Unfilter a row: check the filter value before calling this, there is no point
  * calling it for PNG_FILTER_VALUE_NONE.
  */
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row,(png_structrp pp, png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row, int filter),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row,
+   (png_structrp pp, png_row_infop row_info,
+    png_bytep row, png_const_bytep prev_row, int filter),
+   PNG_EMPTY);
 
 #if PNG_ARM_NEON_OPT > 0
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_neon,(png_row_infop row_info,
-    png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_neon,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_neon,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_neon,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_neon,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_neon,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_neon,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_up_neon,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_sub3_neon,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_sub4_neon,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_avg3_neon,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_avg4_neon,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_paeth3_neon,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_paeth4_neon,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
 #endif
 
 #if PNG_MIPS_MSA_IMPLEMENTATION == 1
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_msa,(png_row_infop row_info,
-    png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_msa,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_msa,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_msa,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_msa,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_msa,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_msa,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_up_msa,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_sub3_msa,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_sub4_msa,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_avg3_msa,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_avg4_msa,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_paeth3_msa,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_paeth4_msa,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
 #endif
 
 #if PNG_MIPS_MMI_IMPLEMENTATION > 0
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_mmi,(png_row_infop row_info,
-    png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_mmi,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_mmi,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_mmi,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_mmi,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_mmi,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_mmi,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_up_mmi,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_sub3_mmi,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_sub4_mmi,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_avg3_mmi,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_avg4_mmi,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_paeth3_mmi,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_paeth4_mmi,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
 #endif
 
 #if PNG_POWERPC_VSX_OPT > 0
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_vsx,(png_row_infop row_info,
-    png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_vsx,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_vsx,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_vsx,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_vsx,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_vsx,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_vsx,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_up_vsx,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_sub3_vsx,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_sub4_vsx,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_avg3_vsx,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_avg4_vsx,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_paeth3_vsx,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_paeth4_vsx,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
 #endif
 
 #if PNG_INTEL_SSE_IMPLEMENTATION > 0
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_sse2,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_sse2,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_sse2,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_sse2,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_sse2,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_sse2,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_sub3_sse2,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_sub4_sse2,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_avg3_sse2,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_avg4_sse2,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_paeth3_sse2,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_paeth4_sse2,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
 #endif
 
 #if PNG_LOONGARCH_LSX_IMPLEMENTATION == 1
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_lsx,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_lsx,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_lsx,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_lsx,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_lsx,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_lsx,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_lsx,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_up_lsx,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_sub3_lsx,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_sub4_lsx,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_avg3_lsx,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_avg4_lsx,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_paeth3_lsx,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_paeth4_lsx,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
 #endif
 
 #if PNG_RISCV_RVV_IMPLEMENTATION == 1
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_rvv,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_rvv,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_rvv,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_rvv,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_rvv,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_rvv,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_rvv,(png_row_infop
-    row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_up_rvv,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_sub3_rvv,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_sub4_rvv,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_avg3_rvv,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_avg4_rvv,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_paeth3_rvv,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_filter_row_paeth4_rvv,
+   (png_row_infop row_info, png_bytep row, png_const_bytep prev_row),
+   PNG_EMPTY);
 #endif
 
 /* Choose the best filter to use and filter the row data */
-PNG_INTERNAL_FUNCTION(void,png_write_find_filter,(png_structrp png_ptr,
-    png_row_infop row_info),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_write_find_filter,
+   (png_structrp png_ptr, png_row_infop row_info),
+   PNG_EMPTY);
 
 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_read_IDAT_data,(png_structrp png_ptr,
-   png_bytep output, png_alloc_size_t avail_out),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_IDAT_data,
+   (png_structrp png_ptr, png_bytep output, png_alloc_size_t avail_out),
+   PNG_EMPTY);
    /* Read 'avail_out' bytes of data from the IDAT stream.  If the output buffer
     * is NULL the function checks, instead, for the end of the stream.  In this
     * case a benign error will be issued if the stream end is not found or if
     * extra data has to be consumed.
     */
-PNG_INTERNAL_FUNCTION(void,png_read_finish_IDAT,(png_structrp png_ptr),
+PNG_INTERNAL_FUNCTION(void, png_read_finish_IDAT,
+   (png_structrp png_ptr),
    PNG_EMPTY);
    /* This cleans up when the IDAT LZ stream does not end when the last image
     * byte is read; there is still some pending input.
     */
 
-PNG_INTERNAL_FUNCTION(void,png_read_finish_row,(png_structrp png_ptr),
+PNG_INTERNAL_FUNCTION(void, png_read_finish_row,
+   (png_structrp png_ptr),
    PNG_EMPTY);
    /* Finish a row while reading, dealing with interlacing passes, etc. */
 #endif /* SEQUENTIAL_READ */
 
 /* Initialize the row buffers, etc. */
-PNG_INTERNAL_FUNCTION(void,png_read_start_row,(png_structrp png_ptr),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_start_row,
+   (png_structrp png_ptr),
+   PNG_EMPTY);
 
 #if ZLIB_VERNUM >= 0x1240
-PNG_INTERNAL_FUNCTION(int,png_zlib_inflate,(png_structrp png_ptr, int flush),
-      PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(int, png_zlib_inflate,
+   (png_structrp png_ptr, int flush),
+   PNG_EMPTY);
 #  define PNG_INFLATE(pp, flush) png_zlib_inflate(pp, flush)
 #else /* Zlib < 1.2.4 */
 #  define PNG_INFLATE(pp, flush) inflate(&(pp)->zstream, flush)
@@ -1628,38 +1762,44 @@ PNG_INTERNAL_FUNCTION(int,png_zlib_inflate,(png_structrp png_ptr, int flush),
 
 #ifdef PNG_READ_TRANSFORMS_SUPPORTED
 /* Optional call to update the users info structure */
-PNG_INTERNAL_FUNCTION(void,png_read_transform_info,(png_structrp png_ptr,
-    png_inforp info_ptr),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_transform_info,
+   (png_structrp png_ptr, png_inforp info_ptr),
+   PNG_EMPTY);
 #endif
 
 /* Shared transform functions, defined in pngtran.c */
 #if defined(PNG_WRITE_FILLER_SUPPORTED) || \
     defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
-PNG_INTERNAL_FUNCTION(void,png_do_strip_channel,(png_row_infop row_info,
-    png_bytep row, int at_start),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_do_strip_channel,
+   (png_row_infop row_info, png_bytep row, int at_start),
+   PNG_EMPTY);
 #endif
 
 #ifdef PNG_16BIT_SUPPORTED
 #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
-PNG_INTERNAL_FUNCTION(void,png_do_swap,(png_row_infop row_info,
-    png_bytep row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_do_swap,
+   (png_row_infop row_info, png_bytep row),
+   PNG_EMPTY);
 #endif
 #endif
 
 #if defined(PNG_READ_PACKSWAP_SUPPORTED) || \
     defined(PNG_WRITE_PACKSWAP_SUPPORTED)
-PNG_INTERNAL_FUNCTION(void,png_do_packswap,(png_row_infop row_info,
-    png_bytep row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_do_packswap,
+   (png_row_infop row_info, png_bytep row),
+   PNG_EMPTY);
 #endif
 
 #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
-PNG_INTERNAL_FUNCTION(void,png_do_invert,(png_row_infop row_info,
-    png_bytep row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_do_invert,
+   (png_row_infop row_info, png_bytep row),
+   PNG_EMPTY);
 #endif
 
 #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
-PNG_INTERNAL_FUNCTION(void,png_do_bgr,(png_row_infop row_info,
-    png_bytep row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_do_bgr,
+   (png_row_infop row_info, png_bytep row),
+   PNG_EMPTY);
 #endif
 
 /* The following decodes the appropriate chunks, and does error correction,
@@ -1680,25 +1820,27 @@ typedef enum
    handled_ok          /* known, supported and handled without error */
 } png_handle_result_code;
 
-PNG_INTERNAL_FUNCTION(png_handle_result_code,png_handle_unknown,
-    (png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length, int keep),
-    PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(png_handle_result_code, png_handle_unknown,
+   (png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length, int keep),
+   PNG_EMPTY);
    /* This is the function that gets called for unknown chunks.  The 'keep'
     * argument is either non-zero for a known chunk that has been set to be
     * handled as unknown or zero for an unknown chunk.  By default the function
     * just skips the chunk or errors out if it is critical.
     */
 
-PNG_INTERNAL_FUNCTION(png_handle_result_code,png_handle_chunk,
-    (png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(png_handle_result_code, png_handle_chunk,
+   (png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length),
+   PNG_EMPTY);
    /* This handles the current chunk png_ptr->chunk_name with unread
     * data[length] and returns one of the above result codes.
     */
 
 #if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) ||\
     defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
-PNG_INTERNAL_FUNCTION(int,png_chunk_unknown_handling,
-    (png_const_structrp png_ptr, png_uint_32 chunk_name),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(int, png_chunk_unknown_handling,
+   (png_const_structrp png_ptr, png_uint_32 chunk_name),
+   PNG_EMPTY);
    /* Exactly as the API png_handle_as_unknown() except that the argument is a
     * 32-bit chunk name, not a string.
     */
@@ -1706,93 +1848,122 @@ PNG_INTERNAL_FUNCTION(int,png_chunk_unknown_handling,
 
 /* Handle the transformations for reading and writing */
 #ifdef PNG_READ_TRANSFORMS_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_do_read_transformations,(png_structrp png_ptr,
-   png_row_infop row_info),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_do_read_transformations,
+   (png_structrp png_ptr, png_row_infop row_info),
+   PNG_EMPTY);
 #endif
 #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_do_write_transformations,(png_structrp png_ptr,
-   png_row_infop row_info),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_do_write_transformations,
+   (png_structrp png_ptr, png_row_infop row_info),
+   PNG_EMPTY);
 #endif
 
 #ifdef PNG_READ_TRANSFORMS_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_init_read_transformations,(png_structrp png_ptr),
-    PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_init_read_transformations,
+   (png_structrp png_ptr),
+   PNG_EMPTY);
 #endif
 
 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_push_read_chunk,(png_structrp png_ptr,
-    png_inforp info_ptr),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_push_read_sig,(png_structrp png_ptr,
-    png_inforp info_ptr),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_push_check_crc,(png_structrp png_ptr),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_push_save_buffer,(png_structrp png_ptr),
-    PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_push_restore_buffer,(png_structrp png_ptr,
-    png_bytep buffer, size_t buffer_length),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_push_read_IDAT,(png_structrp png_ptr),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_process_IDAT_data,(png_structrp png_ptr,
-    png_bytep buffer, size_t buffer_length),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_push_process_row,(png_structrp png_ptr),
-    PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_push_have_info,(png_structrp png_ptr,
-   png_inforp info_ptr),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_push_have_end,(png_structrp png_ptr,
-   png_inforp info_ptr),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_push_have_row,(png_structrp png_ptr,
-    png_bytep row),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_push_read_end,(png_structrp png_ptr,
-    png_inforp info_ptr),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_process_some_data,(png_structrp png_ptr,
-    png_inforp info_ptr),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_read_push_finish_row,(png_structrp png_ptr),
-    PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_push_read_chunk,
+   (png_structrp png_ptr, png_inforp info_ptr),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_push_read_sig,
+   (png_structrp png_ptr, png_inforp info_ptr),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_push_check_crc,
+   (png_structrp png_ptr),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_push_save_buffer,
+   (png_structrp png_ptr),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_push_restore_buffer,
+   (png_structrp png_ptr, png_bytep buffer, size_t buffer_length),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_push_read_IDAT,
+   (png_structrp png_ptr),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_process_IDAT_data,
+   (png_structrp png_ptr, png_bytep buffer, size_t buffer_length),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_push_process_row,
+   (png_structrp png_ptr),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_push_have_info,
+   (png_structrp png_ptr, png_inforp info_ptr),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_push_have_end,
+   (png_structrp png_ptr, png_inforp info_ptr),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_push_have_row,
+   (png_structrp png_ptr, png_bytep row),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_push_read_end,
+   (png_structrp png_ptr, png_inforp info_ptr),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_process_some_data,
+   (png_structrp png_ptr, png_inforp info_ptr),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_read_push_finish_row,
+   (png_structrp png_ptr),
+   PNG_EMPTY);
 #endif /* PROGRESSIVE_READ */
 
 #ifdef PNG_iCCP_SUPPORTED
 /* Routines for checking parts of an ICC profile. */
 #ifdef PNG_READ_iCCP_SUPPORTED
-PNG_INTERNAL_FUNCTION(int,png_icc_check_length,(png_const_structrp png_ptr,
-   png_const_charp name, png_uint_32 profile_length), PNG_EMPTY);
-#endif /* READ_iCCP */
-PNG_INTERNAL_FUNCTION(int,png_icc_check_header,(png_const_structrp png_ptr,
-   png_const_charp name, png_uint_32 profile_length,
-   png_const_bytep profile /* first 132 bytes only */, int color_type),
+PNG_INTERNAL_FUNCTION(int, png_icc_check_length,
+   (png_const_structrp png_ptr,
+    png_const_charp name, png_uint_32 profile_length),
+   PNG_EMPTY);
+#endif /* READ_iCCP */
+PNG_INTERNAL_FUNCTION(int, png_icc_check_header,
+   (png_const_structrp png_ptr,
+    png_const_charp name, png_uint_32 profile_length,
+    png_const_bytep profile /* first 132 bytes only */, int color_type),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(int, png_icc_check_tag_table,
+   (png_const_structrp png_ptr,
+    png_const_charp name, png_uint_32 profile_length,
+    png_const_bytep profile /* header plus whole tag table */),
    PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(int,png_icc_check_tag_table,(png_const_structrp png_ptr,
-   png_const_charp name, png_uint_32 profile_length,
-   png_const_bytep profile /* header plus whole tag table */), PNG_EMPTY);
 #endif /* iCCP */
 
 #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_set_rgb_coefficients, (png_structrp png_ptr),
+PNG_INTERNAL_FUNCTION(void, png_set_rgb_coefficients,
+   (png_structrp png_ptr),
    PNG_EMPTY);
    /* Set the rgb_to_gray coefficients from the cHRM Y values (if unset) */
 #endif /* READ_RGB_TO_GRAY */
 
 /* Added at libpng version 1.4.0 */
-PNG_INTERNAL_FUNCTION(void,png_check_IHDR,(png_const_structrp png_ptr,
-    png_uint_32 width, png_uint_32 height, int bit_depth,
-    int color_type, int interlace_type, int compression_type,
-    int filter_type),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_check_IHDR,
+   (png_const_structrp png_ptr,
+    png_uint_32 width, png_uint_32 height, int bit_depth, int color_type,
+    int interlace_type, int compression_type, int filter_type),
+   PNG_EMPTY);
 
 /* Added at libpng version 1.5.10 */
 #if defined(PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED) || \
     defined(PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED)
-PNG_INTERNAL_FUNCTION(void,png_do_check_palette_indexes,
-   (png_structrp png_ptr, png_row_infop row_info),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_do_check_palette_indexes,
+   (png_structrp png_ptr, png_row_infop row_info),
+   PNG_EMPTY);
 #endif
 
 #if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED)
-PNG_INTERNAL_FUNCTION(void,png_fixed_error,(png_const_structrp png_ptr,
-   png_const_charp name),PNG_NORETURN);
+PNG_INTERNAL_FUNCTION(void, png_fixed_error,
+   (png_const_structrp png_ptr, png_const_charp name),
+   PNG_NORETURN);
 #endif
 
 /* Puts 'string' into 'buffer' at buffer[pos], taking care never to overwrite
  * the end.  Always leaves the buffer nul terminated.  Never errors out (and
  * there is no error code.)
  */
-PNG_INTERNAL_FUNCTION(size_t,png_safecat,(png_charp buffer, size_t bufsize,
-   size_t pos, png_const_charp string),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(size_t, png_safecat,
+   (png_charp buffer, size_t bufsize, size_t pos, png_const_charp string),
+   PNG_EMPTY);
 
 /* Various internal functions to handle formatted warning messages, currently
  * only implemented for warnings.
@@ -1803,8 +1974,9 @@ PNG_INTERNAL_FUNCTION(size_t,png_safecat,(png_charp buffer, size_t bufsize,
  * Returns the pointer to the start of the formatted string.  This utility only
  * does unsigned values.
  */
-PNG_INTERNAL_FUNCTION(png_charp,png_format_number,(png_const_charp start,
-   png_charp end, int format, png_alloc_size_t number),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(png_charp, png_format_number,
+   (png_const_charp start, png_charp end, int format, png_alloc_size_t number),
+   PNG_EMPTY);
 
 /* Convenience macro that takes an array: */
 #define PNG_FORMAT_NUMBER(buffer,format,number) \
@@ -1836,23 +2008,26 @@ PNG_INTERNAL_FUNCTION(png_charp,png_format_number,(png_const_charp start,
 typedef char png_warning_parameters[PNG_WARNING_PARAMETER_COUNT][
    PNG_WARNING_PARAMETER_SIZE];
 
-PNG_INTERNAL_FUNCTION(void,png_warning_parameter,(png_warning_parameters p,
-   int number, png_const_charp string),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_warning_parameter,
+   (png_warning_parameters p, int number, png_const_charp string),
+   PNG_EMPTY);
    /* Parameters are limited in size to PNG_WARNING_PARAMETER_SIZE characters,
     * including the trailing '\0'.
     */
-PNG_INTERNAL_FUNCTION(void,png_warning_parameter_unsigned,
+PNG_INTERNAL_FUNCTION(void, png_warning_parameter_unsigned,
    (png_warning_parameters p, int number, int format, png_alloc_size_t value),
    PNG_EMPTY);
    /* Use png_alloc_size_t because it is an unsigned type as big as any we
     * need to output.  Use the following for a signed value.
     */
-PNG_INTERNAL_FUNCTION(void,png_warning_parameter_signed,
+PNG_INTERNAL_FUNCTION(void, png_warning_parameter_signed,
    (png_warning_parameters p, int number, int format, png_int_32 value),
    PNG_EMPTY);
 
-PNG_INTERNAL_FUNCTION(void,png_formatted_warning,(png_const_structrp png_ptr,
-   png_warning_parameters p, png_const_charp message),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_formatted_warning,
+   (png_const_structrp png_ptr,
+    png_warning_parameters p, png_const_charp message),
+   PNG_EMPTY);
    /* 'message' follows the X/Open approach of using @1, @2 to insert
     * parameters previously supplied using the above functions.  Errors in
     * specifying the parameters will simply result in garbage substitutions.
@@ -1874,14 +2049,16 @@ PNG_INTERNAL_FUNCTION(void,png_formatted_warning,(png_const_structrp png_ptr,
  * If benign errors aren't supported they end up as the corresponding base call
  * (png_warning or png_error.)
  */
-PNG_INTERNAL_FUNCTION(void,png_app_warning,(png_const_structrp png_ptr,
-   png_const_charp message),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_app_warning,
+   (png_const_structrp png_ptr, png_const_charp message),
+   PNG_EMPTY);
    /* The application provided invalid parameters to an API function or called
     * an API function at the wrong time, libpng can completely recover.
     */
 
-PNG_INTERNAL_FUNCTION(void,png_app_error,(png_const_structrp png_ptr,
-   png_const_charp message),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_app_error,
+   (png_const_structrp png_ptr, png_const_charp message),
+   PNG_EMPTY);
    /* As above but libpng will ignore the call, or attempt some other partial
     * recovery from the error.
     */
@@ -1890,8 +2067,9 @@ PNG_INTERNAL_FUNCTION(void,png_app_error,(png_const_structrp png_ptr,
 #  define png_app_error(pp,s) png_error(pp,s)
 #endif
 
-PNG_INTERNAL_FUNCTION(void,png_chunk_report,(png_const_structrp png_ptr,
-   png_const_charp message, int error),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_chunk_report,
+   (png_const_structrp png_ptr, png_const_charp message, int error),
+   PNG_EMPTY);
    /* Report a recoverable issue in chunk data.  On read this is used to report
     * a problem found while reading a particular chunk and the
     * png_chunk_benign_error or png_chunk_warning function is used as
@@ -1917,14 +2095,17 @@ PNG_INTERNAL_FUNCTION(void,png_chunk_report,(png_const_structrp png_ptr,
 #define PNG_sCAL_MAX_DIGITS (PNG_sCAL_PRECISION+1/*.*/+1/*E*/+10/*exponent*/)
 
 #ifdef PNG_FLOATING_POINT_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_ascii_from_fp,(png_const_structrp png_ptr,
-   png_charp ascii, size_t size, double fp, unsigned int precision),
+PNG_INTERNAL_FUNCTION(void, png_ascii_from_fp,
+   (png_const_structrp png_ptr,
+    png_charp ascii, size_t size, double fp, unsigned int precision),
    PNG_EMPTY);
 #endif /* FLOATING_POINT */
 
 #ifdef PNG_FIXED_POINT_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_ascii_from_fixed,(png_const_structrp png_ptr,
-   png_charp ascii, size_t size, png_fixed_point fp),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_ascii_from_fixed,
+   (png_const_structrp png_ptr,
+    png_charp ascii, size_t size, png_fixed_point fp),
+   PNG_EMPTY);
 #endif /* FIXED_POINT */
 #endif /* sCAL */
 
@@ -2016,8 +2197,9 @@ PNG_INTERNAL_FUNCTION(void,png_ascii_from_fixed,(png_const_structrp png_ptr,
  * that omits the last character (i.e. set the size to the index of
  * the problem character.)  This has not been tested within libpng.
  */
-PNG_INTERNAL_FUNCTION(int,png_check_fp_number,(png_const_charp string,
-   size_t size, int *statep, size_t *whereami),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(int, png_check_fp_number,
+   (png_const_charp string, size_t size, int *statep, size_t *whereami),
+   PNG_EMPTY);
 
 /* This is the same but it checks a complete string and returns true
  * only if it just contains a floating point number.  As of 1.5.4 this
@@ -2025,8 +2207,9 @@ PNG_INTERNAL_FUNCTION(int,png_check_fp_number,(png_const_charp string,
  * it was valid (otherwise it returns 0.)  This can be used for testing
  * for negative or zero values using the sticky flag.
  */
-PNG_INTERNAL_FUNCTION(int,png_check_fp_string,(png_const_charp string,
-   size_t size),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(int, png_check_fp_string,
+   (png_const_charp string, size_t size),
+   PNG_EMPTY);
 #endif /* pCAL || sCAL */
 
 #if defined(PNG_READ_GAMMA_SUPPORTED) ||\
@@ -2039,14 +2222,17 @@ PNG_INTERNAL_FUNCTION(int,png_check_fp_string,(png_const_charp string,
  * for overflow, true (1) if no overflow, in which case *res
  * holds the result.
  */
-PNG_INTERNAL_FUNCTION(int,png_muldiv,(png_fixed_point_p res, png_fixed_point a,
-   png_int_32 multiplied_by, png_int_32 divided_by),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(int, png_muldiv,
+   (png_fixed_point_p res, png_fixed_point a,
+    png_int_32 multiplied_by, png_int_32 divided_by),
+   PNG_EMPTY);
 
 /* Calculate a reciprocal - used for gamma values.  This returns
  * 0 if the argument is 0 in order to maintain an undefined value;
  * there are no warnings.
  */
-PNG_INTERNAL_FUNCTION(png_fixed_point,png_reciprocal,(png_fixed_point a),
+PNG_INTERNAL_FUNCTION(png_fixed_point, png_reciprocal,
+   (png_fixed_point a),
    PNG_EMPTY);
 #endif
 
@@ -2055,11 +2241,13 @@ PNG_INTERNAL_FUNCTION(png_fixed_point,png_reciprocal,(png_fixed_point a),
  * values.  Accuracy is suitable for gamma calculations but this is
  * not exact - use png_muldiv for that.  Only required at present on read.
  */
-PNG_INTERNAL_FUNCTION(png_fixed_point,png_reciprocal2,(png_fixed_point a,
-   png_fixed_point b),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(png_fixed_point, png_reciprocal2,
+   (png_fixed_point a, png_fixed_point b),
+   PNG_EMPTY);
 
 /* Return true if the gamma value is significantly different from 1.0 */
-PNG_INTERNAL_FUNCTION(int,png_gamma_significant,(png_fixed_point gamma_value),
+PNG_INTERNAL_FUNCTION(int, png_gamma_significant,
+   (png_fixed_point gamma_value),
    PNG_EMPTY);
 
 /* PNGv3: 'resolve' the file gamma according to the new PNGv3 rules for colour
@@ -2070,8 +2258,9 @@ PNG_INTERNAL_FUNCTION(int,png_gamma_significant,(png_fixed_point gamma_value),
  * transforms.  For this reason a gamma specified by png_set_gamma always takes
  * precedence.
  */
-PNG_INTERNAL_FUNCTION(png_fixed_point,png_resolve_file_gamma,
-   (png_const_structrp png_ptr),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(png_fixed_point, png_resolve_file_gamma,
+   (png_const_structrp png_ptr),
+   PNG_EMPTY);
 
 /* Internal fixed point gamma correction.  These APIs are called as
  * required to convert single values - they don't need to be fast,
@@ -2080,37 +2269,45 @@ PNG_INTERNAL_FUNCTION(png_fixed_point,png_resolve_file_gamma,
  * While the input is an 'unsigned' value it must actually be the
  * correct bit value - 0..255 or 0..65535 as required.
  */
-PNG_INTERNAL_FUNCTION(png_uint_16,png_gamma_correct,(png_structrp png_ptr,
-   unsigned int value, png_fixed_point gamma_value),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(png_uint_16,png_gamma_16bit_correct,(unsigned int value,
-   png_fixed_point gamma_value),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(png_byte,png_gamma_8bit_correct,(unsigned int value,
-   png_fixed_point gamma_value),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_destroy_gamma_table,(png_structrp png_ptr),
+PNG_INTERNAL_FUNCTION(png_uint_16, png_gamma_correct,
+   (png_structrp png_ptr, unsigned int value, png_fixed_point gamma_value),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(png_uint_16, png_gamma_16bit_correct,
+   (unsigned int value, png_fixed_point gamma_value),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(png_byte, png_gamma_8bit_correct,
+   (unsigned int value, png_fixed_point gamma_value),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_destroy_gamma_table,
+   (png_structrp png_ptr),
+   PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_build_gamma_table,
+   (png_structrp png_ptr, int bit_depth),
    PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_build_gamma_table,(png_structrp png_ptr,
-   int bit_depth),PNG_EMPTY);
 #endif /* READ_GAMMA */
 
 #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
 /* Set the RGB coefficients if not already set by png_set_rgb_to_gray */
-PNG_INTERNAL_FUNCTION(void,png_set_rgb_coefficients,(png_structrp png_ptr),
+PNG_INTERNAL_FUNCTION(void, png_set_rgb_coefficients,
+   (png_structrp png_ptr),
    PNG_EMPTY);
 #endif
 
 #if defined(PNG_cHRM_SUPPORTED) || defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
-PNG_INTERNAL_FUNCTION(int,png_XYZ_from_xy,(png_XYZ *XYZ, const png_xy *xy),
+PNG_INTERNAL_FUNCTION(int, png_XYZ_from_xy,
+   (png_XYZ *XYZ, const png_xy *xy),
    PNG_EMPTY);
 #endif /* cHRM || READ_RGB_TO_GRAY */
 
 #ifdef PNG_COLORSPACE_SUPPORTED
-PNG_INTERNAL_FUNCTION(int,png_xy_from_XYZ,(png_xy *xy, const png_XYZ *XYZ),
+PNG_INTERNAL_FUNCTION(int, png_xy_from_XYZ,
+   (png_xy *xy, const png_XYZ *XYZ),
    PNG_EMPTY);
 #endif
 
 /* SIMPLIFIED READ/WRITE SUPPORT */
 #if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\
-   defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
+    defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
 /* The internal structure that png_image::opaque points to. */
 typedef struct png_control
 {
@@ -2138,28 +2335,34 @@ typedef struct png_control
  * errors that might occur.  Returns true on success, false on failure (either
  * of the function or as a result of a png_error.)
  */
-PNG_INTERNAL_CALLBACK(void,png_safe_error,(png_structp png_ptr,
-   png_const_charp error_message),PNG_NORETURN);
+PNG_INTERNAL_CALLBACK(void, png_safe_error,
+   (png_structp png_ptr, png_const_charp error_message),
+   PNG_NORETURN);
 
 #ifdef PNG_WARNINGS_SUPPORTED
-PNG_INTERNAL_CALLBACK(void,png_safe_warning,(png_structp png_ptr,
-   png_const_charp warning_message),PNG_EMPTY);
+PNG_INTERNAL_CALLBACK(void, png_safe_warning,
+   (png_structp png_ptr, png_const_charp warning_message),
+   PNG_EMPTY);
 #else
 #  define png_safe_warning 0/*dummy argument*/
 #endif
 
-PNG_INTERNAL_FUNCTION(int,png_safe_execute,(png_imagep image,
-   int (*function)(png_voidp), png_voidp arg),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(int, png_safe_execute,
+   (png_imagep image, int (*function)(png_voidp), png_voidp arg),
+   PNG_EMPTY);
 
 /* Utility to log an error; this also cleans up the png_image; the function
  * always returns 0 (false).
  */
-PNG_INTERNAL_FUNCTION(int,png_image_error,(png_imagep image,
-   png_const_charp error_message),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(int, png_image_error,
+   (png_imagep image, png_const_charp error_message),
+   PNG_EMPTY);
 
 #ifndef PNG_SIMPLIFIED_READ_SUPPORTED
 /* png_image_free is used by the write code but not exported */
-PNG_INTERNAL_FUNCTION(void, png_image_free, (png_imagep image), PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_image_free,
+   (png_imagep image),
+   PNG_EMPTY);
 #endif /* !SIMPLIFIED_READ */
 
 #endif /* SIMPLIFIED READ/WRITE */
@@ -2170,8 +2373,9 @@ PNG_INTERNAL_FUNCTION(void, png_image_free, (png_imagep image), PNG_EMPTY);
  * the generic code is used.
  */
 #ifdef PNG_FILTER_OPTIMIZATIONS
-PNG_INTERNAL_FUNCTION(void, PNG_FILTER_OPTIMIZATIONS, (png_structp png_ptr,
-   unsigned int bpp), PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, PNG_FILTER_OPTIMIZATIONS,
+   (png_structp png_ptr, unsigned int bpp),
+   PNG_EMPTY);
    /* Just declare the optimization that will be used */
 #else
    /* List *all* the possible optimizations here - this branch is required if
@@ -2180,37 +2384,44 @@ PNG_INTERNAL_FUNCTION(void, PNG_FILTER_OPTIMIZATIONS, (png_structp png_ptr,
     */
 #  if PNG_ARM_NEON_OPT > 0
 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon,
-   (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
+   (png_structp png_ptr, unsigned int bpp),
+   PNG_EMPTY);
 #endif
 
 #if PNG_MIPS_MSA_IMPLEMENTATION == 1
 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_mips,
-   (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
+   (png_structp png_ptr, unsigned int bpp),
+   PNG_EMPTY);
 #endif
 
 #  if PNG_MIPS_MMI_IMPLEMENTATION > 0
 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_mips,
-   (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
+   (png_structp png_ptr, unsigned int bpp),
+   PNG_EMPTY);
 #  endif
 
 #  if PNG_INTEL_SSE_IMPLEMENTATION > 0
 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_sse2,
-   (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
+   (png_structp png_ptr, unsigned int bpp),
+   PNG_EMPTY);
 #  endif
 #endif
 
 #if PNG_LOONGARCH_LSX_OPT > 0
 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_lsx,
-    (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
+   (png_structp png_ptr, unsigned int bpp),
+   PNG_EMPTY);
 #endif
 
 #  if PNG_RISCV_RVV_IMPLEMENTATION == 1
 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_rvv,
-   (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
+   (png_structp png_ptr, unsigned int bpp),
+   PNG_EMPTY);
 #endif
 
-PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr,
-   png_const_charp key, png_bytep new_key), PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword,
+   (png_structrp png_ptr, png_const_charp key, png_bytep new_key),
+   PNG_EMPTY);
 
 #if PNG_ARM_NEON_IMPLEMENTATION == 1
 PNG_INTERNAL_FUNCTION(void,
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngread.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngread.c
index b53668a09ce..79fd9ad6a82 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngread.c
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngread.c
@@ -29,7 +29,7 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Copyright (c) 2018-2025 Cosmin Truta
+ * Copyright (c) 2018-2026 Cosmin Truta
  * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
  * Copyright (c) 1996-1997 Andreas Dilger
  * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -52,7 +52,8 @@
 /* Create a PNG structure for reading, and allocate any memory needed. */
 PNG_FUNCTION(png_structp,PNGAPI
 png_create_read_struct,(png_const_charp user_png_ver, png_voidp error_ptr,
-    png_error_ptr error_fn, png_error_ptr warn_fn),PNG_ALLOCATED)
+    png_error_ptr error_fn, png_error_ptr warn_fn),
+    PNG_ALLOCATED)
 {
 #ifndef PNG_USER_MEM_SUPPORTED
    png_structp png_ptr = png_create_png_struct(user_png_ver, error_ptr,
@@ -68,7 +69,8 @@ png_create_read_struct,(png_const_charp user_png_ver, png_voidp error_ptr,
 PNG_FUNCTION(png_structp,PNGAPI
 png_create_read_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
     png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
-    png_malloc_ptr malloc_fn, png_free_ptr free_fn),PNG_ALLOCATED)
+    png_malloc_ptr malloc_fn, png_free_ptr free_fn),
+    PNG_ALLOCATED)
 {
    png_structp png_ptr = png_create_png_struct(user_png_ver, error_ptr,
        error_fn, warn_fn, mem_ptr, malloc_fn, free_fn);
@@ -548,7 +550,6 @@ png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row)
 
    if (png_ptr->read_row_fn != NULL)
       (*(png_ptr->read_row_fn))(png_ptr, png_ptr->row_number, png_ptr->pass);
-
 }
 #endif /* SEQUENTIAL_READ */
 
@@ -896,7 +897,7 @@ png_set_read_status_fn(png_structrp png_ptr, png_read_status_ptr read_row_fn)
 #ifdef PNG_INFO_IMAGE_SUPPORTED
 void PNGAPI
 png_read_png(png_structrp png_ptr, png_inforp info_ptr,
-    int transforms, voidp params)
+    int transforms, png_voidp params)
 {
    png_debug(1, "in png_read_png");
 
@@ -1133,19 +1134,20 @@ png_read_png(png_structrp png_ptr, png_inforp info_ptr,
 
 typedef struct
 {
-   /* Arguments: */
+   /* Arguments */
    png_imagep image;
-   png_voidp  buffer;
+   png_voidp buffer;
    png_int_32 row_stride;
-   png_voidp  colormap;
+   png_voidp colormap;
    png_const_colorp background;
-   /* Local variables: */
-   png_voidp       local_row;
-   png_voidp       first_row;
-   ptrdiff_t       row_bytes;           /* step between rows */
-   int             file_encoding;       /* E_ values above */
-   png_fixed_point gamma_to_linear;     /* For P_FILE, reciprocal of gamma */
-   int             colormap_processing; /* PNG_CMAP_ values above */
+
+   /* Instance variables */
+   png_voidp local_row;
+   png_voidp first_row;
+   ptrdiff_t row_step;              /* step between rows */
+   int file_encoding;               /* E_ values above */
+   png_fixed_point gamma_to_linear; /* For P_FILE, reciprocal of gamma */
+   int colormap_processing;         /* PNG_CMAP_ values above */
 } png_image_read_control;
 
 /* Do all the *safe* initialization - 'safe' means that png_error won't be
@@ -2866,17 +2868,17 @@ png_image_read_and_map(png_voidp argument)
    }
 
    {
-      png_uint_32  height = image->height;
-      png_uint_32  width = image->width;
-      int          proc = display->colormap_processing;
-      png_bytep    first_row = png_voidcast(png_bytep, display->first_row);
-      ptrdiff_t    step_row = display->row_bytes;
+      png_uint_32 height = image->height;
+      png_uint_32 width = image->width;
+      int proc = display->colormap_processing;
+      png_bytep first_row = png_voidcast(png_bytep, display->first_row);
+      ptrdiff_t row_step = display->row_step;
       int pass;
 
       for (pass = 0; pass < passes; ++pass)
       {
-         unsigned int     startx, stepx, stepy;
-         png_uint_32      y;
+         unsigned int startx, stepx, stepy;
+         png_uint_32 y;
 
          if (png_ptr->interlaced == PNG_INTERLACE_ADAM7)
          {
@@ -2900,7 +2902,7 @@ png_image_read_and_map(png_voidp argument)
          for (; ylocal_row);
-            png_bytep outrow = first_row + y * step_row;
+            png_bytep outrow = first_row + y * row_step;
             png_const_bytep end_row = outrow + width;
 
             /* Read read the libpng data into the temporary buffer. */
@@ -3109,20 +3111,20 @@ png_image_read_colormapped(png_voidp argument)
     */
    {
       png_voidp first_row = display->buffer;
-      ptrdiff_t row_bytes = display->row_stride;
+      ptrdiff_t row_step = display->row_stride;
 
-      /* The following expression is designed to work correctly whether it gives
-       * a signed or an unsigned result.
+      /* The following adjustment is to ensure that calculations are correct,
+       * regardless whether row_step is positive or negative.
        */
-      if (row_bytes < 0)
+      if (row_step < 0)
       {
          char *ptr = png_voidcast(char*, first_row);
-         ptr += (image->height-1) * (-row_bytes);
+         ptr += (image->height-1) * (-row_step);
          first_row = png_voidcast(png_voidp, ptr);
       }
 
       display->first_row = first_row;
-      display->row_bytes = row_bytes;
+      display->row_step = row_step;
    }
 
    if (passes == 0)
@@ -3140,17 +3142,17 @@ png_image_read_colormapped(png_voidp argument)
 
    else
    {
-      png_alloc_size_t row_bytes = (png_alloc_size_t)display->row_bytes;
+      ptrdiff_t row_step = display->row_step;
 
       while (--passes >= 0)
       {
-         png_uint_32      y = image->height;
-         png_bytep        row = png_voidcast(png_bytep, display->first_row);
+         png_uint_32 y = image->height;
+         png_bytep row = png_voidcast(png_bytep, display->first_row);
 
          for (; y > 0; --y)
          {
             png_read_row(png_ptr, row, NULL);
-            row += row_bytes;
+            row += row_step;
          }
       }
 
@@ -3166,9 +3168,11 @@ png_image_read_direct_scaled(png_voidp argument)
        argument);
    png_imagep image = display->image;
    png_structrp png_ptr = image->opaque->png_ptr;
+   png_inforp info_ptr = image->opaque->info_ptr;
    png_bytep local_row = png_voidcast(png_bytep, display->local_row);
    png_bytep first_row = png_voidcast(png_bytep, display->first_row);
-   ptrdiff_t row_bytes = display->row_bytes;
+   ptrdiff_t row_step = display->row_step;
+   size_t row_bytes = png_get_rowbytes(png_ptr, info_ptr);
    int passes;
 
    /* Handle interlacing. */
@@ -3197,9 +3201,14 @@ png_image_read_direct_scaled(png_voidp argument)
          /* Read into local_row (gets transformed 8-bit data). */
          png_read_row(png_ptr, local_row, NULL);
 
-         /* Copy from local_row to user buffer. */
-         memcpy(output_row, local_row, (size_t)row_bytes);
-         output_row += row_bytes;
+         /* Copy from local_row to user buffer.
+          * Use row_bytes (i.e. the actual size in bytes of the row data) for
+          * copying into output_row. Use row_step for advancing output_row,
+          * to respect the caller's stride for padding or negative (bottom-up)
+          * layouts.
+          */
+         memcpy(output_row, local_row, row_bytes);
+         output_row += row_step;
       }
    }
 
@@ -3231,17 +3240,18 @@ png_image_read_composite(png_voidp argument)
    }
 
    {
-      png_uint_32  height = image->height;
-      png_uint_32  width = image->width;
-      ptrdiff_t    step_row = display->row_bytes;
+      png_uint_32 height = image->height;
+      png_uint_32 width = image->width;
+      ptrdiff_t row_step = display->row_step;
       unsigned int channels =
           (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1;
+      int optimize_alpha = (png_ptr->flags & PNG_FLAG_OPTIMIZE_ALPHA) != 0;
       int pass;
 
       for (pass = 0; pass < passes; ++pass)
       {
-         unsigned int     startx, stepx, stepy;
-         png_uint_32      y;
+         unsigned int startx, stepx, stepy;
+         png_uint_32 y;
 
          if (png_ptr->interlaced == PNG_INTERLACE_ADAM7)
          {
@@ -3273,7 +3283,7 @@ png_image_read_composite(png_voidp argument)
             png_read_row(png_ptr, inrow, NULL);
 
             outrow = png_voidcast(png_bytep, display->first_row);
-            outrow += y * step_row;
+            outrow += y * row_step;
             end_row = outrow + width * channels;
 
             /* Now do the composition on each pixel in this row. */
@@ -3292,20 +3302,44 @@ png_image_read_composite(png_voidp argument)
 
                      if (alpha < 255) /* else just use component */
                      {
-                        /* This is PNG_OPTIMIZED_ALPHA, the component value
-                         * is a linear 8-bit value.  Combine this with the
-                         * current outrow[c] value which is sRGB encoded.
-                         * Arithmetic here is 16-bits to preserve the output
-                         * values correctly.
-                         */
-                        component *= 257*255; /* =65535 */
-                        component += (255-alpha)*png_sRGB_table[outrow[c]];
+                        if (optimize_alpha != 0)
+                        {
+                           /* This is PNG_OPTIMIZED_ALPHA, the component value
+                            * is a linear 8-bit value.  Combine this with the
+                            * current outrow[c] value which is sRGB encoded.
+                            * Arithmetic here is 16-bits to preserve the output
+                            * values correctly.
+                            */
+                           component *= 257*255; /* =65535 */
+                           component += (255-alpha)*png_sRGB_table[outrow[c]];
 
-                        /* So 'component' is scaled by 255*65535 and is
-                         * therefore appropriate for the sRGB to linear
-                         * conversion table.
-                         */
-                        component = PNG_sRGB_FROM_LINEAR(component);
+                           /* Clamp to the valid range to defend against
+                            * unforeseen cases where the data might be sRGB
+                            * instead of linear premultiplied.
+                            * (Belt-and-suspenders for CVE-2025-66293.)
+                            */
+                           if (component > 255*65535)
+                              component = 255*65535;
+
+                           /* So 'component' is scaled by 255*65535 and is
+                            * therefore appropriate for the sRGB-to-linear
+                            * conversion table.
+                            */
+                           component = PNG_sRGB_FROM_LINEAR(component);
+                        }
+                        else
+                        {
+                           /* Compositing was already done on the palette
+                            * entries.  The data is sRGB premultiplied on black.
+                            * Composite with the background in sRGB space.
+                            * This is not gamma-correct, but matches what was
+                            * done to the palette.
+                            */
+                           png_uint_32 background = outrow[c];
+                           component += ((255-alpha) * background + 127) / 255;
+                           if (component > 255)
+                              component = 255;
+                        }
                      }
 
                      outrow[c] = (png_byte)component;
@@ -3394,12 +3428,12 @@ png_image_read_background(png_voidp argument)
           */
          {
             png_bytep first_row = png_voidcast(png_bytep, display->first_row);
-            ptrdiff_t step_row = display->row_bytes;
+            ptrdiff_t row_step = display->row_step;
 
             for (pass = 0; pass < passes; ++pass)
             {
-               unsigned int     startx, stepx, stepy;
-               png_uint_32      y;
+               unsigned int startx, stepx, stepy;
+               png_uint_32 y;
 
                if (png_ptr->interlaced == PNG_INTERLACE_ADAM7)
                {
@@ -3426,7 +3460,7 @@ png_image_read_background(png_voidp argument)
                   {
                      png_bytep inrow = png_voidcast(png_bytep,
                          display->local_row);
-                     png_bytep outrow = first_row + y * step_row;
+                     png_bytep outrow = first_row + y * row_step;
                      png_const_bytep end_row = outrow + width;
 
                      /* Read the row, which is packed: */
@@ -3471,7 +3505,7 @@ png_image_read_background(png_voidp argument)
                   {
                      png_bytep inrow = png_voidcast(png_bytep,
                          display->local_row);
-                     png_bytep outrow = first_row + y * step_row;
+                     png_bytep outrow = first_row + y * row_step;
                      png_const_bytep end_row = outrow + width;
 
                      /* Read the row, which is packed: */
@@ -3517,9 +3551,9 @@ png_image_read_background(png_voidp argument)
             png_uint_16p first_row = png_voidcast(png_uint_16p,
                 display->first_row);
             /* The division by two is safe because the caller passed in a
-             * stride which was multiplied by 2 (below) to get row_bytes.
+             * stride which was multiplied by 2 (below) to get row_step.
              */
-            ptrdiff_t    step_row = display->row_bytes / 2;
+            ptrdiff_t row_step = display->row_step / 2;
             unsigned int preserve_alpha = (image->format &
                 PNG_FORMAT_FLAG_ALPHA) != 0;
             unsigned int outchannels = 1U+preserve_alpha;
@@ -3533,8 +3567,8 @@ png_image_read_background(png_voidp argument)
 
             for (pass = 0; pass < passes; ++pass)
             {
-               unsigned int     startx, stepx, stepy;
-               png_uint_32      y;
+               unsigned int startx, stepx, stepy;
+               png_uint_32 y;
 
                /* The 'x' start and step are adjusted to output components here.
                 */
@@ -3561,7 +3595,7 @@ png_image_read_background(png_voidp argument)
                for (; ybuffer;
-      ptrdiff_t row_bytes = display->row_stride;
+      ptrdiff_t row_step = display->row_stride;
 
       if (linear != 0)
-         row_bytes *= 2;
+         row_step *= 2;
 
-      /* The following expression is designed to work correctly whether it gives
-       * a signed or an unsigned result.
+      /* The following adjustment is to ensure that calculations are correct,
+       * regardless whether row_step is positive or negative.
        */
-      if (row_bytes < 0)
+      if (row_step < 0)
       {
          char *ptr = png_voidcast(char*, first_row);
-         ptr += (image->height-1) * (-row_bytes);
+         ptr += (image->height - 1) * (-row_step);
          first_row = png_voidcast(png_voidp, ptr);
       }
 
       display->first_row = first_row;
-      display->row_bytes = row_bytes;
+      display->row_step = row_step;
    }
 
    if (do_local_compose != 0)
@@ -4063,17 +4097,17 @@ png_image_read_direct(png_voidp argument)
 
    else
    {
-      png_alloc_size_t row_bytes = (png_alloc_size_t)display->row_bytes;
+      ptrdiff_t row_step = display->row_step;
 
       while (--passes >= 0)
       {
-         png_uint_32      y = image->height;
-         png_bytep        row = png_voidcast(png_bytep, display->first_row);
+         png_uint_32 y = image->height;
+         png_bytep row = png_voidcast(png_bytep, display->first_row);
 
          for (; y > 0; --y)
          {
             png_read_row(png_ptr, row, NULL);
-            row += row_bytes;
+            row += row_step;
          }
       }
 
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c
index a19615f49fe..7680fe64828 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c
@@ -1149,8 +1149,8 @@ png_set_rgb_to_gray(png_structrp png_ptr, int error_action, double red,
 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
     defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
 void PNGAPI
-png_set_read_user_transform_fn(png_structrp png_ptr, png_user_transform_ptr
-    read_user_transform_fn)
+png_set_read_user_transform_fn(png_structrp png_ptr,
+    png_user_transform_ptr read_user_transform_fn)
 {
    png_debug(1, "in png_set_read_user_transform_fn");
 
@@ -1872,6 +1872,7 @@ png_init_read_transformations(png_structrp png_ptr)
              * transformations elsewhere.
              */
             png_ptr->transformations &= ~(PNG_COMPOSE | PNG_GAMMA);
+            png_ptr->flags &= ~PNG_FLAG_OPTIMIZE_ALPHA;
          } /* color_type == PNG_COLOR_TYPE_PALETTE */
 
          /* if (png_ptr->background_gamma_type!=PNG_BACKGROUND_GAMMA_UNKNOWN) */
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngrutil.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngrutil.c
index 07d53cb2c76..01bb0c8bedc 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngrutil.c
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngrutil.c
@@ -2415,7 +2415,7 @@ png_handle_tIME(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 static png_handle_result_code /* PRIVATE */
 png_handle_tEXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 {
-   png_text  text_info;
+   png_text text_info;
    png_bytep buffer;
    png_charp key;
    png_charp text;
@@ -2488,8 +2488,8 @@ static png_handle_result_code /* PRIVATE */
 png_handle_zTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 {
    png_const_charp errmsg = NULL;
-   png_bytep       buffer;
-   png_uint_32     keyword_length;
+   png_bytep buffer;
+   png_uint_32 keyword_length;
 
    png_debug(1, "in png_handle_zTXt");
 
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngtrans.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngtrans.c
index 2350057e70e..b9f6cb5d437 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngtrans.c
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngtrans.c
@@ -831,8 +831,8 @@ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info)
     defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
 #ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
 void PNGAPI
-png_set_user_transform_info(png_structrp png_ptr, png_voidp
-   user_transform_ptr, int user_transform_depth, int user_transform_channels)
+png_set_user_transform_info(png_structrp png_ptr, png_voidp user_transform_ptr,
+    int user_transform_depth, int user_transform_channels)
 {
    png_debug(1, "in png_set_user_transform_info");
 
diff --git a/src/java.desktop/unix/classes/sun/print/AttributeClass.java b/src/java.desktop/unix/classes/sun/print/AttributeClass.java
index 10d0714a059..3db6e310dd2 100644
--- a/src/java.desktop/unix/classes/sun/print/AttributeClass.java
+++ b/src/java.desktop/unix/classes/sun/print/AttributeClass.java
@@ -174,6 +174,30 @@ public final class AttributeClass {
 
     }
 
+    /**
+     * Returns 3 int values.
+     * xres, yres, resolution as either dpi or dpcm
+     * The resolution is just a single byte of data.
+     */
+    public int[] getIntResolutionValue() {
+        int[] res = {0, 0, 0};
+        byte[] bufArray = (byte[])myValue;
+        if (bufArray != null) {
+            int nBytes = 4; // 32-bit signed integer
+            for (int j=0; j<2; j++) { // 2 set of integers
+                byte[] intBytes = new byte[nBytes];
+                // REMIND: # bytes should be 8
+                for (int i=0; i< nBytes; i++) {
+                    //+ 1 because the 1st byte is length
+                    intBytes[i] = bufArray[i+(4*j)+1];
+                }
+                res[j] = convertToInt(intBytes);
+            }
+            res[2] = (int)bufArray[9];
+        }
+        return res;
+    }
+
     /**
      * Returns String value.
      */
diff --git a/src/java.desktop/unix/classes/sun/print/IPPPrintService.java b/src/java.desktop/unix/classes/sun/print/IPPPrintService.java
index 2bf326fca57..8a3b872b107 100644
--- a/src/java.desktop/unix/classes/sun/print/IPPPrintService.java
+++ b/src/java.desktop/unix/classes/sun/print/IPPPrintService.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
@@ -141,7 +141,7 @@ public final class IPPPrintService implements PrintService, SunPrinterJobService
     private MediaSizeName[] mediaSizeNames;
     private CustomMediaSizeName[] customMediaSizeNames;
     private int defaultMediaIndex;
-    private int[] rawResolutions = null;
+    private int[] ppdResolutions = null;
     private PrinterResolution[] printerResolutions = null;
     private boolean isCupsPrinter;
     private boolean init;
@@ -205,8 +205,7 @@ public final class IPPPrintService implements PrintService, SunPrinterJobService
         OrientationRequested.PORTRAIT,
         new PageRanges(1),
         //PresentationDirection,
-                 // CUPS does not supply printer-resolution attribute
-        //new PrinterResolution(300, 300, PrinterResolution.DPI),
+        new PrinterResolution(300, 300, PrinterResolution.DPI),
         //PrintQuality.NORMAL,
         new RequestingUserName("", Locale.getDefault()),
         //SheetCollate.UNCOLLATED, //CUPS has no sheet collate?
@@ -467,7 +466,9 @@ public final class IPPPrintService implements PrintService, SunPrinterJobService
                                 : getSupportedOutputBins();
                         customMediaSizeNames = cps.getCustomMediaSizeNames();
                         defaultMediaIndex = cps.getDefaultMediaIndex();
-                        rawResolutions = cps.getRawResolutions();
+                        if (ppdResolutions == null) {
+                            ppdResolutions = cps.getRawResolutions();
+                        }
                     }
                     urlConnection.disconnect();
                     init = true;
@@ -821,14 +822,7 @@ public final class IPPPrintService implements PrintService, SunPrinterJobService
                 }
             }
         } else if (category == PrinterResolution.class) {
-            PrinterResolution[] supportedRes = getPrintResolutions();
-            if (supportedRes == null) {
-                return null;
-            }
-            PrinterResolution []arr =
-                new PrinterResolution[supportedRes.length];
-            System.arraycopy(supportedRes, 0, arr, 0, supportedRes.length);
-            return arr;
+            return getPrintResolutions();
         } else if (category == OutputBin.class) {
             return Arrays.copyOf(outputBins, outputBins.length);
         }
@@ -1137,8 +1131,6 @@ public final class IPPPrintService implements PrintService, SunPrinterJobService
             catList.add(Chromaticity.class);
         }
 
-        // CUPS does not report printer resolution via IPP but it
-        // may be gleaned from the PPD.
         PrinterResolution[] supportedRes = getPrintResolutions();
         if (supportedRes != null && (supportedRes.length > 0)) {
             catList.add(PrinterResolution.class);
@@ -1264,7 +1256,6 @@ public final class IPPPrintService implements PrintService, SunPrinterJobService
         }
     }
 
-
     @Override
     public synchronized PrintServiceAttributeSet getAttributes() {
         if (!init) {
@@ -1684,9 +1675,7 @@ public final class IPPPrintService implements PrintService, SunPrinterJobService
         } else if (category == PrinterResolution.class) {
              PrinterResolution[] supportedRes = getPrintResolutions();
              if ((supportedRes != null) && (supportedRes.length > 0)) {
-                return supportedRes[0];
-             } else {
-                 return new PrinterResolution(300, 300, PrinterResolution.DPI);
+                 return supportedRes[0];
              }
         } else if (category == OutputBin.class) {
             if (attribClass != null) {
@@ -1697,26 +1686,40 @@ public final class IPPPrintService implements PrintService, SunPrinterJobService
         return null;
     }
 
+    /* Called only from contexts that have called initAttributes().
+     * Try IPP first, and if that produces nothing, fall back to the PPD
+    */
     private PrinterResolution[] getPrintResolutions() {
+        int[] rawResolutions = null;
         if (printerResolutions == null) {
-            if (rawResolutions == null) {
-              printerResolutions = new PrinterResolution[0];
-            } else {
-                int numRes = rawResolutions.length / 2;
-                PrinterResolution[] pres = new PrinterResolution[numRes];
-                for (int i=0; i < numRes; i++) {
-                    pres[i] =  new PrinterResolution(rawResolutions[i*2],
-                                                     rawResolutions[i*2+1],
-                                                     PrinterResolution.DPI);
-                }
-                printerResolutions = pres;
+            AttributeClass attribClass = (getAttMap != null) ?
+                getAttMap.get("printer-resolution-supported")
+                : null;
+            if (attribClass != null) {
+                rawResolutions = attribClass.getIntResolutionValue();
             }
+            if (rawResolutions == null) {
+                rawResolutions = ppdResolutions;
+            }
+            if (rawResolutions == null) {
+               rawResolutions = new int[] { 300, 300, 3 } ;
+            }
+            int numRes = rawResolutions.length / 3;
+            PrinterResolution[] pres = new PrinterResolution[numRes];
+            for (int i = 0; i < numRes; i++) {
+                int units = (rawResolutions[i*3+2] == 4) ? PrinterResolution.DPCM : PrinterResolution.DPI;
+                pres[i] = new PrinterResolution(rawResolutions[i*3],
+                                                rawResolutions[i*3+1],
+                                                units);
+            }
+            printerResolutions = pres;
         }
-        return printerResolutions;
+        return printerResolutions.clone();
     }
 
     private boolean isSupportedResolution(PrinterResolution res) {
-        PrinterResolution[] supportedRes = getPrintResolutions();
+        PrinterResolution[] supportedRes =
+            (PrinterResolution[])getSupportedAttributeValues(PrinterResolution.class, null, null);
         if (supportedRes != null) {
             for (int i=0; iNewObject(env, intCls, intCtr, 3);
+    CHECK_NULL(dpi);
 
     // NOTE: cupsGetPPD returns a pointer to a filename of a temporary file.
     // unlink() must be called to remove the file after using it.
@@ -672,6 +691,7 @@ Java_sun_print_CUPSPrinter_getResolutions(JNIEnv *env,
           CHECK_NULL(ryObj);
           (*env)->CallBooleanMethod(env, arrayList, arrListAddMID, rxObj);
           (*env)->CallBooleanMethod(env, arrayList, arrListAddMID, ryObj);
+          (*env)->CallBooleanMethod(env, arrayList, arrListAddMID, dpi);
         }
 
         for (i = 0; i < resolution->num_choices; i++) {
@@ -700,6 +720,41 @@ Java_sun_print_CUPSPrinter_getResolutions(JNIEnv *env,
               CHECK_NULL(ryObj);
               (*env)->CallBooleanMethod(env, arrayList, arrListAddMID, rxObj);
               (*env)->CallBooleanMethod(env, arrayList, arrListAddMID, ryObj);
+              (*env)->CallBooleanMethod(env, arrayList, arrListAddMID, dpi);
+            }
+        }
+
+    } else {
+        ppd_attr_t *defresolution = j2d_ppdFindAttr(ppd, "DefaultResolution", NULL);
+        if (defresolution == NULL) {
+            defresolution = j2d_ppdFindAttr(ppd, "Resolution", NULL);
+        }
+        if (defresolution != NULL) {
+            int matches = sscanf(defresolution->value, "%dx%ddpi", &defx, &defy);
+            if (matches == 2) {
+                if (defx <= 0 || defy <= 0) {
+                    defx = 0;
+                    defy = 0;
+                }
+            } else {
+                matches = sscanf(defresolution->value, "%ddpi", &defx);
+                if (matches == 1) {
+                    if (defx <= 0) {
+                       defx = 0;
+                    } else {
+                       defy = defx;
+                    }
+                }
+            }
+            if (defx > 0) {
+              jobject rxObj, ryObj;
+              rxObj = (*env)->NewObject(env, intCls, intCtr, defx);
+              CHECK_NULL(rxObj);
+              ryObj = (*env)->NewObject(env, intCls, intCtr, defy);
+              CHECK_NULL(ryObj);
+              (*env)->CallBooleanMethod(env, arrayList, arrListAddMID, rxObj);
+              (*env)->CallBooleanMethod(env, arrayList, arrListAddMID, ryObj);
+              (*env)->CallBooleanMethod(env, arrayList, arrListAddMID, dpi);
             }
         }
     }
diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java
index 915a361a3a1..91c2cbcd61d 100644
--- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java
+++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.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
@@ -905,10 +905,46 @@ public final class WindowsIconFactory implements Serializable
                         XPStyle xp = XPStyle.getXP();
                         if (xp != null) {
                             Skin skin = xp.getSkin(c, part);
-                            if (icon == null || icon.getIconHeight() <= 16) {
-                                skin.paintSkin(g, x + OFFSET, y + OFFSET, state);
+                            if (WindowsGraphicsUtils.isLeftToRight(c)) {
+                                if (icon == null || icon.getIconHeight() <= 16) {
+                                    skin.paintSkin(g, x + OFFSET, y + OFFSET, state);
+                                } else {
+                                    skin.paintSkin(g, x + OFFSET, y + icon.getIconHeight() / 2, state);
+                                }
                             } else {
-                                skin.paintSkin(g, x + OFFSET, y + icon.getIconHeight() / 2, state);
+                                if (icon == null) {
+                                    skin.paintSkin(g, x + 4 * OFFSET, y + OFFSET, state);
+                                } else {
+                                    int ycoord = (icon.getIconHeight() <= 16)
+                                                  ? y + OFFSET
+                                                  : (y + icon.getIconHeight() / 2);
+                                    if (icon.getIconWidth() <= 8) {
+                                        skin.paintSkin(g, x + OFFSET, ycoord, state);
+                                    } else if (icon.getIconWidth() <= 16) {
+                                        if (menuItem.getText().isEmpty()) {
+                                            skin.paintSkin(g,
+                                                (menuItem.getAccelerator() != null)
+                                                 ? (x + 2 * OFFSET) : (x + 3 * OFFSET),
+                                                ycoord, state);
+                                        } else {
+                                            skin.paintSkin(g,
+                                                (type == JRadioButtonMenuItem.class)
+                                                 ? (x + 4 * OFFSET) : (x + 3 * OFFSET),
+                                                ycoord, state);
+                                        }
+                                    } else {
+                                        if (menuItem.getText().isEmpty()
+                                            || menuItem.getAccelerator() != null) {
+                                            skin.paintSkin(g,
+                                                (type == JRadioButtonMenuItem.class)
+                                                 ? (x + 3 * OFFSET) : (x + 4 * OFFSET),
+                                                ycoord, state);
+                                        } else {
+                                            skin.paintSkin(g, x + 7 * OFFSET,
+                                                           ycoord, state);
+                                        }
+                                    }
+                                }
                             }
                         }
                     }
diff --git a/src/java.desktop/windows/classes/sun/awt/windows/WDesktopPeer.java b/src/java.desktop/windows/classes/sun/awt/windows/WDesktopPeer.java
index 788c1477265..e5b628dd74b 100644
--- a/src/java.desktop/windows/classes/sun/awt/windows/WDesktopPeer.java
+++ b/src/java.desktop/windows/classes/sun/awt/windows/WDesktopPeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -38,6 +38,9 @@ import java.io.File;
 import java.io.IOException;
 import java.net.URI;
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
 import javax.swing.event.EventListenerList;
 
 import sun.awt.shell.ShellFolder;
@@ -50,9 +53,11 @@ import sun.awt.shell.ShellFolder;
  */
 final class WDesktopPeer implements DesktopPeer {
     /* Constants for the operation verbs */
-    private static String ACTION_OPEN_VERB = "open";
-    private static String ACTION_EDIT_VERB = "edit";
-    private static String ACTION_PRINT_VERB = "print";
+    private static final String ACTION_OPEN_VERB = "open";
+    private static final String ACTION_EDIT_VERB = "edit";
+    private static final String ACTION_PRINT_VERB = "print";
+    private static final String ACTION_BROWSE_VERB = "browse";
+    private static final String ACTION_MAIL_VERB = "mail";
 
     private static native void init();
 
@@ -95,12 +100,12 @@ final class WDesktopPeer implements DesktopPeer {
 
     @Override
     public void mail(URI uri) throws IOException {
-        this.ShellExecute(uri, ACTION_OPEN_VERB);
+        this.ShellExecute(uri, ACTION_MAIL_VERB);
     }
 
     @Override
     public void browse(URI uri) throws IOException {
-        this.ShellExecute(uri, ACTION_OPEN_VERB);
+        this.launchUriInBrowser(uri);
     }
 
     private void ShellExecute(File file, String verb) throws IOException {
@@ -121,6 +126,42 @@ final class WDesktopPeer implements DesktopPeer {
         }
     }
 
+    private void launchUriInBrowser(URI uri) throws IOException {
+        String defaultBrowser = getDefaultBrowser();
+        if (defaultBrowser == null) {
+            throw new IOException("Failed to get default browser");
+        }
+
+        List cmdLineTokens = getCmdLineTokens(uri, defaultBrowser);
+        try {
+            ProcessBuilder pb = new ProcessBuilder(cmdLineTokens);
+            pb.start();
+        }  catch (Exception e) {
+            throw new IOException("Error launching Browser: ", e);
+        }
+    }
+
+    private static List getCmdLineTokens(URI uri, String defaultBrowser) {
+        if (defaultBrowser.contains("%1")) {
+            defaultBrowser = defaultBrowser.replace("%1", uri.toString());
+        } else {
+            defaultBrowser = defaultBrowser + " " + uri.toString();
+        }
+
+        List cmdLineTokens = new ArrayList<>();
+        int firstIndex = defaultBrowser.indexOf("\"");
+        int secondIndex = defaultBrowser.indexOf("\"", firstIndex + 1);
+
+        if (firstIndex == 0 && secondIndex != firstIndex) {
+            cmdLineTokens.add(defaultBrowser.substring(firstIndex, secondIndex + 1));
+            defaultBrowser = defaultBrowser.substring(secondIndex + 1).trim();
+        }
+        cmdLineTokens.addAll(Arrays.asList(defaultBrowser.split(" ")));
+        return cmdLineTokens;
+    }
+
+    private static native String getDefaultBrowser();
+
     private static native String ShellExecute(String fileOrUri, String verb);
 
     private static final EventListenerList listenerList = new EventListenerList();
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 ba79523249c..ebb43b2f078 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, 2023, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -30,6 +30,12 @@
 #include 
 #include 
 #include "awt_Toolkit.h"
+#include 
+#include   // for AssocQueryStringW
+#include 
+#include 
+#include 
+#include  // for SaferiIsExecutableFileType
 
 #define BUFFER_LIMIT   MAX_PATH+1
 
@@ -78,14 +84,23 @@ JNIEXPORT jstring JNICALL Java_sun_awt_windows_WDesktopPeer_ShellExecute
     LPCWSTR fileOrUri_c = JNU_GetStringPlatformChars(env, fileOrUri_j, NULL);
     CHECK_NULL_RETURN(fileOrUri_c, NULL);
     LPCWSTR verb_c = JNU_GetStringPlatformChars(env, verb_j, NULL);
+
     if (verb_c == NULL) {
         JNU_ReleaseStringPlatformChars(env, fileOrUri_j, fileOrUri_c);
         return NULL;
     }
+    if (wcscmp(verb_c, L"open") == 0) {
+        BOOL isExecutable = SaferiIsExecutableFileType(fileOrUri_c, FALSE);
+        if (isExecutable) {
+            return env->NewStringUTF("Unsupported URI content");
+        }
+    }
+    // set action verb for mail() to open before calling ShellExecute
+    LPCWSTR actionVerb = wcscmp(verb_c, L"mail") == 0 ? L"open" : verb_c;
 
     // 6457572: ShellExecute possibly changes FPU control word - saving it here
     unsigned oldcontrol87 = _control87(0, 0);
-    HINSTANCE retval = ::ShellExecute(NULL, verb_c, fileOrUri_c, NULL, NULL,
+    HINSTANCE retval = ::ShellExecute(NULL, actionVerb, fileOrUri_c, NULL, NULL,
                                       SW_SHOWNORMAL);
     DWORD error = ::GetLastError();
     _control87(oldcontrol87, 0xffffffff);
@@ -113,10 +128,38 @@ JNIEXPORT jstring JNICALL Java_sun_awt_windows_WDesktopPeer_ShellExecute
             return errmsg;
         }
     }
-
     return NULL;
 }
 
+/*
+ * Class:     sun_awt_windows_WDesktopPeer
+ * Method:    getDefaultBrowser
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_sun_awt_windows_WDesktopPeer_getDefaultBrowser
+(JNIEnv *env, jclass cls)
+{
+    LPCWSTR fileExtension = L"https";
+    WCHAR defaultBrowser_c [MAX_PATH];
+    DWORD cchBuffer = MAX_PATH;
+
+    // Use AssocQueryString to get the default browser
+    HRESULT hr = AssocQueryStringW(
+        ASSOCF_NONE,            // No special flags
+        ASSOCSTR_COMMAND,       // Request the command string
+        fileExtension,          // File extension
+        NULL,                   // pszExtra (optional)
+        defaultBrowser_c,       // Output buffer - result
+        &cchBuffer              // Size of the output buffer
+    );
+
+    if (FAILED(hr)) {
+        return NULL;
+    }
+
+    return JNU_NewStringPlatform(env, defaultBrowser_c);
+}
+
 /*
  * Class:     sun_awt_windows_WDesktopPeer
  * Method:    moveToTrash
diff --git a/src/java.rmi/share/classes/javax/rmi/ssl/SslRMIClientSocketFactory.java b/src/java.rmi/share/classes/javax/rmi/ssl/SslRMIClientSocketFactory.java
index ab6664b9d8f..a4475c8bd1e 100644
--- a/src/java.rmi/share/classes/javax/rmi/ssl/SslRMIClientSocketFactory.java
+++ b/src/java.rmi/share/classes/javax/rmi/ssl/SslRMIClientSocketFactory.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@ import java.net.Socket;
 import java.rmi.server.RMIClientSocketFactory;
 import java.util.StringTokenizer;
 import javax.net.SocketFactory;
+import javax.net.ssl.SSLParameters;
 import javax.net.ssl.SSLSocket;
 import javax.net.ssl.SSLSocketFactory;
 
@@ -119,6 +120,16 @@ public class SslRMIClientSocketFactory
         //
         final SSLSocket sslSocket = (SSLSocket)
             sslSocketFactory.createSocket(host, port);
+
+        if (Boolean.parseBoolean(
+                System.getProperty("jdk.rmi.ssl.client.enableEndpointIdentification", "true"))) {
+            SSLParameters params = sslSocket.getSSLParameters();
+            if (params == null) {
+                params = new SSLParameters();
+            }
+            params.setEndpointIdentificationAlgorithm("HTTPS");
+            sslSocket.setSSLParameters(params);
+        }
         // Set the SSLSocket Enabled Cipher Suites
         //
         final String enabledCipherSuites =
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
index 22cb796870b..7d0c5192039 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
@@ -142,6 +142,9 @@ public class LambdaToMethod extends TreeTranslator {
     /** dump statistics about lambda code generation */
     private final boolean dumpLambdaToMethodStats;
 
+    /** dump statistics about lambda deserialization code generation */
+    private final boolean dumpLambdaDeserializationStats;
+
     /** force serializable representation, for stress testing **/
     private final boolean forceSerializable;
 
@@ -187,6 +190,7 @@ public class LambdaToMethod extends TreeTranslator {
         transTypes = TransTypes.instance(context);
         Options options = Options.instance(context);
         dumpLambdaToMethodStats = options.isSet("debug.dumpLambdaToMethodStats");
+        dumpLambdaDeserializationStats = options.isSet("debug.dumpLambdaDeserializationStats");
         attr = Attr.instance(context);
         forceSerializable = options.isSet("forceSerializable");
         boolean lineDebugInfo =
@@ -714,8 +718,9 @@ public class LambdaToMethod extends TreeTranslator {
         String implMethodName = refSym.getQualifiedName().toString();
         String implMethodSignature = typeSig(types.erasure(refSym.type));
 
+        int implMethodKind = refSym.referenceKind();
         JCExpression kindTest = eqTest(syms.intType, deserGetter("getImplMethodKind", syms.intType),
-                make.Literal(refSym.referenceKind()));
+                make.Literal(implMethodKind));
         ListBuffer serArgs = new ListBuffer<>();
         int i = 0;
         for (Type t : indyType.getParameterTypes()) {
@@ -743,16 +748,16 @@ public class LambdaToMethod extends TreeTranslator {
             stmts = new ListBuffer<>();
             kInfo.deserializeCases.put(implMethodName, stmts);
         }
-        /* **
-        System.err.printf("+++++++++++++++++\n");
-        System.err.printf("*functionalInterfaceClass: '%s'\n", functionalInterfaceClass);
-        System.err.printf("*functionalInterfaceMethodName: '%s'\n", functionalInterfaceMethodName);
-        System.err.printf("*functionalInterfaceMethodSignature: '%s'\n", functionalInterfaceMethodSignature);
-        System.err.printf("*implMethodKind: %d\n", implMethodKind);
-        System.err.printf("*implClass: '%s'\n", implClass);
-        System.err.printf("*implMethodName: '%s'\n", implMethodName);
-        System.err.printf("*implMethodSignature: '%s'\n", implMethodSignature);
-        ****/
+        if (dumpLambdaDeserializationStats) {
+            log.note(pos, Notes.LambdaDeserializationStat(
+                    functionalInterfaceClass,
+                    functionalInterfaceMethodName,
+                    functionalInterfaceMethodSignature,
+                    implMethodKind,
+                    implClass,
+                    implMethodName,
+                    implMethodSignature));
+        }
         stmts.append(stmt);
     }
 
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
index d3539b53541..d658275d4dc 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
@@ -271,16 +271,11 @@ public class JavacParser implements Parser {
     /** When terms are parsed, the mode determines which is expected:
      *     mode = EXPR        : an expression
      *     mode = TYPE        : a type
-     *     mode = NOPARAMS    : no parameters allowed for type
-     *     mode = TYPEARG     : type argument
-     *     mode |= NOLAMBDA   : lambdas are not allowed
+     *     mode = NOLAMBDA    : lambdas are not allowed
      */
     protected static final int EXPR          = 1 << 0;
     protected static final int TYPE          = 1 << 1;
-    protected static final int NOPARAMS      = 1 << 2;
-    protected static final int TYPEARG       = 1 << 3;
-    protected static final int DIAMOND       = 1 << 4;
-    protected static final int NOLAMBDA      = 1 << 5;
+    protected static final int NOLAMBDA      = 1 << 2;
 
     protected void setMode(int mode) {
         this.mode = mode;
@@ -1439,12 +1434,6 @@ public class JavacParser implements Parser {
         int startMode = mode;
         List typeArgs = typeArgumentsOpt(EXPR);
         switch (token.kind) {
-        case QUES:
-            if (isMode(TYPE) && isMode(TYPEARG) && !isMode(NOPARAMS)) {
-                selectTypeMode();
-                return typeArgument();
-            } else
-                return illegal();
         case PLUSPLUS: case SUBSUB: case BANG: case TILDE: case PLUS: case SUB:
             if (typeArgs == null && isMode(EXPR)) {
                 TokenKind tk = token.kind;
@@ -1522,7 +1511,7 @@ public class JavacParser implements Parser {
             if (isMode(EXPR)) {
                 selectExprMode();
                 nextToken();
-                if (token.kind == LT) typeArgs = typeArguments(false);
+                if (token.kind == LT) typeArgs = typeArguments();
                 t = creator(pos, typeArgs);
                 typeArgs = null;
             } else return illegal();
@@ -1625,7 +1614,6 @@ public class JavacParser implements Parser {
                             return illegal();
                         }
                         int prevmode = mode;
-                        setMode(mode & ~NOPARAMS);
                         typeArgs = typeArgumentsOpt(EXPR);
                         setMode(prevmode);
                         if (isMode(EXPR)) {
@@ -1653,7 +1641,7 @@ public class JavacParser implements Parser {
                                 selectExprMode();
                                 int pos1 = token.pos;
                                 nextToken();
-                                if (token.kind == LT) typeArgs = typeArguments(false);
+                                if (token.kind == LT) typeArgs = typeArguments();
                                 t = innerCreator(pos1, typeArgs, t);
                                 typeArgs = null;
                                 break loop;
@@ -1704,7 +1692,7 @@ public class JavacParser implements Parser {
                                 nextToken();
                                 selectTypeMode();
                                 t = toP(F.at(token.pos).Select(t, ident()));
-                                t = typeArgumentsOpt(t);
+                                t = typeApplyOpt(t);
                             }
                             t = bracketsOpt(t);
                             if (token.kind != COLCOL) {
@@ -1721,7 +1709,7 @@ public class JavacParser implements Parser {
                 }
             }
             if (typeArgs != null) illegal();
-            t = typeArgumentsOpt(t);
+            t = typeApplyOpt(t);
             break;
         case BYTE: case SHORT: case CHAR: case INT: case LONG: case FLOAT:
         case DOUBLE: case BOOLEAN:
@@ -1880,7 +1868,7 @@ public class JavacParser implements Parser {
                     selectExprMode();
                     int pos2 = token.pos;
                     nextToken();
-                    if (token.kind == LT) typeArgs = typeArguments(false);
+                    if (token.kind == LT) typeArgs = typeArguments();
                     t = innerCreator(pos2, typeArgs, t);
                     typeArgs = null;
                 } else {
@@ -1900,7 +1888,7 @@ public class JavacParser implements Parser {
                     if (tyannos != null && tyannos.nonEmpty()) {
                         t = toP(F.at(tyannos.head.pos).AnnotatedType(tyannos, t));
                     }
-                    t = argumentsOpt(typeArgs, typeArgumentsOpt(t));
+                    t = argumentsOpt(typeArgs, typeApplyOpt(t));
                     typeArgs = null;
                 }
             } else if (isMode(EXPR) && token.kind == COLCOL) {
@@ -2302,7 +2290,7 @@ public class JavacParser implements Parser {
         } else {
             int pos = token.pos;
             accept(DOT);
-            typeArgs = (token.kind == LT) ? typeArguments(false) : null;
+            typeArgs = (token.kind == LT) ? typeArguments() : null;
             t = toP(F.at(pos).Select(t, ident()));
             t = argumentsOpt(typeArgs, t);
         }
@@ -2373,12 +2361,11 @@ public class JavacParser implements Parser {
 
     /**  TypeArgumentsOpt = [ TypeArguments ]
      */
-    JCExpression typeArgumentsOpt(JCExpression t) {
+    JCExpression typeApplyOpt(JCExpression t) {
         if (token.kind == LT &&
-            isMode(TYPE) &&
-            !isMode(NOPARAMS)) {
+            isMode(TYPE)) {
             selectTypeMode();
-            return typeArguments(t, false);
+            return typeApply(t);
         } else {
             return t;
         }
@@ -2389,12 +2376,11 @@ public class JavacParser implements Parser {
 
     List typeArgumentsOpt(int useMode) {
         if (token.kind == LT) {
-            if (!isMode(useMode) ||
-                isMode(NOPARAMS)) {
+            if (!isMode(useMode)) {
                 illegal();
             }
             setMode(useMode);
-            return typeArguments(false);
+            return typeArguments();
         }
         return null;
     }
@@ -2404,35 +2390,29 @@ public class JavacParser implements Parser {
      *  TypeArguments  = "<" TypeArgument {"," TypeArgument} ">"
      *  }
      */
-    List typeArguments(boolean diamondAllowed) {
+    List typeArguments() {
         if (token.kind == LT) {
             nextToken();
-            if (token.kind == GT && diamondAllowed) {
-                setMode(mode | DIAMOND);
+            ListBuffer args = new ListBuffer<>();
+            args.append(!isMode(EXPR) ? typeArgument() : parseType());
+            while (token.kind == COMMA) {
                 nextToken();
-                return List.nil();
-            } else {
-                ListBuffer args = new ListBuffer<>();
                 args.append(!isMode(EXPR) ? typeArgument() : parseType());
-                while (token.kind == COMMA) {
-                    nextToken();
-                    args.append(!isMode(EXPR) ? typeArgument() : parseType());
-                }
-                switch (token.kind) {
-
-                case GTGTGTEQ: case GTGTEQ: case GTEQ:
-                case GTGTGT: case GTGT:
-                    token = S.split();
-                    break;
-                case GT:
-                    nextToken();
-                    break;
-                default:
-                    args.append(syntaxError(token.pos, Errors.Expected2(GT, COMMA)));
-                    break;
-                }
-                return args.toList();
             }
+            switch (token.kind) {
+
+            case GTGTGTEQ: case GTGTEQ: case GTEQ:
+            case GTGTGT: case GTGT:
+                token = S.split();
+                break;
+            case GT:
+                nextToken();
+                break;
+            default:
+                args.append(syntaxError(token.pos, Errors.Expected2(GT, COMMA)));
+                break;
+            }
+            return args.toList();
         } else {
             return List.of(syntaxError(token.pos, Errors.Expected(LT)));
         }
@@ -2480,12 +2460,23 @@ public class JavacParser implements Parser {
         return result;
     }
 
-    JCTypeApply typeArguments(JCExpression t, boolean diamondAllowed) {
+    JCTypeApply typeApply(JCExpression t) {
         int pos = token.pos;
-        List args = typeArguments(diamondAllowed);
+        List args = typeArguments();
         return toP(F.at(pos).TypeApply(t, args));
     }
 
+    JCTypeApply typeApplyOrDiamond(JCExpression t) {
+        if (peekToken(GT)) {
+            int pos = token.pos;
+            accept(LT);
+            accept(GT);
+            return toP(F.at(pos).TypeApply(t, List.nil()));
+        } else {
+            return typeApply(t);
+        }
+    }
+
     /**
      * BracketsOpt = { [Annotations] "[" "]" }*
      *
@@ -2585,7 +2576,7 @@ public class JavacParser implements Parser {
         selectExprMode();
         List typeArgs = null;
         if (token.kind == LT) {
-            typeArgs = typeArguments(false);
+            typeArgs = typeArguments();
         }
         Name refName;
         ReferenceMode refMode;
@@ -2622,15 +2613,13 @@ public class JavacParser implements Parser {
 
         int prevmode = mode;
         selectTypeMode();
-        boolean diamondFound = false;
         int lastTypeargsPos = -1;
         if (token.kind == LT) {
             lastTypeargsPos = token.pos;
-            t = typeArguments(t, true);
-            diamondFound = isMode(DIAMOND);
+            t = typeApplyOrDiamond(t);
         }
         while (token.kind == DOT) {
-            if (diamondFound) {
+            if (TreeInfo.isDiamond(t)) {
                 //cannot select after a diamond
                 illegal();
             }
@@ -2645,8 +2634,7 @@ public class JavacParser implements Parser {
 
             if (token.kind == LT) {
                 lastTypeargsPos = token.pos;
-                t = typeArguments(t, true);
-                diamondFound = isMode(DIAMOND);
+                t = typeApplyOrDiamond(t);
             }
         }
         setMode(prevmode);
@@ -2657,7 +2645,7 @@ public class JavacParser implements Parser {
             }
 
             JCExpression e = arrayCreatorRest(newpos, t);
-            if (diamondFound) {
+            if (TreeInfo.isDiamond(t)) {
                 reportSyntaxError(lastTypeargsPos, Errors.CannotCreateArrayWithDiamond);
                 return toP(F.at(newpos).Erroneous(List.of(e)));
             }
@@ -2702,7 +2690,7 @@ public class JavacParser implements Parser {
 
         if (token.kind == LT) {
             int prevmode = mode;
-            t = typeArguments(t, true);
+            t = typeApplyOrDiamond(t);
             setMode(prevmode);
         }
         return classCreatorRest(newpos, encl, typeArgs, t);
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties
index 95a7546e2b3..2ba9122c04a 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties
@@ -1701,6 +1701,17 @@ compiler.note.mref.stat.1=\
     alternate metafactory = {0}\n\
     bridge method = {1}
 
+# 0: string, 1: string, 2: string, 3: number, 4: string, 5: string, 6: string
+compiler.note.lambda.deserialization.stat=\
+    Generating lambda deserialization\n\
+    functionalInterfaceClass: {0}\n\
+    functionalInterfaceMethodName: {1}\n\
+    functionalInterfaceMethodSignature:{2}\n\
+    implMethodKind: {3}\n\
+    implClass: {4}\n\
+    implMethodName: {5}\n\
+    implMethodSignature: {6}
+
 compiler.note.note=\
     Note:\u0020
 
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties
index 861f371632d..900557a29da 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties
@@ -292,7 +292,7 @@ compiler.err.annotation.decl.not.allowed.here=此处不允许批注接口声明
 compiler.err.cant.inherit.from.final=无法从最终{0}进行继承
 
 # 0: symbol or name
-compiler.err.cant.ref.before.ctor.called=对 {0} 的引用只能在显式调用构造器后显示
+compiler.err.cant.ref.before.ctor.called=对 {0} 的引用只能在显式调用构造器后出现
 
 # 0: symbol or name
 compiler.err.cant.assign.initialized.before.ctor.called=对初始化字段 ''{0}'' 的分配只能在显式调用构造器后显示
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_ja.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_ja.properties
index 0ea1796a8e6..3ae7ab1690e 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_ja.properties
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_ja.properties
@@ -60,7 +60,7 @@ javac.opt.target=指定されたJava SEリリースに適したクラス・フ
 javac.opt.release=指定されたJava SEリリースに対してコンパイルします。サポートされているリリース: \n    {0}
 javac.opt.source=指定されたJava SEリリースとソースの互換性を保持します。サポートされているリリース: \n    {0}
 javac.opt.Werror=警告が発生した場合にコンパイルを終了します
-javac.opt.arg.Werror=(,)*
+javac.opt.arg.Werror=<キー>(,<キー>)*
 javac.opt.Werror.custom=コンパイルを終了する警告のlintカテゴリを\nコンマで区切って指定します。\n指定したカテゴリを除外するには、キーの前に''-''を指定します。\nサポートされているキーを表示するには--help-lintを使用します。
 javac.opt.A=注釈プロセッサに渡されるオプション
 javac.opt.implicit=暗黙的に参照されるファイルについてクラス・ファイルを生成するかどうかを指定する
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties
index 0cbfac7e778..447d0d26239 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties
@@ -60,7 +60,7 @@ javac.opt.target=生成适合指定的 Java SE 发行版的类文件。支持的
 javac.opt.release=为指定的 Java SE 发行版编译。支持的发行版:{0}
 javac.opt.source=提供与指定的 Java SE 发行版的源兼容性。支持的发行版:{0}
 javac.opt.Werror=出现任何警告时终止编译
-javac.opt.arg.Werror=(,)*
+javac.opt.arg.Werror=<键>(,<键>)*
 javac.opt.Werror.custom=指定出现警告时应终止编译的 lint 类别,\n以逗号分隔。\n在关键字前面加上 ''-'' 可排除指定的类别。\n使用 --help-lint 可查看支持的关键字。
 javac.opt.A=传递给批注处理程序的选项
 javac.opt.implicit=指定是否为隐式引用文件生成类文件
diff --git a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_crypt.c b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_crypt.c
index d969fabffd0..052c7011860 100644
--- a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_crypt.c
+++ b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_crypt.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
  */
 
 /* Copyright  (c) 2002 Graz University of Technology. All rights reserved.
@@ -184,9 +184,12 @@ Java_sun_security_pkcs11_wrapper_PKCS11_C_1Encrypt
 
     if (directIn != 0) {
       inBufP = (CK_BYTE_PTR) jlong_to_ptr(directIn);
-    } else {
+    } else if (jIn != NULL) {
       inBufP = (*env)->GetPrimitiveArrayCritical(env, jIn, NULL);
+      // may happen if out of memory
       if (inBufP == NULL) { return 0; }
+    } else {
+      inBufP = NULL;
     }
 
     if (directOut != 0) {
@@ -194,7 +197,7 @@ Java_sun_security_pkcs11_wrapper_PKCS11_C_1Encrypt
     } else {
       outBufP = (*env)->GetPrimitiveArrayCritical(env, jOut, NULL);
       if (outBufP == NULL) {
-        if (directIn == 0) {
+        if (directIn == 0 && inBufP != NULL) {
           (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT);
         }
         return 0;
@@ -208,7 +211,7 @@ Java_sun_security_pkcs11_wrapper_PKCS11_C_1Encrypt
                                     (CK_BYTE_PTR)(outBufP + jOutOfs),
                                     &ckEncryptedLen);
 
-    if (directIn == 0) {
+    if (directIn == 0 && inBufP != NULL) {
         (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT);
     }
     if (directOut == 0) {
@@ -251,9 +254,12 @@ Java_sun_security_pkcs11_wrapper_PKCS11_C_1EncryptUpdate
 
     if (directIn != 0) {
       inBufP = (CK_BYTE_PTR) jlong_to_ptr(directIn);
-    } else {
+    } else if (jIn != NULL) {
       inBufP = (*env)->GetPrimitiveArrayCritical(env, jIn, NULL);
+      // may happen if out of memory
       if (inBufP == NULL) { return 0; }
+    } else {
+      inBufP = NULL;
     }
 
     if (directOut != 0) {
@@ -261,7 +267,7 @@ Java_sun_security_pkcs11_wrapper_PKCS11_C_1EncryptUpdate
     } else {
       outBufP = (*env)->GetPrimitiveArrayCritical(env, jOut, NULL);
       if (outBufP == NULL) {
-        if (directIn == 0) {
+        if (directIn == 0 && inBufP != NULL) {
           (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT);
         }
         return 0;
@@ -275,7 +281,7 @@ Java_sun_security_pkcs11_wrapper_PKCS11_C_1EncryptUpdate
                                           (CK_BYTE_PTR)(outBufP + jOutOfs),
                                           &ckEncryptedPartLen);
 
-    if (directIn == 0) {
+    if (directIn == 0 && inBufP != NULL) {
         (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT);
     }
     if (directOut == 0) {
@@ -462,9 +468,12 @@ Java_sun_security_pkcs11_wrapper_PKCS11_C_1Decrypt
 
     if (directIn != 0) {
       inBufP = (CK_BYTE_PTR) jlong_to_ptr(directIn);
-    } else {
+    } else if (jIn != NULL) {
       inBufP = (*env)->GetPrimitiveArrayCritical(env, jIn, NULL);
+      // may happen if out of memory
       if (inBufP == NULL) { return 0; }
+    } else {
+      inBufP = NULL;
     }
 
     if (directOut != 0) {
@@ -472,7 +481,7 @@ Java_sun_security_pkcs11_wrapper_PKCS11_C_1Decrypt
     } else {
       outBufP = (*env)->GetPrimitiveArrayCritical(env, jOut, NULL);
       if (outBufP == NULL) {
-        if (directIn == 0) {
+        if (directIn == 0 && inBufP != NULL) {
           (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT);
         }
         return 0;
@@ -485,7 +494,7 @@ Java_sun_security_pkcs11_wrapper_PKCS11_C_1Decrypt
                                     (CK_BYTE_PTR)(outBufP + jOutOfs),
                                     &ckOutLen);
 
-    if (directIn == 0) {
+    if (directIn == 0 && inBufP != NULL) {
         (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT);
     }
     if (directOut == 0) {
@@ -528,9 +537,12 @@ Java_sun_security_pkcs11_wrapper_PKCS11_C_1DecryptUpdate
 
     if (directIn != 0) {
       inBufP = (CK_BYTE_PTR) jlong_to_ptr(directIn);
-    } else {
+    } else if (jIn != NULL) {
       inBufP = (*env)->GetPrimitiveArrayCritical(env, jIn, NULL);
+      // may happen if out of memory
       if (inBufP == NULL) { return 0; }
+    } else {
+      inBufP = NULL;
     }
 
     if (directOut != 0) {
@@ -538,7 +550,7 @@ Java_sun_security_pkcs11_wrapper_PKCS11_C_1DecryptUpdate
     } else {
       outBufP = (*env)->GetPrimitiveArrayCritical(env, jOut, NULL);
       if (outBufP == NULL) {
-        if (directIn == 0) {
+        if (directIn == 0 && inBufP != NULL) {
           (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT);
         }
         return 0;
@@ -551,7 +563,7 @@ Java_sun_security_pkcs11_wrapper_PKCS11_C_1DecryptUpdate
                                           (CK_BYTE_PTR)(outBufP + jOutOfs),
                                           &ckDecryptedPartLen);
 
-    if (directIn == 0) {
+    if (directIn == 0 && inBufP != NULL) {
         (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT);
     }
     if (directOut == 0) {
diff --git a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/Headers.java b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/Headers.java
index 2decd48c806..9389aae8691 100644
--- a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/Headers.java
+++ b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/Headers.java
@@ -36,6 +36,7 @@ import java.util.Set;
 import java.util.function.BiFunction;
 import java.util.stream.Collectors;
 import sun.net.httpserver.UnmodifiableHeaders;
+import sun.net.httpserver.Utils;
 
 /**
  * HTTP request and response headers are represented by this class which
@@ -216,8 +217,13 @@ public class Headers implements Map> {
 
     @Override
     public List put(String key, List value) {
+        // checkHeader is called in this class to fail fast
+        // It also must be called in sendResponseHeaders because
+        // Headers instances internal state can be modified
+        // external to these methods.
+        Utils.checkHeader(key, false);
         for (String v : value)
-            checkValue(v);
+            Utils.checkHeader(v, true);
         return map.put(normalize(key), value);
     }
 
@@ -229,7 +235,8 @@ public class Headers implements Map> {
      * @param value the value to add to the header
      */
     public void add(String key, String value) {
-        checkValue(value);
+        Utils.checkHeader(key, false);
+        Utils.checkHeader(value, true);
         String k = normalize(key);
         List l = map.get(k);
         if (l == null) {
@@ -239,30 +246,6 @@ public class Headers implements Map> {
         l.add(value);
     }
 
-    private static void checkValue(String value) {
-        int len = value.length();
-        for (int i=0; i= len - 2) {
-                    throw new IllegalArgumentException("Illegal CR found in header");
-                }
-                char c1 = value.charAt(i+1);
-                char c2 = value.charAt(i+2);
-                if (c1 != '\n') {
-                    throw new IllegalArgumentException("Illegal char found after CR in header");
-                }
-                if (c2 != ' ' && c2 != '\t') {
-                    throw new IllegalArgumentException("No whitespace found after CRLF in header");
-                }
-                i+=2;
-            } else if (c == '\n') {
-                throw new IllegalArgumentException("Illegal LF found in header");
-            }
-        }
-    }
-
     /**
      * Sets the given {@code value} as the sole header value for the given
      * {@code key}. If the mapping does not already exist, then it is created.
@@ -304,7 +287,7 @@ public class Headers implements Map> {
     public void replaceAll(BiFunction, ? extends List> function) {
         var f = function.andThen(values -> {
             Objects.requireNonNull(values);
-            values.forEach(Headers::checkValue);
+            values.forEach(value -> Utils.checkHeader(value, true));
             return values;
         });
         Map.super.replaceAll(f);
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 8da98cdcfa5..ad6805938a2 100644
--- a/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java
+++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java
@@ -207,6 +207,8 @@ class ExchangeImpl {
         return uos_orig;
     }
 
+    private static final byte[] CRLF = new byte[] {0x0D, 0x0A};
+
     public void sendResponseHeaders(int rCode, long contentLen)
     throws IOException
     {
@@ -215,10 +217,11 @@ class ExchangeImpl {
             throw new IOException("headers already sent");
         }
         this.rcode = rCode;
-        String statusLine = "HTTP/1.1 " + rCode + Code.msg(rCode) + "\r\n";
+        String statusLine = "HTTP/1.1 " + rCode + Code.msg(rCode);
         ByteArrayOutputStream tmpout = new ByteArrayOutputStream();
         PlaceholderOutputStream o = getPlaceholderResponseBody();
-        tmpout.write(bytes(statusLine, 0), 0, statusLine.length());
+        tmpout.write(bytes(statusLine, false, 0), 0, statusLine.length());
+        tmpout.write(CRLF);
         boolean noContentToSend = false; // assume there is content
         boolean noContentLengthHeader = false; // must not send Content-length is set
         rspHdrs.set("Date", FORMATTER.format(Instant.now()));
@@ -305,11 +308,11 @@ class ExchangeImpl {
             List values = entry.getValue();
             for (String val : values) {
                 int i = key.length();
-                buf = bytes(key, 2);
+                buf = bytes(key, true, 2);
                 buf[i++] = ':';
                 buf[i++] = ' ';
                 os.write(buf, 0, i);
-                buf = bytes(val, 2);
+                buf = bytes(val, false, 2);
                 i = val.length();
                 buf[i++] = '\r';
                 buf[i++] = '\n';
@@ -327,8 +330,14 @@ class ExchangeImpl {
      * Make sure that at least "extra" bytes are free at end
      * of rspbuf. Reallocate rspbuf if not big enough.
      * caller must check return value to see if rspbuf moved
+     *
+     * Header values are supposed to be limited to 7-bit ASCII
+     * but 8-bit has to be allowed (for ISO_8859_1). For efficiency
+     * we just down cast 16 bit Java chars to byte. We don't allow
+     * any character that can't be encoded in 8 bits.
      */
-    private byte[] bytes(String s, int extra) {
+    private byte[] bytes(String s, boolean isKey, int extra) throws IOException {
+        Utils.checkHeader(s, !isKey);
         int slen = s.length();
         if (slen+extra > rspbuf.length) {
             int diff = slen + extra - rspbuf.length;
diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/Utils.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/Utils.java
index 43dadb84a90..41834172f27 100644
--- a/src/jdk.httpserver/share/classes/sun/net/httpserver/Utils.java
+++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/Utils.java
@@ -88,4 +88,37 @@ public class Utils {
         }
         return true;
     }
+
+    /* Throw IAE if illegal character found.  isValue is true if String is
+     * a value. Otherwise it is header name
+     */
+    public static void checkHeader(String str, boolean isValue) {
+        int len = str.length();
+        for (int i=0; i= len - 2) {
+                    throw new IllegalArgumentException("Illegal CR found in header");
+                }
+                char c1 = str.charAt(i+1);
+                char c2 = str.charAt(i+2);
+                if (c1 != '\n') {
+                    throw new IllegalArgumentException("Illegal char found after CR in header");
+                }
+                if (c2 != ' ' && c2 != '\t') {
+                    throw new IllegalArgumentException("No whitespace found after CRLF in header");
+                }
+                i+=2;
+            } else if (c == '\n') {
+                throw new IllegalArgumentException("Illegal LF found in header");
+            } else if (c > 255) {
+                throw new IllegalArgumentException("Illegal character found in header");
+            }
+        }
+    }
+
 }
diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java
index 841221c57d9..24c92e81a4c 100644
--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java
@@ -71,7 +71,7 @@ public final class JVM {
     /**
      * Begin recording events
      *
-     * Requires that JFR has been started with {@link #createNativeJFR()}
+     * Requires that JFR has been started with {@link JVMSupport#createJFR()}
      */
     public static native void beginRecording();
 
@@ -83,7 +83,7 @@ public final class JVM {
     /**
      * End recording events, which includes flushing data in thread buffers
      *
-     * Requires that JFR has been started with {@link #createNativeJFR()}
+     * Requires that JFR has been started with {@link JVMSupport#createJFR()}
      *
      */
     public static native void endRecording();
@@ -144,7 +144,7 @@ public final class JVM {
     /**
      * Return unique identifier for stack trace.
      *
-     * Requires that JFR has been started with {@link #createNativeJFR()}
+     * Requires that JFR has been started with {@link JVMSupport#createJFR()}
      *
      * @param skipCount number of frames to skip, or 0 if no frames should be
      *                  skipped
@@ -295,7 +295,7 @@ public final class JVM {
     /**
      * Sets the file where data should be written.
      *
-     * Requires that JFR has been started with {@link #createNativeJFR()}
+     * Requires that JFR has been started with {@link JVMSupport#createJFR()}
      *
      * 
      * Recording  Previous  Current  Action
@@ -380,7 +380,7 @@ public final class JVM {
      * chunk, data should be written after GMT offset and size of metadata event
      * should be adjusted
      *
-     * Requires that JFR has been started with {@link #createNativeJFR()}
+     * Requires that JFR has been started with {@link JVMSupport#createJFR()}
      *
      * @param bytes binary representation of metadata descriptor
      */
@@ -409,7 +409,7 @@ public final class JVM {
     /**
      * Destroys native part of JFR. If already destroy, call is ignored.
      *
-     * Requires that JFR has been started with {@link #createNativeJFR()}
+     * Requires that JFR has been started with {@link JVMSupport#createJFR()}
      *
      * @return if an instance was actually destroyed.
      *
diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_de.properties b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_de.properties
index 80d1ba6e05f..c313d6a348d 100644
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_de.properties
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_de.properties
@@ -170,7 +170,7 @@ plugin.opt.resources-last-sorter=\      --resources-last-sorter     Das le
 
 plugin.opt.disable-plugin=\      --disable-plugin      Deaktiviert das angegebene Plug-in
 
-plugin.opt.compress=\      --compress              Komprimiert alle Ressourcen im Ausgabeimage:\n                                        Zulässige Werte:\n                                        zip-'{0-9}', wobei "zip-0" für keine Komprimierung\n                                        und "zip-9" für die beste Komprimierung steht.\n                                        Standardwert ist "zip-6."\n                                        Veraltete Werte, die in einem zukünftigen Release entfernt werden:\n                                        0:  Keine Komprimierung. Verwenden Sie stattdessen "zip-0".\n                                        1:  Gemeinsame Verwendung konstanter Zeichenfolgen\n                                        2:  ZIP. Verwenden Sie stattdessen "zip-6".
+plugin.opt.compress=\      --compress              Komprimiert alle Ressourcen im Ausgabeimage:\n                                        Zulässige Werte:\n                                        zip-'{0-9}', wobei "zip-0" für keine Komprimierung\n                                        und "zip-9" für die beste Komprimierung steht.\n                                        Standardwert ist "zip-6".\n                                        Veraltete Werte, die in einem zukünftigen Release entfernt werden:\n                                        0:  Keine Komprimierung. Verwenden Sie stattdessen "zip-0".\n                                        1:  Gemeinsame Verwendung konstanter Zeichenfolgen\n                                        2:  ZIP. Verwenden Sie stattdessen "zip-6".
 
 plugin.opt.strip-debug=\  -G, --strip-debug                     Entfernt Debuginformationen
 
diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_ja.properties b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_ja.properties
index 6ed0a486132..a5dc70061f6 100644
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_ja.properties
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_ja.properties
@@ -170,7 +170,7 @@ plugin.opt.resources-last-sorter=\      --resources-last-sorter     最後
 
 plugin.opt.disable-plugin=\      --disable-plugin      指定したプラグインを無効にします
 
-plugin.opt.compress=\      --compress              出力イメージ内のすべてのリソースを圧縮します:\n                                        使用可能な値は\n                                        zip-'{0-9}'です。zip-0では圧縮は行われず、\n                                        zip-9では最適な圧縮が行われます。\n                                        デフォルトはzip-6です。\n                                        今後のリリースで削除される非推奨の値:\n                                        0:  圧縮なし。かわりにzip-0を使用。\n                                        1:  定数文字列の共有\n                                        2:  ZIP。かわりにzip-6を使用。
+plugin.opt.compress=\      --compress <圧縮>             出力イメージ内のすべてのリソースを圧縮します:\n                                        使用可能な値は\n                                        zip-'{0-9}'です。zip-0では圧縮は行われず、\n                                        zip-9では最適な圧縮が行われます。\n                                        デフォルトはzip-6です。\n                                        今後のリリースで削除される非推奨の値:\n                                        0:  圧縮なし。かわりにzip-0を使用。\n                                        1:  定数文字列の共有\n                                        2:  ZIP。かわりにzip-6を使用。
 
 plugin.opt.strip-debug=\  -G, --strip-debug                     デバッグ情報を削除します
 
diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_zh_CN.properties b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_zh_CN.properties
index a0480a31fc3..1de1ef372b6 100644
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_zh_CN.properties
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_zh_CN.properties
@@ -170,7 +170,7 @@ plugin.opt.resources-last-sorter=\      --resources-last-sorter     允许
 
 plugin.opt.disable-plugin=\      --disable-plugin      禁用所提及的插件
 
-plugin.opt.compress=\      --compress              在输出映像中压缩所有资源:\n                                        接受的值包括:\n                                        zip-'{0-9}',其中 zip-0 表示无压缩,\n                                        zip-9 表示最佳压缩。\n                                        默认值为 zip-6。\n                                        要在未来发行版中删除的已过时值:\n                                        0:无压缩。改为使用 zip-0。\n                                        1:常量字符串共享\n                                        2:ZIP。改为使用 zip-6。
+plugin.opt.compress=\      --compress <压缩>             在输出映像中压缩所有资源:\n                                        接受的值包括:\n                                        zip-'{0-9}',其中 zip-0 表示无压缩,\n                                        zip-9 表示最佳压缩。\n                                        默认值为 zip-6。\n                                        要在未来发行版中删除的已过时值:\n                                        0:无压缩。改为使用 zip-0。\n                                        1:常量字符串共享\n                                        2:ZIP。改为使用 zip-6。
 
 plugin.opt.strip-debug=\  -G, --strip-debug                     去除调试信息
 
diff --git a/src/jdk.security.auth/share/classes/com/sun/security/auth/module/UnixLoginModule.java b/src/jdk.security.auth/share/classes/com/sun/security/auth/module/UnixLoginModule.java
index 785b178e296..4f6d8ca25ef 100644
--- a/src/jdk.security.auth/share/classes/com/sun/security/auth/module/UnixLoginModule.java
+++ b/src/jdk.security.auth/share/classes/com/sun/security/auth/module/UnixLoginModule.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
@@ -26,7 +26,6 @@
 package com.sun.security.auth.module;
 
 import java.util.*;
-import java.io.IOException;
 import javax.security.auth.*;
 import javax.security.auth.callback.*;
 import javax.security.auth.login.*;
@@ -34,6 +33,7 @@ import javax.security.auth.spi.*;
 import com.sun.security.auth.UnixPrincipal;
 import com.sun.security.auth.UnixNumericUserPrincipal;
 import com.sun.security.auth.UnixNumericGroupPrincipal;
+import jdk.internal.util.OperatingSystem;
 
 /**
  * This {@code LoginModule} imports a user's Unix
@@ -121,20 +121,34 @@ public class UnixLoginModule implements LoginModule {
      */
     public boolean login() throws LoginException {
 
-        long[] unixGroups = null;
+        // Fail immediately on Windows to avoid cygwin-like functions
+        // being loaded, which are not supported.
+        if (OperatingSystem.isWindows()) {
+            throw new FailedLoginException
+                    ("Failed in attempt to import " +
+                            "the underlying system identity information" +
+                            " on " + System.getProperty("os.name"));
+        }
 
         try {
             ss = new UnixSystem();
-        } catch (UnsatisfiedLinkError ule) {
+        } catch (ExceptionInInitializerError | UnsatisfiedLinkError ule) {
+            // Errors could happen in either static blocks or the constructor,
+            // both have a cause.
             succeeded = false;
-            throw new FailedLoginException
+            var error = new FailedLoginException
                                 ("Failed in attempt to import " +
                                 "the underlying system identity information" +
                                 " on " + System.getProperty("os.name"));
+            if (ule.getCause() != null) {
+                error.initCause(ule.getCause());
+            }
+            throw error;
         }
         userPrincipal = new UnixPrincipal(ss.getUsername());
         UIDPrincipal = new UnixNumericUserPrincipal(ss.getUid());
         GIDPrincipal = new UnixNumericGroupPrincipal(ss.getGid(), true);
+        long[] unixGroups = null;
         if (ss.getGroups() != null && ss.getGroups().length > 0) {
             unixGroups = ss.getGroups();
             for (int i = 0; i < unixGroups.length; i++) {
@@ -150,9 +164,11 @@ public class UnixLoginModule implements LoginModule {
                     "succeeded importing info: ");
             System.out.println("\t\t\tuid = " + ss.getUid());
             System.out.println("\t\t\tgid = " + ss.getGid());
-            unixGroups = ss.getGroups();
-            for (int i = 0; i < unixGroups.length; i++) {
-                System.out.println("\t\t\tsupp gid = " + unixGroups[i]);
+            System.out.println("\t\t\tusername = " + ss.getUsername());
+            if (unixGroups != null) {
+                for (int i = 0; i < unixGroups.length; i++) {
+                    System.out.println("\t\t\tsupp gid = " + unixGroups[i]);
+                }
             }
         }
         succeeded = true;
diff --git a/src/jdk.security.auth/share/classes/com/sun/security/auth/module/UnixSystem.java b/src/jdk.security.auth/share/classes/com/sun/security/auth/module/UnixSystem.java
index f3741c10404..c0e47fafc2c 100644
--- a/src/jdk.security.auth/share/classes/com/sun/security/auth/module/UnixSystem.java
+++ b/src/jdk.security.auth/share/classes/com/sun/security/auth/module/UnixSystem.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
@@ -25,38 +25,194 @@
 
 package com.sun.security.auth.module;
 
+import jdk.internal.util.Architecture;
+import jdk.internal.util.OperatingSystem;
+
+import java.lang.foreign.AddressLayout;
+import java.lang.foreign.Arena;
+import java.lang.foreign.FunctionDescriptor;
+import java.lang.foreign.GroupLayout;
+import java.lang.foreign.Linker;
+import java.lang.foreign.MemoryLayout;
+import java.lang.foreign.MemorySegment;
+import java.lang.foreign.StructLayout;
+import java.lang.foreign.SymbolLookup;
+import java.lang.foreign.ValueLayout;
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.VarHandle;
+
+import static java.lang.foreign.MemoryLayout.PathElement.groupElement;
+
 /**
  * This class implementation retrieves and makes available Unix
  * UID/GID/groups information for the current user.
  *
  * @since 1.4
  */
+@SuppressWarnings("restricted")
 public class UnixSystem {
 
-    private native void getUnixInfo();
-
-    // Warning: the following 4 fields are used by Unix.c
-
-    /** The current username. */
+    /**
+     * The current username.
+     */
     protected String username;
 
-    /** The current user ID. */
+    /**
+     * The current user ID.
+     */
     protected long uid;
 
-    /** The current group ID. */
+    /**
+     * The current group ID.
+     */
     protected long gid;
 
-    /** The current list of groups. */
+    /**
+     * The current list of groups.
+     */
     protected long[] groups;
 
+    private static final Linker LINKER = Linker.nativeLinker();
+    private static final SymbolLookup SYMBOL_LOOKUP = SymbolLookup.loaderLookup()
+            .or(LINKER.defaultLookup());
+
+    private static final ValueLayout.OfByte C_CHAR
+            = (ValueLayout.OfByte) LINKER.canonicalLayouts().get("char");
+    private static final ValueLayout.OfInt C_INT
+            = (ValueLayout.OfInt) LINKER.canonicalLayouts().get("int");
+    private static final ValueLayout.OfLong C_LONG
+            = (ValueLayout.OfLong) LINKER.canonicalLayouts().get("long");
+    private static final AddressLayout C_POINTER
+            = ((AddressLayout) LINKER.canonicalLayouts().get("void*"))
+            .withTargetLayout(MemoryLayout.sequenceLayout(java.lang.Long.MAX_VALUE, C_CHAR));
+    private static final ValueLayout C_SIZE_T
+            = (ValueLayout) LINKER.canonicalLayouts().get("size_t");
+
+    private static final StructLayout CAPTURE_STATE_LAYOUT
+            = Linker.Option.captureStateLayout();
+    private static final VarHandle VH_errno = CAPTURE_STATE_LAYOUT.varHandle(
+            MemoryLayout.PathElement.groupElement("errno"));
+
+    private static final MethodHandle MH_strerror
+            = LINKER.downcallHandle(SYMBOL_LOOKUP.findOrThrow("strerror"),
+                    FunctionDescriptor.of(C_POINTER, C_INT));
+
+    private static final MethodHandle MH_getgroups
+            = LINKER.downcallHandle(SYMBOL_LOOKUP.findOrThrow("getgroups"),
+                    FunctionDescriptor.of(C_INT, C_INT, C_POINTER),
+                    Linker.Option.captureCallState("errno"));
+    private static final MethodHandle MH_getuid
+            = LINKER.downcallHandle(SYMBOL_LOOKUP.findOrThrow("getuid"),
+                    FunctionDescriptor.of(C_INT));
+
+    // Some architectures require appropriate zero or sign extension to 64 bit.
+    // Use long directly before https://bugs.openjdk.org/browse/JDK-8336664 is resolved.
+    private static final boolean calling_convention_requires_int_as_long
+            = Architecture.isPPC64() || Architecture.isPPC64LE() || Architecture.isS390();
+
+    // getpwuid_r does not work on AIX, instead we use another similar function
+    // extern int _posix_getpwuid_r(uid_t, struct passwd *, char *, int, struct passwd **)
+    private static final MethodHandle MH_getpwuid_r
+            = LINKER.downcallHandle(SYMBOL_LOOKUP.findOrThrow(
+                            OperatingSystem.isAix() ? "_posix_getpwuid_r" : "getpwuid_r"),
+                    FunctionDescriptor.of(C_INT,
+                            calling_convention_requires_int_as_long ? C_LONG : C_INT,
+                            C_POINTER, C_POINTER,
+                            OperatingSystem.isAix() ? C_INT : C_SIZE_T,
+                            C_POINTER));
+
+    private static final GroupLayout ML_passwd = MemoryLayout.structLayout(
+            C_POINTER.withName("pw_name"),
+            C_POINTER.withName("pw_passwd"),
+            C_INT.withName("pw_uid"),
+            C_INT.withName("pw_gid"),
+            // Different platforms have different fields in `struct passwd`.
+            // While we don't need those fields here, the struct needs to be
+            // big enough to avoid buffer overflow when `getpwuid_r` is called.
+            MemoryLayout.paddingLayout(100));
+
+    private static final VarHandle VH_pw_uid
+            = ML_passwd.varHandle(groupElement("pw_uid"));
+    private static final VarHandle VH_pw_gid
+            = ML_passwd.varHandle(groupElement("pw_gid"));
+    private static final VarHandle VH_pw_name
+            = ML_passwd.varHandle(groupElement("pw_name"));
+
+    // The buffer size for the getpwuid_r function:
+    // 1. sysconf(_SC_GETPW_R_SIZE_MAX) on macOS is 4096 and 1024 on Linux,
+    //    so we choose a bigger one.
+    // 2. We do not call sysconf() here because even _SC_GETPW_R_SIZE_MAX
+    //    could be different on different platforms.
+    // 3. We choose int instead of long because the buffer_size argument
+    //    might be `int` or `long` and converting from `long` to `int`
+    //    requires an explicit cast.
+    private static final int GETPW_R_SIZE_MAX = 4096;
+
     /**
      * Instantiate a {@code UnixSystem} and load
      * the native library to access the underlying system information.
      */
-    @SuppressWarnings("restricted")
     public UnixSystem() {
-        System.loadLibrary("jaas");
-        getUnixInfo();
+        // The FFM code has only been tested on multiple platforms
+        // (including macOS, Linux, AIX, etc) and might fail on other
+        // *nix systems. Especially, the `passwd` struct could be defined
+        // differently. I've checked several and an extra 100 chars at the
+        // end seems enough.
+        try (Arena scope = Arena.ofConfined()) {
+            MemorySegment capturedState = scope.allocate(CAPTURE_STATE_LAYOUT);
+            int groupnum = (int) MH_getgroups.invokeExact(capturedState, 0, MemorySegment.NULL);
+            if (groupnum == -1) {
+                throw new RuntimeException("getgroups returns " + groupnum);
+            }
+
+            var gs = scope.allocate(C_INT, groupnum);
+            groupnum = (int) MH_getgroups.invokeExact(capturedState, groupnum, gs);
+            if (groupnum == -1) {
+                var errno = (int) VH_errno.get(capturedState, 0L);
+                var errMsg = (MemorySegment) MH_strerror.invokeExact(errno);
+                throw new RuntimeException("getgroups returns " + groupnum
+                        + ". Reason: " + errMsg.reinterpret(Long.MAX_VALUE).getString(0));
+            }
+
+            groups = new long[groupnum];
+            for (int i = 0; i < groupnum; i++) {
+                groups[i] = Integer.toUnsignedLong(gs.getAtIndex(C_INT, i));
+            }
+
+            var pwd = scope.allocate(ML_passwd);
+            var result = scope.allocate(C_POINTER);
+            var buffer = scope.allocate(GETPW_R_SIZE_MAX);
+
+            long tmpUid = Integer.toUnsignedLong((int) MH_getuid.invokeExact());
+
+            // Do not call invokeExact because the type of buffer_size is not
+            // always long in the underlying system.
+            int out;
+            if (calling_convention_requires_int_as_long) {
+                out = (int) MH_getpwuid_r.invoke(
+                        tmpUid, pwd, buffer, GETPW_R_SIZE_MAX, result);
+            } else {
+                out = (int) MH_getpwuid_r.invoke(
+                        (int) tmpUid, pwd, buffer, GETPW_R_SIZE_MAX, result);
+            }
+            if (out != 0) {
+                // If ERANGE (Result too large) is detected in a new platform,
+                // consider adjusting GETPW_R_SIZE_MAX.
+                var err = (MemorySegment) MH_strerror.invokeExact(out);
+                throw new RuntimeException(err.reinterpret(Long.MAX_VALUE).getString(0));
+            } else if (result.get(ValueLayout.ADDRESS, 0).equals(MemorySegment.NULL)) {
+                throw new RuntimeException("the requested entry is not found");
+            } else {
+                // uid_t and gid_t were defined unsigned.
+                uid = Integer.toUnsignedLong((int) VH_pw_uid.get(pwd, 0L));
+                gid = Integer.toUnsignedLong((int) VH_pw_gid.get(pwd, 0L));
+                username = ((MemorySegment) VH_pw_name.get(pwd, 0L)).getString(0);
+            }
+        } catch (Throwable t) {
+            var error = new UnsatisfiedLinkError("FFM calls failed");
+            error.initCause(t);
+            throw error;
+        }
     }
 
     /**
diff --git a/src/jdk.security.auth/unix/native/libjaas/Unix.c b/src/jdk.security.auth/unix/native/libjaas/Unix.c
deleted file mode 100644
index 3a93df9ffc9..00000000000
--- a/src/jdk.security.auth/unix/native/libjaas/Unix.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include 
-#include "jni_util.h"
-#include "com_sun_security_auth_module_UnixSystem.h"
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-
-/*
- * Declare library specific JNI_Onload entry if static build
- */
-DEF_STATIC_JNI_OnLoad
-
-JNIEXPORT void JNICALL
-Java_com_sun_security_auth_module_UnixSystem_getUnixInfo
-                                                (JNIEnv *env, jobject obj) {
-
-    int i;
-    char pwd_buf[1024];
-    struct passwd *pwd = NULL;
-    struct passwd resbuf;
-    jfieldID userNameID;
-    jfieldID userID;
-    jfieldID groupID;
-    jfieldID supplementaryGroupID;
-
-    jstring jstr;
-    jlongArray jgroups;
-    jlong *jgroupsAsArray;
-    jsize numSuppGroups;
-    gid_t *groups;
-    jclass cls;
-
-    numSuppGroups = getgroups(0, NULL);
-    if (numSuppGroups == -1) {
-        return;
-    }
-    groups = (gid_t *)calloc(numSuppGroups, sizeof(gid_t));
-    if (groups == NULL) {
-        jclass cls = (*env)->FindClass(env,"java/lang/OutOfMemoryError");
-        if (cls != NULL) {
-            (*env)->ThrowNew(env, cls, NULL);
-        }
-        return;
-    }
-
-    cls = (*env)->GetObjectClass(env, obj);
-
-    supplementaryGroupID = (*env)->GetFieldID(env, cls, "groups", "[J");
-    if (supplementaryGroupID == 0) {
-        goto cleanUpAndReturn;
-    }
-
-    if (getgroups(numSuppGroups, groups) != -1) {
-        jgroups = (*env)->NewLongArray(env, numSuppGroups);
-        if (jgroups == NULL) {
-            goto cleanUpAndReturn;
-        }
-        jgroupsAsArray = (*env)->GetLongArrayElements(env, jgroups, 0);
-        if (jgroupsAsArray == NULL) {
-            goto cleanUpAndReturn;
-        }
-        for (i = 0; i < numSuppGroups; i++) {
-            jgroupsAsArray[i] = groups[i];
-        }
-        (*env)->ReleaseLongArrayElements(env, jgroups, jgroupsAsArray, 0);
-        (*env)->SetObjectField(env, obj, supplementaryGroupID, jgroups);
-    }
-
-    userNameID = (*env)->GetFieldID(env, cls, "username", "Ljava/lang/String;");
-    if (userNameID == 0) {
-        goto cleanUpAndReturn;
-    }
-
-    userID = (*env)->GetFieldID(env, cls, "uid", "J");
-    if (userID == 0) {
-        goto cleanUpAndReturn;
-    }
-
-    groupID = (*env)->GetFieldID(env, cls, "gid", "J");
-    if (groupID == 0) {
-        goto cleanUpAndReturn;
-    }
-
-    memset(pwd_buf, 0, sizeof(pwd_buf));
-    if (getpwuid_r(getuid(), &resbuf, pwd_buf, sizeof(pwd_buf), &pwd) == 0 &&
-            pwd != NULL) {
-        (*env)->SetLongField(env, obj, userID, pwd->pw_uid);
-        (*env)->SetLongField(env, obj, groupID, pwd->pw_gid);
-        jstr = (*env)->NewStringUTF(env, pwd->pw_name);
-        if (jstr == NULL) {
-            goto cleanUpAndReturn;
-        }
-        (*env)->SetObjectField(env, obj, userNameID, jstr);
-    } else {
-        (*env)->SetLongField(env, obj, userID, getuid());
-        (*env)->SetLongField(env, obj, groupID, getgid());
-    }
-cleanUpAndReturn:
-    free(groups);
-    return;
-}
diff --git a/test/hotspot/gtest/gc/shenandoah/test_shenandoahOldHeuristic.cpp b/test/hotspot/gtest/gc/shenandoah/test_shenandoahOldHeuristic.cpp
index b184b19ce6c..c0ec1bcf3c9 100644
--- a/test/hotspot/gtest/gc/shenandoah/test_shenandoahOldHeuristic.cpp
+++ b/test/hotspot/gtest/gc/shenandoah/test_shenandoahOldHeuristic.cpp
@@ -201,7 +201,9 @@ TEST_VM_F(ShenandoahOldHeuristicTest, prime_one_old_region) {
 
   size_t garbage = make_garbage_above_collection_threshold(10);
   _heuristics->prepare_for_old_collections();
-  _heuristics->prime_collection_set(_collection_set);
+  if (_heuristics->prime_collection_set(_collection_set)) {
+    _heuristics->finalize_mixed_evacs();
+  }
 
   EXPECT_TRUE(collection_set_is(10UL));
   EXPECT_EQ(garbage, _collection_set->get_old_garbage());
@@ -214,7 +216,9 @@ TEST_VM_F(ShenandoahOldHeuristicTest, prime_many_old_regions) {
   size_t g1 = make_garbage_above_collection_threshold(100);
   size_t g2 = make_garbage_above_collection_threshold(101);
   _heuristics->prepare_for_old_collections();
-  _heuristics->prime_collection_set(_collection_set);
+  if (_heuristics->prime_collection_set(_collection_set)) {
+    _heuristics->finalize_mixed_evacs();
+  }
 
   EXPECT_TRUE(collection_set_is(100UL, 101UL));
   EXPECT_EQ(g1 + g2, _collection_set->get_old_garbage());
@@ -226,7 +230,9 @@ TEST_VM_F(ShenandoahOldHeuristicTest, require_multiple_mixed_evacuations) {
 
   size_t garbage = create_too_much_garbage_for_one_mixed_evacuation();
   _heuristics->prepare_for_old_collections();
-  _heuristics->prime_collection_set(_collection_set);
+  if (_heuristics->prime_collection_set(_collection_set)) {
+    _heuristics->finalize_mixed_evacs();
+  }
 
   EXPECT_LT(_collection_set->get_old_garbage(), garbage);
   EXPECT_GT(_heuristics->unprocessed_old_collection_candidates(), 0UL);
@@ -248,7 +254,9 @@ TEST_VM_F(ShenandoahOldHeuristicTest, skip_pinned_regions) {
   ASSERT_EQ(3UL, _heuristics->unprocessed_old_collection_candidates());
 
   // Here the region is still pinned, so it cannot be added to the collection set.
-  _heuristics->prime_collection_set(_collection_set);
+  if (_heuristics->prime_collection_set(_collection_set)) {
+    _heuristics->finalize_mixed_evacs();
+  }
 
   // The two unpinned regions should be added to the collection set and the pinned
   // region should be retained at the front of the list of candidates as it would be
@@ -261,7 +269,9 @@ TEST_VM_F(ShenandoahOldHeuristicTest, skip_pinned_regions) {
   // the now unpinned region should be added to the collection set.
   make_unpinned(1);
   _collection_set->clear();
-  _heuristics->prime_collection_set(_collection_set);
+  if (_heuristics->prime_collection_set(_collection_set)) {
+    _heuristics->finalize_mixed_evacs();
+  }
 
   EXPECT_EQ(_collection_set->get_old_garbage(), g2);
   EXPECT_TRUE(collection_set_is(1UL));
@@ -278,14 +288,18 @@ TEST_VM_F(ShenandoahOldHeuristicTest, pinned_region_is_first) {
 
   make_pinned(0);
   _heuristics->prepare_for_old_collections();
-  _heuristics->prime_collection_set(_collection_set);
+  if (_heuristics->prime_collection_set(_collection_set)) {
+    _heuristics->finalize_mixed_evacs();
+  }
 
   EXPECT_TRUE(collection_set_is(1UL, 2UL));
   EXPECT_EQ(_heuristics->unprocessed_old_collection_candidates(), 1UL);
 
   make_unpinned(0);
   _collection_set->clear();
-  _heuristics->prime_collection_set(_collection_set);
+  if (_heuristics->prime_collection_set(_collection_set)) {
+    _heuristics->finalize_mixed_evacs();
+  }
 
   EXPECT_TRUE(collection_set_is(0UL));
   EXPECT_EQ(_heuristics->unprocessed_old_collection_candidates(), 0UL);
@@ -301,7 +315,9 @@ TEST_VM_F(ShenandoahOldHeuristicTest, pinned_region_is_last) {
 
   make_pinned(2);
   _heuristics->prepare_for_old_collections();
-  _heuristics->prime_collection_set(_collection_set);
+  if (_heuristics->prime_collection_set(_collection_set)) {
+    _heuristics->finalize_mixed_evacs();
+  }
 
   EXPECT_TRUE(collection_set_is(0UL, 1UL));
   EXPECT_EQ(_collection_set->get_old_garbage(), g1 + g2);
@@ -309,7 +325,9 @@ TEST_VM_F(ShenandoahOldHeuristicTest, pinned_region_is_last) {
 
   make_unpinned(2);
   _collection_set->clear();
-  _heuristics->prime_collection_set(_collection_set);
+  if (_heuristics->prime_collection_set(_collection_set)) {
+    _heuristics->finalize_mixed_evacs();
+  }
 
   EXPECT_TRUE(collection_set_is(2UL));
   EXPECT_EQ(_collection_set->get_old_garbage(), g3);
@@ -327,7 +345,9 @@ TEST_VM_F(ShenandoahOldHeuristicTest, unpinned_region_is_middle) {
   make_pinned(0);
   make_pinned(2);
   _heuristics->prepare_for_old_collections();
-  _heuristics->prime_collection_set(_collection_set);
+  if (_heuristics->prime_collection_set(_collection_set)) {
+    _heuristics->finalize_mixed_evacs();
+  }
 
   EXPECT_TRUE(collection_set_is(1UL));
   EXPECT_EQ(_collection_set->get_old_garbage(), g2);
@@ -336,7 +356,9 @@ TEST_VM_F(ShenandoahOldHeuristicTest, unpinned_region_is_middle) {
   make_unpinned(0);
   make_unpinned(2);
   _collection_set->clear();
-  _heuristics->prime_collection_set(_collection_set);
+  if (_heuristics->prime_collection_set(_collection_set)) {
+    _heuristics->finalize_mixed_evacs();
+  }
 
   EXPECT_TRUE(collection_set_is(0UL, 2UL));
   EXPECT_EQ(_collection_set->get_old_garbage(), g1 + g3);
@@ -354,7 +376,9 @@ TEST_VM_F(ShenandoahOldHeuristicTest, all_candidates_are_pinned) {
   make_pinned(1);
   make_pinned(2);
   _heuristics->prepare_for_old_collections();
-  _heuristics->prime_collection_set(_collection_set);
+  if (_heuristics->prime_collection_set(_collection_set)) {
+    _heuristics->finalize_mixed_evacs();
+  }
 
   // In the case when all candidates are pinned, we want to abandon
   // this set of mixed collection candidates so that another old collection
diff --git a/test/hotspot/jtreg/ProblemList-AotJdk.txt b/test/hotspot/jtreg/ProblemList-AotJdk.txt
index af3994289df..e27e85645f5 100644
--- a/test/hotspot/jtreg/ProblemList-AotJdk.txt
+++ b/test/hotspot/jtreg/ProblemList-AotJdk.txt
@@ -1,3 +1,32 @@
+#
+# 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+#############################################################################
+#
+# List of quarantined tests for testing in AOT_JDK mode.
+#
+#############################################################################
+
 runtime/modules/PatchModule/PatchModuleClassList.java 0000000 generic-all
 runtime/NMT/NMTWithCDS.java                           0000000 generic-all
 runtime/symbols/TestSharedArchiveConfigFile.java      0000000 generic-all
diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt
index 13e1ea30a34..84520b00056 100644
--- a/test/hotspot/jtreg/ProblemList.txt
+++ b/test/hotspot/jtreg/ProblemList.txt
@@ -113,7 +113,6 @@ runtime/NMT/VirtualAllocCommitMerge.java 8309698 linux-s390x
 applications/jcstress/copy.java 8229852 linux-all
 
 containers/docker/TestJcmd.java 8278102 linux-all
-containers/docker/TestMemoryAwareness.java 8303470 linux-all
 containers/docker/TestJFREvents.java 8327723 linux-x64
 containers/docker/TestJcmdWithSideCar.java 8341518 linux-x64
 
diff --git a/test/hotspot/jtreg/compiler/igvn/CastLLBits.java b/test/hotspot/jtreg/compiler/igvn/CastLLBits.java
new file mode 100644
index 00000000000..a212fd1d3b6
--- /dev/null
+++ b/test/hotspot/jtreg/compiler/igvn/CastLLBits.java
@@ -0,0 +1,63 @@
+/*
+ * 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.igvn;
+
+/**
+ * @test
+ * @bug 8375618
+ * @summary A CastLLNode may change only a bit of its input, which triggers the incorrect assertion
+ *          that the signed range must changes
+ * @run main/othervm -XX:-TieredCompilation -Xbatch ${test.main.class}
+ * @run main ${test.main.class}
+ */
+public class CastLLBits {
+    static long instanceCount;
+
+    public static void main(String[] args) {
+        for (int i = 0; i < 2000; i++) {
+            test();
+        }
+    }
+
+    static void test() {
+        int i, i1 = 6, i9, i10, i11, i12;
+        boolean b = false;
+        for (i = 25; i > 5; i--) {
+            i9 = 1;
+            do {
+                i1 += 0;
+                for (i10 = 1; i10 < 3; ++i10) {
+                    instanceCount = i9;
+                }
+                i12 = 3;
+                while (--i12 > 0) {
+                    i11 = (int) instanceCount;
+                    i1 = i11;
+                    if (b) {};
+                    instanceCount &= 21;
+                }
+                i9++;
+            } while (i9 < 9);
+        }
+    }
+}
diff --git a/test/hotspot/jtreg/compiler/loopopts/TestSinkingLoadInputOfPhi.java b/test/hotspot/jtreg/compiler/loopopts/TestSinkingLoadInputOfPhi.java
new file mode 100644
index 00000000000..cd563e6caf2
--- /dev/null
+++ b/test/hotspot/jtreg/compiler/loopopts/TestSinkingLoadInputOfPhi.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2026 IBM Corporation. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8374725
+ * @summary C2: assert(x_ctrl == get_late_ctrl_with_anti_dep(x->as_Load(), early_ctrl, x_ctrl)) failed: anti-dependences were already checked
+ * @run main/othervm  -XX:CompileCommand=compileonly,*TestSinkingLoadInputOfPhi*::* -XX:-TieredCompilation -Xcomp ${test.main.class}
+ * @run main ${test.main.class}
+ */
+
+package compiler.loopopts;
+
+public class TestSinkingLoadInputOfPhi {
+
+  static long lFld;
+  static int iFld = 55;
+  static int iFld2 = 10;
+  static void test() {
+    int iArr[] = new int[iFld2];
+
+    for (int i13 : iArr)
+      switch (iFld) {
+      case 69:
+      case 46:
+      case 65:
+        lFld = i13;
+      case 55: // taken
+        for (int i16 = 1; i16 < 30000; i16++)
+          ;
+      case 71:
+        iArr[iFld2] = 2; // OOB-access
+      }
+  }
+
+  public static void main(String[] strArr) {
+    try {
+      test();
+      } catch (ArrayIndexOutOfBoundsException e) {
+        // expected
+      }
+  }
+}
diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMarkObjArrayProcessor.inline.hpp b/test/hotspot/jtreg/compiler/uncommontrap/TestDeoptDetailsLockRank.java
similarity index 62%
rename from src/hotspot/share/gc/g1/g1ConcurrentMarkObjArrayProcessor.inline.hpp
rename to test/hotspot/jtreg/compiler/uncommontrap/TestDeoptDetailsLockRank.java
index f6d47acdc01..2866a84ba46 100644
--- a/src/hotspot/share/gc/g1/g1ConcurrentMarkObjArrayProcessor.inline.hpp
+++ b/test/hotspot/jtreg/compiler/uncommontrap/TestDeoptDetailsLockRank.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -19,20 +19,21 @@
  * Please 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_G1_G1CONCURRENTMARKOBJARRAYPROCESSOR_INLINE_HPP
-#define SHARE_GC_G1_G1CONCURRENTMARKOBJARRAYPROCESSOR_INLINE_HPP
+ /**
+ * @test
+ * @bug 8374862
+ * @summary Regression test for -XX:+Verbose -XX:+WizardMode -XX:+PrintDeoptimizationDetails crash
+ * @requires vm.debug
+ * @run main/othervm -XX:+Verbose -XX:+WizardMode -XX:+PrintDeoptimizationDetails compiler.uncommontrap.TestDeoptDetailsLockRank
+ */
 
-#include "gc/g1/g1ConcurrentMarkObjArrayProcessor.hpp"
+package compiler.uncommontrap;
 
-#include "gc/shared/gc_globals.hpp"
-#include "oops/oop.inline.hpp"
-#include "oops/oopsHierarchy.hpp"
+public class TestDeoptDetailsLockRank {
 
-inline bool G1CMObjArrayProcessor::should_be_sliced(oop obj) {
-  return obj->is_objArray() && ((objArrayOop)obj)->size() >= 2 * ObjArrayMarkingStride;
-}
-
-#endif // SHARE_GC_G1_G1CONCURRENTMARKOBJARRAYPROCESSOR_INLINE_HPP
+    public static void main(String[] args) {
+        System.out.println("passed");
+    }
+}
\ No newline at end of file
diff --git a/test/hotspot/jtreg/compiler/vectorapi/TestCastShapeBadOpc.java b/test/hotspot/jtreg/compiler/vectorapi/TestCastShapeBadOpc.java
new file mode 100644
index 00000000000..743c243cb58
--- /dev/null
+++ b/test/hotspot/jtreg/compiler/vectorapi/TestCastShapeBadOpc.java
@@ -0,0 +1,93 @@
+/*
+ * 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 id=all-flags
+ * @bug 8374889
+ * @summary Test case that can compile unexpected code paths in VectorAPI cast intrinsification.
+ * @modules jdk.incubator.vector
+ * @library /test/lib /
+ * @run main/othervm
+ *      -XX:+IgnoreUnrecognizedVMOptions
+ *      -XX:-TieredCompilation -Xbatch
+ *      -XX:+UnlockDiagnosticVMOptions
+ *      -XX:StressSeed=1462975402
+ *      -XX:+StressIncrementalInlining
+ *      -XX:CompileCommand=compileonly,${test.main.class}::test2
+ *      ${test.main.class}
+ */
+
+/*
+ * @test id=no-stress-seed
+ * @bug 8374889
+ * @modules jdk.incubator.vector
+ * @library /test/lib /
+ * @run main/othervm
+ *      -XX:+IgnoreUnrecognizedVMOptions
+ *      -XX:-TieredCompilation -Xbatch
+ *      -XX:+UnlockDiagnosticVMOptions
+ *      -XX:+StressIncrementalInlining
+ *      -XX:CompileCommand=compileonly,${test.main.class}::test2
+ *      ${test.main.class}
+ */
+
+/*
+ * @test id=vanilla
+ * @bug 8374889
+ * @modules jdk.incubator.vector
+ * @library /test/lib /
+ * @run driver ${test.main.class}
+ */
+
+package compiler.vectorapi;
+
+import jdk.incubator.vector.*;
+
+public class TestCastShapeBadOpc {
+    public static void main(String[] args) {
+        for (int i = 0; i < 100_000; ++i) {
+            test1();
+            test2();
+        }
+    }
+
+    // This code does not trigger the bug itself, but seems to be important for profiling,
+    // so that test2 fails.
+    public static Object test1() {
+        LongVector v0 = LongVector.broadcast(LongVector.SPECIES_512, -15L);
+        var v1 = (ByteVector)v0.convertShape(VectorOperators.Conversion.ofReinterpret(long.class, byte.class), ByteVector.SPECIES_128, 0);
+        var v2 = (ByteVector)v1.castShape(ByteVector.SPECIES_256, 0);
+        return v2;
+    }
+
+    public static Object test2() {
+        var v0 = ShortVector.broadcast(ShortVector.SPECIES_64, (short)7729);
+        var v1 = (FloatVector)v0.reinterpretShape(FloatVector.SPECIES_64, 0);
+        // The castShape below should take the "C" path in AbstractVector::convert0, but sometimes
+        // we also compile the "Z" case because of profiling. This means we attempt to create
+        // a vector cast from float -> long, but unfortunately with a UCAST (float -> long is signed).
+        // This triggered an assert in VectorCastNode::opcode.
+        var v2 = (LongVector)v1.castShape(LongVector.SPECIES_256, 0);
+        return v2;
+    }
+}
diff --git a/test/hotspot/jtreg/containers/docker/TestJcmd.java b/test/hotspot/jtreg/containers/docker/TestJcmd.java
index 3cfe2945e92..fcd5c665f2b 100644
--- a/test/hotspot/jtreg/containers/docker/TestJcmd.java
+++ b/test/hotspot/jtreg/containers/docker/TestJcmd.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
@@ -143,6 +143,7 @@ public class TestJcmd {
         sb.append(String.format("FROM %s:%s\n", DockerfileConfig.getBaseImageName(),
                                 DockerfileConfig.getBaseImageVersion()));
         sb.append("COPY /jdk /jdk\n");
+        sb.append("ENV LANG=C.UTF-8\n");
         sb.append("ENV JAVA_HOME=/jdk\n");
 
         if (!IS_PODMAN) { // only needed for docker
diff --git a/test/hotspot/jtreg/gc/parallel/TestObjectCountAfterGC.java b/test/hotspot/jtreg/gc/parallel/TestObjectCountAfterGC.java
new file mode 100644
index 00000000000..e61e7518938
--- /dev/null
+++ b/test/hotspot/jtreg/gc/parallel/TestObjectCountAfterGC.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 gc.parallel;
+
+/*
+ * @test TestObjectCountAfterGC
+ * @bug 8375314
+ * @summary Verifies that the HeapInspection VM operation for the ObjectCountAfterGC JFR event does not crash the VM.
+ *          Creates a set of custom classes that are about to be unloaded to cause metaspace to uncommit pages. When
+ *          the execution of the heap inspection iterates over the heap, it will come across these unloaded classes
+ *          referencing uncommitted memory, crashing.
+ * @requires vm.gc.Parallel
+ * @requires vm.opt.final.ClassUnloading
+ * @library /test/lib
+ * @library /testlibrary/asm
+ * @modules java.base/jdk.internal.misc
+ * @run main/othervm -XX:+UseParallelGC -Xlog:gc=debug,metaspace=info -XX:StartFlightRecording:gc=all,duration=1s,filename=myrecording.jfr
+ *                   gc.parallel.TestObjectCountAfterGC
+ */
+
+import java.lang.ref.Reference;
+
+import org.objectweb.asm.ClassWriter;
+import org.objectweb.asm.MethodVisitor;
+import org.objectweb.asm.Opcodes;
+
+public class TestObjectCountAfterGC {
+
+    static final String className = "ClassToLoadUnload";
+
+    public static void main(String args[]) throws Exception {
+        final int KEEPALIVE_LENGTH = 100;
+
+        Object[] keepalive = new Object[KEEPALIVE_LENGTH];
+
+        for (int i = 1; i < 1000; i++) {
+            ClassLoader cl = new MyClassLoader();
+            Object o = null;
+            // Create some random kept alive objects so that the
+            // compaction regions are not totally empty and the
+            // heap inspection VM operation needs to iterate them.
+            keepalive[(i / KEEPALIVE_LENGTH) % KEEPALIVE_LENGTH] = new int[100];
+            o = cl.loadClass(className + i).newInstance();
+
+            cl = null;
+            o = null;
+        }
+
+        // There is heap inspection VM operation for the ObjectCountAfterGC event
+        // when JFR stops recording.
+
+        Reference.reachabilityFence(keepalive);
+    }
+}
+
+class MyClassLoader extends ClassLoader {
+
+    // Create a class of the given name with a default constructor.
+    public byte[] createClass(String name) {
+        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
+        cw.visit(Opcodes.V1_8, Opcodes.ACC_PUBLIC | Opcodes.ACC_SUPER, name, null, "java/lang/Object", null);
+        // Add default constructor that just calls the super class constructor.
+        MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "", "()V", null, null);
+        mv.visitCode();
+        mv.visitVarInsn(Opcodes.ALOAD, 0);
+        mv.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/Object", "", "()V", false);
+        mv.visitInsn(Opcodes.RETURN);
+        mv.visitMaxs(0, 0);
+        mv.visitEnd();
+        return cw.toByteArray();
+    }
+
+    // If the given name starts with "TestObjectCountAfterGC" create a new class on the fly,
+    // delegate otherwise.
+    public Class loadClass(String name) throws ClassNotFoundException {
+        if (!name.startsWith(TestObjectCountAfterGC.className)) {
+            return super.loadClass(name);
+        }
+        byte[] cls = createClass(name);
+        return defineClass(name, cls, 0, cls.length, null);
+    }
+  }
+
diff --git a/test/hotspot/jtreg/gc/stress/TestMultiThreadStressRSet.java b/test/hotspot/jtreg/gc/stress/TestMultiThreadStressRSet.java
index a323ebd945a..ffd5203dfb8 100644
--- a/test/hotspot/jtreg/gc/stress/TestMultiThreadStressRSet.java
+++ b/test/hotspot/jtreg/gc/stress/TestMultiThreadStressRSet.java
@@ -44,15 +44,15 @@ import jdk.test.lib.Utils;
  * @build jdk.test.whitebox.WhiteBox
  * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- *   -XX:+UseG1GC -XX:G1SummarizeRSetStatsPeriod=1 -Xlog:gc
+ *   -XX:+UseG1GC -XX:G1SummarizeRSetStatsPeriod=1 -Xlog:gc -XX:-UseGCOverheadLimit
  *   -Xmx500m -XX:G1HeapRegionSize=1m -XX:MaxGCPauseMillis=1000 gc.stress.TestMultiThreadStressRSet 10 4
  *
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- *   -XX:+UseG1GC -XX:G1SummarizeRSetStatsPeriod=100 -Xlog:gc
+ *   -XX:+UseG1GC -XX:G1SummarizeRSetStatsPeriod=100 -Xlog:gc -XX:-UseGCOverheadLimit
  *   -Xmx1G -XX:G1HeapRegionSize=8m -XX:MaxGCPauseMillis=1000 gc.stress.TestMultiThreadStressRSet 60 16
  *
  * @run main/othervm/timeout=1200 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- *   -XX:+UseG1GC -XX:G1SummarizeRSetStatsPeriod=100 -Xlog:gc
+ *   -XX:+UseG1GC -XX:G1SummarizeRSetStatsPeriod=100 -Xlog:gc -XX:-UseGCOverheadLimit
  *   -Xmx500m -XX:G1HeapRegionSize=1m -XX:MaxGCPauseMillis=1000 gc.stress.TestMultiThreadStressRSet 600 32
  */
 public class TestMultiThreadStressRSet {
diff --git a/test/hotspot/jtreg/gc/stress/TestStressG1Uncommit.java b/test/hotspot/jtreg/gc/stress/TestStressG1Uncommit.java
index 9d1f95aa411..4e2b9dd5be7 100644
--- a/test/hotspot/jtreg/gc/stress/TestStressG1Uncommit.java
+++ b/test/hotspot/jtreg/gc/stress/TestStressG1Uncommit.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
@@ -55,6 +55,8 @@ public class TestStressG1Uncommit {
     public static void main(String[] args) throws Exception {
         ArrayList options = new ArrayList<>();
         Collections.addAll(options,
+            "-XX:MinHeapFreeRatio=40",
+            "-XX:MaxHeapFreeRatio=70",
             "-Xlog:gc,gc+heap+region=debug",
             "-XX:+UseG1GC",
             "-Xmx1g",
diff --git a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/ArraySuperTest.java b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/ArraySuperTest.java
new file mode 100644
index 00000000000..5274c140f32
--- /dev/null
+++ b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/ArraySuperTest.java
@@ -0,0 +1,73 @@
+/*
+ * 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 8304147
+ * @summary make sure dynamic archive does not archive array classes with incorrect values in
+ *          Array::_secondary_supers
+ * @requires vm.cds
+ * @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
+ * @build ArraySuperTest jdk.test.whitebox.WhiteBox
+ * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar ArraySuperApp.jar ArraySuperApp
+ * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. ArraySuperTest
+ */
+
+import java.util.function.Predicate;
+import jdk.test.lib.helpers.ClassFileInstaller;
+
+public class ArraySuperTest extends DynamicArchiveTestBase {
+
+    public static void main(String[] args) throws Exception {
+        runTest(ArraySuperTest::test);
+    }
+
+    static void test() throws Exception {
+        String topArchiveName = getNewArchiveName();
+        String appJar = ClassFileInstaller.getJarPath("ArraySuperApp.jar");
+        String mainClass = ArraySuperApp.class.getName();
+
+        dump(topArchiveName, "-cp", appJar, mainClass).assertNormalExit();
+        run(topArchiveName, "-cp", appJar, "-Xshare:off", mainClass, "withDynamicArchive").assertNormalExit();
+        run(topArchiveName, "-cp", appJar, mainClass, "withDynamicArchive").assertNormalExit();
+    }
+}
+
+class ArraySuperApp implements Predicate {
+    static volatile Object array;
+    public boolean test(Object o) {
+        return true;
+    }
+    static void main(String args[]) {
+        array = new ArraySuperApp[1];
+        if (args.length > 0) {
+            Predicate[] p = new Predicate[0];
+            System.out.println(p.getClass().isInstance(array));
+            p = (Predicate[])array;
+            p[0] = new ArraySuperApp();
+            System.out.println("All tests passed");
+        }
+    }
+}
diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadStateTest2/ThreadStateTest2.java b/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadStateTest2/ThreadStateTest2.java
new file mode 100644
index 00000000000..ce3f2a5fe40
--- /dev/null
+++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadStateTest2/ThreadStateTest2.java
@@ -0,0 +1,144 @@
+/*
+ * 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 8373366
+ * @summary HandshakeState should disallow suspend ops for disabler threads
+ * @requires vm.continuations
+ * @requires vm.jvmti
+ * @requires vm.compMode != "Xcomp"
+ * @modules java.base/java.lang:+open
+ * @library /test/lib
+ * @run main/othervm/native -agentlib:ThreadStateTest2 ThreadStateTest2
+ */
+
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.ThreadFactory;
+import jdk.test.lib.thread.VThreadScheduler;
+
+/* Testing scenario:
+ * Several threads are involved:
+ *  - VT-0: a virtual thread which is interrupt-friendly and constantly interrupted with JVMTI InterruptThread
+ *  - VT-1: a virtual thread which state is constantly checked with JVMTI GetThreadState
+ *  - VT-2: a virtual thread: in a loop calls JVMTI InterruptThread(VT-0) and GetThreadState(VT-1)
+ *  - main: a platform thread: in a loop invokes native method testSuspendResume which suspends and resumes VT-2
+ * The JVMTI functions above install a MountUnmountDisabler for target virtual thread (VT-0 or VT-1).
+ * The goal is to catch VT-2 in an attempt to self-suspend while in a context of MountUnmountDisabler.
+ * This would mean there is a suspend point while VT-2 is in a context of MountUnmountDisabler.
+ * The InterruptThread implementation does a Java upcall to j.l.Thread::interrupt().
+ * The JavaCallWrapper constructor has such a suspend point.
+ */
+public class ThreadStateTest2 {
+    private static native void setMonitorContendedMode(boolean enable);
+    private static native void testSuspendResume(Thread vthread);
+    private static native void testInterruptThread(Thread vthread);
+    private static native int testGetThreadState(Thread vthread);
+
+    static Thread vthread0;
+    static Thread vthread1;
+    static Thread vthread2;
+    static AtomicBoolean vt2Started = new AtomicBoolean();
+    static AtomicBoolean vt2Finished = new AtomicBoolean();
+
+    static void log(String msg) { System.out.println(msg); }
+
+    // Should handle interruptions from vthread2.
+    final Runnable FOO_0 = () -> {
+        log("VT-0 started");
+        while (!vt2Finished.get()) {
+            try {
+                Thread.sleep(10);
+            } catch (InterruptedException ie) {
+                // ignore
+            }
+        }
+        log("VT-0 finished");
+    };
+
+    // A target for vthread2 to check state with JVMTI GetThreadState.
+    final Runnable FOO_1 = () -> {
+        log("VT-1 started");
+        while (!vt2Finished.get()) {
+            Thread.yield();
+        }
+        log("VT-1 finished");
+    };
+
+    // In a loop execute JVMTI functions on threads vthread0 and vthread1:
+    // InterruptThread(vthread0) and GetThreadState(vthread1).
+    final Runnable FOO_2 = () -> {
+        log("VT-2 started");
+        vt2Started.set(true);
+        for (int i = 0; i < 40; i++) {
+            testInterruptThread(vthread0);
+            int state = testGetThreadState(vthread1);
+            if (state == 2) {
+                break;
+            }
+            Thread.yield();
+        }
+        vt2Finished.set(true);
+        log("VT-2 finished");
+    };
+
+    private void runTest() throws Exception {
+        // Force creation of JvmtiThreadState on vthread start.
+        setMonitorContendedMode(true);
+
+        ExecutorService scheduler = Executors.newFixedThreadPool(2);
+        ThreadFactory factory = VThreadScheduler.virtualThreadBuilder(scheduler).factory();
+
+        vthread0 = factory.newThread(FOO_0);
+        vthread1 = factory.newThread(FOO_1);
+        vthread2 = factory.newThread(FOO_2);
+        vthread0.setName("VT-0");
+        vthread1.setName("VT-1");
+        vthread2.setName("VT-2");
+        vthread0.start();
+        vthread1.start();
+        vthread2.start();
+
+        // Give some time for vthreads to start.
+        while (!vt2Started.get()) {
+            Thread.sleep(1);
+        }
+        while (!vt2Finished.get() /* && tryCount-- > 0 */) {
+            testSuspendResume(vthread2);
+        }
+        vthread0.join();
+        vthread1.join();
+        vthread2.join();
+
+        // Let all carriers go away.
+        scheduler.shutdown();
+        Thread.sleep(20);
+    }
+
+    public static void main(String[] args) throws Exception {
+        ThreadStateTest2 obj = new ThreadStateTest2();
+        obj.runTest();
+    }
+}
diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadStateTest2/libThreadStateTest2.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadStateTest2/libThreadStateTest2.cpp
new file mode 100644
index 00000000000..8464e8ebc57
--- /dev/null
+++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadStateTest2/libThreadStateTest2.cpp
@@ -0,0 +1,118 @@
+/*
+ * 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 
+#include 
+#include 
+#include 
+#include "jvmti_common.hpp"
+
+// set by Agent_OnLoad
+static jvmtiEnv* jvmti = nullptr;
+static jrawMonitorID agent_event_lock = nullptr;
+
+extern "C" {
+
+static void JNICALL
+MonitorContended(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread,
+                 jobject object) {
+}
+
+JNIEXPORT void JNICALL
+Java_ThreadStateTest2_testSuspendResume(JNIEnv* jni, jclass klass, jthread thread) {
+  jvmtiError err;
+  RawMonitorLocker event_locker(jvmti, jni, agent_event_lock);
+
+  LOG("\nMAIN: testSuspendResume: before suspend\n");
+  err = jvmti->SuspendThread(thread);
+  if (err == JVMTI_ERROR_THREAD_NOT_ALIVE) {
+    return;
+  }
+  check_jvmti_status(jni, err, "testSuspendResume error in JVMTI SuspendThread");
+  LOG("\nMAIN: testSuspendResume:  after suspend\n");
+
+  event_locker.wait(1);
+
+  LOG("MAIN: testSuspendResume: before resume\n");
+  err = jvmti->ResumeThread(thread);
+  check_jvmti_status(jni, err, "testSuspendResume error in JVMTI ResumeThread");
+}
+
+JNIEXPORT void JNICALL
+Java_ThreadStateTest2_setMonitorContendedMode(JNIEnv* jni, jclass klass, jboolean enable) {
+  set_event_notification_mode(jvmti, jni, enable ? JVMTI_ENABLE : JVMTI_DISABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, nullptr);
+}
+
+JNIEXPORT void JNICALL
+Java_ThreadStateTest2_testInterruptThread(JNIEnv* jni, jclass klass, jthread vthread) {
+  char* tname = get_thread_name(jvmti, jni, vthread);
+  LOG("VT-2: testInterruptThread: %s\n", tname);
+
+  jvmtiError err = jvmti->InterruptThread(vthread);
+  check_jvmti_status(jni, err, "testInterruptThread error in JVMTI InterruptThread");
+}
+
+JNIEXPORT jint JNICALL
+Java_ThreadStateTest2_testGetThreadState(JNIEnv* jni, jclass klass, jthread vthread) {
+  jint  state = get_thread_state(jvmti, jni, vthread);
+  char* tname = get_thread_name(jvmti, jni, vthread);
+
+  LOG("VT-2: testGetThreadState: %s state: %x\n", tname, state);
+  return state;
+}
+
+JNIEXPORT jint JNICALL
+Agent_OnLoad(JavaVM* jvm, char* options, void* reserved) {
+  jvmtiEventCallbacks callbacks;
+  jvmtiCapabilities caps;
+  jvmtiError err;
+
+  printf("Agent_OnLoad: started\n");
+  if (jvm->GetEnv((void **) (&jvmti), JVMTI_VERSION) != JNI_OK) {
+    LOG("Agent_OnLoad: error in GetEnv");
+    return JNI_ERR;
+  }
+
+  memset(&caps, 0, sizeof(caps));
+  caps.can_suspend = 1;
+  caps.can_signal_thread = 1;
+  caps.can_support_virtual_threads = 1;
+  caps.can_generate_monitor_events = 1;
+
+  err = jvmti->AddCapabilities(&caps);
+  if (err != JVMTI_ERROR_NONE) {
+    LOG("Agent_OnLoad: error in JVMTI AddCapabilities: %d\n", err);
+  }
+  memset(&callbacks, 0, sizeof(callbacks));
+  callbacks.MonitorContendedEnter = &MonitorContended;
+  err = jvmti->SetEventCallbacks(&callbacks, sizeof(jvmtiEventCallbacks));
+  if (err != JVMTI_ERROR_NONE) {
+    LOG("Agent_OnLoad: Error in JVMTI SetEventCallbacks: %d\n", err);
+  }
+  agent_event_lock = create_raw_monitor(jvmti, "agent_event_lock");
+  printf("Agent_OnLoad: finished\n");
+
+  return 0;
+}
+
+} // extern "C"
diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t003.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t003.java
index d4cb4a8569a..a23732dc554 100644
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t003.java
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t003.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2018, 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
@@ -105,6 +105,21 @@ public class em02t003 extends DebugeeClass {
                 return Consts.TEST_FAILED;
             }
 
+            while (thrd.isAlive()) {
+                logger.display("Thread state: " + thrd.getState()
+                    + " - waiting for completion.");
+                try {
+                    // small delay to avoid produce huge amount of output
+                    Thread.sleep(100);
+                } catch (InterruptedException e) {
+                }
+            }
+            try {
+                // give some time wait thread to exit completely
+                Thread.sleep(2000);
+            } catch (InterruptedException e) {
+            }
+
             logger.display("MethodCompiling:: Provoke unloading compiled method - "
                                 + "\n\ttrying to unload class...");
             thrd = null;
diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/ClassUnloader.java b/test/hotspot/jtreg/vmTestbase/nsk/share/ClassUnloader.java
index 94b086f5757..5c7d2b8d640 100644
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/ClassUnloader.java
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/ClassUnloader.java
@@ -239,6 +239,9 @@ public class ClassUnloader {
      *
      * @see WhiteBox.getWhiteBox().fullGC()
      */
+
+    public static final int MAX_UNLOAD_ATTEMPS = 10;
+
     public boolean unloadClass() {
 
         // free references to class and class loader to be able for collecting by GC
@@ -247,14 +250,26 @@ public class ClassUnloader {
 
         // force class unloading by triggering full GC
         WhiteBox.getWhiteBox().fullGC();
+        int count = 0;
+        while (count++ < MAX_UNLOAD_ATTEMPS && !isClassLoaderReclaimed()) {
+            System.out.println("ClassUnloader: waiting for class loader reclaiming... " + count);
+            WhiteBox.getWhiteBox().fullGC();
+            try {
+                // small delay to give more changes to process objects
+                // inside VM like jvmti deferred queue
+                Thread.sleep(100);
+            } catch (InterruptedException e) {
+            }
+        }
 
         // force GC to unload marked class loader and its classes
         if (isClassLoaderReclaimed()) {
-            Runtime.getRuntime().gc();
+            System.out.println("ClassUnloader: class loader has been reclaimed.");
             return true;
         }
 
         // class loader has not been reclaimed
+        System.out.println("ClassUnloader: class loader is still reachable.");
         return false;
     }
 }
diff --git a/test/jdk/build/CheckFiles.java b/test/jdk/build/CheckFiles.java
index eb903c0a224..5a915e881f0 100644
--- a/test/jdk/build/CheckFiles.java
+++ b/test/jdk/build/CheckFiles.java
@@ -23,6 +23,7 @@
  */
 
 import java.io.IOException;
+import java.nio.file.DirectoryStream;
 import java.nio.file.FileVisitResult;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -36,7 +37,7 @@ import jdk.test.lib.Platform;
 
 /*
  * @test
- * @summary Check for unwanted file (types/extensions) in the jdk image
+ * @summary Check for unwanted files (types/extensions) in the jdk image
  * @library /test/lib
  * @requires !vm.debug
  * @run main CheckFiles
@@ -47,6 +48,20 @@ public class CheckFiles {
     // JTREG=JAVA_OPTIONS=-Djdk.test.build.CheckFiles.dir=/path/to/dir
     public static final String DIR_PROPERTY = "jdk.test.build.CheckFiles.dir";
 
+    private static boolean isGpl(Path myFile) {
+        if (myFile == null || !Files.exists(myFile)) {
+            return false;
+        }
+
+        try {
+            String firstLine = Files.readAllLines(myFile).stream()
+                                    .findFirst().orElse("");
+            return firstLine.contains("The GNU General Public License (GPL)");
+        } catch (IOException e) {
+            return false;
+        }
+    }
+
     public static void main(String[] args) throws Exception {
         String jdkPathString = System.getProperty("test.jdk");
         Path jdkHome = Paths.get(jdkPathString);
@@ -148,6 +163,48 @@ public class CheckFiles {
                 throw new Error("jmods dir scan failed");
             }
         }
+
+        Path legalDir = mainDirToScan.resolve("legal");
+        Path javabaseLicenseFile = mainDirToScan.resolve("legal/java.base/LICENSE");
+        if (isGpl(javabaseLicenseFile)) { // for now check only legal dir of GPL based images; other ones might have other content
+            System.out.println("GPL info found in java.base LICENSE file");
+            ArrayList allowedEndingsLegalDir = new ArrayList<>();
+            allowedEndingsLegalDir.add(".md");
+            allowedEndingsLegalDir.add("ADDITIONAL_LICENSE_INFO");
+            allowedEndingsLegalDir.add("ASSEMBLY_EXCEPTION");
+            allowedEndingsLegalDir.add("LICENSE");
+
+            ArrayList requiredFilesInLegalSubdirs = new ArrayList<>();
+            requiredFilesInLegalSubdirs.add("LICENSE");
+            requiredFilesInLegalSubdirs.add("ADDITIONAL_LICENSE_INFO");
+            requiredFilesInLegalSubdirs.add("ASSEMBLY_EXCEPTION");
+
+            System.out.println("Legal directory to scan:" + legalDir);
+            try (DirectoryStream stream = Files.newDirectoryStream(legalDir)) {
+                for (Path subfolder : stream) {
+                    if (Files.isDirectory(subfolder)) {
+                        System.out.println("Checking legal dir subfolder for required files: " + subfolder.getFileName());
+
+                        for (String fileName : requiredFilesInLegalSubdirs) {
+                            Path filePath = subfolder.resolve(fileName);
+                            if (Files.exists(filePath)) {
+                                System.out.println("  Found " + fileName);
+                            } else {
+                                System.out.println("  Missing " + fileName);
+                                throw new Error("legal dir scan for required files failed");
+                            }
+                        }
+                    }
+                }
+            }
+
+            boolean legalDirRes = scanFiles(legalDir, allowedEndingsLegalDir);
+            if (legalDirRes) {
+                System.out.println("Legal directory scan successful.");
+            } else {
+                throw new Error("Legal dir scan failed");
+            }
+        }
     }
 
     private static boolean scanFiles(Path root, ArrayList allowedEndings) throws IOException {
diff --git a/test/jdk/com/sun/security/auth/module/AllPlatforms.java b/test/jdk/com/sun/security/auth/module/AllPlatforms.java
index 79eea7b4d23..6f7cbfb9c52 100644
--- a/test/jdk/com/sun/security/auth/module/AllPlatforms.java
+++ b/test/jdk/com/sun/security/auth/module/AllPlatforms.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,11 @@
  * @test
  * @bug 8039951
  * @summary com.sun.security.auth.module missing classes on some platforms
+ * @modules java.base/jdk.internal.util
  * @run main/othervm AllPlatforms
  */
+import jdk.internal.util.OperatingSystem;
+
 import javax.security.auth.login.Configuration;
 import javax.security.auth.login.LoginContext;
 import java.nio.file.Files;
@@ -39,14 +42,14 @@ public class AllPlatforms {
     private static final String NT_MODULE = "NTLoginModule";
 
     public static void main(String[] args) throws Exception {
-        login("cross-platform",
+        login(true, "cross-platform",
                 UNIX_MODULE, "optional",
                 NT_MODULE, "optional");
-        login("windows", NT_MODULE, "required");
-        login("unix", UNIX_MODULE, "required");
+        login(OperatingSystem.isWindows(), "windows", NT_MODULE, "required");
+        login(!OperatingSystem.isWindows(), "unix", UNIX_MODULE, "required");
     }
 
-    static void login(String test, String... conf) throws Exception {
+    static void login(boolean shouldSucceed, String test, String... conf) throws Exception {
         System.out.println("Testing " + test + "...");
 
         StringBuilder sb = new StringBuilder();
@@ -68,11 +71,19 @@ public class AllPlatforms {
             lc.login();
             System.out.println(lc.getSubject());
             lc.logout();
+            if (!shouldSucceed) {
+                throw new RuntimeException("Should not succeed");
+            }
         } catch (FailedLoginException e) {
+            if (shouldSucceed) {
+                throw new RuntimeException("Should succeed");
+            }
             // This exception can occur in other platform module than the running one.
-            if(e.getMessage().startsWith("Failed in attempt to import")) {
+            if (e.getMessage().startsWith("Failed in attempt to import")) {
                 System.out.println("Expected Exception found.");
                 e.printStackTrace(System.out);
+            } else {
+                throw new RuntimeException("Unexpected error", e);
             }
         }
     }
diff --git a/test/jdk/java/awt/Desktop/BrowseTest.java b/test/jdk/java/awt/Desktop/BrowseTest.java
index 33de1ecdca7..28e08fe16c7 100644
--- a/test/jdk/java/awt/Desktop/BrowseTest.java
+++ b/test/jdk/java/awt/Desktop/BrowseTest.java
@@ -40,10 +40,27 @@ import jtreg.SkippedException;
 
 public class BrowseTest extends JPanel {
     static final String INSTRUCTIONS = """
-            This test could launch default file manager to open user's home
-            directory, and default web browser to show the URL of java vendor.
-            After test execution close the native file manager and web browser
+            Set your default browser as per the test platform.
+            macOS - Safari
+            windows - MS Edge
+            linux - Firefox
+
+            This test checks 2 cases:
+
+            1) Directory URI:
+               On macOS and windows, verify that a browser window opens and
+               EITHER the browser OR native file manager shows the user's
+               home directory.
+
+               On Linux verify that the user's home directory is shown by the
+               default file manager.
+
+            2) Web URI:
+               Verify that the Web URI (URL of java vendor) opens in the browser.
+
+            After test execution close the native file manager and any web browser
             windows if they were launched by test.
+
             Also check output for any unexpected EXCEPTIONS,
             if you see any failure messages press Fail otherwise press Pass.
             """;
@@ -53,7 +70,7 @@ public class BrowseTest extends JPanel {
 
         URI dirURI = new File(System.getProperty("user.home")).toURI();
         URI webURI = URI.create(System.getProperty("java.vendor.url", "http://www.java.com"));
-        boolean failed = false;
+        PassFailJFrame.log("Testing 1st case: Directory URI ...");
         try {
             PassFailJFrame.log("Try to browse " + dirURI + " ...");
             desktop.browse(dirURI);
@@ -62,6 +79,7 @@ public class BrowseTest extends JPanel {
             PassFailJFrame.log("EXCEPTION: " + e.getMessage());
         }
 
+        PassFailJFrame.log("Testing 2nd case: Web URI ...");
         try {
             PassFailJFrame.log("Try to browse " + webURI + " ...");
             desktop.browse(webURI);
diff --git a/test/jdk/java/awt/Desktop/EditAndPrintTest/EditAndPrintTest.java b/test/jdk/java/awt/Desktop/EditAndPrintTest/EditAndPrintTest.java
index b2d7ef28df1..77d86ceb42a 100644
--- a/test/jdk/java/awt/Desktop/EditAndPrintTest/EditAndPrintTest.java
+++ b/test/jdk/java/awt/Desktop/EditAndPrintTest/EditAndPrintTest.java
@@ -48,7 +48,7 @@ public class EditAndPrintTest extends JPanel {
             This test tries to edit and print a directory, which will expectedly raise IOException.
             Then this test would edit and print a .txt file, which should be successful.
             After test execution close the editor if it was launched by test.
-            If you see any EXCEPTION messages in the output press FAIL.
+            If you see any EXCEPTION messages in case of .txt file in the output press FAIL.
             """;
 
     static Desktop desktop;
diff --git a/test/jdk/java/awt/print/PrinterJob/PageRanges.java b/test/jdk/java/awt/print/PrinterJob/PageRanges.java
index e80330bae6c..aea60516f78 100644
--- a/test/jdk/java/awt/print/PrinterJob/PageRanges.java
+++ b/test/jdk/java/awt/print/PrinterJob/PageRanges.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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6575331
+ * @bug 6575331 8297191
  * @key printer
  * @summary The specified pages should be printed.
  * @library /java/awt/regtesthelpers
diff --git a/test/jdk/java/lang/Thread/virtual/stress/NotifiedThenTimedOutWait.java b/test/jdk/java/lang/Thread/virtual/stress/NotifiedThenTimedOutWait.java
new file mode 100644
index 00000000000..0734a794b90
--- /dev/null
+++ b/test/jdk/java/lang/Thread/virtual/stress/NotifiedThenTimedOutWait.java
@@ -0,0 +1,134 @@
+/*
+ * 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 8373120
+ * @summary Stress test two consecutive timed Object.wait calls where only the first one is notified.
+ * @run main/othervm -XX:CompileCommand=exclude,java.lang.VirtualThread::afterYield NotifiedThenTimedOutWait 1 100 100
+ */
+
+/*
+ * @test
+ * @run main/othervm -XX:CompileCommand=exclude,java.lang.VirtualThread::afterYield NotifiedThenTimedOutWait 2 100 100
+ */
+
+import java.time.Instant;
+import java.util.concurrent.Phaser;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.ThreadLocalRandom;
+
+public class NotifiedThenTimedOutWait {
+    public static void main(String[] args) throws Exception {
+        int race = (args.length > 0) ? Integer.parseInt(args[0]) : 1;
+        int nruns = (args.length > 1) ? Integer.parseInt(args[1]) : 100;
+        int iterations = (args.length > 2) ? Integer.parseInt(args[2]) : 100;
+
+        for (int i = 1; i <= nruns; i++) {
+            System.out.println(Instant.now() + " => " + i + " of " + nruns);
+            switch (race) {
+                case 1 -> race1(iterations);
+                case 2 -> race2(iterations);
+            }
+        }
+    }
+
+    /**
+     * Barrier in synchronized block.
+     */
+    private static void race1(int iterations) throws InterruptedException {
+        final int timeout = 1;
+        var lock = new Object();
+        var start = new Phaser(2);
+        var end = new Phaser(2);
+
+        var vthread = Thread.ofVirtual().start(() -> {
+            try {
+                for (int j = 0; j < iterations; j++) {
+                    synchronized (lock) {
+                        start.arriveAndAwaitAdvance();
+                        lock.wait(timeout);
+                        lock.wait(timeout);
+                    }
+                    end.arriveAndAwaitAdvance();
+                }
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+        });
+
+        ThreadFactory factory = ThreadLocalRandom.current().nextBoolean()
+                    ? Thread.ofPlatform().factory() : Thread.ofVirtual().factory();
+        var notifier = factory.newThread(() -> {
+            for (int j = 0; j < iterations; j++) {
+                start.arriveAndAwaitAdvance();
+                synchronized (lock) {
+                    lock.notify();
+                }
+                end.arriveAndAwaitAdvance();
+            }
+        });
+        notifier.start();
+
+        vthread.join();
+        notifier.join();
+    }
+
+    /**
+     * Barrier before synchronized block.
+     */
+    private static void race2(int iterations) throws InterruptedException {
+        final int timeout = 1;
+        var lock = new Object();
+        var start = new Phaser(2);
+
+        var vthread = Thread.startVirtualThread(() -> {
+            try {
+                for (int i = 0; i < iterations; i++) {
+                    start.arriveAndAwaitAdvance();
+                    synchronized (lock) {
+                        lock.wait(timeout);
+                        lock.wait(timeout);
+                    }
+                }
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+        });
+
+        ThreadFactory factory = ThreadLocalRandom.current().nextBoolean()
+                    ? Thread.ofPlatform().factory() : Thread.ofVirtual().factory();
+        var notifier = factory.newThread(() -> {
+            for (int i = 0; i < iterations; i++) {
+                start.arriveAndAwaitAdvance();
+                synchronized (lock) {
+                    lock.notify();
+                }
+            }
+        });
+        notifier.start();
+
+        vthread.join();
+        notifier.join();
+    }
+}
diff --git a/test/jdk/java/lang/invoke/8147078/Test8147078.java b/test/jdk/java/lang/invoke/8147078/Test8147078.java
index 08532d30929..51580aa6f10 100644
--- a/test/jdk/java/lang/invoke/8147078/Test8147078.java
+++ b/test/jdk/java/lang/invoke/8147078/Test8147078.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 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
@@ -23,17 +23,18 @@
 
 /* @test
  * @bug 8147078
- * @run testng/othervm -ea -esa Test8147078
+ * @run junit/othervm -ea -esa Test8147078
  */
 
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 
 import static java.lang.invoke.MethodType.methodType;
 
-import static org.testng.AssertJUnit.*;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 public class Test8147078 {
 
@@ -65,16 +66,10 @@ public class Test8147078 {
 
     @Test
     public void testNoExceptionType() {
-        boolean caught = false;
-        try {
+        var cce = assertThrows(ClassCastException.class, () -> {
             MethodHandle eek = (MethodHandle) MH_catchException.invoke(MH_target, String.class, MH_handler);
-        } catch (ClassCastException cce) {
-            assertEquals("java.lang.String", cce.getMessage());
-            caught = true;
-        } catch (Throwable t) {
-            fail("unexpected exception caught: " + t);
-        }
-        assertTrue(caught);
+        });
+        assertEquals("java.lang.String", cce.getMessage());
     }
 
 }
\ No newline at end of file
diff --git a/test/jdk/java/lang/invoke/8177146/TestMethodHandleBind.java b/test/jdk/java/lang/invoke/8177146/TestMethodHandleBind.java
index 134cc9f7514..518d07b1518 100644
--- a/test/jdk/java/lang/invoke/8177146/TestMethodHandleBind.java
+++ b/test/jdk/java/lang/invoke/8177146/TestMethodHandleBind.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,17 +23,16 @@
 
 /* @test
  * @bug 8177146
- * @run testng/othervm TestMethodHandleBind
+ * @run junit/othervm TestMethodHandleBind
  */
 
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodType;
 
 import static java.lang.invoke.MethodHandles.lookup;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Test;
 
 public class TestMethodHandleBind extends pkg.A {
     static class B extends TestMethodHandleBind {}
@@ -42,7 +41,7 @@ public class TestMethodHandleBind extends pkg.A {
     public void testInstanceOfCallerClass() throws Throwable {
         MethodHandle bound = lookup().bind(new TestMethodHandleBind() , "m1", MethodType.methodType(String.class));
         String x = (String)bound.invoke();
-        assertEquals(x, this.getClass().getSimpleName());
+        assertEquals(this.getClass().getSimpleName(), x);
     }
 
     @Test
@@ -50,47 +49,37 @@ public class TestMethodHandleBind extends pkg.A {
         MethodHandle bound = lookup().bind(new B() , "m1", MethodType.methodType(String.class));
         // MethodHandle bound = lookup().findVirtual(B.class,  "m1", MethodType.methodType(String.class)).bindTo(new B());
         String x = (String)bound.invoke();
-        assertEquals(x, "B");
+        assertEquals("B", x);
     }
 
     @Test
     public void testInstanceOfReceiverClass() throws Throwable {
-        try {
-            MethodHandle bound = lookup().bind(new pkg.A() , "m1", MethodType.methodType(String.class));
-            bound.invoke();
-            fail("IllegalAccessException expected");
-        } catch (IllegalAccessException e) {
-        }
+        assertThrows(IllegalAccessException.class, () -> lookup().bind(new pkg.A() , "m1", MethodType.methodType(String.class)));
     }
 
     @Test
     public void testPublicMethod() throws Throwable {
         MethodHandle bound = lookup().bind(new pkg.A() , "m2", MethodType.methodType(String.class));
         String x = (String)bound.invoke();
-        assertEquals(x, "A");
+        assertEquals("A", x);
     }
 
     @Test
     public void testPublicMethod2() throws Throwable {
         MethodHandle bound = lookup().bind(new TestMethodHandleBind(), "m2", MethodType.methodType(String.class));
         String x = (String)bound.invoke();
-        assertEquals(x, this.getClass().getSimpleName());
+        assertEquals(this.getClass().getSimpleName(), x);
     }
 
     @Test
     public void testInstanceOfCallerClassVarargs() throws Throwable {
         MethodHandle bound = lookup().bind(new TestMethodHandleBind() , "m3", MethodType.methodType(String.class, String[].class));
         String x = (String)bound.invoke("a", "b", "c");
-        assertEquals(x, this.getClass().getSimpleName() + "abc");
+        assertEquals(this.getClass().getSimpleName() + "abc", x);
     }
 
     @Test
     public void testInstanceOfReceiverClassVarargs() throws Throwable {
-        try {
-            MethodHandle bound = lookup().bind(new pkg.A(), "m3", MethodType.methodType(String.class, String[].class));
-            bound.invoke();
-            fail("IllegalAccessException expected");
-        } catch (IllegalAccessException e) {
-        }
+        assertThrows(IllegalAccessException.class, () -> lookup().bind(new pkg.A(), "m3", MethodType.methodType(String.class, String[].class)));
     }
 }
diff --git a/test/jdk/java/lang/invoke/AccessControlTest.java b/test/jdk/java/lang/invoke/AccessControlTest.java
index e177f08d876..fcd945a5d7f 100644
--- a/test/jdk/java/lang/invoke/AccessControlTest.java
+++ b/test/jdk/java/lang/invoke/AccessControlTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2022, 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
@@ -24,7 +24,7 @@
 /* @test
  * @summary test access checking by java.lang.invoke.MethodHandles.Lookup
  * @compile AccessControlTest.java AccessControlTest_subpkg/Acquaintance_remote.java
- * @run testng/othervm test.java.lang.invoke.AccessControlTest
+ * @run junit/othervm test.java.lang.invoke.AccessControlTest
  */
 
 package test.java.lang.invoke;
@@ -33,12 +33,13 @@ import java.lang.invoke.*;
 import java.lang.reflect.*;
 import java.lang.reflect.Modifier;
 import java.util.*;
-import org.testng.annotations.*;
 
 import static java.lang.invoke.MethodHandles.*;
 import static java.lang.invoke.MethodHandles.Lookup.*;
 import static java.lang.invoke.MethodType.*;
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+
+import org.junit.jupiter.api.Test;
 
 import test.java.lang.invoke.AccessControlTest_subpkg.Acquaintance_remote;
 
@@ -69,7 +70,7 @@ public class AccessControlTest {
             this.prevLookupClass = lookup.previousLookupClass();
             this.lookupModes = lookup.lookupModes();
 
-            assert(lookupString().equals(lookup.toString()));
+            assertEquals(lookupString(), lookup.toString());
             numberOf(lookupClass().getClassLoader()); // assign CL#
         }
         public LookupCase(Class lookupClass, Class prevLookupClass, int lookupModes) {
@@ -96,7 +97,7 @@ public class AccessControlTest {
                 int cmp = c1.getName().compareTo(c2.getName());
                 if (cmp != 0)  return cmp;
                 cmp = numberOf(c1.getClassLoader()) - numberOf(c2.getClassLoader());
-                assert(cmp != 0);
+                assertNotEquals(0, cmp);
                 return cmp;
             } else if (p1 != p2){
                 if (p1 == null)
@@ -106,7 +107,7 @@ public class AccessControlTest {
                 int cmp = p1.getName().compareTo(p2.getName());
                 if (cmp != 0)  return cmp;
                 cmp = numberOf(p1.getClassLoader()) - numberOf(p2.getClassLoader());
-                assert(cmp != 0);
+                assertNotEquals(0, cmp);
                 return cmp;
             }
             return -(this.lookupModes() - that.lookupModes());
@@ -211,8 +212,8 @@ public class AccessControlTest {
                                    c1.getPackageName().equals(c2.getPackageName()));
             boolean sameTopLevel = (topLevelClass(c1) == topLevelClass(c2));
             boolean sameClass = (c1 == c2);
-            assert(samePackage  || !sameTopLevel);
-            assert(sameTopLevel || !sameClass);
+            assertTrue(samePackage  || !sameTopLevel);
+            assertTrue(sameTopLevel || !sameClass);
             boolean accessible = sameClass;
 
             if ((modes1 & PACKAGE) != 0)  accessible |= samePackage;
@@ -251,17 +252,17 @@ public class AccessControlTest {
                 changed |= (PRIVATE|PROTECTED);  // [A5]
             }
             if (sameClass) {
-                assert(changed == 0);       // [A11] (no deprivation if same class)
+                assertEquals(0, changed);       // [A11] (no deprivation if same class)
             }
 
-            if (accessible)  assert((changed & PUBLIC) == 0);
+            if (accessible) assertEquals(0, changed & PUBLIC);
             int modes2 = modes1 & ~changed;
             Class plc = (m1 == m2) ? prevLookupClass() : c1; // [A9] [A10]
             if ((modes1 & UNCONDITIONAL) != 0) plc = null;      // [A8]
             LookupCase l2 = new LookupCase(c2, plc, modes2);
-            assert(l2.lookupClass() == c2);         // [A1]
-            assert((modes1 | modes2) == modes1);    // [A1-a] (no elevation of access)
-            assert(l2.prevLookupClass() == null || (modes2 & MODULE) == 0);
+            assertSame(l2.lookupClass(), c2);         // [A1]
+            assertEquals(modes1, modes1 | modes2);    // [A1-a] (no elevation of access)
+            assertTrue(l2.prevLookupClass() == null || (modes2 & MODULE) == 0);
             return l2;
         }
 
@@ -280,8 +281,8 @@ public class AccessControlTest {
             }
             if (newModes == oldModes) return this;  // return self if no change
             LookupCase l2 = new LookupCase(lookupClass(), prevLookupClass(), newModes);
-            assert((oldModes | newModes) == oldModes);    // [A2] (no elevation of access)
-            assert(l2.prevLookupClass() == null || (newModes & MODULE) == 0);
+            assertEquals(oldModes, oldModes | newModes);    // [A2] (no elevation of access)
+            assertTrue(l2.prevLookupClass() == null || (newModes & MODULE) == 0);
             return l2;
         }
 
@@ -331,7 +332,7 @@ public class AccessControlTest {
                        && Modifier.isPublic(m.getModifiers());
             }
 
-            assert(m1 == m2 && prevLookupClass == null);
+            assertNull(prevLookupClass);
 
             if (!willAccessClass(c2, false))
                 return false;
@@ -380,7 +381,7 @@ public class AccessControlTest {
                     && Modifier.isPublic(c2.getModifiers());
             }
 
-            assert(m1 == m2 && prevLookupClass == null);
+            assertNull(prevLookupClass);
 
             LookupCase lc = this.in(c2);
             int modes1 = lc.lookupModes();
@@ -409,8 +410,8 @@ public class AccessControlTest {
         Class c = cls;
         for (Class ec; (ec = c.getEnclosingClass()) != null; )
             c = ec;
-        assert(c.getEnclosingClass() == null);
-        assert(c == cls || cls.getEnclosingClass() != null);
+        assertNull(c.getEnclosingClass());
+        assertTrue(c == cls || cls.getEnclosingClass() != null);
         return c;
     }
 
@@ -443,14 +444,14 @@ public class AccessControlTest {
         if (edges == null)  CASE_EDGES.put(l2, edges = new TreeSet<>());
         if (edges.add(l1)) {
             Class c1 = l1.lookupClass();
-            assert(l2.lookupClass() == c2); // [A1]
+            assertSame(l2.lookupClass(), c2); // [A1]
             int m1 = l1.lookupModes();
             int m2 = l2.lookupModes();
-            assert((m1 | m2) == m1);        // [A2] (no elevation of access)
+            assertEquals(m1, (m1 | m2));        // [A2] (no elevation of access)
             LookupCase expect = dropAccess == 0 ? l1.in(c2) : l1.in(c2).dropLookupMode(dropAccess);
             if (!expect.equals(l2))
                 System.out.println("*** expect "+l1+" => "+expect+" but got "+l2);
-            assertEquals(l2, expect);
+            assertEquals(expect, l2);
         }
     }
 
@@ -567,7 +568,7 @@ public class AccessControlTest {
         if (willAccess != didAccess) {
             System.out.println(sourceCase+" => "+targetClass.getSimpleName()+(isFindOrAccessClass?"":"."+methodName+methodType));
             System.out.println("fail "+(isFindOrAccessClass?kind:"on "+method)+" ex="+accessError);
-            assertEquals(willAccess, didAccess);
+            assertEquals(didAccess, willAccess);
         }
         testCount++;
         if (!didAccess)  testCountFails++;
@@ -579,10 +580,10 @@ public class AccessControlTest {
             System.out.println(targetClass.getSimpleName()+"."+methodName+methodType);
         try {
             Method method = targetClass.getDeclaredMethod(methodName, methodType.parameterArray());
-            assertEquals(method.getReturnType(), methodType.returnType());
+            assertEquals(methodType.returnType(), method.getReturnType());
             int haveMods = method.getModifiers();
-            assert(Modifier.isStatic(haveMods));
-            assert(targetAccess == fixMods(haveMods));
+            assertTrue(Modifier.isStatic(haveMods));
+            assertEquals(targetAccess, fixMods(haveMods));
             return method;
         } catch (NoSuchMethodException ex) {
             throw new AssertionError(methodName, ex);
@@ -604,7 +605,7 @@ public class AccessControlTest {
         case PACKAGE:    return "pkg_in_";
         case PRIVATE:    return "pri_in_";
         }
-        assert(false);
+        fail();
         return "?";
     }
     private static final int[] ACCESS_CASES = {
diff --git a/test/jdk/java/lang/invoke/ArrayConstructorTest.java b/test/jdk/java/lang/invoke/ArrayConstructorTest.java
index 749bb7926a0..313c2828380 100644
--- a/test/jdk/java/lang/invoke/ArrayConstructorTest.java
+++ b/test/jdk/java/lang/invoke/ArrayConstructorTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 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
@@ -23,7 +23,7 @@
 
 /* @test
  * @bug 8155106
- * @run testng/othervm -ea -esa test.java.lang.invoke.ArrayConstructorTest
+ * @run junit/othervm -ea -esa test.java.lang.invoke.ArrayConstructorTest
  */
 package test.java.lang.invoke;
 
@@ -32,30 +32,22 @@ import java.lang.invoke.MethodHandles;
 
 import static java.lang.invoke.MethodType.methodType;
 
-import static org.testng.AssertJUnit.*;
-
-import org.testng.annotations.*;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+import static org.junit.jupiter.api.Assertions.*;
 
 public class ArrayConstructorTest {
 
     static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup();
 
     @Test
-    public static void testFindConstructorArray() {
-        boolean caught = false;
-        try {
-            MethodHandle h = LOOKUP.findConstructor(Object[].class, methodType(void.class));
-        } catch (NoSuchMethodException nsme) {
-            assertEquals("no constructor for array class: [Ljava.lang.Object;", nsme.getMessage());
-            caught = true;
-        } catch (Exception e) {
-            throw new AssertionError("unexpected exception: " + e);
-        }
-        assertTrue(caught);
+    public void testFindConstructorArray() {
+        var nsme = assertThrows(NoSuchMethodException.class, () -> LOOKUP.findConstructor(Object[].class, methodType(void.class)));
+        assertEquals("no constructor for array class: [Ljava.lang.Object;", nsme.getMessage());
     }
 
-    @DataProvider
     static Object[][] arrayConstructorNegative() {
         return new Object[][]{
                 {String.class, IllegalArgumentException.class, "not an array class: java.lang.String"},
@@ -63,34 +55,28 @@ public class ArrayConstructorTest {
         };
     }
 
-    @Test(dataProvider = "arrayConstructorNegative")
-    public static void testArrayConstructorNegative(Class clazz, Class exceptionClass, String message) {
-        boolean caught = false;
-        try {
-            MethodHandle h = MethodHandles.arrayConstructor(clazz);
-        } catch (Exception e) {
-            assertEquals(exceptionClass, e.getClass());
-            if (message != null) {
-                assertEquals(message, e.getMessage());
-            }
-            caught = true;
+    @ParameterizedTest
+    @MethodSource("arrayConstructorNegative")
+    public void testArrayConstructorNegative(Class clazz, Class exceptionClass, String message) {
+        var e = assertThrowsExactly(exceptionClass, () -> MethodHandles.arrayConstructor(clazz));
+        if (message != null) {
+            assertEquals(message, e.getMessage());
         }
-        assertTrue(caught);
     }
 
     @Test
-    public static void testArrayConstructor() throws Throwable {
+    public void testArrayConstructor() throws Throwable {
         MethodHandle h = MethodHandles.arrayConstructor(String[].class);
         assertEquals(methodType(String[].class, int.class), h.type());
         String[] a = (String[]) h.invoke(17);
         assertEquals(17, a.length);
     }
 
-    @Test(expectedExceptions = {NegativeArraySizeException.class})
-    public static void testArrayConstructorNegativeIndex() throws Throwable {
+    @Test
+    public void testArrayConstructorNegativeIndex() throws Throwable {
         MethodHandle h = MethodHandles.arrayConstructor(String[].class);
         assertEquals(methodType(String[].class, int.class), h.type());
-        h.invoke(-1); // throws exception
+        assertThrows(NegativeArraySizeException.class, () -> h.invoke(-1));
     }
 
 }
diff --git a/test/jdk/java/lang/invoke/ArrayLengthTest.java b/test/jdk/java/lang/invoke/ArrayLengthTest.java
index 9f3cc6fe240..2ef97442638 100644
--- a/test/jdk/java/lang/invoke/ArrayLengthTest.java
+++ b/test/jdk/java/lang/invoke/ArrayLengthTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 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
@@ -22,36 +22,39 @@
  */
 
 /* @test
- * @run testng/othervm -ea -esa test.java.lang.invoke.ArrayLengthTest
+ * @run junit/othervm -ea -esa test.java.lang.invoke.ArrayLengthTest
  */
 package test.java.lang.invoke;
 
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 
-import static org.testng.AssertJUnit.*;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
-import org.testng.annotations.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 public class ArrayLengthTest {
 
-    @DataProvider
-    Object[][] arrayClasses() {
-        return new Object[][] {
-                {int[].class},
-                {long[].class},
-                {float[].class},
-                {double[].class},
-                {boolean[].class},
-                {byte[].class},
-                {short[].class},
-                {char[].class},
-                {Object[].class},
-                {StringBuffer[].class}
+    static Object[] arrayClasses() {
+        return new Object[] {
+                int[].class,
+                long[].class,
+                float[].class,
+                double[].class,
+                boolean[].class,
+                byte[].class,
+                short[].class,
+                char[].class,
+                Object[].class,
+                StringBuffer[].class
         };
     }
 
-    @Test(dataProvider = "arrayClasses")
+    @ParameterizedTest
+    @MethodSource("arrayClasses")
     public void testArrayLength(Class arrayClass) throws Throwable {
         MethodHandle arrayLength = MethodHandles.arrayLength(arrayClass);
         assertEquals(int.class, arrayLength.type().returnType());
@@ -60,25 +63,28 @@ public class ArrayLengthTest {
         assertEquals(10, arrayLength.invoke(array));
     }
 
-    @Test(dataProvider = "arrayClasses", expectedExceptions = NullPointerException.class)
+    @ParameterizedTest
+    @MethodSource("arrayClasses")
     public void testArrayLengthInvokeNPE(Class arrayClass) throws Throwable {
         MethodHandle arrayLength = MethodHandles.arrayLength(arrayClass);
-        arrayLength.invoke(null);
+        assertThrows(NullPointerException.class, () -> arrayLength.invoke(null));
     }
 
-    @Test(expectedExceptions = IllegalArgumentException.class)
+    @Test
     public void testArrayLengthNoArray() {
-        MethodHandles.arrayLength(String.class);
+        assertThrows(IllegalArgumentException.class, () -> MethodHandles.arrayLength(String.class));
     }
 
-    @Test(expectedExceptions = NullPointerException.class)
+    @Test
     public void testArrayLengthNPE() {
-        MethodHandles.arrayLength(null);
+        assertThrows(NullPointerException.class, () -> MethodHandles.arrayLength(null));
     }
 
-    @Test(expectedExceptions = NullPointerException.class)
+    @Test
     public void testNullReference() throws Throwable {
         MethodHandle arrayLength = MethodHandles.arrayLength(String[].class);
-        int len = (int)arrayLength.invokeExact((String[])null);
+        assertThrows(NullPointerException.class, () -> {
+            int len = (int)arrayLength.invokeExact((String[])null);
+        });
     }
 }
diff --git a/test/jdk/java/lang/invoke/CallerSensitiveMethodHandle.java b/test/jdk/java/lang/invoke/CallerSensitiveMethodHandle.java
index 369c2c2bea1..a2756fc2f23 100644
--- a/test/jdk/java/lang/invoke/CallerSensitiveMethodHandle.java
+++ b/test/jdk/java/lang/invoke/CallerSensitiveMethodHandle.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 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
@@ -22,20 +22,19 @@
  */
 
 /* @test
- * @run testng/othervm CallerSensitiveMethodHandle
+ * @run junit/othervm CallerSensitiveMethodHandle
  * @summary Check Lookup findVirtual, findStatic and unreflect behavior with
  *          caller sensitive methods with focus on AccessibleObject.setAccessible
  */
 
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodHandles.Lookup;
 import java.lang.reflect.Field;
 
 import static java.lang.invoke.MethodType.*;
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Test;
 
 public class CallerSensitiveMethodHandle {
     private static int field = 0;
@@ -46,7 +45,7 @@ public class CallerSensitiveMethodHandle {
         MethodHandle mh = l.findVirtual(Field.class, "setInt", methodType(void.class, Object.class, int.class));
         int newValue = 5;
         mh.invokeExact(f, (Object) null, newValue);
-        assertTrue(field == newValue);
+        assertEquals(newValue, field);
     }
 
     @Test
@@ -55,6 +54,6 @@ public class CallerSensitiveMethodHandle {
         MethodHandle MH_lookup2 = lookup.findStatic(MethodHandles.class, "lookup", methodType(Lookup.class));
         Lookup lookup2 = (Lookup) MH_lookup2.invokeExact();
         System.out.println(lookup2 + " original lookup class " + lookup.lookupClass());
-        assertTrue(lookup2.lookupClass() == lookup.lookupClass());
+        assertSame(lookup.lookupClass(), lookup2.lookupClass());
     }
 }
diff --git a/test/jdk/java/lang/invoke/ClassSpecializerTest.java b/test/jdk/java/lang/invoke/ClassSpecializerTest.java
index 671cf39e217..8bc5c58ad52 100644
--- a/test/jdk/java/lang/invoke/ClassSpecializerTest.java
+++ b/test/jdk/java/lang/invoke/ClassSpecializerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 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,15 +24,13 @@
 /* @test
  * @summary Smoke-test class specializer, used to create BoundMethodHandle classes
  * @compile/module=java.base java/lang/invoke/ClassSpecializerHelper.java
- * @run testng/othervm/timeout=250 -ea -esa ClassSpecializerTest
+ * @run junit/othervm/timeout=250 -ea -esa ClassSpecializerTest
  */
 
 // Useful diagnostics to try:
 //   -Djava.lang.invoke.MethodHandle.TRACE_RESOLVE=true
 //   -Djava.lang.invoke.MethodHandle.DUMP_CLASS_FILES=true
 
-
-import org.testng.annotations.*;
 import java.lang.invoke.*;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -40,6 +38,11 @@ import java.util.List;
 
 import static java.lang.invoke.ClassSpecializerHelper.*;
 
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertSame;
+
 
 public class ClassSpecializerTest {
     @Test
@@ -58,12 +61,12 @@ public class ClassSpecializerTest {
             }
             args.set(0, key * 1000 + 42);
             Frob f = (Frob) mh.invokeWithArguments(args.toArray());
-            assert(f.kind() == k);
+            assertSame(k, f.kind());
             System.out.println("k.f(...) = " + f.toString());
             List l = f.asList();
             System.out.println("f.l = " + l);
             args.subList(0,1).clear();  // drop label
-            assert(args.equals(l));
+            assertEquals(args, l);
         }
     }
     private static Object coughUpA(Class pt) throws Throwable {
diff --git a/test/jdk/java/lang/invoke/CompileThresholdBootstrapTest.java b/test/jdk/java/lang/invoke/CompileThresholdBootstrapTest.java
index 848264b83a3..c6e093bd09a 100644
--- a/test/jdk/java/lang/invoke/CompileThresholdBootstrapTest.java
+++ b/test/jdk/java/lang/invoke/CompileThresholdBootstrapTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2019, 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
@@ -26,27 +26,19 @@
  * @bug 8143232
  * @summary Test verifies that LF bootstraps properly when run with COMPILE_THRESHOLD set
  * @compile CompileThresholdBootstrapTest.java
- * @run testng/othervm -Djava.lang.invoke.MethodHandle.COMPILE_THRESHOLD=30 test.java.lang.invoke.CompileThresholdBootstrapTest
+ * @run junit/othervm -Djava.lang.invoke.MethodHandle.COMPILE_THRESHOLD=30 test.java.lang.invoke.CompileThresholdBootstrapTest
  */
 package test.java.lang.invoke;
 
 import java.lang.invoke.MethodHandles;
-import org.testng.*;
-import org.testng.annotations.*;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public final class CompileThresholdBootstrapTest {
 
     @Test
     public void testBootstrap() throws Throwable {
-        Assert.assertEquals((int)MethodHandles.constant(int.class, (int)0).invokeExact(), 0);
-    }
-
-    public static void main(String ... args) {
-        try {
-            CompileThresholdBootstrapTest test = new CompileThresholdBootstrapTest();
-            test.testBootstrap();
-        } catch (Throwable t) {
-            t.printStackTrace();
-        }
+        assertEquals(0, (int)MethodHandles.constant(int.class, (int)0).invokeExact());
     }
 }
diff --git a/test/jdk/java/lang/invoke/ConstantIdentityMHTest.java b/test/jdk/java/lang/invoke/ConstantIdentityMHTest.java
index 320fd29abe6..43770ea023b 100644
--- a/test/jdk/java/lang/invoke/ConstantIdentityMHTest.java
+++ b/test/jdk/java/lang/invoke/ConstantIdentityMHTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2019, 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
@@ -23,7 +23,7 @@
 
 /* @test
  * @summary unit tests for java.lang.invoke.MethodHandles
- * @run testng/othervm -ea -esa test.java.lang.invoke.ConstantIdentityMHTest
+ * @run junit/othervm -ea -esa test.java.lang.invoke.ConstantIdentityMHTest
  */
 package test.java.lang.invoke;
 
@@ -31,13 +31,14 @@ import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import static java.lang.invoke.MethodHandles.*;
 import static java.lang.invoke.MethodType.*;
-import static org.testng.Assert.*;
-import org.testng.annotations.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 public class ConstantIdentityMHTest {
 
-    @DataProvider(name = "testZeroData")
-    private Object[][] testZeroData() {
+    private static Object[][] testZeroData() {
        return new Object[][] {
            {void.class, "()void"},
            {int.class, "()int"},
@@ -52,26 +53,27 @@ public class ConstantIdentityMHTest {
        };
     }
 
-    @Test(dataProvider = "testZeroData")
+    @ParameterizedTest
+    @MethodSource("testZeroData")
     public void testZero(Class expectedtype, String expected) throws Throwable {
-        assertEquals(MethodHandles.zero(expectedtype).type().toString(), expected);
+        assertEquals(expected, MethodHandles.zero(expectedtype).type().toString());
     }
 
-    @Test(expectedExceptions={ NullPointerException.class })
+    @Test
     public void testZeroNPE() {
-        MethodHandle mh = MethodHandles.zero(null);
+        assertThrows(NullPointerException.class, () -> MethodHandles.zero(null));
     }
 
     @Test
     void testEmpty() throws Throwable {
         MethodHandle cat = lookup().findVirtual(String.class, "concat", methodType(String.class, String.class));
-        assertEquals((String)cat.invoke("x","y"), "xy");
+        assertEquals("xy", (String)cat.invoke("x","y"));
         MethodHandle mhEmpty = MethodHandles.empty(cat.type());
-        assertEquals((String)mhEmpty.invoke("x","y"), null);
+        assertNull((String) mhEmpty.invoke("x", "y"));
     }
 
-    @Test(expectedExceptions = { NullPointerException.class })
+    @Test
     void testEmptyNPE() {
-        MethodHandle lenEmptyMH = MethodHandles.empty(null);
+        assertThrows(NullPointerException.class, () -> MethodHandles.empty(null));
     }
 }
diff --git a/test/jdk/java/lang/invoke/DefineClassTest.java b/test/jdk/java/lang/invoke/DefineClassTest.java
index f712c945e59..889607f38f5 100644
--- a/test/jdk/java/lang/invoke/DefineClassTest.java
+++ b/test/jdk/java/lang/invoke/DefineClassTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /* @test
  * @modules java.base/java.lang:open
- * @run testng/othervm test.DefineClassTest
+ * @run junit/othervm test.DefineClassTest
  * @summary Basic test for java.lang.invoke.MethodHandles.Lookup.defineClass
  */
 
@@ -38,7 +38,6 @@ import java.net.URLClassLoader;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
-import org.testng.annotations.Test;
 
 import static java.lang.classfile.ClassFile.ACC_PUBLIC;
 import static java.lang.classfile.ClassFile.ACC_STATIC;
@@ -48,7 +47,8 @@ import static java.lang.constant.ConstantDescs.INIT_NAME;
 import static java.lang.constant.ConstantDescs.MTD_void;
 import static java.lang.invoke.MethodHandles.*;
 import static java.lang.invoke.MethodHandles.Lookup.*;
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Test;
 
 public class DefineClassTest {
     private static final String THIS_PACKAGE = DefineClassTest.class.getPackageName();
@@ -60,9 +60,9 @@ public class DefineClassTest {
      * protection domain, as a lookup class.
      */
     void testSameAbode(Class clazz, Class lc) {
-        assertTrue(clazz.getClassLoader() == lc.getClassLoader());
-        assertEquals(clazz.getPackageName(), lc.getPackageName());
-        assertTrue(clazz.getProtectionDomain() == lc.getProtectionDomain());
+        assertSame(lc.getClassLoader(), clazz.getClassLoader());
+        assertEquals(lc.getPackageName(), clazz.getPackageName());
+        assertSame(lc.getProtectionDomain(), clazz.getProtectionDomain());
     }
 
     /**
@@ -72,8 +72,8 @@ public class DefineClassTest {
     void testDiscoverable(Class clazz, Lookup lookup) throws Exception {
         String cn = clazz.getName();
         ClassLoader loader = clazz.getClassLoader();
-        assertTrue(Class.forName(cn, false, loader) == clazz);
-        assertTrue(lookup.findClass(cn) == clazz);
+        assertSame(clazz, Class.forName(cn, false, loader));
+        assertSame(clazz, lookup.findClass(cn));
     }
 
     /**
@@ -86,7 +86,7 @@ public class DefineClassTest {
         Class clazz = lookup.defineClass(generateClass(CLASS_NAME));
 
         // test name
-        assertEquals(clazz.getName(), CLASS_NAME);
+        assertEquals(CLASS_NAME, clazz.getName());
 
         // test loader/package/protection-domain
         testSameAbode(clazz, lookup.lookupClass());
@@ -95,10 +95,8 @@ public class DefineClassTest {
         testDiscoverable(clazz, lookup);
 
         // attempt defineClass again
-        try {
-            lookup.defineClass(generateClass(CLASS_NAME));
-            assertTrue(false);
-        } catch (LinkageError expected) { }
+        var bytes = generateClass(CLASS_NAME);
+        assertThrows(LinkageError.class, () -> lookup.defineClass(bytes));
     }
 
     /**
@@ -126,10 +124,7 @@ public class DefineClassTest {
         classBytes = generateRunner(CLASS_NAME + nextNumber(), THIS_CLASS, "method4");
         Class clazz = lookup.defineClass(classBytes);
         Runnable r = (Runnable) clazz.newInstance();
-        try {
-            r.run();
-            assertTrue(false);
-        } catch (IllegalAccessError expected) { }
+        assertThrows(IllegalAccessError.class, r::run);
     }
 
     public static void method1() { }
@@ -154,12 +149,8 @@ public class DefineClassTest {
         Class clazz = lookup().defineClass(classBytes);
 
         // trigger initializer to run
-        try {
-            clazz.newInstance();
-            assertTrue(false);
-        } catch (ExceptionInInitializerError e) {
-            assertTrue(e.getCause() instanceof IllegalCallerException);
-        }
+        var e = assertThrows(ExceptionInInitializerError.class, clazz::newInstance);
+        assertInstanceOf(IllegalCallerException.class, e.getCause());
     }
 
     static void fail() { throw new IllegalCallerException(); }
@@ -189,9 +180,9 @@ public class DefineClassTest {
         ClassLoader loader = new URLClassLoader(new URL[] { url1, url2 });
         Class target1 = Class.forName("p.C1", false, loader);
         Class target2 = Class.forName("p.C2", false, loader);
-        assertTrue(target1.getClassLoader() == loader);
-        assertTrue(target1.getClassLoader() == loader);
-        assertNotEquals(target1.getProtectionDomain(), target2.getProtectionDomain());
+        assertSame(loader, target1.getClassLoader());
+        assertSame(loader, target1.getClassLoader());
+        assertNotEquals(target2.getProtectionDomain(), target1.getProtectionDomain());
 
         // protection domain 1
         Lookup lookup1 = privateLookupIn(target1, lookup());
@@ -214,43 +205,43 @@ public class DefineClassTest {
     @Test
     public void testBootLoader() throws Exception {
         Lookup lookup = privateLookupIn(Thread.class, lookup());
-        assertTrue(lookup.getClass().getClassLoader() == null);
+        assertNull(lookup.getClass().getClassLoader());
 
         Class clazz = lookup.defineClass(generateClass("java.lang.Foo"));
-        assertEquals(clazz.getName(), "java.lang.Foo");
+        assertEquals("java.lang.Foo", clazz.getName());
         testSameAbode(clazz, Thread.class);
         testDiscoverable(clazz, lookup);
     }
 
-    @Test(expectedExceptions = { IllegalArgumentException.class })
+    @Test
     public void testWrongPackage() throws Exception {
-        lookup().defineClass(generateClass("other.C"));
+        assertThrows(IllegalArgumentException.class, () -> lookup().defineClass(generateClass("other.C")));
     }
 
-    @Test(expectedExceptions = { IllegalAccessException.class })
+    @Test
     public void testNoPackageAccess() throws Exception {
         Lookup lookup = lookup().dropLookupMode(PACKAGE);
-        lookup.defineClass(generateClass(THIS_PACKAGE + ".C"));
+        assertThrows(IllegalAccessException.class, () -> lookup.defineClass(generateClass(THIS_PACKAGE + ".C")));
     }
 
-    @Test(expectedExceptions = { ClassFormatError.class })
+    @Test
     public void testTruncatedClassFile() throws Exception {
-        lookup().defineClass(new byte[0]);
+        assertThrows(ClassFormatError.class, () -> lookup().defineClass(new byte[0]));
     }
 
-    @Test(expectedExceptions = { NullPointerException.class })
+    @Test
     public void testNull() throws Exception {
-        lookup().defineClass(null);
+        assertThrows(NullPointerException.class, () -> lookup().defineClass(null));
     }
 
-    @Test(expectedExceptions = { NoClassDefFoundError.class })
+    @Test
     public void testLinking() throws Exception {
-        lookup().defineClass(generateNonLinkableClass(THIS_PACKAGE + ".NonLinkableClass"));
+        assertThrows(NoClassDefFoundError.class, () -> lookup().defineClass(generateNonLinkableClass(THIS_PACKAGE + ".NonLinkableClass")));
     }
 
-    @Test(expectedExceptions = { IllegalArgumentException.class })
+    @Test
     public void testModuleInfo() throws Exception {
-        lookup().defineClass(generateModuleInfo());
+        assertThrows(IllegalArgumentException.class, () -> lookup().defineClass(generateModuleInfo()));
     }
 
     /**
diff --git a/test/jdk/java/lang/invoke/DropArgumentsTest.java b/test/jdk/java/lang/invoke/DropArgumentsTest.java
index 2df9b5f63ba..fb82bb312cd 100644
--- a/test/jdk/java/lang/invoke/DropArgumentsTest.java
+++ b/test/jdk/java/lang/invoke/DropArgumentsTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 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
@@ -24,19 +24,24 @@
 /* @test
  * @bug  8158169
  * @summary unit tests for java.lang.invoke.MethodHandles
- * @run testng test.java.lang.invoke.DropArgumentsTest
+ * @run junit test.java.lang.invoke.DropArgumentsTest
  */
 package test.java.lang.invoke;
 
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import static java.lang.invoke.MethodHandles.*;
 import static java.lang.invoke.MethodType.*;
-import static org.testng.AssertJUnit.*;
-import org.testng.annotations.*;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 public class DropArgumentsTest {
 
@@ -53,8 +58,7 @@ public class DropArgumentsTest {
 
     }
 
-    @DataProvider(name = "dropArgumentsToMatchNPEData")
-    private Object[][] dropArgumentsToMatchNPEData()
+    private static Object[][] dropArgumentsToMatchNPEData()
             throws NoSuchMethodException, IllegalAccessException {
         MethodHandle cat = lookup().findVirtual(String.class, "concat", methodType(String.class, String.class));
         return new Object[][] {
@@ -63,13 +67,13 @@ public class DropArgumentsTest {
         };
     }
 
-    @Test(dataProvider = "dropArgumentsToMatchNPEData", expectedExceptions = { NullPointerException.class })
+    @ParameterizedTest
+    @MethodSource("dropArgumentsToMatchNPEData")
     public void dropArgumentsToMatchNPE(MethodHandle target, int pos, List> valueType, int skip) {
-        MethodHandles.dropArgumentsToMatch(target, pos, valueType , skip);
+        assertThrows(NullPointerException.class, () -> MethodHandles.dropArgumentsToMatch(target, pos, valueType, skip));
     }
 
-    @DataProvider(name = "dropArgumentsToMatchIAEData")
-    private Object[][] dropArgumentsToMatchIAEData()
+    private static Object[][] dropArgumentsToMatchIAEData()
         throws NoSuchMethodException, IllegalAccessException {
         MethodHandle cat = lookup().findVirtual(String.class, "concat", methodType(String.class, String.class));
         MethodType bigType = cat.type().insertParameterTypes(0, String.class, String.class, int.class);
@@ -82,17 +86,20 @@ public class DropArgumentsTest {
         };
     }
 
-    @Test(dataProvider = "dropArgumentsToMatchIAEData", expectedExceptions = { IllegalArgumentException.class })
+    @ParameterizedTest
+    @MethodSource("dropArgumentsToMatchIAEData")
     public void dropArgumentsToMatchIAE(MethodHandle target, int pos, List> valueType, int skip) {
-        MethodHandles.dropArgumentsToMatch(target, pos, valueType , skip);
+        assertThrows(IllegalArgumentException.class, () -> MethodHandles.dropArgumentsToMatch(target, pos, valueType, skip));
     }
 
-    @Test(expectedExceptions = { IllegalArgumentException.class })
+    @Test
     public void dropArgumentsToMatchTestWithVoid() throws Throwable {
         MethodHandle cat = lookup().findVirtual(String.class, "concat",
-                                   MethodType.methodType(String.class, String.class));
-        MethodType bigTypewithVoid = cat.type().insertParameterTypes(0, void.class, String.class, int.class);
-        MethodHandle handle2 = MethodHandles.dropArgumentsToMatch(cat, 0, bigTypewithVoid.parameterList(), 1);
+                MethodType.methodType(String.class, String.class));
+        List> bigTypewithVoid = new ArrayList<>(cat.type().parameterList());
+        bigTypewithVoid.addAll(0, List.of(void.class, String.class, int.class));
+        assertThrows(IllegalArgumentException.class, () ->
+                MethodHandles.dropArgumentsToMatch(cat, 0, bigTypewithVoid, 1));
     }
 
     public static class MethodSet {
diff --git a/test/jdk/java/lang/invoke/DropLookupModeTest.java b/test/jdk/java/lang/invoke/DropLookupModeTest.java
index 1a4c311be8b..7619793c3c6 100644
--- a/test/jdk/java/lang/invoke/DropLookupModeTest.java
+++ b/test/jdk/java/lang/invoke/DropLookupModeTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2019, 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
@@ -21,9 +21,9 @@
  * questions.
  */
 
-/**
+/*
  * @test
- * @run testng DropLookupModeTest
+ * @run junit DropLookupModeTest
  * @summary Basic unit tests Lookup::dropLookupMode
  */
 
@@ -31,83 +31,85 @@ import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodHandles.Lookup;
 import static java.lang.invoke.MethodHandles.Lookup.*;
 
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+import org.junit.jupiter.params.provider.ValueSource;
 
-@Test
 public class DropLookupModeTest {
 
     /**
      * Basic test of dropLookupMode
      */
+    @Test
     public void testBasic() {
         final Lookup fullPowerLookup = MethodHandles.lookup();
         final Class lc = fullPowerLookup.lookupClass();
-        assertTrue(fullPowerLookup.lookupModes() == (PUBLIC|MODULE|PACKAGE|PROTECTED|PRIVATE|ORIGINAL));
+        assertEquals(PUBLIC | MODULE | PACKAGE | PROTECTED | PRIVATE | ORIGINAL, fullPowerLookup.lookupModes());
 
         Lookup lookup = fullPowerLookup.dropLookupMode(PRIVATE);
-        assertTrue(lookup.lookupClass() == lc);
-        assertTrue(lookup.lookupModes() == (PUBLIC|MODULE|PACKAGE));
+        assertSame(lc, lookup.lookupClass());
+        assertEquals(PUBLIC | MODULE | PACKAGE, lookup.lookupModes());
 
         lookup = fullPowerLookup.dropLookupMode(PROTECTED);
-        assertTrue(lookup.lookupClass() == lc);
-        assertTrue(lookup.lookupModes() == (PUBLIC|MODULE|PACKAGE|PRIVATE));
+        assertSame(lc, lookup.lookupClass());
+        assertEquals(PUBLIC | MODULE | PACKAGE | PRIVATE, lookup.lookupModes());
 
         lookup = fullPowerLookup.dropLookupMode(PACKAGE);
-        assertTrue(lookup.lookupClass() == lc);
-        assertTrue(lookup.lookupModes() == (PUBLIC|MODULE));
+        assertSame(lc, lookup.lookupClass());
+        assertEquals(PUBLIC | MODULE, lookup.lookupModes());
 
         lookup = fullPowerLookup.dropLookupMode(MODULE);
-        assertTrue(lookup.lookupClass() == lc);
-        assertTrue(lookup.lookupModes() == (PUBLIC));
+        assertSame(lc, lookup.lookupClass());
+        assertEquals(PUBLIC, lookup.lookupModes());
 
         lookup = fullPowerLookup.dropLookupMode(PUBLIC);
-        assertTrue(lookup.lookupClass() == lc);
-        assertTrue(lookup.lookupModes() == 0);
+        assertSame(lc, lookup.lookupClass());
+        assertEquals(0, lookup.lookupModes());
 
         lookup = fullPowerLookup.dropLookupMode(UNCONDITIONAL);
-        assertTrue(lookup.lookupClass() == lc);
-        assertTrue(lookup.lookupModes() == (PUBLIC|MODULE|PACKAGE|PRIVATE));
+        assertSame(lc, lookup.lookupClass());
+        assertEquals(PUBLIC | MODULE | PACKAGE | PRIVATE, lookup.lookupModes());
     }
 
     /**
      * Starting with a full power Lookup, use dropLookupMode to create new Lookups
      * with reduced access.
      */
+    @Test
     public void testReducingAccess() {
         Lookup lookup = MethodHandles.lookup();
         final Class lc = lookup.lookupClass();
-        assertTrue(lookup.lookupModes() == (PUBLIC|MODULE|PACKAGE|PROTECTED|PRIVATE|ORIGINAL));
+        assertEquals(PUBLIC | MODULE | PACKAGE | PROTECTED | PRIVATE | ORIGINAL, lookup.lookupModes());
 
         lookup = lookup.dropLookupMode(PROTECTED);
-        assertTrue(lookup.lookupClass() == lc);
-        assertTrue(lookup.lookupModes() == (PUBLIC|MODULE|PACKAGE|PRIVATE));
+        assertSame(lc, lookup.lookupClass());
+        assertEquals(PUBLIC | MODULE | PACKAGE | PRIVATE, lookup.lookupModes());
 
         lookup = lookup.dropLookupMode(PRIVATE);
-        assertTrue(lookup.lookupClass() == lc);
-        assertTrue(lookup.lookupModes() == (PUBLIC|MODULE|PACKAGE));
+        assertSame(lc, lookup.lookupClass());
+        assertEquals(PUBLIC | MODULE | PACKAGE, lookup.lookupModes());
 
         lookup = lookup.dropLookupMode(PACKAGE);
-        assertTrue(lookup.lookupClass() == lc);
-        assertTrue(lookup.lookupModes() == (PUBLIC|MODULE));
+        assertSame(lc, lookup.lookupClass());
+        assertEquals(PUBLIC | MODULE, lookup.lookupModes());
 
         lookup = lookup.dropLookupMode(MODULE);
-        assertTrue(lookup.lookupClass() == lc);
-        assertTrue(lookup.lookupModes() == PUBLIC);
+        assertSame(lc, lookup.lookupClass());
+        assertEquals(PUBLIC, lookup.lookupModes());
 
         lookup = lookup.dropLookupMode(PUBLIC);
-        assertTrue(lookup.lookupClass() == lc);
-        assertTrue(lookup.lookupModes() == 0);
+        assertSame(lc, lookup.lookupClass());
+        assertEquals(0, lookup.lookupModes());
 
         // repeat with lookup has no access
         lookup = lookup.dropLookupMode(PUBLIC);
-        assertTrue(lookup.lookupClass() == lc);
-        assertTrue(lookup.lookupModes() == 0);
+        assertSame(lc, lookup.lookupClass());
+        assertEquals(0, lookup.lookupModes());
     }
 
-    @DataProvider(name = "unconditionals")
-    public Object[][] unconditionals() {
+    public static Object[][] unconditionals() {
         Lookup publicLookup = MethodHandles.publicLookup();
         return new Object[][] {
             { publicLookup, Object.class },
@@ -120,9 +122,10 @@ public class DropLookupModeTest {
      * Test dropLookupMode on the lookup with public lookup
      * and UNCONDITIONAL
      */
-    @Test(dataProvider = "unconditionals")
+    @ParameterizedTest
+    @MethodSource("unconditionals")
     public void testUnconditionalLookup(Lookup unconditionalLookup, Class expected) {
-        assertTrue(unconditionalLookup.lookupModes() == UNCONDITIONAL);
+        assertEquals(UNCONDITIONAL, unconditionalLookup.lookupModes());
 
         assertPublicLookup(unconditionalLookup.dropLookupMode(PRIVATE), expected);
         assertPublicLookup(unconditionalLookup.dropLookupMode(PROTECTED), expected);
@@ -132,31 +135,27 @@ public class DropLookupModeTest {
 
         // drop all access
         Lookup lookup = unconditionalLookup.dropLookupMode(UNCONDITIONAL);
-        assertTrue(lookup.lookupClass() == expected);
-        assertTrue(lookup.lookupModes() == 0);
+        assertSame(expected, lookup.lookupClass());
+        assertEquals(0, lookup.lookupModes());
     }
 
     private void assertPublicLookup(Lookup lookup, Class expected) {
-        assertTrue(lookup.lookupClass() == expected);
-        assertTrue(lookup.lookupModes() == UNCONDITIONAL);
-    }
-
-    @DataProvider(name = "badInput")
-    public Object[][] badInput() {
-        return new Object[][] {
-                { 0,                        null },
-                { (PACKAGE|PRIVATE),        null },    // two modes
-                { Integer.MAX_VALUE,        null },
-                { Integer.MIN_VALUE,        null },
-        };
+        assertSame(expected, lookup.lookupClass());
+        assertEquals(UNCONDITIONAL, lookup.lookupModes());
     }
 
     /**
      * Check that IllegalArgumentException is thrown for bad input
      */
-    @Test(dataProvider = "badInput", expectedExceptions = {IllegalArgumentException.class})
-    public void testBadInput(Integer modeToDrop, Object ignore) {
-        MethodHandles.lookup().dropLookupMode(modeToDrop);
+    @ParameterizedTest
+    @ValueSource(ints = {
+            0,
+            (PACKAGE|PRIVATE),    // two modes
+            Integer.MAX_VALUE,
+            Integer.MIN_VALUE,
+    })
+    public void testBadInput(int modeToDrop) {
+        assertThrows(IllegalArgumentException.class, () -> MethodHandles.lookup().dropLookupMode(modeToDrop));
     }
 
 }
diff --git a/test/jdk/java/lang/invoke/FilterArgumentsTest.java b/test/jdk/java/lang/invoke/FilterArgumentsTest.java
index 3c4884e7c6a..2326799cc1c 100644
--- a/test/jdk/java/lang/invoke/FilterArgumentsTest.java
+++ b/test/jdk/java/lang/invoke/FilterArgumentsTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2019, 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
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 8194554
- * @run testng/othervm test.java.lang.invoke.FilterArgumentsTest
+ * @run junit/othervm test.java.lang.invoke.FilterArgumentsTest
  */
 
 package test.java.lang.invoke;
@@ -37,40 +37,40 @@ import java.util.List;
 import static java.lang.invoke.MethodHandles.*;
 import static java.lang.invoke.MethodType.methodType;
 
-import org.testng.annotations.*;
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Test;
 
 public class FilterArgumentsTest {
 
     @Test
-    public static void testFilterA_B_C() throws Throwable {
+    public void testFilterA_B_C() throws Throwable {
         FilterTest test = new FilterTest(
             filterArguments(MH_TEST, 0, MH_FILTER_A, MH_FILTER_B, MH_FILTER_C));
         test.run(List.of("A", "B", "C"));
     }
 
     @Test
-    public static void testFilterA_B() throws Throwable {
+    public void testFilterA_B() throws Throwable {
         FilterTest test = new FilterTest(
             filterArguments(MH_TEST, 0, MH_FILTER_A, MH_FILTER_B));
         test.run(List.of("A", "B"));
     }
 
     @Test
-    public static void testFilterB_C() throws Throwable {
+    public void testFilterB_C() throws Throwable {
         FilterTest test = new FilterTest(
             filterArguments(MH_TEST, 1, MH_FILTER_B, MH_FILTER_C));
         test.run(List.of("B", "C"));
     }
 
     @Test
-    public static void testFilterB() throws Throwable {
+    public void testFilterB() throws Throwable {
         FilterTest test = new FilterTest(filterArguments(MH_TEST, 1, MH_FILTER_B));
         test.run(List.of("B"));
     }
 
     @Test
-    public static void testFilterC() throws Throwable {
+    public void testFilterC() throws Throwable {
         FilterTest test = new FilterTest(filterArguments(MH_TEST, 2, MH_FILTER_C));
         test.run(List.of("C"));
     }
@@ -85,8 +85,8 @@ public class FilterArgumentsTest {
 
         void run(List expected) throws Throwable {
             filters.clear();
-            assertEquals((String)mh.invokeExact("x", 0, 'z'), "x-0-z");
-            assertEquals(filters, expected);
+            assertEquals("x-0-z", (String)mh.invokeExact("x", 0, 'z'));
+            assertEquals(expected, filters);
         }
 
         static String filterA(String s) {
diff --git a/test/jdk/java/lang/invoke/FindAccessTest.java b/test/jdk/java/lang/invoke/FindAccessTest.java
index f8602ee22bd..3bcff4f5324 100644
--- a/test/jdk/java/lang/invoke/FindAccessTest.java
+++ b/test/jdk/java/lang/invoke/FindAccessTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, 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,7 +23,7 @@
 
 /* @test
  * @bug 8139885
- * @run testng/othervm -ea -esa test.java.lang.invoke.FindAccessTest
+ * @run junit/othervm -ea -esa test.java.lang.invoke.FindAccessTest
  */
 
 package test.java.lang.invoke;
@@ -33,9 +33,10 @@ import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodHandles.Lookup;
 import java.lang.invoke.MethodType;
 
-import static org.testng.AssertJUnit.*;
+import org.junit.jupiter.api.Test;
 
-import org.testng.annotations.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 /**
  * Tests for Lookup.findClass/accessClass extensions added in JEP 274.
@@ -45,7 +46,7 @@ public class FindAccessTest {
     static final Lookup LOOKUP = MethodHandles.lookup();
 
     @Test
-    public static void testFindSpecial() throws Throwable {
+    public void testFindSpecial() throws Throwable {
         FindSpecial.C c = new FindSpecial.C();
         assertEquals("I1.m", c.m());
         MethodType t = MethodType.methodType(String.class);
@@ -54,25 +55,18 @@ public class FindAccessTest {
     }
 
     @Test
-    public static void testFindSpecialAbstract() throws Throwable {
+    public void testFindSpecialAbstract() throws Throwable {
         FindSpecial.C c = new FindSpecial.C();
         assertEquals("q", c.q());
         MethodType t = MethodType.methodType(String.class);
-        boolean caught = false;
-        try {
-            MethodHandle ci3q = LOOKUP.findSpecial(FindSpecial.I3.class, "q", t, FindSpecial.C.class);
-        } catch (Throwable thrown) {
-            if (!(thrown instanceof IllegalAccessException) || !FindSpecial.ABSTRACT_ERROR.equals(thrown.getMessage())) {
-                throw new AssertionError(thrown.getMessage(), thrown);
-            }
-            caught = true;
-        }
-        assertTrue(caught);
+        var thrown = assertThrows(IllegalAccessException.class,
+                () -> LOOKUP.findSpecial(FindSpecial.I3.class, "q", t, FindSpecial.C.class));
+        assertEquals(FindSpecial.ABSTRACT_ERROR, thrown.getMessage());
     }
 
-    @Test(expectedExceptions = {ClassNotFoundException.class})
-    public static void testFindClassCNFE() throws ClassNotFoundException, IllegalAccessException {
-        LOOKUP.findClass("does.not.Exist");
+    @Test
+    public void testFindClassCNFE() throws ClassNotFoundException, IllegalAccessException {
+        assertThrows(ClassNotFoundException.class, () -> LOOKUP.findClass("does.not.Exist"));
     }
 
     static class FindSpecial {
diff --git a/test/jdk/java/lang/invoke/FoldTest.java b/test/jdk/java/lang/invoke/FoldTest.java
index 157cfbffe2e..92ba246ebc8 100644
--- a/test/jdk/java/lang/invoke/FoldTest.java
+++ b/test/jdk/java/lang/invoke/FoldTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, 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,7 +23,7 @@
 
 /* @test
  * @bug 8139885
- * @run testng/othervm -ea -esa test.java.lang.invoke.FoldTest
+ * @run junit/othervm -ea -esa test.java.lang.invoke.FoldTest
  */
 
 package test.java.lang.invoke;
@@ -36,9 +36,9 @@ import java.lang.invoke.MethodType;
 
 import static java.lang.invoke.MethodType.methodType;
 
-import static org.testng.AssertJUnit.*;
+import org.junit.jupiter.api.Test;
 
-import org.testng.annotations.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 /**
  * Tests for the new fold method handle combinator added in JEP 274.
@@ -48,7 +48,7 @@ public class FoldTest {
     static final Lookup LOOKUP = MethodHandles.lookup();
 
     @Test
-    public static void testFold0a() throws Throwable {
+    public void testFold0a() throws Throwable {
         // equivalence to foldArguments(MethodHandle,MethodHandle)
         MethodHandle fold = MethodHandles.foldArguments(Fold.MH_multer, 0, Fold.MH_adder);
         assertEquals(Fold.MT_folded1, fold.type());
@@ -56,7 +56,7 @@ public class FoldTest {
     }
 
     @Test
-    public static void testFold1a() throws Throwable {
+    public void testFold1a() throws Throwable {
         // test foldArguments for folding position 1
         MethodHandle fold = MethodHandles.foldArguments(Fold.MH_multer, 1, Fold.MH_adder1);
         assertEquals(Fold.MT_folded1, fold.type());
@@ -64,7 +64,7 @@ public class FoldTest {
     }
 
     @Test
-    public static void testFold0b() throws Throwable {
+    public void testFold0b() throws Throwable {
         // test foldArguments equivalence with multiple types
         MethodHandle fold = MethodHandles.foldArguments(Fold.MH_str, 0, Fold.MH_comb);
         assertEquals(Fold.MT_folded2, fold.type());
@@ -72,7 +72,7 @@ public class FoldTest {
     }
 
     @Test
-    public static void testFold1b() throws Throwable {
+    public void testFold1b() throws Throwable {
         // test folgArguments for folding position 1, with multiple types
         MethodHandle fold = MethodHandles.foldArguments(Fold.MH_str, 1, Fold.MH_comb2);
         assertEquals(Fold.MT_folded3, fold.type());
@@ -81,7 +81,7 @@ public class FoldTest {
     }
 
     @Test
-    public static void testFoldArgumentsExample() throws Throwable {
+    public void testFoldArgumentsExample() throws Throwable {
         // test the JavaDoc foldArguments-with-pos example
         StringWriter swr = new StringWriter();
         MethodHandle trace = LOOKUP.findVirtual(StringWriter.class, "write", methodType(void.class, String.class)).bindTo(swr);
diff --git a/test/jdk/java/lang/invoke/InvokeGenericTest.java b/test/jdk/java/lang/invoke/InvokeGenericTest.java
index ef201caead1..0be810506de 100644
--- a/test/jdk/java/lang/invoke/InvokeGenericTest.java
+++ b/test/jdk/java/lang/invoke/InvokeGenericTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2026, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
 /* @test
  * @summary unit tests for java.lang.invoke.MethodHandle.invoke
  * @compile InvokeGenericTest.java
- * @run testng/othervm test.java.lang.invoke.InvokeGenericTest
+ * @run junit/othervm test.java.lang.invoke.InvokeGenericTest
  */
 
 package test.java.lang.invoke;
@@ -34,9 +34,13 @@ import static java.lang.invoke.MethodHandles.*;
 import static java.lang.invoke.MethodType.*;
 import java.lang.reflect.*;
 import java.util.*;
-import org.testng.*;
-import static org.testng.AssertJUnit.*;
-import org.testng.annotations.*;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
 
 /**
  *
@@ -68,7 +72,7 @@ public class InvokeGenericTest {
     String testName;
     static int allPosTests, allNegTests;
     int posTests, negTests;
-    @AfterMethod
+    @AfterEach
     public void printCounts() {
         if (verbosity >= 2 && (posTests | negTests) != 0) {
             System.out.println();
@@ -92,14 +96,14 @@ public class InvokeGenericTest {
         testName = name;
     }
 
-    @BeforeClass
+    @BeforeAll
     public static void setUpClass() throws Exception {
         calledLog.clear();
         calledLog.add(null);
         nextArgVal = INITIAL_ARG_VAL;
     }
 
-    @AfterClass
+    @AfterAll
     public static void tearDownClass() throws Exception {
         int posTests = allPosTests, negTests = allNegTests;
         if (verbosity >= 2 && (posTests | negTests) != 0) {
@@ -127,7 +131,7 @@ public class InvokeGenericTest {
         System.out.println("actual:     "+actual);
         System.out.println("ex. types:  "+getClasses(expected));
         System.out.println("act. types: "+getClasses(actual));
-        assertEquals("previous method call", expected, actual);
+        assertEquals(expected, actual, "previous method call");
     }
     static void printCalled(MethodHandle target, String name, Object... args) {
         if (verbosity >= 3)
@@ -389,8 +393,7 @@ public class InvokeGenericTest {
     }
     public void testWrongArgumentCount(List> expect, List> observe) throws Throwable {
         countTest(false);
-        if (expect.equals(observe))
-            assert(false);
+        assertNotEquals(expect, observe);
         MethodHandle target = callable(expect);
         Object[] args = zeroArgs(observe);
         Object junk;
@@ -473,28 +476,25 @@ public class InvokeGenericTest {
         mh = MethodHandles.filterReturnValue(mh, toString_MH);
         mh = mh.asType(type);
         Object res = null;
-        if (nargs == 2) {
-            res = mh.invoke((Object)args[0], (Object)args[1]);
-            assertEquals(expectString, res);
-            res = mh.invoke((String)args[0], (Object)args[1]);
-            assertEquals(expectString, res);
-            res = mh.invoke((Object)args[0], (String)args[1]);
-            assertEquals(expectString, res);
-            res = mh.invoke((String)args[0], (String)args[1]);
-            assertEquals(expectString, res);
-            res = mh.invoke((String)args[0], (CharSequence)args[1]);
-            assertEquals(expectString, res);
-            res = mh.invoke((CharSequence)args[0], (Object)args[1]);
-            assertEquals(expectString, res);
-            res = (String) mh.invoke((Object)args[0], (Object)args[1]);
-            assertEquals(expectString, res);
-            res = (String) mh.invoke((String)args[0], (Object)args[1]);
-            assertEquals(expectString, res);
-            res = (CharSequence) mh.invoke((String)args[0], (Object)args[1]);
-            assertEquals(expectString, res);
-        } else {
-            assert(false);  // write this code
-        }
+        assertEquals(2, nargs);
+        res = mh.invoke((Object)args[0], (Object)args[1]);
+        assertEquals(expectString, res);
+        res = mh.invoke((String)args[0], (Object)args[1]);
+        assertEquals(expectString, res);
+        res = mh.invoke((Object)args[0], (String)args[1]);
+        assertEquals(expectString, res);
+        res = mh.invoke((String)args[0], (String)args[1]);
+        assertEquals(expectString, res);
+        res = mh.invoke((String)args[0], (CharSequence)args[1]);
+        assertEquals(expectString, res);
+        res = mh.invoke((CharSequence)args[0], (Object)args[1]);
+        assertEquals(expectString, res);
+        res = (String) mh.invoke((Object)args[0], (Object)args[1]);
+        assertEquals(expectString, res);
+        res = (String) mh.invoke((String)args[0], (Object)args[1]);
+        assertEquals(expectString, res);
+        res = (CharSequence) mh.invoke((String)args[0], (Object)args[1]);
+        assertEquals(expectString, res);
         //System.out.println(res);
     }
 
diff --git a/test/jdk/java/lang/invoke/InvokeMethodHandleWithBadArgument.java b/test/jdk/java/lang/invoke/InvokeMethodHandleWithBadArgument.java
index 2479c22b2f4..f2749cfb164 100644
--- a/test/jdk/java/lang/invoke/InvokeMethodHandleWithBadArgument.java
+++ b/test/jdk/java/lang/invoke/InvokeMethodHandleWithBadArgument.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 8157246
  * @summary Tests invocation of MethodHandle with invalid leading argument
- * @run testng/othervm test.java.lang.invoke.InvokeMethodHandleWithBadArgument
+ * @run junit/othervm test.java.lang.invoke.InvokeMethodHandleWithBadArgument
  */
 
 package test.java.lang.invoke;
@@ -38,9 +38,9 @@ import java.lang.invoke.VarHandle;
 
 import static java.lang.invoke.MethodType.methodType;
 
-import static org.testng.AssertJUnit.*;
+import org.junit.jupiter.api.Test;
 
-import org.testng.annotations.*;
+import static org.junit.jupiter.api.Assertions.*;
 
 /**
  * Tests invocation of MethodHandle with invalid leading argument such as
@@ -49,86 +49,100 @@ import org.testng.annotations.*;
 public class InvokeMethodHandleWithBadArgument {
     // ---- null array reference ----
 
-    @Test(expectedExceptions = {NullPointerException.class})
-    public static void testAsSpreaderPosInvokeWithNull() throws Throwable {
+    @Test
+    public void testAsSpreaderPosInvokeWithNull() throws Throwable {
         MethodHandle spreader = MH_spread.asSpreader(1, int[].class, 3);
-        spreader.invoke("A", null, "B");
+        assertThrows(NullPointerException.class, () -> spreader.invoke("A", null, "B"));
     }
 
-    @Test(expectedExceptions = {NullPointerException.class})
-    public static void testAsSpreaderInvokeWithNull() throws Throwable {
+    @Test
+    public void testAsSpreaderInvokeWithNull() throws Throwable {
         MethodHandle spreader = MH_String_equals.asSpreader(String[].class, 2);
-        assert ((boolean) spreader.invokeExact(new String[]{"me", "me"}));
-        boolean eq = (boolean) spreader.invokeExact((String[]) null);
+        assertTrue((boolean) spreader.invokeExact(new String[]{"me", "me"}));
+        assertThrows(NullPointerException.class, () -> {
+            boolean eq = (boolean) spreader.invokeExact((String[]) null);
+        });
     }
 
     // ---- incorrect array element count ----
-    @Test(expectedExceptions = {IllegalArgumentException.class})
-    public static void testAsSpreaderPosInvokeWithBadElementCount() throws Throwable {
+    @Test
+    public void testAsSpreaderPosInvokeWithBadElementCount() throws Throwable {
         MethodHandle spreader = MH_spread.asSpreader(1, int[].class, 3);
-        spreader.invoke("A", new int[]{1, 2}, "B");
+        assertThrows(IllegalArgumentException.class, () -> spreader.invoke("A", new int[]{1, 2}, "B"));
     }
 
-    @Test(expectedExceptions = {IllegalArgumentException.class})
-    public static void testAsSpreaderInvokeWithBadElementCount() throws Throwable {
+    @Test
+    public void testAsSpreaderInvokeWithBadElementCount() throws Throwable {
         MethodHandle spreader = MH_String_equals.asSpreader(String[].class, 2);
-        assert (!(boolean) spreader.invokeExact(new String[]{"me", "thee"}));
-        boolean eq = (boolean) spreader.invokeExact(new String[0]);
+        assertFalse((boolean) spreader.invokeExact(new String[]{"me", "thee"}));
+        assertThrows(IllegalArgumentException.class, () -> {
+            boolean eq = (boolean) spreader.invokeExact(new String[0]);
+        });
     }
 
     // ---- spread no argument ----
     @Test
-    public static void testAsSpreaderPosInvokeWithZeroLength() throws Throwable {
+    public void testAsSpreaderPosInvokeWithZeroLength() throws Throwable {
         MethodHandle spreader = MH_spread.asSpreader(1, int[].class, 0);
-        assert("A123B".equals(spreader.invoke("A", (int[])null, 1, 2, 3, "B")));
+        assertEquals("A123B", spreader.invoke("A", (int[]) null, 1, 2, 3, "B"));
     }
 
     @Test
-    public static void testAsSpreaderInvokeWithZeroLength() throws Throwable {
+    public void testAsSpreaderInvokeWithZeroLength() throws Throwable {
         MethodHandle spreader = MH_String_equals.asSpreader(String[].class, 0);
-        assert ((boolean) spreader.invokeExact("me", (Object)"me", new String[0]));
+        assertTrue((boolean) spreader.invokeExact("me", (Object)"me", new String[0]));
         boolean eq = (boolean) spreader.invokeExact("me", (Object)"me", (String[]) null);
     }
 
     // ---- invokers with null method/var handle argument ----
-    @Test(expectedExceptions = {NullPointerException.class})
-    public static void testInvokerWithNull() throws Throwable {
+    @Test
+    public void testInvokerWithNull() throws Throwable {
         MethodType type = methodType(int.class, int.class, int.class);
         MethodHandle invoker = MethodHandles.invoker(type);
-        assert((int) invoker.invoke(MH_add, 1, 2) == 3);
-        int sum = (int)invoker.invoke((MethodHandle)null, 1, 2);
+        assertEquals(3, (int) invoker.invoke(MH_add, 1, 2));
+        assertThrows(NullPointerException.class, () -> {
+            int sum = (int)invoker.invoke((MethodHandle)null, 1, 2);
+        });
     }
 
-    @Test(expectedExceptions = {NullPointerException.class})
-    public static void testExactInvokerWithNull() throws Throwable {
+    @Test
+    public void testExactInvokerWithNull() throws Throwable {
         MethodType type = methodType(int.class, int.class, int.class);
         MethodHandle invoker = MethodHandles.exactInvoker(type);
-        assert((int) invoker.invoke(MH_add, 1, 2) == 3);
-        int sum = (int)invoker.invokeExact((MethodHandle)null, 1, 2);
+        assertEquals(3, (int) invoker.invoke(MH_add, 1, 2));
+        assertThrows(NullPointerException.class, () -> {
+            int sum = (int)invoker.invokeExact((MethodHandle)null, 1, 2);
+        });
     }
 
-    @Test(expectedExceptions = {NullPointerException.class})
-    public static void testSpreadInvokerWithNull() throws Throwable {
+    @Test
+    public void testSpreadInvokerWithNull() throws Throwable {
         MethodType type = methodType(boolean.class, String.class, String.class);
         MethodHandle invoker = MethodHandles.spreadInvoker(type, 0);
-        assert ((boolean) invoker.invoke(MH_String_equals, new String[]{"me", "me"}));
-        boolean eq = (boolean) invoker.invoke((MethodHandle)null, new String[]{"me", "me"});
+        assertTrue((boolean) invoker.invoke(MH_String_equals, new String[]{"me", "me"}));
+        assertThrows(NullPointerException.class, () -> {
+            boolean eq = (boolean) invoker.invoke((MethodHandle)null, new String[]{"me", "me"});
+        });
     }
 
-    @Test(expectedExceptions = {NullPointerException.class})
-    public static void testVarHandleInvokerWithNull() throws Throwable {
+    @Test
+    public void testVarHandleInvokerWithNull() throws Throwable {
         VarHandle.AccessMode am = VarHandle.AccessMode.GET;
         MethodHandle invoker = MethodHandles.varHandleInvoker(am, VH_array.accessModeType(am));
-        assert ((int) invoker.invoke(VH_array, array, 3) == 3);
-        int value = (int)invoker.invoke((VarHandle)null, array, 3);
+        assertEquals(3, (int) invoker.invoke(VH_array, array, 3));
+        assertThrows(NullPointerException.class, () -> {
+            int value = (int)invoker.invoke((VarHandle)null, array, 3);
+        });
     }
 
-    @Test(expectedExceptions = {NullPointerException.class})
-    public static void testVarHandleExactInvokerWithNull() throws Throwable {
+    @Test
+    public void testVarHandleExactInvokerWithNull() throws Throwable {
         VarHandle.AccessMode am = VarHandle.AccessMode.GET;
         MethodHandle invoker = MethodHandles.varHandleExactInvoker(am, VH_array.accessModeType(am));
-        assert ((int) invoker.invoke(VH_array, array, 3) == 3);
-        int value = (int)invoker.invokeExact((VarHandle)null, array, 3);
+        assertEquals(3, (int) invoker.invoke(VH_array, array, 3));
+        assertThrows(NullPointerException.class, () -> {
+            int value = (int)invoker.invokeExact((VarHandle)null, array, 3);
+        });
     }
 
     static final Lookup LOOKUP = MethodHandles.lookup();
diff --git a/test/jdk/java/lang/invoke/InvokeWithArgumentsTest.java b/test/jdk/java/lang/invoke/InvokeWithArgumentsTest.java
index 63a2101bd67..3a705aca699 100644
--- a/test/jdk/java/lang/invoke/InvokeWithArgumentsTest.java
+++ b/test/jdk/java/lang/invoke/InvokeWithArgumentsTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 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
@@ -23,19 +23,19 @@
 
 /* @test
  * @summary basic tests for MethodHandle.invokeWithArguments
- * @run testng test.java.lang.invoke.InvokeWithArgumentsTest
+ * @run junit test.java.lang.invoke.InvokeWithArgumentsTest
  */
 
 package test.java.lang.invoke;
 
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.WrongMethodTypeException;
 
 import static java.lang.invoke.MethodType.methodType;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
 
 public class InvokeWithArgumentsTest {
     static final MethodHandles.Lookup L = MethodHandles.lookup();
@@ -49,10 +49,7 @@ public class InvokeWithArgumentsTest {
         MethodHandle mh = L.findStatic(L.lookupClass(), "arity",
                                        methodType(Object[].class, Object.class, Object.class, Object[].class));
 
-        try {
-            mh.invokeWithArguments("");
-            Assert.fail("WrongMethodTypeException expected");
-        } catch (WrongMethodTypeException e) {}
+        assertThrows(WrongMethodTypeException.class, () -> mh.invokeWithArguments(""));
     }
 
     static Object[] passThrough(String... a) {
@@ -72,10 +69,10 @@ public class InvokeWithArgumentsTest {
 
         // Note: the actual array is not preserved, the elements will be
         // unpacked and then packed into a new array before invoking the method
-        String[] expected = (String[]) mh.invokeWithArguments(actual);
+        String[] result = (String[]) mh.invokeWithArguments(actual);
 
-        Assert.assertTrue(actual != expected, "Array should not pass through");
-        Assert.assertEquals(actual, expected, "Array contents should be equal");
+        assertNotSame(actual, result, "Array should not pass through");
+        assertArrayEquals(actual, result, "Array contents should be equal");
     }
 
     @Test
@@ -89,8 +86,8 @@ public class InvokeWithArgumentsTest {
         // will cast to Object become the single element of a new Object[] array
         Object[] expected = (Object[]) mh.invokeWithArguments("", actual);
 
-        Assert.assertEquals(1, expected.length, "Array should contain just one element");
-        Assert.assertTrue(actual == expected[0], "Array should pass through");
+        assertEquals(1, expected.length, "Array should contain just one element");
+        assertSame(actual, expected[0], "Array should pass through");
     }
 
     static void intArray(int... a) {
@@ -100,20 +97,14 @@ public class InvokeWithArgumentsTest {
     public void testPrimitiveArrayWithNull() throws Throwable {
         MethodHandle mh = L.findStatic(L.lookupClass(), "intArray",
                                        methodType(void.class, int[].class));
-        try {
-            mh.invokeWithArguments(null, null);
-            Assert.fail("NullPointerException expected");
-        } catch (NullPointerException e) {}
+        assertThrows(NullPointerException.class, () -> mh.invokeWithArguments(null, null));
     }
 
     @Test
     public void testPrimitiveArrayWithRef() throws Throwable {
         MethodHandle mh = L.findStatic(L.lookupClass(), "intArray",
                                        methodType(void.class, int[].class));
-        try {
-            mh.invokeWithArguments("A", "B");
-            Assert.fail("ClassCastException expected");
-        } catch (ClassCastException e) {}
+        assertThrows(ClassCastException.class, () -> mh.invokeWithArguments("A", "B"));
     }
 
 
@@ -127,9 +118,6 @@ public class InvokeWithArgumentsTest {
         // All numbers, should not throw
         mh.invokeWithArguments(1, 1.0, 1.0F, 1L);
 
-        try {
-            mh.invokeWithArguments("A");
-            Assert.fail("ClassCastException expected");
-        } catch (ClassCastException e) {}
+        assertThrows(ClassCastException.class, () -> mh.invokeWithArguments("A"));
     }
 }
diff --git a/test/jdk/java/lang/invoke/JavaDocExamplesTest.java b/test/jdk/java/lang/invoke/JavaDocExamplesTest.java
index 53257d9876d..0fa2614c83f 100644
--- a/test/jdk/java/lang/invoke/JavaDocExamplesTest.java
+++ b/test/jdk/java/lang/invoke/JavaDocExamplesTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
 /* @test
  * @summary example code used in javadoc for java.lang.invoke API
  * @compile JavaDocExamplesTest.java
- * @run testng/othervm test.java.lang.invoke.JavaDocExamplesTest
+ * @run junit/othervm test.java.lang.invoke.JavaDocExamplesTest
  */
 
 package test.java.lang.invoke;
@@ -36,8 +36,8 @@ import static java.lang.invoke.MethodType.*;
 
 import java.util.*;
 
-import org.testng.*;
-import org.testng.annotations.*;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
 
 /**
  * @author jrose
@@ -350,14 +350,14 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
     static void assertEquals(Object exp, Object act) {
         if (verbosity > 0)
             System.out.println("result: "+act);
-        Assert.assertEquals(exp, act);
+        Assertions.assertEquals(exp, act);
     }
 
     static void assertTrue(boolean b) {
         if (verbosity > 0) {
             System.out.println("result: " + b);
         }
-        Assert.assertTrue(b);
+        Assertions.assertTrue(b);
     }
 
     @Test public void testMethodHandlesSummary() throws Throwable {
diff --git a/test/jdk/java/lang/invoke/JavaUtilConcurrentLookupTest.java b/test/jdk/java/lang/invoke/JavaUtilConcurrentLookupTest.java
index 9715de8fd46..a9a6861bc05 100644
--- a/test/jdk/java/lang/invoke/JavaUtilConcurrentLookupTest.java
+++ b/test/jdk/java/lang/invoke/JavaUtilConcurrentLookupTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,12 +25,11 @@
  * @summary Tests that Lookup can be produced from classes under java.util.concurrent
  * @bug 8154447
  * @compile/module=java.base java/util/concurrent/LookupTester.java
- * @run testng/othervm JavaUtilConcurrentLookupTest
+ * @run junit/othervm JavaUtilConcurrentLookupTest
  */
 
-import org.testng.annotations.Test;
-
 import java.util.concurrent.LookupTester;
+import org.junit.jupiter.api.Test;
 
 public class JavaUtilConcurrentLookupTest {
 
diff --git a/test/jdk/java/lang/invoke/LoopCombinatorTest.java b/test/jdk/java/lang/invoke/LoopCombinatorTest.java
index 15fb9d320a3..91a752f2666 100644
--- a/test/jdk/java/lang/invoke/LoopCombinatorTest.java
+++ b/test/jdk/java/lang/invoke/LoopCombinatorTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, 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
@@ -32,7 +32,7 @@
  * @bug 8154751
  * @bug 8154754
  * @bug 8167974
- * @run testng/othervm -ea -esa test.java.lang.invoke.LoopCombinatorTest
+ * @run junit/othervm -ea -esa test.java.lang.invoke.LoopCombinatorTest
  */
 
 package test.java.lang.invoke;
@@ -45,9 +45,12 @@ import java.util.*;
 
 import static java.lang.invoke.MethodType.methodType;
 
-import static org.testng.AssertJUnit.*;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
-import org.testng.annotations.*;
+import static org.junit.jupiter.api.Assertions.*;
 
 /**
  * Tests for the loop combinators introduced in JEP 274.
@@ -57,7 +60,7 @@ public class LoopCombinatorTest {
     static final Lookup LOOKUP = MethodHandles.lookup();
 
     @Test
-    public static void testLoopFac() throws Throwable {
+    public void testLoopFac() throws Throwable {
         MethodHandle[] counterClause = new MethodHandle[]{Fac.MH_zero, Fac.MH_inc};
         MethodHandle[] accumulatorClause = new MethodHandle[]{Fac.MH_one, Fac.MH_mult, Fac.MH_pred, Fac.MH_fin};
         MethodHandle loop = MethodHandles.loop(counterClause, accumulatorClause);
@@ -66,7 +69,7 @@ public class LoopCombinatorTest {
     }
 
     @Test
-    public static void testLoopFacNullInit() throws Throwable {
+    public void testLoopFacNullInit() throws Throwable {
         // null initializer for counter, should initialize to 0
         MethodHandle[] counterClause = new MethodHandle[]{null, Fac.MH_inc};
         MethodHandle[] accumulatorClause = new MethodHandle[]{Fac.MH_one, Fac.MH_mult, Fac.MH_pred, Fac.MH_fin};
@@ -76,7 +79,7 @@ public class LoopCombinatorTest {
     }
 
     @Test
-    public static void testLoopNullInit() throws Throwable {
+    public void testLoopNullInit() throws Throwable {
         // null initializer for counter, should initialize to 0, one-clause loop
         MethodHandle[] counterClause = new MethodHandle[]{null, Loop.MH_inc, Loop.MH_pred, Loop.MH_fin};
         MethodHandle loop = MethodHandles.loop(counterClause);
@@ -85,7 +88,7 @@ public class LoopCombinatorTest {
     }
 
     @Test
-    public static void testLoopVoid1() throws Throwable {
+    public void testLoopVoid1() throws Throwable {
         // construct a post-checked loop that only does one iteration and has a void body and void local state
         MethodHandle loop = MethodHandles.loop(new MethodHandle[]{Empty.MH_f, Empty.MH_f, Empty.MH_pred, null});
         assertEquals(MethodType.methodType(void.class), loop.type());
@@ -93,7 +96,7 @@ public class LoopCombinatorTest {
     }
 
     @Test
-    public static void testLoopVoid2() throws Throwable {
+    public void testLoopVoid2() throws Throwable {
         // construct a post-checked loop that only does one iteration and has a void body and void local state,
         // initialized implicitly from the step type
         MethodHandle loop = MethodHandles.loop(new MethodHandle[]{null, Empty.MH_f, Empty.MH_pred, null});
@@ -102,7 +105,7 @@ public class LoopCombinatorTest {
     }
 
     @Test
-    public static void testLoopVoid3() throws Throwable {
+    public void testLoopVoid3() throws Throwable {
         // construct a post-checked loop that only does one iteration and has a void body and void local state,
         // and that has a void finalizer
         MethodHandle loop = MethodHandles.loop(new MethodHandle[]{null, Empty.MH_f, Empty.MH_pred, Empty.MH_f});
@@ -111,7 +114,7 @@ public class LoopCombinatorTest {
     }
 
     @Test
-    public static void testLoopFacWithVoidState() throws Throwable {
+    public void testLoopFacWithVoidState() throws Throwable {
         // like testLoopFac, but with additional void state that outputs a dot
         MethodHandle[] counterClause = new MethodHandle[]{Fac.MH_zero, Fac.MH_inc};
         MethodHandle[] accumulatorClause = new MethodHandle[]{Fac.MH_one, Fac.MH_mult, Fac.MH_pred, Fac.MH_fin};
@@ -122,7 +125,7 @@ public class LoopCombinatorTest {
     }
 
     @Test
-    public static void testLoopVoidInt() throws Throwable {
+    public void testLoopVoidInt() throws Throwable {
         // construct a post-checked loop that only does one iteration and has a void body and void local state,
         // and that returns a constant
         MethodHandle loop = MethodHandles.loop(new MethodHandle[]{null, Empty.MH_f, Empty.MH_pred, Empty.MH_c});
@@ -131,7 +134,7 @@ public class LoopCombinatorTest {
     }
 
     @Test
-    public static void testLoopWithVirtuals() throws Throwable {
+    public void testLoopWithVirtuals() throws Throwable {
         // construct a loop (to calculate factorial) that uses a mix of static and virtual methods
         MethodHandle[] counterClause = new MethodHandle[]{null, LoopWithVirtuals.permute(LoopWithVirtuals.MH_inc)};
         MethodHandle[] accumulatorClause = new MethodHandle[]{
@@ -147,7 +150,7 @@ public class LoopCombinatorTest {
     }
 
     @Test
-    public static void testLoopOmitPred() throws Throwable {
+    public void testLoopOmitPred() throws Throwable {
         // construct a loop to calculate factorial that omits a predicate
         MethodHandle[] counterClause = new MethodHandle[]{null, Fac.MH_inc, null, Fac.MH_fin};
         MethodHandle[] accumulatorClause = new MethodHandle[]{Fac.MH_one, Fac.MH_mult, Fac.MH_pred, Fac.MH_fin};
@@ -156,7 +159,6 @@ public class LoopCombinatorTest {
         assertEquals(120, loop.invoke(5));
     }
 
-    @DataProvider
     static Object[][] negativeTestData() {
         MethodHandle i0 = MethodHandles.constant(int.class, 0);
         MethodHandle ii = MethodHandles.dropArguments(i0, 0, int.class, int.class);
@@ -214,36 +216,36 @@ public class LoopCombinatorTest {
         }
     }
 
-    @Test(dataProvider = "negativeTestData")
-    public static void testLoopNegative(MethodHandle[][] clauses, String expectedMessage) throws Throwable {
-        boolean caught = false;
-        try {
-            MH_loop.invokeWithArguments((Object[]) clauses);
-        } catch (IllegalArgumentException iae) {
-            assertEquals(expectedMessage, iae.getMessage());
-            caught = true;
-        }
-        assertTrue(caught);
+    @ParameterizedTest
+    @MethodSource("negativeTestData")
+    public void testLoopNegative(MethodHandle[][] clauses, String expectedMessage) throws Throwable {
+        var iae = assertThrows(IllegalArgumentException.class, () -> MH_loop.invokeWithArguments((Object[]) clauses));
+        assertEquals(expectedMessage, iae.getMessage());
     }
 
-    @Test(dataProvider = "whileLoopTestData")
-    public static void testWhileLoop(MethodHandle MH_zero,
-                                     MethodHandle MH_pred,
-                                     MethodHandle MH_step,
-                                     String messageOrNull) throws Throwable {
+    @ParameterizedTest
+    @MethodSource("whileLoopPassData")
+    public void testWhileLoop(MethodHandle MH_zero,
+                              MethodHandle MH_pred,
+                              MethodHandle MH_step) throws Throwable {
         // int i = 0; while (i < limit) { ++i; } return i; => limit
-        try {
-            MethodHandle loop = MethodHandles.whileLoop(MH_zero, MH_pred, MH_step);
-            assert messageOrNull == null;
-            if (MH_step.type().equals(While.MH_step.type()))
-                assertEquals(While.MT_while, loop.type());
-            assertEquals(MH_step.type().dropParameterTypes(0, 1), loop.type());
-            while (loop.type().parameterCount() > 1)  loop = snip(loop);
-            assertEquals(23, loop.invoke(23));
-        } catch (IllegalArgumentException iae) {
-            assert messageOrNull != null;
-            assertEqualsFIXME(messageOrNull, iae.getMessage());
-        }
+        MethodHandle loop = MethodHandles.whileLoop(MH_zero, MH_pred, MH_step);
+        if (MH_step.type().equals(While.MH_step.type()))
+            assertEquals(While.MT_while, loop.type());
+        assertEquals(MH_step.type().dropParameterTypes(0, 1), loop.type());
+        while (loop.type().parameterCount() > 1)  loop = snip(loop);
+        assertEquals(23, loop.invoke(23));
+    }
+
+    @ParameterizedTest
+    @MethodSource("whileLoopFailData")
+    public void testWhileLoopFail(MethodHandle MH_zero,
+                                  MethodHandle MH_pred,
+                                  MethodHandle MH_step,
+                                  String message) throws Throwable {
+        // int i = 0; while (i < limit) { ++i; } return i; => limit
+        var iae = assertThrows(IllegalArgumentException.class, () -> MethodHandles.whileLoop(MH_zero, MH_pred, MH_step));
+        assertEqualsFIXME(message, iae.getMessage());
     }
 
     static void assertEqualsFIXME(String expect, String actual) {
@@ -253,8 +255,7 @@ public class LoopCombinatorTest {
         }
     }
 
-    @DataProvider
-    static Object[][] whileLoopTestData() {
+    static Object[][] whileLoopPassData() {
         MethodHandle
             zeroI = While.MH_zero,
             zeroX = snip(zeroI),
@@ -268,28 +269,44 @@ public class LoopCombinatorTest {
             ;
         return new Object[][] {
             // normal while loop clauses, perhaps with effectively-identical reductions
-            {zeroI, predII, stepII, null},
-            {zeroX, predII, stepII, null},
-            {null, predII, stepII, null},
+            {zeroI, predII, stepII},
+            {zeroX, predII, stepII},
+            {null, predII, stepII},
             // expanded while loop clauses
-            {zeroIB, predIIB, stepIIB, null},
-            {zeroI, predIIB, stepIIB, null},
-            {null, predIIB, stepIIB, null},
-            {zeroIB, predII, stepIIB, null},
-            {zeroX, predII, stepIIB, null},
-            {null, predII, stepIIB, null},
-            // short step clauses cause errors
-            {zeroI, predII, stepIX, "loop predicate must match: (int,int)boolean != (int)boolean"},
-            {zeroIB, predIX, stepIX, "loop initializer must match: (int,byte)int != ()int"},
-            // bad body type
-            {zeroI, predII, tweak(stepII, -1, char.class), "body function must match: (int,int)char != (char,int,int)char"},
-            {zeroI, predII, tweak(stepII,  0, char.class), "body function must match: (char,int)int != (int,char,int)int"},
-            // bad pred type
-            {zeroI, tweak(predII, -1, char.class), stepII, "loop predicate must match: (int,int)char != (int,int)boolean"},
-            {zeroI, tweak(predII,  0, char.class), stepII, "loop predicate must match: (char,int)boolean != (int,int)boolean"},
-            // bad init type
-            {tweak(zeroI, -1, char.class), predII, stepII, "loop initializer must match: (int)char != (int)int"},
-            {tweak(zeroI,  0, char.class), predII, stepII, "loop initializer must match: (char)int != (int)int"},
+            {zeroIB, predIIB, stepIIB},
+            {zeroI, predIIB, stepIIB},
+            {null, predIIB, stepIIB},
+            {zeroIB, predII, stepIIB},
+            {zeroX, predII, stepIIB},
+            {null, predII, stepIIB},
+        };
+    }
+
+    static Object[][] whileLoopFailData() {
+        MethodHandle
+                zeroI = While.MH_zero,
+                zeroX = snip(zeroI),
+                zeroIB = slap(zeroI, byte.class),
+                predII = While.MH_pred,
+                predIX = snip(predII),
+                predIIB = slap(predII, byte.class),
+                stepII = While.MH_step,
+                stepIX = snip(stepII),
+                stepIIB = slap(stepII, byte.class)
+                        ;
+        return new Object[][] {
+                // short step clauses cause errors
+                {zeroI, predII, stepIX, "loop predicate must match: (int,int)boolean != (int)boolean"},
+                {zeroIB, predIX, stepIX, "loop initializer must match: (int,byte)int != ()int"},
+                // bad body type
+                {zeroI, predII, tweak(stepII, -1, char.class), "body function must match: (int,int)char != (char,int,int)char"},
+                {zeroI, predII, tweak(stepII,  0, char.class), "body function must match: (char,int)int != (int,char,int)int"},
+                // bad pred type
+                {zeroI, tweak(predII, -1, char.class), stepII, "loop predicate must match: (int,int)char != (int,int)boolean"},
+                {zeroI, tweak(predII,  0, char.class), stepII, "loop predicate must match: (char,int)boolean != (int,int)boolean"},
+                // bad init type
+                {tweak(zeroI, -1, char.class), predII, stepII, "loop initializer must match: (int)char != (int)int"},
+                {tweak(zeroI,  0, char.class), predII, stepII, "loop initializer must match: (char)int != (int)int"},
         };
     }
 
@@ -323,53 +340,50 @@ public class LoopCombinatorTest {
     }
 
     @Test
-    public static void testWhileLoopNoIteration() throws Throwable {
+    public void testWhileLoopNoIteration() throws Throwable {
         // a while loop that never executes its body because the predicate evaluates to false immediately
         MethodHandle loop = MethodHandles.whileLoop(While.MH_initString, While.MH_predString, While.MH_stepString);
         assertEquals(While.MT_string, loop.type());
         assertEquals("a", loop.invoke());
     }
 
-    @Test(dataProvider = "whileLoopTestData")
-    public static void testDoWhileLoop(MethodHandle MH_zero,
-                                       MethodHandle MH_pred,
-                                       MethodHandle MH_step,
-                                       String messageOrNull) throws Throwable {
+    @ParameterizedTest
+    @MethodSource("whileLoopPassData")
+    public void testDoWhileLoopPass(MethodHandle MH_zero,
+                                    MethodHandle MH_pred,
+                                    MethodHandle MH_step) throws Throwable {
         // int i = 0; do { ++i; } while (i < limit); return i; => limit
-        try {
-            MethodHandle loop = MethodHandles.doWhileLoop(MH_zero, MH_step, MH_pred);
-            assert messageOrNull == null;
-            if (MH_step.type().equals(While.MH_step.type()))
-                assertEquals(While.MT_while, loop.type());
-            assertEquals(MH_step.type().dropParameterTypes(0, 1), loop.type());
-            while (loop.type().parameterCount() > 1)  loop = snip(loop);
-            assertEquals(23, loop.invoke(23));
-        } catch (IllegalArgumentException iae) {
-            assert messageOrNull != null;
-            if (!messageOrNull.equals(iae.getMessage())) {
-                // just issue a warning
-                System.out.println("*** "+messageOrNull+"\n != "+iae.getMessage());
-            }
-        }
+        MethodHandle loop = MethodHandles.doWhileLoop(MH_zero, MH_step, MH_pred);
+        if (MH_step.type().equals(While.MH_step.type()))
+            assertEquals(While.MT_while, loop.type());
+        assertEquals(MH_step.type().dropParameterTypes(0, 1), loop.type());
+        while (loop.type().parameterCount() > 1)  loop = snip(loop);
+        assertEquals(23, loop.invoke(23));
+    }
+
+    @ParameterizedTest
+    @MethodSource("whileLoopFailData")
+    public void testDoWhileLoopFail(MethodHandle MH_zero,
+                                    MethodHandle MH_pred,
+                                    MethodHandle MH_step,
+                                    String message) throws Throwable {
+        // int i = 0; do { ++i; } while (i < limit); return i; => limit
+        var iae = assertThrows(IllegalArgumentException.class, () -> MethodHandles.doWhileLoop(MH_zero, MH_step, MH_pred));
+        assertEqualsFIXME(message, iae.getMessage());
     }
 
     @Test
-    public static void testDoWhileBadInit() throws Throwable {
-        boolean caught = false;
-        try {
-            While w = new While();
-            MethodHandle loop = MethodHandles.doWhileLoop(MethodHandles.empty(methodType(char.class)),
-                                                          While.MH_voidBody.bindTo(w),
-                                                          While.MH_voidPred.bindTo(w));
-        } catch (IllegalArgumentException iae) {
-            assertEquals("loop initializer must match: ()char != (int)void", iae.getMessage());
-            caught = true;
-        }
-        assertTrue(caught);
+    public void testDoWhileBadInit() throws Throwable {
+        While w = new While();
+        var iae = assertThrows(IllegalArgumentException.class, () ->
+                MethodHandles.doWhileLoop(MethodHandles.empty(methodType(char.class)),
+                                          While.MH_voidBody.bindTo(w),
+                                          While.MH_voidPred.bindTo(w)));
+        assertEquals("loop initializer must match: ()char != (int)void", iae.getMessage());
     }
 
     @Test
-    public static void testWhileZip() throws Throwable {
+    public void testWhileZip() throws Throwable {
         MethodHandle loop = MethodHandles.doWhileLoop(While.MH_zipInitZip, While.MH_zipStep, While.MH_zipPred);
         assertEquals(While.MT_zip, loop.type());
         List a = Arrays.asList("a", "b", "c", "d");
@@ -379,22 +393,17 @@ public class LoopCombinatorTest {
     }
 
     @Test
-    public static void testWhileBadInit() throws Throwable {
-        boolean caught = false;
-        try {
-            While w = new While();
-            MethodHandle loop = MethodHandles.whileLoop(MethodHandles.empty(methodType(void.class, char.class)),
-                                                        While.MH_voidPred.bindTo(w),
-                                                        While.MH_voidBody.bindTo(w));
-        } catch (IllegalArgumentException iae) {
-            assertEquals("loop initializer must match: (char)void != (int)void", iae.getMessage());
-            caught = true;
-        }
-        assertTrue(caught);
+    public void testWhileBadInit() throws Throwable {
+        While w = new While();
+        var iae = assertThrows(IllegalArgumentException.class, () ->
+                MethodHandles.whileLoop(MethodHandles.empty(methodType(void.class, char.class)),
+                                        While.MH_voidPred.bindTo(w),
+                                        While.MH_voidBody.bindTo(w)));
+        assertEquals("loop initializer must match: (char)void != (int)void", iae.getMessage());
     }
 
     @Test
-    public static void testWhileVoidInit() throws Throwable {
+    public void testWhileVoidInit() throws Throwable {
         While w = new While();
         int v = 5;
         MethodHandle loop = MethodHandles.whileLoop(While.MH_voidInit.bindTo(w), While.MH_voidPred.bindTo(w),
@@ -405,7 +414,7 @@ public class LoopCombinatorTest {
     }
 
     @Test
-    public static void testDoWhileVoidInit() throws Throwable {
+    public void testDoWhileVoidInit() throws Throwable {
         While w = new While();
         int v = 5;
         MethodHandle loop = MethodHandles.doWhileLoop(While.MH_voidInit.bindTo(w), While.MH_voidBody.bindTo(w),
@@ -415,24 +424,25 @@ public class LoopCombinatorTest {
         assertEquals(v, w.i);
     }
 
-    @DataProvider
     static Object[][] nullArgs() {
         MethodHandle c = MethodHandles.constant(int.class, 1);
         return new Object[][]{{null, c}, {c, null}};
     }
 
-    @Test(dataProvider = "nullArgs", expectedExceptions = NullPointerException.class)
-    public static void testWhileNullArgs(MethodHandle pred, MethodHandle body) {
-        MethodHandles.whileLoop(null, pred, body);
+    @ParameterizedTest
+    @MethodSource("nullArgs")
+    public void testWhileNullArgs(MethodHandle pred, MethodHandle body) {
+        assertThrows(NullPointerException.class, () -> MethodHandles.whileLoop(null, pred, body));
     }
 
-    @Test(dataProvider = "nullArgs", expectedExceptions = NullPointerException.class)
-    public static void testDoWhileNullArgs(MethodHandle body, MethodHandle pred) {
-        MethodHandles.whileLoop(null, body, pred);
+    @ParameterizedTest
+    @MethodSource("nullArgs")
+    public void testDoWhileNullArgs(MethodHandle body, MethodHandle pred) {
+        assertThrows(NullPointerException.class, () -> MethodHandles.whileLoop(null, body, pred));
     }
 
     @Test
-    public static void testCountedLoop() throws Throwable {
+    public void testCountedLoop() throws Throwable {
         // String s = "Lambdaman!"; for (int i = 0; i < 13; ++i) { s = "na " + s; } return s; => a variation on a well known theme
         MethodHandle fit13 = MethodHandles.dropArguments(MethodHandles.constant(int.class, 13), 0, String.class);
         MethodHandle loop = MethodHandles.countedLoop(fit13, Counted.MH_start, Counted.MH_step);
@@ -441,7 +451,7 @@ public class LoopCombinatorTest {
     }
 
     @Test
-    public static void testCountedLoopVoidInit() throws Throwable {
+    public void testCountedLoopVoidInit() throws Throwable {
         MethodHandle fit5 = MethodHandles.constant(int.class, 5);
         for (int i = 0; i < 8; i++) {
             MethodHandle zero = MethodHandles.zero(void.class);
@@ -465,7 +475,7 @@ public class LoopCombinatorTest {
     }
 
     @Test
-    public static void testCountedArrayLoop() throws Throwable {
+    public void testCountedArrayLoop() throws Throwable {
         // int[] a = new int[]{0}; for (int i = 0; i < 13; ++i) { ++a[0]; } => a[0] == 13
         MethodHandle fit13 = MethodHandles.dropArguments(MethodHandles.constant(int.class, 13), 0, int[].class);
         MethodHandle loop = MethodHandles.countedLoop(fit13, null, Counted.MH_stepUpdateArray);
@@ -476,37 +486,30 @@ public class LoopCombinatorTest {
     }
 
     @Test
-    public static void testCountedPrintingLoop() throws Throwable {
+    public void testCountedPrintingLoop() throws Throwable {
         MethodHandle fit5 = MethodHandles.constant(int.class, 5);
         MethodHandle loop = MethodHandles.countedLoop(fit5, null, Counted.MH_printHello);
         assertEquals(Counted.MT_countedPrinting, loop.type());
         loop.invoke();
     }
 
-    @Test(expectedExceptions = NullPointerException.class)
-    public static void testCountedLoopNullBody() throws Throwable {
+    @Test
+    public void testCountedLoopNullBody() throws Throwable {
         MethodHandle h5 = MethodHandles.constant(int.class, 5);
         MethodHandle h13 = MethodHandles.constant(int.class, 13);
-        MethodHandle loop = MethodHandles.countedLoop(h5, h13, null);
-        assertEquals(methodType(int.class), loop.type());
-        assertEquals(13, loop.invoke());
+        assertThrows(NullPointerException.class, () -> MethodHandles.countedLoop(h5, h13, null));
     }
 
-    @Test(expectedExceptions = NullPointerException.class)
-    public static void testCountedLoopNullIterations() throws Throwable {
-        MethodHandle loop = MethodHandles.countedLoop(null, null, null);
-        assertEquals(methodType(void.class), loop.type());
-        loop.invoke();
+    @Test
+    public void testCountedLoopNullIterations() throws Throwable {
+        assertThrows(NullPointerException.class, () -> MethodHandles.countedLoop(null, null, null));
     }
 
-    @Test(expectedExceptions = NullPointerException.class)
-    public static void testCountedLoopNullInitAndBody() throws Throwable {
-        MethodHandle loop = MethodHandles.countedLoop(MethodHandles.constant(int.class, 5), null, null);
-        assertEquals(methodType(void.class), loop.type());
-        loop.invoke();
+    @Test
+    public void testCountedLoopNullInitAndBody() throws Throwable {
+        assertThrows(NullPointerException.class, () -> MethodHandles.countedLoop(MethodHandles.constant(int.class, 5), null, null));
     }
 
-    @DataProvider
     static Object[][] countedLoopBodyParameters() {
         Class V = String.class, I = int.class, A = List.class;
         // return types are of these forms:
@@ -531,8 +534,9 @@ public class LoopCombinatorTest {
         };
     }
 
-    @Test(dataProvider = "countedLoopBodyParameters")
-    public static void testCountedLoopBodyParameters(MethodType countType, MethodType initType, MethodType bodyType) throws Throwable {
+    @ParameterizedTest
+    @MethodSource("countedLoopBodyParameters")
+    public void testCountedLoopBodyParameters(MethodType countType, MethodType initType, MethodType bodyType) throws Throwable {
         MethodHandle loop = MethodHandles.countedLoop(
                 MethodHandles.empty(countType),
                 initType == null ? null : MethodHandles.empty(initType),
@@ -546,13 +550,14 @@ public class LoopCombinatorTest {
         assertEquals(expectType, loop.type());
     }
 
-    @Test(dataProvider = "countedLoopBodyParameters")
-    public static void testCountedLoopBodyParametersNullInit(MethodType countType, MethodType initType, MethodType bodyType) throws Throwable {
+    @ParameterizedTest
+    @MethodSource("countedLoopBodyParameters")
+    public void testCountedLoopBodyParametersNullInit(MethodType countType, MethodType initType, MethodType bodyType) throws Throwable {
         testCountedLoopBodyParameters(countType, null, bodyType);
     }
 
     @Test
-    public static void testCountedLoopStateInitializedToNull() throws Throwable {
+    public void testCountedLoopStateInitializedToNull() throws Throwable {
         MethodHandle loop = MethodHandles.countedLoop(MethodHandles.constant(int.class, 5),
                 MethodHandles.empty(methodType(String.class)), Counted.MH_stateBody);
         assertEquals(Counted.MT_bodyDeterminesState, loop.type());
@@ -560,7 +565,7 @@ public class LoopCombinatorTest {
     }
 
     @Test
-    public static void testCountedLoopArgsDefinedByIterations() throws Throwable {
+    public void testCountedLoopArgsDefinedByIterations() throws Throwable {
         MethodHandle iterations =
                 MethodHandles.dropArguments(MethodHandles.constant(int.class, 3), 0, String.class);
         MethodHandle loop = MethodHandles.countedLoop(iterations,
@@ -570,7 +575,7 @@ public class LoopCombinatorTest {
     }
 
     @Test
-    public static void testCountedRangeLoop() throws Throwable {
+    public void testCountedRangeLoop() throws Throwable {
         // String s = "Lambdaman!"; for (int i = -5; i < 8; ++i) { s = "na " + s; } return s; => a well known theme
         MethodHandle fitm5 = MethodHandles.dropArguments(Counted.MH_m5, 0, String.class);
         MethodHandle fit8 = MethodHandles.dropArguments(Counted.MH_8, 0, String.class);
@@ -580,7 +585,7 @@ public class LoopCombinatorTest {
     }
 
     @Test
-    public static void testCountedLoopCounterInit() throws Throwable {
+    public void testCountedLoopCounterInit() throws Throwable {
         // int x = 0; for (int i = 0; i < 5; ++i) { x += i; } return x; => 10
         // (only if counter's first value in body is 0)
         MethodHandle iter = MethodHandles.constant(int.class, 5);
@@ -592,7 +597,7 @@ public class LoopCombinatorTest {
     }
 
     @Test
-    public static void testCountedLoopEmpty() throws Throwable {
+    public void testCountedLoopEmpty() throws Throwable {
         // for (int i = 0; i < 5; ++i) { /* empty */ }
         MethodHandle loop = MethodHandles.countedLoop(MethodHandles.constant(int.class, 5), null,
                 MethodHandles.empty(methodType(void.class, int.class)));
@@ -601,7 +606,7 @@ public class LoopCombinatorTest {
     }
 
     @Test
-    public static void testCountedRangeLoopEmpty() throws Throwable {
+    public void testCountedRangeLoopEmpty() throws Throwable {
         // for (int i = -5; i < 5; ++i) { /* empty */ }
         MethodHandle loop = MethodHandles.countedLoop(MethodHandles.constant(int.class, -5),
                 MethodHandles.constant(int.class, 5), null, MethodHandles.empty(methodType(void.class, int.class)));
@@ -609,7 +614,6 @@ public class LoopCombinatorTest {
         loop.invoke();
     }
 
-    @DataProvider
     static Object[][] countedLoopNegativeData() {
         MethodHandle dummy = MethodHandles.zero(void.class);
         MethodHandle one = MethodHandles.constant(int.class, 1);
@@ -629,35 +633,30 @@ public class LoopCombinatorTest {
         };
     }
 
-    @Test(dataProvider = "countedLoopNegativeData")
-    public static void testCountedLoopNegative(MethodHandle start, MethodHandle end, MethodHandle init,
+    @ParameterizedTest
+    @MethodSource("countedLoopNegativeData")
+    @Disabled //%%%FIXME%%%%
+    public void testCountedLoopNegative(MethodHandle start, MethodHandle end, MethodHandle init,
                                                MethodHandle body, String msg) {
-        if (true)  return;  //%%%FIXME%%%%
-        boolean caught = false;
-        try {
-            MethodHandles.countedLoop(start, end, init, body);
-        } catch (IllegalArgumentException iae) {
-            assertEquals(msg, iae.getMessage());
-            caught = true;
-        }
-        assertTrue(caught);
+        var iae = assertThrows(IllegalArgumentException.class, () -> MethodHandles.countedLoop(start, end, init, body));
+        assertEquals(msg, iae.getMessage());
     }
 
     @Test
-    public static void testIterateSum() throws Throwable {
+    public void testIterateSum() throws Throwable {
         // Integer[] a = new Integer[]{1,2,3,4,5,6}; int sum = 0; for (int e : a) { sum += e; } return sum; => 21
         MethodHandle loop = MethodHandles.iteratedLoop(Iterate.MH_sumIterator, Iterate.MH_sumInit, Iterate.MH_sumStep);
         assertEquals(Iterate.MT_sum, loop.type());
         assertEquals(21, loop.invoke(new Integer[]{1, 2, 3, 4, 5, 6}));
     }
 
-    @DataProvider
     static Object[][] iteratorInits() {
         return new Object[][]{{Iterate.MH_iteratorFromList}, {Iterate.MH_iteratorFromIterable}, {null}};
     }
 
-    @Test(dataProvider = "iteratorInits")
-    public static void testIterateReverse(MethodHandle iterator) throws Throwable {
+    @ParameterizedTest
+    @MethodSource("iteratorInits")
+    public void testIterateReverse(MethodHandle iterator) throws Throwable {
         // this test uses List as its loop state type; don't try to change that
         if (iterator != null)
             iterator = iterator.asType(iterator.type().changeParameterType(0, List.class));
@@ -685,8 +684,9 @@ public class LoopCombinatorTest {
         }
     }
 
-    @Test(dataProvider = "iteratorInits")
-    public static void testIterateLength(MethodHandle iterator) throws Throwable {
+    @ParameterizedTest
+    @MethodSource("iteratorInits")
+    public void testIterateLength(MethodHandle iterator) throws Throwable {
         MethodHandle body = Iterate.MH_lengthStep;
         MethodHandle init = Iterate.MH_lengthInit;
         MethodType expectedType = Iterate.MT_length;
@@ -708,8 +708,9 @@ public class LoopCombinatorTest {
         }
     }
 
-    @Test(dataProvider = "iteratorInits")
-    public static void testIterateMap(MethodHandle iterator) throws Throwable {
+    @ParameterizedTest
+    @MethodSource("iteratorInits")
+    public void testIterateMap(MethodHandle iterator) throws Throwable {
         MethodHandle body = Iterate.MH_mapStep;
         MethodHandle init = Iterate.MH_mapInit;
         MethodType expectedType = Iterate.MT_map;
@@ -731,8 +732,9 @@ public class LoopCombinatorTest {
         }
     }
 
-    @Test(dataProvider = "iteratorInits")
-    public static void testIteratePrint(MethodHandle iterator) throws Throwable {
+    @ParameterizedTest
+    @MethodSource("iteratorInits")
+    public void testIteratePrint(MethodHandle iterator) throws Throwable {
         MethodHandle body = Iterate.MH_printStep;
         MethodType expectedType = Iterate.MT_print;
         int barity = body.type().parameterCount();
@@ -747,32 +749,28 @@ public class LoopCombinatorTest {
         loop.invoke(Arrays.asList("hello", "world"));
     }
 
-    @Test(expectedExceptions = NullPointerException.class)
-    public static void testIterateNullBody() {
-        MethodHandles.iteratedLoop(MethodHandles.empty(methodType(Iterator.class, int.class)),
-                MethodHandles.identity(int.class), null);
+    @Test
+    public void testIterateNullBody() {
+        assertThrows(NullPointerException.class, () ->
+                MethodHandles.iteratedLoop(MethodHandles.empty(methodType(Iterator.class, int.class)),
+                                           MethodHandles.identity(int.class), null));
     }
 
-    @DataProvider
     static Object[][] wrongIteratorTypes() {
         return new Object[][]{{void.class}, {Object.class}, {Iterable.class}};
     }
 
-    @Test(dataProvider = "wrongIteratorTypes")
-    public static void testIterateVoidIterator(Class it) {
-        boolean caught = false;
+    @ParameterizedTest
+    @MethodSource("wrongIteratorTypes")
+    public void testIterateVoidIterator(Class it) {
         MethodType v = methodType(it);
-        try {
-            MethodHandles.iteratedLoop(MethodHandles.empty(v), null, MethodHandles.empty(v));
-        } catch(IllegalArgumentException iae) {
-            assertEqualsFIXME("iteratedLoop first argument must have Iterator return type", iae.getMessage());
-            caught = true;
-        }
-        assertTrue(caught);
+        var iae = assertThrows(IllegalArgumentException.class, () -> MethodHandles.iteratedLoop(MethodHandles.empty(v), null, MethodHandles.empty(v)));
+        assertEqualsFIXME("iteratedLoop first argument must have Iterator return type", iae.getMessage());
     }
 
-    @Test(dataProvider = "iteratorInits")
-    public static void testIterateVoidInit(MethodHandle iterator) throws Throwable {
+    @ParameterizedTest
+    @MethodSource("iteratorInits")
+    public void testIterateVoidInit(MethodHandle iterator) throws Throwable {
         // this test uses List as its loop state type; don't try to change that
         if (iterator != null)
             iterator = iterator.asType(iterator.type().changeParameterType(0, List.class));
@@ -781,7 +779,6 @@ public class LoopCombinatorTest {
         loop.invoke(Arrays.asList("hello", "world"));
     }
 
-    @DataProvider
     static Object[][] iterateParameters() {
         MethodType i = methodType(int.class);
         MethodType sil_v = methodType(void.class, String.class, int.class, List.class);
@@ -811,8 +808,9 @@ public class LoopCombinatorTest {
         };
     }
 
-    @Test(dataProvider = "iterateParameters")
-    public static void testIterateParameters(MethodType it, MethodType in, MethodType bo, String msg) {
+    @ParameterizedTest
+    @MethodSource("iterateParameters")
+    public void testIterateParameters(MethodType it, MethodType in, MethodType bo, String msg) {
         boolean negative = !msg.isEmpty();
         MethodHandle iterator = it == null ? null : MethodHandles.empty(it);
         MethodHandle init = in == null ? null : MethodHandles.empty(in);
@@ -855,7 +853,7 @@ public class LoopCombinatorTest {
     }
 
     @Test
-    public static void testIteratorSubclass() throws Throwable {
+    public void testIteratorSubclass() throws Throwable {
         MethodHandle loop = MethodHandles.iteratedLoop(MethodHandles.empty(methodType(BogusIterator.class, List.class)),
                 null, MethodHandles.empty(methodType(void.class, String.class, List.class)));
         assertEquals(methodType(void.class, List.class), loop.type());
diff --git a/test/jdk/java/lang/invoke/MethodHandleInvokeUOE.java b/test/jdk/java/lang/invoke/MethodHandleInvokeUOE.java
index e728516fe03..510a65acabf 100644
--- a/test/jdk/java/lang/invoke/MethodHandleInvokeUOE.java
+++ b/test/jdk/java/lang/invoke/MethodHandleInvokeUOE.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 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
@@ -24,20 +24,18 @@
 /* @test
  * @summary Test MethodHandle::invokeExact and MethodHandle::invoke throws
  *          UnsupportedOperationException when called via Method::invoke
- * @run testng test.java.lang.invoke.MethodHandleInvokeUOE
+ * @run junit test.java.lang.invoke.MethodHandleInvokeUOE
  */
 
 package test.java.lang.invoke;
 
-import org.testng.*;
-import org.testng.annotations.*;
-
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
 import static java.lang.invoke.MethodType.*;
+import org.junit.jupiter.api.Test;
 
 public class MethodHandleInvokeUOE {
     @Test
diff --git a/test/jdk/java/lang/invoke/MethodHandleProxies/Driver.java b/test/jdk/java/lang/invoke/MethodHandleProxies/Driver.java
index 6acd4fb30e1..2d99db46c2c 100644
--- a/test/jdk/java/lang/invoke/MethodHandleProxies/Driver.java
+++ b/test/jdk/java/lang/invoke/MethodHandleProxies/Driver.java
@@ -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
@@ -21,12 +21,12 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 8280377
  * @build m1/* m2/* Unnamed
- * @run testng/othervm m1/p1.Main
- * @run testng/othervm Unnamed
+ * @run junit/othervm m1/p1.Main
+ * @run junit/othervm Unnamed
  * @summary Test MethodHandleProxies::asInterfaceInstance with a default
  *          method with varargs
  */
diff --git a/test/jdk/java/lang/invoke/MethodHandleProxies/Unnamed.java b/test/jdk/java/lang/invoke/MethodHandleProxies/Unnamed.java
index f42071f0427..8cd9a37cc2f 100644
--- a/test/jdk/java/lang/invoke/MethodHandleProxies/Unnamed.java
+++ b/test/jdk/java/lang/invoke/MethodHandleProxies/Unnamed.java
@@ -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
@@ -26,20 +26,23 @@ import java.lang.invoke.MethodHandleProxies;
 import java.lang.invoke.MethodHandles;
 import java.lang.reflect.Method;
 
-import static org.testng.Assert.*;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
 
 /*
  * Test MethodHandleProxies::asInterfaceInstance with an inaccessible interface
  */
 public class Unnamed {
-    public static void main(String... args) throws Throwable {
+    @Test
+    void testInaccessible() throws Throwable {
         MethodHandle target = MethodHandles.constant(String.class, "test");
         Class intf = Class.forName("p2.TestIntf");
         Object t = MethodHandleProxies.asInterfaceInstance(intf, target);
 
         // verify that the caller has no access to the proxy created on an
         // inaccessible interface
-        Method m = intf.getMethod("test", Object[].class);
-        assertFalse(m.canAccess(null));
+        Method m = intf.getMethod("test");
+        assertFalse(m.canAccess(t));
     }
 }
diff --git a/test/jdk/java/lang/invoke/MethodHandleProxies/m1/module-info.java b/test/jdk/java/lang/invoke/MethodHandleProxies/m1/module-info.java
index 1bdeddce28f..5e0174635fb 100644
--- a/test/jdk/java/lang/invoke/MethodHandleProxies/m1/module-info.java
+++ b/test/jdk/java/lang/invoke/MethodHandleProxies/m1/module-info.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,6 @@
  */
 module m1 {
     requires m2;
-    requires org.testng;
+    requires org.junit.platform.console.standalone;
     exports p1;
 }
diff --git a/test/jdk/java/lang/invoke/MethodHandleProxies/m1/p1/Main.java b/test/jdk/java/lang/invoke/MethodHandleProxies/m1/p1/Main.java
index df71809996b..1e4ffcb4aac 100644
--- a/test/jdk/java/lang/invoke/MethodHandleProxies/m1/p1/Main.java
+++ b/test/jdk/java/lang/invoke/MethodHandleProxies/m1/p1/Main.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,9 +32,8 @@ import java.util.stream.Collectors;
 
 import p2.TestIntf;
 
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Test;
 
 public class Main {
     public interface A {
@@ -57,24 +56,24 @@ public class Main {
      * Test the invocation of default methods with varargs
      */
     @Test
-    public static void testVarargsMethods() throws Throwable {
+    public void testVarargsMethods() throws Throwable {
         MethodHandle target = MethodHandles.lookup().findStatic(Main.class,
                 "concat", MethodType.methodType(String.class, Object[].class));
         C proxy = MethodHandleProxies.asInterfaceInstance(C.class, target);
 
-        assertEquals(proxy.c("a", "b", "c"), "abc");
-        assertEquals(proxy.aConcat("a", "b", "c"), "[a, b, c]");
-        assertEquals(proxy.aConcat(new Object[] { "a", "b", "c" }), "[a, b, c]");
-        assertEquals(proxy.bConcat(new Object[] { "a", "b", "c" }), "[a, b, c]");
+        assertEquals("abc", proxy.c("a", "b", "c"));
+        assertEquals("[a, b, c]", proxy.aConcat("a", "b", "c"));
+        assertEquals("[a, b, c]", proxy.aConcat(new Object[] { "a", "b", "c" }));
+        assertEquals("[a, b, c]", proxy.bConcat(new Object[] { "a", "b", "c" }));
     }
 
     /*
      * Test the invocation of a default method of an accessible interface
      */
     @Test
-    public static void modulePrivateInterface() {
+    public void modulePrivateInterface() {
         MethodHandle target = MethodHandles.constant(String.class, "test");
         TestIntf t = MethodHandleProxies.asInterfaceInstance(TestIntf.class, target);
-        assertEquals(t.test(), "test");
+        assertEquals("test", t.test());
     }
 }
diff --git a/test/jdk/java/lang/invoke/MethodHandles/TestDropReturn.java b/test/jdk/java/lang/invoke/MethodHandles/TestDropReturn.java
index ff31dd63f0b..1b8ef6331b3 100644
--- a/test/jdk/java/lang/invoke/MethodHandles/TestDropReturn.java
+++ b/test/jdk/java/lang/invoke/MethodHandles/TestDropReturn.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020, 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,33 +24,33 @@
 /*
  * @test
  * @bug 8255398
- * @run testng TestDropReturn
+ * @run junit TestDropReturn
  */
 
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
 
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 
 import static java.lang.invoke.MethodType.methodType;
-import static org.testng.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 public class TestDropReturn {
 
-    @Test(dataProvider = "dropReturnCases")
+    @ParameterizedTest
+    @MethodSource("dropReturnCases")
     public void testDropReturn(Class cls, Object testValue) throws Throwable {
         MethodHandle mh = MethodHandles.identity(cls);
-        assertEquals(mh.type(), methodType(cls, cls));
+        assertEquals(methodType(cls, cls), mh.type());
         Object x = mh.invoke(testValue);
-        assertEquals(x, testValue);
+        assertEquals(testValue, x);
 
         mh = MethodHandles.dropReturn(mh);
-        assertEquals(mh.type(), methodType(void.class, cls));
+        assertEquals(methodType(void.class, cls), mh.type());
         mh.invoke(testValue); // should at least work
     }
 
-    @DataProvider
     public static Object[][] dropReturnCases() {
         return new Object[][]{
             { boolean.class, true         },
diff --git a/test/jdk/java/lang/invoke/MethodHandles/TestTableSwitch.java b/test/jdk/java/lang/invoke/MethodHandles/TestTableSwitch.java
index 4ff1a99cc28..960d98fb387 100644
--- a/test/jdk/java/lang/invoke/MethodHandles/TestTableSwitch.java
+++ b/test/jdk/java/lang/invoke/MethodHandles/TestTableSwitch.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 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
@@ -23,13 +23,9 @@
 
 /*
  * @test
- * @run testng/othervm -Xverify:all TestTableSwitch
+ * @run junit/othervm -Xverify:all TestTableSwitch
  */
 
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-import javax.management.ObjectName;
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
@@ -38,7 +34,11 @@ import java.util.List;
 import java.util.function.IntConsumer;
 import java.util.function.IntFunction;
 
-import static org.testng.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import static org.junit.jupiter.api.Assertions.*;
 
 public class TestTableSwitch {
 
@@ -111,7 +111,6 @@ public class TestTableSwitch {
         return args;
     }
 
-    @DataProvider
     public static Object[][] nonVoidCases() {
         List tests = new ArrayList<>();
 
@@ -126,10 +125,11 @@ public class TestTableSwitch {
     }
 
     private static void check(List testValues, Object[] collectedValues) {
-        assertEquals(collectedValues, testValues.toArray());
+        assertArrayEquals(testValues.toArray(), collectedValues);
     }
 
-    @Test(dataProvider = "nonVoidCases")
+    @ParameterizedTest
+    @MethodSource("nonVoidCases")
     public void testNonVoidHandles(Class type, int numCases, List> additionalTypes) throws Throwable {
         MethodHandle collector = MH_check;
         List testArguments = new ArrayList<>();
@@ -158,19 +158,19 @@ public class TestTableSwitch {
             testArguments.add(testValue(additionalType));
         }
 
-        assertEquals(mhSwitch.invokeWithArguments(testArguments(-1, testArguments)), defaultReturnValue);
+        assertEquals(defaultReturnValue, mhSwitch.invokeWithArguments(testArguments(-1, testArguments)));
 
         for (int i = 0; i < numCases; i++) {
-            assertEquals(mhSwitch.invokeWithArguments(testArguments(i, testArguments)), returnValues[i]);
+            assertEquals(returnValues[i], mhSwitch.invokeWithArguments(testArguments(i, testArguments)));
         }
 
-        assertEquals(mhSwitch.invokeWithArguments(testArguments(numCases, testArguments)), defaultReturnValue);
+        assertEquals(defaultReturnValue, mhSwitch.invokeWithArguments(testArguments(numCases, testArguments)));
     }
 
     @Test
     public void testVoidHandles() throws Throwable {
         IntFunction makeTestCase = expectedIndex -> {
-            IntConsumer test = actualIndex -> assertEquals(actualIndex, expectedIndex);
+            IntConsumer test = actualIndex -> assertEquals(expectedIndex, actualIndex);
             return MH_IntConsumer_accept.bindTo(test);
         };
 
@@ -187,48 +187,48 @@ public class TestTableSwitch {
         mhSwitch.invokeExact((int) 2);
     }
 
-    @Test(expectedExceptions = NullPointerException.class)
+    @Test
     public void testNullDefaultHandle() {
-        MethodHandles.tableSwitch(null, simpleTestCase("test"));
+        assertThrows(NullPointerException.class, () -> MethodHandles.tableSwitch(null, simpleTestCase("test")));
     }
 
-    @Test(expectedExceptions = NullPointerException.class)
+    @Test
     public void testNullCases() {
         MethodHandle[] cases = null;
-        MethodHandles.tableSwitch(simpleTestCase("default"), cases);
+        assertThrows(NullPointerException.class, () ->
+                MethodHandles.tableSwitch(simpleTestCase("default"), cases));
     }
 
-    @Test(expectedExceptions = NullPointerException.class)
+    @Test
     public void testNullCase() {
-        MethodHandles.tableSwitch(simpleTestCase("default"), simpleTestCase("case"), null);
+        assertThrows(NullPointerException.class, () -> MethodHandles.tableSwitch(simpleTestCase("default"), simpleTestCase("case"), null));
     }
 
-    @Test(expectedExceptions = IllegalArgumentException.class,
-          expectedExceptionsMessageRegExp = ".*Not enough cases.*")
+    @Test
     public void testNotEnoughCases() {
-        MethodHandles.tableSwitch(simpleTestCase("default"));
+        assertThrows(IllegalArgumentException.class, () -> MethodHandles.tableSwitch(simpleTestCase("default")));
     }
 
-    @Test(expectedExceptions = IllegalArgumentException.class,
-          expectedExceptionsMessageRegExp = ".*Case actions must have int as leading parameter.*")
+    @Test
     public void testNotEnoughParameters() {
         MethodHandle empty = MethodHandles.empty(MethodType.methodType(void.class));
-        MethodHandles.tableSwitch(empty, empty, empty);
+        assertThrows(IllegalArgumentException.class, () ->
+                MethodHandles.tableSwitch(empty, empty, empty));
     }
 
-    @Test(expectedExceptions = IllegalArgumentException.class,
-          expectedExceptionsMessageRegExp = ".*Case actions must have int as leading parameter.*")
+    @Test
     public void testNoLeadingIntParameter() {
         MethodHandle empty = MethodHandles.empty(MethodType.methodType(void.class, double.class));
-        MethodHandles.tableSwitch(empty, empty, empty);
+        assertThrows(IllegalArgumentException.class, () ->
+                MethodHandles.tableSwitch(empty, empty, empty));
     }
 
-    @Test(expectedExceptions = IllegalArgumentException.class,
-          expectedExceptionsMessageRegExp = ".*Case actions must have the same type.*")
+    @Test
     public void testWrongCaseType() {
         // doesn't return a String
         MethodHandle wrongType = MethodHandles.empty(MethodType.methodType(void.class, int.class));
-        MethodHandles.tableSwitch(simpleTestCase("default"), simpleTestCase("case"), wrongType);
+        assertThrows(IllegalArgumentException.class, () ->
+                MethodHandles.tableSwitch(simpleTestCase("default"), simpleTestCase("case"), wrongType));
     }
 
 }
diff --git a/test/jdk/java/lang/invoke/MethodHandles/classData/ClassDataTest.java b/test/jdk/java/lang/invoke/MethodHandles/classData/ClassDataTest.java
index 5880761f925..f96a6f23162 100644
--- a/test/jdk/java/lang/invoke/MethodHandles/classData/ClassDataTest.java
+++ b/test/jdk/java/lang/invoke/MethodHandles/classData/ClassDataTest.java
@@ -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
@@ -25,7 +25,7 @@
  * @test
  * @bug 8230501
  * @library /test/lib
- * @run testng/othervm ClassDataTest
+ * @run junit/othervm ClassDataTest
  */
 
 import java.io.IOException;
@@ -54,13 +54,14 @@ import java.util.Map;
 import java.util.function.Consumer;
 import java.util.stream.Stream;
 
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
 
 import static java.lang.classfile.ClassFile.*;
 import static java.lang.constant.ConstantDescs.*;
 import static java.lang.invoke.MethodHandles.Lookup.*;
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 public class ClassDataTest {
     private static final Lookup LOOKUP = MethodHandles.lookup();
@@ -72,10 +73,10 @@ public class ClassDataTest {
         assertTrue(lookup.hasFullPrivilegeAccess());
 
         int value = MethodHandles.classData(lookup, "_", int.class);
-        assertEquals(value, 20);
+        assertEquals(20, value);
 
         Integer i = MethodHandles.classData(lookup, "_", Integer.class);
-        assertEquals(i.intValue(), 20);
+        assertEquals(20, i.intValue());
     }
 
     /*
@@ -86,8 +87,7 @@ public class ClassDataTest {
         assertNull(MethodHandles.classData(LOOKUP, "_", Object.class));
     }
 
-    @DataProvider(name = "teleportedLookup")
-    private Object[][] teleportedLookup() throws ReflectiveOperationException {
+    private static Object[][] teleportedLookup() throws ReflectiveOperationException {
         Lookup lookup = hiddenClass(30);
         Class hc = lookup.lookupClass();
         assertClassData(lookup, 30);
@@ -100,32 +100,33 @@ public class ClassDataTest {
         };
     }
 
-    @Test(dataProvider = "teleportedLookup", expectedExceptions = { IllegalAccessException.class })
+    @ParameterizedTest
+    @MethodSource("teleportedLookup")
     public void illegalAccess(Lookup lookup, int access) throws IllegalAccessException {
         int lookupModes = lookup.lookupModes();
-        assertTrue((lookupModes & ORIGINAL) == 0);
-        assertEquals(lookupModes, access);
-        MethodHandles.classData(lookup, "_", int.class);
+        assertEquals(0, lookupModes & ORIGINAL);
+        assertEquals(access, lookupModes);
+        assertThrows(IllegalAccessException.class, () -> MethodHandles.classData(lookup, "_", int.class));
     }
 
-    @Test(expectedExceptions = { ClassCastException.class })
+    @Test
     public void incorrectType() throws IllegalAccessException {
         Lookup lookup = hiddenClass(20);
-        MethodHandles.classData(lookup, "_", Long.class);
+        assertThrows(ClassCastException.class, () -> MethodHandles.classData(lookup, "_", Long.class));
     }
 
-    @Test(expectedExceptions = { IndexOutOfBoundsException.class })
+    @Test
     public void invalidIndex() throws IllegalAccessException {
         Lookup lookup = hiddenClass(List.of());
-        MethodHandles.classDataAt(lookup, "_", Object.class, 0);
+        assertThrows(IndexOutOfBoundsException.class, () -> MethodHandles.classDataAt(lookup, "_", Object.class, 0));
     }
 
-    @Test(expectedExceptions = { NullPointerException.class })
+    @Test
     public void unboxNull() throws IllegalAccessException {
         List list = new ArrayList<>();
         list.add(null);
         Lookup lookup = hiddenClass(list);
-        MethodHandles.classDataAt(lookup, "_", int.class, 0);
+        assertThrows(NullPointerException.class, () -> MethodHandles.classDataAt(lookup, "_", int.class, 0));
     }
 
     @Test
@@ -133,7 +134,7 @@ public class ClassDataTest {
         List list = new ArrayList<>();
         list.add(null);
         Lookup lookup = hiddenClass(list);
-        assertTrue(MethodHandles.classDataAt(lookup, "_", Object.class, 0) == null);
+        assertNull(MethodHandles.classDataAt(lookup, "_", Object.class, 0));
     }
 
     @Test
@@ -142,7 +143,7 @@ public class ClassDataTest {
         byte[] bytes = builder.classData(ACC_PUBLIC|ACC_STATIC, int.class).build();
         Lookup lookup = LOOKUP.defineHiddenClassWithClassData(bytes, 100, true);
         int value = MethodHandles.classData(lookup, "_", int.class);
-        assertEquals(value, 100);
+        assertEquals(100, value);
         // call through condy
         assertClassData(lookup, 100);
     }
@@ -153,7 +154,7 @@ public class ClassDataTest {
         byte[] bytes = builder.classData(ACC_PUBLIC|ACC_STATIC, float.class).build();
         Lookup lookup = LOOKUP.defineHiddenClassWithClassData(bytes, 0.1234f, true);
         float value = MethodHandles.classData(lookup, "_", float.class);
-        assertEquals(value, 0.1234f);
+        assertEquals(0.1234f, value);
         // call through condy
         assertClassData(lookup, 0.1234f);
     }
@@ -165,7 +166,7 @@ public class ClassDataTest {
         byte[] bytes = builder.classData(ACC_PUBLIC|ACC_STATIC, Class.class).build();
         Lookup lookup = LOOKUP.defineHiddenClassWithClassData(bytes, hc, true);
         Class value = MethodHandles.classData(lookup, "_", Class.class);
-        assertEquals(value, hc);
+        assertEquals(hc, value);
         // call through condy
         assertClassData(lookup, hc);
     }
@@ -181,7 +182,7 @@ public class ClassDataTest {
         colors[0] = "black";
         // it will get back the modified class data
         String[] value = MethodHandles.classData(lookup, "_", String[].class);
-        assertEquals(value, colors);
+        assertArrayEquals(colors, value);
         // even call through condy as it's not a constant
         assertClassData(lookup, colors);
     }
@@ -194,7 +195,7 @@ public class ClassDataTest {
         int expected = 102;  // element at index=2
         Lookup lookup = LOOKUP.defineHiddenClassWithClassData(bytes, cd, true);
         int value = MethodHandles.classDataAt(lookup, "_", int.class, 2);
-        assertEquals(value, expected);
+        assertEquals(expected, value);
         // call through condy
         assertClassData(lookup, expected);
     }
@@ -208,7 +209,7 @@ public class ClassDataTest {
         int expected = 101;  // element at index=1
         Lookup lookup = LOOKUP.defineHiddenClassWithClassData(bytes, cd, true);
         int value = MethodHandles.classDataAt(lookup, "_", int.class, 1);
-        assertEquals(value, expected);
+        assertEquals(expected, value);
         // call through condy
         assertClassData(lookup, expected);
     }
@@ -216,20 +217,12 @@ public class ClassDataTest {
     private static Lookup hiddenClass(int value) {
         ClassByteBuilder builder = new ClassByteBuilder("HC");
         byte[] bytes = builder.classData(ACC_PUBLIC|ACC_STATIC, int.class).build();
-        try {
-            return LOOKUP.defineHiddenClassWithClassData(bytes, value, true);
-        } catch (Throwable e) {
-            throw new RuntimeException(e);
-        }
+        return assertDoesNotThrow(() -> LOOKUP.defineHiddenClassWithClassData(bytes, value, true));
     }
     private static Lookup hiddenClass(List list) {
         ClassByteBuilder builder = new ClassByteBuilder("HC");
         byte[] bytes = builder.classData(ACC_PUBLIC|ACC_STATIC, List.class).build();
-        try {
-            return LOOKUP.defineHiddenClassWithClassData(bytes, list, true);
-        } catch (Throwable e) {
-            throw new RuntimeException(e);
-        }
+        return assertDoesNotThrow(() -> LOOKUP.defineHiddenClassWithClassData(bytes, list, true));
     }
 
     @Test
@@ -242,7 +235,7 @@ public class ClassDataTest {
         Class hc = hcLookup.lookupClass();
         Lookup lookup = LOOKUP.defineHiddenClassWithClassData(bytes, hc, true);
         Class value = MethodHandles.classData(lookup, "_", Class.class);
-        assertEquals(value, hc);
+        assertEquals(hc, value);
         // call through condy
         Class c = lookup.lookupClass();
         assertClassData(lookup, c.newInstance(), hc);
@@ -257,7 +250,7 @@ public class ClassDataTest {
         int expected = 102;  // element at index=2
         Lookup lookup = LOOKUP.defineHiddenClassWithClassData(bytes, cd, true);
         int value = MethodHandles.classDataAt(lookup, "_", int.class, 2);
-        assertEquals(value, expected);
+        assertEquals(expected, value);
         // call through condy
         Class c = lookup.lookupClass();
         assertClassData(lookup, c.newInstance() ,expected);
@@ -285,13 +278,13 @@ public class ClassDataTest {
         Class c = lookup.lookupClass();
         assertClassData(lookup, c.newInstance(), mtype);
         // modify the class data
-        assertTrue(cd.remove(0) == mtype);
+        assertSame(mtype, cd.remove(0));
         cd.add(0,  MethodType.methodType(void.class));
         MethodType newMType = cd.get(0);
         // loading the element using condy returns the original value
         assertClassData(lookup, c.newInstance(), mtype);
         // direct invocation of MethodHandles.classDataAt returns the modified value
-        assertEquals(MethodHandles.classDataAt(lookup, "_", MethodType.class, 0), newMType);
+        assertEquals(newMType, MethodHandles.classDataAt(lookup, "_", MethodType.class, 0));
     }
 
     // helper method to extract from a class data map
@@ -334,7 +327,7 @@ public class ClassDataTest {
         assertEquals(mh, v1);
     }
 
-    @Test(expectedExceptions = { IllegalArgumentException.class })
+    @Test
     public void nonDefaultName() throws ReflectiveOperationException {
         ClassByteBuilder builder = new ClassByteBuilder("nonDefaultName");
         byte[] bytes = builder.classData(ACC_PUBLIC|ACC_STATIC, Class.class)
@@ -342,7 +335,7 @@ public class ClassDataTest {
         Lookup lookup = LOOKUP.defineHiddenClassWithClassData(bytes, ClassDataTest.class, true);
         assertClassData(lookup, ClassDataTest.class);
         // throw IAE
-        MethodHandles.classData(lookup, "non_default_name", Class.class);
+        assertThrows(IllegalArgumentException.class, () -> MethodHandles.classData(lookup, "non_default_name", Class.class));
     }
 
     static class ClassByteBuilder {
@@ -428,7 +421,7 @@ public class ClassDataTest {
      * Load an int constant from class data via condy and
      * verify it matches the given value.
      */
-    private void assertClassData(Lookup lookup, int value) throws ReflectiveOperationException {
+    private static void assertClassData(Lookup lookup, int value) throws ReflectiveOperationException {
         Class c = lookup.lookupClass();
         Method m = c.getMethod("classData");
         int v = (int) m.invoke(null);
@@ -439,7 +432,7 @@ public class ClassDataTest {
      * Load an int constant from class data via condy and
      * verify it matches the given value.
      */
-    private void assertClassData(Lookup lookup, Object o, int value) throws ReflectiveOperationException {
+    private static void assertClassData(Lookup lookup, Object o, int value) throws ReflectiveOperationException {
         Class c = lookup.lookupClass();
         Method m = c.getMethod("classData");
         int v = (int) m.invoke(o);
@@ -450,7 +443,7 @@ public class ClassDataTest {
      * Load a float constant from class data via condy and
      * verify it matches the given value.
      */
-    private void assertClassData(Lookup lookup, float value) throws ReflectiveOperationException {
+    private static void assertClassData(Lookup lookup, float value) throws ReflectiveOperationException {
         Class c = lookup.lookupClass();
         Method m = c.getMethod("classData");
         float v = (float) m.invoke(null);
@@ -461,7 +454,7 @@ public class ClassDataTest {
      * Load a Class constant from class data via condy and
      * verify it matches the given value.
      */
-    private void assertClassData(Lookup lookup, Class value) throws ReflectiveOperationException {
+    private static void assertClassData(Lookup lookup, Class value) throws ReflectiveOperationException {
         Class c = lookup.lookupClass();
         Method m = c.getMethod("classData");
         Class v = (Class)m.invoke(null);
@@ -472,7 +465,7 @@ public class ClassDataTest {
      * Load a Class from class data via condy and
      * verify it matches the given value.
      */
-    private void assertClassData(Lookup lookup, Object o, Class value) throws ReflectiveOperationException {
+    private static void assertClassData(Lookup lookup, Object o, Class value) throws ReflectiveOperationException {
         Class c = lookup.lookupClass();
         Method m = c.getMethod("classData");
         Object v = m.invoke(o);
@@ -483,18 +476,29 @@ public class ClassDataTest {
      * Load an Object from class data via condy and
      * verify it matches the given value.
      */
-    private void assertClassData(Lookup lookup, Object value) throws ReflectiveOperationException {
+    private static void assertClassData(Lookup lookup, Object value) throws ReflectiveOperationException {
         Class c = lookup.lookupClass();
         Method m = c.getMethod("classData");
         Object v = m.invoke(null);
         assertEquals(value, v);
     }
 
+    /*
+     * Load an Object array from class data via condy and
+     * verify it matches the given value in content.
+     */
+    private static void assertClassData(Lookup lookup, Object[] value) throws ReflectiveOperationException {
+        Class c = lookup.lookupClass();
+        Method m = c.getMethod("classData");
+        Object v = m.invoke(null);
+        assertArrayEquals(value, (Object[]) v);
+    }
+
     /*
      * Load an Object from class data via condy and
      * verify it matches the given value.
      */
-    private void assertClassData(Lookup lookup, Object o, Object value) throws ReflectiveOperationException {
+    private static void assertClassData(Lookup lookup, Object o, Object value) throws ReflectiveOperationException {
         Class c = lookup.lookupClass();
         Method m = c.getMethod("classData");
         Object v = m.invoke(o);
diff --git a/test/jdk/java/lang/invoke/MethodHandles/ensureInitialized/Main.java b/test/jdk/java/lang/invoke/MethodHandles/ensureInitialized/Main.java
index 58146286da1..afb628d31ba 100644
--- a/test/jdk/java/lang/invoke/MethodHandles/ensureInitialized/Main.java
+++ b/test/jdk/java/lang/invoke/MethodHandles/ensureInitialized/Main.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,16 +24,15 @@
 import java.lang.invoke.MethodHandles;
 import java.lang.reflect.Method;
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Test;
 
 /**
  * @test
  * @bug 8235521
  * @summary Tests for Lookup::ensureClassInitialized
  * @build java.base/* m1/* m2/* Main
- * @run testng/othervm --add-modules m1 Main
+ * @run junit/othervm --add-modules m1 Main
  */
 
 public class Main {
@@ -48,20 +47,20 @@ public class Main {
     }
 
     // access denied to package-private java.lang class
-    @Test(expectedExceptions = { IllegalAccessException.class })
+    @Test
     public void testPackagePrivate() throws Exception {
         Class c = Class.forName("java.lang.DefaultInit", false, null);
         assertFalse(Helper.isInitialized(c));
         // access denied
-        MethodHandles.lookup().ensureInitialized(c);
+        assertThrows(IllegalAccessException.class, () -> MethodHandles.lookup().ensureInitialized(c));
     }
 
     // access denied to public class in a non-exported package
-    @Test(expectedExceptions = { IllegalAccessException.class })
+    @Test
     public void testNonExportedPackage() throws Exception {
         Class c = Class.forName("jdk.internal.misc.VM", false, null);
         // access denied
-        MethodHandles.lookup().ensureInitialized(c);
+        assertThrows(IllegalAccessException.class, () -> MethodHandles.lookup().ensureInitialized(c));
     }
 
     // invoke p1.Test::test to test module boundary access
@@ -72,9 +71,9 @@ public class Main {
         m.invoke(null);
     }
 
-    @Test(expectedExceptions = { IllegalArgumentException.class })
+    @Test
     public void testArrayType() throws Exception {
         Class arrayType = PublicInit.class.arrayType();
-        MethodHandles.lookup().ensureInitialized(arrayType);
+        assertThrows(IllegalArgumentException.class, () -> MethodHandles.lookup().ensureInitialized(arrayType));
     }
 }
diff --git a/test/jdk/java/lang/invoke/MethodHandles/privateLookupIn/Driver.java b/test/jdk/java/lang/invoke/MethodHandles/privateLookupIn/Driver.java
index 810351bae3e..bf3f1f40913 100644
--- a/test/jdk/java/lang/invoke/MethodHandles/privateLookupIn/Driver.java
+++ b/test/jdk/java/lang/invoke/MethodHandles/privateLookupIn/Driver.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 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
@@ -24,6 +24,6 @@
 /**
  * @test
  * @build test/* m1/* m2/* m3/* Unnamed
- * @run testng/othervm test/p.PrivateLookupInTests
+ * @run junit/othervm test/p.PrivateLookupInTests
  * @summary Unit tests for MethodHandles.privateLookupIn
  */
diff --git a/test/jdk/java/lang/invoke/MethodHandles/privateLookupIn/test/module-info.java b/test/jdk/java/lang/invoke/MethodHandles/privateLookupIn/test/module-info.java
index da93c879ef1..f364c761aa3 100644
--- a/test/jdk/java/lang/invoke/MethodHandles/privateLookupIn/test/module-info.java
+++ b/test/jdk/java/lang/invoke/MethodHandles/privateLookupIn/test/module-info.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 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
@@ -22,6 +22,6 @@
  */
 
 module test {
-   requires org.testng;
-   exports p to org.testng;   // TestNG invokes the public methods
+   requires org.junit.platform.console.standalone;
+   exports p to org.junit.platform.console.standalone;   // JUnit invokes the public methods in PrivateLookupInTests
 }
diff --git a/test/jdk/java/lang/invoke/MethodHandles/privateLookupIn/test/p/PrivateLookupInTests.java b/test/jdk/java/lang/invoke/MethodHandles/privateLookupIn/test/p/PrivateLookupInTests.java
index b17204de013..068d2fb534e 100644
--- a/test/jdk/java/lang/invoke/MethodHandles/privateLookupIn/test/p/PrivateLookupInTests.java
+++ b/test/jdk/java/lang/invoke/MethodHandles/privateLookupIn/test/p/PrivateLookupInTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2019, 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
@@ -29,15 +29,14 @@ import java.lang.reflect.Modifier;
 
 import static java.lang.invoke.MethodHandles.Lookup.*;
 
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Test;
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
 /**
  * Unit tests for MethodHandles.privateLookupIn
  */
 
-@Test
 public class PrivateLookupInTests {
     /**
      * A public and non-public types in the test module but in a different
@@ -52,24 +51,25 @@ public class PrivateLookupInTests {
      *     private static final Object obj = ...
      * }
      */
-    private Class publicType;
-    private Class nonPublicType;
+    private static Class publicType;
+    private static Class nonPublicType;
 
     // initialize and sanity check publicType/nonPublicType
-    @BeforeTest
-    public void init() throws Exception {
+    @BeforeAll
+    public static void init() throws Exception {
         publicType = Class.forName("p.internal.PublicType");
-        assertTrue(this.getClass().getModule() == publicType.getModule());
-        assertNotEquals(this.getClass().getPackageName(), publicType.getPackageName());
+        assertSame(PrivateLookupInTests.class.getModule(), publicType.getModule());
+        assertNotEquals(publicType.getPackageName(), PrivateLookupInTests.class.getPackageName());
         assertTrue(Modifier.isPublic(publicType.getModifiers()));
 
         nonPublicType = Class.forName("p.internal.NonPublicType");
-        assertTrue(this.getClass().getModule() == nonPublicType.getModule());
-        assertNotEquals(this.getClass().getPackageName(), nonPublicType.getPackageName());
+        assertSame(PrivateLookupInTests.class.getModule(), nonPublicType.getModule());
+        assertNotEquals(nonPublicType.getPackageName(), PrivateLookupInTests.class.getPackageName());
         assertFalse(Modifier.isPublic(nonPublicType.getModifiers()));
     }
 
     // Invoke MethodHandles.privateLookupIn with a full-power caller
+    @Test
     public void testAllAccessCallerSameModule() throws Throwable {
         Lookup lookup = MethodHandles.privateLookupIn(nonPublicType, MethodHandles.lookup());
         assertTrue(lookup.lookupClass() == nonPublicType);
@@ -82,29 +82,31 @@ public class PrivateLookupInTests {
     }
 
     // Invoke MethodHandles.privateLookupIn with a reduced-power caller
-    @Test(expectedExceptions = {IllegalAccessException.class})
+    @Test
     public void testReducedAccessCallerSameModule() throws Throwable {
         Lookup caller = MethodHandles.lookup().dropLookupMode(PACKAGE);
-        assertTrue((caller.lookupModes() & PRIVATE) == 0);
-        assertTrue((caller.lookupModes() & PACKAGE) == 0);
-        assertTrue((caller.lookupModes() & MODULE) != 0);
-        assertTrue((caller.lookupModes() & ORIGINAL) == 0);
-
-        Lookup lookup = MethodHandles.privateLookupIn(nonPublicType, caller);
+        assertEquals(0, caller.lookupModes() & PRIVATE);
+        assertEquals(0, caller.lookupModes() & PACKAGE);
+        assertNotEquals(0, caller.lookupModes() & MODULE);
+        assertEquals(0, caller.lookupModes() & ORIGINAL);
+        assertThrows(IllegalAccessException.class, () ->
+                MethodHandles.privateLookupIn(nonPublicType, caller));
     }
 
     // Invoke MethodHandles.privateLookupIn with the public lookup as caller
-    @Test(expectedExceptions = {IllegalAccessException.class})
+    @Test
     public void testPublicLookupSameModule() throws Exception {
         Lookup caller = MethodHandles.publicLookup();
-        Lookup lookup = MethodHandles.privateLookupIn(publicType, caller);
+        assertThrows(IllegalAccessException.class, () ->
+                MethodHandles.privateLookupIn(publicType, caller));
     }
 
     // test reads m1, open module m1 containing p1
+    @Test
     public void testTargetClassInOpenModule() throws Throwable {
         // m1/p1.Type
         Class clazz = Class.forName("p1.Type");
-        assertEquals(clazz.getModule().getName(), "m1");
+        assertEquals("m1", clazz.getModule().getName());
 
         // ensure that this module reads m1
         Module thisModule = getClass().getModule();
@@ -113,9 +115,9 @@ public class PrivateLookupInTests {
         assertTrue(m1.isOpen("p1", thisModule));
 
         Lookup lookup = MethodHandles.privateLookupIn(clazz, MethodHandles.lookup());
-        assertTrue(lookup.lookupClass() == clazz);
-        assertTrue((lookup.lookupModes() & PRIVATE) == PRIVATE);
-        assertTrue((lookup.lookupModes() & MODULE) == 0);
+        assertSame(clazz, lookup.lookupClass());
+        assertEquals(PRIVATE, lookup.lookupModes() & PRIVATE);
+        assertEquals(0, lookup.lookupModes() & MODULE);
 
         // get obj field
         MethodHandle mh = lookup.findStaticGetter(clazz, "obj", Object.class);
@@ -123,6 +125,7 @@ public class PrivateLookupInTests {
     }
 
     // test target class in unnamed module
+    @Test
     public void testTargetClassInUnnamedModule() throws Throwable {
         Class clazz = Class.forName("Unnamed");
         assertFalse(clazz.getModule().isNamed());
@@ -130,76 +133,72 @@ public class PrivateLookupInTests {
         // thisModule does not read the unnamed module
         Module thisModule = getClass().getModule();
         assertFalse(thisModule.canRead(clazz.getModule()));
-        try {
-            MethodHandles.privateLookupIn(clazz, MethodHandles.lookup());
-            assertTrue(false);
-        } catch (IllegalAccessException expected) { }
+        var baseLookup = MethodHandles.lookup();
+        assertThrows(IllegalAccessException.class, () -> MethodHandles.privateLookupIn(clazz, baseLookup));
 
         // thisModule reads the unnamed module
         thisModule.addReads(clazz.getModule());
-        Lookup lookup = MethodHandles.privateLookupIn(clazz, MethodHandles.lookup());
-        assertTrue(lookup.lookupClass() == clazz);
-        assertTrue((lookup.lookupModes() & PRIVATE) == PRIVATE);
-        assertTrue((lookup.lookupModes() & MODULE) == 0);
+        Lookup lookup = MethodHandles.privateLookupIn(clazz, baseLookup);
+        assertSame(clazz, lookup.lookupClass());
+        assertEquals(PRIVATE, (lookup.lookupModes() & PRIVATE));
+        assertEquals(0, (lookup.lookupModes() & MODULE));
     }
 
     // test does not read m2, m2 opens p2 to test
-    @Test(expectedExceptions = {IllegalAccessException.class})
+    @Test
     public void testCallerDoesNotRead() throws Throwable {
         // m2/p2.Type
         Class clazz = Class.forName("p2.Type");
-        assertEquals(clazz.getModule().getName(), "m2");
-
+        assertEquals("m2", clazz.getModule().getName());
         Module thisModule = getClass().getModule();
         Module m2 = clazz.getModule();
         assertFalse(thisModule.canRead(m2));
         assertTrue(m2.isOpen("p2", thisModule));
-
-        Lookup lookup = MethodHandles.privateLookupIn(clazz, MethodHandles.lookup());
+        assertThrows(IllegalAccessException.class, () ->
+                MethodHandles.privateLookupIn(clazz, MethodHandles.lookup()));
     }
 
     // test reads m3, m3 does not open p3 to test
-    @Test(expectedExceptions = {IllegalAccessException.class})
+    @Test
     public void testNotOpenToCaller() throws Throwable {
         // m3/p2.Type
         Class clazz = Class.forName("p3.Type");
-        assertEquals(clazz.getModule().getName(), "m3");
-
+        assertEquals("m3", clazz.getModule().getName());
         Module thisModule = getClass().getModule();
         Module m3 = clazz.getModule();
         thisModule.addReads(clazz.getModule());
         assertFalse(m3.isOpen("p3", thisModule));
-
-        Lookup lookup = MethodHandles.privateLookupIn(clazz, MethodHandles.lookup());
+        assertThrows(IllegalAccessException.class, () ->
+                MethodHandles.privateLookupIn(clazz, MethodHandles.lookup()));
     }
 
     // Invoke MethodHandles.privateLookupIn with a primitive class
-    @Test(expectedExceptions = {IllegalArgumentException.class})
+    @Test
     public void testPrimitiveClassAsTargetClass() throws Exception {
-        MethodHandles.privateLookupIn(int.class, MethodHandles.lookup());
+        assertThrows(IllegalArgumentException.class, () -> MethodHandles.privateLookupIn(int.class, MethodHandles.lookup()));
     }
 
     // Invoke MethodHandles.privateLookupIn with an array class
-    @Test(expectedExceptions = {IllegalArgumentException.class})
+    @Test
     public void testArrayClassAsTargetClass() throws Exception {
-        MethodHandles.privateLookupIn(PrivateLookupInTests[].class, MethodHandles.lookup());
+        assertThrows(IllegalArgumentException.class, () -> MethodHandles.privateLookupIn(PrivateLookupInTests[].class, MethodHandles.lookup()));
     }
 
     // Invoke MethodHandles.privateLookupIn with a primitive array class
-    @Test(expectedExceptions = {IllegalArgumentException.class})
+    @Test
     public void testPrimitiveArrayClassAsTargetClass() throws Exception {
-        MethodHandles.privateLookupIn(int[].class, MethodHandles.lookup());
+        assertThrows(IllegalArgumentException.class, () -> MethodHandles.privateLookupIn(int[].class, MethodHandles.lookup()));
     }
 
     // Invoke MethodHandles.privateLookupIn with null
-    @Test(expectedExceptions = {NullPointerException.class})
+    @Test
     public void testNullTargetClass() throws Exception {
-        MethodHandles.privateLookupIn(null, MethodHandles.lookup());
+        assertThrows(NullPointerException.class, () -> MethodHandles.privateLookupIn(null, MethodHandles.lookup()));
     }
 
     // Invoke MethodHandles.privateLookupIn with null
-    @Test(expectedExceptions = {NullPointerException.class})
+    @Test
     public void testNullCaller() throws Exception {
-        MethodHandles.privateLookupIn(getClass(), null);
+        assertThrows(NullPointerException.class, () -> MethodHandles.privateLookupIn(getClass(), null));
     }
 }
diff --git a/test/jdk/java/lang/invoke/MethodHandlesCollectArgsTest.java b/test/jdk/java/lang/invoke/MethodHandlesCollectArgsTest.java
index 5fc0083d5fb..20f03454d32 100644
--- a/test/jdk/java/lang/invoke/MethodHandlesCollectArgsTest.java
+++ b/test/jdk/java/lang/invoke/MethodHandlesCollectArgsTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, 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,18 +23,17 @@
 
 /* @test
  * @bug 8259922
- * @run testng/othervm MethodHandlesCollectArgsTest
+ * @run junit/othervm MethodHandlesCollectArgsTest
  */
 
-import org.testng.annotations.Test;
-import org.testng.annotations.DataProvider;
-
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
 import static java.lang.invoke.MethodType.methodType;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 public class MethodHandlesCollectArgsTest {
 
@@ -43,7 +42,6 @@ public class MethodHandlesCollectArgsTest {
     private static final MethodHandle FILTER_INT = MethodHandles.empty(methodType(int.class, String.class));
     private static final MethodHandle FILTER_VOID = MethodHandles.empty(methodType(void.class, String.class));
 
-    @DataProvider(name = "illegalPos")
     public static Object[][] illegalPos() {
         return new Object[][] {
             {TARGET_II_I, 2, FILTER_INT},
@@ -57,7 +55,6 @@ public class MethodHandlesCollectArgsTest {
         };
     }
 
-    @DataProvider(name = "validPos")
     public static Object[][] validPos() {
         return new Object[][] {
             {TARGET_II_I, 0, FILTER_INT, methodType(int.class, String.class, int.class)},
@@ -69,14 +66,16 @@ public class MethodHandlesCollectArgsTest {
         };
     }
 
-    @Test(dataProvider="illegalPos", expectedExceptions = {IllegalArgumentException.class})
+    @ParameterizedTest
+    @MethodSource("illegalPos")
     public void illegalPosition(MethodHandle target, int position, MethodHandle filter) {
-        MethodHandles.collectArguments(target, position, filter);
+        assertThrows(IllegalArgumentException.class, () -> MethodHandles.collectArguments(target, position, filter));
     }
 
-    @Test(dataProvider="validPos")
+    @ParameterizedTest
+    @MethodSource("validPos")
     public void legalPosition(MethodHandle target, int position, MethodHandle filter, MethodType expectedType) {
         MethodHandle result = MethodHandles.collectArguments(target, position, filter);
-        assertEquals(result.type(), expectedType);
+        assertEquals(expectedType, result.type());
     }
 }
diff --git a/test/jdk/java/lang/invoke/MethodHandlesGeneralTest.java b/test/jdk/java/lang/invoke/MethodHandlesGeneralTest.java
index b60c35fc30b..588227fef15 100644
--- a/test/jdk/java/lang/invoke/MethodHandlesGeneralTest.java
+++ b/test/jdk/java/lang/invoke/MethodHandlesGeneralTest.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
@@ -60,6 +60,7 @@ import java.util.Map;
 
 import static java.lang.invoke.MethodType.methodType;
 import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
 
 public class MethodHandlesGeneralTest extends MethodHandlesTest {
 
@@ -398,7 +399,7 @@ public class MethodHandlesGeneralTest extends MethodHandlesTest {
         Object obj = target.invokeWithArguments(args);
         if (!(defc == Example.class && params.length < 2))
             assertCalled(defc.getSimpleName()+".", args);
-        assertTrue("instance of "+defc.getName(), defc.isInstance(obj));
+        assertInstanceOf(defc, obj);
     }
 
     @Test
@@ -971,8 +972,7 @@ public class MethodHandlesGeneralTest extends MethodHandlesTest {
                 arrayToMH = new SubIntExample[length];
             else
                 return;  // can't make an ArrayStoreException test
-            assert(arrayType.isInstance(arrayToMH))
-                : Arrays.asList(arrayType, arrayToMH.getClass(), testSetter, negTest);
+            assertInstanceOf(arrayType, arrayToMH, () -> Arrays.asList(testSetter, negTest).toString());
             break;
         }
         countTest(positive);
diff --git a/test/jdk/java/lang/invoke/MethodTypeTest.java b/test/jdk/java/lang/invoke/MethodTypeTest.java
index 8ac03d1a7fd..dccc82fa348 100644
--- a/test/jdk/java/lang/invoke/MethodTypeTest.java
+++ b/test/jdk/java/lang/invoke/MethodTypeTest.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
@@ -25,7 +25,7 @@
  * @bug 8366028
  * @summary unit tests for java.lang.invoke.MethodType
  * @compile MethodTypeTest.java
- * @run testng/othervm test.java.lang.invoke.MethodTypeTest
+ * @run junit/othervm test.java.lang.invoke.MethodTypeTest
  */
 
 package test.java.lang.invoke;
@@ -35,11 +35,13 @@ import java.lang.invoke.MethodType;
 import java.lang.reflect.Method;
 
 import java.util.*;
-import org.testng.*;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
-import static org.testng.Assert.assertThrows;
-import static org.testng.AssertJUnit.*;
-import org.testng.annotations.*;
+import static org.junit.jupiter.api.Assertions.*;
 
 /**
  *
@@ -57,7 +59,7 @@ public class MethodTypeTest {
     private MethodType[] GALLERY;
     private Method compareTo;
 
-    @BeforeMethod
+    @BeforeEach
     public void setUp() throws Exception {
         rtype = void.class;
         ptypes = new Class[] { int.class, String.class };
@@ -98,7 +100,7 @@ public class MethodTypeTest {
         };
     }
 
-    @AfterMethod
+    @AfterEach
     public void tearDown() throws Exception {
     }
 
@@ -107,7 +109,7 @@ public class MethodTypeTest {
     public void testDistinct() {
         List gallery2 = new ArrayList<>();
         for (MethodType mt : GALLERY) {
-            assertFalse(mt.toString(), gallery2.contains(mt));
+            assertFalse(gallery2.contains(mt), mt.toString());
             gallery2.add(mt);
         }
         // check self-equality also:
@@ -198,9 +200,9 @@ public class MethodTypeTest {
         for (int i = 0; i < instances.length; i++) {
             MethodType instance = instances[i];
             String result = instance.toMethodDescriptorString();
-            assertEquals("#"+i, expResults[i], result);
+            assertEquals(expResults[i], result, "#"+i);
             MethodType parsed = MethodType.fromMethodDescriptorString(result, loader);
-            assertSame("--#"+i, instance, parsed);
+            assertSame(instance, parsed, "--#"+i);
         }
     }
     private static String concat(Object... parts) {
@@ -221,8 +223,7 @@ public class MethodTypeTest {
         return sb.toString().replace('.', '/');
     }
 
-    @DataProvider(name = "badMethodDescriptorStrings")
-    public String[] badMethodDescriptorStrings() {
+    public static String[] badMethodDescriptorStrings() {
         return new String[] {
                 "(I)",
                 "(V)V",
@@ -239,9 +240,12 @@ public class MethodTypeTest {
     }
 
     // JDK-8366028
-    @Test(dataProvider = "badMethodDescriptorStrings", expectedExceptions = IllegalArgumentException.class)
+    @ParameterizedTest
+    @MethodSource("badMethodDescriptorStrings")
     public void testFromMethodDescriptorStringNegatives(String desc) {
-        MethodType.fromMethodDescriptorString(desc, null);
+        assertThrows(IllegalArgumentException.class, () -> {
+            MethodType.fromMethodDescriptorString(desc, null);
+        });
     }
 
     @Test
@@ -251,7 +255,7 @@ public class MethodTypeTest {
         boolean[] expResults =   {true,   false,  true,  false, true,   true,   false,  true};
         for (int i = 0; i < instances.length; i++) {
             boolean result = instances[i].hasPrimitives();
-            assertEquals("#"+i, expResults[i], result);
+            assertEquals(expResults[i], result, "#"+i);
         }
     }
 
@@ -263,7 +267,7 @@ public class MethodTypeTest {
         for (int i = 0; i < instances.length; i++) {
             System.out.println("  hasWrappers "+instances[i]);
             boolean result = instances[i].hasWrappers();
-            assertEquals("#"+i, expResults[i], result);
+            assertEquals(expResults[i], result, "#"+i);
         }
     }
 
@@ -274,7 +278,7 @@ public class MethodTypeTest {
         MethodType[] expResults = {mt_viO, mt_OO2, mt_vv, mt_Ov, mt_iO2, mt_OOi, mt_OO2, mt_iOi};
         for (int i = 0; i < instances.length; i++) {
             MethodType result = instances[i].erase();
-            assertSame("#"+i, expResults[i], result);
+            assertSame(expResults[i], result, "#"+i);
         }
     }
 
@@ -285,7 +289,7 @@ public class MethodTypeTest {
         MethodType[] expResults = {mt_OO2, mt_OO2, mt_Ov, mt_Ov, mt_OO2, mt_OO2, mt_OO2, mt_OO2};
         for (int i = 0; i < instances.length; i++) {
             MethodType result = instances[i].generic();
-            assertSame("#"+i, expResults[i], result);
+            assertSame(expResults[i], result, "#"+i);
         }
     }
 
@@ -296,7 +300,7 @@ public class MethodTypeTest {
         MethodType[] expResults = {mt_VIS, mt_OO2, mt_Vv, mt_Ov, mt_ISI, mt_ISI, mt_ISI, mt_ISI};
         for (int i = 0; i < instances.length; i++) {
             MethodType result = instances[i].wrap();
-            assertSame("#"+i, expResults[i], result);
+            assertSame(expResults[i], result, "#"+i);
         }
     }
 
@@ -307,7 +311,7 @@ public class MethodTypeTest {
         MethodType[] expResults = {mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSi, mt_iSi, mt_iSi, mt_iSi};
         for (int i = 0; i < instances.length; i++) {
             MethodType result = instances[i].unwrap();
-            assertSame("#"+i, expResults[i], result);
+            assertSame(expResults[i], result, "#"+i);
         }
     }
 
@@ -436,7 +440,7 @@ public class MethodTypeTest {
             MethodType instance = instances[i];
             String result = instance.toString();
             System.out.println("#"+i+":"+result);
-            assertEquals("#"+i, expResults[i], result);
+            assertEquals(expResults[i], result, "#"+i);
         }
     }
 
diff --git a/test/jdk/java/lang/invoke/PermuteArgsReturnVoidTest.java b/test/jdk/java/lang/invoke/PermuteArgsReturnVoidTest.java
index b01a4aa2a99..6bd604dcd36 100644
--- a/test/jdk/java/lang/invoke/PermuteArgsReturnVoidTest.java
+++ b/test/jdk/java/lang/invoke/PermuteArgsReturnVoidTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 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,21 +24,21 @@
 /* @test
  * @bug 8184119
  * @summary test permutation when return value is directly derived from an argument
- * @run testng/othervm test.java.lang.invoke.PermuteArgsReturnVoidTest
+ * @run junit/othervm test.java.lang.invoke.PermuteArgsReturnVoidTest
  */
 
 
 package test.java.lang.invoke;
 
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
 
 import static java.lang.invoke.MethodHandles.dropArguments;
 import static java.lang.invoke.MethodHandles.identity;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class PermuteArgsReturnVoidTest {
 
@@ -65,8 +65,8 @@ public class PermuteArgsReturnVoidTest {
         MethodHandle p = MethodHandles.permuteArguments(f, MethodType.methodType(String.class, String.class, int.class, int.class), 0, 2, 1);
 
         String s = (String) p.invoke("IN", 0, 0);
-        Assert.assertEquals(s.getClass(), String.class);
-        Assert.assertEquals(s, "IN");
+        assertEquals(String.class, s.getClass());
+        assertEquals("IN", s);
     }
 
     @Test
@@ -84,7 +84,7 @@ public class PermuteArgsReturnVoidTest {
         MethodHandle p = MethodHandles.permuteArguments(f, MethodType.methodType(String.class, String.class, int.class, int.class), 0, 2, 1);
 
         String s = (String) p.invoke("IN", 0, 0);
-        Assert.assertEquals(s.getClass(), String.class);
-        Assert.assertEquals(s, "IN");
+        assertEquals(String.class, s.getClass());
+        assertEquals("IN", s);
     }
 }
diff --git a/test/jdk/java/lang/invoke/PermuteArgsTest.java b/test/jdk/java/lang/invoke/PermuteArgsTest.java
index 3586dc9382f..77558714d11 100644
--- a/test/jdk/java/lang/invoke/PermuteArgsTest.java
+++ b/test/jdk/java/lang/invoke/PermuteArgsTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, 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
@@ -24,7 +24,7 @@
 /* @test
  * @summary unit tests for method handles which permute their arguments
  * @library /test/lib /java/lang/invoke/common
- * @run testng/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-VerifyDependencies -ea -esa -DPermuteArgsTest.MAX_ARITY=8 test.java.lang.invoke.PermuteArgsTest
+ * @run junit/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-VerifyDependencies -ea -esa -DPermuteArgsTest.MAX_ARITY=8 test.java.lang.invoke.PermuteArgsTest
  */
 
 /* Examples of manual runs:
@@ -35,7 +35,6 @@
 
 package test.java.lang.invoke;
 
-import org.testng.annotations.Test;
 import test.java.lang.invoke.lib.CodeCacheOverflowProcessor;
 
 import java.lang.invoke.MethodHandle;
@@ -52,6 +51,10 @@ import static java.lang.invoke.MethodHandles.Lookup;
 import static java.lang.invoke.MethodHandles.lookup;
 import static java.lang.invoke.MethodHandles.permuteArguments;
 import static java.lang.invoke.MethodType.methodType;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class PermuteArgsTest {
     private static final Class CLASS = PermuteArgsTest.class;
@@ -259,11 +262,11 @@ public class PermuteArgsTest {
             reverse(perm, 0, perm.length);
         }
         switch (perm.length) {
-        case 2: assert(testCases - testCases0 == 2); break;
-        case 3: assert(testCases - testCases0 == 6); break;
-        case 4: assert(testCases - testCases0 == 24); break;
-        case 5: assert(testCases - testCases0 == 120); break;
-        case 6: assert(testCases - testCases0 > 720/3); break;
+            case 2 -> assertEquals(2, testCases - testCases0);
+            case 3 -> assertEquals(6, testCases - testCases0);
+            case 4 -> assertEquals(24, testCases - testCases0);
+            case 5 -> assertEquals(120, testCases - testCases0);
+            case 6 -> assertTrue(testCases - testCases0 > 720/3);
         }
     }
 
diff --git a/test/jdk/java/lang/invoke/SpreadCollectTest.java b/test/jdk/java/lang/invoke/SpreadCollectTest.java
index bcddcd449f8..d58ebab3611 100644
--- a/test/jdk/java/lang/invoke/SpreadCollectTest.java
+++ b/test/jdk/java/lang/invoke/SpreadCollectTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, 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 @@
 /* @test
  * @bug 8139885
  * @bug 8143798
- * @run testng/othervm -ea -esa test.java.lang.invoke.SpreadCollectTest
+ * @run junit/othervm -ea -esa test.java.lang.invoke.SpreadCollectTest
  */
 
 package test.java.lang.invoke;
@@ -39,9 +39,11 @@ import java.util.*;
 
 import static java.lang.invoke.MethodType.methodType;
 
-import static org.testng.AssertJUnit.*;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
-import org.testng.annotations.*;
+import static org.junit.jupiter.api.Assertions.*;
 
 /**
  * Tests for the new asSpreader/asCollector API added in JEP 274.
@@ -51,14 +53,14 @@ public class SpreadCollectTest {
     static final Lookup LOOKUP = MethodHandles.lookup();
 
     @Test
-    public static void testAsSpreader() throws Throwable {
+    public void testAsSpreader() throws Throwable {
         MethodHandle spreader = SpreadCollect.MH_forSpreading.asSpreader(1, int[].class, 3);
         assertEquals(SpreadCollect.MT_spreader, spreader.type());
         assertEquals("A456B", (String) spreader.invoke("A", new int[]{4, 5, 6}, "B"));
     }
 
     @Test
-    public static void testAsSpreaderExample() throws Throwable {
+    public void testAsSpreaderExample() throws Throwable {
         // test the JavaDoc asSpreader-with-pos example
         MethodHandle compare = LOOKUP.findStatic(Objects.class, "compare", methodType(int.class, Object.class, Object.class, Comparator.class));
         MethodHandle compare2FromArray = compare.asSpreader(0, Object[].class, 2);
@@ -66,49 +68,43 @@ public class SpreadCollectTest {
         Comparator cmp = (a, b) -> a - b;
         assertTrue((int) compare2FromArray.invoke(Arrays.copyOfRange(ints, 0, 2), cmp) < 0);
         assertTrue((int) compare2FromArray.invoke(Arrays.copyOfRange(ints, 1, 3), cmp) > 0);
-        assertTrue((int) compare2FromArray.invoke(Arrays.copyOfRange(ints, 2, 4), cmp) == 0);
+        assertEquals(0, (int) compare2FromArray.invoke(Arrays.copyOfRange(ints, 2, 4), cmp));
     }
 
-    @DataProvider
     static Object[][] asSpreaderIllegalPositions() {
         return new Object[][]{{-7}, {3}, {19}};
     }
 
-    @Test(dataProvider = "asSpreaderIllegalPositions")
-    public static void testAsSpreaderIllegalPos(int p) throws Throwable {
-        boolean caught = false;
-        try {
-            SpreadCollect.MH_forSpreading.asSpreader(p, Object[].class, 3);
-        } catch (IllegalArgumentException iae) {
-            assertEquals("bad spread position", iae.getMessage());
-            caught = true;
-        }
-        assertTrue(caught);
-    }
-
-    @Test(expectedExceptions = {WrongMethodTypeException.class})
-    public static void testAsSpreaderIllegalMethodType() {
-        MethodHandle h = MethodHandles.dropArguments(MethodHandles.constant(String.class, ""), 0, int.class, int.class);
-        MethodHandle s = h.asSpreader(String[].class, 1);
-    }
-
-    @Test(expectedExceptions = {NullPointerException.class})
-    public static void testAsSpreaderNullArrayType() {
-        SpreadCollect.MH_forSpreading.asSpreader(null, 0);
-    }
-
-    @Test(expectedExceptions = {NullPointerException.class})
-    public static void testAsSpreaderNullArrayNonZeroLength() {
-        SpreadCollect.MH_forSpreading.asSpreader(null, 1);
-    }
-
-    @Test(expectedExceptions = {IllegalArgumentException.class})
-    public static void testAsSpreaderTooManyParams() throws Throwable {
-        SpreadCollect.MH_forSpreading.asSpreader(1, int[].class, 6);
+    @ParameterizedTest
+    @MethodSource("asSpreaderIllegalPositions")
+    public void testAsSpreaderIllegalPos(int p) throws Throwable {
+        var iae = assertThrows(IllegalArgumentException.class, () -> SpreadCollect.MH_forSpreading.asSpreader(p, Object[].class, 3));
+        assertEquals("bad spread position", iae.getMessage());
     }
 
     @Test
-    public static void testAsCollector() throws Throwable {
+    public void testAsSpreaderIllegalMethodType() {
+        MethodHandle h = MethodHandles.dropArguments(MethodHandles.constant(String.class, ""), 0, int.class, int.class);
+        assertThrows(WrongMethodTypeException.class, () -> h.asSpreader(String[].class, 1));
+    }
+
+    @Test
+    public void testAsSpreaderNullArrayType() {
+        assertThrows(NullPointerException.class, () -> SpreadCollect.MH_forSpreading.asSpreader(null, 0));
+    }
+
+    @Test
+    public void testAsSpreaderNullArrayNonZeroLength() {
+        assertThrows(NullPointerException.class, () -> SpreadCollect.MH_forSpreading.asSpreader(null, 1));
+    }
+
+    @Test
+    public void testAsSpreaderTooManyParams() throws Throwable {
+        assertThrows(IllegalArgumentException.class, () -> SpreadCollect.MH_forSpreading.asSpreader(1, int[].class, 6));
+    }
+
+    @Test
+    public void testAsCollector() throws Throwable {
         MethodHandle collector = SpreadCollect.MH_forCollecting.asCollector(1, int[].class, 1);
         assertEquals(SpreadCollect.MT_collector1, collector.type());
         assertEquals("A4B", (String) collector.invoke("A", 4, "B"));
@@ -121,7 +117,7 @@ public class SpreadCollectTest {
     }
 
     @Test
-    public static void testAsCollectorInvokeWithArguments() throws Throwable {
+    public void testAsCollectorInvokeWithArguments() throws Throwable {
         MethodHandle collector = SpreadCollect.MH_forCollecting.asCollector(1, int[].class, 1);
         assertEquals(SpreadCollect.MT_collector1, collector.type());
         assertEquals("A4B", (String) collector.invokeWithArguments("A", 4, "B"));
@@ -134,7 +130,7 @@ public class SpreadCollectTest {
     }
 
     @Test
-    public static void testAsCollectorLeading() throws Throwable {
+    public void testAsCollectorLeading() throws Throwable {
         MethodHandle collector = SpreadCollect.MH_forCollectingLeading.asCollector(0, int[].class, 1);
         assertEquals(SpreadCollect.MT_collectorLeading1, collector.type());
         assertEquals("7Q", (String) collector.invoke(7, "Q"));
@@ -147,7 +143,7 @@ public class SpreadCollectTest {
     }
 
     @Test
-    public static void testAsCollectorLeadingInvokeWithArguments() throws Throwable {
+    public void testAsCollectorLeadingInvokeWithArguments() throws Throwable {
         MethodHandle collector = SpreadCollect.MH_forCollectingLeading.asCollector(0, int[].class, 1);
         assertEquals(SpreadCollect.MT_collectorLeading1, collector.type());
         assertEquals("7Q", (String) collector.invokeWithArguments(7, "Q"));
@@ -160,31 +156,25 @@ public class SpreadCollectTest {
     }
 
     @Test
-    public static void testAsCollectorNone() throws Throwable {
+    public void testAsCollectorNone() throws Throwable {
         MethodHandle collector = SpreadCollect.MH_forCollecting.asCollector(1, int[].class, 0);
         assertEquals(SpreadCollect.MT_collector0, collector.type());
         assertEquals("AB", (String) collector.invoke("A", "B"));
     }
 
-    @DataProvider
     static Object[][] asCollectorIllegalPositions() {
         return new Object[][]{{-1}, {17}};
     }
 
-    @Test(dataProvider = "asCollectorIllegalPositions")
-    public static void testAsCollectorIllegalPos(int p) {
-        boolean caught = false;
-        try {
-            SpreadCollect.MH_forCollecting.asCollector(p, int[].class, 0);
-        } catch (IllegalArgumentException iae) {
-            assertEquals("bad collect position", iae.getMessage());
-            caught = true;
-        }
-        assertTrue(caught);
+    @ParameterizedTest
+    @MethodSource("asCollectorIllegalPositions")
+    public void testAsCollectorIllegalPos(int p) {
+        var iae = assertThrows(IllegalArgumentException.class, () -> SpreadCollect.MH_forCollecting.asCollector(p, int[].class, 0));
+        assertEquals("bad collect position", iae.getMessage());
     }
 
     @Test
-    public static void testAsCollectorExample() throws Throwable {
+    public void testAsCollectorExample() throws Throwable {
         // test the JavaDoc asCollector-with-pos example
         StringWriter swr = new StringWriter();
         MethodHandle swWrite = LOOKUP.
diff --git a/test/jdk/java/lang/invoke/TestVHInvokerCaching.java b/test/jdk/java/lang/invoke/TestVHInvokerCaching.java
index 0a1ae5914ca..e5c7d50daa7 100644
--- a/test/jdk/java/lang/invoke/TestVHInvokerCaching.java
+++ b/test/jdk/java/lang/invoke/TestVHInvokerCaching.java
@@ -23,12 +23,9 @@
 
 /* @test
  * @bug 8265079
- * @run testng/othervm -Xverify:all TestVHInvokerCaching
+ * @run junit/othervm -Xverify:all TestVHInvokerCaching
  */
 
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
@@ -37,12 +34,16 @@ import java.util.ArrayList;
 import java.util.List;
 
 import static java.lang.invoke.MethodHandles.lookup;
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 public class TestVHInvokerCaching {
 
-    @Test(dataProvider = "testHandles")
-    public static void testVHIInvokerCaching(VarHandle testHandle) throws Throwable {
+    @ParameterizedTest
+    @MethodSource("testHandles")
+    public void testVHIInvokerCaching(VarHandle testHandle) throws Throwable {
         for (VarHandle.AccessMode mode : VarHandle.AccessMode.values()) {
             MethodHandle handle1 = MethodHandles.varHandleInvoker(mode, testHandle.accessModeType(mode));
             MethodHandle handle2 = MethodHandles.varHandleInvoker(mode, testHandle.accessModeType(mode));
@@ -56,7 +57,6 @@ public class TestVHInvokerCaching {
         }
     }
 
-    @DataProvider
     public static Object[][] testHandles() throws NoSuchFieldException, IllegalAccessException {
         List testHandles = new ArrayList<>();
 
diff --git a/test/jdk/java/lang/invoke/ThrowExceptionsTest.java b/test/jdk/java/lang/invoke/ThrowExceptionsTest.java
index e12bb7040c4..627a056faec 100644
--- a/test/jdk/java/lang/invoke/ThrowExceptionsTest.java
+++ b/test/jdk/java/lang/invoke/ThrowExceptionsTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, 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
@@ -23,14 +23,11 @@
 
 /* @test
  * @summary unit tests for method handles which permute their arguments
- * @run testng test.java.lang.invoke.ThrowExceptionsTest
+ * @run junit test.java.lang.invoke.ThrowExceptionsTest
  */
 
 package test.java.lang.invoke;
 
-import org.testng.*;
-import org.testng.annotations.*;
-
 import java.util.*;
 import java.lang.reflect.*;
 
@@ -38,6 +35,10 @@ import java.lang.invoke.*;
 import static java.lang.invoke.MethodHandles.*;
 import static java.lang.invoke.MethodType.*;
 
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
+
 public class ThrowExceptionsTest {
     private static final Class CLASS = ThrowExceptionsTest.class;
     private static final Lookup LOOKUP = lookup();
@@ -51,7 +52,7 @@ public class ThrowExceptionsTest {
         // mostly call testWMTCallee, but sometimes call its void-returning variant
         MethodHandle mh = testWMTCallee();
         MethodHandle mh1 = mh.asType(mh.type().changeReturnType(void.class));
-        assert(mh1 != mh);
+        assertNotSame(mh, mh1);
         testWMT(mh, mh1, 1000);
     }
 
@@ -108,7 +109,7 @@ public class ThrowExceptionsTest {
         MethodHandle[] cell = { null };  // recursion point
         MethodHandle getCell = insertArguments(arrayElementGetter(cell.getClass()), 0, cell, 0);
         MethodHandle invokeCell = foldArguments(exactInvoker(cellType), getCell);
-        assert(invokeCell.type() == cellType);
+        assertSame(cellType, invokeCell.type());
         cell[0] = invokeCell;
         // make it conformable to any type:
         invokeCell = dropArguments(invokeCell, 0, Object[].class).asVarargsCollector(Object[].class);
@@ -189,7 +190,6 @@ public class ThrowExceptionsTest {
             try {
                 // FIXME: should not have to retype this
                 n = (int) mh.invokeExact((Object)this, "x");
-                assertEquals(n, i - catches);
                 // Using the exact type for this causes endless deopt due to
                 // 'non_cached_result' in SystemDictionary::find_method_handle_invoke.
                 // The problem is that the compiler thread needs to access a cached
@@ -198,7 +198,9 @@ public class ThrowExceptionsTest {
             } catch (Exception ex) {
                 savedEx = ex;
                 catches++;
+                continue;
             }
+            assertEquals(i - catches, n);
         }
         //VERBOSE: System.out.println("reps="+reps+" catches="+catches);
         return savedEx;
@@ -220,9 +222,4 @@ public class ThrowExceptionsTest {
         }
         return savedEx;
     }
-
-    private static void assertEquals(Object x, Object y) {
-        if (x == y || x != null && x.equals(y))  return;
-        throw new RuntimeException(x+" != "+y);
-    }
 }
diff --git a/test/jdk/java/lang/invoke/TryFinallyTest.java b/test/jdk/java/lang/invoke/TryFinallyTest.java
index 4a3c255201e..ebe276ede93 100644
--- a/test/jdk/java/lang/invoke/TryFinallyTest.java
+++ b/test/jdk/java/lang/invoke/TryFinallyTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, 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,7 +23,7 @@
 
 /* @test
  * @bug 8139885 8150824 8150825 8194238 8233920
- * @run testng/othervm -ea -esa -Xverify:all test.java.lang.invoke.TryFinallyTest
+ * @run junit/othervm -ea -esa -Xverify:all test.java.lang.invoke.TryFinallyTest
  */
 
 package test.java.lang.invoke;
@@ -35,9 +35,12 @@ import java.lang.invoke.MethodType;
 
 import static java.lang.invoke.MethodType.methodType;
 
-import static org.testng.AssertJUnit.*;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
-import org.testng.annotations.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 /**
  * Tests for the tryFinally method handle combinator introduced in JEP 274.
@@ -47,13 +50,12 @@ public class TryFinallyTest {
     static final Lookup LOOKUP = MethodHandles.lookup();
 
     @Test
-    public static void testTryFinally() throws Throwable {
+    public void testTryFinally() throws Throwable {
         MethodHandle hello = MethodHandles.tryFinally(TryFinally.MH_greet, TryFinally.MH_exclaim);
         assertEquals(TryFinally.MT_hello, hello.type());
         assertEquals("Hello, world!", hello.invoke("world"));
     }
 
-    @DataProvider
     static Object[][] tryFinallyArgs() {
         return new Object[][] {
                 { boolean.class, true },
@@ -68,8 +70,9 @@ public class TryFinallyTest {
         };
     }
 
-    @Test(dataProvider = "tryFinallyArgs")
-    public static void testTryFinally(Class argType, Object arg) throws Throwable {
+    @ParameterizedTest
+    @MethodSource("tryFinallyArgs")
+    public void testTryFinally(Class argType, Object arg) throws Throwable {
         MethodHandle identity = MethodHandles.identity(argType);
         MethodHandle tryFinally = MethodHandles.tryFinally(
                 identity,
@@ -78,31 +81,31 @@ public class TryFinallyTest {
         assertEquals(arg, tryFinally.invoke(arg));
     }
 
-    @Test(dataProvider = "tryFinallyArgs", expectedExceptions = TryFinally.T1.class)
-    public static void testTryFinallyException(Class argType, Object arg) throws Throwable {
+    @ParameterizedTest
+    @MethodSource("tryFinallyArgs")
+    public void testTryFinallyException(Class argType, Object arg) throws Throwable {
         MethodHandle identity = TryFinally.MH_throwingTargetIdentity.asType(methodType(argType, argType));
         MethodHandle tryFinally = MethodHandles.tryFinally(
                 identity,
                 MethodHandles.dropArguments(identity, 0, TryFinally.T1.class));
         assertEquals(methodType(argType, argType), tryFinally.type());
-        tryFinally.invoke(arg); // should throw
+        assertThrows(TryFinally.T1.class, () -> tryFinally.invoke(arg));
     }
 
     @Test
-    public static void testTryFinallyVoid() throws Throwable {
+    public void testTryFinallyVoid() throws Throwable {
         MethodHandle tfVoid = MethodHandles.tryFinally(TryFinally.MH_print, TryFinally.MH_printMore);
         assertEquals(TryFinally.MT_printHello, tfVoid.type());
         tfVoid.invoke("world");
     }
 
     @Test
-    public static void testTryFinallySublist() throws Throwable {
+    public void testTryFinallySublist() throws Throwable {
         MethodHandle helloMore = MethodHandles.tryFinally(TryFinally.MH_greetMore, TryFinally.MH_exclaimMore);
         assertEquals(TryFinally.MT_moreHello, helloMore.type());
         assertEquals("Hello, world and universe (but world first)!", helloMore.invoke("world", "universe"));
     }
 
-    @DataProvider
     static Object[][] omitTrailingArguments() {
         MethodHandle c = TryFinally.MH_voidCleanup;
         return new Object[][]{
@@ -114,13 +117,13 @@ public class TryFinallyTest {
         };
     }
 
-    @Test(dataProvider = "omitTrailingArguments")
-    public static void testTryFinallyOmitTrailingArguments(MethodHandle cleanup) throws Throwable {
+    @ParameterizedTest
+    @MethodSource("omitTrailingArguments")
+    public void testTryFinallyOmitTrailingArguments(MethodHandle cleanup) throws Throwable {
         MethodHandle tf = MethodHandles.tryFinally(TryFinally.MH_dummyTarget, cleanup);
         tf.invoke(1, 2L, "a", 23, 42L, "b");
     }
 
-    @DataProvider
     static Object[][] negativeTestData() {
         MethodHandle intid = MethodHandles.identity(int.class);
         MethodHandle intco = MethodHandles.constant(int.class, 0);
@@ -145,29 +148,18 @@ public class TryFinallyTest {
         };
     }
 
-    @Test(dataProvider = "negativeTestData")
-    public static void testTryFinallyNegative(MethodHandle target, MethodHandle cleanup, String expectedMessage) {
-        boolean caught = false;
-        try {
-            MethodHandles.tryFinally(target, cleanup);
-        } catch (IllegalArgumentException iae) {
-            assertEquals(expectedMessage, iae.getMessage());
-            caught = true;
-        }
-        assertTrue(caught);
+    @ParameterizedTest
+    @MethodSource("negativeTestData")
+    public void testTryFinallyNegative(MethodHandle target, MethodHandle cleanup, String expectedMessage) {
+        var iae = assertThrows(IllegalArgumentException.class, () -> MethodHandles.tryFinally(target, cleanup));
+        assertEquals(expectedMessage, iae.getMessage());
     }
 
     @Test
-    public static void testTryFinallyThrowableCheck() {
+    public void testTryFinallyThrowableCheck() {
         MethodHandle mh = MethodHandles.tryFinally(TryFinally.MH_throwingTarget,
                                                    TryFinally.MH_catchingCleanup);
-        try {
-            mh.invoke();
-            fail("ClassCastException expected");
-        } catch (Throwable t) {
-            assertTrue("Throwable not assignable to ClassCastException: " + t,
-                       ClassCastException.class.isAssignableFrom(t.getClass()));
-        }
+        assertThrows(ClassCastException.class, mh::invoke);
     }
 
     static class TryFinally {
diff --git a/test/jdk/java/lang/invoke/VarArgsTest.java b/test/jdk/java/lang/invoke/VarArgsTest.java
index bb17881b514..bcea9a0b54e 100644
--- a/test/jdk/java/lang/invoke/VarArgsTest.java
+++ b/test/jdk/java/lang/invoke/VarArgsTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 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
@@ -23,19 +23,18 @@
 
 /* @test
  * @summary unit tests for java.lang.invoke.MethodHandles
- * @run testng/othervm -ea -esa test.java.lang.invoke.VarArgsTest
+ * @run junit/othervm -ea -esa test.java.lang.invoke.VarArgsTest
  */
 package test.java.lang.invoke;
 
 import java.lang.invoke.MethodHandle;
-import java.lang.invoke.MethodHandles;
-import java.lang.invoke.MethodType;
 import java.util.Arrays;
 import java.util.List;
 import static java.lang.invoke.MethodHandles.*;
 import static java.lang.invoke.MethodType.*;
-import static org.testng.AssertJUnit.*;
-import org.testng.annotations.*;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
 
 public class VarArgsTest {
 
@@ -61,17 +60,17 @@ public class VarArgsTest {
         MethodHandle asList = publicLookup()
             .findStatic(Arrays.class, "asList", methodType(List.class, Object[].class));
         MethodHandle asListWithVarargs = asList.withVarargs(asList.isVarargsCollector());
-        assert(asListWithVarargs.isVarargsCollector());
+        assertTrue(asListWithVarargs.isVarargsCollector());
         assertEquals("[]", asListWithVarargs.invoke().toString());
         assertEquals("[1]", asListWithVarargs.invoke(1).toString());
         assertEquals("[two, too]", asListWithVarargs.invoke("two", "too").toString());
     }
 
-    @Test(expectedExceptions = { IllegalArgumentException.class })
+    @Test
     public void testWithVarargsIAE() throws Throwable {
         MethodHandle lenMH = publicLookup()
-            .findVirtual(String.class, "length", methodType(int.class));
-        MethodHandle lenMHWithVarargs = lenMH.withVarargs(true);
+                .findVirtual(String.class, "length", methodType(int.class));
+        assertThrows(IllegalArgumentException.class, () -> lenMH.withVarargs(true));
     }
 
 }
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleBaseByteArrayTest.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleBaseByteArrayTest.java
index f09ba518e48..c89fcc8289b 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleBaseByteArrayTest.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleBaseByteArrayTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,9 +21,6 @@
  * questions.
  */
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-
 import java.lang.invoke.VarHandle;
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
@@ -32,6 +29,7 @@ import java.util.Arrays;
 import java.util.EnumSet;
 import java.util.List;
 import java.util.function.Function;
+import org.junit.jupiter.api.BeforeAll;
 
 public abstract class VarHandleBaseByteArrayTest extends VarHandleBaseTest {
 
@@ -338,7 +336,7 @@ public abstract class VarHandleBaseByteArrayTest extends VarHandleBaseTest {
         bavss.add(dbb_offset_unaligned_ro);
     }
 
-    @BeforeClass
+    @BeforeAll
     public void setup() {
         setupByteSources();
         vhss = setupVarHandleSources(true);
@@ -346,13 +344,10 @@ public abstract class VarHandleBaseByteArrayTest extends VarHandleBaseTest {
 
     abstract List setupVarHandleSources(boolean same);
 
-
-    @DataProvider
     public Object[][] varHandlesProvider() throws Exception {
         return vhss.stream().map(cvh -> new Object[]{cvh}).toArray(Object[][]::new);
     }
 
-    @DataProvider
     public Object[][] typesProvider() throws Exception {
         List> aepts = Arrays.asList(byte[].class, int.class);
         List> bbpts = Arrays.asList(ByteBuffer.class, int.class);
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleBaseTest.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleBaseTest.java
index 0c9a7fd3953..0e029b8f5f7 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleBaseTest.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleBaseTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2023, 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
@@ -36,7 +36,7 @@ import java.util.Map;
 import java.util.stream.Stream;
 
 import static java.util.stream.Collectors.toList;
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
 
 abstract class VarHandleBaseTest {
     static final int ITERS = Integer.getInteger("iters", 1);
@@ -136,18 +136,7 @@ abstract class VarHandleBaseTest {
     static void checkWithThrowable(Class re,
                                    Object message,
                                    ThrowingRunnable r) {
-        Throwable _e = null;
-        try {
-            r.run();
-        }
-        catch (Throwable e) {
-            _e = e;
-        }
-        message = message == null ? "" : message + ". ";
-        assertNotNull(_e, String.format("%sNo throwable thrown. Expected %s", message, re));
-        if (!re.isInstance(_e)) {
-            fail(String.format("%sIncorrect throwable thrown, %s. Expected %s", message, _e, re), _e);
-        }
+        assertThrows(re, r::run, message == null ? null : message.toString());
     }
 
 
@@ -277,11 +266,11 @@ abstract class VarHandleBaseTest {
     }
 
     private static MethodHandle bind(VarHandle vh, MethodHandle mh, MethodType emt) {
-        assertEquals(mh.type(), emt.insertParameterTypes(0, VarHandle.class),
+        assertEquals(emt.insertParameterTypes(0, VarHandle.class), mh.type(),
                      "MethodHandle type differs from access mode type");
 
         MethodHandleInfo info = MethodHandles.lookup().revealDirect(mh);
-        assertEquals(info.getMethodType(), emt,
+        assertEquals(emt, info.getMethodType(),
                      "MethodHandleInfo method type differs from access mode type");
 
         return mh.bindTo(vh);
@@ -472,39 +461,39 @@ abstract class VarHandleBaseTest {
         for (TestAccessMode accessMode : testAccessModes()) {
             MethodType amt = vh.accessModeType(accessMode.toAccessMode());
 
-            assertEquals(amt.parameterList().subList(0, pts.size()), pts);
+            assertEquals(pts, amt.parameterList().subList(0, pts.size()));
         }
 
         for (TestAccessMode testAccessMode : testAccessModesOfType(TestAccessType.GET)) {
             MethodType mt = vh.accessModeType(testAccessMode.toAccessMode());
-            assertEquals(mt.returnType(), vh.varType());
-            assertEquals(mt.parameterList(), pts);
+            assertEquals(vh.varType(), mt.returnType());
+            assertEquals(pts, mt.parameterList());
         }
 
         for (TestAccessMode testAccessMode : testAccessModesOfType(TestAccessType.SET)) {
             MethodType mt = vh.accessModeType(testAccessMode.toAccessMode());
-            assertEquals(mt.returnType(), void.class);
-            assertEquals(mt.parameterType(mt.parameterCount() - 1), vh.varType());
+            assertEquals(void.class, mt.returnType());
+            assertEquals(vh.varType(), mt.parameterType(mt.parameterCount() - 1));
         }
 
         for (TestAccessMode testAccessMode : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) {
             MethodType mt = vh.accessModeType(testAccessMode.toAccessMode());
-            assertEquals(mt.returnType(), boolean.class);
-            assertEquals(mt.parameterType(mt.parameterCount() - 1), vh.varType());
-            assertEquals(mt.parameterType(mt.parameterCount() - 2), vh.varType());
+            assertEquals(boolean.class, mt.returnType());
+            assertEquals(vh.varType(), mt.parameterType(mt.parameterCount() - 1));
+            assertEquals(vh.varType(), mt.parameterType(mt.parameterCount() - 2));
         }
 
         for (TestAccessMode testAccessMode : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) {
             MethodType mt = vh.accessModeType(testAccessMode.toAccessMode());
-            assertEquals(mt.returnType(), vh.varType());
-            assertEquals(mt.parameterType(mt.parameterCount() - 1), vh.varType());
-            assertEquals(mt.parameterType(mt.parameterCount() - 2), vh.varType());
+            assertEquals(vh.varType(), mt.returnType());
+            assertEquals(vh.varType(), mt.parameterType(mt.parameterCount() - 1));
+            assertEquals(vh.varType(), mt.parameterType(mt.parameterCount() - 2));
         }
 
         for (TestAccessMode testAccessMode : testAccessModesOfType(TestAccessType.GET_AND_SET, TestAccessType.GET_AND_ADD)) {
             MethodType mt = vh.accessModeType(testAccessMode.toAccessMode());
-            assertEquals(mt.returnType(), vh.varType());
-            assertEquals(mt.parameterType(mt.parameterCount() - 1), vh.varType());
+            assertEquals(vh.varType(), mt.returnType());
+            assertEquals(vh.varType(), mt.parameterType(mt.parameterCount() - 1));
         }
     }
 
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleMethodReferenceTest.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleMethodReferenceTest.java
index 02de5a3e186..23e46096073 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleMethodReferenceTest.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleMethodReferenceTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 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
@@ -25,12 +25,12 @@
  * @test
  * @bug 8195650
  * @summary Test linking of method references to VarHandle access methods.
- * @run testng VarHandleMethodReferenceTest
+ * @run junit VarHandleMethodReferenceTest
  */
 
-import org.testng.annotations.Test;
 
 import java.lang.invoke.*;
+import org.junit.jupiter.api.Test;
 
 public class VarHandleMethodReferenceTest {
 
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java
index a9cd5a61655..548e008b09e 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,28 +23,30 @@
 
 /*
  * @test
- * @run testng/othervm -Diters=10   -Xint                                                   VarHandleTestAccessBoolean
+ * @run junit/othervm -Diters=10   -Xint                                                   VarHandleTestAccessBoolean
  *
  * @comment Set CompileThresholdScaling to 0.1 so that the warmup loop sets to 2000 iterations
  *          to hit compilation thresholds
  *
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestAccessBoolean
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestAccessBoolean
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestAccessBoolean
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestAccessBoolean
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestAccessBoolean
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestAccessBoolean
  */
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
     static final boolean static_final_v = true;
 
@@ -108,7 +110,7 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
         return vhs.toArray(new VarHandle[0]);
     }
 
-    @BeforeClass
+    @BeforeAll
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
                 VarHandleTestAccessBoolean.class, "final_v", boolean.class);
@@ -125,8 +127,6 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
         vhArray = MethodHandles.arrayElementVarHandle(boolean[].class);
     }
 
-
-    @DataProvider
     public Object[][] varHandlesProvider() throws Exception {
         List vhs = new ArrayList<>();
         vhs.add(vhField);
@@ -156,7 +156,8 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
         }
     }
 
-    @Test(dataProvider = "varHandlesProvider")
+    @ParameterizedTest
+    @MethodSource("varHandlesProvider")
     public void testIsAccessModeSupported(VarHandle vh) {
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
@@ -194,8 +195,6 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
     }
 
-
-    @DataProvider
     public Object[][] typesProvider() throws Exception {
         List types = new ArrayList<>();
         types.add(new Object[] {vhField, Arrays.asList(VarHandleTestAccessBoolean.class)});
@@ -205,16 +204,16 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
         return types.stream().toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "typesProvider")
+    @ParameterizedTest
+    @MethodSource("typesProvider")
     public void testTypes(VarHandle vh, List> pts) {
-        assertEquals(vh.varType(), boolean.class);
+        assertEquals(boolean.class, vh.varType());
 
-        assertEquals(vh.coordinateTypes(), pts);
+        assertEquals(pts, vh.coordinateTypes());
 
         testTypes(vh);
     }
 
-
     @Test
     public void testLookupInstanceToStatic() {
         checkIAE("Lookup of static final field to instance final field", () -> {
@@ -241,8 +240,6 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
         });
     }
 
-
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -284,7 +281,8 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -297,26 +295,26 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
         // Plain
         {
             boolean x = (boolean) vh.get(recv);
-            assertEquals(x, true, "get boolean value");
+            assertEquals(true, x, "get boolean value");
         }
 
 
         // Volatile
         {
             boolean x = (boolean) vh.getVolatile(recv);
-            assertEquals(x, true, "getVolatile boolean value");
+            assertEquals(true, x, "getVolatile boolean value");
         }
 
         // Lazy
         {
             boolean x = (boolean) vh.getAcquire(recv);
-            assertEquals(x, true, "getRelease boolean value");
+            assertEquals(true, x, "getRelease boolean value");
         }
 
         // Opaque
         {
             boolean x = (boolean) vh.getOpaque(recv);
-            assertEquals(x, true, "getOpaque boolean value");
+            assertEquals(true, x, "getOpaque boolean value");
         }
     }
 
@@ -357,26 +355,26 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
         // Plain
         {
             boolean x = (boolean) vh.get();
-            assertEquals(x, true, "get boolean value");
+            assertEquals(true, x, "get boolean value");
         }
 
 
         // Volatile
         {
             boolean x = (boolean) vh.getVolatile();
-            assertEquals(x, true, "getVolatile boolean value");
+            assertEquals(true, x, "getVolatile boolean value");
         }
 
         // Lazy
         {
             boolean x = (boolean) vh.getAcquire();
-            assertEquals(x, true, "getRelease boolean value");
+            assertEquals(true, x, "getRelease boolean value");
         }
 
         // Opaque
         {
             boolean x = (boolean) vh.getOpaque();
-            assertEquals(x, true, "getOpaque boolean value");
+            assertEquals(true, x, "getOpaque boolean value");
         }
     }
 
@@ -418,7 +416,7 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
         {
             vh.set(recv, true);
             boolean x = (boolean) vh.get(recv);
-            assertEquals(x, true, "set boolean value");
+            assertEquals(true, x, "set boolean value");
         }
 
 
@@ -426,21 +424,21 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
         {
             vh.setVolatile(recv, false);
             boolean x = (boolean) vh.getVolatile(recv);
-            assertEquals(x, false, "setVolatile boolean value");
+            assertEquals(false, x, "setVolatile boolean value");
         }
 
         // Lazy
         {
             vh.setRelease(recv, true);
             boolean x = (boolean) vh.getAcquire(recv);
-            assertEquals(x, true, "setRelease boolean value");
+            assertEquals(true, x, "setRelease boolean value");
         }
 
         // Opaque
         {
             vh.setOpaque(recv, false);
             boolean x = (boolean) vh.getOpaque(recv);
-            assertEquals(x, false, "setOpaque boolean value");
+            assertEquals(false, x, "setOpaque boolean value");
         }
 
         vh.set(recv, true);
@@ -450,56 +448,56 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
             boolean r = vh.compareAndSet(recv, true, false);
             assertEquals(r, true, "success compareAndSet boolean");
             boolean x = (boolean) vh.get(recv);
-            assertEquals(x, false, "success compareAndSet boolean value");
+            assertEquals(false, x, "success compareAndSet boolean value");
         }
 
         {
             boolean r = vh.compareAndSet(recv, true, false);
             assertEquals(r, false, "failing compareAndSet boolean");
             boolean x = (boolean) vh.get(recv);
-            assertEquals(x, false, "failing compareAndSet boolean value");
+            assertEquals(false, x, "failing compareAndSet boolean value");
         }
 
         {
             boolean r = (boolean) vh.compareAndExchange(recv, false, true);
             assertEquals(r, false, "success compareAndExchange boolean");
             boolean x = (boolean) vh.get(recv);
-            assertEquals(x, true, "success compareAndExchange boolean value");
+            assertEquals(true, x, "success compareAndExchange boolean value");
         }
 
         {
             boolean r = (boolean) vh.compareAndExchange(recv, false, false);
             assertEquals(r, true, "failing compareAndExchange boolean");
             boolean x = (boolean) vh.get(recv);
-            assertEquals(x, true, "failing compareAndExchange boolean value");
+            assertEquals(true, x, "failing compareAndExchange boolean value");
         }
 
         {
             boolean r = (boolean) vh.compareAndExchangeAcquire(recv, true, false);
             assertEquals(r, true, "success compareAndExchangeAcquire boolean");
             boolean x = (boolean) vh.get(recv);
-            assertEquals(x, false, "success compareAndExchangeAcquire boolean value");
+            assertEquals(false, x, "success compareAndExchangeAcquire boolean value");
         }
 
         {
             boolean r = (boolean) vh.compareAndExchangeAcquire(recv, true, false);
             assertEquals(r, false, "failing compareAndExchangeAcquire boolean");
             boolean x = (boolean) vh.get(recv);
-            assertEquals(x, false, "failing compareAndExchangeAcquire boolean value");
+            assertEquals(false, x, "failing compareAndExchangeAcquire boolean value");
         }
 
         {
             boolean r = (boolean) vh.compareAndExchangeRelease(recv, false, true);
             assertEquals(r, false, "success compareAndExchangeRelease boolean");
             boolean x = (boolean) vh.get(recv);
-            assertEquals(x, true, "success compareAndExchangeRelease boolean value");
+            assertEquals(true, x, "success compareAndExchangeRelease boolean value");
         }
 
         {
             boolean r = (boolean) vh.compareAndExchangeRelease(recv, false, false);
             assertEquals(r, true, "failing compareAndExchangeRelease boolean");
             boolean x = (boolean) vh.get(recv);
-            assertEquals(x, true, "failing compareAndExchangeRelease boolean value");
+            assertEquals(true, x, "failing compareAndExchangeRelease boolean value");
         }
 
         {
@@ -510,14 +508,14 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain boolean");
             boolean x = (boolean) vh.get(recv);
-            assertEquals(x, false, "success weakCompareAndSetPlain boolean value");
+            assertEquals(false, x, "success weakCompareAndSetPlain boolean value");
         }
 
         {
             boolean success = vh.weakCompareAndSetPlain(recv, true, false);
             assertEquals(success, false, "failing weakCompareAndSetPlain boolean");
             boolean x = (boolean) vh.get(recv);
-            assertEquals(x, false, "failing weakCompareAndSetPlain boolean value");
+            assertEquals(false, x, "failing weakCompareAndSetPlain boolean value");
         }
 
         {
@@ -528,14 +526,14 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire boolean");
             boolean x = (boolean) vh.get(recv);
-            assertEquals(x, true, "success weakCompareAndSetAcquire boolean");
+            assertEquals(true, x, "success weakCompareAndSetAcquire boolean");
         }
 
         {
             boolean success = vh.weakCompareAndSetAcquire(recv, false, false);
             assertEquals(success, false, "failing weakCompareAndSetAcquire boolean");
             boolean x = (boolean) vh.get(recv);
-            assertEquals(x, true, "failing weakCompareAndSetAcquire boolean value");
+            assertEquals(true, x, "failing weakCompareAndSetAcquire boolean value");
         }
 
         {
@@ -546,14 +544,14 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease boolean");
             boolean x = (boolean) vh.get(recv);
-            assertEquals(x, false, "success weakCompareAndSetRelease boolean");
+            assertEquals(false, x, "success weakCompareAndSetRelease boolean");
         }
 
         {
             boolean success = vh.weakCompareAndSetRelease(recv, true, false);
             assertEquals(success, false, "failing weakCompareAndSetRelease boolean");
             boolean x = (boolean) vh.get(recv);
-            assertEquals(x, false, "failing weakCompareAndSetRelease boolean value");
+            assertEquals(false, x, "failing weakCompareAndSetRelease boolean value");
         }
 
         {
@@ -564,14 +562,14 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet boolean");
             boolean x = (boolean) vh.get(recv);
-            assertEquals(x, true, "success weakCompareAndSet boolean value");
+            assertEquals(true, x, "success weakCompareAndSet boolean value");
         }
 
         {
             boolean success = vh.weakCompareAndSet(recv, false, false);
             assertEquals(success, false, "failing weakCompareAndSet boolean");
             boolean x = (boolean) vh.get(recv);
-            assertEquals(x, true, "failing weakCompareAndSet boolean value");
+            assertEquals(true, x, "failing weakCompareAndSet boolean value");
         }
 
         // Compare set and get
@@ -579,27 +577,27 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
             vh.set(recv, true);
 
             boolean o = (boolean) vh.getAndSet(recv, false);
-            assertEquals(o, true, "getAndSet boolean");
+            assertEquals(true, o, "getAndSet boolean");
             boolean x = (boolean) vh.get(recv);
-            assertEquals(x, false, "getAndSet boolean value");
+            assertEquals(false, x, "getAndSet boolean value");
         }
 
         {
             vh.set(recv, true);
 
             boolean o = (boolean) vh.getAndSetAcquire(recv, false);
-            assertEquals(o, true, "getAndSetAcquire boolean");
+            assertEquals(true, o, "getAndSetAcquire boolean");
             boolean x = (boolean) vh.get(recv);
-            assertEquals(x, false, "getAndSetAcquire boolean value");
+            assertEquals(false, x, "getAndSetAcquire boolean value");
         }
 
         {
             vh.set(recv, true);
 
             boolean o = (boolean) vh.getAndSetRelease(recv, false);
-            assertEquals(o, true, "getAndSetRelease boolean");
+            assertEquals(true, o, "getAndSetRelease boolean");
             boolean x = (boolean) vh.get(recv);
-            assertEquals(x, false, "getAndSetRelease boolean value");
+            assertEquals(false, x, "getAndSetRelease boolean value");
         }
 
 
@@ -608,27 +606,27 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
             vh.set(recv, true);
 
             boolean o = (boolean) vh.getAndBitwiseOr(recv, false);
-            assertEquals(o, true, "getAndBitwiseOr boolean");
+            assertEquals(true, o, "getAndBitwiseOr boolean");
             boolean x = (boolean) vh.get(recv);
-            assertEquals(x, (boolean)(true | false), "getAndBitwiseOr boolean value");
+            assertEquals((boolean)(true | false), x, "getAndBitwiseOr boolean value");
         }
 
         {
             vh.set(recv, true);
 
             boolean o = (boolean) vh.getAndBitwiseOrAcquire(recv, false);
-            assertEquals(o, true, "getAndBitwiseOrAcquire boolean");
+            assertEquals(true, o, "getAndBitwiseOrAcquire boolean");
             boolean x = (boolean) vh.get(recv);
-            assertEquals(x, (boolean)(true | false), "getAndBitwiseOrAcquire boolean value");
+            assertEquals((boolean)(true | false), x, "getAndBitwiseOrAcquire boolean value");
         }
 
         {
             vh.set(recv, true);
 
             boolean o = (boolean) vh.getAndBitwiseOrRelease(recv, false);
-            assertEquals(o, true, "getAndBitwiseOrRelease boolean");
+            assertEquals(true, o, "getAndBitwiseOrRelease boolean");
             boolean x = (boolean) vh.get(recv);
-            assertEquals(x, (boolean)(true | false), "getAndBitwiseOrRelease boolean value");
+            assertEquals((boolean)(true | false), x, "getAndBitwiseOrRelease boolean value");
         }
 
         // get and bitwise and
@@ -636,27 +634,27 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
             vh.set(recv, true);
 
             boolean o = (boolean) vh.getAndBitwiseAnd(recv, false);
-            assertEquals(o, true, "getAndBitwiseAnd boolean");
+            assertEquals(true, o, "getAndBitwiseAnd boolean");
             boolean x = (boolean) vh.get(recv);
-            assertEquals(x, (boolean)(true & false), "getAndBitwiseAnd boolean value");
+            assertEquals((boolean)(true & false), x, "getAndBitwiseAnd boolean value");
         }
 
         {
             vh.set(recv, true);
 
             boolean o = (boolean) vh.getAndBitwiseAndAcquire(recv, false);
-            assertEquals(o, true, "getAndBitwiseAndAcquire boolean");
+            assertEquals(true, o, "getAndBitwiseAndAcquire boolean");
             boolean x = (boolean) vh.get(recv);
-            assertEquals(x, (boolean)(true & false), "getAndBitwiseAndAcquire boolean value");
+            assertEquals((boolean)(true & false), x, "getAndBitwiseAndAcquire boolean value");
         }
 
         {
             vh.set(recv, true);
 
             boolean o = (boolean) vh.getAndBitwiseAndRelease(recv, false);
-            assertEquals(o, true, "getAndBitwiseAndRelease boolean");
+            assertEquals(true, o, "getAndBitwiseAndRelease boolean");
             boolean x = (boolean) vh.get(recv);
-            assertEquals(x, (boolean)(true & false), "getAndBitwiseAndRelease boolean value");
+            assertEquals((boolean)(true & false), x, "getAndBitwiseAndRelease boolean value");
         }
 
         // get and bitwise xor
@@ -664,27 +662,27 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
             vh.set(recv, true);
 
             boolean o = (boolean) vh.getAndBitwiseXor(recv, false);
-            assertEquals(o, true, "getAndBitwiseXor boolean");
+            assertEquals(true, o, "getAndBitwiseXor boolean");
             boolean x = (boolean) vh.get(recv);
-            assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXor boolean value");
+            assertEquals((boolean)(true ^ false), x, "getAndBitwiseXor boolean value");
         }
 
         {
             vh.set(recv, true);
 
             boolean o = (boolean) vh.getAndBitwiseXorAcquire(recv, false);
-            assertEquals(o, true, "getAndBitwiseXorAcquire boolean");
+            assertEquals(true, o, "getAndBitwiseXorAcquire boolean");
             boolean x = (boolean) vh.get(recv);
-            assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorAcquire boolean value");
+            assertEquals((boolean)(true ^ false), x, "getAndBitwiseXorAcquire boolean value");
         }
 
         {
             vh.set(recv, true);
 
             boolean o = (boolean) vh.getAndBitwiseXorRelease(recv, false);
-            assertEquals(o, true, "getAndBitwiseXorRelease boolean");
+            assertEquals(true, o, "getAndBitwiseXorRelease boolean");
             boolean x = (boolean) vh.get(recv);
-            assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorRelease boolean value");
+            assertEquals((boolean)(true ^ false), x, "getAndBitwiseXorRelease boolean value");
         }
     }
 
@@ -710,7 +708,7 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
         {
             vh.set(true);
             boolean x = (boolean) vh.get();
-            assertEquals(x, true, "set boolean value");
+            assertEquals(true, x, "set boolean value");
         }
 
 
@@ -718,21 +716,21 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
         {
             vh.setVolatile(false);
             boolean x = (boolean) vh.getVolatile();
-            assertEquals(x, false, "setVolatile boolean value");
+            assertEquals(false, x, "setVolatile boolean value");
         }
 
         // Lazy
         {
             vh.setRelease(true);
             boolean x = (boolean) vh.getAcquire();
-            assertEquals(x, true, "setRelease boolean value");
+            assertEquals(true, x, "setRelease boolean value");
         }
 
         // Opaque
         {
             vh.setOpaque(false);
             boolean x = (boolean) vh.getOpaque();
-            assertEquals(x, false, "setOpaque boolean value");
+            assertEquals(false, x, "setOpaque boolean value");
         }
 
         vh.set(true);
@@ -742,56 +740,56 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
             boolean r = vh.compareAndSet(true, false);
             assertEquals(r, true, "success compareAndSet boolean");
             boolean x = (boolean) vh.get();
-            assertEquals(x, false, "success compareAndSet boolean value");
+            assertEquals(false, x, "success compareAndSet boolean value");
         }
 
         {
             boolean r = vh.compareAndSet(true, false);
             assertEquals(r, false, "failing compareAndSet boolean");
             boolean x = (boolean) vh.get();
-            assertEquals(x, false, "failing compareAndSet boolean value");
+            assertEquals(false, x, "failing compareAndSet boolean value");
         }
 
         {
             boolean r = (boolean) vh.compareAndExchange(false, true);
             assertEquals(r, false, "success compareAndExchange boolean");
             boolean x = (boolean) vh.get();
-            assertEquals(x, true, "success compareAndExchange boolean value");
+            assertEquals(true, x, "success compareAndExchange boolean value");
         }
 
         {
             boolean r = (boolean) vh.compareAndExchange(false, false);
             assertEquals(r, true, "failing compareAndExchange boolean");
             boolean x = (boolean) vh.get();
-            assertEquals(x, true, "failing compareAndExchange boolean value");
+            assertEquals(true, x, "failing compareAndExchange boolean value");
         }
 
         {
             boolean r = (boolean) vh.compareAndExchangeAcquire(true, false);
             assertEquals(r, true, "success compareAndExchangeAcquire boolean");
             boolean x = (boolean) vh.get();
-            assertEquals(x, false, "success compareAndExchangeAcquire boolean value");
+            assertEquals(false, x, "success compareAndExchangeAcquire boolean value");
         }
 
         {
             boolean r = (boolean) vh.compareAndExchangeAcquire(true, false);
             assertEquals(r, false, "failing compareAndExchangeAcquire boolean");
             boolean x = (boolean) vh.get();
-            assertEquals(x, false, "failing compareAndExchangeAcquire boolean value");
+            assertEquals(false, x, "failing compareAndExchangeAcquire boolean value");
         }
 
         {
             boolean r = (boolean) vh.compareAndExchangeRelease(false, true);
             assertEquals(r, false, "success compareAndExchangeRelease boolean");
             boolean x = (boolean) vh.get();
-            assertEquals(x, true, "success compareAndExchangeRelease boolean value");
+            assertEquals(true, x, "success compareAndExchangeRelease boolean value");
         }
 
         {
             boolean r = (boolean) vh.compareAndExchangeRelease(false, false);
             assertEquals(r, true, "failing compareAndExchangeRelease boolean");
             boolean x = (boolean) vh.get();
-            assertEquals(x, true, "failing compareAndExchangeRelease boolean value");
+            assertEquals(true, x, "failing compareAndExchangeRelease boolean value");
         }
 
         {
@@ -802,14 +800,14 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain boolean");
             boolean x = (boolean) vh.get();
-            assertEquals(x, false, "success weakCompareAndSetPlain boolean value");
+            assertEquals(false, x, "success weakCompareAndSetPlain boolean value");
         }
 
         {
             boolean success = vh.weakCompareAndSetPlain(true, false);
             assertEquals(success, false, "failing weakCompareAndSetPlain boolean");
             boolean x = (boolean) vh.get();
-            assertEquals(x, false, "failing weakCompareAndSetPlain boolean value");
+            assertEquals(false, x, "failing weakCompareAndSetPlain boolean value");
         }
 
         {
@@ -820,14 +818,14 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire boolean");
             boolean x = (boolean) vh.get();
-            assertEquals(x, true, "success weakCompareAndSetAcquire boolean");
+            assertEquals(true, x, "success weakCompareAndSetAcquire boolean");
         }
 
         {
             boolean success = vh.weakCompareAndSetAcquire(false, false);
             assertEquals(success, false, "failing weakCompareAndSetAcquire boolean");
             boolean x = (boolean) vh.get();
-            assertEquals(x, true, "failing weakCompareAndSetAcquire boolean value");
+            assertEquals(true, x, "failing weakCompareAndSetAcquire boolean value");
         }
 
         {
@@ -838,14 +836,14 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease boolean");
             boolean x = (boolean) vh.get();
-            assertEquals(x, false, "success weakCompareAndSetRelease boolean");
+            assertEquals(false, x, "success weakCompareAndSetRelease boolean");
         }
 
         {
             boolean success = vh.weakCompareAndSetRelease(true, false);
             assertEquals(success, false, "failing weakCompareAndSetRelease boolean");
             boolean x = (boolean) vh.get();
-            assertEquals(x, false, "failing weakCompareAndSetRelease boolean value");
+            assertEquals(false, x, "failing weakCompareAndSetRelease boolean value");
         }
 
         {
@@ -856,14 +854,14 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet boolean");
             boolean x = (boolean) vh.get();
-            assertEquals(x, true, "success weakCompareAndSet boolean");
+            assertEquals(true, x, "success weakCompareAndSet boolean");
         }
 
         {
             boolean success = vh.weakCompareAndSet(false, false);
             assertEquals(success, false, "failing weakCompareAndSet boolean");
             boolean x = (boolean) vh.get();
-            assertEquals(x, true, "failing weakCompareAndSet boolean value");
+            assertEquals(true, x, "failing weakCompareAndSet boolean value");
         }
 
         // Compare set and get
@@ -871,27 +869,27 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
             vh.set(true);
 
             boolean o = (boolean) vh.getAndSet(false);
-            assertEquals(o, true, "getAndSet boolean");
+            assertEquals(true, o, "getAndSet boolean");
             boolean x = (boolean) vh.get();
-            assertEquals(x, false, "getAndSet boolean value");
+            assertEquals(false, x, "getAndSet boolean value");
         }
 
         {
             vh.set(true);
 
             boolean o = (boolean) vh.getAndSetAcquire(false);
-            assertEquals(o, true, "getAndSetAcquire boolean");
+            assertEquals(true, o, "getAndSetAcquire boolean");
             boolean x = (boolean) vh.get();
-            assertEquals(x, false, "getAndSetAcquire boolean value");
+            assertEquals(false, x, "getAndSetAcquire boolean value");
         }
 
         {
             vh.set(true);
 
             boolean o = (boolean) vh.getAndSetRelease(false);
-            assertEquals(o, true, "getAndSetRelease boolean");
+            assertEquals(true, o, "getAndSetRelease boolean");
             boolean x = (boolean) vh.get();
-            assertEquals(x, false, "getAndSetRelease boolean value");
+            assertEquals(false, x, "getAndSetRelease boolean value");
         }
 
 
@@ -900,27 +898,27 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
             vh.set(true);
 
             boolean o = (boolean) vh.getAndBitwiseOr(false);
-            assertEquals(o, true, "getAndBitwiseOr boolean");
+            assertEquals(true, o, "getAndBitwiseOr boolean");
             boolean x = (boolean) vh.get();
-            assertEquals(x, (boolean)(true | false), "getAndBitwiseOr boolean value");
+            assertEquals((boolean)(true | false), x, "getAndBitwiseOr boolean value");
         }
 
         {
             vh.set(true);
 
             boolean o = (boolean) vh.getAndBitwiseOrAcquire(false);
-            assertEquals(o, true, "getAndBitwiseOrAcquire boolean");
+            assertEquals(true, o, "getAndBitwiseOrAcquire boolean");
             boolean x = (boolean) vh.get();
-            assertEquals(x, (boolean)(true | false), "getAndBitwiseOrAcquire boolean value");
+            assertEquals((boolean)(true | false), x, "getAndBitwiseOrAcquire boolean value");
         }
 
         {
             vh.set(true);
 
             boolean o = (boolean) vh.getAndBitwiseOrRelease(false);
-            assertEquals(o, true, "getAndBitwiseOrRelease boolean");
+            assertEquals(true, o, "getAndBitwiseOrRelease boolean");
             boolean x = (boolean) vh.get();
-            assertEquals(x, (boolean)(true | false), "getAndBitwiseOrRelease boolean value");
+            assertEquals((boolean)(true | false), x, "getAndBitwiseOrRelease boolean value");
         }
 
         // get and bitwise and
@@ -928,27 +926,27 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
             vh.set(true);
 
             boolean o = (boolean) vh.getAndBitwiseAnd(false);
-            assertEquals(o, true, "getAndBitwiseAnd boolean");
+            assertEquals(true, o, "getAndBitwiseAnd boolean");
             boolean x = (boolean) vh.get();
-            assertEquals(x, (boolean)(true & false), "getAndBitwiseAnd boolean value");
+            assertEquals((boolean)(true & false), x, "getAndBitwiseAnd boolean value");
         }
 
         {
             vh.set(true);
 
             boolean o = (boolean) vh.getAndBitwiseAndAcquire(false);
-            assertEquals(o, true, "getAndBitwiseAndAcquire boolean");
+            assertEquals(true, o, "getAndBitwiseAndAcquire boolean");
             boolean x = (boolean) vh.get();
-            assertEquals(x, (boolean)(true & false), "getAndBitwiseAndAcquire boolean value");
+            assertEquals((boolean)(true & false), x, "getAndBitwiseAndAcquire boolean value");
         }
 
         {
             vh.set(true);
 
             boolean o = (boolean) vh.getAndBitwiseAndRelease(false);
-            assertEquals(o, true, "getAndBitwiseAndRelease boolean");
+            assertEquals(true, o, "getAndBitwiseAndRelease boolean");
             boolean x = (boolean) vh.get();
-            assertEquals(x, (boolean)(true & false), "getAndBitwiseAndRelease boolean value");
+            assertEquals((boolean)(true & false), x, "getAndBitwiseAndRelease boolean value");
         }
 
         // get and bitwise xor
@@ -956,27 +954,27 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
             vh.set(true);
 
             boolean o = (boolean) vh.getAndBitwiseXor(false);
-            assertEquals(o, true, "getAndBitwiseXor boolean");
+            assertEquals(true, o, "getAndBitwiseXor boolean");
             boolean x = (boolean) vh.get();
-            assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXor boolean value");
+            assertEquals((boolean)(true ^ false), x, "getAndBitwiseXor boolean value");
         }
 
         {
             vh.set(true);
 
             boolean o = (boolean) vh.getAndBitwiseXorAcquire(false);
-            assertEquals(o, true, "getAndBitwiseXorAcquire boolean");
+            assertEquals(true, o, "getAndBitwiseXorAcquire boolean");
             boolean x = (boolean) vh.get();
-            assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorAcquire boolean value");
+            assertEquals((boolean)(true ^ false), x, "getAndBitwiseXorAcquire boolean value");
         }
 
         {
             vh.set(true);
 
             boolean o = (boolean) vh.getAndBitwiseXorRelease(false);
-            assertEquals(o, true, "getAndBitwiseXorRelease boolean");
+            assertEquals(true, o, "getAndBitwiseXorRelease boolean");
             boolean x = (boolean) vh.get();
-            assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorRelease boolean value");
+            assertEquals((boolean)(true ^ false), x, "getAndBitwiseXorRelease boolean value");
         }
     }
 
@@ -1005,7 +1003,7 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
             {
                 vh.set(array, i, true);
                 boolean x = (boolean) vh.get(array, i);
-                assertEquals(x, true, "get boolean value");
+                assertEquals(true, x, "get boolean value");
             }
 
 
@@ -1013,21 +1011,21 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
             {
                 vh.setVolatile(array, i, false);
                 boolean x = (boolean) vh.getVolatile(array, i);
-                assertEquals(x, false, "setVolatile boolean value");
+                assertEquals(false, x, "setVolatile boolean value");
             }
 
             // Lazy
             {
                 vh.setRelease(array, i, true);
                 boolean x = (boolean) vh.getAcquire(array, i);
-                assertEquals(x, true, "setRelease boolean value");
+                assertEquals(true, x, "setRelease boolean value");
             }
 
             // Opaque
             {
                 vh.setOpaque(array, i, false);
                 boolean x = (boolean) vh.getOpaque(array, i);
-                assertEquals(x, false, "setOpaque boolean value");
+                assertEquals(false, x, "setOpaque boolean value");
             }
 
             vh.set(array, i, true);
@@ -1037,56 +1035,56 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
                 boolean r = vh.compareAndSet(array, i, true, false);
                 assertEquals(r, true, "success compareAndSet boolean");
                 boolean x = (boolean) vh.get(array, i);
-                assertEquals(x, false, "success compareAndSet boolean value");
+                assertEquals(false, x, "success compareAndSet boolean value");
             }
 
             {
                 boolean r = vh.compareAndSet(array, i, true, false);
                 assertEquals(r, false, "failing compareAndSet boolean");
                 boolean x = (boolean) vh.get(array, i);
-                assertEquals(x, false, "failing compareAndSet boolean value");
+                assertEquals(false, x, "failing compareAndSet boolean value");
             }
 
             {
                 boolean r = (boolean) vh.compareAndExchange(array, i, false, true);
                 assertEquals(r, false, "success compareAndExchange boolean");
                 boolean x = (boolean) vh.get(array, i);
-                assertEquals(x, true, "success compareAndExchange boolean value");
+                assertEquals(true, x, "success compareAndExchange boolean value");
             }
 
             {
                 boolean r = (boolean) vh.compareAndExchange(array, i, false, false);
                 assertEquals(r, true, "failing compareAndExchange boolean");
                 boolean x = (boolean) vh.get(array, i);
-                assertEquals(x, true, "failing compareAndExchange boolean value");
+                assertEquals(true, x, "failing compareAndExchange boolean value");
             }
 
             {
                 boolean r = (boolean) vh.compareAndExchangeAcquire(array, i, true, false);
                 assertEquals(r, true, "success compareAndExchangeAcquire boolean");
                 boolean x = (boolean) vh.get(array, i);
-                assertEquals(x, false, "success compareAndExchangeAcquire boolean value");
+                assertEquals(false, x, "success compareAndExchangeAcquire boolean value");
             }
 
             {
                 boolean r = (boolean) vh.compareAndExchangeAcquire(array, i, true, false);
                 assertEquals(r, false, "failing compareAndExchangeAcquire boolean");
                 boolean x = (boolean) vh.get(array, i);
-                assertEquals(x, false, "failing compareAndExchangeAcquire boolean value");
+                assertEquals(false, x, "failing compareAndExchangeAcquire boolean value");
             }
 
             {
                 boolean r = (boolean) vh.compareAndExchangeRelease(array, i, false, true);
                 assertEquals(r, false, "success compareAndExchangeRelease boolean");
                 boolean x = (boolean) vh.get(array, i);
-                assertEquals(x, true, "success compareAndExchangeRelease boolean value");
+                assertEquals(true, x, "success compareAndExchangeRelease boolean value");
             }
 
             {
                 boolean r = (boolean) vh.compareAndExchangeRelease(array, i, false, false);
                 assertEquals(r, true, "failing compareAndExchangeRelease boolean");
                 boolean x = (boolean) vh.get(array, i);
-                assertEquals(x, true, "failing compareAndExchangeRelease boolean value");
+                assertEquals(true, x, "failing compareAndExchangeRelease boolean value");
             }
 
             {
@@ -1097,14 +1095,14 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetPlain boolean");
                 boolean x = (boolean) vh.get(array, i);
-                assertEquals(x, false, "success weakCompareAndSetPlain boolean value");
+                assertEquals(false, x, "success weakCompareAndSetPlain boolean value");
             }
 
             {
                 boolean success = vh.weakCompareAndSetPlain(array, i, true, false);
                 assertEquals(success, false, "failing weakCompareAndSetPlain boolean");
                 boolean x = (boolean) vh.get(array, i);
-                assertEquals(x, false, "failing weakCompareAndSetPlain boolean value");
+                assertEquals(false, x, "failing weakCompareAndSetPlain boolean value");
             }
 
             {
@@ -1115,14 +1113,14 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetAcquire boolean");
                 boolean x = (boolean) vh.get(array, i);
-                assertEquals(x, true, "success weakCompareAndSetAcquire boolean");
+                assertEquals(true, x, "success weakCompareAndSetAcquire boolean");
             }
 
             {
                 boolean success = vh.weakCompareAndSetAcquire(array, i, false, false);
                 assertEquals(success, false, "failing weakCompareAndSetAcquire boolean");
                 boolean x = (boolean) vh.get(array, i);
-                assertEquals(x, true, "failing weakCompareAndSetAcquire boolean value");
+                assertEquals(true, x, "failing weakCompareAndSetAcquire boolean value");
             }
 
             {
@@ -1133,14 +1131,14 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetRelease boolean");
                 boolean x = (boolean) vh.get(array, i);
-                assertEquals(x, false, "success weakCompareAndSetRelease boolean");
+                assertEquals(false, x, "success weakCompareAndSetRelease boolean");
             }
 
             {
                 boolean success = vh.weakCompareAndSetRelease(array, i, true, false);
                 assertEquals(success, false, "failing weakCompareAndSetRelease boolean");
                 boolean x = (boolean) vh.get(array, i);
-                assertEquals(x, false, "failing weakCompareAndSetRelease boolean value");
+                assertEquals(false, x, "failing weakCompareAndSetRelease boolean value");
             }
 
             {
@@ -1151,14 +1149,14 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSet boolean");
                 boolean x = (boolean) vh.get(array, i);
-                assertEquals(x, true, "success weakCompareAndSet boolean");
+                assertEquals(true, x, "success weakCompareAndSet boolean");
             }
 
             {
                 boolean success = vh.weakCompareAndSet(array, i, false, false);
                 assertEquals(success, false, "failing weakCompareAndSet boolean");
                 boolean x = (boolean) vh.get(array, i);
-                assertEquals(x, true, "failing weakCompareAndSet boolean value");
+                assertEquals(true, x, "failing weakCompareAndSet boolean value");
             }
 
             // Compare set and get
@@ -1166,27 +1164,27 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
                 vh.set(array, i, true);
 
                 boolean o = (boolean) vh.getAndSet(array, i, false);
-                assertEquals(o, true, "getAndSet boolean");
+                assertEquals(true, o, "getAndSet boolean");
                 boolean x = (boolean) vh.get(array, i);
-                assertEquals(x, false, "getAndSet boolean value");
+                assertEquals(false, x, "getAndSet boolean value");
             }
 
             {
                 vh.set(array, i, true);
 
                 boolean o = (boolean) vh.getAndSetAcquire(array, i, false);
-                assertEquals(o, true, "getAndSetAcquire boolean");
+                assertEquals(true, o, "getAndSetAcquire boolean");
                 boolean x = (boolean) vh.get(array, i);
-                assertEquals(x, false, "getAndSetAcquire boolean value");
+                assertEquals(false, x, "getAndSetAcquire boolean value");
             }
 
             {
                 vh.set(array, i, true);
 
                 boolean o = (boolean) vh.getAndSetRelease(array, i, false);
-                assertEquals(o, true, "getAndSetRelease boolean");
+                assertEquals(true, o, "getAndSetRelease boolean");
                 boolean x = (boolean) vh.get(array, i);
-                assertEquals(x, false, "getAndSetRelease boolean value");
+                assertEquals(false, x, "getAndSetRelease boolean value");
             }
 
 
@@ -1195,27 +1193,27 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
                 vh.set(array, i, true);
 
                 boolean o = (boolean) vh.getAndBitwiseOr(array, i, false);
-                assertEquals(o, true, "getAndBitwiseOr boolean");
+                assertEquals(true, o, "getAndBitwiseOr boolean");
                 boolean x = (boolean) vh.get(array, i);
-                assertEquals(x, (boolean)(true | false), "getAndBitwiseOr boolean value");
+                assertEquals((boolean)(true | false), x, "getAndBitwiseOr boolean value");
             }
 
             {
                 vh.set(array, i, true);
 
                 boolean o = (boolean) vh.getAndBitwiseOrAcquire(array, i, false);
-                assertEquals(o, true, "getAndBitwiseOrAcquire boolean");
+                assertEquals(true, o, "getAndBitwiseOrAcquire boolean");
                 boolean x = (boolean) vh.get(array, i);
-                assertEquals(x, (boolean)(true | false), "getAndBitwiseOrAcquire boolean value");
+                assertEquals((boolean)(true | false), x, "getAndBitwiseOrAcquire boolean value");
             }
 
             {
                 vh.set(array, i, true);
 
                 boolean o = (boolean) vh.getAndBitwiseOrRelease(array, i, false);
-                assertEquals(o, true, "getAndBitwiseOrRelease boolean");
+                assertEquals(true, o, "getAndBitwiseOrRelease boolean");
                 boolean x = (boolean) vh.get(array, i);
-                assertEquals(x, (boolean)(true | false), "getAndBitwiseOrRelease boolean value");
+                assertEquals((boolean)(true | false), x, "getAndBitwiseOrRelease boolean value");
             }
 
             // get and bitwise and
@@ -1223,27 +1221,27 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
                 vh.set(array, i, true);
 
                 boolean o = (boolean) vh.getAndBitwiseAnd(array, i, false);
-                assertEquals(o, true, "getAndBitwiseAnd boolean");
+                assertEquals(true, o, "getAndBitwiseAnd boolean");
                 boolean x = (boolean) vh.get(array, i);
-                assertEquals(x, (boolean)(true & false), "getAndBitwiseAnd boolean value");
+                assertEquals((boolean)(true & false), x, "getAndBitwiseAnd boolean value");
             }
 
             {
                 vh.set(array, i, true);
 
                 boolean o = (boolean) vh.getAndBitwiseAndAcquire(array, i, false);
-                assertEquals(o, true, "getAndBitwiseAndAcquire boolean");
+                assertEquals(true, o, "getAndBitwiseAndAcquire boolean");
                 boolean x = (boolean) vh.get(array, i);
-                assertEquals(x, (boolean)(true & false), "getAndBitwiseAndAcquire boolean value");
+                assertEquals((boolean)(true & false), x, "getAndBitwiseAndAcquire boolean value");
             }
 
             {
                 vh.set(array, i, true);
 
                 boolean o = (boolean) vh.getAndBitwiseAndRelease(array, i, false);
-                assertEquals(o, true, "getAndBitwiseAndRelease boolean");
+                assertEquals(true, o, "getAndBitwiseAndRelease boolean");
                 boolean x = (boolean) vh.get(array, i);
-                assertEquals(x, (boolean)(true & false), "getAndBitwiseAndRelease boolean value");
+                assertEquals((boolean)(true & false), x, "getAndBitwiseAndRelease boolean value");
             }
 
             // get and bitwise xor
@@ -1251,27 +1249,27 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
                 vh.set(array, i, true);
 
                 boolean o = (boolean) vh.getAndBitwiseXor(array, i, false);
-                assertEquals(o, true, "getAndBitwiseXor boolean");
+                assertEquals(true, o, "getAndBitwiseXor boolean");
                 boolean x = (boolean) vh.get(array, i);
-                assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXor boolean value");
+                assertEquals((boolean)(true ^ false), x, "getAndBitwiseXor boolean value");
             }
 
             {
                 vh.set(array, i, true);
 
                 boolean o = (boolean) vh.getAndBitwiseXorAcquire(array, i, false);
-                assertEquals(o, true, "getAndBitwiseXorAcquire boolean");
+                assertEquals(true, o, "getAndBitwiseXorAcquire boolean");
                 boolean x = (boolean) vh.get(array, i);
-                assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorAcquire boolean value");
+                assertEquals((boolean)(true ^ false), x, "getAndBitwiseXorAcquire boolean value");
             }
 
             {
                 vh.set(array, i, true);
 
                 boolean o = (boolean) vh.getAndBitwiseXorRelease(array, i, false);
-                assertEquals(o, true, "getAndBitwiseXorRelease boolean");
+                assertEquals(true, o, "getAndBitwiseXorRelease boolean");
                 boolean x = (boolean) vh.get(array, i);
-                assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorRelease boolean value");
+                assertEquals((boolean)(true ^ false), x, "getAndBitwiseXorRelease boolean value");
             }
         }
     }
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java
index 5dc4bf2d1d5..42c465af75e 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,28 +23,30 @@
 
 /*
  * @test
- * @run testng/othervm -Diters=10   -Xint                                                   VarHandleTestAccessByte
+ * @run junit/othervm -Diters=10   -Xint                                                   VarHandleTestAccessByte
  *
  * @comment Set CompileThresholdScaling to 0.1 so that the warmup loop sets to 2000 iterations
  *          to hit compilation thresholds
  *
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestAccessByte
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestAccessByte
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestAccessByte
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestAccessByte
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestAccessByte
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestAccessByte
  */
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestAccessByte extends VarHandleBaseTest {
     static final byte static_final_v = (byte)0x01;
 
@@ -108,7 +110,7 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
         return vhs.toArray(new VarHandle[0]);
     }
 
-    @BeforeClass
+    @BeforeAll
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
                 VarHandleTestAccessByte.class, "final_v", byte.class);
@@ -125,8 +127,6 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
         vhArray = MethodHandles.arrayElementVarHandle(byte[].class);
     }
 
-
-    @DataProvider
     public Object[][] varHandlesProvider() throws Exception {
         List vhs = new ArrayList<>();
         vhs.add(vhField);
@@ -156,7 +156,8 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
         }
     }
 
-    @Test(dataProvider = "varHandlesProvider")
+    @ParameterizedTest
+    @MethodSource("varHandlesProvider")
     public void testIsAccessModeSupported(VarHandle vh) {
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
@@ -194,8 +195,6 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
     }
 
-
-    @DataProvider
     public Object[][] typesProvider() throws Exception {
         List types = new ArrayList<>();
         types.add(new Object[] {vhField, Arrays.asList(VarHandleTestAccessByte.class)});
@@ -205,16 +204,16 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
         return types.stream().toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "typesProvider")
+    @ParameterizedTest
+    @MethodSource("typesProvider")
     public void testTypes(VarHandle vh, List> pts) {
-        assertEquals(vh.varType(), byte.class);
+        assertEquals(byte.class, vh.varType());
 
-        assertEquals(vh.coordinateTypes(), pts);
+        assertEquals(pts, vh.coordinateTypes());
 
         testTypes(vh);
     }
 
-
     @Test
     public void testLookupInstanceToStatic() {
         checkIAE("Lookup of static final field to instance final field", () -> {
@@ -241,8 +240,6 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
         });
     }
 
-
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -284,7 +281,8 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -297,26 +295,26 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
         // Plain
         {
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)0x01, "get byte value");
+            assertEquals((byte)0x01, x, "get byte value");
         }
 
 
         // Volatile
         {
             byte x = (byte) vh.getVolatile(recv);
-            assertEquals(x, (byte)0x01, "getVolatile byte value");
+            assertEquals((byte)0x01, x, "getVolatile byte value");
         }
 
         // Lazy
         {
             byte x = (byte) vh.getAcquire(recv);
-            assertEquals(x, (byte)0x01, "getRelease byte value");
+            assertEquals((byte)0x01, x, "getRelease byte value");
         }
 
         // Opaque
         {
             byte x = (byte) vh.getOpaque(recv);
-            assertEquals(x, (byte)0x01, "getOpaque byte value");
+            assertEquals((byte)0x01, x, "getOpaque byte value");
         }
     }
 
@@ -346,26 +344,26 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
         // Plain
         {
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)0x01, "get byte value");
+            assertEquals((byte)0x01, x, "get byte value");
         }
 
 
         // Volatile
         {
             byte x = (byte) vh.getVolatile();
-            assertEquals(x, (byte)0x01, "getVolatile byte value");
+            assertEquals((byte)0x01, x, "getVolatile byte value");
         }
 
         // Lazy
         {
             byte x = (byte) vh.getAcquire();
-            assertEquals(x, (byte)0x01, "getRelease byte value");
+            assertEquals((byte)0x01, x, "getRelease byte value");
         }
 
         // Opaque
         {
             byte x = (byte) vh.getOpaque();
-            assertEquals(x, (byte)0x01, "getOpaque byte value");
+            assertEquals((byte)0x01, x, "getOpaque byte value");
         }
     }
 
@@ -396,7 +394,7 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
         {
             vh.set(recv, (byte)0x01);
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)0x01, "set byte value");
+            assertEquals((byte)0x01, x, "set byte value");
         }
 
 
@@ -404,21 +402,21 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
         {
             vh.setVolatile(recv, (byte)0x23);
             byte x = (byte) vh.getVolatile(recv);
-            assertEquals(x, (byte)0x23, "setVolatile byte value");
+            assertEquals((byte)0x23, x, "setVolatile byte value");
         }
 
         // Lazy
         {
             vh.setRelease(recv, (byte)0x01);
             byte x = (byte) vh.getAcquire(recv);
-            assertEquals(x, (byte)0x01, "setRelease byte value");
+            assertEquals((byte)0x01, x, "setRelease byte value");
         }
 
         // Opaque
         {
             vh.setOpaque(recv, (byte)0x23);
             byte x = (byte) vh.getOpaque(recv);
-            assertEquals(x, (byte)0x23, "setOpaque byte value");
+            assertEquals((byte)0x23, x, "setOpaque byte value");
         }
 
         vh.set(recv, (byte)0x01);
@@ -428,56 +426,56 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
             boolean r = vh.compareAndSet(recv, (byte)0x01, (byte)0x23);
             assertEquals(r, true, "success compareAndSet byte");
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)0x23, "success compareAndSet byte value");
+            assertEquals((byte)0x23, x, "success compareAndSet byte value");
         }
 
         {
             boolean r = vh.compareAndSet(recv, (byte)0x01, (byte)0x45);
             assertEquals(r, false, "failing compareAndSet byte");
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)0x23, "failing compareAndSet byte value");
+            assertEquals((byte)0x23, x, "failing compareAndSet byte value");
         }
 
         {
             byte r = (byte) vh.compareAndExchange(recv, (byte)0x23, (byte)0x01);
             assertEquals(r, (byte)0x23, "success compareAndExchange byte");
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)0x01, "success compareAndExchange byte value");
+            assertEquals((byte)0x01, x, "success compareAndExchange byte value");
         }
 
         {
             byte r = (byte) vh.compareAndExchange(recv, (byte)0x23, (byte)0x45);
             assertEquals(r, (byte)0x01, "failing compareAndExchange byte");
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)0x01, "failing compareAndExchange byte value");
+            assertEquals((byte)0x01, x, "failing compareAndExchange byte value");
         }
 
         {
             byte r = (byte) vh.compareAndExchangeAcquire(recv, (byte)0x01, (byte)0x23);
             assertEquals(r, (byte)0x01, "success compareAndExchangeAcquire byte");
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)0x23, "success compareAndExchangeAcquire byte value");
+            assertEquals((byte)0x23, x, "success compareAndExchangeAcquire byte value");
         }
 
         {
             byte r = (byte) vh.compareAndExchangeAcquire(recv, (byte)0x01, (byte)0x45);
             assertEquals(r, (byte)0x23, "failing compareAndExchangeAcquire byte");
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)0x23, "failing compareAndExchangeAcquire byte value");
+            assertEquals((byte)0x23, x, "failing compareAndExchangeAcquire byte value");
         }
 
         {
             byte r = (byte) vh.compareAndExchangeRelease(recv, (byte)0x23, (byte)0x01);
             assertEquals(r, (byte)0x23, "success compareAndExchangeRelease byte");
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)0x01, "success compareAndExchangeRelease byte value");
+            assertEquals((byte)0x01, x, "success compareAndExchangeRelease byte value");
         }
 
         {
             byte r = (byte) vh.compareAndExchangeRelease(recv, (byte)0x23, (byte)0x45);
             assertEquals(r, (byte)0x01, "failing compareAndExchangeRelease byte");
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)0x01, "failing compareAndExchangeRelease byte value");
+            assertEquals((byte)0x01, x, "failing compareAndExchangeRelease byte value");
         }
 
         {
@@ -488,14 +486,14 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain byte");
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)0x23, "success weakCompareAndSetPlain byte value");
+            assertEquals((byte)0x23, x, "success weakCompareAndSetPlain byte value");
         }
 
         {
             boolean success = vh.weakCompareAndSetPlain(recv, (byte)0x01, (byte)0x45);
             assertEquals(success, false, "failing weakCompareAndSetPlain byte");
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)0x23, "failing weakCompareAndSetPlain byte value");
+            assertEquals((byte)0x23, x, "failing weakCompareAndSetPlain byte value");
         }
 
         {
@@ -506,14 +504,14 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire byte");
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)0x01, "success weakCompareAndSetAcquire byte");
+            assertEquals((byte)0x01, x, "success weakCompareAndSetAcquire byte");
         }
 
         {
             boolean success = vh.weakCompareAndSetAcquire(recv, (byte)0x23, (byte)0x45);
             assertEquals(success, false, "failing weakCompareAndSetAcquire byte");
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)0x01, "failing weakCompareAndSetAcquire byte value");
+            assertEquals((byte)0x01, x, "failing weakCompareAndSetAcquire byte value");
         }
 
         {
@@ -524,14 +522,14 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease byte");
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)0x23, "success weakCompareAndSetRelease byte");
+            assertEquals((byte)0x23, x, "success weakCompareAndSetRelease byte");
         }
 
         {
             boolean success = vh.weakCompareAndSetRelease(recv, (byte)0x01, (byte)0x45);
             assertEquals(success, false, "failing weakCompareAndSetRelease byte");
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)0x23, "failing weakCompareAndSetRelease byte value");
+            assertEquals((byte)0x23, x, "failing weakCompareAndSetRelease byte value");
         }
 
         {
@@ -542,14 +540,14 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet byte");
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)0x01, "success weakCompareAndSet byte value");
+            assertEquals((byte)0x01, x, "success weakCompareAndSet byte value");
         }
 
         {
             boolean success = vh.weakCompareAndSet(recv, (byte)0x23, (byte)0x45);
             assertEquals(success, false, "failing weakCompareAndSet byte");
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)0x01, "failing weakCompareAndSet byte value");
+            assertEquals((byte)0x01, x, "failing weakCompareAndSet byte value");
         }
 
         // Compare set and get
@@ -557,27 +555,27 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
             vh.set(recv, (byte)0x01);
 
             byte o = (byte) vh.getAndSet(recv, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndSet byte");
+            assertEquals((byte)0x01, o, "getAndSet byte");
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)0x23, "getAndSet byte value");
+            assertEquals((byte)0x23, x, "getAndSet byte value");
         }
 
         {
             vh.set(recv, (byte)0x01);
 
             byte o = (byte) vh.getAndSetAcquire(recv, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndSetAcquire byte");
+            assertEquals((byte)0x01, o, "getAndSetAcquire byte");
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)0x23, "getAndSetAcquire byte value");
+            assertEquals((byte)0x23, x, "getAndSetAcquire byte value");
         }
 
         {
             vh.set(recv, (byte)0x01);
 
             byte o = (byte) vh.getAndSetRelease(recv, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndSetRelease byte");
+            assertEquals((byte)0x01, o, "getAndSetRelease byte");
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)0x23, "getAndSetRelease byte value");
+            assertEquals((byte)0x23, x, "getAndSetRelease byte value");
         }
 
         // get and add, add and get
@@ -585,27 +583,27 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
             vh.set(recv, (byte)0x01);
 
             byte o = (byte) vh.getAndAdd(recv, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndAdd byte");
+            assertEquals((byte)0x01, o, "getAndAdd byte");
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAdd byte value");
+            assertEquals((byte)((byte)0x01 + (byte)0x23), x, "getAndAdd byte value");
         }
 
         {
             vh.set(recv, (byte)0x01);
 
             byte o = (byte) vh.getAndAddAcquire(recv, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndAddAcquire byte");
+            assertEquals((byte)0x01, o, "getAndAddAcquire byte");
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddAcquire byte value");
+            assertEquals((byte)((byte)0x01 + (byte)0x23), x, "getAndAddAcquire byte value");
         }
 
         {
             vh.set(recv, (byte)0x01);
 
             byte o = (byte) vh.getAndAddRelease(recv, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndAddReleasebyte");
+            assertEquals((byte)0x01, o, "getAndAddReleasebyte");
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddRelease byte value");
+            assertEquals((byte)((byte)0x01 + (byte)0x23), x, "getAndAddRelease byte value");
         }
 
         // get and bitwise or
@@ -613,27 +611,27 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
             vh.set(recv, (byte)0x01);
 
             byte o = (byte) vh.getAndBitwiseOr(recv, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseOr byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseOr byte");
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOr byte value");
+            assertEquals((byte)((byte)0x01 | (byte)0x23), x, "getAndBitwiseOr byte value");
         }
 
         {
             vh.set(recv, (byte)0x01);
 
             byte o = (byte) vh.getAndBitwiseOrAcquire(recv, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseOrAcquire byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseOrAcquire byte");
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrAcquire byte value");
+            assertEquals((byte)((byte)0x01 | (byte)0x23), x, "getAndBitwiseOrAcquire byte value");
         }
 
         {
             vh.set(recv, (byte)0x01);
 
             byte o = (byte) vh.getAndBitwiseOrRelease(recv, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseOrRelease byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseOrRelease byte");
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrRelease byte value");
+            assertEquals((byte)((byte)0x01 | (byte)0x23), x, "getAndBitwiseOrRelease byte value");
         }
 
         // get and bitwise and
@@ -641,27 +639,27 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
             vh.set(recv, (byte)0x01);
 
             byte o = (byte) vh.getAndBitwiseAnd(recv, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseAnd byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseAnd byte");
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAnd byte value");
+            assertEquals((byte)((byte)0x01 & (byte)0x23), x, "getAndBitwiseAnd byte value");
         }
 
         {
             vh.set(recv, (byte)0x01);
 
             byte o = (byte) vh.getAndBitwiseAndAcquire(recv, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseAndAcquire byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseAndAcquire byte");
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndAcquire byte value");
+            assertEquals((byte)((byte)0x01 & (byte)0x23), x, "getAndBitwiseAndAcquire byte value");
         }
 
         {
             vh.set(recv, (byte)0x01);
 
             byte o = (byte) vh.getAndBitwiseAndRelease(recv, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseAndRelease byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseAndRelease byte");
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndRelease byte value");
+            assertEquals((byte)((byte)0x01 & (byte)0x23), x, "getAndBitwiseAndRelease byte value");
         }
 
         // get and bitwise xor
@@ -669,27 +667,27 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
             vh.set(recv, (byte)0x01);
 
             byte o = (byte) vh.getAndBitwiseXor(recv, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseXor byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseXor byte");
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXor byte value");
+            assertEquals((byte)((byte)0x01 ^ (byte)0x23), x, "getAndBitwiseXor byte value");
         }
 
         {
             vh.set(recv, (byte)0x01);
 
             byte o = (byte) vh.getAndBitwiseXorAcquire(recv, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseXorAcquire byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseXorAcquire byte");
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorAcquire byte value");
+            assertEquals((byte)((byte)0x01 ^ (byte)0x23), x, "getAndBitwiseXorAcquire byte value");
         }
 
         {
             vh.set(recv, (byte)0x01);
 
             byte o = (byte) vh.getAndBitwiseXorRelease(recv, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseXorRelease byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseXorRelease byte");
             byte x = (byte) vh.get(recv);
-            assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorRelease byte value");
+            assertEquals((byte)((byte)0x01 ^ (byte)0x23), x, "getAndBitwiseXorRelease byte value");
         }
     }
 
@@ -704,7 +702,7 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
         {
             vh.set((byte)0x01);
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)0x01, "set byte value");
+            assertEquals((byte)0x01, x, "set byte value");
         }
 
 
@@ -712,21 +710,21 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
         {
             vh.setVolatile((byte)0x23);
             byte x = (byte) vh.getVolatile();
-            assertEquals(x, (byte)0x23, "setVolatile byte value");
+            assertEquals((byte)0x23, x, "setVolatile byte value");
         }
 
         // Lazy
         {
             vh.setRelease((byte)0x01);
             byte x = (byte) vh.getAcquire();
-            assertEquals(x, (byte)0x01, "setRelease byte value");
+            assertEquals((byte)0x01, x, "setRelease byte value");
         }
 
         // Opaque
         {
             vh.setOpaque((byte)0x23);
             byte x = (byte) vh.getOpaque();
-            assertEquals(x, (byte)0x23, "setOpaque byte value");
+            assertEquals((byte)0x23, x, "setOpaque byte value");
         }
 
         vh.set((byte)0x01);
@@ -736,56 +734,56 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
             boolean r = vh.compareAndSet((byte)0x01, (byte)0x23);
             assertEquals(r, true, "success compareAndSet byte");
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)0x23, "success compareAndSet byte value");
+            assertEquals((byte)0x23, x, "success compareAndSet byte value");
         }
 
         {
             boolean r = vh.compareAndSet((byte)0x01, (byte)0x45);
             assertEquals(r, false, "failing compareAndSet byte");
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)0x23, "failing compareAndSet byte value");
+            assertEquals((byte)0x23, x, "failing compareAndSet byte value");
         }
 
         {
             byte r = (byte) vh.compareAndExchange((byte)0x23, (byte)0x01);
             assertEquals(r, (byte)0x23, "success compareAndExchange byte");
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)0x01, "success compareAndExchange byte value");
+            assertEquals((byte)0x01, x, "success compareAndExchange byte value");
         }
 
         {
             byte r = (byte) vh.compareAndExchange((byte)0x23, (byte)0x45);
             assertEquals(r, (byte)0x01, "failing compareAndExchange byte");
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)0x01, "failing compareAndExchange byte value");
+            assertEquals((byte)0x01, x, "failing compareAndExchange byte value");
         }
 
         {
             byte r = (byte) vh.compareAndExchangeAcquire((byte)0x01, (byte)0x23);
             assertEquals(r, (byte)0x01, "success compareAndExchangeAcquire byte");
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)0x23, "success compareAndExchangeAcquire byte value");
+            assertEquals((byte)0x23, x, "success compareAndExchangeAcquire byte value");
         }
 
         {
             byte r = (byte) vh.compareAndExchangeAcquire((byte)0x01, (byte)0x45);
             assertEquals(r, (byte)0x23, "failing compareAndExchangeAcquire byte");
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)0x23, "failing compareAndExchangeAcquire byte value");
+            assertEquals((byte)0x23, x, "failing compareAndExchangeAcquire byte value");
         }
 
         {
             byte r = (byte) vh.compareAndExchangeRelease((byte)0x23, (byte)0x01);
             assertEquals(r, (byte)0x23, "success compareAndExchangeRelease byte");
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)0x01, "success compareAndExchangeRelease byte value");
+            assertEquals((byte)0x01, x, "success compareAndExchangeRelease byte value");
         }
 
         {
             byte r = (byte) vh.compareAndExchangeRelease((byte)0x23, (byte)0x45);
             assertEquals(r, (byte)0x01, "failing compareAndExchangeRelease byte");
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)0x01, "failing compareAndExchangeRelease byte value");
+            assertEquals((byte)0x01, x, "failing compareAndExchangeRelease byte value");
         }
 
         {
@@ -796,14 +794,14 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain byte");
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)0x23, "success weakCompareAndSetPlain byte value");
+            assertEquals((byte)0x23, x, "success weakCompareAndSetPlain byte value");
         }
 
         {
             boolean success = vh.weakCompareAndSetPlain((byte)0x01, (byte)0x45);
             assertEquals(success, false, "failing weakCompareAndSetPlain byte");
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)0x23, "failing weakCompareAndSetPlain byte value");
+            assertEquals((byte)0x23, x, "failing weakCompareAndSetPlain byte value");
         }
 
         {
@@ -814,14 +812,14 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire byte");
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)0x01, "success weakCompareAndSetAcquire byte");
+            assertEquals((byte)0x01, x, "success weakCompareAndSetAcquire byte");
         }
 
         {
             boolean success = vh.weakCompareAndSetAcquire((byte)0x23, (byte)0x45);
             assertEquals(success, false, "failing weakCompareAndSetAcquire byte");
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)0x01, "failing weakCompareAndSetAcquire byte value");
+            assertEquals((byte)0x01, x, "failing weakCompareAndSetAcquire byte value");
         }
 
         {
@@ -832,14 +830,14 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease byte");
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)0x23, "success weakCompareAndSetRelease byte");
+            assertEquals((byte)0x23, x, "success weakCompareAndSetRelease byte");
         }
 
         {
             boolean success = vh.weakCompareAndSetRelease((byte)0x01, (byte)0x45);
             assertEquals(success, false, "failing weakCompareAndSetRelease byte");
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)0x23, "failing weakCompareAndSetRelease byte value");
+            assertEquals((byte)0x23, x, "failing weakCompareAndSetRelease byte value");
         }
 
         {
@@ -850,14 +848,14 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet byte");
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)0x01, "success weakCompareAndSet byte");
+            assertEquals((byte)0x01, x, "success weakCompareAndSet byte");
         }
 
         {
             boolean success = vh.weakCompareAndSet((byte)0x23, (byte)0x45);
             assertEquals(success, false, "failing weakCompareAndSet byte");
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)0x01, "failing weakCompareAndSet byte value");
+            assertEquals((byte)0x01, x, "failing weakCompareAndSet byte value");
         }
 
         // Compare set and get
@@ -865,27 +863,27 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
             vh.set((byte)0x01);
 
             byte o = (byte) vh.getAndSet((byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndSet byte");
+            assertEquals((byte)0x01, o, "getAndSet byte");
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)0x23, "getAndSet byte value");
+            assertEquals((byte)0x23, x, "getAndSet byte value");
         }
 
         {
             vh.set((byte)0x01);
 
             byte o = (byte) vh.getAndSetAcquire((byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndSetAcquire byte");
+            assertEquals((byte)0x01, o, "getAndSetAcquire byte");
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)0x23, "getAndSetAcquire byte value");
+            assertEquals((byte)0x23, x, "getAndSetAcquire byte value");
         }
 
         {
             vh.set((byte)0x01);
 
             byte o = (byte) vh.getAndSetRelease((byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndSetRelease byte");
+            assertEquals((byte)0x01, o, "getAndSetRelease byte");
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)0x23, "getAndSetRelease byte value");
+            assertEquals((byte)0x23, x, "getAndSetRelease byte value");
         }
 
         // get and add, add and get
@@ -893,27 +891,27 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
             vh.set((byte)0x01);
 
             byte o = (byte) vh.getAndAdd((byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndAdd byte");
+            assertEquals((byte)0x01, o, "getAndAdd byte");
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAdd byte value");
+            assertEquals((byte)((byte)0x01 + (byte)0x23), x, "getAndAdd byte value");
         }
 
         {
             vh.set((byte)0x01);
 
             byte o = (byte) vh.getAndAddAcquire((byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndAddAcquire byte");
+            assertEquals((byte)0x01, o, "getAndAddAcquire byte");
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddAcquire byte value");
+            assertEquals((byte)((byte)0x01 + (byte)0x23), x, "getAndAddAcquire byte value");
         }
 
         {
             vh.set((byte)0x01);
 
             byte o = (byte) vh.getAndAddRelease((byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndAddReleasebyte");
+            assertEquals((byte)0x01, o, "getAndAddReleasebyte");
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddRelease byte value");
+            assertEquals((byte)((byte)0x01 + (byte)0x23), x, "getAndAddRelease byte value");
         }
 
         // get and bitwise or
@@ -921,27 +919,27 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
             vh.set((byte)0x01);
 
             byte o = (byte) vh.getAndBitwiseOr((byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseOr byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseOr byte");
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOr byte value");
+            assertEquals((byte)((byte)0x01 | (byte)0x23), x, "getAndBitwiseOr byte value");
         }
 
         {
             vh.set((byte)0x01);
 
             byte o = (byte) vh.getAndBitwiseOrAcquire((byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseOrAcquire byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseOrAcquire byte");
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrAcquire byte value");
+            assertEquals((byte)((byte)0x01 | (byte)0x23), x, "getAndBitwiseOrAcquire byte value");
         }
 
         {
             vh.set((byte)0x01);
 
             byte o = (byte) vh.getAndBitwiseOrRelease((byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseOrRelease byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseOrRelease byte");
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrRelease byte value");
+            assertEquals((byte)((byte)0x01 | (byte)0x23), x, "getAndBitwiseOrRelease byte value");
         }
 
         // get and bitwise and
@@ -949,27 +947,27 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
             vh.set((byte)0x01);
 
             byte o = (byte) vh.getAndBitwiseAnd((byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseAnd byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseAnd byte");
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAnd byte value");
+            assertEquals((byte)((byte)0x01 & (byte)0x23), x, "getAndBitwiseAnd byte value");
         }
 
         {
             vh.set((byte)0x01);
 
             byte o = (byte) vh.getAndBitwiseAndAcquire((byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseAndAcquire byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseAndAcquire byte");
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndAcquire byte value");
+            assertEquals((byte)((byte)0x01 & (byte)0x23), x, "getAndBitwiseAndAcquire byte value");
         }
 
         {
             vh.set((byte)0x01);
 
             byte o = (byte) vh.getAndBitwiseAndRelease((byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseAndRelease byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseAndRelease byte");
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndRelease byte value");
+            assertEquals((byte)((byte)0x01 & (byte)0x23), x, "getAndBitwiseAndRelease byte value");
         }
 
         // get and bitwise xor
@@ -977,27 +975,27 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
             vh.set((byte)0x01);
 
             byte o = (byte) vh.getAndBitwiseXor((byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseXor byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseXor byte");
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXor byte value");
+            assertEquals((byte)((byte)0x01 ^ (byte)0x23), x, "getAndBitwiseXor byte value");
         }
 
         {
             vh.set((byte)0x01);
 
             byte o = (byte) vh.getAndBitwiseXorAcquire((byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseXorAcquire byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseXorAcquire byte");
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorAcquire byte value");
+            assertEquals((byte)((byte)0x01 ^ (byte)0x23), x, "getAndBitwiseXorAcquire byte value");
         }
 
         {
             vh.set((byte)0x01);
 
             byte o = (byte) vh.getAndBitwiseXorRelease((byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseXorRelease byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseXorRelease byte");
             byte x = (byte) vh.get();
-            assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorRelease byte value");
+            assertEquals((byte)((byte)0x01 ^ (byte)0x23), x, "getAndBitwiseXorRelease byte value");
         }
     }
 
@@ -1015,7 +1013,7 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
             {
                 vh.set(array, i, (byte)0x01);
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)0x01, "get byte value");
+                assertEquals((byte)0x01, x, "get byte value");
             }
 
 
@@ -1023,21 +1021,21 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
             {
                 vh.setVolatile(array, i, (byte)0x23);
                 byte x = (byte) vh.getVolatile(array, i);
-                assertEquals(x, (byte)0x23, "setVolatile byte value");
+                assertEquals((byte)0x23, x, "setVolatile byte value");
             }
 
             // Lazy
             {
                 vh.setRelease(array, i, (byte)0x01);
                 byte x = (byte) vh.getAcquire(array, i);
-                assertEquals(x, (byte)0x01, "setRelease byte value");
+                assertEquals((byte)0x01, x, "setRelease byte value");
             }
 
             // Opaque
             {
                 vh.setOpaque(array, i, (byte)0x23);
                 byte x = (byte) vh.getOpaque(array, i);
-                assertEquals(x, (byte)0x23, "setOpaque byte value");
+                assertEquals((byte)0x23, x, "setOpaque byte value");
             }
 
             vh.set(array, i, (byte)0x01);
@@ -1047,56 +1045,56 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
                 boolean r = vh.compareAndSet(array, i, (byte)0x01, (byte)0x23);
                 assertEquals(r, true, "success compareAndSet byte");
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)0x23, "success compareAndSet byte value");
+                assertEquals((byte)0x23, x, "success compareAndSet byte value");
             }
 
             {
                 boolean r = vh.compareAndSet(array, i, (byte)0x01, (byte)0x45);
                 assertEquals(r, false, "failing compareAndSet byte");
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)0x23, "failing compareAndSet byte value");
+                assertEquals((byte)0x23, x, "failing compareAndSet byte value");
             }
 
             {
                 byte r = (byte) vh.compareAndExchange(array, i, (byte)0x23, (byte)0x01);
                 assertEquals(r, (byte)0x23, "success compareAndExchange byte");
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)0x01, "success compareAndExchange byte value");
+                assertEquals((byte)0x01, x, "success compareAndExchange byte value");
             }
 
             {
                 byte r = (byte) vh.compareAndExchange(array, i, (byte)0x23, (byte)0x45);
                 assertEquals(r, (byte)0x01, "failing compareAndExchange byte");
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)0x01, "failing compareAndExchange byte value");
+                assertEquals((byte)0x01, x, "failing compareAndExchange byte value");
             }
 
             {
                 byte r = (byte) vh.compareAndExchangeAcquire(array, i, (byte)0x01, (byte)0x23);
                 assertEquals(r, (byte)0x01, "success compareAndExchangeAcquire byte");
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)0x23, "success compareAndExchangeAcquire byte value");
+                assertEquals((byte)0x23, x, "success compareAndExchangeAcquire byte value");
             }
 
             {
                 byte r = (byte) vh.compareAndExchangeAcquire(array, i, (byte)0x01, (byte)0x45);
                 assertEquals(r, (byte)0x23, "failing compareAndExchangeAcquire byte");
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)0x23, "failing compareAndExchangeAcquire byte value");
+                assertEquals((byte)0x23, x, "failing compareAndExchangeAcquire byte value");
             }
 
             {
                 byte r = (byte) vh.compareAndExchangeRelease(array, i, (byte)0x23, (byte)0x01);
                 assertEquals(r, (byte)0x23, "success compareAndExchangeRelease byte");
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)0x01, "success compareAndExchangeRelease byte value");
+                assertEquals((byte)0x01, x, "success compareAndExchangeRelease byte value");
             }
 
             {
                 byte r = (byte) vh.compareAndExchangeRelease(array, i, (byte)0x23, (byte)0x45);
                 assertEquals(r, (byte)0x01, "failing compareAndExchangeRelease byte");
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)0x01, "failing compareAndExchangeRelease byte value");
+                assertEquals((byte)0x01, x, "failing compareAndExchangeRelease byte value");
             }
 
             {
@@ -1107,14 +1105,14 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetPlain byte");
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)0x23, "success weakCompareAndSetPlain byte value");
+                assertEquals((byte)0x23, x, "success weakCompareAndSetPlain byte value");
             }
 
             {
                 boolean success = vh.weakCompareAndSetPlain(array, i, (byte)0x01, (byte)0x45);
                 assertEquals(success, false, "failing weakCompareAndSetPlain byte");
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)0x23, "failing weakCompareAndSetPlain byte value");
+                assertEquals((byte)0x23, x, "failing weakCompareAndSetPlain byte value");
             }
 
             {
@@ -1125,14 +1123,14 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetAcquire byte");
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)0x01, "success weakCompareAndSetAcquire byte");
+                assertEquals((byte)0x01, x, "success weakCompareAndSetAcquire byte");
             }
 
             {
                 boolean success = vh.weakCompareAndSetAcquire(array, i, (byte)0x23, (byte)0x45);
                 assertEquals(success, false, "failing weakCompareAndSetAcquire byte");
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)0x01, "failing weakCompareAndSetAcquire byte value");
+                assertEquals((byte)0x01, x, "failing weakCompareAndSetAcquire byte value");
             }
 
             {
@@ -1143,14 +1141,14 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetRelease byte");
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)0x23, "success weakCompareAndSetRelease byte");
+                assertEquals((byte)0x23, x, "success weakCompareAndSetRelease byte");
             }
 
             {
                 boolean success = vh.weakCompareAndSetRelease(array, i, (byte)0x01, (byte)0x45);
                 assertEquals(success, false, "failing weakCompareAndSetRelease byte");
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)0x23, "failing weakCompareAndSetRelease byte value");
+                assertEquals((byte)0x23, x, "failing weakCompareAndSetRelease byte value");
             }
 
             {
@@ -1161,14 +1159,14 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSet byte");
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)0x01, "success weakCompareAndSet byte");
+                assertEquals((byte)0x01, x, "success weakCompareAndSet byte");
             }
 
             {
                 boolean success = vh.weakCompareAndSet(array, i, (byte)0x23, (byte)0x45);
                 assertEquals(success, false, "failing weakCompareAndSet byte");
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)0x01, "failing weakCompareAndSet byte value");
+                assertEquals((byte)0x01, x, "failing weakCompareAndSet byte value");
             }
 
             // Compare set and get
@@ -1176,27 +1174,27 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
                 vh.set(array, i, (byte)0x01);
 
                 byte o = (byte) vh.getAndSet(array, i, (byte)0x23);
-                assertEquals(o, (byte)0x01, "getAndSet byte");
+                assertEquals((byte)0x01, o, "getAndSet byte");
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)0x23, "getAndSet byte value");
+                assertEquals((byte)0x23, x, "getAndSet byte value");
             }
 
             {
                 vh.set(array, i, (byte)0x01);
 
                 byte o = (byte) vh.getAndSetAcquire(array, i, (byte)0x23);
-                assertEquals(o, (byte)0x01, "getAndSetAcquire byte");
+                assertEquals((byte)0x01, o, "getAndSetAcquire byte");
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)0x23, "getAndSetAcquire byte value");
+                assertEquals((byte)0x23, x, "getAndSetAcquire byte value");
             }
 
             {
                 vh.set(array, i, (byte)0x01);
 
                 byte o = (byte) vh.getAndSetRelease(array, i, (byte)0x23);
-                assertEquals(o, (byte)0x01, "getAndSetRelease byte");
+                assertEquals((byte)0x01, o, "getAndSetRelease byte");
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)0x23, "getAndSetRelease byte value");
+                assertEquals((byte)0x23, x, "getAndSetRelease byte value");
             }
 
             // get and add, add and get
@@ -1204,27 +1202,27 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
                 vh.set(array, i, (byte)0x01);
 
                 byte o = (byte) vh.getAndAdd(array, i, (byte)0x23);
-                assertEquals(o, (byte)0x01, "getAndAdd byte");
+                assertEquals((byte)0x01, o, "getAndAdd byte");
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAdd byte value");
+                assertEquals((byte)((byte)0x01 + (byte)0x23), x, "getAndAdd byte value");
             }
 
             {
                 vh.set(array, i, (byte)0x01);
 
                 byte o = (byte) vh.getAndAddAcquire(array, i, (byte)0x23);
-                assertEquals(o, (byte)0x01, "getAndAddAcquire byte");
+                assertEquals((byte)0x01, o, "getAndAddAcquire byte");
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddAcquire byte value");
+                assertEquals((byte)((byte)0x01 + (byte)0x23), x, "getAndAddAcquire byte value");
             }
 
             {
                 vh.set(array, i, (byte)0x01);
 
                 byte o = (byte) vh.getAndAddRelease(array, i, (byte)0x23);
-                assertEquals(o, (byte)0x01, "getAndAddReleasebyte");
+                assertEquals((byte)0x01, o, "getAndAddReleasebyte");
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddRelease byte value");
+                assertEquals((byte)((byte)0x01 + (byte)0x23), x, "getAndAddRelease byte value");
             }
 
             // get and bitwise or
@@ -1232,27 +1230,27 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
                 vh.set(array, i, (byte)0x01);
 
                 byte o = (byte) vh.getAndBitwiseOr(array, i, (byte)0x23);
-                assertEquals(o, (byte)0x01, "getAndBitwiseOr byte");
+                assertEquals((byte)0x01, o, "getAndBitwiseOr byte");
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOr byte value");
+                assertEquals((byte)((byte)0x01 | (byte)0x23), x, "getAndBitwiseOr byte value");
             }
 
             {
                 vh.set(array, i, (byte)0x01);
 
                 byte o = (byte) vh.getAndBitwiseOrAcquire(array, i, (byte)0x23);
-                assertEquals(o, (byte)0x01, "getAndBitwiseOrAcquire byte");
+                assertEquals((byte)0x01, o, "getAndBitwiseOrAcquire byte");
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrAcquire byte value");
+                assertEquals((byte)((byte)0x01 | (byte)0x23), x, "getAndBitwiseOrAcquire byte value");
             }
 
             {
                 vh.set(array, i, (byte)0x01);
 
                 byte o = (byte) vh.getAndBitwiseOrRelease(array, i, (byte)0x23);
-                assertEquals(o, (byte)0x01, "getAndBitwiseOrRelease byte");
+                assertEquals((byte)0x01, o, "getAndBitwiseOrRelease byte");
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrRelease byte value");
+                assertEquals((byte)((byte)0x01 | (byte)0x23), x, "getAndBitwiseOrRelease byte value");
             }
 
             // get and bitwise and
@@ -1260,27 +1258,27 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
                 vh.set(array, i, (byte)0x01);
 
                 byte o = (byte) vh.getAndBitwiseAnd(array, i, (byte)0x23);
-                assertEquals(o, (byte)0x01, "getAndBitwiseAnd byte");
+                assertEquals((byte)0x01, o, "getAndBitwiseAnd byte");
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAnd byte value");
+                assertEquals((byte)((byte)0x01 & (byte)0x23), x, "getAndBitwiseAnd byte value");
             }
 
             {
                 vh.set(array, i, (byte)0x01);
 
                 byte o = (byte) vh.getAndBitwiseAndAcquire(array, i, (byte)0x23);
-                assertEquals(o, (byte)0x01, "getAndBitwiseAndAcquire byte");
+                assertEquals((byte)0x01, o, "getAndBitwiseAndAcquire byte");
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndAcquire byte value");
+                assertEquals((byte)((byte)0x01 & (byte)0x23), x, "getAndBitwiseAndAcquire byte value");
             }
 
             {
                 vh.set(array, i, (byte)0x01);
 
                 byte o = (byte) vh.getAndBitwiseAndRelease(array, i, (byte)0x23);
-                assertEquals(o, (byte)0x01, "getAndBitwiseAndRelease byte");
+                assertEquals((byte)0x01, o, "getAndBitwiseAndRelease byte");
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndRelease byte value");
+                assertEquals((byte)((byte)0x01 & (byte)0x23), x, "getAndBitwiseAndRelease byte value");
             }
 
             // get and bitwise xor
@@ -1288,27 +1286,27 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
                 vh.set(array, i, (byte)0x01);
 
                 byte o = (byte) vh.getAndBitwiseXor(array, i, (byte)0x23);
-                assertEquals(o, (byte)0x01, "getAndBitwiseXor byte");
+                assertEquals((byte)0x01, o, "getAndBitwiseXor byte");
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXor byte value");
+                assertEquals((byte)((byte)0x01 ^ (byte)0x23), x, "getAndBitwiseXor byte value");
             }
 
             {
                 vh.set(array, i, (byte)0x01);
 
                 byte o = (byte) vh.getAndBitwiseXorAcquire(array, i, (byte)0x23);
-                assertEquals(o, (byte)0x01, "getAndBitwiseXorAcquire byte");
+                assertEquals((byte)0x01, o, "getAndBitwiseXorAcquire byte");
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorAcquire byte value");
+                assertEquals((byte)((byte)0x01 ^ (byte)0x23), x, "getAndBitwiseXorAcquire byte value");
             }
 
             {
                 vh.set(array, i, (byte)0x01);
 
                 byte o = (byte) vh.getAndBitwiseXorRelease(array, i, (byte)0x23);
-                assertEquals(o, (byte)0x01, "getAndBitwiseXorRelease byte");
+                assertEquals((byte)0x01, o, "getAndBitwiseXorRelease byte");
                 byte x = (byte) vh.get(array, i);
-                assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorRelease byte value");
+                assertEquals((byte)((byte)0x01 ^ (byte)0x23), x, "getAndBitwiseXorRelease byte value");
             }
         }
     }
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java
index bafde057167..e17e7616609 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,28 +23,30 @@
 
 /*
  * @test
- * @run testng/othervm -Diters=10   -Xint                                                   VarHandleTestAccessChar
+ * @run junit/othervm -Diters=10   -Xint                                                   VarHandleTestAccessChar
  *
  * @comment Set CompileThresholdScaling to 0.1 so that the warmup loop sets to 2000 iterations
  *          to hit compilation thresholds
  *
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestAccessChar
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestAccessChar
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestAccessChar
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestAccessChar
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestAccessChar
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestAccessChar
  */
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestAccessChar extends VarHandleBaseTest {
     static final char static_final_v = '\u0123';
 
@@ -108,7 +110,7 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
         return vhs.toArray(new VarHandle[0]);
     }
 
-    @BeforeClass
+    @BeforeAll
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
                 VarHandleTestAccessChar.class, "final_v", char.class);
@@ -125,8 +127,6 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
         vhArray = MethodHandles.arrayElementVarHandle(char[].class);
     }
 
-
-    @DataProvider
     public Object[][] varHandlesProvider() throws Exception {
         List vhs = new ArrayList<>();
         vhs.add(vhField);
@@ -156,7 +156,8 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
         }
     }
 
-    @Test(dataProvider = "varHandlesProvider")
+    @ParameterizedTest
+    @MethodSource("varHandlesProvider")
     public void testIsAccessModeSupported(VarHandle vh) {
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
@@ -194,8 +195,6 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
     }
 
-
-    @DataProvider
     public Object[][] typesProvider() throws Exception {
         List types = new ArrayList<>();
         types.add(new Object[] {vhField, Arrays.asList(VarHandleTestAccessChar.class)});
@@ -205,16 +204,16 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
         return types.stream().toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "typesProvider")
+    @ParameterizedTest
+    @MethodSource("typesProvider")
     public void testTypes(VarHandle vh, List> pts) {
-        assertEquals(vh.varType(), char.class);
+        assertEquals(char.class, vh.varType());
 
-        assertEquals(vh.coordinateTypes(), pts);
+        assertEquals(pts, vh.coordinateTypes());
 
         testTypes(vh);
     }
 
-
     @Test
     public void testLookupInstanceToStatic() {
         checkIAE("Lookup of static final field to instance final field", () -> {
@@ -241,8 +240,6 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
         });
     }
 
-
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -284,7 +281,8 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -297,26 +295,26 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
         // Plain
         {
             char x = (char) vh.get(recv);
-            assertEquals(x, '\u0123', "get char value");
+            assertEquals('\u0123', x, "get char value");
         }
 
 
         // Volatile
         {
             char x = (char) vh.getVolatile(recv);
-            assertEquals(x, '\u0123', "getVolatile char value");
+            assertEquals('\u0123', x, "getVolatile char value");
         }
 
         // Lazy
         {
             char x = (char) vh.getAcquire(recv);
-            assertEquals(x, '\u0123', "getRelease char value");
+            assertEquals('\u0123', x, "getRelease char value");
         }
 
         // Opaque
         {
             char x = (char) vh.getOpaque(recv);
-            assertEquals(x, '\u0123', "getOpaque char value");
+            assertEquals('\u0123', x, "getOpaque char value");
         }
     }
 
@@ -346,26 +344,26 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
         // Plain
         {
             char x = (char) vh.get();
-            assertEquals(x, '\u0123', "get char value");
+            assertEquals('\u0123', x, "get char value");
         }
 
 
         // Volatile
         {
             char x = (char) vh.getVolatile();
-            assertEquals(x, '\u0123', "getVolatile char value");
+            assertEquals('\u0123', x, "getVolatile char value");
         }
 
         // Lazy
         {
             char x = (char) vh.getAcquire();
-            assertEquals(x, '\u0123', "getRelease char value");
+            assertEquals('\u0123', x, "getRelease char value");
         }
 
         // Opaque
         {
             char x = (char) vh.getOpaque();
-            assertEquals(x, '\u0123', "getOpaque char value");
+            assertEquals('\u0123', x, "getOpaque char value");
         }
     }
 
@@ -396,7 +394,7 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
         {
             vh.set(recv, '\u0123');
             char x = (char) vh.get(recv);
-            assertEquals(x, '\u0123', "set char value");
+            assertEquals('\u0123', x, "set char value");
         }
 
 
@@ -404,21 +402,21 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
         {
             vh.setVolatile(recv, '\u4567');
             char x = (char) vh.getVolatile(recv);
-            assertEquals(x, '\u4567', "setVolatile char value");
+            assertEquals('\u4567', x, "setVolatile char value");
         }
 
         // Lazy
         {
             vh.setRelease(recv, '\u0123');
             char x = (char) vh.getAcquire(recv);
-            assertEquals(x, '\u0123', "setRelease char value");
+            assertEquals('\u0123', x, "setRelease char value");
         }
 
         // Opaque
         {
             vh.setOpaque(recv, '\u4567');
             char x = (char) vh.getOpaque(recv);
-            assertEquals(x, '\u4567', "setOpaque char value");
+            assertEquals('\u4567', x, "setOpaque char value");
         }
 
         vh.set(recv, '\u0123');
@@ -428,56 +426,56 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
             boolean r = vh.compareAndSet(recv, '\u0123', '\u4567');
             assertEquals(r, true, "success compareAndSet char");
             char x = (char) vh.get(recv);
-            assertEquals(x, '\u4567', "success compareAndSet char value");
+            assertEquals('\u4567', x, "success compareAndSet char value");
         }
 
         {
             boolean r = vh.compareAndSet(recv, '\u0123', '\u89AB');
             assertEquals(r, false, "failing compareAndSet char");
             char x = (char) vh.get(recv);
-            assertEquals(x, '\u4567', "failing compareAndSet char value");
+            assertEquals('\u4567', x, "failing compareAndSet char value");
         }
 
         {
             char r = (char) vh.compareAndExchange(recv, '\u4567', '\u0123');
             assertEquals(r, '\u4567', "success compareAndExchange char");
             char x = (char) vh.get(recv);
-            assertEquals(x, '\u0123', "success compareAndExchange char value");
+            assertEquals('\u0123', x, "success compareAndExchange char value");
         }
 
         {
             char r = (char) vh.compareAndExchange(recv, '\u4567', '\u89AB');
             assertEquals(r, '\u0123', "failing compareAndExchange char");
             char x = (char) vh.get(recv);
-            assertEquals(x, '\u0123', "failing compareAndExchange char value");
+            assertEquals('\u0123', x, "failing compareAndExchange char value");
         }
 
         {
             char r = (char) vh.compareAndExchangeAcquire(recv, '\u0123', '\u4567');
             assertEquals(r, '\u0123', "success compareAndExchangeAcquire char");
             char x = (char) vh.get(recv);
-            assertEquals(x, '\u4567', "success compareAndExchangeAcquire char value");
+            assertEquals('\u4567', x, "success compareAndExchangeAcquire char value");
         }
 
         {
             char r = (char) vh.compareAndExchangeAcquire(recv, '\u0123', '\u89AB');
             assertEquals(r, '\u4567', "failing compareAndExchangeAcquire char");
             char x = (char) vh.get(recv);
-            assertEquals(x, '\u4567', "failing compareAndExchangeAcquire char value");
+            assertEquals('\u4567', x, "failing compareAndExchangeAcquire char value");
         }
 
         {
             char r = (char) vh.compareAndExchangeRelease(recv, '\u4567', '\u0123');
             assertEquals(r, '\u4567', "success compareAndExchangeRelease char");
             char x = (char) vh.get(recv);
-            assertEquals(x, '\u0123', "success compareAndExchangeRelease char value");
+            assertEquals('\u0123', x, "success compareAndExchangeRelease char value");
         }
 
         {
             char r = (char) vh.compareAndExchangeRelease(recv, '\u4567', '\u89AB');
             assertEquals(r, '\u0123', "failing compareAndExchangeRelease char");
             char x = (char) vh.get(recv);
-            assertEquals(x, '\u0123', "failing compareAndExchangeRelease char value");
+            assertEquals('\u0123', x, "failing compareAndExchangeRelease char value");
         }
 
         {
@@ -488,14 +486,14 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain char");
             char x = (char) vh.get(recv);
-            assertEquals(x, '\u4567', "success weakCompareAndSetPlain char value");
+            assertEquals('\u4567', x, "success weakCompareAndSetPlain char value");
         }
 
         {
             boolean success = vh.weakCompareAndSetPlain(recv, '\u0123', '\u89AB');
             assertEquals(success, false, "failing weakCompareAndSetPlain char");
             char x = (char) vh.get(recv);
-            assertEquals(x, '\u4567', "failing weakCompareAndSetPlain char value");
+            assertEquals('\u4567', x, "failing weakCompareAndSetPlain char value");
         }
 
         {
@@ -506,14 +504,14 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire char");
             char x = (char) vh.get(recv);
-            assertEquals(x, '\u0123', "success weakCompareAndSetAcquire char");
+            assertEquals('\u0123', x, "success weakCompareAndSetAcquire char");
         }
 
         {
             boolean success = vh.weakCompareAndSetAcquire(recv, '\u4567', '\u89AB');
             assertEquals(success, false, "failing weakCompareAndSetAcquire char");
             char x = (char) vh.get(recv);
-            assertEquals(x, '\u0123', "failing weakCompareAndSetAcquire char value");
+            assertEquals('\u0123', x, "failing weakCompareAndSetAcquire char value");
         }
 
         {
@@ -524,14 +522,14 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease char");
             char x = (char) vh.get(recv);
-            assertEquals(x, '\u4567', "success weakCompareAndSetRelease char");
+            assertEquals('\u4567', x, "success weakCompareAndSetRelease char");
         }
 
         {
             boolean success = vh.weakCompareAndSetRelease(recv, '\u0123', '\u89AB');
             assertEquals(success, false, "failing weakCompareAndSetRelease char");
             char x = (char) vh.get(recv);
-            assertEquals(x, '\u4567', "failing weakCompareAndSetRelease char value");
+            assertEquals('\u4567', x, "failing weakCompareAndSetRelease char value");
         }
 
         {
@@ -542,14 +540,14 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet char");
             char x = (char) vh.get(recv);
-            assertEquals(x, '\u0123', "success weakCompareAndSet char value");
+            assertEquals('\u0123', x, "success weakCompareAndSet char value");
         }
 
         {
             boolean success = vh.weakCompareAndSet(recv, '\u4567', '\u89AB');
             assertEquals(success, false, "failing weakCompareAndSet char");
             char x = (char) vh.get(recv);
-            assertEquals(x, '\u0123', "failing weakCompareAndSet char value");
+            assertEquals('\u0123', x, "failing weakCompareAndSet char value");
         }
 
         // Compare set and get
@@ -557,27 +555,27 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
             vh.set(recv, '\u0123');
 
             char o = (char) vh.getAndSet(recv, '\u4567');
-            assertEquals(o, '\u0123', "getAndSet char");
+            assertEquals('\u0123', o, "getAndSet char");
             char x = (char) vh.get(recv);
-            assertEquals(x, '\u4567', "getAndSet char value");
+            assertEquals('\u4567', x, "getAndSet char value");
         }
 
         {
             vh.set(recv, '\u0123');
 
             char o = (char) vh.getAndSetAcquire(recv, '\u4567');
-            assertEquals(o, '\u0123', "getAndSetAcquire char");
+            assertEquals('\u0123', o, "getAndSetAcquire char");
             char x = (char) vh.get(recv);
-            assertEquals(x, '\u4567', "getAndSetAcquire char value");
+            assertEquals('\u4567', x, "getAndSetAcquire char value");
         }
 
         {
             vh.set(recv, '\u0123');
 
             char o = (char) vh.getAndSetRelease(recv, '\u4567');
-            assertEquals(o, '\u0123', "getAndSetRelease char");
+            assertEquals('\u0123', o, "getAndSetRelease char");
             char x = (char) vh.get(recv);
-            assertEquals(x, '\u4567', "getAndSetRelease char value");
+            assertEquals('\u4567', x, "getAndSetRelease char value");
         }
 
         // get and add, add and get
@@ -585,27 +583,27 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
             vh.set(recv, '\u0123');
 
             char o = (char) vh.getAndAdd(recv, '\u4567');
-            assertEquals(o, '\u0123', "getAndAdd char");
+            assertEquals('\u0123', o, "getAndAdd char");
             char x = (char) vh.get(recv);
-            assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAdd char value");
+            assertEquals((char)('\u0123' + '\u4567'), x, "getAndAdd char value");
         }
 
         {
             vh.set(recv, '\u0123');
 
             char o = (char) vh.getAndAddAcquire(recv, '\u4567');
-            assertEquals(o, '\u0123', "getAndAddAcquire char");
+            assertEquals('\u0123', o, "getAndAddAcquire char");
             char x = (char) vh.get(recv);
-            assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddAcquire char value");
+            assertEquals((char)('\u0123' + '\u4567'), x, "getAndAddAcquire char value");
         }
 
         {
             vh.set(recv, '\u0123');
 
             char o = (char) vh.getAndAddRelease(recv, '\u4567');
-            assertEquals(o, '\u0123', "getAndAddReleasechar");
+            assertEquals('\u0123', o, "getAndAddReleasechar");
             char x = (char) vh.get(recv);
-            assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddRelease char value");
+            assertEquals((char)('\u0123' + '\u4567'), x, "getAndAddRelease char value");
         }
 
         // get and bitwise or
@@ -613,27 +611,27 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
             vh.set(recv, '\u0123');
 
             char o = (char) vh.getAndBitwiseOr(recv, '\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseOr char");
+            assertEquals('\u0123', o, "getAndBitwiseOr char");
             char x = (char) vh.get(recv);
-            assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOr char value");
+            assertEquals((char)('\u0123' | '\u4567'), x, "getAndBitwiseOr char value");
         }
 
         {
             vh.set(recv, '\u0123');
 
             char o = (char) vh.getAndBitwiseOrAcquire(recv, '\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseOrAcquire char");
+            assertEquals('\u0123', o, "getAndBitwiseOrAcquire char");
             char x = (char) vh.get(recv);
-            assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrAcquire char value");
+            assertEquals((char)('\u0123' | '\u4567'), x, "getAndBitwiseOrAcquire char value");
         }
 
         {
             vh.set(recv, '\u0123');
 
             char o = (char) vh.getAndBitwiseOrRelease(recv, '\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseOrRelease char");
+            assertEquals('\u0123', o, "getAndBitwiseOrRelease char");
             char x = (char) vh.get(recv);
-            assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrRelease char value");
+            assertEquals((char)('\u0123' | '\u4567'), x, "getAndBitwiseOrRelease char value");
         }
 
         // get and bitwise and
@@ -641,27 +639,27 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
             vh.set(recv, '\u0123');
 
             char o = (char) vh.getAndBitwiseAnd(recv, '\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseAnd char");
+            assertEquals('\u0123', o, "getAndBitwiseAnd char");
             char x = (char) vh.get(recv);
-            assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAnd char value");
+            assertEquals((char)('\u0123' & '\u4567'), x, "getAndBitwiseAnd char value");
         }
 
         {
             vh.set(recv, '\u0123');
 
             char o = (char) vh.getAndBitwiseAndAcquire(recv, '\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseAndAcquire char");
+            assertEquals('\u0123', o, "getAndBitwiseAndAcquire char");
             char x = (char) vh.get(recv);
-            assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndAcquire char value");
+            assertEquals((char)('\u0123' & '\u4567'), x, "getAndBitwiseAndAcquire char value");
         }
 
         {
             vh.set(recv, '\u0123');
 
             char o = (char) vh.getAndBitwiseAndRelease(recv, '\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseAndRelease char");
+            assertEquals('\u0123', o, "getAndBitwiseAndRelease char");
             char x = (char) vh.get(recv);
-            assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndRelease char value");
+            assertEquals((char)('\u0123' & '\u4567'), x, "getAndBitwiseAndRelease char value");
         }
 
         // get and bitwise xor
@@ -669,27 +667,27 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
             vh.set(recv, '\u0123');
 
             char o = (char) vh.getAndBitwiseXor(recv, '\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseXor char");
+            assertEquals('\u0123', o, "getAndBitwiseXor char");
             char x = (char) vh.get(recv);
-            assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXor char value");
+            assertEquals((char)('\u0123' ^ '\u4567'), x, "getAndBitwiseXor char value");
         }
 
         {
             vh.set(recv, '\u0123');
 
             char o = (char) vh.getAndBitwiseXorAcquire(recv, '\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseXorAcquire char");
+            assertEquals('\u0123', o, "getAndBitwiseXorAcquire char");
             char x = (char) vh.get(recv);
-            assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorAcquire char value");
+            assertEquals((char)('\u0123' ^ '\u4567'), x, "getAndBitwiseXorAcquire char value");
         }
 
         {
             vh.set(recv, '\u0123');
 
             char o = (char) vh.getAndBitwiseXorRelease(recv, '\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseXorRelease char");
+            assertEquals('\u0123', o, "getAndBitwiseXorRelease char");
             char x = (char) vh.get(recv);
-            assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorRelease char value");
+            assertEquals((char)('\u0123' ^ '\u4567'), x, "getAndBitwiseXorRelease char value");
         }
     }
 
@@ -704,7 +702,7 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
         {
             vh.set('\u0123');
             char x = (char) vh.get();
-            assertEquals(x, '\u0123', "set char value");
+            assertEquals('\u0123', x, "set char value");
         }
 
 
@@ -712,21 +710,21 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
         {
             vh.setVolatile('\u4567');
             char x = (char) vh.getVolatile();
-            assertEquals(x, '\u4567', "setVolatile char value");
+            assertEquals('\u4567', x, "setVolatile char value");
         }
 
         // Lazy
         {
             vh.setRelease('\u0123');
             char x = (char) vh.getAcquire();
-            assertEquals(x, '\u0123', "setRelease char value");
+            assertEquals('\u0123', x, "setRelease char value");
         }
 
         // Opaque
         {
             vh.setOpaque('\u4567');
             char x = (char) vh.getOpaque();
-            assertEquals(x, '\u4567', "setOpaque char value");
+            assertEquals('\u4567', x, "setOpaque char value");
         }
 
         vh.set('\u0123');
@@ -736,56 +734,56 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
             boolean r = vh.compareAndSet('\u0123', '\u4567');
             assertEquals(r, true, "success compareAndSet char");
             char x = (char) vh.get();
-            assertEquals(x, '\u4567', "success compareAndSet char value");
+            assertEquals('\u4567', x, "success compareAndSet char value");
         }
 
         {
             boolean r = vh.compareAndSet('\u0123', '\u89AB');
             assertEquals(r, false, "failing compareAndSet char");
             char x = (char) vh.get();
-            assertEquals(x, '\u4567', "failing compareAndSet char value");
+            assertEquals('\u4567', x, "failing compareAndSet char value");
         }
 
         {
             char r = (char) vh.compareAndExchange('\u4567', '\u0123');
             assertEquals(r, '\u4567', "success compareAndExchange char");
             char x = (char) vh.get();
-            assertEquals(x, '\u0123', "success compareAndExchange char value");
+            assertEquals('\u0123', x, "success compareAndExchange char value");
         }
 
         {
             char r = (char) vh.compareAndExchange('\u4567', '\u89AB');
             assertEquals(r, '\u0123', "failing compareAndExchange char");
             char x = (char) vh.get();
-            assertEquals(x, '\u0123', "failing compareAndExchange char value");
+            assertEquals('\u0123', x, "failing compareAndExchange char value");
         }
 
         {
             char r = (char) vh.compareAndExchangeAcquire('\u0123', '\u4567');
             assertEquals(r, '\u0123', "success compareAndExchangeAcquire char");
             char x = (char) vh.get();
-            assertEquals(x, '\u4567', "success compareAndExchangeAcquire char value");
+            assertEquals('\u4567', x, "success compareAndExchangeAcquire char value");
         }
 
         {
             char r = (char) vh.compareAndExchangeAcquire('\u0123', '\u89AB');
             assertEquals(r, '\u4567', "failing compareAndExchangeAcquire char");
             char x = (char) vh.get();
-            assertEquals(x, '\u4567', "failing compareAndExchangeAcquire char value");
+            assertEquals('\u4567', x, "failing compareAndExchangeAcquire char value");
         }
 
         {
             char r = (char) vh.compareAndExchangeRelease('\u4567', '\u0123');
             assertEquals(r, '\u4567', "success compareAndExchangeRelease char");
             char x = (char) vh.get();
-            assertEquals(x, '\u0123', "success compareAndExchangeRelease char value");
+            assertEquals('\u0123', x, "success compareAndExchangeRelease char value");
         }
 
         {
             char r = (char) vh.compareAndExchangeRelease('\u4567', '\u89AB');
             assertEquals(r, '\u0123', "failing compareAndExchangeRelease char");
             char x = (char) vh.get();
-            assertEquals(x, '\u0123', "failing compareAndExchangeRelease char value");
+            assertEquals('\u0123', x, "failing compareAndExchangeRelease char value");
         }
 
         {
@@ -796,14 +794,14 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain char");
             char x = (char) vh.get();
-            assertEquals(x, '\u4567', "success weakCompareAndSetPlain char value");
+            assertEquals('\u4567', x, "success weakCompareAndSetPlain char value");
         }
 
         {
             boolean success = vh.weakCompareAndSetPlain('\u0123', '\u89AB');
             assertEquals(success, false, "failing weakCompareAndSetPlain char");
             char x = (char) vh.get();
-            assertEquals(x, '\u4567', "failing weakCompareAndSetPlain char value");
+            assertEquals('\u4567', x, "failing weakCompareAndSetPlain char value");
         }
 
         {
@@ -814,14 +812,14 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire char");
             char x = (char) vh.get();
-            assertEquals(x, '\u0123', "success weakCompareAndSetAcquire char");
+            assertEquals('\u0123', x, "success weakCompareAndSetAcquire char");
         }
 
         {
             boolean success = vh.weakCompareAndSetAcquire('\u4567', '\u89AB');
             assertEquals(success, false, "failing weakCompareAndSetAcquire char");
             char x = (char) vh.get();
-            assertEquals(x, '\u0123', "failing weakCompareAndSetAcquire char value");
+            assertEquals('\u0123', x, "failing weakCompareAndSetAcquire char value");
         }
 
         {
@@ -832,14 +830,14 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease char");
             char x = (char) vh.get();
-            assertEquals(x, '\u4567', "success weakCompareAndSetRelease char");
+            assertEquals('\u4567', x, "success weakCompareAndSetRelease char");
         }
 
         {
             boolean success = vh.weakCompareAndSetRelease('\u0123', '\u89AB');
             assertEquals(success, false, "failing weakCompareAndSetRelease char");
             char x = (char) vh.get();
-            assertEquals(x, '\u4567', "failing weakCompareAndSetRelease char value");
+            assertEquals('\u4567', x, "failing weakCompareAndSetRelease char value");
         }
 
         {
@@ -850,14 +848,14 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet char");
             char x = (char) vh.get();
-            assertEquals(x, '\u0123', "success weakCompareAndSet char");
+            assertEquals('\u0123', x, "success weakCompareAndSet char");
         }
 
         {
             boolean success = vh.weakCompareAndSet('\u4567', '\u89AB');
             assertEquals(success, false, "failing weakCompareAndSet char");
             char x = (char) vh.get();
-            assertEquals(x, '\u0123', "failing weakCompareAndSet char value");
+            assertEquals('\u0123', x, "failing weakCompareAndSet char value");
         }
 
         // Compare set and get
@@ -865,27 +863,27 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
             vh.set('\u0123');
 
             char o = (char) vh.getAndSet('\u4567');
-            assertEquals(o, '\u0123', "getAndSet char");
+            assertEquals('\u0123', o, "getAndSet char");
             char x = (char) vh.get();
-            assertEquals(x, '\u4567', "getAndSet char value");
+            assertEquals('\u4567', x, "getAndSet char value");
         }
 
         {
             vh.set('\u0123');
 
             char o = (char) vh.getAndSetAcquire('\u4567');
-            assertEquals(o, '\u0123', "getAndSetAcquire char");
+            assertEquals('\u0123', o, "getAndSetAcquire char");
             char x = (char) vh.get();
-            assertEquals(x, '\u4567', "getAndSetAcquire char value");
+            assertEquals('\u4567', x, "getAndSetAcquire char value");
         }
 
         {
             vh.set('\u0123');
 
             char o = (char) vh.getAndSetRelease('\u4567');
-            assertEquals(o, '\u0123', "getAndSetRelease char");
+            assertEquals('\u0123', o, "getAndSetRelease char");
             char x = (char) vh.get();
-            assertEquals(x, '\u4567', "getAndSetRelease char value");
+            assertEquals('\u4567', x, "getAndSetRelease char value");
         }
 
         // get and add, add and get
@@ -893,27 +891,27 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
             vh.set('\u0123');
 
             char o = (char) vh.getAndAdd('\u4567');
-            assertEquals(o, '\u0123', "getAndAdd char");
+            assertEquals('\u0123', o, "getAndAdd char");
             char x = (char) vh.get();
-            assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAdd char value");
+            assertEquals((char)('\u0123' + '\u4567'), x, "getAndAdd char value");
         }
 
         {
             vh.set('\u0123');
 
             char o = (char) vh.getAndAddAcquire('\u4567');
-            assertEquals(o, '\u0123', "getAndAddAcquire char");
+            assertEquals('\u0123', o, "getAndAddAcquire char");
             char x = (char) vh.get();
-            assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddAcquire char value");
+            assertEquals((char)('\u0123' + '\u4567'), x, "getAndAddAcquire char value");
         }
 
         {
             vh.set('\u0123');
 
             char o = (char) vh.getAndAddRelease('\u4567');
-            assertEquals(o, '\u0123', "getAndAddReleasechar");
+            assertEquals('\u0123', o, "getAndAddReleasechar");
             char x = (char) vh.get();
-            assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddRelease char value");
+            assertEquals((char)('\u0123' + '\u4567'), x, "getAndAddRelease char value");
         }
 
         // get and bitwise or
@@ -921,27 +919,27 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
             vh.set('\u0123');
 
             char o = (char) vh.getAndBitwiseOr('\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseOr char");
+            assertEquals('\u0123', o, "getAndBitwiseOr char");
             char x = (char) vh.get();
-            assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOr char value");
+            assertEquals((char)('\u0123' | '\u4567'), x, "getAndBitwiseOr char value");
         }
 
         {
             vh.set('\u0123');
 
             char o = (char) vh.getAndBitwiseOrAcquire('\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseOrAcquire char");
+            assertEquals('\u0123', o, "getAndBitwiseOrAcquire char");
             char x = (char) vh.get();
-            assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrAcquire char value");
+            assertEquals((char)('\u0123' | '\u4567'), x, "getAndBitwiseOrAcquire char value");
         }
 
         {
             vh.set('\u0123');
 
             char o = (char) vh.getAndBitwiseOrRelease('\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseOrRelease char");
+            assertEquals('\u0123', o, "getAndBitwiseOrRelease char");
             char x = (char) vh.get();
-            assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrRelease char value");
+            assertEquals((char)('\u0123' | '\u4567'), x, "getAndBitwiseOrRelease char value");
         }
 
         // get and bitwise and
@@ -949,27 +947,27 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
             vh.set('\u0123');
 
             char o = (char) vh.getAndBitwiseAnd('\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseAnd char");
+            assertEquals('\u0123', o, "getAndBitwiseAnd char");
             char x = (char) vh.get();
-            assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAnd char value");
+            assertEquals((char)('\u0123' & '\u4567'), x, "getAndBitwiseAnd char value");
         }
 
         {
             vh.set('\u0123');
 
             char o = (char) vh.getAndBitwiseAndAcquire('\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseAndAcquire char");
+            assertEquals('\u0123', o, "getAndBitwiseAndAcquire char");
             char x = (char) vh.get();
-            assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndAcquire char value");
+            assertEquals((char)('\u0123' & '\u4567'), x, "getAndBitwiseAndAcquire char value");
         }
 
         {
             vh.set('\u0123');
 
             char o = (char) vh.getAndBitwiseAndRelease('\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseAndRelease char");
+            assertEquals('\u0123', o, "getAndBitwiseAndRelease char");
             char x = (char) vh.get();
-            assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndRelease char value");
+            assertEquals((char)('\u0123' & '\u4567'), x, "getAndBitwiseAndRelease char value");
         }
 
         // get and bitwise xor
@@ -977,27 +975,27 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
             vh.set('\u0123');
 
             char o = (char) vh.getAndBitwiseXor('\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseXor char");
+            assertEquals('\u0123', o, "getAndBitwiseXor char");
             char x = (char) vh.get();
-            assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXor char value");
+            assertEquals((char)('\u0123' ^ '\u4567'), x, "getAndBitwiseXor char value");
         }
 
         {
             vh.set('\u0123');
 
             char o = (char) vh.getAndBitwiseXorAcquire('\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseXorAcquire char");
+            assertEquals('\u0123', o, "getAndBitwiseXorAcquire char");
             char x = (char) vh.get();
-            assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorAcquire char value");
+            assertEquals((char)('\u0123' ^ '\u4567'), x, "getAndBitwiseXorAcquire char value");
         }
 
         {
             vh.set('\u0123');
 
             char o = (char) vh.getAndBitwiseXorRelease('\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseXorRelease char");
+            assertEquals('\u0123', o, "getAndBitwiseXorRelease char");
             char x = (char) vh.get();
-            assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorRelease char value");
+            assertEquals((char)('\u0123' ^ '\u4567'), x, "getAndBitwiseXorRelease char value");
         }
     }
 
@@ -1015,7 +1013,7 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
             {
                 vh.set(array, i, '\u0123');
                 char x = (char) vh.get(array, i);
-                assertEquals(x, '\u0123', "get char value");
+                assertEquals('\u0123', x, "get char value");
             }
 
 
@@ -1023,21 +1021,21 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
             {
                 vh.setVolatile(array, i, '\u4567');
                 char x = (char) vh.getVolatile(array, i);
-                assertEquals(x, '\u4567', "setVolatile char value");
+                assertEquals('\u4567', x, "setVolatile char value");
             }
 
             // Lazy
             {
                 vh.setRelease(array, i, '\u0123');
                 char x = (char) vh.getAcquire(array, i);
-                assertEquals(x, '\u0123', "setRelease char value");
+                assertEquals('\u0123', x, "setRelease char value");
             }
 
             // Opaque
             {
                 vh.setOpaque(array, i, '\u4567');
                 char x = (char) vh.getOpaque(array, i);
-                assertEquals(x, '\u4567', "setOpaque char value");
+                assertEquals('\u4567', x, "setOpaque char value");
             }
 
             vh.set(array, i, '\u0123');
@@ -1047,56 +1045,56 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
                 boolean r = vh.compareAndSet(array, i, '\u0123', '\u4567');
                 assertEquals(r, true, "success compareAndSet char");
                 char x = (char) vh.get(array, i);
-                assertEquals(x, '\u4567', "success compareAndSet char value");
+                assertEquals('\u4567', x, "success compareAndSet char value");
             }
 
             {
                 boolean r = vh.compareAndSet(array, i, '\u0123', '\u89AB');
                 assertEquals(r, false, "failing compareAndSet char");
                 char x = (char) vh.get(array, i);
-                assertEquals(x, '\u4567', "failing compareAndSet char value");
+                assertEquals('\u4567', x, "failing compareAndSet char value");
             }
 
             {
                 char r = (char) vh.compareAndExchange(array, i, '\u4567', '\u0123');
                 assertEquals(r, '\u4567', "success compareAndExchange char");
                 char x = (char) vh.get(array, i);
-                assertEquals(x, '\u0123', "success compareAndExchange char value");
+                assertEquals('\u0123', x, "success compareAndExchange char value");
             }
 
             {
                 char r = (char) vh.compareAndExchange(array, i, '\u4567', '\u89AB');
                 assertEquals(r, '\u0123', "failing compareAndExchange char");
                 char x = (char) vh.get(array, i);
-                assertEquals(x, '\u0123', "failing compareAndExchange char value");
+                assertEquals('\u0123', x, "failing compareAndExchange char value");
             }
 
             {
                 char r = (char) vh.compareAndExchangeAcquire(array, i, '\u0123', '\u4567');
                 assertEquals(r, '\u0123', "success compareAndExchangeAcquire char");
                 char x = (char) vh.get(array, i);
-                assertEquals(x, '\u4567', "success compareAndExchangeAcquire char value");
+                assertEquals('\u4567', x, "success compareAndExchangeAcquire char value");
             }
 
             {
                 char r = (char) vh.compareAndExchangeAcquire(array, i, '\u0123', '\u89AB');
                 assertEquals(r, '\u4567', "failing compareAndExchangeAcquire char");
                 char x = (char) vh.get(array, i);
-                assertEquals(x, '\u4567', "failing compareAndExchangeAcquire char value");
+                assertEquals('\u4567', x, "failing compareAndExchangeAcquire char value");
             }
 
             {
                 char r = (char) vh.compareAndExchangeRelease(array, i, '\u4567', '\u0123');
                 assertEquals(r, '\u4567', "success compareAndExchangeRelease char");
                 char x = (char) vh.get(array, i);
-                assertEquals(x, '\u0123', "success compareAndExchangeRelease char value");
+                assertEquals('\u0123', x, "success compareAndExchangeRelease char value");
             }
 
             {
                 char r = (char) vh.compareAndExchangeRelease(array, i, '\u4567', '\u89AB');
                 assertEquals(r, '\u0123', "failing compareAndExchangeRelease char");
                 char x = (char) vh.get(array, i);
-                assertEquals(x, '\u0123', "failing compareAndExchangeRelease char value");
+                assertEquals('\u0123', x, "failing compareAndExchangeRelease char value");
             }
 
             {
@@ -1107,14 +1105,14 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetPlain char");
                 char x = (char) vh.get(array, i);
-                assertEquals(x, '\u4567', "success weakCompareAndSetPlain char value");
+                assertEquals('\u4567', x, "success weakCompareAndSetPlain char value");
             }
 
             {
                 boolean success = vh.weakCompareAndSetPlain(array, i, '\u0123', '\u89AB');
                 assertEquals(success, false, "failing weakCompareAndSetPlain char");
                 char x = (char) vh.get(array, i);
-                assertEquals(x, '\u4567', "failing weakCompareAndSetPlain char value");
+                assertEquals('\u4567', x, "failing weakCompareAndSetPlain char value");
             }
 
             {
@@ -1125,14 +1123,14 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetAcquire char");
                 char x = (char) vh.get(array, i);
-                assertEquals(x, '\u0123', "success weakCompareAndSetAcquire char");
+                assertEquals('\u0123', x, "success weakCompareAndSetAcquire char");
             }
 
             {
                 boolean success = vh.weakCompareAndSetAcquire(array, i, '\u4567', '\u89AB');
                 assertEquals(success, false, "failing weakCompareAndSetAcquire char");
                 char x = (char) vh.get(array, i);
-                assertEquals(x, '\u0123', "failing weakCompareAndSetAcquire char value");
+                assertEquals('\u0123', x, "failing weakCompareAndSetAcquire char value");
             }
 
             {
@@ -1143,14 +1141,14 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetRelease char");
                 char x = (char) vh.get(array, i);
-                assertEquals(x, '\u4567', "success weakCompareAndSetRelease char");
+                assertEquals('\u4567', x, "success weakCompareAndSetRelease char");
             }
 
             {
                 boolean success = vh.weakCompareAndSetRelease(array, i, '\u0123', '\u89AB');
                 assertEquals(success, false, "failing weakCompareAndSetRelease char");
                 char x = (char) vh.get(array, i);
-                assertEquals(x, '\u4567', "failing weakCompareAndSetRelease char value");
+                assertEquals('\u4567', x, "failing weakCompareAndSetRelease char value");
             }
 
             {
@@ -1161,14 +1159,14 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSet char");
                 char x = (char) vh.get(array, i);
-                assertEquals(x, '\u0123', "success weakCompareAndSet char");
+                assertEquals('\u0123', x, "success weakCompareAndSet char");
             }
 
             {
                 boolean success = vh.weakCompareAndSet(array, i, '\u4567', '\u89AB');
                 assertEquals(success, false, "failing weakCompareAndSet char");
                 char x = (char) vh.get(array, i);
-                assertEquals(x, '\u0123', "failing weakCompareAndSet char value");
+                assertEquals('\u0123', x, "failing weakCompareAndSet char value");
             }
 
             // Compare set and get
@@ -1176,27 +1174,27 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
                 vh.set(array, i, '\u0123');
 
                 char o = (char) vh.getAndSet(array, i, '\u4567');
-                assertEquals(o, '\u0123', "getAndSet char");
+                assertEquals('\u0123', o, "getAndSet char");
                 char x = (char) vh.get(array, i);
-                assertEquals(x, '\u4567', "getAndSet char value");
+                assertEquals('\u4567', x, "getAndSet char value");
             }
 
             {
                 vh.set(array, i, '\u0123');
 
                 char o = (char) vh.getAndSetAcquire(array, i, '\u4567');
-                assertEquals(o, '\u0123', "getAndSetAcquire char");
+                assertEquals('\u0123', o, "getAndSetAcquire char");
                 char x = (char) vh.get(array, i);
-                assertEquals(x, '\u4567', "getAndSetAcquire char value");
+                assertEquals('\u4567', x, "getAndSetAcquire char value");
             }
 
             {
                 vh.set(array, i, '\u0123');
 
                 char o = (char) vh.getAndSetRelease(array, i, '\u4567');
-                assertEquals(o, '\u0123', "getAndSetRelease char");
+                assertEquals('\u0123', o, "getAndSetRelease char");
                 char x = (char) vh.get(array, i);
-                assertEquals(x, '\u4567', "getAndSetRelease char value");
+                assertEquals('\u4567', x, "getAndSetRelease char value");
             }
 
             // get and add, add and get
@@ -1204,27 +1202,27 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
                 vh.set(array, i, '\u0123');
 
                 char o = (char) vh.getAndAdd(array, i, '\u4567');
-                assertEquals(o, '\u0123', "getAndAdd char");
+                assertEquals('\u0123', o, "getAndAdd char");
                 char x = (char) vh.get(array, i);
-                assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAdd char value");
+                assertEquals((char)('\u0123' + '\u4567'), x, "getAndAdd char value");
             }
 
             {
                 vh.set(array, i, '\u0123');
 
                 char o = (char) vh.getAndAddAcquire(array, i, '\u4567');
-                assertEquals(o, '\u0123', "getAndAddAcquire char");
+                assertEquals('\u0123', o, "getAndAddAcquire char");
                 char x = (char) vh.get(array, i);
-                assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddAcquire char value");
+                assertEquals((char)('\u0123' + '\u4567'), x, "getAndAddAcquire char value");
             }
 
             {
                 vh.set(array, i, '\u0123');
 
                 char o = (char) vh.getAndAddRelease(array, i, '\u4567');
-                assertEquals(o, '\u0123', "getAndAddReleasechar");
+                assertEquals('\u0123', o, "getAndAddReleasechar");
                 char x = (char) vh.get(array, i);
-                assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddRelease char value");
+                assertEquals((char)('\u0123' + '\u4567'), x, "getAndAddRelease char value");
             }
 
             // get and bitwise or
@@ -1232,27 +1230,27 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
                 vh.set(array, i, '\u0123');
 
                 char o = (char) vh.getAndBitwiseOr(array, i, '\u4567');
-                assertEquals(o, '\u0123', "getAndBitwiseOr char");
+                assertEquals('\u0123', o, "getAndBitwiseOr char");
                 char x = (char) vh.get(array, i);
-                assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOr char value");
+                assertEquals((char)('\u0123' | '\u4567'), x, "getAndBitwiseOr char value");
             }
 
             {
                 vh.set(array, i, '\u0123');
 
                 char o = (char) vh.getAndBitwiseOrAcquire(array, i, '\u4567');
-                assertEquals(o, '\u0123', "getAndBitwiseOrAcquire char");
+                assertEquals('\u0123', o, "getAndBitwiseOrAcquire char");
                 char x = (char) vh.get(array, i);
-                assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrAcquire char value");
+                assertEquals((char)('\u0123' | '\u4567'), x, "getAndBitwiseOrAcquire char value");
             }
 
             {
                 vh.set(array, i, '\u0123');
 
                 char o = (char) vh.getAndBitwiseOrRelease(array, i, '\u4567');
-                assertEquals(o, '\u0123', "getAndBitwiseOrRelease char");
+                assertEquals('\u0123', o, "getAndBitwiseOrRelease char");
                 char x = (char) vh.get(array, i);
-                assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrRelease char value");
+                assertEquals((char)('\u0123' | '\u4567'), x, "getAndBitwiseOrRelease char value");
             }
 
             // get and bitwise and
@@ -1260,27 +1258,27 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
                 vh.set(array, i, '\u0123');
 
                 char o = (char) vh.getAndBitwiseAnd(array, i, '\u4567');
-                assertEquals(o, '\u0123', "getAndBitwiseAnd char");
+                assertEquals('\u0123', o, "getAndBitwiseAnd char");
                 char x = (char) vh.get(array, i);
-                assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAnd char value");
+                assertEquals((char)('\u0123' & '\u4567'), x, "getAndBitwiseAnd char value");
             }
 
             {
                 vh.set(array, i, '\u0123');
 
                 char o = (char) vh.getAndBitwiseAndAcquire(array, i, '\u4567');
-                assertEquals(o, '\u0123', "getAndBitwiseAndAcquire char");
+                assertEquals('\u0123', o, "getAndBitwiseAndAcquire char");
                 char x = (char) vh.get(array, i);
-                assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndAcquire char value");
+                assertEquals((char)('\u0123' & '\u4567'), x, "getAndBitwiseAndAcquire char value");
             }
 
             {
                 vh.set(array, i, '\u0123');
 
                 char o = (char) vh.getAndBitwiseAndRelease(array, i, '\u4567');
-                assertEquals(o, '\u0123', "getAndBitwiseAndRelease char");
+                assertEquals('\u0123', o, "getAndBitwiseAndRelease char");
                 char x = (char) vh.get(array, i);
-                assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndRelease char value");
+                assertEquals((char)('\u0123' & '\u4567'), x, "getAndBitwiseAndRelease char value");
             }
 
             // get and bitwise xor
@@ -1288,27 +1286,27 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
                 vh.set(array, i, '\u0123');
 
                 char o = (char) vh.getAndBitwiseXor(array, i, '\u4567');
-                assertEquals(o, '\u0123', "getAndBitwiseXor char");
+                assertEquals('\u0123', o, "getAndBitwiseXor char");
                 char x = (char) vh.get(array, i);
-                assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXor char value");
+                assertEquals((char)('\u0123' ^ '\u4567'), x, "getAndBitwiseXor char value");
             }
 
             {
                 vh.set(array, i, '\u0123');
 
                 char o = (char) vh.getAndBitwiseXorAcquire(array, i, '\u4567');
-                assertEquals(o, '\u0123', "getAndBitwiseXorAcquire char");
+                assertEquals('\u0123', o, "getAndBitwiseXorAcquire char");
                 char x = (char) vh.get(array, i);
-                assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorAcquire char value");
+                assertEquals((char)('\u0123' ^ '\u4567'), x, "getAndBitwiseXorAcquire char value");
             }
 
             {
                 vh.set(array, i, '\u0123');
 
                 char o = (char) vh.getAndBitwiseXorRelease(array, i, '\u4567');
-                assertEquals(o, '\u0123', "getAndBitwiseXorRelease char");
+                assertEquals('\u0123', o, "getAndBitwiseXorRelease char");
                 char x = (char) vh.get(array, i);
-                assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorRelease char value");
+                assertEquals((char)('\u0123' ^ '\u4567'), x, "getAndBitwiseXorRelease char value");
             }
         }
     }
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java
index 0edb196076c..29fa6c2886d 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,28 +23,30 @@
 
 /*
  * @test
- * @run testng/othervm -Diters=10   -Xint                                                   VarHandleTestAccessDouble
+ * @run junit/othervm -Diters=10   -Xint                                                   VarHandleTestAccessDouble
  *
  * @comment Set CompileThresholdScaling to 0.1 so that the warmup loop sets to 2000 iterations
  *          to hit compilation thresholds
  *
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestAccessDouble
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestAccessDouble
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestAccessDouble
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestAccessDouble
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestAccessDouble
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestAccessDouble
  */
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestAccessDouble extends VarHandleBaseTest {
     static final double static_final_v = 1.0d;
 
@@ -108,7 +110,7 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
         return vhs.toArray(new VarHandle[0]);
     }
 
-    @BeforeClass
+    @BeforeAll
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
                 VarHandleTestAccessDouble.class, "final_v", double.class);
@@ -125,8 +127,6 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
         vhArray = MethodHandles.arrayElementVarHandle(double[].class);
     }
 
-
-    @DataProvider
     public Object[][] varHandlesProvider() throws Exception {
         List vhs = new ArrayList<>();
         vhs.add(vhField);
@@ -156,7 +156,8 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
         }
     }
 
-    @Test(dataProvider = "varHandlesProvider")
+    @ParameterizedTest
+    @MethodSource("varHandlesProvider")
     public void testIsAccessModeSupported(VarHandle vh) {
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
@@ -194,8 +195,6 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
     }
 
-
-    @DataProvider
     public Object[][] typesProvider() throws Exception {
         List types = new ArrayList<>();
         types.add(new Object[] {vhField, Arrays.asList(VarHandleTestAccessDouble.class)});
@@ -205,16 +204,16 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
         return types.stream().toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "typesProvider")
+    @ParameterizedTest
+    @MethodSource("typesProvider")
     public void testTypes(VarHandle vh, List> pts) {
-        assertEquals(vh.varType(), double.class);
+        assertEquals(double.class, vh.varType());
 
-        assertEquals(vh.coordinateTypes(), pts);
+        assertEquals(pts, vh.coordinateTypes());
 
         testTypes(vh);
     }
 
-
     @Test
     public void testLookupInstanceToStatic() {
         checkIAE("Lookup of static final field to instance final field", () -> {
@@ -241,8 +240,6 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
         });
     }
 
-
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -284,7 +281,8 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -297,26 +295,26 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
         // Plain
         {
             double x = (double) vh.get(recv);
-            assertEquals(x, 1.0d, "get double value");
+            assertEquals(1.0d, x, "get double value");
         }
 
 
         // Volatile
         {
             double x = (double) vh.getVolatile(recv);
-            assertEquals(x, 1.0d, "getVolatile double value");
+            assertEquals(1.0d, x, "getVolatile double value");
         }
 
         // Lazy
         {
             double x = (double) vh.getAcquire(recv);
-            assertEquals(x, 1.0d, "getRelease double value");
+            assertEquals(1.0d, x, "getRelease double value");
         }
 
         // Opaque
         {
             double x = (double) vh.getOpaque(recv);
-            assertEquals(x, 1.0d, "getOpaque double value");
+            assertEquals(1.0d, x, "getOpaque double value");
         }
     }
 
@@ -381,26 +379,26 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
         // Plain
         {
             double x = (double) vh.get();
-            assertEquals(x, 1.0d, "get double value");
+            assertEquals(1.0d, x, "get double value");
         }
 
 
         // Volatile
         {
             double x = (double) vh.getVolatile();
-            assertEquals(x, 1.0d, "getVolatile double value");
+            assertEquals(1.0d, x, "getVolatile double value");
         }
 
         // Lazy
         {
             double x = (double) vh.getAcquire();
-            assertEquals(x, 1.0d, "getRelease double value");
+            assertEquals(1.0d, x, "getRelease double value");
         }
 
         // Opaque
         {
             double x = (double) vh.getOpaque();
-            assertEquals(x, 1.0d, "getOpaque double value");
+            assertEquals(1.0d, x, "getOpaque double value");
         }
     }
 
@@ -466,7 +464,7 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
         {
             vh.set(recv, 1.0d);
             double x = (double) vh.get(recv);
-            assertEquals(x, 1.0d, "set double value");
+            assertEquals(1.0d, x, "set double value");
         }
 
 
@@ -474,21 +472,21 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
         {
             vh.setVolatile(recv, 2.0d);
             double x = (double) vh.getVolatile(recv);
-            assertEquals(x, 2.0d, "setVolatile double value");
+            assertEquals(2.0d, x, "setVolatile double value");
         }
 
         // Lazy
         {
             vh.setRelease(recv, 1.0d);
             double x = (double) vh.getAcquire(recv);
-            assertEquals(x, 1.0d, "setRelease double value");
+            assertEquals(1.0d, x, "setRelease double value");
         }
 
         // Opaque
         {
             vh.setOpaque(recv, 2.0d);
             double x = (double) vh.getOpaque(recv);
-            assertEquals(x, 2.0d, "setOpaque double value");
+            assertEquals(2.0d, x, "setOpaque double value");
         }
 
         vh.set(recv, 1.0d);
@@ -498,56 +496,56 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
             boolean r = vh.compareAndSet(recv, 1.0d, 2.0d);
             assertEquals(r, true, "success compareAndSet double");
             double x = (double) vh.get(recv);
-            assertEquals(x, 2.0d, "success compareAndSet double value");
+            assertEquals(2.0d, x, "success compareAndSet double value");
         }
 
         {
             boolean r = vh.compareAndSet(recv, 1.0d, 3.0d);
             assertEquals(r, false, "failing compareAndSet double");
             double x = (double) vh.get(recv);
-            assertEquals(x, 2.0d, "failing compareAndSet double value");
+            assertEquals(2.0d, x, "failing compareAndSet double value");
         }
 
         {
             double r = (double) vh.compareAndExchange(recv, 2.0d, 1.0d);
             assertEquals(r, 2.0d, "success compareAndExchange double");
             double x = (double) vh.get(recv);
-            assertEquals(x, 1.0d, "success compareAndExchange double value");
+            assertEquals(1.0d, x, "success compareAndExchange double value");
         }
 
         {
             double r = (double) vh.compareAndExchange(recv, 2.0d, 3.0d);
             assertEquals(r, 1.0d, "failing compareAndExchange double");
             double x = (double) vh.get(recv);
-            assertEquals(x, 1.0d, "failing compareAndExchange double value");
+            assertEquals(1.0d, x, "failing compareAndExchange double value");
         }
 
         {
             double r = (double) vh.compareAndExchangeAcquire(recv, 1.0d, 2.0d);
             assertEquals(r, 1.0d, "success compareAndExchangeAcquire double");
             double x = (double) vh.get(recv);
-            assertEquals(x, 2.0d, "success compareAndExchangeAcquire double value");
+            assertEquals(2.0d, x, "success compareAndExchangeAcquire double value");
         }
 
         {
             double r = (double) vh.compareAndExchangeAcquire(recv, 1.0d, 3.0d);
             assertEquals(r, 2.0d, "failing compareAndExchangeAcquire double");
             double x = (double) vh.get(recv);
-            assertEquals(x, 2.0d, "failing compareAndExchangeAcquire double value");
+            assertEquals(2.0d, x, "failing compareAndExchangeAcquire double value");
         }
 
         {
             double r = (double) vh.compareAndExchangeRelease(recv, 2.0d, 1.0d);
             assertEquals(r, 2.0d, "success compareAndExchangeRelease double");
             double x = (double) vh.get(recv);
-            assertEquals(x, 1.0d, "success compareAndExchangeRelease double value");
+            assertEquals(1.0d, x, "success compareAndExchangeRelease double value");
         }
 
         {
             double r = (double) vh.compareAndExchangeRelease(recv, 2.0d, 3.0d);
             assertEquals(r, 1.0d, "failing compareAndExchangeRelease double");
             double x = (double) vh.get(recv);
-            assertEquals(x, 1.0d, "failing compareAndExchangeRelease double value");
+            assertEquals(1.0d, x, "failing compareAndExchangeRelease double value");
         }
 
         {
@@ -558,14 +556,14 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain double");
             double x = (double) vh.get(recv);
-            assertEquals(x, 2.0d, "success weakCompareAndSetPlain double value");
+            assertEquals(2.0d, x, "success weakCompareAndSetPlain double value");
         }
 
         {
             boolean success = vh.weakCompareAndSetPlain(recv, 1.0d, 3.0d);
             assertEquals(success, false, "failing weakCompareAndSetPlain double");
             double x = (double) vh.get(recv);
-            assertEquals(x, 2.0d, "failing weakCompareAndSetPlain double value");
+            assertEquals(2.0d, x, "failing weakCompareAndSetPlain double value");
         }
 
         {
@@ -576,14 +574,14 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire double");
             double x = (double) vh.get(recv);
-            assertEquals(x, 1.0d, "success weakCompareAndSetAcquire double");
+            assertEquals(1.0d, x, "success weakCompareAndSetAcquire double");
         }
 
         {
             boolean success = vh.weakCompareAndSetAcquire(recv, 2.0d, 3.0d);
             assertEquals(success, false, "failing weakCompareAndSetAcquire double");
             double x = (double) vh.get(recv);
-            assertEquals(x, 1.0d, "failing weakCompareAndSetAcquire double value");
+            assertEquals(1.0d, x, "failing weakCompareAndSetAcquire double value");
         }
 
         {
@@ -594,14 +592,14 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease double");
             double x = (double) vh.get(recv);
-            assertEquals(x, 2.0d, "success weakCompareAndSetRelease double");
+            assertEquals(2.0d, x, "success weakCompareAndSetRelease double");
         }
 
         {
             boolean success = vh.weakCompareAndSetRelease(recv, 1.0d, 3.0d);
             assertEquals(success, false, "failing weakCompareAndSetRelease double");
             double x = (double) vh.get(recv);
-            assertEquals(x, 2.0d, "failing weakCompareAndSetRelease double value");
+            assertEquals(2.0d, x, "failing weakCompareAndSetRelease double value");
         }
 
         {
@@ -612,14 +610,14 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet double");
             double x = (double) vh.get(recv);
-            assertEquals(x, 1.0d, "success weakCompareAndSet double value");
+            assertEquals(1.0d, x, "success weakCompareAndSet double value");
         }
 
         {
             boolean success = vh.weakCompareAndSet(recv, 2.0d, 3.0d);
             assertEquals(success, false, "failing weakCompareAndSet double");
             double x = (double) vh.get(recv);
-            assertEquals(x, 1.0d, "failing weakCompareAndSet double value");
+            assertEquals(1.0d, x, "failing weakCompareAndSet double value");
         }
 
         // Compare set and get
@@ -627,27 +625,27 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
             vh.set(recv, 1.0d);
 
             double o = (double) vh.getAndSet(recv, 2.0d);
-            assertEquals(o, 1.0d, "getAndSet double");
+            assertEquals(1.0d, o, "getAndSet double");
             double x = (double) vh.get(recv);
-            assertEquals(x, 2.0d, "getAndSet double value");
+            assertEquals(2.0d, x, "getAndSet double value");
         }
 
         {
             vh.set(recv, 1.0d);
 
             double o = (double) vh.getAndSetAcquire(recv, 2.0d);
-            assertEquals(o, 1.0d, "getAndSetAcquire double");
+            assertEquals(1.0d, o, "getAndSetAcquire double");
             double x = (double) vh.get(recv);
-            assertEquals(x, 2.0d, "getAndSetAcquire double value");
+            assertEquals(2.0d, x, "getAndSetAcquire double value");
         }
 
         {
             vh.set(recv, 1.0d);
 
             double o = (double) vh.getAndSetRelease(recv, 2.0d);
-            assertEquals(o, 1.0d, "getAndSetRelease double");
+            assertEquals(1.0d, o, "getAndSetRelease double");
             double x = (double) vh.get(recv);
-            assertEquals(x, 2.0d, "getAndSetRelease double value");
+            assertEquals(2.0d, x, "getAndSetRelease double value");
         }
 
         // get and add, add and get
@@ -655,27 +653,27 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
             vh.set(recv, 1.0d);
 
             double o = (double) vh.getAndAdd(recv, 2.0d);
-            assertEquals(o, 1.0d, "getAndAdd double");
+            assertEquals(1.0d, o, "getAndAdd double");
             double x = (double) vh.get(recv);
-            assertEquals(x, (double)(1.0d + 2.0d), "getAndAdd double value");
+            assertEquals((double)(1.0d + 2.0d), x, "getAndAdd double value");
         }
 
         {
             vh.set(recv, 1.0d);
 
             double o = (double) vh.getAndAddAcquire(recv, 2.0d);
-            assertEquals(o, 1.0d, "getAndAddAcquire double");
+            assertEquals(1.0d, o, "getAndAddAcquire double");
             double x = (double) vh.get(recv);
-            assertEquals(x, (double)(1.0d + 2.0d), "getAndAddAcquire double value");
+            assertEquals((double)(1.0d + 2.0d), x, "getAndAddAcquire double value");
         }
 
         {
             vh.set(recv, 1.0d);
 
             double o = (double) vh.getAndAddRelease(recv, 2.0d);
-            assertEquals(o, 1.0d, "getAndAddReleasedouble");
+            assertEquals(1.0d, o, "getAndAddReleasedouble");
             double x = (double) vh.get(recv);
-            assertEquals(x, (double)(1.0d + 2.0d), "getAndAddRelease double value");
+            assertEquals((double)(1.0d + 2.0d), x, "getAndAddRelease double value");
         }
 
     }
@@ -726,7 +724,7 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
         {
             vh.set(1.0d);
             double x = (double) vh.get();
-            assertEquals(x, 1.0d, "set double value");
+            assertEquals(1.0d, x, "set double value");
         }
 
 
@@ -734,21 +732,21 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
         {
             vh.setVolatile(2.0d);
             double x = (double) vh.getVolatile();
-            assertEquals(x, 2.0d, "setVolatile double value");
+            assertEquals(2.0d, x, "setVolatile double value");
         }
 
         // Lazy
         {
             vh.setRelease(1.0d);
             double x = (double) vh.getAcquire();
-            assertEquals(x, 1.0d, "setRelease double value");
+            assertEquals(1.0d, x, "setRelease double value");
         }
 
         // Opaque
         {
             vh.setOpaque(2.0d);
             double x = (double) vh.getOpaque();
-            assertEquals(x, 2.0d, "setOpaque double value");
+            assertEquals(2.0d, x, "setOpaque double value");
         }
 
         vh.set(1.0d);
@@ -758,56 +756,56 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
             boolean r = vh.compareAndSet(1.0d, 2.0d);
             assertEquals(r, true, "success compareAndSet double");
             double x = (double) vh.get();
-            assertEquals(x, 2.0d, "success compareAndSet double value");
+            assertEquals(2.0d, x, "success compareAndSet double value");
         }
 
         {
             boolean r = vh.compareAndSet(1.0d, 3.0d);
             assertEquals(r, false, "failing compareAndSet double");
             double x = (double) vh.get();
-            assertEquals(x, 2.0d, "failing compareAndSet double value");
+            assertEquals(2.0d, x, "failing compareAndSet double value");
         }
 
         {
             double r = (double) vh.compareAndExchange(2.0d, 1.0d);
             assertEquals(r, 2.0d, "success compareAndExchange double");
             double x = (double) vh.get();
-            assertEquals(x, 1.0d, "success compareAndExchange double value");
+            assertEquals(1.0d, x, "success compareAndExchange double value");
         }
 
         {
             double r = (double) vh.compareAndExchange(2.0d, 3.0d);
             assertEquals(r, 1.0d, "failing compareAndExchange double");
             double x = (double) vh.get();
-            assertEquals(x, 1.0d, "failing compareAndExchange double value");
+            assertEquals(1.0d, x, "failing compareAndExchange double value");
         }
 
         {
             double r = (double) vh.compareAndExchangeAcquire(1.0d, 2.0d);
             assertEquals(r, 1.0d, "success compareAndExchangeAcquire double");
             double x = (double) vh.get();
-            assertEquals(x, 2.0d, "success compareAndExchangeAcquire double value");
+            assertEquals(2.0d, x, "success compareAndExchangeAcquire double value");
         }
 
         {
             double r = (double) vh.compareAndExchangeAcquire(1.0d, 3.0d);
             assertEquals(r, 2.0d, "failing compareAndExchangeAcquire double");
             double x = (double) vh.get();
-            assertEquals(x, 2.0d, "failing compareAndExchangeAcquire double value");
+            assertEquals(2.0d, x, "failing compareAndExchangeAcquire double value");
         }
 
         {
             double r = (double) vh.compareAndExchangeRelease(2.0d, 1.0d);
             assertEquals(r, 2.0d, "success compareAndExchangeRelease double");
             double x = (double) vh.get();
-            assertEquals(x, 1.0d, "success compareAndExchangeRelease double value");
+            assertEquals(1.0d, x, "success compareAndExchangeRelease double value");
         }
 
         {
             double r = (double) vh.compareAndExchangeRelease(2.0d, 3.0d);
             assertEquals(r, 1.0d, "failing compareAndExchangeRelease double");
             double x = (double) vh.get();
-            assertEquals(x, 1.0d, "failing compareAndExchangeRelease double value");
+            assertEquals(1.0d, x, "failing compareAndExchangeRelease double value");
         }
 
         {
@@ -818,14 +816,14 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain double");
             double x = (double) vh.get();
-            assertEquals(x, 2.0d, "success weakCompareAndSetPlain double value");
+            assertEquals(2.0d, x, "success weakCompareAndSetPlain double value");
         }
 
         {
             boolean success = vh.weakCompareAndSetPlain(1.0d, 3.0d);
             assertEquals(success, false, "failing weakCompareAndSetPlain double");
             double x = (double) vh.get();
-            assertEquals(x, 2.0d, "failing weakCompareAndSetPlain double value");
+            assertEquals(2.0d, x, "failing weakCompareAndSetPlain double value");
         }
 
         {
@@ -836,14 +834,14 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire double");
             double x = (double) vh.get();
-            assertEquals(x, 1.0d, "success weakCompareAndSetAcquire double");
+            assertEquals(1.0d, x, "success weakCompareAndSetAcquire double");
         }
 
         {
             boolean success = vh.weakCompareAndSetAcquire(2.0d, 3.0d);
             assertEquals(success, false, "failing weakCompareAndSetAcquire double");
             double x = (double) vh.get();
-            assertEquals(x, 1.0d, "failing weakCompareAndSetAcquire double value");
+            assertEquals(1.0d, x, "failing weakCompareAndSetAcquire double value");
         }
 
         {
@@ -854,14 +852,14 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease double");
             double x = (double) vh.get();
-            assertEquals(x, 2.0d, "success weakCompareAndSetRelease double");
+            assertEquals(2.0d, x, "success weakCompareAndSetRelease double");
         }
 
         {
             boolean success = vh.weakCompareAndSetRelease(1.0d, 3.0d);
             assertEquals(success, false, "failing weakCompareAndSetRelease double");
             double x = (double) vh.get();
-            assertEquals(x, 2.0d, "failing weakCompareAndSetRelease double value");
+            assertEquals(2.0d, x, "failing weakCompareAndSetRelease double value");
         }
 
         {
@@ -872,14 +870,14 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet double");
             double x = (double) vh.get();
-            assertEquals(x, 1.0d, "success weakCompareAndSet double");
+            assertEquals(1.0d, x, "success weakCompareAndSet double");
         }
 
         {
             boolean success = vh.weakCompareAndSet(2.0d, 3.0d);
             assertEquals(success, false, "failing weakCompareAndSet double");
             double x = (double) vh.get();
-            assertEquals(x, 1.0d, "failing weakCompareAndSet double value");
+            assertEquals(1.0d, x, "failing weakCompareAndSet double value");
         }
 
         // Compare set and get
@@ -887,27 +885,27 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
             vh.set(1.0d);
 
             double o = (double) vh.getAndSet(2.0d);
-            assertEquals(o, 1.0d, "getAndSet double");
+            assertEquals(1.0d, o, "getAndSet double");
             double x = (double) vh.get();
-            assertEquals(x, 2.0d, "getAndSet double value");
+            assertEquals(2.0d, x, "getAndSet double value");
         }
 
         {
             vh.set(1.0d);
 
             double o = (double) vh.getAndSetAcquire(2.0d);
-            assertEquals(o, 1.0d, "getAndSetAcquire double");
+            assertEquals(1.0d, o, "getAndSetAcquire double");
             double x = (double) vh.get();
-            assertEquals(x, 2.0d, "getAndSetAcquire double value");
+            assertEquals(2.0d, x, "getAndSetAcquire double value");
         }
 
         {
             vh.set(1.0d);
 
             double o = (double) vh.getAndSetRelease(2.0d);
-            assertEquals(o, 1.0d, "getAndSetRelease double");
+            assertEquals(1.0d, o, "getAndSetRelease double");
             double x = (double) vh.get();
-            assertEquals(x, 2.0d, "getAndSetRelease double value");
+            assertEquals(2.0d, x, "getAndSetRelease double value");
         }
 
         // get and add, add and get
@@ -915,27 +913,27 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
             vh.set(1.0d);
 
             double o = (double) vh.getAndAdd(2.0d);
-            assertEquals(o, 1.0d, "getAndAdd double");
+            assertEquals(1.0d, o, "getAndAdd double");
             double x = (double) vh.get();
-            assertEquals(x, (double)(1.0d + 2.0d), "getAndAdd double value");
+            assertEquals((double)(1.0d + 2.0d), x, "getAndAdd double value");
         }
 
         {
             vh.set(1.0d);
 
             double o = (double) vh.getAndAddAcquire(2.0d);
-            assertEquals(o, 1.0d, "getAndAddAcquire double");
+            assertEquals(1.0d, o, "getAndAddAcquire double");
             double x = (double) vh.get();
-            assertEquals(x, (double)(1.0d + 2.0d), "getAndAddAcquire double value");
+            assertEquals((double)(1.0d + 2.0d), x, "getAndAddAcquire double value");
         }
 
         {
             vh.set(1.0d);
 
             double o = (double) vh.getAndAddRelease(2.0d);
-            assertEquals(o, 1.0d, "getAndAddReleasedouble");
+            assertEquals(1.0d, o, "getAndAddReleasedouble");
             double x = (double) vh.get();
-            assertEquals(x, (double)(1.0d + 2.0d), "getAndAddRelease double value");
+            assertEquals((double)(1.0d + 2.0d), x, "getAndAddRelease double value");
         }
 
     }
@@ -989,7 +987,7 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
             {
                 vh.set(array, i, 1.0d);
                 double x = (double) vh.get(array, i);
-                assertEquals(x, 1.0d, "get double value");
+                assertEquals(1.0d, x, "get double value");
             }
 
 
@@ -997,21 +995,21 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
             {
                 vh.setVolatile(array, i, 2.0d);
                 double x = (double) vh.getVolatile(array, i);
-                assertEquals(x, 2.0d, "setVolatile double value");
+                assertEquals(2.0d, x, "setVolatile double value");
             }
 
             // Lazy
             {
                 vh.setRelease(array, i, 1.0d);
                 double x = (double) vh.getAcquire(array, i);
-                assertEquals(x, 1.0d, "setRelease double value");
+                assertEquals(1.0d, x, "setRelease double value");
             }
 
             // Opaque
             {
                 vh.setOpaque(array, i, 2.0d);
                 double x = (double) vh.getOpaque(array, i);
-                assertEquals(x, 2.0d, "setOpaque double value");
+                assertEquals(2.0d, x, "setOpaque double value");
             }
 
             vh.set(array, i, 1.0d);
@@ -1021,56 +1019,56 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
                 boolean r = vh.compareAndSet(array, i, 1.0d, 2.0d);
                 assertEquals(r, true, "success compareAndSet double");
                 double x = (double) vh.get(array, i);
-                assertEquals(x, 2.0d, "success compareAndSet double value");
+                assertEquals(2.0d, x, "success compareAndSet double value");
             }
 
             {
                 boolean r = vh.compareAndSet(array, i, 1.0d, 3.0d);
                 assertEquals(r, false, "failing compareAndSet double");
                 double x = (double) vh.get(array, i);
-                assertEquals(x, 2.0d, "failing compareAndSet double value");
+                assertEquals(2.0d, x, "failing compareAndSet double value");
             }
 
             {
                 double r = (double) vh.compareAndExchange(array, i, 2.0d, 1.0d);
                 assertEquals(r, 2.0d, "success compareAndExchange double");
                 double x = (double) vh.get(array, i);
-                assertEquals(x, 1.0d, "success compareAndExchange double value");
+                assertEquals(1.0d, x, "success compareAndExchange double value");
             }
 
             {
                 double r = (double) vh.compareAndExchange(array, i, 2.0d, 3.0d);
                 assertEquals(r, 1.0d, "failing compareAndExchange double");
                 double x = (double) vh.get(array, i);
-                assertEquals(x, 1.0d, "failing compareAndExchange double value");
+                assertEquals(1.0d, x, "failing compareAndExchange double value");
             }
 
             {
                 double r = (double) vh.compareAndExchangeAcquire(array, i, 1.0d, 2.0d);
                 assertEquals(r, 1.0d, "success compareAndExchangeAcquire double");
                 double x = (double) vh.get(array, i);
-                assertEquals(x, 2.0d, "success compareAndExchangeAcquire double value");
+                assertEquals(2.0d, x, "success compareAndExchangeAcquire double value");
             }
 
             {
                 double r = (double) vh.compareAndExchangeAcquire(array, i, 1.0d, 3.0d);
                 assertEquals(r, 2.0d, "failing compareAndExchangeAcquire double");
                 double x = (double) vh.get(array, i);
-                assertEquals(x, 2.0d, "failing compareAndExchangeAcquire double value");
+                assertEquals(2.0d, x, "failing compareAndExchangeAcquire double value");
             }
 
             {
                 double r = (double) vh.compareAndExchangeRelease(array, i, 2.0d, 1.0d);
                 assertEquals(r, 2.0d, "success compareAndExchangeRelease double");
                 double x = (double) vh.get(array, i);
-                assertEquals(x, 1.0d, "success compareAndExchangeRelease double value");
+                assertEquals(1.0d, x, "success compareAndExchangeRelease double value");
             }
 
             {
                 double r = (double) vh.compareAndExchangeRelease(array, i, 2.0d, 3.0d);
                 assertEquals(r, 1.0d, "failing compareAndExchangeRelease double");
                 double x = (double) vh.get(array, i);
-                assertEquals(x, 1.0d, "failing compareAndExchangeRelease double value");
+                assertEquals(1.0d, x, "failing compareAndExchangeRelease double value");
             }
 
             {
@@ -1081,14 +1079,14 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetPlain double");
                 double x = (double) vh.get(array, i);
-                assertEquals(x, 2.0d, "success weakCompareAndSetPlain double value");
+                assertEquals(2.0d, x, "success weakCompareAndSetPlain double value");
             }
 
             {
                 boolean success = vh.weakCompareAndSetPlain(array, i, 1.0d, 3.0d);
                 assertEquals(success, false, "failing weakCompareAndSetPlain double");
                 double x = (double) vh.get(array, i);
-                assertEquals(x, 2.0d, "failing weakCompareAndSetPlain double value");
+                assertEquals(2.0d, x, "failing weakCompareAndSetPlain double value");
             }
 
             {
@@ -1099,14 +1097,14 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetAcquire double");
                 double x = (double) vh.get(array, i);
-                assertEquals(x, 1.0d, "success weakCompareAndSetAcquire double");
+                assertEquals(1.0d, x, "success weakCompareAndSetAcquire double");
             }
 
             {
                 boolean success = vh.weakCompareAndSetAcquire(array, i, 2.0d, 3.0d);
                 assertEquals(success, false, "failing weakCompareAndSetAcquire double");
                 double x = (double) vh.get(array, i);
-                assertEquals(x, 1.0d, "failing weakCompareAndSetAcquire double value");
+                assertEquals(1.0d, x, "failing weakCompareAndSetAcquire double value");
             }
 
             {
@@ -1117,14 +1115,14 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetRelease double");
                 double x = (double) vh.get(array, i);
-                assertEquals(x, 2.0d, "success weakCompareAndSetRelease double");
+                assertEquals(2.0d, x, "success weakCompareAndSetRelease double");
             }
 
             {
                 boolean success = vh.weakCompareAndSetRelease(array, i, 1.0d, 3.0d);
                 assertEquals(success, false, "failing weakCompareAndSetRelease double");
                 double x = (double) vh.get(array, i);
-                assertEquals(x, 2.0d, "failing weakCompareAndSetRelease double value");
+                assertEquals(2.0d, x, "failing weakCompareAndSetRelease double value");
             }
 
             {
@@ -1135,14 +1133,14 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSet double");
                 double x = (double) vh.get(array, i);
-                assertEquals(x, 1.0d, "success weakCompareAndSet double");
+                assertEquals(1.0d, x, "success weakCompareAndSet double");
             }
 
             {
                 boolean success = vh.weakCompareAndSet(array, i, 2.0d, 3.0d);
                 assertEquals(success, false, "failing weakCompareAndSet double");
                 double x = (double) vh.get(array, i);
-                assertEquals(x, 1.0d, "failing weakCompareAndSet double value");
+                assertEquals(1.0d, x, "failing weakCompareAndSet double value");
             }
 
             // Compare set and get
@@ -1150,27 +1148,27 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
                 vh.set(array, i, 1.0d);
 
                 double o = (double) vh.getAndSet(array, i, 2.0d);
-                assertEquals(o, 1.0d, "getAndSet double");
+                assertEquals(1.0d, o, "getAndSet double");
                 double x = (double) vh.get(array, i);
-                assertEquals(x, 2.0d, "getAndSet double value");
+                assertEquals(2.0d, x, "getAndSet double value");
             }
 
             {
                 vh.set(array, i, 1.0d);
 
                 double o = (double) vh.getAndSetAcquire(array, i, 2.0d);
-                assertEquals(o, 1.0d, "getAndSetAcquire double");
+                assertEquals(1.0d, o, "getAndSetAcquire double");
                 double x = (double) vh.get(array, i);
-                assertEquals(x, 2.0d, "getAndSetAcquire double value");
+                assertEquals(2.0d, x, "getAndSetAcquire double value");
             }
 
             {
                 vh.set(array, i, 1.0d);
 
                 double o = (double) vh.getAndSetRelease(array, i, 2.0d);
-                assertEquals(o, 1.0d, "getAndSetRelease double");
+                assertEquals(1.0d, o, "getAndSetRelease double");
                 double x = (double) vh.get(array, i);
-                assertEquals(x, 2.0d, "getAndSetRelease double value");
+                assertEquals(2.0d, x, "getAndSetRelease double value");
             }
 
             // get and add, add and get
@@ -1178,27 +1176,27 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
                 vh.set(array, i, 1.0d);
 
                 double o = (double) vh.getAndAdd(array, i, 2.0d);
-                assertEquals(o, 1.0d, "getAndAdd double");
+                assertEquals(1.0d, o, "getAndAdd double");
                 double x = (double) vh.get(array, i);
-                assertEquals(x, (double)(1.0d + 2.0d), "getAndAdd double value");
+                assertEquals((double)(1.0d + 2.0d), x, "getAndAdd double value");
             }
 
             {
                 vh.set(array, i, 1.0d);
 
                 double o = (double) vh.getAndAddAcquire(array, i, 2.0d);
-                assertEquals(o, 1.0d, "getAndAddAcquire double");
+                assertEquals(1.0d, o, "getAndAddAcquire double");
                 double x = (double) vh.get(array, i);
-                assertEquals(x, (double)(1.0d + 2.0d), "getAndAddAcquire double value");
+                assertEquals((double)(1.0d + 2.0d), x, "getAndAddAcquire double value");
             }
 
             {
                 vh.set(array, i, 1.0d);
 
                 double o = (double) vh.getAndAddRelease(array, i, 2.0d);
-                assertEquals(o, 1.0d, "getAndAddReleasedouble");
+                assertEquals(1.0d, o, "getAndAddReleasedouble");
                 double x = (double) vh.get(array, i);
-                assertEquals(x, (double)(1.0d + 2.0d), "getAndAddRelease double value");
+                assertEquals((double)(1.0d + 2.0d), x, "getAndAddRelease double value");
             }
 
         }
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java
index c77a8d68008..750a1bbc408 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,28 +23,30 @@
 
 /*
  * @test
- * @run testng/othervm -Diters=10   -Xint                                                   VarHandleTestAccessFloat
+ * @run junit/othervm -Diters=10   -Xint                                                   VarHandleTestAccessFloat
  *
  * @comment Set CompileThresholdScaling to 0.1 so that the warmup loop sets to 2000 iterations
  *          to hit compilation thresholds
  *
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestAccessFloat
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestAccessFloat
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestAccessFloat
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestAccessFloat
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestAccessFloat
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestAccessFloat
  */
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestAccessFloat extends VarHandleBaseTest {
     static final float static_final_v = 1.0f;
 
@@ -108,7 +110,7 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
         return vhs.toArray(new VarHandle[0]);
     }
 
-    @BeforeClass
+    @BeforeAll
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
                 VarHandleTestAccessFloat.class, "final_v", float.class);
@@ -125,8 +127,6 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
         vhArray = MethodHandles.arrayElementVarHandle(float[].class);
     }
 
-
-    @DataProvider
     public Object[][] varHandlesProvider() throws Exception {
         List vhs = new ArrayList<>();
         vhs.add(vhField);
@@ -156,7 +156,8 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
         }
     }
 
-    @Test(dataProvider = "varHandlesProvider")
+    @ParameterizedTest
+    @MethodSource("varHandlesProvider")
     public void testIsAccessModeSupported(VarHandle vh) {
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
@@ -194,8 +195,6 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
     }
 
-
-    @DataProvider
     public Object[][] typesProvider() throws Exception {
         List types = new ArrayList<>();
         types.add(new Object[] {vhField, Arrays.asList(VarHandleTestAccessFloat.class)});
@@ -205,16 +204,16 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
         return types.stream().toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "typesProvider")
+    @ParameterizedTest
+    @MethodSource("typesProvider")
     public void testTypes(VarHandle vh, List> pts) {
-        assertEquals(vh.varType(), float.class);
+        assertEquals(float.class, vh.varType());
 
-        assertEquals(vh.coordinateTypes(), pts);
+        assertEquals(pts, vh.coordinateTypes());
 
         testTypes(vh);
     }
 
-
     @Test
     public void testLookupInstanceToStatic() {
         checkIAE("Lookup of static final field to instance final field", () -> {
@@ -241,8 +240,6 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
         });
     }
 
-
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -284,7 +281,8 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -297,26 +295,26 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
         // Plain
         {
             float x = (float) vh.get(recv);
-            assertEquals(x, 1.0f, "get float value");
+            assertEquals(1.0f, x, "get float value");
         }
 
 
         // Volatile
         {
             float x = (float) vh.getVolatile(recv);
-            assertEquals(x, 1.0f, "getVolatile float value");
+            assertEquals(1.0f, x, "getVolatile float value");
         }
 
         // Lazy
         {
             float x = (float) vh.getAcquire(recv);
-            assertEquals(x, 1.0f, "getRelease float value");
+            assertEquals(1.0f, x, "getRelease float value");
         }
 
         // Opaque
         {
             float x = (float) vh.getOpaque(recv);
-            assertEquals(x, 1.0f, "getOpaque float value");
+            assertEquals(1.0f, x, "getOpaque float value");
         }
     }
 
@@ -381,26 +379,26 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
         // Plain
         {
             float x = (float) vh.get();
-            assertEquals(x, 1.0f, "get float value");
+            assertEquals(1.0f, x, "get float value");
         }
 
 
         // Volatile
         {
             float x = (float) vh.getVolatile();
-            assertEquals(x, 1.0f, "getVolatile float value");
+            assertEquals(1.0f, x, "getVolatile float value");
         }
 
         // Lazy
         {
             float x = (float) vh.getAcquire();
-            assertEquals(x, 1.0f, "getRelease float value");
+            assertEquals(1.0f, x, "getRelease float value");
         }
 
         // Opaque
         {
             float x = (float) vh.getOpaque();
-            assertEquals(x, 1.0f, "getOpaque float value");
+            assertEquals(1.0f, x, "getOpaque float value");
         }
     }
 
@@ -466,7 +464,7 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
         {
             vh.set(recv, 1.0f);
             float x = (float) vh.get(recv);
-            assertEquals(x, 1.0f, "set float value");
+            assertEquals(1.0f, x, "set float value");
         }
 
 
@@ -474,21 +472,21 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
         {
             vh.setVolatile(recv, 2.0f);
             float x = (float) vh.getVolatile(recv);
-            assertEquals(x, 2.0f, "setVolatile float value");
+            assertEquals(2.0f, x, "setVolatile float value");
         }
 
         // Lazy
         {
             vh.setRelease(recv, 1.0f);
             float x = (float) vh.getAcquire(recv);
-            assertEquals(x, 1.0f, "setRelease float value");
+            assertEquals(1.0f, x, "setRelease float value");
         }
 
         // Opaque
         {
             vh.setOpaque(recv, 2.0f);
             float x = (float) vh.getOpaque(recv);
-            assertEquals(x, 2.0f, "setOpaque float value");
+            assertEquals(2.0f, x, "setOpaque float value");
         }
 
         vh.set(recv, 1.0f);
@@ -498,56 +496,56 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
             boolean r = vh.compareAndSet(recv, 1.0f, 2.0f);
             assertEquals(r, true, "success compareAndSet float");
             float x = (float) vh.get(recv);
-            assertEquals(x, 2.0f, "success compareAndSet float value");
+            assertEquals(2.0f, x, "success compareAndSet float value");
         }
 
         {
             boolean r = vh.compareAndSet(recv, 1.0f, 3.0f);
             assertEquals(r, false, "failing compareAndSet float");
             float x = (float) vh.get(recv);
-            assertEquals(x, 2.0f, "failing compareAndSet float value");
+            assertEquals(2.0f, x, "failing compareAndSet float value");
         }
 
         {
             float r = (float) vh.compareAndExchange(recv, 2.0f, 1.0f);
             assertEquals(r, 2.0f, "success compareAndExchange float");
             float x = (float) vh.get(recv);
-            assertEquals(x, 1.0f, "success compareAndExchange float value");
+            assertEquals(1.0f, x, "success compareAndExchange float value");
         }
 
         {
             float r = (float) vh.compareAndExchange(recv, 2.0f, 3.0f);
             assertEquals(r, 1.0f, "failing compareAndExchange float");
             float x = (float) vh.get(recv);
-            assertEquals(x, 1.0f, "failing compareAndExchange float value");
+            assertEquals(1.0f, x, "failing compareAndExchange float value");
         }
 
         {
             float r = (float) vh.compareAndExchangeAcquire(recv, 1.0f, 2.0f);
             assertEquals(r, 1.0f, "success compareAndExchangeAcquire float");
             float x = (float) vh.get(recv);
-            assertEquals(x, 2.0f, "success compareAndExchangeAcquire float value");
+            assertEquals(2.0f, x, "success compareAndExchangeAcquire float value");
         }
 
         {
             float r = (float) vh.compareAndExchangeAcquire(recv, 1.0f, 3.0f);
             assertEquals(r, 2.0f, "failing compareAndExchangeAcquire float");
             float x = (float) vh.get(recv);
-            assertEquals(x, 2.0f, "failing compareAndExchangeAcquire float value");
+            assertEquals(2.0f, x, "failing compareAndExchangeAcquire float value");
         }
 
         {
             float r = (float) vh.compareAndExchangeRelease(recv, 2.0f, 1.0f);
             assertEquals(r, 2.0f, "success compareAndExchangeRelease float");
             float x = (float) vh.get(recv);
-            assertEquals(x, 1.0f, "success compareAndExchangeRelease float value");
+            assertEquals(1.0f, x, "success compareAndExchangeRelease float value");
         }
 
         {
             float r = (float) vh.compareAndExchangeRelease(recv, 2.0f, 3.0f);
             assertEquals(r, 1.0f, "failing compareAndExchangeRelease float");
             float x = (float) vh.get(recv);
-            assertEquals(x, 1.0f, "failing compareAndExchangeRelease float value");
+            assertEquals(1.0f, x, "failing compareAndExchangeRelease float value");
         }
 
         {
@@ -558,14 +556,14 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain float");
             float x = (float) vh.get(recv);
-            assertEquals(x, 2.0f, "success weakCompareAndSetPlain float value");
+            assertEquals(2.0f, x, "success weakCompareAndSetPlain float value");
         }
 
         {
             boolean success = vh.weakCompareAndSetPlain(recv, 1.0f, 3.0f);
             assertEquals(success, false, "failing weakCompareAndSetPlain float");
             float x = (float) vh.get(recv);
-            assertEquals(x, 2.0f, "failing weakCompareAndSetPlain float value");
+            assertEquals(2.0f, x, "failing weakCompareAndSetPlain float value");
         }
 
         {
@@ -576,14 +574,14 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire float");
             float x = (float) vh.get(recv);
-            assertEquals(x, 1.0f, "success weakCompareAndSetAcquire float");
+            assertEquals(1.0f, x, "success weakCompareAndSetAcquire float");
         }
 
         {
             boolean success = vh.weakCompareAndSetAcquire(recv, 2.0f, 3.0f);
             assertEquals(success, false, "failing weakCompareAndSetAcquire float");
             float x = (float) vh.get(recv);
-            assertEquals(x, 1.0f, "failing weakCompareAndSetAcquire float value");
+            assertEquals(1.0f, x, "failing weakCompareAndSetAcquire float value");
         }
 
         {
@@ -594,14 +592,14 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease float");
             float x = (float) vh.get(recv);
-            assertEquals(x, 2.0f, "success weakCompareAndSetRelease float");
+            assertEquals(2.0f, x, "success weakCompareAndSetRelease float");
         }
 
         {
             boolean success = vh.weakCompareAndSetRelease(recv, 1.0f, 3.0f);
             assertEquals(success, false, "failing weakCompareAndSetRelease float");
             float x = (float) vh.get(recv);
-            assertEquals(x, 2.0f, "failing weakCompareAndSetRelease float value");
+            assertEquals(2.0f, x, "failing weakCompareAndSetRelease float value");
         }
 
         {
@@ -612,14 +610,14 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet float");
             float x = (float) vh.get(recv);
-            assertEquals(x, 1.0f, "success weakCompareAndSet float value");
+            assertEquals(1.0f, x, "success weakCompareAndSet float value");
         }
 
         {
             boolean success = vh.weakCompareAndSet(recv, 2.0f, 3.0f);
             assertEquals(success, false, "failing weakCompareAndSet float");
             float x = (float) vh.get(recv);
-            assertEquals(x, 1.0f, "failing weakCompareAndSet float value");
+            assertEquals(1.0f, x, "failing weakCompareAndSet float value");
         }
 
         // Compare set and get
@@ -627,27 +625,27 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
             vh.set(recv, 1.0f);
 
             float o = (float) vh.getAndSet(recv, 2.0f);
-            assertEquals(o, 1.0f, "getAndSet float");
+            assertEquals(1.0f, o, "getAndSet float");
             float x = (float) vh.get(recv);
-            assertEquals(x, 2.0f, "getAndSet float value");
+            assertEquals(2.0f, x, "getAndSet float value");
         }
 
         {
             vh.set(recv, 1.0f);
 
             float o = (float) vh.getAndSetAcquire(recv, 2.0f);
-            assertEquals(o, 1.0f, "getAndSetAcquire float");
+            assertEquals(1.0f, o, "getAndSetAcquire float");
             float x = (float) vh.get(recv);
-            assertEquals(x, 2.0f, "getAndSetAcquire float value");
+            assertEquals(2.0f, x, "getAndSetAcquire float value");
         }
 
         {
             vh.set(recv, 1.0f);
 
             float o = (float) vh.getAndSetRelease(recv, 2.0f);
-            assertEquals(o, 1.0f, "getAndSetRelease float");
+            assertEquals(1.0f, o, "getAndSetRelease float");
             float x = (float) vh.get(recv);
-            assertEquals(x, 2.0f, "getAndSetRelease float value");
+            assertEquals(2.0f, x, "getAndSetRelease float value");
         }
 
         // get and add, add and get
@@ -655,27 +653,27 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
             vh.set(recv, 1.0f);
 
             float o = (float) vh.getAndAdd(recv, 2.0f);
-            assertEquals(o, 1.0f, "getAndAdd float");
+            assertEquals(1.0f, o, "getAndAdd float");
             float x = (float) vh.get(recv);
-            assertEquals(x, (float)(1.0f + 2.0f), "getAndAdd float value");
+            assertEquals((float)(1.0f + 2.0f), x, "getAndAdd float value");
         }
 
         {
             vh.set(recv, 1.0f);
 
             float o = (float) vh.getAndAddAcquire(recv, 2.0f);
-            assertEquals(o, 1.0f, "getAndAddAcquire float");
+            assertEquals(1.0f, o, "getAndAddAcquire float");
             float x = (float) vh.get(recv);
-            assertEquals(x, (float)(1.0f + 2.0f), "getAndAddAcquire float value");
+            assertEquals((float)(1.0f + 2.0f), x, "getAndAddAcquire float value");
         }
 
         {
             vh.set(recv, 1.0f);
 
             float o = (float) vh.getAndAddRelease(recv, 2.0f);
-            assertEquals(o, 1.0f, "getAndAddReleasefloat");
+            assertEquals(1.0f, o, "getAndAddReleasefloat");
             float x = (float) vh.get(recv);
-            assertEquals(x, (float)(1.0f + 2.0f), "getAndAddRelease float value");
+            assertEquals((float)(1.0f + 2.0f), x, "getAndAddRelease float value");
         }
 
     }
@@ -726,7 +724,7 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
         {
             vh.set(1.0f);
             float x = (float) vh.get();
-            assertEquals(x, 1.0f, "set float value");
+            assertEquals(1.0f, x, "set float value");
         }
 
 
@@ -734,21 +732,21 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
         {
             vh.setVolatile(2.0f);
             float x = (float) vh.getVolatile();
-            assertEquals(x, 2.0f, "setVolatile float value");
+            assertEquals(2.0f, x, "setVolatile float value");
         }
 
         // Lazy
         {
             vh.setRelease(1.0f);
             float x = (float) vh.getAcquire();
-            assertEquals(x, 1.0f, "setRelease float value");
+            assertEquals(1.0f, x, "setRelease float value");
         }
 
         // Opaque
         {
             vh.setOpaque(2.0f);
             float x = (float) vh.getOpaque();
-            assertEquals(x, 2.0f, "setOpaque float value");
+            assertEquals(2.0f, x, "setOpaque float value");
         }
 
         vh.set(1.0f);
@@ -758,56 +756,56 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
             boolean r = vh.compareAndSet(1.0f, 2.0f);
             assertEquals(r, true, "success compareAndSet float");
             float x = (float) vh.get();
-            assertEquals(x, 2.0f, "success compareAndSet float value");
+            assertEquals(2.0f, x, "success compareAndSet float value");
         }
 
         {
             boolean r = vh.compareAndSet(1.0f, 3.0f);
             assertEquals(r, false, "failing compareAndSet float");
             float x = (float) vh.get();
-            assertEquals(x, 2.0f, "failing compareAndSet float value");
+            assertEquals(2.0f, x, "failing compareAndSet float value");
         }
 
         {
             float r = (float) vh.compareAndExchange(2.0f, 1.0f);
             assertEquals(r, 2.0f, "success compareAndExchange float");
             float x = (float) vh.get();
-            assertEquals(x, 1.0f, "success compareAndExchange float value");
+            assertEquals(1.0f, x, "success compareAndExchange float value");
         }
 
         {
             float r = (float) vh.compareAndExchange(2.0f, 3.0f);
             assertEquals(r, 1.0f, "failing compareAndExchange float");
             float x = (float) vh.get();
-            assertEquals(x, 1.0f, "failing compareAndExchange float value");
+            assertEquals(1.0f, x, "failing compareAndExchange float value");
         }
 
         {
             float r = (float) vh.compareAndExchangeAcquire(1.0f, 2.0f);
             assertEquals(r, 1.0f, "success compareAndExchangeAcquire float");
             float x = (float) vh.get();
-            assertEquals(x, 2.0f, "success compareAndExchangeAcquire float value");
+            assertEquals(2.0f, x, "success compareAndExchangeAcquire float value");
         }
 
         {
             float r = (float) vh.compareAndExchangeAcquire(1.0f, 3.0f);
             assertEquals(r, 2.0f, "failing compareAndExchangeAcquire float");
             float x = (float) vh.get();
-            assertEquals(x, 2.0f, "failing compareAndExchangeAcquire float value");
+            assertEquals(2.0f, x, "failing compareAndExchangeAcquire float value");
         }
 
         {
             float r = (float) vh.compareAndExchangeRelease(2.0f, 1.0f);
             assertEquals(r, 2.0f, "success compareAndExchangeRelease float");
             float x = (float) vh.get();
-            assertEquals(x, 1.0f, "success compareAndExchangeRelease float value");
+            assertEquals(1.0f, x, "success compareAndExchangeRelease float value");
         }
 
         {
             float r = (float) vh.compareAndExchangeRelease(2.0f, 3.0f);
             assertEquals(r, 1.0f, "failing compareAndExchangeRelease float");
             float x = (float) vh.get();
-            assertEquals(x, 1.0f, "failing compareAndExchangeRelease float value");
+            assertEquals(1.0f, x, "failing compareAndExchangeRelease float value");
         }
 
         {
@@ -818,14 +816,14 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain float");
             float x = (float) vh.get();
-            assertEquals(x, 2.0f, "success weakCompareAndSetPlain float value");
+            assertEquals(2.0f, x, "success weakCompareAndSetPlain float value");
         }
 
         {
             boolean success = vh.weakCompareAndSetPlain(1.0f, 3.0f);
             assertEquals(success, false, "failing weakCompareAndSetPlain float");
             float x = (float) vh.get();
-            assertEquals(x, 2.0f, "failing weakCompareAndSetPlain float value");
+            assertEquals(2.0f, x, "failing weakCompareAndSetPlain float value");
         }
 
         {
@@ -836,14 +834,14 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire float");
             float x = (float) vh.get();
-            assertEquals(x, 1.0f, "success weakCompareAndSetAcquire float");
+            assertEquals(1.0f, x, "success weakCompareAndSetAcquire float");
         }
 
         {
             boolean success = vh.weakCompareAndSetAcquire(2.0f, 3.0f);
             assertEquals(success, false, "failing weakCompareAndSetAcquire float");
             float x = (float) vh.get();
-            assertEquals(x, 1.0f, "failing weakCompareAndSetAcquire float value");
+            assertEquals(1.0f, x, "failing weakCompareAndSetAcquire float value");
         }
 
         {
@@ -854,14 +852,14 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease float");
             float x = (float) vh.get();
-            assertEquals(x, 2.0f, "success weakCompareAndSetRelease float");
+            assertEquals(2.0f, x, "success weakCompareAndSetRelease float");
         }
 
         {
             boolean success = vh.weakCompareAndSetRelease(1.0f, 3.0f);
             assertEquals(success, false, "failing weakCompareAndSetRelease float");
             float x = (float) vh.get();
-            assertEquals(x, 2.0f, "failing weakCompareAndSetRelease float value");
+            assertEquals(2.0f, x, "failing weakCompareAndSetRelease float value");
         }
 
         {
@@ -872,14 +870,14 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet float");
             float x = (float) vh.get();
-            assertEquals(x, 1.0f, "success weakCompareAndSet float");
+            assertEquals(1.0f, x, "success weakCompareAndSet float");
         }
 
         {
             boolean success = vh.weakCompareAndSet(2.0f, 3.0f);
             assertEquals(success, false, "failing weakCompareAndSet float");
             float x = (float) vh.get();
-            assertEquals(x, 1.0f, "failing weakCompareAndSet float value");
+            assertEquals(1.0f, x, "failing weakCompareAndSet float value");
         }
 
         // Compare set and get
@@ -887,27 +885,27 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
             vh.set(1.0f);
 
             float o = (float) vh.getAndSet(2.0f);
-            assertEquals(o, 1.0f, "getAndSet float");
+            assertEquals(1.0f, o, "getAndSet float");
             float x = (float) vh.get();
-            assertEquals(x, 2.0f, "getAndSet float value");
+            assertEquals(2.0f, x, "getAndSet float value");
         }
 
         {
             vh.set(1.0f);
 
             float o = (float) vh.getAndSetAcquire(2.0f);
-            assertEquals(o, 1.0f, "getAndSetAcquire float");
+            assertEquals(1.0f, o, "getAndSetAcquire float");
             float x = (float) vh.get();
-            assertEquals(x, 2.0f, "getAndSetAcquire float value");
+            assertEquals(2.0f, x, "getAndSetAcquire float value");
         }
 
         {
             vh.set(1.0f);
 
             float o = (float) vh.getAndSetRelease(2.0f);
-            assertEquals(o, 1.0f, "getAndSetRelease float");
+            assertEquals(1.0f, o, "getAndSetRelease float");
             float x = (float) vh.get();
-            assertEquals(x, 2.0f, "getAndSetRelease float value");
+            assertEquals(2.0f, x, "getAndSetRelease float value");
         }
 
         // get and add, add and get
@@ -915,27 +913,27 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
             vh.set(1.0f);
 
             float o = (float) vh.getAndAdd(2.0f);
-            assertEquals(o, 1.0f, "getAndAdd float");
+            assertEquals(1.0f, o, "getAndAdd float");
             float x = (float) vh.get();
-            assertEquals(x, (float)(1.0f + 2.0f), "getAndAdd float value");
+            assertEquals((float)(1.0f + 2.0f), x, "getAndAdd float value");
         }
 
         {
             vh.set(1.0f);
 
             float o = (float) vh.getAndAddAcquire(2.0f);
-            assertEquals(o, 1.0f, "getAndAddAcquire float");
+            assertEquals(1.0f, o, "getAndAddAcquire float");
             float x = (float) vh.get();
-            assertEquals(x, (float)(1.0f + 2.0f), "getAndAddAcquire float value");
+            assertEquals((float)(1.0f + 2.0f), x, "getAndAddAcquire float value");
         }
 
         {
             vh.set(1.0f);
 
             float o = (float) vh.getAndAddRelease(2.0f);
-            assertEquals(o, 1.0f, "getAndAddReleasefloat");
+            assertEquals(1.0f, o, "getAndAddReleasefloat");
             float x = (float) vh.get();
-            assertEquals(x, (float)(1.0f + 2.0f), "getAndAddRelease float value");
+            assertEquals((float)(1.0f + 2.0f), x, "getAndAddRelease float value");
         }
 
     }
@@ -989,7 +987,7 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
             {
                 vh.set(array, i, 1.0f);
                 float x = (float) vh.get(array, i);
-                assertEquals(x, 1.0f, "get float value");
+                assertEquals(1.0f, x, "get float value");
             }
 
 
@@ -997,21 +995,21 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
             {
                 vh.setVolatile(array, i, 2.0f);
                 float x = (float) vh.getVolatile(array, i);
-                assertEquals(x, 2.0f, "setVolatile float value");
+                assertEquals(2.0f, x, "setVolatile float value");
             }
 
             // Lazy
             {
                 vh.setRelease(array, i, 1.0f);
                 float x = (float) vh.getAcquire(array, i);
-                assertEquals(x, 1.0f, "setRelease float value");
+                assertEquals(1.0f, x, "setRelease float value");
             }
 
             // Opaque
             {
                 vh.setOpaque(array, i, 2.0f);
                 float x = (float) vh.getOpaque(array, i);
-                assertEquals(x, 2.0f, "setOpaque float value");
+                assertEquals(2.0f, x, "setOpaque float value");
             }
 
             vh.set(array, i, 1.0f);
@@ -1021,56 +1019,56 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
                 boolean r = vh.compareAndSet(array, i, 1.0f, 2.0f);
                 assertEquals(r, true, "success compareAndSet float");
                 float x = (float) vh.get(array, i);
-                assertEquals(x, 2.0f, "success compareAndSet float value");
+                assertEquals(2.0f, x, "success compareAndSet float value");
             }
 
             {
                 boolean r = vh.compareAndSet(array, i, 1.0f, 3.0f);
                 assertEquals(r, false, "failing compareAndSet float");
                 float x = (float) vh.get(array, i);
-                assertEquals(x, 2.0f, "failing compareAndSet float value");
+                assertEquals(2.0f, x, "failing compareAndSet float value");
             }
 
             {
                 float r = (float) vh.compareAndExchange(array, i, 2.0f, 1.0f);
                 assertEquals(r, 2.0f, "success compareAndExchange float");
                 float x = (float) vh.get(array, i);
-                assertEquals(x, 1.0f, "success compareAndExchange float value");
+                assertEquals(1.0f, x, "success compareAndExchange float value");
             }
 
             {
                 float r = (float) vh.compareAndExchange(array, i, 2.0f, 3.0f);
                 assertEquals(r, 1.0f, "failing compareAndExchange float");
                 float x = (float) vh.get(array, i);
-                assertEquals(x, 1.0f, "failing compareAndExchange float value");
+                assertEquals(1.0f, x, "failing compareAndExchange float value");
             }
 
             {
                 float r = (float) vh.compareAndExchangeAcquire(array, i, 1.0f, 2.0f);
                 assertEquals(r, 1.0f, "success compareAndExchangeAcquire float");
                 float x = (float) vh.get(array, i);
-                assertEquals(x, 2.0f, "success compareAndExchangeAcquire float value");
+                assertEquals(2.0f, x, "success compareAndExchangeAcquire float value");
             }
 
             {
                 float r = (float) vh.compareAndExchangeAcquire(array, i, 1.0f, 3.0f);
                 assertEquals(r, 2.0f, "failing compareAndExchangeAcquire float");
                 float x = (float) vh.get(array, i);
-                assertEquals(x, 2.0f, "failing compareAndExchangeAcquire float value");
+                assertEquals(2.0f, x, "failing compareAndExchangeAcquire float value");
             }
 
             {
                 float r = (float) vh.compareAndExchangeRelease(array, i, 2.0f, 1.0f);
                 assertEquals(r, 2.0f, "success compareAndExchangeRelease float");
                 float x = (float) vh.get(array, i);
-                assertEquals(x, 1.0f, "success compareAndExchangeRelease float value");
+                assertEquals(1.0f, x, "success compareAndExchangeRelease float value");
             }
 
             {
                 float r = (float) vh.compareAndExchangeRelease(array, i, 2.0f, 3.0f);
                 assertEquals(r, 1.0f, "failing compareAndExchangeRelease float");
                 float x = (float) vh.get(array, i);
-                assertEquals(x, 1.0f, "failing compareAndExchangeRelease float value");
+                assertEquals(1.0f, x, "failing compareAndExchangeRelease float value");
             }
 
             {
@@ -1081,14 +1079,14 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetPlain float");
                 float x = (float) vh.get(array, i);
-                assertEquals(x, 2.0f, "success weakCompareAndSetPlain float value");
+                assertEquals(2.0f, x, "success weakCompareAndSetPlain float value");
             }
 
             {
                 boolean success = vh.weakCompareAndSetPlain(array, i, 1.0f, 3.0f);
                 assertEquals(success, false, "failing weakCompareAndSetPlain float");
                 float x = (float) vh.get(array, i);
-                assertEquals(x, 2.0f, "failing weakCompareAndSetPlain float value");
+                assertEquals(2.0f, x, "failing weakCompareAndSetPlain float value");
             }
 
             {
@@ -1099,14 +1097,14 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetAcquire float");
                 float x = (float) vh.get(array, i);
-                assertEquals(x, 1.0f, "success weakCompareAndSetAcquire float");
+                assertEquals(1.0f, x, "success weakCompareAndSetAcquire float");
             }
 
             {
                 boolean success = vh.weakCompareAndSetAcquire(array, i, 2.0f, 3.0f);
                 assertEquals(success, false, "failing weakCompareAndSetAcquire float");
                 float x = (float) vh.get(array, i);
-                assertEquals(x, 1.0f, "failing weakCompareAndSetAcquire float value");
+                assertEquals(1.0f, x, "failing weakCompareAndSetAcquire float value");
             }
 
             {
@@ -1117,14 +1115,14 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetRelease float");
                 float x = (float) vh.get(array, i);
-                assertEquals(x, 2.0f, "success weakCompareAndSetRelease float");
+                assertEquals(2.0f, x, "success weakCompareAndSetRelease float");
             }
 
             {
                 boolean success = vh.weakCompareAndSetRelease(array, i, 1.0f, 3.0f);
                 assertEquals(success, false, "failing weakCompareAndSetRelease float");
                 float x = (float) vh.get(array, i);
-                assertEquals(x, 2.0f, "failing weakCompareAndSetRelease float value");
+                assertEquals(2.0f, x, "failing weakCompareAndSetRelease float value");
             }
 
             {
@@ -1135,14 +1133,14 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSet float");
                 float x = (float) vh.get(array, i);
-                assertEquals(x, 1.0f, "success weakCompareAndSet float");
+                assertEquals(1.0f, x, "success weakCompareAndSet float");
             }
 
             {
                 boolean success = vh.weakCompareAndSet(array, i, 2.0f, 3.0f);
                 assertEquals(success, false, "failing weakCompareAndSet float");
                 float x = (float) vh.get(array, i);
-                assertEquals(x, 1.0f, "failing weakCompareAndSet float value");
+                assertEquals(1.0f, x, "failing weakCompareAndSet float value");
             }
 
             // Compare set and get
@@ -1150,27 +1148,27 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
                 vh.set(array, i, 1.0f);
 
                 float o = (float) vh.getAndSet(array, i, 2.0f);
-                assertEquals(o, 1.0f, "getAndSet float");
+                assertEquals(1.0f, o, "getAndSet float");
                 float x = (float) vh.get(array, i);
-                assertEquals(x, 2.0f, "getAndSet float value");
+                assertEquals(2.0f, x, "getAndSet float value");
             }
 
             {
                 vh.set(array, i, 1.0f);
 
                 float o = (float) vh.getAndSetAcquire(array, i, 2.0f);
-                assertEquals(o, 1.0f, "getAndSetAcquire float");
+                assertEquals(1.0f, o, "getAndSetAcquire float");
                 float x = (float) vh.get(array, i);
-                assertEquals(x, 2.0f, "getAndSetAcquire float value");
+                assertEquals(2.0f, x, "getAndSetAcquire float value");
             }
 
             {
                 vh.set(array, i, 1.0f);
 
                 float o = (float) vh.getAndSetRelease(array, i, 2.0f);
-                assertEquals(o, 1.0f, "getAndSetRelease float");
+                assertEquals(1.0f, o, "getAndSetRelease float");
                 float x = (float) vh.get(array, i);
-                assertEquals(x, 2.0f, "getAndSetRelease float value");
+                assertEquals(2.0f, x, "getAndSetRelease float value");
             }
 
             // get and add, add and get
@@ -1178,27 +1176,27 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
                 vh.set(array, i, 1.0f);
 
                 float o = (float) vh.getAndAdd(array, i, 2.0f);
-                assertEquals(o, 1.0f, "getAndAdd float");
+                assertEquals(1.0f, o, "getAndAdd float");
                 float x = (float) vh.get(array, i);
-                assertEquals(x, (float)(1.0f + 2.0f), "getAndAdd float value");
+                assertEquals((float)(1.0f + 2.0f), x, "getAndAdd float value");
             }
 
             {
                 vh.set(array, i, 1.0f);
 
                 float o = (float) vh.getAndAddAcquire(array, i, 2.0f);
-                assertEquals(o, 1.0f, "getAndAddAcquire float");
+                assertEquals(1.0f, o, "getAndAddAcquire float");
                 float x = (float) vh.get(array, i);
-                assertEquals(x, (float)(1.0f + 2.0f), "getAndAddAcquire float value");
+                assertEquals((float)(1.0f + 2.0f), x, "getAndAddAcquire float value");
             }
 
             {
                 vh.set(array, i, 1.0f);
 
                 float o = (float) vh.getAndAddRelease(array, i, 2.0f);
-                assertEquals(o, 1.0f, "getAndAddReleasefloat");
+                assertEquals(1.0f, o, "getAndAddReleasefloat");
                 float x = (float) vh.get(array, i);
-                assertEquals(x, (float)(1.0f + 2.0f), "getAndAddRelease float value");
+                assertEquals((float)(1.0f + 2.0f), x, "getAndAddRelease float value");
             }
 
         }
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java
index d5dfaa4e1c6..4748d699555 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,28 +23,30 @@
 
 /*
  * @test
- * @run testng/othervm -Diters=10   -Xint                                                   VarHandleTestAccessInt
+ * @run junit/othervm -Diters=10   -Xint                                                   VarHandleTestAccessInt
  *
  * @comment Set CompileThresholdScaling to 0.1 so that the warmup loop sets to 2000 iterations
  *          to hit compilation thresholds
  *
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestAccessInt
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestAccessInt
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestAccessInt
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestAccessInt
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestAccessInt
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestAccessInt
  */
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestAccessInt extends VarHandleBaseTest {
     static final int static_final_v = 0x01234567;
 
@@ -108,7 +110,7 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
         return vhs.toArray(new VarHandle[0]);
     }
 
-    @BeforeClass
+    @BeforeAll
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
                 VarHandleTestAccessInt.class, "final_v", int.class);
@@ -125,8 +127,6 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
         vhArray = MethodHandles.arrayElementVarHandle(int[].class);
     }
 
-
-    @DataProvider
     public Object[][] varHandlesProvider() throws Exception {
         List vhs = new ArrayList<>();
         vhs.add(vhField);
@@ -156,7 +156,8 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
         }
     }
 
-    @Test(dataProvider = "varHandlesProvider")
+    @ParameterizedTest
+    @MethodSource("varHandlesProvider")
     public void testIsAccessModeSupported(VarHandle vh) {
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
@@ -194,8 +195,6 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
     }
 
-
-    @DataProvider
     public Object[][] typesProvider() throws Exception {
         List types = new ArrayList<>();
         types.add(new Object[] {vhField, Arrays.asList(VarHandleTestAccessInt.class)});
@@ -205,16 +204,16 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
         return types.stream().toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "typesProvider")
+    @ParameterizedTest
+    @MethodSource("typesProvider")
     public void testTypes(VarHandle vh, List> pts) {
-        assertEquals(vh.varType(), int.class);
+        assertEquals(int.class, vh.varType());
 
-        assertEquals(vh.coordinateTypes(), pts);
+        assertEquals(pts, vh.coordinateTypes());
 
         testTypes(vh);
     }
 
-
     @Test
     public void testLookupInstanceToStatic() {
         checkIAE("Lookup of static final field to instance final field", () -> {
@@ -241,8 +240,6 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
         });
     }
 
-
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -284,7 +281,8 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -297,26 +295,26 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
         // Plain
         {
             int x = (int) vh.get(recv);
-            assertEquals(x, 0x01234567, "get int value");
+            assertEquals(0x01234567, x, "get int value");
         }
 
 
         // Volatile
         {
             int x = (int) vh.getVolatile(recv);
-            assertEquals(x, 0x01234567, "getVolatile int value");
+            assertEquals(0x01234567, x, "getVolatile int value");
         }
 
         // Lazy
         {
             int x = (int) vh.getAcquire(recv);
-            assertEquals(x, 0x01234567, "getRelease int value");
+            assertEquals(0x01234567, x, "getRelease int value");
         }
 
         // Opaque
         {
             int x = (int) vh.getOpaque(recv);
-            assertEquals(x, 0x01234567, "getOpaque int value");
+            assertEquals(0x01234567, x, "getOpaque int value");
         }
     }
 
@@ -346,26 +344,26 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
         // Plain
         {
             int x = (int) vh.get();
-            assertEquals(x, 0x01234567, "get int value");
+            assertEquals(0x01234567, x, "get int value");
         }
 
 
         // Volatile
         {
             int x = (int) vh.getVolatile();
-            assertEquals(x, 0x01234567, "getVolatile int value");
+            assertEquals(0x01234567, x, "getVolatile int value");
         }
 
         // Lazy
         {
             int x = (int) vh.getAcquire();
-            assertEquals(x, 0x01234567, "getRelease int value");
+            assertEquals(0x01234567, x, "getRelease int value");
         }
 
         // Opaque
         {
             int x = (int) vh.getOpaque();
-            assertEquals(x, 0x01234567, "getOpaque int value");
+            assertEquals(0x01234567, x, "getOpaque int value");
         }
     }
 
@@ -396,7 +394,7 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
         {
             vh.set(recv, 0x01234567);
             int x = (int) vh.get(recv);
-            assertEquals(x, 0x01234567, "set int value");
+            assertEquals(0x01234567, x, "set int value");
         }
 
 
@@ -404,21 +402,21 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
         {
             vh.setVolatile(recv, 0x89ABCDEF);
             int x = (int) vh.getVolatile(recv);
-            assertEquals(x, 0x89ABCDEF, "setVolatile int value");
+            assertEquals(0x89ABCDEF, x, "setVolatile int value");
         }
 
         // Lazy
         {
             vh.setRelease(recv, 0x01234567);
             int x = (int) vh.getAcquire(recv);
-            assertEquals(x, 0x01234567, "setRelease int value");
+            assertEquals(0x01234567, x, "setRelease int value");
         }
 
         // Opaque
         {
             vh.setOpaque(recv, 0x89ABCDEF);
             int x = (int) vh.getOpaque(recv);
-            assertEquals(x, 0x89ABCDEF, "setOpaque int value");
+            assertEquals(0x89ABCDEF, x, "setOpaque int value");
         }
 
         vh.set(recv, 0x01234567);
@@ -428,56 +426,56 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
             boolean r = vh.compareAndSet(recv, 0x01234567, 0x89ABCDEF);
             assertEquals(r, true, "success compareAndSet int");
             int x = (int) vh.get(recv);
-            assertEquals(x, 0x89ABCDEF, "success compareAndSet int value");
+            assertEquals(0x89ABCDEF, x, "success compareAndSet int value");
         }
 
         {
             boolean r = vh.compareAndSet(recv, 0x01234567, 0xCAFEBABE);
             assertEquals(r, false, "failing compareAndSet int");
             int x = (int) vh.get(recv);
-            assertEquals(x, 0x89ABCDEF, "failing compareAndSet int value");
+            assertEquals(0x89ABCDEF, x, "failing compareAndSet int value");
         }
 
         {
             int r = (int) vh.compareAndExchange(recv, 0x89ABCDEF, 0x01234567);
             assertEquals(r, 0x89ABCDEF, "success compareAndExchange int");
             int x = (int) vh.get(recv);
-            assertEquals(x, 0x01234567, "success compareAndExchange int value");
+            assertEquals(0x01234567, x, "success compareAndExchange int value");
         }
 
         {
             int r = (int) vh.compareAndExchange(recv, 0x89ABCDEF, 0xCAFEBABE);
             assertEquals(r, 0x01234567, "failing compareAndExchange int");
             int x = (int) vh.get(recv);
-            assertEquals(x, 0x01234567, "failing compareAndExchange int value");
+            assertEquals(0x01234567, x, "failing compareAndExchange int value");
         }
 
         {
             int r = (int) vh.compareAndExchangeAcquire(recv, 0x01234567, 0x89ABCDEF);
             assertEquals(r, 0x01234567, "success compareAndExchangeAcquire int");
             int x = (int) vh.get(recv);
-            assertEquals(x, 0x89ABCDEF, "success compareAndExchangeAcquire int value");
+            assertEquals(0x89ABCDEF, x, "success compareAndExchangeAcquire int value");
         }
 
         {
             int r = (int) vh.compareAndExchangeAcquire(recv, 0x01234567, 0xCAFEBABE);
             assertEquals(r, 0x89ABCDEF, "failing compareAndExchangeAcquire int");
             int x = (int) vh.get(recv);
-            assertEquals(x, 0x89ABCDEF, "failing compareAndExchangeAcquire int value");
+            assertEquals(0x89ABCDEF, x, "failing compareAndExchangeAcquire int value");
         }
 
         {
             int r = (int) vh.compareAndExchangeRelease(recv, 0x89ABCDEF, 0x01234567);
             assertEquals(r, 0x89ABCDEF, "success compareAndExchangeRelease int");
             int x = (int) vh.get(recv);
-            assertEquals(x, 0x01234567, "success compareAndExchangeRelease int value");
+            assertEquals(0x01234567, x, "success compareAndExchangeRelease int value");
         }
 
         {
             int r = (int) vh.compareAndExchangeRelease(recv, 0x89ABCDEF, 0xCAFEBABE);
             assertEquals(r, 0x01234567, "failing compareAndExchangeRelease int");
             int x = (int) vh.get(recv);
-            assertEquals(x, 0x01234567, "failing compareAndExchangeRelease int value");
+            assertEquals(0x01234567, x, "failing compareAndExchangeRelease int value");
         }
 
         {
@@ -488,14 +486,14 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain int");
             int x = (int) vh.get(recv);
-            assertEquals(x, 0x89ABCDEF, "success weakCompareAndSetPlain int value");
+            assertEquals(0x89ABCDEF, x, "success weakCompareAndSetPlain int value");
         }
 
         {
             boolean success = vh.weakCompareAndSetPlain(recv, 0x01234567, 0xCAFEBABE);
             assertEquals(success, false, "failing weakCompareAndSetPlain int");
             int x = (int) vh.get(recv);
-            assertEquals(x, 0x89ABCDEF, "failing weakCompareAndSetPlain int value");
+            assertEquals(0x89ABCDEF, x, "failing weakCompareAndSetPlain int value");
         }
 
         {
@@ -506,14 +504,14 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire int");
             int x = (int) vh.get(recv);
-            assertEquals(x, 0x01234567, "success weakCompareAndSetAcquire int");
+            assertEquals(0x01234567, x, "success weakCompareAndSetAcquire int");
         }
 
         {
             boolean success = vh.weakCompareAndSetAcquire(recv, 0x89ABCDEF, 0xCAFEBABE);
             assertEquals(success, false, "failing weakCompareAndSetAcquire int");
             int x = (int) vh.get(recv);
-            assertEquals(x, 0x01234567, "failing weakCompareAndSetAcquire int value");
+            assertEquals(0x01234567, x, "failing weakCompareAndSetAcquire int value");
         }
 
         {
@@ -524,14 +522,14 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease int");
             int x = (int) vh.get(recv);
-            assertEquals(x, 0x89ABCDEF, "success weakCompareAndSetRelease int");
+            assertEquals(0x89ABCDEF, x, "success weakCompareAndSetRelease int");
         }
 
         {
             boolean success = vh.weakCompareAndSetRelease(recv, 0x01234567, 0xCAFEBABE);
             assertEquals(success, false, "failing weakCompareAndSetRelease int");
             int x = (int) vh.get(recv);
-            assertEquals(x, 0x89ABCDEF, "failing weakCompareAndSetRelease int value");
+            assertEquals(0x89ABCDEF, x, "failing weakCompareAndSetRelease int value");
         }
 
         {
@@ -542,14 +540,14 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet int");
             int x = (int) vh.get(recv);
-            assertEquals(x, 0x01234567, "success weakCompareAndSet int value");
+            assertEquals(0x01234567, x, "success weakCompareAndSet int value");
         }
 
         {
             boolean success = vh.weakCompareAndSet(recv, 0x89ABCDEF, 0xCAFEBABE);
             assertEquals(success, false, "failing weakCompareAndSet int");
             int x = (int) vh.get(recv);
-            assertEquals(x, 0x01234567, "failing weakCompareAndSet int value");
+            assertEquals(0x01234567, x, "failing weakCompareAndSet int value");
         }
 
         // Compare set and get
@@ -557,27 +555,27 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
             vh.set(recv, 0x01234567);
 
             int o = (int) vh.getAndSet(recv, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndSet int");
+            assertEquals(0x01234567, o, "getAndSet int");
             int x = (int) vh.get(recv);
-            assertEquals(x, 0x89ABCDEF, "getAndSet int value");
+            assertEquals(0x89ABCDEF, x, "getAndSet int value");
         }
 
         {
             vh.set(recv, 0x01234567);
 
             int o = (int) vh.getAndSetAcquire(recv, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndSetAcquire int");
+            assertEquals(0x01234567, o, "getAndSetAcquire int");
             int x = (int) vh.get(recv);
-            assertEquals(x, 0x89ABCDEF, "getAndSetAcquire int value");
+            assertEquals(0x89ABCDEF, x, "getAndSetAcquire int value");
         }
 
         {
             vh.set(recv, 0x01234567);
 
             int o = (int) vh.getAndSetRelease(recv, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndSetRelease int");
+            assertEquals(0x01234567, o, "getAndSetRelease int");
             int x = (int) vh.get(recv);
-            assertEquals(x, 0x89ABCDEF, "getAndSetRelease int value");
+            assertEquals(0x89ABCDEF, x, "getAndSetRelease int value");
         }
 
         // get and add, add and get
@@ -585,27 +583,27 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
             vh.set(recv, 0x01234567);
 
             int o = (int) vh.getAndAdd(recv, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndAdd int");
+            assertEquals(0x01234567, o, "getAndAdd int");
             int x = (int) vh.get(recv);
-            assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAdd int value");
+            assertEquals((int)(0x01234567 + 0x89ABCDEF), x, "getAndAdd int value");
         }
 
         {
             vh.set(recv, 0x01234567);
 
             int o = (int) vh.getAndAddAcquire(recv, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndAddAcquire int");
+            assertEquals(0x01234567, o, "getAndAddAcquire int");
             int x = (int) vh.get(recv);
-            assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddAcquire int value");
+            assertEquals((int)(0x01234567 + 0x89ABCDEF), x, "getAndAddAcquire int value");
         }
 
         {
             vh.set(recv, 0x01234567);
 
             int o = (int) vh.getAndAddRelease(recv, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndAddReleaseint");
+            assertEquals(0x01234567, o, "getAndAddReleaseint");
             int x = (int) vh.get(recv);
-            assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddRelease int value");
+            assertEquals((int)(0x01234567 + 0x89ABCDEF), x, "getAndAddRelease int value");
         }
 
         // get and bitwise or
@@ -613,27 +611,27 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
             vh.set(recv, 0x01234567);
 
             int o = (int) vh.getAndBitwiseOr(recv, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseOr int");
+            assertEquals(0x01234567, o, "getAndBitwiseOr int");
             int x = (int) vh.get(recv);
-            assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOr int value");
+            assertEquals((int)(0x01234567 | 0x89ABCDEF), x, "getAndBitwiseOr int value");
         }
 
         {
             vh.set(recv, 0x01234567);
 
             int o = (int) vh.getAndBitwiseOrAcquire(recv, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseOrAcquire int");
+            assertEquals(0x01234567, o, "getAndBitwiseOrAcquire int");
             int x = (int) vh.get(recv);
-            assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrAcquire int value");
+            assertEquals((int)(0x01234567 | 0x89ABCDEF), x, "getAndBitwiseOrAcquire int value");
         }
 
         {
             vh.set(recv, 0x01234567);
 
             int o = (int) vh.getAndBitwiseOrRelease(recv, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseOrRelease int");
+            assertEquals(0x01234567, o, "getAndBitwiseOrRelease int");
             int x = (int) vh.get(recv);
-            assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrRelease int value");
+            assertEquals((int)(0x01234567 | 0x89ABCDEF), x, "getAndBitwiseOrRelease int value");
         }
 
         // get and bitwise and
@@ -641,27 +639,27 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
             vh.set(recv, 0x01234567);
 
             int o = (int) vh.getAndBitwiseAnd(recv, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseAnd int");
+            assertEquals(0x01234567, o, "getAndBitwiseAnd int");
             int x = (int) vh.get(recv);
-            assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAnd int value");
+            assertEquals((int)(0x01234567 & 0x89ABCDEF), x, "getAndBitwiseAnd int value");
         }
 
         {
             vh.set(recv, 0x01234567);
 
             int o = (int) vh.getAndBitwiseAndAcquire(recv, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseAndAcquire int");
+            assertEquals(0x01234567, o, "getAndBitwiseAndAcquire int");
             int x = (int) vh.get(recv);
-            assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndAcquire int value");
+            assertEquals((int)(0x01234567 & 0x89ABCDEF), x, "getAndBitwiseAndAcquire int value");
         }
 
         {
             vh.set(recv, 0x01234567);
 
             int o = (int) vh.getAndBitwiseAndRelease(recv, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseAndRelease int");
+            assertEquals(0x01234567, o, "getAndBitwiseAndRelease int");
             int x = (int) vh.get(recv);
-            assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndRelease int value");
+            assertEquals((int)(0x01234567 & 0x89ABCDEF), x, "getAndBitwiseAndRelease int value");
         }
 
         // get and bitwise xor
@@ -669,27 +667,27 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
             vh.set(recv, 0x01234567);
 
             int o = (int) vh.getAndBitwiseXor(recv, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseXor int");
+            assertEquals(0x01234567, o, "getAndBitwiseXor int");
             int x = (int) vh.get(recv);
-            assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXor int value");
+            assertEquals((int)(0x01234567 ^ 0x89ABCDEF), x, "getAndBitwiseXor int value");
         }
 
         {
             vh.set(recv, 0x01234567);
 
             int o = (int) vh.getAndBitwiseXorAcquire(recv, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseXorAcquire int");
+            assertEquals(0x01234567, o, "getAndBitwiseXorAcquire int");
             int x = (int) vh.get(recv);
-            assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorAcquire int value");
+            assertEquals((int)(0x01234567 ^ 0x89ABCDEF), x, "getAndBitwiseXorAcquire int value");
         }
 
         {
             vh.set(recv, 0x01234567);
 
             int o = (int) vh.getAndBitwiseXorRelease(recv, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseXorRelease int");
+            assertEquals(0x01234567, o, "getAndBitwiseXorRelease int");
             int x = (int) vh.get(recv);
-            assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorRelease int value");
+            assertEquals((int)(0x01234567 ^ 0x89ABCDEF), x, "getAndBitwiseXorRelease int value");
         }
     }
 
@@ -704,7 +702,7 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
         {
             vh.set(0x01234567);
             int x = (int) vh.get();
-            assertEquals(x, 0x01234567, "set int value");
+            assertEquals(0x01234567, x, "set int value");
         }
 
 
@@ -712,21 +710,21 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
         {
             vh.setVolatile(0x89ABCDEF);
             int x = (int) vh.getVolatile();
-            assertEquals(x, 0x89ABCDEF, "setVolatile int value");
+            assertEquals(0x89ABCDEF, x, "setVolatile int value");
         }
 
         // Lazy
         {
             vh.setRelease(0x01234567);
             int x = (int) vh.getAcquire();
-            assertEquals(x, 0x01234567, "setRelease int value");
+            assertEquals(0x01234567, x, "setRelease int value");
         }
 
         // Opaque
         {
             vh.setOpaque(0x89ABCDEF);
             int x = (int) vh.getOpaque();
-            assertEquals(x, 0x89ABCDEF, "setOpaque int value");
+            assertEquals(0x89ABCDEF, x, "setOpaque int value");
         }
 
         vh.set(0x01234567);
@@ -736,56 +734,56 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
             boolean r = vh.compareAndSet(0x01234567, 0x89ABCDEF);
             assertEquals(r, true, "success compareAndSet int");
             int x = (int) vh.get();
-            assertEquals(x, 0x89ABCDEF, "success compareAndSet int value");
+            assertEquals(0x89ABCDEF, x, "success compareAndSet int value");
         }
 
         {
             boolean r = vh.compareAndSet(0x01234567, 0xCAFEBABE);
             assertEquals(r, false, "failing compareAndSet int");
             int x = (int) vh.get();
-            assertEquals(x, 0x89ABCDEF, "failing compareAndSet int value");
+            assertEquals(0x89ABCDEF, x, "failing compareAndSet int value");
         }
 
         {
             int r = (int) vh.compareAndExchange(0x89ABCDEF, 0x01234567);
             assertEquals(r, 0x89ABCDEF, "success compareAndExchange int");
             int x = (int) vh.get();
-            assertEquals(x, 0x01234567, "success compareAndExchange int value");
+            assertEquals(0x01234567, x, "success compareAndExchange int value");
         }
 
         {
             int r = (int) vh.compareAndExchange(0x89ABCDEF, 0xCAFEBABE);
             assertEquals(r, 0x01234567, "failing compareAndExchange int");
             int x = (int) vh.get();
-            assertEquals(x, 0x01234567, "failing compareAndExchange int value");
+            assertEquals(0x01234567, x, "failing compareAndExchange int value");
         }
 
         {
             int r = (int) vh.compareAndExchangeAcquire(0x01234567, 0x89ABCDEF);
             assertEquals(r, 0x01234567, "success compareAndExchangeAcquire int");
             int x = (int) vh.get();
-            assertEquals(x, 0x89ABCDEF, "success compareAndExchangeAcquire int value");
+            assertEquals(0x89ABCDEF, x, "success compareAndExchangeAcquire int value");
         }
 
         {
             int r = (int) vh.compareAndExchangeAcquire(0x01234567, 0xCAFEBABE);
             assertEquals(r, 0x89ABCDEF, "failing compareAndExchangeAcquire int");
             int x = (int) vh.get();
-            assertEquals(x, 0x89ABCDEF, "failing compareAndExchangeAcquire int value");
+            assertEquals(0x89ABCDEF, x, "failing compareAndExchangeAcquire int value");
         }
 
         {
             int r = (int) vh.compareAndExchangeRelease(0x89ABCDEF, 0x01234567);
             assertEquals(r, 0x89ABCDEF, "success compareAndExchangeRelease int");
             int x = (int) vh.get();
-            assertEquals(x, 0x01234567, "success compareAndExchangeRelease int value");
+            assertEquals(0x01234567, x, "success compareAndExchangeRelease int value");
         }
 
         {
             int r = (int) vh.compareAndExchangeRelease(0x89ABCDEF, 0xCAFEBABE);
             assertEquals(r, 0x01234567, "failing compareAndExchangeRelease int");
             int x = (int) vh.get();
-            assertEquals(x, 0x01234567, "failing compareAndExchangeRelease int value");
+            assertEquals(0x01234567, x, "failing compareAndExchangeRelease int value");
         }
 
         {
@@ -796,14 +794,14 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain int");
             int x = (int) vh.get();
-            assertEquals(x, 0x89ABCDEF, "success weakCompareAndSetPlain int value");
+            assertEquals(0x89ABCDEF, x, "success weakCompareAndSetPlain int value");
         }
 
         {
             boolean success = vh.weakCompareAndSetPlain(0x01234567, 0xCAFEBABE);
             assertEquals(success, false, "failing weakCompareAndSetPlain int");
             int x = (int) vh.get();
-            assertEquals(x, 0x89ABCDEF, "failing weakCompareAndSetPlain int value");
+            assertEquals(0x89ABCDEF, x, "failing weakCompareAndSetPlain int value");
         }
 
         {
@@ -814,14 +812,14 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire int");
             int x = (int) vh.get();
-            assertEquals(x, 0x01234567, "success weakCompareAndSetAcquire int");
+            assertEquals(0x01234567, x, "success weakCompareAndSetAcquire int");
         }
 
         {
             boolean success = vh.weakCompareAndSetAcquire(0x89ABCDEF, 0xCAFEBABE);
             assertEquals(success, false, "failing weakCompareAndSetAcquire int");
             int x = (int) vh.get();
-            assertEquals(x, 0x01234567, "failing weakCompareAndSetAcquire int value");
+            assertEquals(0x01234567, x, "failing weakCompareAndSetAcquire int value");
         }
 
         {
@@ -832,14 +830,14 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease int");
             int x = (int) vh.get();
-            assertEquals(x, 0x89ABCDEF, "success weakCompareAndSetRelease int");
+            assertEquals(0x89ABCDEF, x, "success weakCompareAndSetRelease int");
         }
 
         {
             boolean success = vh.weakCompareAndSetRelease(0x01234567, 0xCAFEBABE);
             assertEquals(success, false, "failing weakCompareAndSetRelease int");
             int x = (int) vh.get();
-            assertEquals(x, 0x89ABCDEF, "failing weakCompareAndSetRelease int value");
+            assertEquals(0x89ABCDEF, x, "failing weakCompareAndSetRelease int value");
         }
 
         {
@@ -850,14 +848,14 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet int");
             int x = (int) vh.get();
-            assertEquals(x, 0x01234567, "success weakCompareAndSet int");
+            assertEquals(0x01234567, x, "success weakCompareAndSet int");
         }
 
         {
             boolean success = vh.weakCompareAndSet(0x89ABCDEF, 0xCAFEBABE);
             assertEquals(success, false, "failing weakCompareAndSet int");
             int x = (int) vh.get();
-            assertEquals(x, 0x01234567, "failing weakCompareAndSet int value");
+            assertEquals(0x01234567, x, "failing weakCompareAndSet int value");
         }
 
         // Compare set and get
@@ -865,27 +863,27 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
             vh.set(0x01234567);
 
             int o = (int) vh.getAndSet(0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndSet int");
+            assertEquals(0x01234567, o, "getAndSet int");
             int x = (int) vh.get();
-            assertEquals(x, 0x89ABCDEF, "getAndSet int value");
+            assertEquals(0x89ABCDEF, x, "getAndSet int value");
         }
 
         {
             vh.set(0x01234567);
 
             int o = (int) vh.getAndSetAcquire(0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndSetAcquire int");
+            assertEquals(0x01234567, o, "getAndSetAcquire int");
             int x = (int) vh.get();
-            assertEquals(x, 0x89ABCDEF, "getAndSetAcquire int value");
+            assertEquals(0x89ABCDEF, x, "getAndSetAcquire int value");
         }
 
         {
             vh.set(0x01234567);
 
             int o = (int) vh.getAndSetRelease(0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndSetRelease int");
+            assertEquals(0x01234567, o, "getAndSetRelease int");
             int x = (int) vh.get();
-            assertEquals(x, 0x89ABCDEF, "getAndSetRelease int value");
+            assertEquals(0x89ABCDEF, x, "getAndSetRelease int value");
         }
 
         // get and add, add and get
@@ -893,27 +891,27 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
             vh.set(0x01234567);
 
             int o = (int) vh.getAndAdd(0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndAdd int");
+            assertEquals(0x01234567, o, "getAndAdd int");
             int x = (int) vh.get();
-            assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAdd int value");
+            assertEquals((int)(0x01234567 + 0x89ABCDEF), x, "getAndAdd int value");
         }
 
         {
             vh.set(0x01234567);
 
             int o = (int) vh.getAndAddAcquire(0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndAddAcquire int");
+            assertEquals(0x01234567, o, "getAndAddAcquire int");
             int x = (int) vh.get();
-            assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddAcquire int value");
+            assertEquals((int)(0x01234567 + 0x89ABCDEF), x, "getAndAddAcquire int value");
         }
 
         {
             vh.set(0x01234567);
 
             int o = (int) vh.getAndAddRelease(0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndAddReleaseint");
+            assertEquals(0x01234567, o, "getAndAddReleaseint");
             int x = (int) vh.get();
-            assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddRelease int value");
+            assertEquals((int)(0x01234567 + 0x89ABCDEF), x, "getAndAddRelease int value");
         }
 
         // get and bitwise or
@@ -921,27 +919,27 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
             vh.set(0x01234567);
 
             int o = (int) vh.getAndBitwiseOr(0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseOr int");
+            assertEquals(0x01234567, o, "getAndBitwiseOr int");
             int x = (int) vh.get();
-            assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOr int value");
+            assertEquals((int)(0x01234567 | 0x89ABCDEF), x, "getAndBitwiseOr int value");
         }
 
         {
             vh.set(0x01234567);
 
             int o = (int) vh.getAndBitwiseOrAcquire(0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseOrAcquire int");
+            assertEquals(0x01234567, o, "getAndBitwiseOrAcquire int");
             int x = (int) vh.get();
-            assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrAcquire int value");
+            assertEquals((int)(0x01234567 | 0x89ABCDEF), x, "getAndBitwiseOrAcquire int value");
         }
 
         {
             vh.set(0x01234567);
 
             int o = (int) vh.getAndBitwiseOrRelease(0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseOrRelease int");
+            assertEquals(0x01234567, o, "getAndBitwiseOrRelease int");
             int x = (int) vh.get();
-            assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrRelease int value");
+            assertEquals((int)(0x01234567 | 0x89ABCDEF), x, "getAndBitwiseOrRelease int value");
         }
 
         // get and bitwise and
@@ -949,27 +947,27 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
             vh.set(0x01234567);
 
             int o = (int) vh.getAndBitwiseAnd(0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseAnd int");
+            assertEquals(0x01234567, o, "getAndBitwiseAnd int");
             int x = (int) vh.get();
-            assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAnd int value");
+            assertEquals((int)(0x01234567 & 0x89ABCDEF), x, "getAndBitwiseAnd int value");
         }
 
         {
             vh.set(0x01234567);
 
             int o = (int) vh.getAndBitwiseAndAcquire(0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseAndAcquire int");
+            assertEquals(0x01234567, o, "getAndBitwiseAndAcquire int");
             int x = (int) vh.get();
-            assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndAcquire int value");
+            assertEquals((int)(0x01234567 & 0x89ABCDEF), x, "getAndBitwiseAndAcquire int value");
         }
 
         {
             vh.set(0x01234567);
 
             int o = (int) vh.getAndBitwiseAndRelease(0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseAndRelease int");
+            assertEquals(0x01234567, o, "getAndBitwiseAndRelease int");
             int x = (int) vh.get();
-            assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndRelease int value");
+            assertEquals((int)(0x01234567 & 0x89ABCDEF), x, "getAndBitwiseAndRelease int value");
         }
 
         // get and bitwise xor
@@ -977,27 +975,27 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
             vh.set(0x01234567);
 
             int o = (int) vh.getAndBitwiseXor(0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseXor int");
+            assertEquals(0x01234567, o, "getAndBitwiseXor int");
             int x = (int) vh.get();
-            assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXor int value");
+            assertEquals((int)(0x01234567 ^ 0x89ABCDEF), x, "getAndBitwiseXor int value");
         }
 
         {
             vh.set(0x01234567);
 
             int o = (int) vh.getAndBitwiseXorAcquire(0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseXorAcquire int");
+            assertEquals(0x01234567, o, "getAndBitwiseXorAcquire int");
             int x = (int) vh.get();
-            assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorAcquire int value");
+            assertEquals((int)(0x01234567 ^ 0x89ABCDEF), x, "getAndBitwiseXorAcquire int value");
         }
 
         {
             vh.set(0x01234567);
 
             int o = (int) vh.getAndBitwiseXorRelease(0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseXorRelease int");
+            assertEquals(0x01234567, o, "getAndBitwiseXorRelease int");
             int x = (int) vh.get();
-            assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorRelease int value");
+            assertEquals((int)(0x01234567 ^ 0x89ABCDEF), x, "getAndBitwiseXorRelease int value");
         }
     }
 
@@ -1015,7 +1013,7 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
             {
                 vh.set(array, i, 0x01234567);
                 int x = (int) vh.get(array, i);
-                assertEquals(x, 0x01234567, "get int value");
+                assertEquals(0x01234567, x, "get int value");
             }
 
 
@@ -1023,21 +1021,21 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
             {
                 vh.setVolatile(array, i, 0x89ABCDEF);
                 int x = (int) vh.getVolatile(array, i);
-                assertEquals(x, 0x89ABCDEF, "setVolatile int value");
+                assertEquals(0x89ABCDEF, x, "setVolatile int value");
             }
 
             // Lazy
             {
                 vh.setRelease(array, i, 0x01234567);
                 int x = (int) vh.getAcquire(array, i);
-                assertEquals(x, 0x01234567, "setRelease int value");
+                assertEquals(0x01234567, x, "setRelease int value");
             }
 
             // Opaque
             {
                 vh.setOpaque(array, i, 0x89ABCDEF);
                 int x = (int) vh.getOpaque(array, i);
-                assertEquals(x, 0x89ABCDEF, "setOpaque int value");
+                assertEquals(0x89ABCDEF, x, "setOpaque int value");
             }
 
             vh.set(array, i, 0x01234567);
@@ -1047,56 +1045,56 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
                 boolean r = vh.compareAndSet(array, i, 0x01234567, 0x89ABCDEF);
                 assertEquals(r, true, "success compareAndSet int");
                 int x = (int) vh.get(array, i);
-                assertEquals(x, 0x89ABCDEF, "success compareAndSet int value");
+                assertEquals(0x89ABCDEF, x, "success compareAndSet int value");
             }
 
             {
                 boolean r = vh.compareAndSet(array, i, 0x01234567, 0xCAFEBABE);
                 assertEquals(r, false, "failing compareAndSet int");
                 int x = (int) vh.get(array, i);
-                assertEquals(x, 0x89ABCDEF, "failing compareAndSet int value");
+                assertEquals(0x89ABCDEF, x, "failing compareAndSet int value");
             }
 
             {
                 int r = (int) vh.compareAndExchange(array, i, 0x89ABCDEF, 0x01234567);
                 assertEquals(r, 0x89ABCDEF, "success compareAndExchange int");
                 int x = (int) vh.get(array, i);
-                assertEquals(x, 0x01234567, "success compareAndExchange int value");
+                assertEquals(0x01234567, x, "success compareAndExchange int value");
             }
 
             {
                 int r = (int) vh.compareAndExchange(array, i, 0x89ABCDEF, 0xCAFEBABE);
                 assertEquals(r, 0x01234567, "failing compareAndExchange int");
                 int x = (int) vh.get(array, i);
-                assertEquals(x, 0x01234567, "failing compareAndExchange int value");
+                assertEquals(0x01234567, x, "failing compareAndExchange int value");
             }
 
             {
                 int r = (int) vh.compareAndExchangeAcquire(array, i, 0x01234567, 0x89ABCDEF);
                 assertEquals(r, 0x01234567, "success compareAndExchangeAcquire int");
                 int x = (int) vh.get(array, i);
-                assertEquals(x, 0x89ABCDEF, "success compareAndExchangeAcquire int value");
+                assertEquals(0x89ABCDEF, x, "success compareAndExchangeAcquire int value");
             }
 
             {
                 int r = (int) vh.compareAndExchangeAcquire(array, i, 0x01234567, 0xCAFEBABE);
                 assertEquals(r, 0x89ABCDEF, "failing compareAndExchangeAcquire int");
                 int x = (int) vh.get(array, i);
-                assertEquals(x, 0x89ABCDEF, "failing compareAndExchangeAcquire int value");
+                assertEquals(0x89ABCDEF, x, "failing compareAndExchangeAcquire int value");
             }
 
             {
                 int r = (int) vh.compareAndExchangeRelease(array, i, 0x89ABCDEF, 0x01234567);
                 assertEquals(r, 0x89ABCDEF, "success compareAndExchangeRelease int");
                 int x = (int) vh.get(array, i);
-                assertEquals(x, 0x01234567, "success compareAndExchangeRelease int value");
+                assertEquals(0x01234567, x, "success compareAndExchangeRelease int value");
             }
 
             {
                 int r = (int) vh.compareAndExchangeRelease(array, i, 0x89ABCDEF, 0xCAFEBABE);
                 assertEquals(r, 0x01234567, "failing compareAndExchangeRelease int");
                 int x = (int) vh.get(array, i);
-                assertEquals(x, 0x01234567, "failing compareAndExchangeRelease int value");
+                assertEquals(0x01234567, x, "failing compareAndExchangeRelease int value");
             }
 
             {
@@ -1107,14 +1105,14 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetPlain int");
                 int x = (int) vh.get(array, i);
-                assertEquals(x, 0x89ABCDEF, "success weakCompareAndSetPlain int value");
+                assertEquals(0x89ABCDEF, x, "success weakCompareAndSetPlain int value");
             }
 
             {
                 boolean success = vh.weakCompareAndSetPlain(array, i, 0x01234567, 0xCAFEBABE);
                 assertEquals(success, false, "failing weakCompareAndSetPlain int");
                 int x = (int) vh.get(array, i);
-                assertEquals(x, 0x89ABCDEF, "failing weakCompareAndSetPlain int value");
+                assertEquals(0x89ABCDEF, x, "failing weakCompareAndSetPlain int value");
             }
 
             {
@@ -1125,14 +1123,14 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetAcquire int");
                 int x = (int) vh.get(array, i);
-                assertEquals(x, 0x01234567, "success weakCompareAndSetAcquire int");
+                assertEquals(0x01234567, x, "success weakCompareAndSetAcquire int");
             }
 
             {
                 boolean success = vh.weakCompareAndSetAcquire(array, i, 0x89ABCDEF, 0xCAFEBABE);
                 assertEquals(success, false, "failing weakCompareAndSetAcquire int");
                 int x = (int) vh.get(array, i);
-                assertEquals(x, 0x01234567, "failing weakCompareAndSetAcquire int value");
+                assertEquals(0x01234567, x, "failing weakCompareAndSetAcquire int value");
             }
 
             {
@@ -1143,14 +1141,14 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetRelease int");
                 int x = (int) vh.get(array, i);
-                assertEquals(x, 0x89ABCDEF, "success weakCompareAndSetRelease int");
+                assertEquals(0x89ABCDEF, x, "success weakCompareAndSetRelease int");
             }
 
             {
                 boolean success = vh.weakCompareAndSetRelease(array, i, 0x01234567, 0xCAFEBABE);
                 assertEquals(success, false, "failing weakCompareAndSetRelease int");
                 int x = (int) vh.get(array, i);
-                assertEquals(x, 0x89ABCDEF, "failing weakCompareAndSetRelease int value");
+                assertEquals(0x89ABCDEF, x, "failing weakCompareAndSetRelease int value");
             }
 
             {
@@ -1161,14 +1159,14 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSet int");
                 int x = (int) vh.get(array, i);
-                assertEquals(x, 0x01234567, "success weakCompareAndSet int");
+                assertEquals(0x01234567, x, "success weakCompareAndSet int");
             }
 
             {
                 boolean success = vh.weakCompareAndSet(array, i, 0x89ABCDEF, 0xCAFEBABE);
                 assertEquals(success, false, "failing weakCompareAndSet int");
                 int x = (int) vh.get(array, i);
-                assertEquals(x, 0x01234567, "failing weakCompareAndSet int value");
+                assertEquals(0x01234567, x, "failing weakCompareAndSet int value");
             }
 
             // Compare set and get
@@ -1176,27 +1174,27 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
                 vh.set(array, i, 0x01234567);
 
                 int o = (int) vh.getAndSet(array, i, 0x89ABCDEF);
-                assertEquals(o, 0x01234567, "getAndSet int");
+                assertEquals(0x01234567, o, "getAndSet int");
                 int x = (int) vh.get(array, i);
-                assertEquals(x, 0x89ABCDEF, "getAndSet int value");
+                assertEquals(0x89ABCDEF, x, "getAndSet int value");
             }
 
             {
                 vh.set(array, i, 0x01234567);
 
                 int o = (int) vh.getAndSetAcquire(array, i, 0x89ABCDEF);
-                assertEquals(o, 0x01234567, "getAndSetAcquire int");
+                assertEquals(0x01234567, o, "getAndSetAcquire int");
                 int x = (int) vh.get(array, i);
-                assertEquals(x, 0x89ABCDEF, "getAndSetAcquire int value");
+                assertEquals(0x89ABCDEF, x, "getAndSetAcquire int value");
             }
 
             {
                 vh.set(array, i, 0x01234567);
 
                 int o = (int) vh.getAndSetRelease(array, i, 0x89ABCDEF);
-                assertEquals(o, 0x01234567, "getAndSetRelease int");
+                assertEquals(0x01234567, o, "getAndSetRelease int");
                 int x = (int) vh.get(array, i);
-                assertEquals(x, 0x89ABCDEF, "getAndSetRelease int value");
+                assertEquals(0x89ABCDEF, x, "getAndSetRelease int value");
             }
 
             // get and add, add and get
@@ -1204,27 +1202,27 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
                 vh.set(array, i, 0x01234567);
 
                 int o = (int) vh.getAndAdd(array, i, 0x89ABCDEF);
-                assertEquals(o, 0x01234567, "getAndAdd int");
+                assertEquals(0x01234567, o, "getAndAdd int");
                 int x = (int) vh.get(array, i);
-                assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAdd int value");
+                assertEquals((int)(0x01234567 + 0x89ABCDEF), x, "getAndAdd int value");
             }
 
             {
                 vh.set(array, i, 0x01234567);
 
                 int o = (int) vh.getAndAddAcquire(array, i, 0x89ABCDEF);
-                assertEquals(o, 0x01234567, "getAndAddAcquire int");
+                assertEquals(0x01234567, o, "getAndAddAcquire int");
                 int x = (int) vh.get(array, i);
-                assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddAcquire int value");
+                assertEquals((int)(0x01234567 + 0x89ABCDEF), x, "getAndAddAcquire int value");
             }
 
             {
                 vh.set(array, i, 0x01234567);
 
                 int o = (int) vh.getAndAddRelease(array, i, 0x89ABCDEF);
-                assertEquals(o, 0x01234567, "getAndAddReleaseint");
+                assertEquals(0x01234567, o, "getAndAddReleaseint");
                 int x = (int) vh.get(array, i);
-                assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddRelease int value");
+                assertEquals((int)(0x01234567 + 0x89ABCDEF), x, "getAndAddRelease int value");
             }
 
             // get and bitwise or
@@ -1232,27 +1230,27 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
                 vh.set(array, i, 0x01234567);
 
                 int o = (int) vh.getAndBitwiseOr(array, i, 0x89ABCDEF);
-                assertEquals(o, 0x01234567, "getAndBitwiseOr int");
+                assertEquals(0x01234567, o, "getAndBitwiseOr int");
                 int x = (int) vh.get(array, i);
-                assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOr int value");
+                assertEquals((int)(0x01234567 | 0x89ABCDEF), x, "getAndBitwiseOr int value");
             }
 
             {
                 vh.set(array, i, 0x01234567);
 
                 int o = (int) vh.getAndBitwiseOrAcquire(array, i, 0x89ABCDEF);
-                assertEquals(o, 0x01234567, "getAndBitwiseOrAcquire int");
+                assertEquals(0x01234567, o, "getAndBitwiseOrAcquire int");
                 int x = (int) vh.get(array, i);
-                assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrAcquire int value");
+                assertEquals((int)(0x01234567 | 0x89ABCDEF), x, "getAndBitwiseOrAcquire int value");
             }
 
             {
                 vh.set(array, i, 0x01234567);
 
                 int o = (int) vh.getAndBitwiseOrRelease(array, i, 0x89ABCDEF);
-                assertEquals(o, 0x01234567, "getAndBitwiseOrRelease int");
+                assertEquals(0x01234567, o, "getAndBitwiseOrRelease int");
                 int x = (int) vh.get(array, i);
-                assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrRelease int value");
+                assertEquals((int)(0x01234567 | 0x89ABCDEF), x, "getAndBitwiseOrRelease int value");
             }
 
             // get and bitwise and
@@ -1260,27 +1258,27 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
                 vh.set(array, i, 0x01234567);
 
                 int o = (int) vh.getAndBitwiseAnd(array, i, 0x89ABCDEF);
-                assertEquals(o, 0x01234567, "getAndBitwiseAnd int");
+                assertEquals(0x01234567, o, "getAndBitwiseAnd int");
                 int x = (int) vh.get(array, i);
-                assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAnd int value");
+                assertEquals((int)(0x01234567 & 0x89ABCDEF), x, "getAndBitwiseAnd int value");
             }
 
             {
                 vh.set(array, i, 0x01234567);
 
                 int o = (int) vh.getAndBitwiseAndAcquire(array, i, 0x89ABCDEF);
-                assertEquals(o, 0x01234567, "getAndBitwiseAndAcquire int");
+                assertEquals(0x01234567, o, "getAndBitwiseAndAcquire int");
                 int x = (int) vh.get(array, i);
-                assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndAcquire int value");
+                assertEquals((int)(0x01234567 & 0x89ABCDEF), x, "getAndBitwiseAndAcquire int value");
             }
 
             {
                 vh.set(array, i, 0x01234567);
 
                 int o = (int) vh.getAndBitwiseAndRelease(array, i, 0x89ABCDEF);
-                assertEquals(o, 0x01234567, "getAndBitwiseAndRelease int");
+                assertEquals(0x01234567, o, "getAndBitwiseAndRelease int");
                 int x = (int) vh.get(array, i);
-                assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndRelease int value");
+                assertEquals((int)(0x01234567 & 0x89ABCDEF), x, "getAndBitwiseAndRelease int value");
             }
 
             // get and bitwise xor
@@ -1288,27 +1286,27 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
                 vh.set(array, i, 0x01234567);
 
                 int o = (int) vh.getAndBitwiseXor(array, i, 0x89ABCDEF);
-                assertEquals(o, 0x01234567, "getAndBitwiseXor int");
+                assertEquals(0x01234567, o, "getAndBitwiseXor int");
                 int x = (int) vh.get(array, i);
-                assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXor int value");
+                assertEquals((int)(0x01234567 ^ 0x89ABCDEF), x, "getAndBitwiseXor int value");
             }
 
             {
                 vh.set(array, i, 0x01234567);
 
                 int o = (int) vh.getAndBitwiseXorAcquire(array, i, 0x89ABCDEF);
-                assertEquals(o, 0x01234567, "getAndBitwiseXorAcquire int");
+                assertEquals(0x01234567, o, "getAndBitwiseXorAcquire int");
                 int x = (int) vh.get(array, i);
-                assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorAcquire int value");
+                assertEquals((int)(0x01234567 ^ 0x89ABCDEF), x, "getAndBitwiseXorAcquire int value");
             }
 
             {
                 vh.set(array, i, 0x01234567);
 
                 int o = (int) vh.getAndBitwiseXorRelease(array, i, 0x89ABCDEF);
-                assertEquals(o, 0x01234567, "getAndBitwiseXorRelease int");
+                assertEquals(0x01234567, o, "getAndBitwiseXorRelease int");
                 int x = (int) vh.get(array, i);
-                assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorRelease int value");
+                assertEquals((int)(0x01234567 ^ 0x89ABCDEF), x, "getAndBitwiseXorRelease int value");
             }
         }
     }
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java
index e40256a8bd5..8bf997bb9a6 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,28 +23,30 @@
 
 /*
  * @test
- * @run testng/othervm -Diters=10   -Xint                                                   VarHandleTestAccessLong
+ * @run junit/othervm -Diters=10   -Xint                                                   VarHandleTestAccessLong
  *
  * @comment Set CompileThresholdScaling to 0.1 so that the warmup loop sets to 2000 iterations
  *          to hit compilation thresholds
  *
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestAccessLong
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestAccessLong
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestAccessLong
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestAccessLong
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestAccessLong
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestAccessLong
  */
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestAccessLong extends VarHandleBaseTest {
     static final long static_final_v = 0x0123456789ABCDEFL;
 
@@ -108,7 +110,7 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
         return vhs.toArray(new VarHandle[0]);
     }
 
-    @BeforeClass
+    @BeforeAll
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
                 VarHandleTestAccessLong.class, "final_v", long.class);
@@ -125,8 +127,6 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
         vhArray = MethodHandles.arrayElementVarHandle(long[].class);
     }
 
-
-    @DataProvider
     public Object[][] varHandlesProvider() throws Exception {
         List vhs = new ArrayList<>();
         vhs.add(vhField);
@@ -156,7 +156,8 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
         }
     }
 
-    @Test(dataProvider = "varHandlesProvider")
+    @ParameterizedTest
+    @MethodSource("varHandlesProvider")
     public void testIsAccessModeSupported(VarHandle vh) {
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
@@ -194,8 +195,6 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
     }
 
-
-    @DataProvider
     public Object[][] typesProvider() throws Exception {
         List types = new ArrayList<>();
         types.add(new Object[] {vhField, Arrays.asList(VarHandleTestAccessLong.class)});
@@ -205,16 +204,16 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
         return types.stream().toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "typesProvider")
+    @ParameterizedTest
+    @MethodSource("typesProvider")
     public void testTypes(VarHandle vh, List> pts) {
-        assertEquals(vh.varType(), long.class);
+        assertEquals(long.class, vh.varType());
 
-        assertEquals(vh.coordinateTypes(), pts);
+        assertEquals(pts, vh.coordinateTypes());
 
         testTypes(vh);
     }
 
-
     @Test
     public void testLookupInstanceToStatic() {
         checkIAE("Lookup of static final field to instance final field", () -> {
@@ -241,8 +240,6 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
         });
     }
 
-
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -284,7 +281,8 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -297,26 +295,26 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
         // Plain
         {
             long x = (long) vh.get(recv);
-            assertEquals(x, 0x0123456789ABCDEFL, "get long value");
+            assertEquals(0x0123456789ABCDEFL, x, "get long value");
         }
 
 
         // Volatile
         {
             long x = (long) vh.getVolatile(recv);
-            assertEquals(x, 0x0123456789ABCDEFL, "getVolatile long value");
+            assertEquals(0x0123456789ABCDEFL, x, "getVolatile long value");
         }
 
         // Lazy
         {
             long x = (long) vh.getAcquire(recv);
-            assertEquals(x, 0x0123456789ABCDEFL, "getRelease long value");
+            assertEquals(0x0123456789ABCDEFL, x, "getRelease long value");
         }
 
         // Opaque
         {
             long x = (long) vh.getOpaque(recv);
-            assertEquals(x, 0x0123456789ABCDEFL, "getOpaque long value");
+            assertEquals(0x0123456789ABCDEFL, x, "getOpaque long value");
         }
     }
 
@@ -346,26 +344,26 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
         // Plain
         {
             long x = (long) vh.get();
-            assertEquals(x, 0x0123456789ABCDEFL, "get long value");
+            assertEquals(0x0123456789ABCDEFL, x, "get long value");
         }
 
 
         // Volatile
         {
             long x = (long) vh.getVolatile();
-            assertEquals(x, 0x0123456789ABCDEFL, "getVolatile long value");
+            assertEquals(0x0123456789ABCDEFL, x, "getVolatile long value");
         }
 
         // Lazy
         {
             long x = (long) vh.getAcquire();
-            assertEquals(x, 0x0123456789ABCDEFL, "getRelease long value");
+            assertEquals(0x0123456789ABCDEFL, x, "getRelease long value");
         }
 
         // Opaque
         {
             long x = (long) vh.getOpaque();
-            assertEquals(x, 0x0123456789ABCDEFL, "getOpaque long value");
+            assertEquals(0x0123456789ABCDEFL, x, "getOpaque long value");
         }
     }
 
@@ -396,7 +394,7 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
         {
             vh.set(recv, 0x0123456789ABCDEFL);
             long x = (long) vh.get(recv);
-            assertEquals(x, 0x0123456789ABCDEFL, "set long value");
+            assertEquals(0x0123456789ABCDEFL, x, "set long value");
         }
 
 
@@ -404,21 +402,21 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
         {
             vh.setVolatile(recv, 0xCAFEBABECAFEBABEL);
             long x = (long) vh.getVolatile(recv);
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "setVolatile long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "setVolatile long value");
         }
 
         // Lazy
         {
             vh.setRelease(recv, 0x0123456789ABCDEFL);
             long x = (long) vh.getAcquire(recv);
-            assertEquals(x, 0x0123456789ABCDEFL, "setRelease long value");
+            assertEquals(0x0123456789ABCDEFL, x, "setRelease long value");
         }
 
         // Opaque
         {
             vh.setOpaque(recv, 0xCAFEBABECAFEBABEL);
             long x = (long) vh.getOpaque(recv);
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "setOpaque long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "setOpaque long value");
         }
 
         vh.set(recv, 0x0123456789ABCDEFL);
@@ -428,56 +426,56 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
             boolean r = vh.compareAndSet(recv, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
             assertEquals(r, true, "success compareAndSet long");
             long x = (long) vh.get(recv);
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "success compareAndSet long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "success compareAndSet long value");
         }
 
         {
             boolean r = vh.compareAndSet(recv, 0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
             assertEquals(r, false, "failing compareAndSet long");
             long x = (long) vh.get(recv);
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "failing compareAndSet long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "failing compareAndSet long value");
         }
 
         {
             long r = (long) vh.compareAndExchange(recv, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
             assertEquals(r, 0xCAFEBABECAFEBABEL, "success compareAndExchange long");
             long x = (long) vh.get(recv);
-            assertEquals(x, 0x0123456789ABCDEFL, "success compareAndExchange long value");
+            assertEquals(0x0123456789ABCDEFL, x, "success compareAndExchange long value");
         }
 
         {
             long r = (long) vh.compareAndExchange(recv, 0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
             assertEquals(r, 0x0123456789ABCDEFL, "failing compareAndExchange long");
             long x = (long) vh.get(recv);
-            assertEquals(x, 0x0123456789ABCDEFL, "failing compareAndExchange long value");
+            assertEquals(0x0123456789ABCDEFL, x, "failing compareAndExchange long value");
         }
 
         {
             long r = (long) vh.compareAndExchangeAcquire(recv, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
             assertEquals(r, 0x0123456789ABCDEFL, "success compareAndExchangeAcquire long");
             long x = (long) vh.get(recv);
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "success compareAndExchangeAcquire long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "success compareAndExchangeAcquire long value");
         }
 
         {
             long r = (long) vh.compareAndExchangeAcquire(recv, 0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
             assertEquals(r, 0xCAFEBABECAFEBABEL, "failing compareAndExchangeAcquire long");
             long x = (long) vh.get(recv);
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "failing compareAndExchangeAcquire long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "failing compareAndExchangeAcquire long value");
         }
 
         {
             long r = (long) vh.compareAndExchangeRelease(recv, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
             assertEquals(r, 0xCAFEBABECAFEBABEL, "success compareAndExchangeRelease long");
             long x = (long) vh.get(recv);
-            assertEquals(x, 0x0123456789ABCDEFL, "success compareAndExchangeRelease long value");
+            assertEquals(0x0123456789ABCDEFL, x, "success compareAndExchangeRelease long value");
         }
 
         {
             long r = (long) vh.compareAndExchangeRelease(recv, 0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
             assertEquals(r, 0x0123456789ABCDEFL, "failing compareAndExchangeRelease long");
             long x = (long) vh.get(recv);
-            assertEquals(x, 0x0123456789ABCDEFL, "failing compareAndExchangeRelease long value");
+            assertEquals(0x0123456789ABCDEFL, x, "failing compareAndExchangeRelease long value");
         }
 
         {
@@ -488,14 +486,14 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain long");
             long x = (long) vh.get(recv);
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "success weakCompareAndSetPlain long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "success weakCompareAndSetPlain long value");
         }
 
         {
             boolean success = vh.weakCompareAndSetPlain(recv, 0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
             assertEquals(success, false, "failing weakCompareAndSetPlain long");
             long x = (long) vh.get(recv);
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "failing weakCompareAndSetPlain long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "failing weakCompareAndSetPlain long value");
         }
 
         {
@@ -506,14 +504,14 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire long");
             long x = (long) vh.get(recv);
-            assertEquals(x, 0x0123456789ABCDEFL, "success weakCompareAndSetAcquire long");
+            assertEquals(0x0123456789ABCDEFL, x, "success weakCompareAndSetAcquire long");
         }
 
         {
             boolean success = vh.weakCompareAndSetAcquire(recv, 0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
             assertEquals(success, false, "failing weakCompareAndSetAcquire long");
             long x = (long) vh.get(recv);
-            assertEquals(x, 0x0123456789ABCDEFL, "failing weakCompareAndSetAcquire long value");
+            assertEquals(0x0123456789ABCDEFL, x, "failing weakCompareAndSetAcquire long value");
         }
 
         {
@@ -524,14 +522,14 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease long");
             long x = (long) vh.get(recv);
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "success weakCompareAndSetRelease long");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "success weakCompareAndSetRelease long");
         }
 
         {
             boolean success = vh.weakCompareAndSetRelease(recv, 0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
             assertEquals(success, false, "failing weakCompareAndSetRelease long");
             long x = (long) vh.get(recv);
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "failing weakCompareAndSetRelease long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "failing weakCompareAndSetRelease long value");
         }
 
         {
@@ -542,14 +540,14 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet long");
             long x = (long) vh.get(recv);
-            assertEquals(x, 0x0123456789ABCDEFL, "success weakCompareAndSet long value");
+            assertEquals(0x0123456789ABCDEFL, x, "success weakCompareAndSet long value");
         }
 
         {
             boolean success = vh.weakCompareAndSet(recv, 0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
             assertEquals(success, false, "failing weakCompareAndSet long");
             long x = (long) vh.get(recv);
-            assertEquals(x, 0x0123456789ABCDEFL, "failing weakCompareAndSet long value");
+            assertEquals(0x0123456789ABCDEFL, x, "failing weakCompareAndSet long value");
         }
 
         // Compare set and get
@@ -557,27 +555,27 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
             vh.set(recv, 0x0123456789ABCDEFL);
 
             long o = (long) vh.getAndSet(recv, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndSet long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndSet long");
             long x = (long) vh.get(recv);
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSet long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "getAndSet long value");
         }
 
         {
             vh.set(recv, 0x0123456789ABCDEFL);
 
             long o = (long) vh.getAndSetAcquire(recv, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndSetAcquire long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndSetAcquire long");
             long x = (long) vh.get(recv);
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetAcquire long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "getAndSetAcquire long value");
         }
 
         {
             vh.set(recv, 0x0123456789ABCDEFL);
 
             long o = (long) vh.getAndSetRelease(recv, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndSetRelease long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndSetRelease long");
             long x = (long) vh.get(recv);
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetRelease long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "getAndSetRelease long value");
         }
 
         // get and add, add and get
@@ -585,27 +583,27 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
             vh.set(recv, 0x0123456789ABCDEFL);
 
             long o = (long) vh.getAndAdd(recv, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndAdd long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndAdd long");
             long x = (long) vh.get(recv);
-            assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAdd long value");
+            assertEquals((long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), x, "getAndAdd long value");
         }
 
         {
             vh.set(recv, 0x0123456789ABCDEFL);
 
             long o = (long) vh.getAndAddAcquire(recv, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndAddAcquire long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndAddAcquire long");
             long x = (long) vh.get(recv);
-            assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddAcquire long value");
+            assertEquals((long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), x, "getAndAddAcquire long value");
         }
 
         {
             vh.set(recv, 0x0123456789ABCDEFL);
 
             long o = (long) vh.getAndAddRelease(recv, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndAddReleaselong");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndAddReleaselong");
             long x = (long) vh.get(recv);
-            assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddRelease long value");
+            assertEquals((long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), x, "getAndAddRelease long value");
         }
 
         // get and bitwise or
@@ -613,27 +611,27 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
             vh.set(recv, 0x0123456789ABCDEFL);
 
             long o = (long) vh.getAndBitwiseOr(recv, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOr long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseOr long");
             long x = (long) vh.get(recv);
-            assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOr long value");
+            assertEquals((long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), x, "getAndBitwiseOr long value");
         }
 
         {
             vh.set(recv, 0x0123456789ABCDEFL);
 
             long o = (long) vh.getAndBitwiseOrAcquire(recv, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrAcquire long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseOrAcquire long");
             long x = (long) vh.get(recv);
-            assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrAcquire long value");
+            assertEquals((long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), x, "getAndBitwiseOrAcquire long value");
         }
 
         {
             vh.set(recv, 0x0123456789ABCDEFL);
 
             long o = (long) vh.getAndBitwiseOrRelease(recv, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrRelease long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseOrRelease long");
             long x = (long) vh.get(recv);
-            assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrRelease long value");
+            assertEquals((long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), x, "getAndBitwiseOrRelease long value");
         }
 
         // get and bitwise and
@@ -641,27 +639,27 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
             vh.set(recv, 0x0123456789ABCDEFL);
 
             long o = (long) vh.getAndBitwiseAnd(recv, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAnd long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseAnd long");
             long x = (long) vh.get(recv);
-            assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAnd long value");
+            assertEquals((long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), x, "getAndBitwiseAnd long value");
         }
 
         {
             vh.set(recv, 0x0123456789ABCDEFL);
 
             long o = (long) vh.getAndBitwiseAndAcquire(recv, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndAcquire long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseAndAcquire long");
             long x = (long) vh.get(recv);
-            assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndAcquire long value");
+            assertEquals((long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), x, "getAndBitwiseAndAcquire long value");
         }
 
         {
             vh.set(recv, 0x0123456789ABCDEFL);
 
             long o = (long) vh.getAndBitwiseAndRelease(recv, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndRelease long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseAndRelease long");
             long x = (long) vh.get(recv);
-            assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndRelease long value");
+            assertEquals((long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), x, "getAndBitwiseAndRelease long value");
         }
 
         // get and bitwise xor
@@ -669,27 +667,27 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
             vh.set(recv, 0x0123456789ABCDEFL);
 
             long o = (long) vh.getAndBitwiseXor(recv, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXor long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseXor long");
             long x = (long) vh.get(recv);
-            assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXor long value");
+            assertEquals((long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), x, "getAndBitwiseXor long value");
         }
 
         {
             vh.set(recv, 0x0123456789ABCDEFL);
 
             long o = (long) vh.getAndBitwiseXorAcquire(recv, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorAcquire long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseXorAcquire long");
             long x = (long) vh.get(recv);
-            assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorAcquire long value");
+            assertEquals((long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), x, "getAndBitwiseXorAcquire long value");
         }
 
         {
             vh.set(recv, 0x0123456789ABCDEFL);
 
             long o = (long) vh.getAndBitwiseXorRelease(recv, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorRelease long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseXorRelease long");
             long x = (long) vh.get(recv);
-            assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorRelease long value");
+            assertEquals((long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), x, "getAndBitwiseXorRelease long value");
         }
     }
 
@@ -704,7 +702,7 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
         {
             vh.set(0x0123456789ABCDEFL);
             long x = (long) vh.get();
-            assertEquals(x, 0x0123456789ABCDEFL, "set long value");
+            assertEquals(0x0123456789ABCDEFL, x, "set long value");
         }
 
 
@@ -712,21 +710,21 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
         {
             vh.setVolatile(0xCAFEBABECAFEBABEL);
             long x = (long) vh.getVolatile();
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "setVolatile long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "setVolatile long value");
         }
 
         // Lazy
         {
             vh.setRelease(0x0123456789ABCDEFL);
             long x = (long) vh.getAcquire();
-            assertEquals(x, 0x0123456789ABCDEFL, "setRelease long value");
+            assertEquals(0x0123456789ABCDEFL, x, "setRelease long value");
         }
 
         // Opaque
         {
             vh.setOpaque(0xCAFEBABECAFEBABEL);
             long x = (long) vh.getOpaque();
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "setOpaque long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "setOpaque long value");
         }
 
         vh.set(0x0123456789ABCDEFL);
@@ -736,56 +734,56 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
             boolean r = vh.compareAndSet(0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
             assertEquals(r, true, "success compareAndSet long");
             long x = (long) vh.get();
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "success compareAndSet long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "success compareAndSet long value");
         }
 
         {
             boolean r = vh.compareAndSet(0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
             assertEquals(r, false, "failing compareAndSet long");
             long x = (long) vh.get();
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "failing compareAndSet long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "failing compareAndSet long value");
         }
 
         {
             long r = (long) vh.compareAndExchange(0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
             assertEquals(r, 0xCAFEBABECAFEBABEL, "success compareAndExchange long");
             long x = (long) vh.get();
-            assertEquals(x, 0x0123456789ABCDEFL, "success compareAndExchange long value");
+            assertEquals(0x0123456789ABCDEFL, x, "success compareAndExchange long value");
         }
 
         {
             long r = (long) vh.compareAndExchange(0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
             assertEquals(r, 0x0123456789ABCDEFL, "failing compareAndExchange long");
             long x = (long) vh.get();
-            assertEquals(x, 0x0123456789ABCDEFL, "failing compareAndExchange long value");
+            assertEquals(0x0123456789ABCDEFL, x, "failing compareAndExchange long value");
         }
 
         {
             long r = (long) vh.compareAndExchangeAcquire(0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
             assertEquals(r, 0x0123456789ABCDEFL, "success compareAndExchangeAcquire long");
             long x = (long) vh.get();
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "success compareAndExchangeAcquire long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "success compareAndExchangeAcquire long value");
         }
 
         {
             long r = (long) vh.compareAndExchangeAcquire(0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
             assertEquals(r, 0xCAFEBABECAFEBABEL, "failing compareAndExchangeAcquire long");
             long x = (long) vh.get();
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "failing compareAndExchangeAcquire long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "failing compareAndExchangeAcquire long value");
         }
 
         {
             long r = (long) vh.compareAndExchangeRelease(0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
             assertEquals(r, 0xCAFEBABECAFEBABEL, "success compareAndExchangeRelease long");
             long x = (long) vh.get();
-            assertEquals(x, 0x0123456789ABCDEFL, "success compareAndExchangeRelease long value");
+            assertEquals(0x0123456789ABCDEFL, x, "success compareAndExchangeRelease long value");
         }
 
         {
             long r = (long) vh.compareAndExchangeRelease(0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
             assertEquals(r, 0x0123456789ABCDEFL, "failing compareAndExchangeRelease long");
             long x = (long) vh.get();
-            assertEquals(x, 0x0123456789ABCDEFL, "failing compareAndExchangeRelease long value");
+            assertEquals(0x0123456789ABCDEFL, x, "failing compareAndExchangeRelease long value");
         }
 
         {
@@ -796,14 +794,14 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain long");
             long x = (long) vh.get();
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "success weakCompareAndSetPlain long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "success weakCompareAndSetPlain long value");
         }
 
         {
             boolean success = vh.weakCompareAndSetPlain(0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
             assertEquals(success, false, "failing weakCompareAndSetPlain long");
             long x = (long) vh.get();
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "failing weakCompareAndSetPlain long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "failing weakCompareAndSetPlain long value");
         }
 
         {
@@ -814,14 +812,14 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire long");
             long x = (long) vh.get();
-            assertEquals(x, 0x0123456789ABCDEFL, "success weakCompareAndSetAcquire long");
+            assertEquals(0x0123456789ABCDEFL, x, "success weakCompareAndSetAcquire long");
         }
 
         {
             boolean success = vh.weakCompareAndSetAcquire(0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
             assertEquals(success, false, "failing weakCompareAndSetAcquire long");
             long x = (long) vh.get();
-            assertEquals(x, 0x0123456789ABCDEFL, "failing weakCompareAndSetAcquire long value");
+            assertEquals(0x0123456789ABCDEFL, x, "failing weakCompareAndSetAcquire long value");
         }
 
         {
@@ -832,14 +830,14 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease long");
             long x = (long) vh.get();
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "success weakCompareAndSetRelease long");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "success weakCompareAndSetRelease long");
         }
 
         {
             boolean success = vh.weakCompareAndSetRelease(0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
             assertEquals(success, false, "failing weakCompareAndSetRelease long");
             long x = (long) vh.get();
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "failing weakCompareAndSetRelease long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "failing weakCompareAndSetRelease long value");
         }
 
         {
@@ -850,14 +848,14 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet long");
             long x = (long) vh.get();
-            assertEquals(x, 0x0123456789ABCDEFL, "success weakCompareAndSet long");
+            assertEquals(0x0123456789ABCDEFL, x, "success weakCompareAndSet long");
         }
 
         {
             boolean success = vh.weakCompareAndSet(0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
             assertEquals(success, false, "failing weakCompareAndSet long");
             long x = (long) vh.get();
-            assertEquals(x, 0x0123456789ABCDEFL, "failing weakCompareAndSet long value");
+            assertEquals(0x0123456789ABCDEFL, x, "failing weakCompareAndSet long value");
         }
 
         // Compare set and get
@@ -865,27 +863,27 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
             vh.set(0x0123456789ABCDEFL);
 
             long o = (long) vh.getAndSet(0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndSet long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndSet long");
             long x = (long) vh.get();
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSet long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "getAndSet long value");
         }
 
         {
             vh.set(0x0123456789ABCDEFL);
 
             long o = (long) vh.getAndSetAcquire(0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndSetAcquire long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndSetAcquire long");
             long x = (long) vh.get();
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetAcquire long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "getAndSetAcquire long value");
         }
 
         {
             vh.set(0x0123456789ABCDEFL);
 
             long o = (long) vh.getAndSetRelease(0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndSetRelease long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndSetRelease long");
             long x = (long) vh.get();
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetRelease long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "getAndSetRelease long value");
         }
 
         // get and add, add and get
@@ -893,27 +891,27 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
             vh.set(0x0123456789ABCDEFL);
 
             long o = (long) vh.getAndAdd(0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndAdd long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndAdd long");
             long x = (long) vh.get();
-            assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAdd long value");
+            assertEquals((long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), x, "getAndAdd long value");
         }
 
         {
             vh.set(0x0123456789ABCDEFL);
 
             long o = (long) vh.getAndAddAcquire(0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndAddAcquire long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndAddAcquire long");
             long x = (long) vh.get();
-            assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddAcquire long value");
+            assertEquals((long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), x, "getAndAddAcquire long value");
         }
 
         {
             vh.set(0x0123456789ABCDEFL);
 
             long o = (long) vh.getAndAddRelease(0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndAddReleaselong");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndAddReleaselong");
             long x = (long) vh.get();
-            assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddRelease long value");
+            assertEquals((long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), x, "getAndAddRelease long value");
         }
 
         // get and bitwise or
@@ -921,27 +919,27 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
             vh.set(0x0123456789ABCDEFL);
 
             long o = (long) vh.getAndBitwiseOr(0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOr long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseOr long");
             long x = (long) vh.get();
-            assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOr long value");
+            assertEquals((long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), x, "getAndBitwiseOr long value");
         }
 
         {
             vh.set(0x0123456789ABCDEFL);
 
             long o = (long) vh.getAndBitwiseOrAcquire(0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrAcquire long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseOrAcquire long");
             long x = (long) vh.get();
-            assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrAcquire long value");
+            assertEquals((long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), x, "getAndBitwiseOrAcquire long value");
         }
 
         {
             vh.set(0x0123456789ABCDEFL);
 
             long o = (long) vh.getAndBitwiseOrRelease(0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrRelease long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseOrRelease long");
             long x = (long) vh.get();
-            assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrRelease long value");
+            assertEquals((long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), x, "getAndBitwiseOrRelease long value");
         }
 
         // get and bitwise and
@@ -949,27 +947,27 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
             vh.set(0x0123456789ABCDEFL);
 
             long o = (long) vh.getAndBitwiseAnd(0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAnd long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseAnd long");
             long x = (long) vh.get();
-            assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAnd long value");
+            assertEquals((long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), x, "getAndBitwiseAnd long value");
         }
 
         {
             vh.set(0x0123456789ABCDEFL);
 
             long o = (long) vh.getAndBitwiseAndAcquire(0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndAcquire long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseAndAcquire long");
             long x = (long) vh.get();
-            assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndAcquire long value");
+            assertEquals((long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), x, "getAndBitwiseAndAcquire long value");
         }
 
         {
             vh.set(0x0123456789ABCDEFL);
 
             long o = (long) vh.getAndBitwiseAndRelease(0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndRelease long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseAndRelease long");
             long x = (long) vh.get();
-            assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndRelease long value");
+            assertEquals((long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), x, "getAndBitwiseAndRelease long value");
         }
 
         // get and bitwise xor
@@ -977,27 +975,27 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
             vh.set(0x0123456789ABCDEFL);
 
             long o = (long) vh.getAndBitwiseXor(0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXor long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseXor long");
             long x = (long) vh.get();
-            assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXor long value");
+            assertEquals((long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), x, "getAndBitwiseXor long value");
         }
 
         {
             vh.set(0x0123456789ABCDEFL);
 
             long o = (long) vh.getAndBitwiseXorAcquire(0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorAcquire long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseXorAcquire long");
             long x = (long) vh.get();
-            assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorAcquire long value");
+            assertEquals((long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), x, "getAndBitwiseXorAcquire long value");
         }
 
         {
             vh.set(0x0123456789ABCDEFL);
 
             long o = (long) vh.getAndBitwiseXorRelease(0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorRelease long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseXorRelease long");
             long x = (long) vh.get();
-            assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorRelease long value");
+            assertEquals((long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), x, "getAndBitwiseXorRelease long value");
         }
     }
 
@@ -1015,7 +1013,7 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
             {
                 vh.set(array, i, 0x0123456789ABCDEFL);
                 long x = (long) vh.get(array, i);
-                assertEquals(x, 0x0123456789ABCDEFL, "get long value");
+                assertEquals(0x0123456789ABCDEFL, x, "get long value");
             }
 
 
@@ -1023,21 +1021,21 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
             {
                 vh.setVolatile(array, i, 0xCAFEBABECAFEBABEL);
                 long x = (long) vh.getVolatile(array, i);
-                assertEquals(x, 0xCAFEBABECAFEBABEL, "setVolatile long value");
+                assertEquals(0xCAFEBABECAFEBABEL, x, "setVolatile long value");
             }
 
             // Lazy
             {
                 vh.setRelease(array, i, 0x0123456789ABCDEFL);
                 long x = (long) vh.getAcquire(array, i);
-                assertEquals(x, 0x0123456789ABCDEFL, "setRelease long value");
+                assertEquals(0x0123456789ABCDEFL, x, "setRelease long value");
             }
 
             // Opaque
             {
                 vh.setOpaque(array, i, 0xCAFEBABECAFEBABEL);
                 long x = (long) vh.getOpaque(array, i);
-                assertEquals(x, 0xCAFEBABECAFEBABEL, "setOpaque long value");
+                assertEquals(0xCAFEBABECAFEBABEL, x, "setOpaque long value");
             }
 
             vh.set(array, i, 0x0123456789ABCDEFL);
@@ -1047,56 +1045,56 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
                 boolean r = vh.compareAndSet(array, i, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
                 assertEquals(r, true, "success compareAndSet long");
                 long x = (long) vh.get(array, i);
-                assertEquals(x, 0xCAFEBABECAFEBABEL, "success compareAndSet long value");
+                assertEquals(0xCAFEBABECAFEBABEL, x, "success compareAndSet long value");
             }
 
             {
                 boolean r = vh.compareAndSet(array, i, 0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
                 assertEquals(r, false, "failing compareAndSet long");
                 long x = (long) vh.get(array, i);
-                assertEquals(x, 0xCAFEBABECAFEBABEL, "failing compareAndSet long value");
+                assertEquals(0xCAFEBABECAFEBABEL, x, "failing compareAndSet long value");
             }
 
             {
                 long r = (long) vh.compareAndExchange(array, i, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
                 assertEquals(r, 0xCAFEBABECAFEBABEL, "success compareAndExchange long");
                 long x = (long) vh.get(array, i);
-                assertEquals(x, 0x0123456789ABCDEFL, "success compareAndExchange long value");
+                assertEquals(0x0123456789ABCDEFL, x, "success compareAndExchange long value");
             }
 
             {
                 long r = (long) vh.compareAndExchange(array, i, 0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
                 assertEquals(r, 0x0123456789ABCDEFL, "failing compareAndExchange long");
                 long x = (long) vh.get(array, i);
-                assertEquals(x, 0x0123456789ABCDEFL, "failing compareAndExchange long value");
+                assertEquals(0x0123456789ABCDEFL, x, "failing compareAndExchange long value");
             }
 
             {
                 long r = (long) vh.compareAndExchangeAcquire(array, i, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
                 assertEquals(r, 0x0123456789ABCDEFL, "success compareAndExchangeAcquire long");
                 long x = (long) vh.get(array, i);
-                assertEquals(x, 0xCAFEBABECAFEBABEL, "success compareAndExchangeAcquire long value");
+                assertEquals(0xCAFEBABECAFEBABEL, x, "success compareAndExchangeAcquire long value");
             }
 
             {
                 long r = (long) vh.compareAndExchangeAcquire(array, i, 0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
                 assertEquals(r, 0xCAFEBABECAFEBABEL, "failing compareAndExchangeAcquire long");
                 long x = (long) vh.get(array, i);
-                assertEquals(x, 0xCAFEBABECAFEBABEL, "failing compareAndExchangeAcquire long value");
+                assertEquals(0xCAFEBABECAFEBABEL, x, "failing compareAndExchangeAcquire long value");
             }
 
             {
                 long r = (long) vh.compareAndExchangeRelease(array, i, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
                 assertEquals(r, 0xCAFEBABECAFEBABEL, "success compareAndExchangeRelease long");
                 long x = (long) vh.get(array, i);
-                assertEquals(x, 0x0123456789ABCDEFL, "success compareAndExchangeRelease long value");
+                assertEquals(0x0123456789ABCDEFL, x, "success compareAndExchangeRelease long value");
             }
 
             {
                 long r = (long) vh.compareAndExchangeRelease(array, i, 0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
                 assertEquals(r, 0x0123456789ABCDEFL, "failing compareAndExchangeRelease long");
                 long x = (long) vh.get(array, i);
-                assertEquals(x, 0x0123456789ABCDEFL, "failing compareAndExchangeRelease long value");
+                assertEquals(0x0123456789ABCDEFL, x, "failing compareAndExchangeRelease long value");
             }
 
             {
@@ -1107,14 +1105,14 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetPlain long");
                 long x = (long) vh.get(array, i);
-                assertEquals(x, 0xCAFEBABECAFEBABEL, "success weakCompareAndSetPlain long value");
+                assertEquals(0xCAFEBABECAFEBABEL, x, "success weakCompareAndSetPlain long value");
             }
 
             {
                 boolean success = vh.weakCompareAndSetPlain(array, i, 0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
                 assertEquals(success, false, "failing weakCompareAndSetPlain long");
                 long x = (long) vh.get(array, i);
-                assertEquals(x, 0xCAFEBABECAFEBABEL, "failing weakCompareAndSetPlain long value");
+                assertEquals(0xCAFEBABECAFEBABEL, x, "failing weakCompareAndSetPlain long value");
             }
 
             {
@@ -1125,14 +1123,14 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetAcquire long");
                 long x = (long) vh.get(array, i);
-                assertEquals(x, 0x0123456789ABCDEFL, "success weakCompareAndSetAcquire long");
+                assertEquals(0x0123456789ABCDEFL, x, "success weakCompareAndSetAcquire long");
             }
 
             {
                 boolean success = vh.weakCompareAndSetAcquire(array, i, 0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
                 assertEquals(success, false, "failing weakCompareAndSetAcquire long");
                 long x = (long) vh.get(array, i);
-                assertEquals(x, 0x0123456789ABCDEFL, "failing weakCompareAndSetAcquire long value");
+                assertEquals(0x0123456789ABCDEFL, x, "failing weakCompareAndSetAcquire long value");
             }
 
             {
@@ -1143,14 +1141,14 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetRelease long");
                 long x = (long) vh.get(array, i);
-                assertEquals(x, 0xCAFEBABECAFEBABEL, "success weakCompareAndSetRelease long");
+                assertEquals(0xCAFEBABECAFEBABEL, x, "success weakCompareAndSetRelease long");
             }
 
             {
                 boolean success = vh.weakCompareAndSetRelease(array, i, 0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
                 assertEquals(success, false, "failing weakCompareAndSetRelease long");
                 long x = (long) vh.get(array, i);
-                assertEquals(x, 0xCAFEBABECAFEBABEL, "failing weakCompareAndSetRelease long value");
+                assertEquals(0xCAFEBABECAFEBABEL, x, "failing weakCompareAndSetRelease long value");
             }
 
             {
@@ -1161,14 +1159,14 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSet long");
                 long x = (long) vh.get(array, i);
-                assertEquals(x, 0x0123456789ABCDEFL, "success weakCompareAndSet long");
+                assertEquals(0x0123456789ABCDEFL, x, "success weakCompareAndSet long");
             }
 
             {
                 boolean success = vh.weakCompareAndSet(array, i, 0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
                 assertEquals(success, false, "failing weakCompareAndSet long");
                 long x = (long) vh.get(array, i);
-                assertEquals(x, 0x0123456789ABCDEFL, "failing weakCompareAndSet long value");
+                assertEquals(0x0123456789ABCDEFL, x, "failing weakCompareAndSet long value");
             }
 
             // Compare set and get
@@ -1176,27 +1174,27 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
                 vh.set(array, i, 0x0123456789ABCDEFL);
 
                 long o = (long) vh.getAndSet(array, i, 0xCAFEBABECAFEBABEL);
-                assertEquals(o, 0x0123456789ABCDEFL, "getAndSet long");
+                assertEquals(0x0123456789ABCDEFL, o, "getAndSet long");
                 long x = (long) vh.get(array, i);
-                assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSet long value");
+                assertEquals(0xCAFEBABECAFEBABEL, x, "getAndSet long value");
             }
 
             {
                 vh.set(array, i, 0x0123456789ABCDEFL);
 
                 long o = (long) vh.getAndSetAcquire(array, i, 0xCAFEBABECAFEBABEL);
-                assertEquals(o, 0x0123456789ABCDEFL, "getAndSetAcquire long");
+                assertEquals(0x0123456789ABCDEFL, o, "getAndSetAcquire long");
                 long x = (long) vh.get(array, i);
-                assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetAcquire long value");
+                assertEquals(0xCAFEBABECAFEBABEL, x, "getAndSetAcquire long value");
             }
 
             {
                 vh.set(array, i, 0x0123456789ABCDEFL);
 
                 long o = (long) vh.getAndSetRelease(array, i, 0xCAFEBABECAFEBABEL);
-                assertEquals(o, 0x0123456789ABCDEFL, "getAndSetRelease long");
+                assertEquals(0x0123456789ABCDEFL, o, "getAndSetRelease long");
                 long x = (long) vh.get(array, i);
-                assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetRelease long value");
+                assertEquals(0xCAFEBABECAFEBABEL, x, "getAndSetRelease long value");
             }
 
             // get and add, add and get
@@ -1204,27 +1202,27 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
                 vh.set(array, i, 0x0123456789ABCDEFL);
 
                 long o = (long) vh.getAndAdd(array, i, 0xCAFEBABECAFEBABEL);
-                assertEquals(o, 0x0123456789ABCDEFL, "getAndAdd long");
+                assertEquals(0x0123456789ABCDEFL, o, "getAndAdd long");
                 long x = (long) vh.get(array, i);
-                assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAdd long value");
+                assertEquals((long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), x, "getAndAdd long value");
             }
 
             {
                 vh.set(array, i, 0x0123456789ABCDEFL);
 
                 long o = (long) vh.getAndAddAcquire(array, i, 0xCAFEBABECAFEBABEL);
-                assertEquals(o, 0x0123456789ABCDEFL, "getAndAddAcquire long");
+                assertEquals(0x0123456789ABCDEFL, o, "getAndAddAcquire long");
                 long x = (long) vh.get(array, i);
-                assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddAcquire long value");
+                assertEquals((long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), x, "getAndAddAcquire long value");
             }
 
             {
                 vh.set(array, i, 0x0123456789ABCDEFL);
 
                 long o = (long) vh.getAndAddRelease(array, i, 0xCAFEBABECAFEBABEL);
-                assertEquals(o, 0x0123456789ABCDEFL, "getAndAddReleaselong");
+                assertEquals(0x0123456789ABCDEFL, o, "getAndAddReleaselong");
                 long x = (long) vh.get(array, i);
-                assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddRelease long value");
+                assertEquals((long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), x, "getAndAddRelease long value");
             }
 
             // get and bitwise or
@@ -1232,27 +1230,27 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
                 vh.set(array, i, 0x0123456789ABCDEFL);
 
                 long o = (long) vh.getAndBitwiseOr(array, i, 0xCAFEBABECAFEBABEL);
-                assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOr long");
+                assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseOr long");
                 long x = (long) vh.get(array, i);
-                assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOr long value");
+                assertEquals((long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), x, "getAndBitwiseOr long value");
             }
 
             {
                 vh.set(array, i, 0x0123456789ABCDEFL);
 
                 long o = (long) vh.getAndBitwiseOrAcquire(array, i, 0xCAFEBABECAFEBABEL);
-                assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrAcquire long");
+                assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseOrAcquire long");
                 long x = (long) vh.get(array, i);
-                assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrAcquire long value");
+                assertEquals((long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), x, "getAndBitwiseOrAcquire long value");
             }
 
             {
                 vh.set(array, i, 0x0123456789ABCDEFL);
 
                 long o = (long) vh.getAndBitwiseOrRelease(array, i, 0xCAFEBABECAFEBABEL);
-                assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrRelease long");
+                assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseOrRelease long");
                 long x = (long) vh.get(array, i);
-                assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrRelease long value");
+                assertEquals((long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), x, "getAndBitwiseOrRelease long value");
             }
 
             // get and bitwise and
@@ -1260,27 +1258,27 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
                 vh.set(array, i, 0x0123456789ABCDEFL);
 
                 long o = (long) vh.getAndBitwiseAnd(array, i, 0xCAFEBABECAFEBABEL);
-                assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAnd long");
+                assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseAnd long");
                 long x = (long) vh.get(array, i);
-                assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAnd long value");
+                assertEquals((long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), x, "getAndBitwiseAnd long value");
             }
 
             {
                 vh.set(array, i, 0x0123456789ABCDEFL);
 
                 long o = (long) vh.getAndBitwiseAndAcquire(array, i, 0xCAFEBABECAFEBABEL);
-                assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndAcquire long");
+                assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseAndAcquire long");
                 long x = (long) vh.get(array, i);
-                assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndAcquire long value");
+                assertEquals((long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), x, "getAndBitwiseAndAcquire long value");
             }
 
             {
                 vh.set(array, i, 0x0123456789ABCDEFL);
 
                 long o = (long) vh.getAndBitwiseAndRelease(array, i, 0xCAFEBABECAFEBABEL);
-                assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndRelease long");
+                assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseAndRelease long");
                 long x = (long) vh.get(array, i);
-                assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndRelease long value");
+                assertEquals((long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), x, "getAndBitwiseAndRelease long value");
             }
 
             // get and bitwise xor
@@ -1288,27 +1286,27 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
                 vh.set(array, i, 0x0123456789ABCDEFL);
 
                 long o = (long) vh.getAndBitwiseXor(array, i, 0xCAFEBABECAFEBABEL);
-                assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXor long");
+                assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseXor long");
                 long x = (long) vh.get(array, i);
-                assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXor long value");
+                assertEquals((long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), x, "getAndBitwiseXor long value");
             }
 
             {
                 vh.set(array, i, 0x0123456789ABCDEFL);
 
                 long o = (long) vh.getAndBitwiseXorAcquire(array, i, 0xCAFEBABECAFEBABEL);
-                assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorAcquire long");
+                assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseXorAcquire long");
                 long x = (long) vh.get(array, i);
-                assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorAcquire long value");
+                assertEquals((long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), x, "getAndBitwiseXorAcquire long value");
             }
 
             {
                 vh.set(array, i, 0x0123456789ABCDEFL);
 
                 long o = (long) vh.getAndBitwiseXorRelease(array, i, 0xCAFEBABECAFEBABEL);
-                assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorRelease long");
+                assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseXorRelease long");
                 long x = (long) vh.get(array, i);
-                assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorRelease long value");
+                assertEquals((long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), x, "getAndBitwiseXorRelease long value");
             }
         }
     }
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessModeMethodNames.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessModeMethodNames.java
index 3365bd923bc..61fc8a53fd0 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessModeMethodNames.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessModeMethodNames.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 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
@@ -23,32 +23,34 @@
 
 /*
  * @test
- * @run testng VarHandleTestAccessModeMethodNames
+ * @run junit VarHandleTestAccessModeMethodNames
  * @modules java.base/java.lang.invoke:open
  */
 
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
 
 import java.lang.invoke.VarHandle;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.util.stream.Stream;
 
-import static org.testng.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestAccessModeMethodNames {
 
-    @DataProvider
     public static Object[][] accessModesProvider() {
         return Stream.of(VarHandle.AccessMode.values()).
                 map(am -> new Object[]{am}).
                 toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessModesProvider")
+    @ParameterizedTest
+    @MethodSource("accessModesProvider")
     public void testMethodName(VarHandle.AccessMode am) {
-        assertEquals(am.methodName(), toMethodName(am.name()));
+        assertEquals(toMethodName(am.name()), am.methodName());
     }
 
     private static String toMethodName(String name) {
@@ -62,9 +64,10 @@ public class VarHandleTestAccessModeMethodNames {
     }
 
 
-    @Test(dataProvider = "accessModesProvider")
+    @ParameterizedTest
+    @MethodSource("accessModesProvider")
     public void testReturnType(VarHandle.AccessMode am) throws Exception {
-        assertEquals(getReturnType(am.methodName()), getAccessModeReturnType(am));
+        assertEquals(getAccessModeReturnType(am), getReturnType(am.methodName()));
     }
 
     private static Class getReturnType(String name) throws Exception {
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java
index b9daf4880a0..552672c7372 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,28 +23,30 @@
 
 /*
  * @test
- * @run testng/othervm -Diters=10   -Xint                                                   VarHandleTestAccessShort
+ * @run junit/othervm -Diters=10   -Xint                                                   VarHandleTestAccessShort
  *
  * @comment Set CompileThresholdScaling to 0.1 so that the warmup loop sets to 2000 iterations
  *          to hit compilation thresholds
  *
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestAccessShort
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestAccessShort
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestAccessShort
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestAccessShort
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestAccessShort
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestAccessShort
  */
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestAccessShort extends VarHandleBaseTest {
     static final short static_final_v = (short)0x0123;
 
@@ -108,7 +110,7 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
         return vhs.toArray(new VarHandle[0]);
     }
 
-    @BeforeClass
+    @BeforeAll
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
                 VarHandleTestAccessShort.class, "final_v", short.class);
@@ -125,8 +127,6 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
         vhArray = MethodHandles.arrayElementVarHandle(short[].class);
     }
 
-
-    @DataProvider
     public Object[][] varHandlesProvider() throws Exception {
         List vhs = new ArrayList<>();
         vhs.add(vhField);
@@ -156,7 +156,8 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
         }
     }
 
-    @Test(dataProvider = "varHandlesProvider")
+    @ParameterizedTest
+    @MethodSource("varHandlesProvider")
     public void testIsAccessModeSupported(VarHandle vh) {
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
@@ -194,8 +195,6 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
     }
 
-
-    @DataProvider
     public Object[][] typesProvider() throws Exception {
         List types = new ArrayList<>();
         types.add(new Object[] {vhField, Arrays.asList(VarHandleTestAccessShort.class)});
@@ -205,16 +204,16 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
         return types.stream().toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "typesProvider")
+    @ParameterizedTest
+    @MethodSource("typesProvider")
     public void testTypes(VarHandle vh, List> pts) {
-        assertEquals(vh.varType(), short.class);
+        assertEquals(short.class, vh.varType());
 
-        assertEquals(vh.coordinateTypes(), pts);
+        assertEquals(pts, vh.coordinateTypes());
 
         testTypes(vh);
     }
 
-
     @Test
     public void testLookupInstanceToStatic() {
         checkIAE("Lookup of static final field to instance final field", () -> {
@@ -241,8 +240,6 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
         });
     }
 
-
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -284,7 +281,8 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -297,26 +295,26 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
         // Plain
         {
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)0x0123, "get short value");
+            assertEquals((short)0x0123, x, "get short value");
         }
 
 
         // Volatile
         {
             short x = (short) vh.getVolatile(recv);
-            assertEquals(x, (short)0x0123, "getVolatile short value");
+            assertEquals((short)0x0123, x, "getVolatile short value");
         }
 
         // Lazy
         {
             short x = (short) vh.getAcquire(recv);
-            assertEquals(x, (short)0x0123, "getRelease short value");
+            assertEquals((short)0x0123, x, "getRelease short value");
         }
 
         // Opaque
         {
             short x = (short) vh.getOpaque(recv);
-            assertEquals(x, (short)0x0123, "getOpaque short value");
+            assertEquals((short)0x0123, x, "getOpaque short value");
         }
     }
 
@@ -346,26 +344,26 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
         // Plain
         {
             short x = (short) vh.get();
-            assertEquals(x, (short)0x0123, "get short value");
+            assertEquals((short)0x0123, x, "get short value");
         }
 
 
         // Volatile
         {
             short x = (short) vh.getVolatile();
-            assertEquals(x, (short)0x0123, "getVolatile short value");
+            assertEquals((short)0x0123, x, "getVolatile short value");
         }
 
         // Lazy
         {
             short x = (short) vh.getAcquire();
-            assertEquals(x, (short)0x0123, "getRelease short value");
+            assertEquals((short)0x0123, x, "getRelease short value");
         }
 
         // Opaque
         {
             short x = (short) vh.getOpaque();
-            assertEquals(x, (short)0x0123, "getOpaque short value");
+            assertEquals((short)0x0123, x, "getOpaque short value");
         }
     }
 
@@ -396,7 +394,7 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
         {
             vh.set(recv, (short)0x0123);
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)0x0123, "set short value");
+            assertEquals((short)0x0123, x, "set short value");
         }
 
 
@@ -404,21 +402,21 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
         {
             vh.setVolatile(recv, (short)0x4567);
             short x = (short) vh.getVolatile(recv);
-            assertEquals(x, (short)0x4567, "setVolatile short value");
+            assertEquals((short)0x4567, x, "setVolatile short value");
         }
 
         // Lazy
         {
             vh.setRelease(recv, (short)0x0123);
             short x = (short) vh.getAcquire(recv);
-            assertEquals(x, (short)0x0123, "setRelease short value");
+            assertEquals((short)0x0123, x, "setRelease short value");
         }
 
         // Opaque
         {
             vh.setOpaque(recv, (short)0x4567);
             short x = (short) vh.getOpaque(recv);
-            assertEquals(x, (short)0x4567, "setOpaque short value");
+            assertEquals((short)0x4567, x, "setOpaque short value");
         }
 
         vh.set(recv, (short)0x0123);
@@ -428,56 +426,56 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
             boolean r = vh.compareAndSet(recv, (short)0x0123, (short)0x4567);
             assertEquals(r, true, "success compareAndSet short");
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)0x4567, "success compareAndSet short value");
+            assertEquals((short)0x4567, x, "success compareAndSet short value");
         }
 
         {
             boolean r = vh.compareAndSet(recv, (short)0x0123, (short)0x89AB);
             assertEquals(r, false, "failing compareAndSet short");
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)0x4567, "failing compareAndSet short value");
+            assertEquals((short)0x4567, x, "failing compareAndSet short value");
         }
 
         {
             short r = (short) vh.compareAndExchange(recv, (short)0x4567, (short)0x0123);
             assertEquals(r, (short)0x4567, "success compareAndExchange short");
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)0x0123, "success compareAndExchange short value");
+            assertEquals((short)0x0123, x, "success compareAndExchange short value");
         }
 
         {
             short r = (short) vh.compareAndExchange(recv, (short)0x4567, (short)0x89AB);
             assertEquals(r, (short)0x0123, "failing compareAndExchange short");
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)0x0123, "failing compareAndExchange short value");
+            assertEquals((short)0x0123, x, "failing compareAndExchange short value");
         }
 
         {
             short r = (short) vh.compareAndExchangeAcquire(recv, (short)0x0123, (short)0x4567);
             assertEquals(r, (short)0x0123, "success compareAndExchangeAcquire short");
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)0x4567, "success compareAndExchangeAcquire short value");
+            assertEquals((short)0x4567, x, "success compareAndExchangeAcquire short value");
         }
 
         {
             short r = (short) vh.compareAndExchangeAcquire(recv, (short)0x0123, (short)0x89AB);
             assertEquals(r, (short)0x4567, "failing compareAndExchangeAcquire short");
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)0x4567, "failing compareAndExchangeAcquire short value");
+            assertEquals((short)0x4567, x, "failing compareAndExchangeAcquire short value");
         }
 
         {
             short r = (short) vh.compareAndExchangeRelease(recv, (short)0x4567, (short)0x0123);
             assertEquals(r, (short)0x4567, "success compareAndExchangeRelease short");
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)0x0123, "success compareAndExchangeRelease short value");
+            assertEquals((short)0x0123, x, "success compareAndExchangeRelease short value");
         }
 
         {
             short r = (short) vh.compareAndExchangeRelease(recv, (short)0x4567, (short)0x89AB);
             assertEquals(r, (short)0x0123, "failing compareAndExchangeRelease short");
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)0x0123, "failing compareAndExchangeRelease short value");
+            assertEquals((short)0x0123, x, "failing compareAndExchangeRelease short value");
         }
 
         {
@@ -488,14 +486,14 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain short");
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)0x4567, "success weakCompareAndSetPlain short value");
+            assertEquals((short)0x4567, x, "success weakCompareAndSetPlain short value");
         }
 
         {
             boolean success = vh.weakCompareAndSetPlain(recv, (short)0x0123, (short)0x89AB);
             assertEquals(success, false, "failing weakCompareAndSetPlain short");
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)0x4567, "failing weakCompareAndSetPlain short value");
+            assertEquals((short)0x4567, x, "failing weakCompareAndSetPlain short value");
         }
 
         {
@@ -506,14 +504,14 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire short");
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)0x0123, "success weakCompareAndSetAcquire short");
+            assertEquals((short)0x0123, x, "success weakCompareAndSetAcquire short");
         }
 
         {
             boolean success = vh.weakCompareAndSetAcquire(recv, (short)0x4567, (short)0x89AB);
             assertEquals(success, false, "failing weakCompareAndSetAcquire short");
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)0x0123, "failing weakCompareAndSetAcquire short value");
+            assertEquals((short)0x0123, x, "failing weakCompareAndSetAcquire short value");
         }
 
         {
@@ -524,14 +522,14 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease short");
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)0x4567, "success weakCompareAndSetRelease short");
+            assertEquals((short)0x4567, x, "success weakCompareAndSetRelease short");
         }
 
         {
             boolean success = vh.weakCompareAndSetRelease(recv, (short)0x0123, (short)0x89AB);
             assertEquals(success, false, "failing weakCompareAndSetRelease short");
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)0x4567, "failing weakCompareAndSetRelease short value");
+            assertEquals((short)0x4567, x, "failing weakCompareAndSetRelease short value");
         }
 
         {
@@ -542,14 +540,14 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet short");
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)0x0123, "success weakCompareAndSet short value");
+            assertEquals((short)0x0123, x, "success weakCompareAndSet short value");
         }
 
         {
             boolean success = vh.weakCompareAndSet(recv, (short)0x4567, (short)0x89AB);
             assertEquals(success, false, "failing weakCompareAndSet short");
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)0x0123, "failing weakCompareAndSet short value");
+            assertEquals((short)0x0123, x, "failing weakCompareAndSet short value");
         }
 
         // Compare set and get
@@ -557,27 +555,27 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
             vh.set(recv, (short)0x0123);
 
             short o = (short) vh.getAndSet(recv, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndSet short");
+            assertEquals((short)0x0123, o, "getAndSet short");
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)0x4567, "getAndSet short value");
+            assertEquals((short)0x4567, x, "getAndSet short value");
         }
 
         {
             vh.set(recv, (short)0x0123);
 
             short o = (short) vh.getAndSetAcquire(recv, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndSetAcquire short");
+            assertEquals((short)0x0123, o, "getAndSetAcquire short");
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)0x4567, "getAndSetAcquire short value");
+            assertEquals((short)0x4567, x, "getAndSetAcquire short value");
         }
 
         {
             vh.set(recv, (short)0x0123);
 
             short o = (short) vh.getAndSetRelease(recv, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndSetRelease short");
+            assertEquals((short)0x0123, o, "getAndSetRelease short");
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)0x4567, "getAndSetRelease short value");
+            assertEquals((short)0x4567, x, "getAndSetRelease short value");
         }
 
         // get and add, add and get
@@ -585,27 +583,27 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
             vh.set(recv, (short)0x0123);
 
             short o = (short) vh.getAndAdd(recv, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndAdd short");
+            assertEquals((short)0x0123, o, "getAndAdd short");
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAdd short value");
+            assertEquals((short)((short)0x0123 + (short)0x4567), x, "getAndAdd short value");
         }
 
         {
             vh.set(recv, (short)0x0123);
 
             short o = (short) vh.getAndAddAcquire(recv, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndAddAcquire short");
+            assertEquals((short)0x0123, o, "getAndAddAcquire short");
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddAcquire short value");
+            assertEquals((short)((short)0x0123 + (short)0x4567), x, "getAndAddAcquire short value");
         }
 
         {
             vh.set(recv, (short)0x0123);
 
             short o = (short) vh.getAndAddRelease(recv, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndAddReleaseshort");
+            assertEquals((short)0x0123, o, "getAndAddReleaseshort");
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddRelease short value");
+            assertEquals((short)((short)0x0123 + (short)0x4567), x, "getAndAddRelease short value");
         }
 
         // get and bitwise or
@@ -613,27 +611,27 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
             vh.set(recv, (short)0x0123);
 
             short o = (short) vh.getAndBitwiseOr(recv, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseOr short");
+            assertEquals((short)0x0123, o, "getAndBitwiseOr short");
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOr short value");
+            assertEquals((short)((short)0x0123 | (short)0x4567), x, "getAndBitwiseOr short value");
         }
 
         {
             vh.set(recv, (short)0x0123);
 
             short o = (short) vh.getAndBitwiseOrAcquire(recv, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseOrAcquire short");
+            assertEquals((short)0x0123, o, "getAndBitwiseOrAcquire short");
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrAcquire short value");
+            assertEquals((short)((short)0x0123 | (short)0x4567), x, "getAndBitwiseOrAcquire short value");
         }
 
         {
             vh.set(recv, (short)0x0123);
 
             short o = (short) vh.getAndBitwiseOrRelease(recv, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseOrRelease short");
+            assertEquals((short)0x0123, o, "getAndBitwiseOrRelease short");
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrRelease short value");
+            assertEquals((short)((short)0x0123 | (short)0x4567), x, "getAndBitwiseOrRelease short value");
         }
 
         // get and bitwise and
@@ -641,27 +639,27 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
             vh.set(recv, (short)0x0123);
 
             short o = (short) vh.getAndBitwiseAnd(recv, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseAnd short");
+            assertEquals((short)0x0123, o, "getAndBitwiseAnd short");
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAnd short value");
+            assertEquals((short)((short)0x0123 & (short)0x4567), x, "getAndBitwiseAnd short value");
         }
 
         {
             vh.set(recv, (short)0x0123);
 
             short o = (short) vh.getAndBitwiseAndAcquire(recv, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseAndAcquire short");
+            assertEquals((short)0x0123, o, "getAndBitwiseAndAcquire short");
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndAcquire short value");
+            assertEquals((short)((short)0x0123 & (short)0x4567), x, "getAndBitwiseAndAcquire short value");
         }
 
         {
             vh.set(recv, (short)0x0123);
 
             short o = (short) vh.getAndBitwiseAndRelease(recv, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseAndRelease short");
+            assertEquals((short)0x0123, o, "getAndBitwiseAndRelease short");
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndRelease short value");
+            assertEquals((short)((short)0x0123 & (short)0x4567), x, "getAndBitwiseAndRelease short value");
         }
 
         // get and bitwise xor
@@ -669,27 +667,27 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
             vh.set(recv, (short)0x0123);
 
             short o = (short) vh.getAndBitwiseXor(recv, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseXor short");
+            assertEquals((short)0x0123, o, "getAndBitwiseXor short");
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXor short value");
+            assertEquals((short)((short)0x0123 ^ (short)0x4567), x, "getAndBitwiseXor short value");
         }
 
         {
             vh.set(recv, (short)0x0123);
 
             short o = (short) vh.getAndBitwiseXorAcquire(recv, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseXorAcquire short");
+            assertEquals((short)0x0123, o, "getAndBitwiseXorAcquire short");
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorAcquire short value");
+            assertEquals((short)((short)0x0123 ^ (short)0x4567), x, "getAndBitwiseXorAcquire short value");
         }
 
         {
             vh.set(recv, (short)0x0123);
 
             short o = (short) vh.getAndBitwiseXorRelease(recv, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseXorRelease short");
+            assertEquals((short)0x0123, o, "getAndBitwiseXorRelease short");
             short x = (short) vh.get(recv);
-            assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorRelease short value");
+            assertEquals((short)((short)0x0123 ^ (short)0x4567), x, "getAndBitwiseXorRelease short value");
         }
     }
 
@@ -704,7 +702,7 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
         {
             vh.set((short)0x0123);
             short x = (short) vh.get();
-            assertEquals(x, (short)0x0123, "set short value");
+            assertEquals((short)0x0123, x, "set short value");
         }
 
 
@@ -712,21 +710,21 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
         {
             vh.setVolatile((short)0x4567);
             short x = (short) vh.getVolatile();
-            assertEquals(x, (short)0x4567, "setVolatile short value");
+            assertEquals((short)0x4567, x, "setVolatile short value");
         }
 
         // Lazy
         {
             vh.setRelease((short)0x0123);
             short x = (short) vh.getAcquire();
-            assertEquals(x, (short)0x0123, "setRelease short value");
+            assertEquals((short)0x0123, x, "setRelease short value");
         }
 
         // Opaque
         {
             vh.setOpaque((short)0x4567);
             short x = (short) vh.getOpaque();
-            assertEquals(x, (short)0x4567, "setOpaque short value");
+            assertEquals((short)0x4567, x, "setOpaque short value");
         }
 
         vh.set((short)0x0123);
@@ -736,56 +734,56 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
             boolean r = vh.compareAndSet((short)0x0123, (short)0x4567);
             assertEquals(r, true, "success compareAndSet short");
             short x = (short) vh.get();
-            assertEquals(x, (short)0x4567, "success compareAndSet short value");
+            assertEquals((short)0x4567, x, "success compareAndSet short value");
         }
 
         {
             boolean r = vh.compareAndSet((short)0x0123, (short)0x89AB);
             assertEquals(r, false, "failing compareAndSet short");
             short x = (short) vh.get();
-            assertEquals(x, (short)0x4567, "failing compareAndSet short value");
+            assertEquals((short)0x4567, x, "failing compareAndSet short value");
         }
 
         {
             short r = (short) vh.compareAndExchange((short)0x4567, (short)0x0123);
             assertEquals(r, (short)0x4567, "success compareAndExchange short");
             short x = (short) vh.get();
-            assertEquals(x, (short)0x0123, "success compareAndExchange short value");
+            assertEquals((short)0x0123, x, "success compareAndExchange short value");
         }
 
         {
             short r = (short) vh.compareAndExchange((short)0x4567, (short)0x89AB);
             assertEquals(r, (short)0x0123, "failing compareAndExchange short");
             short x = (short) vh.get();
-            assertEquals(x, (short)0x0123, "failing compareAndExchange short value");
+            assertEquals((short)0x0123, x, "failing compareAndExchange short value");
         }
 
         {
             short r = (short) vh.compareAndExchangeAcquire((short)0x0123, (short)0x4567);
             assertEquals(r, (short)0x0123, "success compareAndExchangeAcquire short");
             short x = (short) vh.get();
-            assertEquals(x, (short)0x4567, "success compareAndExchangeAcquire short value");
+            assertEquals((short)0x4567, x, "success compareAndExchangeAcquire short value");
         }
 
         {
             short r = (short) vh.compareAndExchangeAcquire((short)0x0123, (short)0x89AB);
             assertEquals(r, (short)0x4567, "failing compareAndExchangeAcquire short");
             short x = (short) vh.get();
-            assertEquals(x, (short)0x4567, "failing compareAndExchangeAcquire short value");
+            assertEquals((short)0x4567, x, "failing compareAndExchangeAcquire short value");
         }
 
         {
             short r = (short) vh.compareAndExchangeRelease((short)0x4567, (short)0x0123);
             assertEquals(r, (short)0x4567, "success compareAndExchangeRelease short");
             short x = (short) vh.get();
-            assertEquals(x, (short)0x0123, "success compareAndExchangeRelease short value");
+            assertEquals((short)0x0123, x, "success compareAndExchangeRelease short value");
         }
 
         {
             short r = (short) vh.compareAndExchangeRelease((short)0x4567, (short)0x89AB);
             assertEquals(r, (short)0x0123, "failing compareAndExchangeRelease short");
             short x = (short) vh.get();
-            assertEquals(x, (short)0x0123, "failing compareAndExchangeRelease short value");
+            assertEquals((short)0x0123, x, "failing compareAndExchangeRelease short value");
         }
 
         {
@@ -796,14 +794,14 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain short");
             short x = (short) vh.get();
-            assertEquals(x, (short)0x4567, "success weakCompareAndSetPlain short value");
+            assertEquals((short)0x4567, x, "success weakCompareAndSetPlain short value");
         }
 
         {
             boolean success = vh.weakCompareAndSetPlain((short)0x0123, (short)0x89AB);
             assertEquals(success, false, "failing weakCompareAndSetPlain short");
             short x = (short) vh.get();
-            assertEquals(x, (short)0x4567, "failing weakCompareAndSetPlain short value");
+            assertEquals((short)0x4567, x, "failing weakCompareAndSetPlain short value");
         }
 
         {
@@ -814,14 +812,14 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire short");
             short x = (short) vh.get();
-            assertEquals(x, (short)0x0123, "success weakCompareAndSetAcquire short");
+            assertEquals((short)0x0123, x, "success weakCompareAndSetAcquire short");
         }
 
         {
             boolean success = vh.weakCompareAndSetAcquire((short)0x4567, (short)0x89AB);
             assertEquals(success, false, "failing weakCompareAndSetAcquire short");
             short x = (short) vh.get();
-            assertEquals(x, (short)0x0123, "failing weakCompareAndSetAcquire short value");
+            assertEquals((short)0x0123, x, "failing weakCompareAndSetAcquire short value");
         }
 
         {
@@ -832,14 +830,14 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease short");
             short x = (short) vh.get();
-            assertEquals(x, (short)0x4567, "success weakCompareAndSetRelease short");
+            assertEquals((short)0x4567, x, "success weakCompareAndSetRelease short");
         }
 
         {
             boolean success = vh.weakCompareAndSetRelease((short)0x0123, (short)0x89AB);
             assertEquals(success, false, "failing weakCompareAndSetRelease short");
             short x = (short) vh.get();
-            assertEquals(x, (short)0x4567, "failing weakCompareAndSetRelease short value");
+            assertEquals((short)0x4567, x, "failing weakCompareAndSetRelease short value");
         }
 
         {
@@ -850,14 +848,14 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet short");
             short x = (short) vh.get();
-            assertEquals(x, (short)0x0123, "success weakCompareAndSet short");
+            assertEquals((short)0x0123, x, "success weakCompareAndSet short");
         }
 
         {
             boolean success = vh.weakCompareAndSet((short)0x4567, (short)0x89AB);
             assertEquals(success, false, "failing weakCompareAndSet short");
             short x = (short) vh.get();
-            assertEquals(x, (short)0x0123, "failing weakCompareAndSet short value");
+            assertEquals((short)0x0123, x, "failing weakCompareAndSet short value");
         }
 
         // Compare set and get
@@ -865,27 +863,27 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
             vh.set((short)0x0123);
 
             short o = (short) vh.getAndSet((short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndSet short");
+            assertEquals((short)0x0123, o, "getAndSet short");
             short x = (short) vh.get();
-            assertEquals(x, (short)0x4567, "getAndSet short value");
+            assertEquals((short)0x4567, x, "getAndSet short value");
         }
 
         {
             vh.set((short)0x0123);
 
             short o = (short) vh.getAndSetAcquire((short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndSetAcquire short");
+            assertEquals((short)0x0123, o, "getAndSetAcquire short");
             short x = (short) vh.get();
-            assertEquals(x, (short)0x4567, "getAndSetAcquire short value");
+            assertEquals((short)0x4567, x, "getAndSetAcquire short value");
         }
 
         {
             vh.set((short)0x0123);
 
             short o = (short) vh.getAndSetRelease((short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndSetRelease short");
+            assertEquals((short)0x0123, o, "getAndSetRelease short");
             short x = (short) vh.get();
-            assertEquals(x, (short)0x4567, "getAndSetRelease short value");
+            assertEquals((short)0x4567, x, "getAndSetRelease short value");
         }
 
         // get and add, add and get
@@ -893,27 +891,27 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
             vh.set((short)0x0123);
 
             short o = (short) vh.getAndAdd((short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndAdd short");
+            assertEquals((short)0x0123, o, "getAndAdd short");
             short x = (short) vh.get();
-            assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAdd short value");
+            assertEquals((short)((short)0x0123 + (short)0x4567), x, "getAndAdd short value");
         }
 
         {
             vh.set((short)0x0123);
 
             short o = (short) vh.getAndAddAcquire((short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndAddAcquire short");
+            assertEquals((short)0x0123, o, "getAndAddAcquire short");
             short x = (short) vh.get();
-            assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddAcquire short value");
+            assertEquals((short)((short)0x0123 + (short)0x4567), x, "getAndAddAcquire short value");
         }
 
         {
             vh.set((short)0x0123);
 
             short o = (short) vh.getAndAddRelease((short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndAddReleaseshort");
+            assertEquals((short)0x0123, o, "getAndAddReleaseshort");
             short x = (short) vh.get();
-            assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddRelease short value");
+            assertEquals((short)((short)0x0123 + (short)0x4567), x, "getAndAddRelease short value");
         }
 
         // get and bitwise or
@@ -921,27 +919,27 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
             vh.set((short)0x0123);
 
             short o = (short) vh.getAndBitwiseOr((short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseOr short");
+            assertEquals((short)0x0123, o, "getAndBitwiseOr short");
             short x = (short) vh.get();
-            assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOr short value");
+            assertEquals((short)((short)0x0123 | (short)0x4567), x, "getAndBitwiseOr short value");
         }
 
         {
             vh.set((short)0x0123);
 
             short o = (short) vh.getAndBitwiseOrAcquire((short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseOrAcquire short");
+            assertEquals((short)0x0123, o, "getAndBitwiseOrAcquire short");
             short x = (short) vh.get();
-            assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrAcquire short value");
+            assertEquals((short)((short)0x0123 | (short)0x4567), x, "getAndBitwiseOrAcquire short value");
         }
 
         {
             vh.set((short)0x0123);
 
             short o = (short) vh.getAndBitwiseOrRelease((short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseOrRelease short");
+            assertEquals((short)0x0123, o, "getAndBitwiseOrRelease short");
             short x = (short) vh.get();
-            assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrRelease short value");
+            assertEquals((short)((short)0x0123 | (short)0x4567), x, "getAndBitwiseOrRelease short value");
         }
 
         // get and bitwise and
@@ -949,27 +947,27 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
             vh.set((short)0x0123);
 
             short o = (short) vh.getAndBitwiseAnd((short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseAnd short");
+            assertEquals((short)0x0123, o, "getAndBitwiseAnd short");
             short x = (short) vh.get();
-            assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAnd short value");
+            assertEquals((short)((short)0x0123 & (short)0x4567), x, "getAndBitwiseAnd short value");
         }
 
         {
             vh.set((short)0x0123);
 
             short o = (short) vh.getAndBitwiseAndAcquire((short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseAndAcquire short");
+            assertEquals((short)0x0123, o, "getAndBitwiseAndAcquire short");
             short x = (short) vh.get();
-            assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndAcquire short value");
+            assertEquals((short)((short)0x0123 & (short)0x4567), x, "getAndBitwiseAndAcquire short value");
         }
 
         {
             vh.set((short)0x0123);
 
             short o = (short) vh.getAndBitwiseAndRelease((short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseAndRelease short");
+            assertEquals((short)0x0123, o, "getAndBitwiseAndRelease short");
             short x = (short) vh.get();
-            assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndRelease short value");
+            assertEquals((short)((short)0x0123 & (short)0x4567), x, "getAndBitwiseAndRelease short value");
         }
 
         // get and bitwise xor
@@ -977,27 +975,27 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
             vh.set((short)0x0123);
 
             short o = (short) vh.getAndBitwiseXor((short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseXor short");
+            assertEquals((short)0x0123, o, "getAndBitwiseXor short");
             short x = (short) vh.get();
-            assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXor short value");
+            assertEquals((short)((short)0x0123 ^ (short)0x4567), x, "getAndBitwiseXor short value");
         }
 
         {
             vh.set((short)0x0123);
 
             short o = (short) vh.getAndBitwiseXorAcquire((short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseXorAcquire short");
+            assertEquals((short)0x0123, o, "getAndBitwiseXorAcquire short");
             short x = (short) vh.get();
-            assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorAcquire short value");
+            assertEquals((short)((short)0x0123 ^ (short)0x4567), x, "getAndBitwiseXorAcquire short value");
         }
 
         {
             vh.set((short)0x0123);
 
             short o = (short) vh.getAndBitwiseXorRelease((short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseXorRelease short");
+            assertEquals((short)0x0123, o, "getAndBitwiseXorRelease short");
             short x = (short) vh.get();
-            assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorRelease short value");
+            assertEquals((short)((short)0x0123 ^ (short)0x4567), x, "getAndBitwiseXorRelease short value");
         }
     }
 
@@ -1015,7 +1013,7 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
             {
                 vh.set(array, i, (short)0x0123);
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)0x0123, "get short value");
+                assertEquals((short)0x0123, x, "get short value");
             }
 
 
@@ -1023,21 +1021,21 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
             {
                 vh.setVolatile(array, i, (short)0x4567);
                 short x = (short) vh.getVolatile(array, i);
-                assertEquals(x, (short)0x4567, "setVolatile short value");
+                assertEquals((short)0x4567, x, "setVolatile short value");
             }
 
             // Lazy
             {
                 vh.setRelease(array, i, (short)0x0123);
                 short x = (short) vh.getAcquire(array, i);
-                assertEquals(x, (short)0x0123, "setRelease short value");
+                assertEquals((short)0x0123, x, "setRelease short value");
             }
 
             // Opaque
             {
                 vh.setOpaque(array, i, (short)0x4567);
                 short x = (short) vh.getOpaque(array, i);
-                assertEquals(x, (short)0x4567, "setOpaque short value");
+                assertEquals((short)0x4567, x, "setOpaque short value");
             }
 
             vh.set(array, i, (short)0x0123);
@@ -1047,56 +1045,56 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
                 boolean r = vh.compareAndSet(array, i, (short)0x0123, (short)0x4567);
                 assertEquals(r, true, "success compareAndSet short");
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)0x4567, "success compareAndSet short value");
+                assertEquals((short)0x4567, x, "success compareAndSet short value");
             }
 
             {
                 boolean r = vh.compareAndSet(array, i, (short)0x0123, (short)0x89AB);
                 assertEquals(r, false, "failing compareAndSet short");
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)0x4567, "failing compareAndSet short value");
+                assertEquals((short)0x4567, x, "failing compareAndSet short value");
             }
 
             {
                 short r = (short) vh.compareAndExchange(array, i, (short)0x4567, (short)0x0123);
                 assertEquals(r, (short)0x4567, "success compareAndExchange short");
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)0x0123, "success compareAndExchange short value");
+                assertEquals((short)0x0123, x, "success compareAndExchange short value");
             }
 
             {
                 short r = (short) vh.compareAndExchange(array, i, (short)0x4567, (short)0x89AB);
                 assertEquals(r, (short)0x0123, "failing compareAndExchange short");
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)0x0123, "failing compareAndExchange short value");
+                assertEquals((short)0x0123, x, "failing compareAndExchange short value");
             }
 
             {
                 short r = (short) vh.compareAndExchangeAcquire(array, i, (short)0x0123, (short)0x4567);
                 assertEquals(r, (short)0x0123, "success compareAndExchangeAcquire short");
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)0x4567, "success compareAndExchangeAcquire short value");
+                assertEquals((short)0x4567, x, "success compareAndExchangeAcquire short value");
             }
 
             {
                 short r = (short) vh.compareAndExchangeAcquire(array, i, (short)0x0123, (short)0x89AB);
                 assertEquals(r, (short)0x4567, "failing compareAndExchangeAcquire short");
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)0x4567, "failing compareAndExchangeAcquire short value");
+                assertEquals((short)0x4567, x, "failing compareAndExchangeAcquire short value");
             }
 
             {
                 short r = (short) vh.compareAndExchangeRelease(array, i, (short)0x4567, (short)0x0123);
                 assertEquals(r, (short)0x4567, "success compareAndExchangeRelease short");
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)0x0123, "success compareAndExchangeRelease short value");
+                assertEquals((short)0x0123, x, "success compareAndExchangeRelease short value");
             }
 
             {
                 short r = (short) vh.compareAndExchangeRelease(array, i, (short)0x4567, (short)0x89AB);
                 assertEquals(r, (short)0x0123, "failing compareAndExchangeRelease short");
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)0x0123, "failing compareAndExchangeRelease short value");
+                assertEquals((short)0x0123, x, "failing compareAndExchangeRelease short value");
             }
 
             {
@@ -1107,14 +1105,14 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetPlain short");
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)0x4567, "success weakCompareAndSetPlain short value");
+                assertEquals((short)0x4567, x, "success weakCompareAndSetPlain short value");
             }
 
             {
                 boolean success = vh.weakCompareAndSetPlain(array, i, (short)0x0123, (short)0x89AB);
                 assertEquals(success, false, "failing weakCompareAndSetPlain short");
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)0x4567, "failing weakCompareAndSetPlain short value");
+                assertEquals((short)0x4567, x, "failing weakCompareAndSetPlain short value");
             }
 
             {
@@ -1125,14 +1123,14 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetAcquire short");
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)0x0123, "success weakCompareAndSetAcquire short");
+                assertEquals((short)0x0123, x, "success weakCompareAndSetAcquire short");
             }
 
             {
                 boolean success = vh.weakCompareAndSetAcquire(array, i, (short)0x4567, (short)0x89AB);
                 assertEquals(success, false, "failing weakCompareAndSetAcquire short");
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)0x0123, "failing weakCompareAndSetAcquire short value");
+                assertEquals((short)0x0123, x, "failing weakCompareAndSetAcquire short value");
             }
 
             {
@@ -1143,14 +1141,14 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetRelease short");
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)0x4567, "success weakCompareAndSetRelease short");
+                assertEquals((short)0x4567, x, "success weakCompareAndSetRelease short");
             }
 
             {
                 boolean success = vh.weakCompareAndSetRelease(array, i, (short)0x0123, (short)0x89AB);
                 assertEquals(success, false, "failing weakCompareAndSetRelease short");
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)0x4567, "failing weakCompareAndSetRelease short value");
+                assertEquals((short)0x4567, x, "failing weakCompareAndSetRelease short value");
             }
 
             {
@@ -1161,14 +1159,14 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSet short");
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)0x0123, "success weakCompareAndSet short");
+                assertEquals((short)0x0123, x, "success weakCompareAndSet short");
             }
 
             {
                 boolean success = vh.weakCompareAndSet(array, i, (short)0x4567, (short)0x89AB);
                 assertEquals(success, false, "failing weakCompareAndSet short");
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)0x0123, "failing weakCompareAndSet short value");
+                assertEquals((short)0x0123, x, "failing weakCompareAndSet short value");
             }
 
             // Compare set and get
@@ -1176,27 +1174,27 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
                 vh.set(array, i, (short)0x0123);
 
                 short o = (short) vh.getAndSet(array, i, (short)0x4567);
-                assertEquals(o, (short)0x0123, "getAndSet short");
+                assertEquals((short)0x0123, o, "getAndSet short");
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)0x4567, "getAndSet short value");
+                assertEquals((short)0x4567, x, "getAndSet short value");
             }
 
             {
                 vh.set(array, i, (short)0x0123);
 
                 short o = (short) vh.getAndSetAcquire(array, i, (short)0x4567);
-                assertEquals(o, (short)0x0123, "getAndSetAcquire short");
+                assertEquals((short)0x0123, o, "getAndSetAcquire short");
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)0x4567, "getAndSetAcquire short value");
+                assertEquals((short)0x4567, x, "getAndSetAcquire short value");
             }
 
             {
                 vh.set(array, i, (short)0x0123);
 
                 short o = (short) vh.getAndSetRelease(array, i, (short)0x4567);
-                assertEquals(o, (short)0x0123, "getAndSetRelease short");
+                assertEquals((short)0x0123, o, "getAndSetRelease short");
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)0x4567, "getAndSetRelease short value");
+                assertEquals((short)0x4567, x, "getAndSetRelease short value");
             }
 
             // get and add, add and get
@@ -1204,27 +1202,27 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
                 vh.set(array, i, (short)0x0123);
 
                 short o = (short) vh.getAndAdd(array, i, (short)0x4567);
-                assertEquals(o, (short)0x0123, "getAndAdd short");
+                assertEquals((short)0x0123, o, "getAndAdd short");
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAdd short value");
+                assertEquals((short)((short)0x0123 + (short)0x4567), x, "getAndAdd short value");
             }
 
             {
                 vh.set(array, i, (short)0x0123);
 
                 short o = (short) vh.getAndAddAcquire(array, i, (short)0x4567);
-                assertEquals(o, (short)0x0123, "getAndAddAcquire short");
+                assertEquals((short)0x0123, o, "getAndAddAcquire short");
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddAcquire short value");
+                assertEquals((short)((short)0x0123 + (short)0x4567), x, "getAndAddAcquire short value");
             }
 
             {
                 vh.set(array, i, (short)0x0123);
 
                 short o = (short) vh.getAndAddRelease(array, i, (short)0x4567);
-                assertEquals(o, (short)0x0123, "getAndAddReleaseshort");
+                assertEquals((short)0x0123, o, "getAndAddReleaseshort");
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddRelease short value");
+                assertEquals((short)((short)0x0123 + (short)0x4567), x, "getAndAddRelease short value");
             }
 
             // get and bitwise or
@@ -1232,27 +1230,27 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
                 vh.set(array, i, (short)0x0123);
 
                 short o = (short) vh.getAndBitwiseOr(array, i, (short)0x4567);
-                assertEquals(o, (short)0x0123, "getAndBitwiseOr short");
+                assertEquals((short)0x0123, o, "getAndBitwiseOr short");
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOr short value");
+                assertEquals((short)((short)0x0123 | (short)0x4567), x, "getAndBitwiseOr short value");
             }
 
             {
                 vh.set(array, i, (short)0x0123);
 
                 short o = (short) vh.getAndBitwiseOrAcquire(array, i, (short)0x4567);
-                assertEquals(o, (short)0x0123, "getAndBitwiseOrAcquire short");
+                assertEquals((short)0x0123, o, "getAndBitwiseOrAcquire short");
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrAcquire short value");
+                assertEquals((short)((short)0x0123 | (short)0x4567), x, "getAndBitwiseOrAcquire short value");
             }
 
             {
                 vh.set(array, i, (short)0x0123);
 
                 short o = (short) vh.getAndBitwiseOrRelease(array, i, (short)0x4567);
-                assertEquals(o, (short)0x0123, "getAndBitwiseOrRelease short");
+                assertEquals((short)0x0123, o, "getAndBitwiseOrRelease short");
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrRelease short value");
+                assertEquals((short)((short)0x0123 | (short)0x4567), x, "getAndBitwiseOrRelease short value");
             }
 
             // get and bitwise and
@@ -1260,27 +1258,27 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
                 vh.set(array, i, (short)0x0123);
 
                 short o = (short) vh.getAndBitwiseAnd(array, i, (short)0x4567);
-                assertEquals(o, (short)0x0123, "getAndBitwiseAnd short");
+                assertEquals((short)0x0123, o, "getAndBitwiseAnd short");
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAnd short value");
+                assertEquals((short)((short)0x0123 & (short)0x4567), x, "getAndBitwiseAnd short value");
             }
 
             {
                 vh.set(array, i, (short)0x0123);
 
                 short o = (short) vh.getAndBitwiseAndAcquire(array, i, (short)0x4567);
-                assertEquals(o, (short)0x0123, "getAndBitwiseAndAcquire short");
+                assertEquals((short)0x0123, o, "getAndBitwiseAndAcquire short");
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndAcquire short value");
+                assertEquals((short)((short)0x0123 & (short)0x4567), x, "getAndBitwiseAndAcquire short value");
             }
 
             {
                 vh.set(array, i, (short)0x0123);
 
                 short o = (short) vh.getAndBitwiseAndRelease(array, i, (short)0x4567);
-                assertEquals(o, (short)0x0123, "getAndBitwiseAndRelease short");
+                assertEquals((short)0x0123, o, "getAndBitwiseAndRelease short");
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndRelease short value");
+                assertEquals((short)((short)0x0123 & (short)0x4567), x, "getAndBitwiseAndRelease short value");
             }
 
             // get and bitwise xor
@@ -1288,27 +1286,27 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
                 vh.set(array, i, (short)0x0123);
 
                 short o = (short) vh.getAndBitwiseXor(array, i, (short)0x4567);
-                assertEquals(o, (short)0x0123, "getAndBitwiseXor short");
+                assertEquals((short)0x0123, o, "getAndBitwiseXor short");
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXor short value");
+                assertEquals((short)((short)0x0123 ^ (short)0x4567), x, "getAndBitwiseXor short value");
             }
 
             {
                 vh.set(array, i, (short)0x0123);
 
                 short o = (short) vh.getAndBitwiseXorAcquire(array, i, (short)0x4567);
-                assertEquals(o, (short)0x0123, "getAndBitwiseXorAcquire short");
+                assertEquals((short)0x0123, o, "getAndBitwiseXorAcquire short");
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorAcquire short value");
+                assertEquals((short)((short)0x0123 ^ (short)0x4567), x, "getAndBitwiseXorAcquire short value");
             }
 
             {
                 vh.set(array, i, (short)0x0123);
 
                 short o = (short) vh.getAndBitwiseXorRelease(array, i, (short)0x4567);
-                assertEquals(o, (short)0x0123, "getAndBitwiseXorRelease short");
+                assertEquals((short)0x0123, o, "getAndBitwiseXorRelease short");
                 short x = (short) vh.get(array, i);
-                assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorRelease short value");
+                assertEquals((short)((short)0x0123 ^ (short)0x4567), x, "getAndBitwiseXorRelease short value");
             }
         }
     }
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessString.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessString.java
index 8bc30739660..d1a746ba80e 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessString.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessString.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,28 +23,30 @@
 
 /*
  * @test
- * @run testng/othervm -Diters=10   -Xint                                                   VarHandleTestAccessString
+ * @run junit/othervm -Diters=10   -Xint                                                   VarHandleTestAccessString
  *
  * @comment Set CompileThresholdScaling to 0.1 so that the warmup loop sets to 2000 iterations
  *          to hit compilation thresholds
  *
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestAccessString
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestAccessString
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestAccessString
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestAccessString
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestAccessString
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestAccessString
  */
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestAccessString extends VarHandleBaseTest {
     static final String static_final_v = "foo";
 
@@ -109,7 +111,7 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
         return vhs.toArray(new VarHandle[0]);
     }
 
-    @BeforeClass
+    @BeforeAll
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
                 VarHandleTestAccessString.class, "final_v", String.class);
@@ -127,8 +129,6 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
         vhArrayObject = MethodHandles.arrayElementVarHandle(Object[].class);
     }
 
-
-    @DataProvider
     public Object[][] varHandlesProvider() throws Exception {
         List vhs = new ArrayList<>();
         vhs.add(vhField);
@@ -158,7 +158,8 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
         }
     }
 
-    @Test(dataProvider = "varHandlesProvider")
+    @ParameterizedTest
+    @MethodSource("varHandlesProvider")
     public void testIsAccessModeSupported(VarHandle vh) {
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
@@ -196,8 +197,6 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
         assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
     }
 
-
-    @DataProvider
     public Object[][] typesProvider() throws Exception {
         List types = new ArrayList<>();
         types.add(new Object[] {vhField, Arrays.asList(VarHandleTestAccessString.class)});
@@ -207,16 +206,16 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
         return types.stream().toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "typesProvider")
+    @ParameterizedTest
+    @MethodSource("typesProvider")
     public void testTypes(VarHandle vh, List> pts) {
-        assertEquals(vh.varType(), String.class);
+        assertEquals(String.class, vh.varType());
 
-        assertEquals(vh.coordinateTypes(), pts);
+        assertEquals(pts, vh.coordinateTypes());
 
         testTypes(vh);
     }
 
-
     @Test
     public void testLookupInstanceToStatic() {
         checkIAE("Lookup of static final field to instance final field", () -> {
@@ -243,8 +242,6 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
         });
     }
 
-
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -291,7 +288,8 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -304,26 +302,26 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
         // Plain
         {
             String x = (String) vh.get(recv);
-            assertEquals(x, "foo", "get String value");
+            assertEquals("foo", x, "get String value");
         }
 
 
         // Volatile
         {
             String x = (String) vh.getVolatile(recv);
-            assertEquals(x, "foo", "getVolatile String value");
+            assertEquals("foo", x, "getVolatile String value");
         }
 
         // Lazy
         {
             String x = (String) vh.getAcquire(recv);
-            assertEquals(x, "foo", "getRelease String value");
+            assertEquals("foo", x, "getRelease String value");
         }
 
         // Opaque
         {
             String x = (String) vh.getOpaque(recv);
-            assertEquals(x, "foo", "getOpaque String value");
+            assertEquals("foo", x, "getOpaque String value");
         }
     }
 
@@ -399,26 +397,26 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
         // Plain
         {
             String x = (String) vh.get();
-            assertEquals(x, "foo", "get String value");
+            assertEquals("foo", x, "get String value");
         }
 
 
         // Volatile
         {
             String x = (String) vh.getVolatile();
-            assertEquals(x, "foo", "getVolatile String value");
+            assertEquals("foo", x, "getVolatile String value");
         }
 
         // Lazy
         {
             String x = (String) vh.getAcquire();
-            assertEquals(x, "foo", "getRelease String value");
+            assertEquals("foo", x, "getRelease String value");
         }
 
         // Opaque
         {
             String x = (String) vh.getOpaque();
-            assertEquals(x, "foo", "getOpaque String value");
+            assertEquals("foo", x, "getOpaque String value");
         }
     }
 
@@ -495,7 +493,7 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
         {
             vh.set(recv, "foo");
             String x = (String) vh.get(recv);
-            assertEquals(x, "foo", "set String value");
+            assertEquals("foo", x, "set String value");
         }
 
 
@@ -503,21 +501,21 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
         {
             vh.setVolatile(recv, "bar");
             String x = (String) vh.getVolatile(recv);
-            assertEquals(x, "bar", "setVolatile String value");
+            assertEquals("bar", x, "setVolatile String value");
         }
 
         // Lazy
         {
             vh.setRelease(recv, "foo");
             String x = (String) vh.getAcquire(recv);
-            assertEquals(x, "foo", "setRelease String value");
+            assertEquals("foo", x, "setRelease String value");
         }
 
         // Opaque
         {
             vh.setOpaque(recv, "bar");
             String x = (String) vh.getOpaque(recv);
-            assertEquals(x, "bar", "setOpaque String value");
+            assertEquals("bar", x, "setOpaque String value");
         }
 
         vh.set(recv, "foo");
@@ -527,56 +525,56 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
             boolean r = vh.compareAndSet(recv, "foo", "bar");
             assertEquals(r, true, "success compareAndSet String");
             String x = (String) vh.get(recv);
-            assertEquals(x, "bar", "success compareAndSet String value");
+            assertEquals("bar", x, "success compareAndSet String value");
         }
 
         {
             boolean r = vh.compareAndSet(recv, "foo", "baz");
             assertEquals(r, false, "failing compareAndSet String");
             String x = (String) vh.get(recv);
-            assertEquals(x, "bar", "failing compareAndSet String value");
+            assertEquals("bar", x, "failing compareAndSet String value");
         }
 
         {
             String r = (String) vh.compareAndExchange(recv, "bar", "foo");
             assertEquals(r, "bar", "success compareAndExchange String");
             String x = (String) vh.get(recv);
-            assertEquals(x, "foo", "success compareAndExchange String value");
+            assertEquals("foo", x, "success compareAndExchange String value");
         }
 
         {
             String r = (String) vh.compareAndExchange(recv, "bar", "baz");
             assertEquals(r, "foo", "failing compareAndExchange String");
             String x = (String) vh.get(recv);
-            assertEquals(x, "foo", "failing compareAndExchange String value");
+            assertEquals("foo", x, "failing compareAndExchange String value");
         }
 
         {
             String r = (String) vh.compareAndExchangeAcquire(recv, "foo", "bar");
             assertEquals(r, "foo", "success compareAndExchangeAcquire String");
             String x = (String) vh.get(recv);
-            assertEquals(x, "bar", "success compareAndExchangeAcquire String value");
+            assertEquals("bar", x, "success compareAndExchangeAcquire String value");
         }
 
         {
             String r = (String) vh.compareAndExchangeAcquire(recv, "foo", "baz");
             assertEquals(r, "bar", "failing compareAndExchangeAcquire String");
             String x = (String) vh.get(recv);
-            assertEquals(x, "bar", "failing compareAndExchangeAcquire String value");
+            assertEquals("bar", x, "failing compareAndExchangeAcquire String value");
         }
 
         {
             String r = (String) vh.compareAndExchangeRelease(recv, "bar", "foo");
             assertEquals(r, "bar", "success compareAndExchangeRelease String");
             String x = (String) vh.get(recv);
-            assertEquals(x, "foo", "success compareAndExchangeRelease String value");
+            assertEquals("foo", x, "success compareAndExchangeRelease String value");
         }
 
         {
             String r = (String) vh.compareAndExchangeRelease(recv, "bar", "baz");
             assertEquals(r, "foo", "failing compareAndExchangeRelease String");
             String x = (String) vh.get(recv);
-            assertEquals(x, "foo", "failing compareAndExchangeRelease String value");
+            assertEquals("foo", x, "failing compareAndExchangeRelease String value");
         }
 
         {
@@ -587,14 +585,14 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain String");
             String x = (String) vh.get(recv);
-            assertEquals(x, "bar", "success weakCompareAndSetPlain String value");
+            assertEquals("bar", x, "success weakCompareAndSetPlain String value");
         }
 
         {
             boolean success = vh.weakCompareAndSetPlain(recv, "foo", "baz");
             assertEquals(success, false, "failing weakCompareAndSetPlain String");
             String x = (String) vh.get(recv);
-            assertEquals(x, "bar", "failing weakCompareAndSetPlain String value");
+            assertEquals("bar", x, "failing weakCompareAndSetPlain String value");
         }
 
         {
@@ -605,14 +603,14 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire String");
             String x = (String) vh.get(recv);
-            assertEquals(x, "foo", "success weakCompareAndSetAcquire String");
+            assertEquals("foo", x, "success weakCompareAndSetAcquire String");
         }
 
         {
             boolean success = vh.weakCompareAndSetAcquire(recv, "bar", "baz");
             assertEquals(success, false, "failing weakCompareAndSetAcquire String");
             String x = (String) vh.get(recv);
-            assertEquals(x, "foo", "failing weakCompareAndSetAcquire String value");
+            assertEquals("foo", x, "failing weakCompareAndSetAcquire String value");
         }
 
         {
@@ -623,14 +621,14 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease String");
             String x = (String) vh.get(recv);
-            assertEquals(x, "bar", "success weakCompareAndSetRelease String");
+            assertEquals("bar", x, "success weakCompareAndSetRelease String");
         }
 
         {
             boolean success = vh.weakCompareAndSetRelease(recv, "foo", "baz");
             assertEquals(success, false, "failing weakCompareAndSetRelease String");
             String x = (String) vh.get(recv);
-            assertEquals(x, "bar", "failing weakCompareAndSetRelease String value");
+            assertEquals("bar", x, "failing weakCompareAndSetRelease String value");
         }
 
         {
@@ -641,14 +639,14 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet String");
             String x = (String) vh.get(recv);
-            assertEquals(x, "foo", "success weakCompareAndSet String value");
+            assertEquals("foo", x, "success weakCompareAndSet String value");
         }
 
         {
             boolean success = vh.weakCompareAndSet(recv, "bar", "baz");
             assertEquals(success, false, "failing weakCompareAndSet String");
             String x = (String) vh.get(recv);
-            assertEquals(x, "foo", "failing weakCompareAndSet String value");
+            assertEquals("foo", x, "failing weakCompareAndSet String value");
         }
 
         // Compare set and get
@@ -656,27 +654,27 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
             vh.set(recv, "foo");
 
             String o = (String) vh.getAndSet(recv, "bar");
-            assertEquals(o, "foo", "getAndSet String");
+            assertEquals("foo", o, "getAndSet String");
             String x = (String) vh.get(recv);
-            assertEquals(x, "bar", "getAndSet String value");
+            assertEquals("bar", x, "getAndSet String value");
         }
 
         {
             vh.set(recv, "foo");
 
             String o = (String) vh.getAndSetAcquire(recv, "bar");
-            assertEquals(o, "foo", "getAndSetAcquire String");
+            assertEquals("foo", o, "getAndSetAcquire String");
             String x = (String) vh.get(recv);
-            assertEquals(x, "bar", "getAndSetAcquire String value");
+            assertEquals("bar", x, "getAndSetAcquire String value");
         }
 
         {
             vh.set(recv, "foo");
 
             String o = (String) vh.getAndSetRelease(recv, "bar");
-            assertEquals(o, "foo", "getAndSetRelease String");
+            assertEquals("foo", o, "getAndSetRelease String");
             String x = (String) vh.get(recv);
-            assertEquals(x, "bar", "getAndSetRelease String value");
+            assertEquals("bar", x, "getAndSetRelease String value");
         }
 
 
@@ -739,7 +737,7 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
         {
             vh.set("foo");
             String x = (String) vh.get();
-            assertEquals(x, "foo", "set String value");
+            assertEquals("foo", x, "set String value");
         }
 
 
@@ -747,21 +745,21 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
         {
             vh.setVolatile("bar");
             String x = (String) vh.getVolatile();
-            assertEquals(x, "bar", "setVolatile String value");
+            assertEquals("bar", x, "setVolatile String value");
         }
 
         // Lazy
         {
             vh.setRelease("foo");
             String x = (String) vh.getAcquire();
-            assertEquals(x, "foo", "setRelease String value");
+            assertEquals("foo", x, "setRelease String value");
         }
 
         // Opaque
         {
             vh.setOpaque("bar");
             String x = (String) vh.getOpaque();
-            assertEquals(x, "bar", "setOpaque String value");
+            assertEquals("bar", x, "setOpaque String value");
         }
 
         vh.set("foo");
@@ -771,56 +769,56 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
             boolean r = vh.compareAndSet("foo", "bar");
             assertEquals(r, true, "success compareAndSet String");
             String x = (String) vh.get();
-            assertEquals(x, "bar", "success compareAndSet String value");
+            assertEquals("bar", x, "success compareAndSet String value");
         }
 
         {
             boolean r = vh.compareAndSet("foo", "baz");
             assertEquals(r, false, "failing compareAndSet String");
             String x = (String) vh.get();
-            assertEquals(x, "bar", "failing compareAndSet String value");
+            assertEquals("bar", x, "failing compareAndSet String value");
         }
 
         {
             String r = (String) vh.compareAndExchange("bar", "foo");
             assertEquals(r, "bar", "success compareAndExchange String");
             String x = (String) vh.get();
-            assertEquals(x, "foo", "success compareAndExchange String value");
+            assertEquals("foo", x, "success compareAndExchange String value");
         }
 
         {
             String r = (String) vh.compareAndExchange("bar", "baz");
             assertEquals(r, "foo", "failing compareAndExchange String");
             String x = (String) vh.get();
-            assertEquals(x, "foo", "failing compareAndExchange String value");
+            assertEquals("foo", x, "failing compareAndExchange String value");
         }
 
         {
             String r = (String) vh.compareAndExchangeAcquire("foo", "bar");
             assertEquals(r, "foo", "success compareAndExchangeAcquire String");
             String x = (String) vh.get();
-            assertEquals(x, "bar", "success compareAndExchangeAcquire String value");
+            assertEquals("bar", x, "success compareAndExchangeAcquire String value");
         }
 
         {
             String r = (String) vh.compareAndExchangeAcquire("foo", "baz");
             assertEquals(r, "bar", "failing compareAndExchangeAcquire String");
             String x = (String) vh.get();
-            assertEquals(x, "bar", "failing compareAndExchangeAcquire String value");
+            assertEquals("bar", x, "failing compareAndExchangeAcquire String value");
         }
 
         {
             String r = (String) vh.compareAndExchangeRelease("bar", "foo");
             assertEquals(r, "bar", "success compareAndExchangeRelease String");
             String x = (String) vh.get();
-            assertEquals(x, "foo", "success compareAndExchangeRelease String value");
+            assertEquals("foo", x, "success compareAndExchangeRelease String value");
         }
 
         {
             String r = (String) vh.compareAndExchangeRelease("bar", "baz");
             assertEquals(r, "foo", "failing compareAndExchangeRelease String");
             String x = (String) vh.get();
-            assertEquals(x, "foo", "failing compareAndExchangeRelease String value");
+            assertEquals("foo", x, "failing compareAndExchangeRelease String value");
         }
 
         {
@@ -831,14 +829,14 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain String");
             String x = (String) vh.get();
-            assertEquals(x, "bar", "success weakCompareAndSetPlain String value");
+            assertEquals("bar", x, "success weakCompareAndSetPlain String value");
         }
 
         {
             boolean success = vh.weakCompareAndSetPlain("foo", "baz");
             assertEquals(success, false, "failing weakCompareAndSetPlain String");
             String x = (String) vh.get();
-            assertEquals(x, "bar", "failing weakCompareAndSetPlain String value");
+            assertEquals("bar", x, "failing weakCompareAndSetPlain String value");
         }
 
         {
@@ -849,14 +847,14 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire String");
             String x = (String) vh.get();
-            assertEquals(x, "foo", "success weakCompareAndSetAcquire String");
+            assertEquals("foo", x, "success weakCompareAndSetAcquire String");
         }
 
         {
             boolean success = vh.weakCompareAndSetAcquire("bar", "baz");
             assertEquals(success, false, "failing weakCompareAndSetAcquire String");
             String x = (String) vh.get();
-            assertEquals(x, "foo", "failing weakCompareAndSetAcquire String value");
+            assertEquals("foo", x, "failing weakCompareAndSetAcquire String value");
         }
 
         {
@@ -867,14 +865,14 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease String");
             String x = (String) vh.get();
-            assertEquals(x, "bar", "success weakCompareAndSetRelease String");
+            assertEquals("bar", x, "success weakCompareAndSetRelease String");
         }
 
         {
             boolean success = vh.weakCompareAndSetRelease("foo", "baz");
             assertEquals(success, false, "failing weakCompareAndSetRelease String");
             String x = (String) vh.get();
-            assertEquals(x, "bar", "failing weakCompareAndSetRelease String value");
+            assertEquals("bar", x, "failing weakCompareAndSetRelease String value");
         }
 
         {
@@ -885,14 +883,14 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet String");
             String x = (String) vh.get();
-            assertEquals(x, "foo", "success weakCompareAndSet String");
+            assertEquals("foo", x, "success weakCompareAndSet String");
         }
 
         {
             boolean success = vh.weakCompareAndSet("bar", "baz");
             assertEquals(success, false, "failing weakCompareAndSet String");
             String x = (String) vh.get();
-            assertEquals(x, "foo", "failing weakCompareAndSet String value");
+            assertEquals("foo", x, "failing weakCompareAndSet String value");
         }
 
         // Compare set and get
@@ -900,27 +898,27 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
             vh.set("foo");
 
             String o = (String) vh.getAndSet("bar");
-            assertEquals(o, "foo", "getAndSet String");
+            assertEquals("foo", o, "getAndSet String");
             String x = (String) vh.get();
-            assertEquals(x, "bar", "getAndSet String value");
+            assertEquals("bar", x, "getAndSet String value");
         }
 
         {
             vh.set("foo");
 
             String o = (String) vh.getAndSetAcquire("bar");
-            assertEquals(o, "foo", "getAndSetAcquire String");
+            assertEquals("foo", o, "getAndSetAcquire String");
             String x = (String) vh.get();
-            assertEquals(x, "bar", "getAndSetAcquire String value");
+            assertEquals("bar", x, "getAndSetAcquire String value");
         }
 
         {
             vh.set("foo");
 
             String o = (String) vh.getAndSetRelease("bar");
-            assertEquals(o, "foo", "getAndSetRelease String");
+            assertEquals("foo", o, "getAndSetRelease String");
             String x = (String) vh.get();
-            assertEquals(x, "bar", "getAndSetRelease String value");
+            assertEquals("bar", x, "getAndSetRelease String value");
         }
 
 
@@ -986,7 +984,7 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
             {
                 vh.set(array, i, "foo");
                 String x = (String) vh.get(array, i);
-                assertEquals(x, "foo", "get String value");
+                assertEquals("foo", x, "get String value");
             }
 
 
@@ -994,21 +992,21 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
             {
                 vh.setVolatile(array, i, "bar");
                 String x = (String) vh.getVolatile(array, i);
-                assertEquals(x, "bar", "setVolatile String value");
+                assertEquals("bar", x, "setVolatile String value");
             }
 
             // Lazy
             {
                 vh.setRelease(array, i, "foo");
                 String x = (String) vh.getAcquire(array, i);
-                assertEquals(x, "foo", "setRelease String value");
+                assertEquals("foo", x, "setRelease String value");
             }
 
             // Opaque
             {
                 vh.setOpaque(array, i, "bar");
                 String x = (String) vh.getOpaque(array, i);
-                assertEquals(x, "bar", "setOpaque String value");
+                assertEquals("bar", x, "setOpaque String value");
             }
 
             vh.set(array, i, "foo");
@@ -1018,56 +1016,56 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
                 boolean r = vh.compareAndSet(array, i, "foo", "bar");
                 assertEquals(r, true, "success compareAndSet String");
                 String x = (String) vh.get(array, i);
-                assertEquals(x, "bar", "success compareAndSet String value");
+                assertEquals("bar", x, "success compareAndSet String value");
             }
 
             {
                 boolean r = vh.compareAndSet(array, i, "foo", "baz");
                 assertEquals(r, false, "failing compareAndSet String");
                 String x = (String) vh.get(array, i);
-                assertEquals(x, "bar", "failing compareAndSet String value");
+                assertEquals("bar", x, "failing compareAndSet String value");
             }
 
             {
                 String r = (String) vh.compareAndExchange(array, i, "bar", "foo");
                 assertEquals(r, "bar", "success compareAndExchange String");
                 String x = (String) vh.get(array, i);
-                assertEquals(x, "foo", "success compareAndExchange String value");
+                assertEquals("foo", x, "success compareAndExchange String value");
             }
 
             {
                 String r = (String) vh.compareAndExchange(array, i, "bar", "baz");
                 assertEquals(r, "foo", "failing compareAndExchange String");
                 String x = (String) vh.get(array, i);
-                assertEquals(x, "foo", "failing compareAndExchange String value");
+                assertEquals("foo", x, "failing compareAndExchange String value");
             }
 
             {
                 String r = (String) vh.compareAndExchangeAcquire(array, i, "foo", "bar");
                 assertEquals(r, "foo", "success compareAndExchangeAcquire String");
                 String x = (String) vh.get(array, i);
-                assertEquals(x, "bar", "success compareAndExchangeAcquire String value");
+                assertEquals("bar", x, "success compareAndExchangeAcquire String value");
             }
 
             {
                 String r = (String) vh.compareAndExchangeAcquire(array, i, "foo", "baz");
                 assertEquals(r, "bar", "failing compareAndExchangeAcquire String");
                 String x = (String) vh.get(array, i);
-                assertEquals(x, "bar", "failing compareAndExchangeAcquire String value");
+                assertEquals("bar", x, "failing compareAndExchangeAcquire String value");
             }
 
             {
                 String r = (String) vh.compareAndExchangeRelease(array, i, "bar", "foo");
                 assertEquals(r, "bar", "success compareAndExchangeRelease String");
                 String x = (String) vh.get(array, i);
-                assertEquals(x, "foo", "success compareAndExchangeRelease String value");
+                assertEquals("foo", x, "success compareAndExchangeRelease String value");
             }
 
             {
                 String r = (String) vh.compareAndExchangeRelease(array, i, "bar", "baz");
                 assertEquals(r, "foo", "failing compareAndExchangeRelease String");
                 String x = (String) vh.get(array, i);
-                assertEquals(x, "foo", "failing compareAndExchangeRelease String value");
+                assertEquals("foo", x, "failing compareAndExchangeRelease String value");
             }
 
             {
@@ -1078,14 +1076,14 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetPlain String");
                 String x = (String) vh.get(array, i);
-                assertEquals(x, "bar", "success weakCompareAndSetPlain String value");
+                assertEquals("bar", x, "success weakCompareAndSetPlain String value");
             }
 
             {
                 boolean success = vh.weakCompareAndSetPlain(array, i, "foo", "baz");
                 assertEquals(success, false, "failing weakCompareAndSetPlain String");
                 String x = (String) vh.get(array, i);
-                assertEquals(x, "bar", "failing weakCompareAndSetPlain String value");
+                assertEquals("bar", x, "failing weakCompareAndSetPlain String value");
             }
 
             {
@@ -1096,14 +1094,14 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetAcquire String");
                 String x = (String) vh.get(array, i);
-                assertEquals(x, "foo", "success weakCompareAndSetAcquire String");
+                assertEquals("foo", x, "success weakCompareAndSetAcquire String");
             }
 
             {
                 boolean success = vh.weakCompareAndSetAcquire(array, i, "bar", "baz");
                 assertEquals(success, false, "failing weakCompareAndSetAcquire String");
                 String x = (String) vh.get(array, i);
-                assertEquals(x, "foo", "failing weakCompareAndSetAcquire String value");
+                assertEquals("foo", x, "failing weakCompareAndSetAcquire String value");
             }
 
             {
@@ -1114,14 +1112,14 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetRelease String");
                 String x = (String) vh.get(array, i);
-                assertEquals(x, "bar", "success weakCompareAndSetRelease String");
+                assertEquals("bar", x, "success weakCompareAndSetRelease String");
             }
 
             {
                 boolean success = vh.weakCompareAndSetRelease(array, i, "foo", "baz");
                 assertEquals(success, false, "failing weakCompareAndSetRelease String");
                 String x = (String) vh.get(array, i);
-                assertEquals(x, "bar", "failing weakCompareAndSetRelease String value");
+                assertEquals("bar", x, "failing weakCompareAndSetRelease String value");
             }
 
             {
@@ -1132,14 +1130,14 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSet String");
                 String x = (String) vh.get(array, i);
-                assertEquals(x, "foo", "success weakCompareAndSet String");
+                assertEquals("foo", x, "success weakCompareAndSet String");
             }
 
             {
                 boolean success = vh.weakCompareAndSet(array, i, "bar", "baz");
                 assertEquals(success, false, "failing weakCompareAndSet String");
                 String x = (String) vh.get(array, i);
-                assertEquals(x, "foo", "failing weakCompareAndSet String value");
+                assertEquals("foo", x, "failing weakCompareAndSet String value");
             }
 
             // Compare set and get
@@ -1147,27 +1145,27 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
                 vh.set(array, i, "foo");
 
                 String o = (String) vh.getAndSet(array, i, "bar");
-                assertEquals(o, "foo", "getAndSet String");
+                assertEquals("foo", o, "getAndSet String");
                 String x = (String) vh.get(array, i);
-                assertEquals(x, "bar", "getAndSet String value");
+                assertEquals("bar", x, "getAndSet String value");
             }
 
             {
                 vh.set(array, i, "foo");
 
                 String o = (String) vh.getAndSetAcquire(array, i, "bar");
-                assertEquals(o, "foo", "getAndSetAcquire String");
+                assertEquals("foo", o, "getAndSetAcquire String");
                 String x = (String) vh.get(array, i);
-                assertEquals(x, "bar", "getAndSetAcquire String value");
+                assertEquals("bar", x, "getAndSetAcquire String value");
             }
 
             {
                 vh.set(array, i, "foo");
 
                 String o = (String) vh.getAndSetRelease(array, i, "bar");
-                assertEquals(o, "foo", "getAndSetRelease String");
+                assertEquals("foo", o, "getAndSetRelease String");
                 String x = (String) vh.get(array, i);
-                assertEquals(x, "bar", "getAndSetRelease String value");
+                assertEquals("bar", x, "getAndSetRelease String value");
             }
 
 
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java
index 78c13da45a9..26ac4aab893 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,25 +26,25 @@
  * @bug 8154556
  * @comment Set CompileThresholdScaling to 0.1 so that the warmup loop sets to 2000 iterations
  *          to hit compilation thresholds
- * @run testng/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsChar
- * @run testng/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestByteArrayAsChar
- * @run testng/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestByteArrayAsChar
+ * @run junit/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsChar
+ * @run junit/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestByteArrayAsChar
+ * @run junit/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestByteArrayAsChar
  */
 
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.EnumSet;
 import java.util.List;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest {
     static final int SIZE = Character.BYTES;
 
@@ -107,7 +107,8 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest {
         }
     }
 
-    @Test(dataProvider = "varHandlesProvider")
+    @ParameterizedTest
+    @MethodSource("VarHandleBaseByteArrayTest#varHandlesProvider")
     public void testIsAccessModeSupported(VarHandleSource vhs) {
         VarHandle vh = vhs.s;
 
@@ -158,17 +159,16 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest {
             assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
     }
 
-    @Test(dataProvider = "typesProvider")
+    @ParameterizedTest
+    @MethodSource("typesProvider")
     public void testTypes(VarHandle vh, List> pts) {
-        assertEquals(vh.varType(), char.class);
+        assertEquals(char.class, vh.varType());
 
-        assertEquals(vh.coordinateTypes(), pts);
+        assertEquals(pts, vh.coordinateTypes());
 
         testTypes(vh);
     }
 
-
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -230,7 +230,8 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -239,7 +240,6 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest {
         }
     }
 
-
     static void testArrayNPE(ByteArraySource bs, VarHandleSource vhs) {
         VarHandle vh = vhs.s;
         byte[] array = null;
@@ -740,7 +740,7 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest {
             {
                 vh.set(array, i, VALUE_1);
                 char x = (char) vh.get(array, i);
-                assertEquals(x, VALUE_1, "get char value");
+                assertEquals(VALUE_1, x, "get char value");
             }
         }
     }
@@ -759,7 +759,7 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest {
             {
                 vh.set(array, i, VALUE_1);
                 char x = (char) vh.get(array, i);
-                assertEquals(x, VALUE_1, "get char value");
+                assertEquals(VALUE_1, x, "get char value");
             }
 
             if (iAligned) {
@@ -767,21 +767,21 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest {
                 {
                     vh.setVolatile(array, i, VALUE_2);
                     char x = (char) vh.getVolatile(array, i);
-                    assertEquals(x, VALUE_2, "setVolatile char value");
+                    assertEquals(VALUE_2, x, "setVolatile char value");
                 }
 
                 // Lazy
                 {
                     vh.setRelease(array, i, VALUE_1);
                     char x = (char) vh.getAcquire(array, i);
-                    assertEquals(x, VALUE_1, "setRelease char value");
+                    assertEquals(VALUE_1, x, "setRelease char value");
                 }
 
                 // Opaque
                 {
                     vh.setOpaque(array, i, VALUE_2);
                     char x = (char) vh.getOpaque(array, i);
-                    assertEquals(x, VALUE_2, "setOpaque char value");
+                    assertEquals(VALUE_2, x, "setOpaque char value");
                 }
 
 
@@ -807,26 +807,26 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest {
             // Plain
             {
                 char x = (char) vh.get(array, i);
-                assertEquals(x, v, "get char value");
+                assertEquals(v, x, "get char value");
             }
 
             if (iAligned) {
                 // Volatile
                 {
                     char x = (char) vh.getVolatile(array, i);
-                    assertEquals(x, v, "getVolatile char value");
+                    assertEquals(v, x, "getVolatile char value");
                 }
 
                 // Lazy
                 {
                     char x = (char) vh.getAcquire(array, i);
-                    assertEquals(x, v, "getRelease char value");
+                    assertEquals(v, x, "getRelease char value");
                 }
 
                 // Opaque
                 {
                     char x = (char) vh.getOpaque(array, i);
-                    assertEquals(x, v, "getOpaque char value");
+                    assertEquals(v, x, "getOpaque char value");
                 }
             }
         }
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java
index 331b9073e90..a9e1e603c5d 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,25 +26,25 @@
  * @bug 8154556
  * @comment Set CompileThresholdScaling to 0.1 so that the warmup loop sets to 2000 iterations
  *          to hit compilation thresholds
- * @run testng/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsDouble
- * @run testng/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestByteArrayAsDouble
- * @run testng/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestByteArrayAsDouble
+ * @run junit/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsDouble
+ * @run junit/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestByteArrayAsDouble
+ * @run junit/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestByteArrayAsDouble
  */
 
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.EnumSet;
 import java.util.List;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
     static final int SIZE = Double.BYTES;
 
@@ -107,7 +107,8 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
         }
     }
 
-    @Test(dataProvider = "varHandlesProvider")
+    @ParameterizedTest
+    @MethodSource("VarHandleBaseByteArrayTest#varHandlesProvider")
     public void testIsAccessModeSupported(VarHandleSource vhs) {
         VarHandle vh = vhs.s;
 
@@ -172,17 +173,16 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
             assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
     }
 
-    @Test(dataProvider = "typesProvider")
+    @ParameterizedTest
+    @MethodSource("typesProvider")
     public void testTypes(VarHandle vh, List> pts) {
-        assertEquals(vh.varType(), double.class);
+        assertEquals(double.class, vh.varType());
 
-        assertEquals(vh.coordinateTypes(), pts);
+        assertEquals(pts, vh.coordinateTypes());
 
         testTypes(vh);
     }
 
-
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -244,7 +244,8 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -253,7 +254,6 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
         }
     }
 
-
     static void testArrayNPE(ByteArraySource bs, VarHandleSource vhs) {
         VarHandle vh = vhs.s;
         byte[] array = null;
@@ -883,7 +883,7 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
             {
                 vh.set(array, i, VALUE_1);
                 double x = (double) vh.get(array, i);
-                assertEquals(x, VALUE_1, "get double value");
+                assertEquals(VALUE_1, x, "get double value");
             }
         }
     }
@@ -902,7 +902,7 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
             {
                 vh.set(array, i, VALUE_1);
                 double x = (double) vh.get(array, i);
-                assertEquals(x, VALUE_1, "get double value");
+                assertEquals(VALUE_1, x, "get double value");
             }
 
             if (iAligned) {
@@ -910,21 +910,21 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
                 {
                     vh.setVolatile(array, i, VALUE_2);
                     double x = (double) vh.getVolatile(array, i);
-                    assertEquals(x, VALUE_2, "setVolatile double value");
+                    assertEquals(VALUE_2, x, "setVolatile double value");
                 }
 
                 // Lazy
                 {
                     vh.setRelease(array, i, VALUE_1);
                     double x = (double) vh.getAcquire(array, i);
-                    assertEquals(x, VALUE_1, "setRelease double value");
+                    assertEquals(VALUE_1, x, "setRelease double value");
                 }
 
                 // Opaque
                 {
                     vh.setOpaque(array, i, VALUE_2);
                     double x = (double) vh.getOpaque(array, i);
-                    assertEquals(x, VALUE_2, "setOpaque double value");
+                    assertEquals(VALUE_2, x, "setOpaque double value");
                 }
 
                 vh.set(array, i, VALUE_1);
@@ -934,56 +934,56 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
                     boolean r = vh.compareAndSet(array, i, VALUE_1, VALUE_2);
                     assertEquals(r, true, "success compareAndSet double");
                     double x = (double) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "success compareAndSet double value");
+                    assertEquals(VALUE_2, x, "success compareAndSet double value");
                 }
 
                 {
                     boolean r = vh.compareAndSet(array, i, VALUE_1, VALUE_3);
                     assertEquals(r, false, "failing compareAndSet double");
                     double x = (double) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "failing compareAndSet double value");
+                    assertEquals(VALUE_2, x, "failing compareAndSet double value");
                 }
 
                 {
                     double r = (double) vh.compareAndExchange(array, i, VALUE_2, VALUE_1);
                     assertEquals(r, VALUE_2, "success compareAndExchange double");
                     double x = (double) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "success compareAndExchange double value");
+                    assertEquals(VALUE_1, x, "success compareAndExchange double value");
                 }
 
                 {
                     double r = (double) vh.compareAndExchange(array, i, VALUE_2, VALUE_3);
                     assertEquals(r, VALUE_1, "failing compareAndExchange double");
                     double x = (double) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "failing compareAndExchange double value");
+                    assertEquals(VALUE_1, x, "failing compareAndExchange double value");
                 }
 
                 {
                     double r = (double) vh.compareAndExchangeAcquire(array, i, VALUE_1, VALUE_2);
                     assertEquals(r, VALUE_1, "success compareAndExchangeAcquire double");
                     double x = (double) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "success compareAndExchangeAcquire double value");
+                    assertEquals(VALUE_2, x, "success compareAndExchangeAcquire double value");
                 }
 
                 {
                     double r = (double) vh.compareAndExchangeAcquire(array, i, VALUE_1, VALUE_3);
                     assertEquals(r, VALUE_2, "failing compareAndExchangeAcquire double");
                     double x = (double) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "failing compareAndExchangeAcquire double value");
+                    assertEquals(VALUE_2, x, "failing compareAndExchangeAcquire double value");
                 }
 
                 {
                     double r = (double) vh.compareAndExchangeRelease(array, i, VALUE_2, VALUE_1);
                     assertEquals(r, VALUE_2, "success compareAndExchangeRelease double");
                     double x = (double) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "success compareAndExchangeRelease double value");
+                    assertEquals(VALUE_1, x, "success compareAndExchangeRelease double value");
                 }
 
                 {
                     double r = (double) vh.compareAndExchangeRelease(array, i, VALUE_2, VALUE_3);
                     assertEquals(r, VALUE_1, "failing compareAndExchangeRelease double");
                     double x = (double) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "failing compareAndExchangeRelease double value");
+                    assertEquals(VALUE_1, x, "failing compareAndExchangeRelease double value");
                 }
 
                 {
@@ -994,14 +994,14 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
                     }
                     assertEquals(success, true, "success weakCompareAndSetPlain double");
                     double x = (double) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "success weakCompareAndSetPlain double value");
+                    assertEquals(VALUE_2, x, "success weakCompareAndSetPlain double value");
                 }
 
                 {
                     boolean success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_3);
                     assertEquals(success, false, "failing weakCompareAndSetPlain double");
                     double x = (double) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "failing weakCompareAndSetPlain double value");
+                    assertEquals(VALUE_2, x, "failing weakCompareAndSetPlain double value");
                 }
 
                 {
@@ -1012,14 +1012,14 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
                     }
                     assertEquals(success, true, "success weakCompareAndSetAcquire double");
                     double x = (double) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "success weakCompareAndSetAcquire double");
+                    assertEquals(VALUE_1, x, "success weakCompareAndSetAcquire double");
                 }
 
                 {
                     boolean success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_3);
                     assertEquals(success, false, "failing weakCompareAndSetAcquire double");
                     double x = (double) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "failing weakCompareAndSetAcquire double value");
+                    assertEquals(VALUE_1, x, "failing weakCompareAndSetAcquire double value");
                 }
 
                 {
@@ -1030,14 +1030,14 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
                     }
                     assertEquals(success, true, "success weakCompareAndSetRelease double");
                     double x = (double) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "success weakCompareAndSetRelease double");
+                    assertEquals(VALUE_2, x, "success weakCompareAndSetRelease double");
                 }
 
                 {
                     boolean success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_3);
                     assertEquals(success, false, "failing weakCompareAndSetRelease double");
                     double x = (double) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "failing weakCompareAndSetRelease double value");
+                    assertEquals(VALUE_2, x, "failing weakCompareAndSetRelease double value");
                 }
 
                 {
@@ -1048,14 +1048,14 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
                     }
                     assertEquals(success, true, "success weakCompareAndSet double");
                     double x = (double) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "success weakCompareAndSet double");
+                    assertEquals(VALUE_1, x, "success weakCompareAndSet double");
                 }
 
                 {
                     boolean success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_3);
                     assertEquals(success, false, "failing weakCompareAndSet double");
                     double x = (double) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "failing weakCompareAndSet double value");
+                    assertEquals(VALUE_1, x, "failing weakCompareAndSet double value");
                 }
 
                 // Compare set and get
@@ -1063,27 +1063,27 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
                     vh.set(array, i, VALUE_1);
 
                     double o = (double) vh.getAndSet(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndSet double");
+                    assertEquals(VALUE_1, o, "getAndSet double");
                     double x = (double) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "getAndSet double value");
+                    assertEquals(VALUE_2, x, "getAndSet double value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     double o = (double) vh.getAndSetAcquire(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndSetAcquire double");
+                    assertEquals(VALUE_1, o, "getAndSetAcquire double");
                     double x = (double) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "getAndSetAcquire double value");
+                    assertEquals(VALUE_2, x, "getAndSetAcquire double value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     double o = (double) vh.getAndSetRelease(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndSetRelease double");
+                    assertEquals(VALUE_1, o, "getAndSetRelease double");
                     double x = (double) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "getAndSetRelease double value");
+                    assertEquals(VALUE_2, x, "getAndSetRelease double value");
                 }
 
 
@@ -1109,26 +1109,26 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
             // Plain
             {
                 double x = (double) vh.get(array, i);
-                assertEquals(x, v, "get double value");
+                assertEquals(v, x, "get double value");
             }
 
             if (iAligned) {
                 // Volatile
                 {
                     double x = (double) vh.getVolatile(array, i);
-                    assertEquals(x, v, "getVolatile double value");
+                    assertEquals(v, x, "getVolatile double value");
                 }
 
                 // Lazy
                 {
                     double x = (double) vh.getAcquire(array, i);
-                    assertEquals(x, v, "getRelease double value");
+                    assertEquals(v, x, "getRelease double value");
                 }
 
                 // Opaque
                 {
                     double x = (double) vh.getOpaque(array, i);
-                    assertEquals(x, v, "getOpaque double value");
+                    assertEquals(v, x, "getOpaque double value");
                 }
             }
         }
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java
index 908d61dd597..486487518e9 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,25 +26,25 @@
  * @bug 8154556
  * @comment Set CompileThresholdScaling to 0.1 so that the warmup loop sets to 2000 iterations
  *          to hit compilation thresholds
- * @run testng/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsFloat
- * @run testng/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestByteArrayAsFloat
- * @run testng/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestByteArrayAsFloat
+ * @run junit/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsFloat
+ * @run junit/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestByteArrayAsFloat
+ * @run junit/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestByteArrayAsFloat
  */
 
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.EnumSet;
 import java.util.List;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest {
     static final int SIZE = Float.BYTES;
 
@@ -107,7 +107,8 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest {
         }
     }
 
-    @Test(dataProvider = "varHandlesProvider")
+    @ParameterizedTest
+    @MethodSource("VarHandleBaseByteArrayTest#varHandlesProvider")
     public void testIsAccessModeSupported(VarHandleSource vhs) {
         VarHandle vh = vhs.s;
 
@@ -172,17 +173,16 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest {
             assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
     }
 
-    @Test(dataProvider = "typesProvider")
+    @ParameterizedTest
+    @MethodSource("typesProvider")
     public void testTypes(VarHandle vh, List> pts) {
-        assertEquals(vh.varType(), float.class);
+        assertEquals(float.class, vh.varType());
 
-        assertEquals(vh.coordinateTypes(), pts);
+        assertEquals(pts, vh.coordinateTypes());
 
         testTypes(vh);
     }
 
-
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -244,7 +244,8 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -253,7 +254,6 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest {
         }
     }
 
-
     static void testArrayNPE(ByteArraySource bs, VarHandleSource vhs) {
         VarHandle vh = vhs.s;
         byte[] array = null;
@@ -883,7 +883,7 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest {
             {
                 vh.set(array, i, VALUE_1);
                 float x = (float) vh.get(array, i);
-                assertEquals(x, VALUE_1, "get float value");
+                assertEquals(VALUE_1, x, "get float value");
             }
         }
     }
@@ -902,7 +902,7 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest {
             {
                 vh.set(array, i, VALUE_1);
                 float x = (float) vh.get(array, i);
-                assertEquals(x, VALUE_1, "get float value");
+                assertEquals(VALUE_1, x, "get float value");
             }
 
             if (iAligned) {
@@ -910,21 +910,21 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest {
                 {
                     vh.setVolatile(array, i, VALUE_2);
                     float x = (float) vh.getVolatile(array, i);
-                    assertEquals(x, VALUE_2, "setVolatile float value");
+                    assertEquals(VALUE_2, x, "setVolatile float value");
                 }
 
                 // Lazy
                 {
                     vh.setRelease(array, i, VALUE_1);
                     float x = (float) vh.getAcquire(array, i);
-                    assertEquals(x, VALUE_1, "setRelease float value");
+                    assertEquals(VALUE_1, x, "setRelease float value");
                 }
 
                 // Opaque
                 {
                     vh.setOpaque(array, i, VALUE_2);
                     float x = (float) vh.getOpaque(array, i);
-                    assertEquals(x, VALUE_2, "setOpaque float value");
+                    assertEquals(VALUE_2, x, "setOpaque float value");
                 }
 
                 vh.set(array, i, VALUE_1);
@@ -934,56 +934,56 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest {
                     boolean r = vh.compareAndSet(array, i, VALUE_1, VALUE_2);
                     assertEquals(r, true, "success compareAndSet float");
                     float x = (float) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "success compareAndSet float value");
+                    assertEquals(VALUE_2, x, "success compareAndSet float value");
                 }
 
                 {
                     boolean r = vh.compareAndSet(array, i, VALUE_1, VALUE_3);
                     assertEquals(r, false, "failing compareAndSet float");
                     float x = (float) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "failing compareAndSet float value");
+                    assertEquals(VALUE_2, x, "failing compareAndSet float value");
                 }
 
                 {
                     float r = (float) vh.compareAndExchange(array, i, VALUE_2, VALUE_1);
                     assertEquals(r, VALUE_2, "success compareAndExchange float");
                     float x = (float) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "success compareAndExchange float value");
+                    assertEquals(VALUE_1, x, "success compareAndExchange float value");
                 }
 
                 {
                     float r = (float) vh.compareAndExchange(array, i, VALUE_2, VALUE_3);
                     assertEquals(r, VALUE_1, "failing compareAndExchange float");
                     float x = (float) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "failing compareAndExchange float value");
+                    assertEquals(VALUE_1, x, "failing compareAndExchange float value");
                 }
 
                 {
                     float r = (float) vh.compareAndExchangeAcquire(array, i, VALUE_1, VALUE_2);
                     assertEquals(r, VALUE_1, "success compareAndExchangeAcquire float");
                     float x = (float) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "success compareAndExchangeAcquire float value");
+                    assertEquals(VALUE_2, x, "success compareAndExchangeAcquire float value");
                 }
 
                 {
                     float r = (float) vh.compareAndExchangeAcquire(array, i, VALUE_1, VALUE_3);
                     assertEquals(r, VALUE_2, "failing compareAndExchangeAcquire float");
                     float x = (float) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "failing compareAndExchangeAcquire float value");
+                    assertEquals(VALUE_2, x, "failing compareAndExchangeAcquire float value");
                 }
 
                 {
                     float r = (float) vh.compareAndExchangeRelease(array, i, VALUE_2, VALUE_1);
                     assertEquals(r, VALUE_2, "success compareAndExchangeRelease float");
                     float x = (float) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "success compareAndExchangeRelease float value");
+                    assertEquals(VALUE_1, x, "success compareAndExchangeRelease float value");
                 }
 
                 {
                     float r = (float) vh.compareAndExchangeRelease(array, i, VALUE_2, VALUE_3);
                     assertEquals(r, VALUE_1, "failing compareAndExchangeRelease float");
                     float x = (float) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "failing compareAndExchangeRelease float value");
+                    assertEquals(VALUE_1, x, "failing compareAndExchangeRelease float value");
                 }
 
                 {
@@ -994,14 +994,14 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest {
                     }
                     assertEquals(success, true, "success weakCompareAndSetPlain float");
                     float x = (float) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "success weakCompareAndSetPlain float value");
+                    assertEquals(VALUE_2, x, "success weakCompareAndSetPlain float value");
                 }
 
                 {
                     boolean success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_3);
                     assertEquals(success, false, "failing weakCompareAndSetPlain float");
                     float x = (float) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "failing weakCompareAndSetPlain float value");
+                    assertEquals(VALUE_2, x, "failing weakCompareAndSetPlain float value");
                 }
 
                 {
@@ -1012,14 +1012,14 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest {
                     }
                     assertEquals(success, true, "success weakCompareAndSetAcquire float");
                     float x = (float) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "success weakCompareAndSetAcquire float");
+                    assertEquals(VALUE_1, x, "success weakCompareAndSetAcquire float");
                 }
 
                 {
                     boolean success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_3);
                     assertEquals(success, false, "failing weakCompareAndSetAcquire float");
                     float x = (float) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "failing weakCompareAndSetAcquire float value");
+                    assertEquals(VALUE_1, x, "failing weakCompareAndSetAcquire float value");
                 }
 
                 {
@@ -1030,14 +1030,14 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest {
                     }
                     assertEquals(success, true, "success weakCompareAndSetRelease float");
                     float x = (float) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "success weakCompareAndSetRelease float");
+                    assertEquals(VALUE_2, x, "success weakCompareAndSetRelease float");
                 }
 
                 {
                     boolean success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_3);
                     assertEquals(success, false, "failing weakCompareAndSetRelease float");
                     float x = (float) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "failing weakCompareAndSetRelease float value");
+                    assertEquals(VALUE_2, x, "failing weakCompareAndSetRelease float value");
                 }
 
                 {
@@ -1048,14 +1048,14 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest {
                     }
                     assertEquals(success, true, "success weakCompareAndSet float");
                     float x = (float) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "success weakCompareAndSet float");
+                    assertEquals(VALUE_1, x, "success weakCompareAndSet float");
                 }
 
                 {
                     boolean success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_3);
                     assertEquals(success, false, "failing weakCompareAndSet float");
                     float x = (float) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "failing weakCompareAndSet float value");
+                    assertEquals(VALUE_1, x, "failing weakCompareAndSet float value");
                 }
 
                 // Compare set and get
@@ -1063,27 +1063,27 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest {
                     vh.set(array, i, VALUE_1);
 
                     float o = (float) vh.getAndSet(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndSet float");
+                    assertEquals(VALUE_1, o, "getAndSet float");
                     float x = (float) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "getAndSet float value");
+                    assertEquals(VALUE_2, x, "getAndSet float value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     float o = (float) vh.getAndSetAcquire(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndSetAcquire float");
+                    assertEquals(VALUE_1, o, "getAndSetAcquire float");
                     float x = (float) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "getAndSetAcquire float value");
+                    assertEquals(VALUE_2, x, "getAndSetAcquire float value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     float o = (float) vh.getAndSetRelease(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndSetRelease float");
+                    assertEquals(VALUE_1, o, "getAndSetRelease float");
                     float x = (float) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "getAndSetRelease float value");
+                    assertEquals(VALUE_2, x, "getAndSetRelease float value");
                 }
 
 
@@ -1109,26 +1109,26 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest {
             // Plain
             {
                 float x = (float) vh.get(array, i);
-                assertEquals(x, v, "get float value");
+                assertEquals(v, x, "get float value");
             }
 
             if (iAligned) {
                 // Volatile
                 {
                     float x = (float) vh.getVolatile(array, i);
-                    assertEquals(x, v, "getVolatile float value");
+                    assertEquals(v, x, "getVolatile float value");
                 }
 
                 // Lazy
                 {
                     float x = (float) vh.getAcquire(array, i);
-                    assertEquals(x, v, "getRelease float value");
+                    assertEquals(v, x, "getRelease float value");
                 }
 
                 // Opaque
                 {
                     float x = (float) vh.getOpaque(array, i);
-                    assertEquals(x, v, "getOpaque float value");
+                    assertEquals(v, x, "getOpaque float value");
                 }
             }
         }
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java
index 791510281c1..ce55c3d5e31 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,25 +26,25 @@
  * @bug 8154556
  * @comment Set CompileThresholdScaling to 0.1 so that the warmup loop sets to 2000 iterations
  *          to hit compilation thresholds
- * @run testng/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsInt
- * @run testng/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestByteArrayAsInt
- * @run testng/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestByteArrayAsInt
+ * @run junit/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsInt
+ * @run junit/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestByteArrayAsInt
+ * @run junit/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestByteArrayAsInt
  */
 
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.EnumSet;
 import java.util.List;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
     static final int SIZE = Integer.BYTES;
 
@@ -107,7 +107,8 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
         }
     }
 
-    @Test(dataProvider = "varHandlesProvider")
+    @ParameterizedTest
+    @MethodSource("VarHandleBaseByteArrayTest#varHandlesProvider")
     public void testIsAccessModeSupported(VarHandleSource vhs) {
         VarHandle vh = vhs.s;
 
@@ -190,17 +191,16 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
         }
     }
 
-    @Test(dataProvider = "typesProvider")
+    @ParameterizedTest
+    @MethodSource("typesProvider")
     public void testTypes(VarHandle vh, List> pts) {
-        assertEquals(vh.varType(), int.class);
+        assertEquals(int.class, vh.varType());
 
-        assertEquals(vh.coordinateTypes(), pts);
+        assertEquals(pts, vh.coordinateTypes());
 
         testTypes(vh);
     }
 
-
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -262,7 +262,8 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -271,7 +272,6 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
         }
     }
 
-
     static void testArrayNPE(ByteArraySource bs, VarHandleSource vhs) {
         VarHandle vh = vhs.s;
         byte[] array = null;
@@ -1039,7 +1039,7 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
             {
                 vh.set(array, i, VALUE_1);
                 int x = (int) vh.get(array, i);
-                assertEquals(x, VALUE_1, "get int value");
+                assertEquals(VALUE_1, x, "get int value");
             }
         }
     }
@@ -1058,7 +1058,7 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
             {
                 vh.set(array, i, VALUE_1);
                 int x = (int) vh.get(array, i);
-                assertEquals(x, VALUE_1, "get int value");
+                assertEquals(VALUE_1, x, "get int value");
             }
 
             if (iAligned) {
@@ -1066,21 +1066,21 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
                 {
                     vh.setVolatile(array, i, VALUE_2);
                     int x = (int) vh.getVolatile(array, i);
-                    assertEquals(x, VALUE_2, "setVolatile int value");
+                    assertEquals(VALUE_2, x, "setVolatile int value");
                 }
 
                 // Lazy
                 {
                     vh.setRelease(array, i, VALUE_1);
                     int x = (int) vh.getAcquire(array, i);
-                    assertEquals(x, VALUE_1, "setRelease int value");
+                    assertEquals(VALUE_1, x, "setRelease int value");
                 }
 
                 // Opaque
                 {
                     vh.setOpaque(array, i, VALUE_2);
                     int x = (int) vh.getOpaque(array, i);
-                    assertEquals(x, VALUE_2, "setOpaque int value");
+                    assertEquals(VALUE_2, x, "setOpaque int value");
                 }
 
                 vh.set(array, i, VALUE_1);
@@ -1090,56 +1090,56 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
                     boolean r = vh.compareAndSet(array, i, VALUE_1, VALUE_2);
                     assertEquals(r, true, "success compareAndSet int");
                     int x = (int) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "success compareAndSet int value");
+                    assertEquals(VALUE_2, x, "success compareAndSet int value");
                 }
 
                 {
                     boolean r = vh.compareAndSet(array, i, VALUE_1, VALUE_3);
                     assertEquals(r, false, "failing compareAndSet int");
                     int x = (int) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "failing compareAndSet int value");
+                    assertEquals(VALUE_2, x, "failing compareAndSet int value");
                 }
 
                 {
                     int r = (int) vh.compareAndExchange(array, i, VALUE_2, VALUE_1);
                     assertEquals(r, VALUE_2, "success compareAndExchange int");
                     int x = (int) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "success compareAndExchange int value");
+                    assertEquals(VALUE_1, x, "success compareAndExchange int value");
                 }
 
                 {
                     int r = (int) vh.compareAndExchange(array, i, VALUE_2, VALUE_3);
                     assertEquals(r, VALUE_1, "failing compareAndExchange int");
                     int x = (int) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "failing compareAndExchange int value");
+                    assertEquals(VALUE_1, x, "failing compareAndExchange int value");
                 }
 
                 {
                     int r = (int) vh.compareAndExchangeAcquire(array, i, VALUE_1, VALUE_2);
                     assertEquals(r, VALUE_1, "success compareAndExchangeAcquire int");
                     int x = (int) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "success compareAndExchangeAcquire int value");
+                    assertEquals(VALUE_2, x, "success compareAndExchangeAcquire int value");
                 }
 
                 {
                     int r = (int) vh.compareAndExchangeAcquire(array, i, VALUE_1, VALUE_3);
                     assertEquals(r, VALUE_2, "failing compareAndExchangeAcquire int");
                     int x = (int) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "failing compareAndExchangeAcquire int value");
+                    assertEquals(VALUE_2, x, "failing compareAndExchangeAcquire int value");
                 }
 
                 {
                     int r = (int) vh.compareAndExchangeRelease(array, i, VALUE_2, VALUE_1);
                     assertEquals(r, VALUE_2, "success compareAndExchangeRelease int");
                     int x = (int) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "success compareAndExchangeRelease int value");
+                    assertEquals(VALUE_1, x, "success compareAndExchangeRelease int value");
                 }
 
                 {
                     int r = (int) vh.compareAndExchangeRelease(array, i, VALUE_2, VALUE_3);
                     assertEquals(r, VALUE_1, "failing compareAndExchangeRelease int");
                     int x = (int) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "failing compareAndExchangeRelease int value");
+                    assertEquals(VALUE_1, x, "failing compareAndExchangeRelease int value");
                 }
 
                 {
@@ -1150,14 +1150,14 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
                     }
                     assertEquals(success, true, "success weakCompareAndSetPlain int");
                     int x = (int) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "success weakCompareAndSetPlain int value");
+                    assertEquals(VALUE_2, x, "success weakCompareAndSetPlain int value");
                 }
 
                 {
                     boolean success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_3);
                     assertEquals(success, false, "failing weakCompareAndSetPlain int");
                     int x = (int) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "failing weakCompareAndSetPlain int value");
+                    assertEquals(VALUE_2, x, "failing weakCompareAndSetPlain int value");
                 }
 
                 {
@@ -1168,14 +1168,14 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
                     }
                     assertEquals(success, true, "success weakCompareAndSetAcquire int");
                     int x = (int) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "success weakCompareAndSetAcquire int");
+                    assertEquals(VALUE_1, x, "success weakCompareAndSetAcquire int");
                 }
 
                 {
                     boolean success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_3);
                     assertEquals(success, false, "failing weakCompareAndSetAcquire int");
                     int x = (int) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "failing weakCompareAndSetAcquire int value");
+                    assertEquals(VALUE_1, x, "failing weakCompareAndSetAcquire int value");
                 }
 
                 {
@@ -1186,14 +1186,14 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
                     }
                     assertEquals(success, true, "success weakCompareAndSetRelease int");
                     int x = (int) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "success weakCompareAndSetRelease int");
+                    assertEquals(VALUE_2, x, "success weakCompareAndSetRelease int");
                 }
 
                 {
                     boolean success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_3);
                     assertEquals(success, false, "failing weakCompareAndSetRelease int");
                     int x = (int) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "failing weakCompareAndSetRelease int value");
+                    assertEquals(VALUE_2, x, "failing weakCompareAndSetRelease int value");
                 }
 
                 {
@@ -1204,14 +1204,14 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
                     }
                     assertEquals(success, true, "success weakCompareAndSet int");
                     int x = (int) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "success weakCompareAndSet int");
+                    assertEquals(VALUE_1, x, "success weakCompareAndSet int");
                 }
 
                 {
                     boolean success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_3);
                     assertEquals(success, false, "failing weakCompareAndSet int");
                     int x = (int) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "failing weakCompareAndSet int value");
+                    assertEquals(VALUE_1, x, "failing weakCompareAndSet int value");
                 }
 
                 // Compare set and get
@@ -1219,27 +1219,27 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
                     vh.set(array, i, VALUE_1);
 
                     int o = (int) vh.getAndSet(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndSet int");
+                    assertEquals(VALUE_1, o, "getAndSet int");
                     int x = (int) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "getAndSet int value");
+                    assertEquals(VALUE_2, x, "getAndSet int value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     int o = (int) vh.getAndSetAcquire(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndSetAcquire int");
+                    assertEquals(VALUE_1, o, "getAndSetAcquire int");
                     int x = (int) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "getAndSetAcquire int value");
+                    assertEquals(VALUE_2, x, "getAndSetAcquire int value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     int o = (int) vh.getAndSetRelease(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndSetRelease int");
+                    assertEquals(VALUE_1, o, "getAndSetRelease int");
                     int x = (int) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "getAndSetRelease int value");
+                    assertEquals(VALUE_2, x, "getAndSetRelease int value");
                 }
 
                 // get and add, add and get
@@ -1247,27 +1247,27 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
                     vh.set(array, i, VALUE_1);
 
                     int o = (int) vh.getAndAdd(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndAdd int");
+                    assertEquals(VALUE_1, o, "getAndAdd int");
                     int x = (int) vh.get(array, i);
-                    assertEquals(x, VALUE_1 + VALUE_2, "getAndAdd int value");
+                    assertEquals(VALUE_1 + VALUE_2, x,  "getAndAdd int value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     int o = (int) vh.getAndAddAcquire(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndAddAcquire int");
+                    assertEquals(VALUE_1, o, "getAndAddAcquire int");
                     int x = (int) vh.get(array, i);
-                    assertEquals(x, VALUE_1 + VALUE_2, "getAndAddAcquire int value");
+                    assertEquals(VALUE_1 + VALUE_2, x,  "getAndAddAcquire int value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     int o = (int) vh.getAndAddRelease(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndAddRelease int");
+                    assertEquals(VALUE_1, o, "getAndAddRelease int");
                     int x = (int) vh.get(array, i);
-                    assertEquals(x, VALUE_1 + VALUE_2, "getAndAddRelease int value");
+                    assertEquals(VALUE_1 + VALUE_2, x,  "getAndAddRelease int value");
                 }
 
                 // get and bitwise or
@@ -1275,27 +1275,27 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
                     vh.set(array, i, VALUE_1);
 
                     int o = (int) vh.getAndBitwiseOr(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndBitwiseOr int");
+                    assertEquals(VALUE_1, o, "getAndBitwiseOr int");
                     int x = (int) vh.get(array, i);
-                    assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOr int value");
+                    assertEquals(VALUE_1 | VALUE_2, x, "getAndBitwiseOr int value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     int o = (int) vh.getAndBitwiseOrAcquire(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndBitwiseOrAcquire int");
+                    assertEquals(VALUE_1, o, "getAndBitwiseOrAcquire int");
                     int x = (int) vh.get(array, i);
-                    assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrAcquire int value");
+                    assertEquals(VALUE_1 | VALUE_2, x, "getAndBitwiseOrAcquire int value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     int o = (int) vh.getAndBitwiseOrRelease(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndBitwiseOrRelease int");
+                    assertEquals(VALUE_1, o, "getAndBitwiseOrRelease int");
                     int x = (int) vh.get(array, i);
-                    assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrRelease int value");
+                    assertEquals(VALUE_1 | VALUE_2, x, "getAndBitwiseOrRelease int value");
                 }
 
                 // get and bitwise and
@@ -1303,27 +1303,27 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
                     vh.set(array, i, VALUE_1);
 
                     int o = (int) vh.getAndBitwiseAnd(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndBitwiseAnd int");
+                    assertEquals(VALUE_1, o, "getAndBitwiseAnd int");
                     int x = (int) vh.get(array, i);
-                    assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAnd int value");
+                    assertEquals(VALUE_1 & VALUE_2, x, "getAndBitwiseAnd int value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     int o = (int) vh.getAndBitwiseAndAcquire(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndBitwiseAndAcquire int");
+                    assertEquals(VALUE_1, o, "getAndBitwiseAndAcquire int");
                     int x = (int) vh.get(array, i);
-                    assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndAcquire int value");
+                    assertEquals(VALUE_1 & VALUE_2, x, "getAndBitwiseAndAcquire int value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     int o = (int) vh.getAndBitwiseAndRelease(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndBitwiseAndRelease int");
+                    assertEquals(VALUE_1, o, "getAndBitwiseAndRelease int");
                     int x = (int) vh.get(array, i);
-                    assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndRelease int value");
+                    assertEquals(VALUE_1 & VALUE_2, x, "getAndBitwiseAndRelease int value");
                 }
 
                 // get and bitwise xor
@@ -1331,27 +1331,27 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
                     vh.set(array, i, VALUE_1);
 
                     int o = (int) vh.getAndBitwiseXor(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndBitwiseXor int");
+                    assertEquals(VALUE_1, o, "getAndBitwiseXor int");
                     int x = (int) vh.get(array, i);
-                    assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXor int value");
+                    assertEquals(VALUE_1 ^ VALUE_2, x, "getAndBitwiseXor int value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     int o = (int) vh.getAndBitwiseXorAcquire(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndBitwiseXorAcquire int");
+                    assertEquals(VALUE_1, o, "getAndBitwiseXorAcquire int");
                     int x = (int) vh.get(array, i);
-                    assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorAcquire int value");
+                    assertEquals(VALUE_1 ^ VALUE_2, x, "getAndBitwiseXorAcquire int value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     int o = (int) vh.getAndBitwiseXorRelease(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndBitwiseXorRelease int");
+                    assertEquals(VALUE_1, o, "getAndBitwiseXorRelease int");
                     int x = (int) vh.get(array, i);
-                    assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorRelease int value");
+                    assertEquals(VALUE_1 ^ VALUE_2, x, "getAndBitwiseXorRelease int value");
                 }
             }
         }
@@ -1375,26 +1375,26 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
             // Plain
             {
                 int x = (int) vh.get(array, i);
-                assertEquals(x, v, "get int value");
+                assertEquals(v, x, "get int value");
             }
 
             if (iAligned) {
                 // Volatile
                 {
                     int x = (int) vh.getVolatile(array, i);
-                    assertEquals(x, v, "getVolatile int value");
+                    assertEquals(v, x, "getVolatile int value");
                 }
 
                 // Lazy
                 {
                     int x = (int) vh.getAcquire(array, i);
-                    assertEquals(x, v, "getRelease int value");
+                    assertEquals(v, x, "getRelease int value");
                 }
 
                 // Opaque
                 {
                     int x = (int) vh.getOpaque(array, i);
-                    assertEquals(x, v, "getOpaque int value");
+                    assertEquals(v, x, "getOpaque int value");
                 }
             }
         }
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java
index 4188a51a559..763703b6079 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,25 +26,25 @@
  * @bug 8154556
  * @comment Set CompileThresholdScaling to 0.1 so that the warmup loop sets to 2000 iterations
  *          to hit compilation thresholds
- * @run testng/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsLong
- * @run testng/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestByteArrayAsLong
- * @run testng/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestByteArrayAsLong
+ * @run junit/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsLong
+ * @run junit/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestByteArrayAsLong
+ * @run junit/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestByteArrayAsLong
  */
 
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.EnumSet;
 import java.util.List;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
     static final int SIZE = Long.BYTES;
 
@@ -107,7 +107,8 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
         }
     }
 
-    @Test(dataProvider = "varHandlesProvider")
+    @ParameterizedTest
+    @MethodSource("VarHandleBaseByteArrayTest#varHandlesProvider")
     public void testIsAccessModeSupported(VarHandleSource vhs) {
         VarHandle vh = vhs.s;
 
@@ -190,17 +191,16 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
         }
     }
 
-    @Test(dataProvider = "typesProvider")
+    @ParameterizedTest
+    @MethodSource("typesProvider")
     public void testTypes(VarHandle vh, List> pts) {
-        assertEquals(vh.varType(), long.class);
+        assertEquals(long.class, vh.varType());
 
-        assertEquals(vh.coordinateTypes(), pts);
+        assertEquals(pts, vh.coordinateTypes());
 
         testTypes(vh);
     }
 
-
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -262,7 +262,8 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -271,7 +272,6 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
         }
     }
 
-
     static void testArrayNPE(ByteArraySource bs, VarHandleSource vhs) {
         VarHandle vh = vhs.s;
         byte[] array = null;
@@ -1039,7 +1039,7 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
             {
                 vh.set(array, i, VALUE_1);
                 long x = (long) vh.get(array, i);
-                assertEquals(x, VALUE_1, "get long value");
+                assertEquals(VALUE_1, x, "get long value");
             }
         }
     }
@@ -1058,7 +1058,7 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
             {
                 vh.set(array, i, VALUE_1);
                 long x = (long) vh.get(array, i);
-                assertEquals(x, VALUE_1, "get long value");
+                assertEquals(VALUE_1, x, "get long value");
             }
 
             if (iAligned) {
@@ -1066,21 +1066,21 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
                 {
                     vh.setVolatile(array, i, VALUE_2);
                     long x = (long) vh.getVolatile(array, i);
-                    assertEquals(x, VALUE_2, "setVolatile long value");
+                    assertEquals(VALUE_2, x, "setVolatile long value");
                 }
 
                 // Lazy
                 {
                     vh.setRelease(array, i, VALUE_1);
                     long x = (long) vh.getAcquire(array, i);
-                    assertEquals(x, VALUE_1, "setRelease long value");
+                    assertEquals(VALUE_1, x, "setRelease long value");
                 }
 
                 // Opaque
                 {
                     vh.setOpaque(array, i, VALUE_2);
                     long x = (long) vh.getOpaque(array, i);
-                    assertEquals(x, VALUE_2, "setOpaque long value");
+                    assertEquals(VALUE_2, x, "setOpaque long value");
                 }
 
                 vh.set(array, i, VALUE_1);
@@ -1090,56 +1090,56 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
                     boolean r = vh.compareAndSet(array, i, VALUE_1, VALUE_2);
                     assertEquals(r, true, "success compareAndSet long");
                     long x = (long) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "success compareAndSet long value");
+                    assertEquals(VALUE_2, x, "success compareAndSet long value");
                 }
 
                 {
                     boolean r = vh.compareAndSet(array, i, VALUE_1, VALUE_3);
                     assertEquals(r, false, "failing compareAndSet long");
                     long x = (long) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "failing compareAndSet long value");
+                    assertEquals(VALUE_2, x, "failing compareAndSet long value");
                 }
 
                 {
                     long r = (long) vh.compareAndExchange(array, i, VALUE_2, VALUE_1);
                     assertEquals(r, VALUE_2, "success compareAndExchange long");
                     long x = (long) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "success compareAndExchange long value");
+                    assertEquals(VALUE_1, x, "success compareAndExchange long value");
                 }
 
                 {
                     long r = (long) vh.compareAndExchange(array, i, VALUE_2, VALUE_3);
                     assertEquals(r, VALUE_1, "failing compareAndExchange long");
                     long x = (long) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "failing compareAndExchange long value");
+                    assertEquals(VALUE_1, x, "failing compareAndExchange long value");
                 }
 
                 {
                     long r = (long) vh.compareAndExchangeAcquire(array, i, VALUE_1, VALUE_2);
                     assertEquals(r, VALUE_1, "success compareAndExchangeAcquire long");
                     long x = (long) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "success compareAndExchangeAcquire long value");
+                    assertEquals(VALUE_2, x, "success compareAndExchangeAcquire long value");
                 }
 
                 {
                     long r = (long) vh.compareAndExchangeAcquire(array, i, VALUE_1, VALUE_3);
                     assertEquals(r, VALUE_2, "failing compareAndExchangeAcquire long");
                     long x = (long) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "failing compareAndExchangeAcquire long value");
+                    assertEquals(VALUE_2, x, "failing compareAndExchangeAcquire long value");
                 }
 
                 {
                     long r = (long) vh.compareAndExchangeRelease(array, i, VALUE_2, VALUE_1);
                     assertEquals(r, VALUE_2, "success compareAndExchangeRelease long");
                     long x = (long) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "success compareAndExchangeRelease long value");
+                    assertEquals(VALUE_1, x, "success compareAndExchangeRelease long value");
                 }
 
                 {
                     long r = (long) vh.compareAndExchangeRelease(array, i, VALUE_2, VALUE_3);
                     assertEquals(r, VALUE_1, "failing compareAndExchangeRelease long");
                     long x = (long) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "failing compareAndExchangeRelease long value");
+                    assertEquals(VALUE_1, x, "failing compareAndExchangeRelease long value");
                 }
 
                 {
@@ -1150,14 +1150,14 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
                     }
                     assertEquals(success, true, "success weakCompareAndSetPlain long");
                     long x = (long) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "success weakCompareAndSetPlain long value");
+                    assertEquals(VALUE_2, x, "success weakCompareAndSetPlain long value");
                 }
 
                 {
                     boolean success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_3);
                     assertEquals(success, false, "failing weakCompareAndSetPlain long");
                     long x = (long) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "failing weakCompareAndSetPlain long value");
+                    assertEquals(VALUE_2, x, "failing weakCompareAndSetPlain long value");
                 }
 
                 {
@@ -1168,14 +1168,14 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
                     }
                     assertEquals(success, true, "success weakCompareAndSetAcquire long");
                     long x = (long) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "success weakCompareAndSetAcquire long");
+                    assertEquals(VALUE_1, x, "success weakCompareAndSetAcquire long");
                 }
 
                 {
                     boolean success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_3);
                     assertEquals(success, false, "failing weakCompareAndSetAcquire long");
                     long x = (long) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "failing weakCompareAndSetAcquire long value");
+                    assertEquals(VALUE_1, x, "failing weakCompareAndSetAcquire long value");
                 }
 
                 {
@@ -1186,14 +1186,14 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
                     }
                     assertEquals(success, true, "success weakCompareAndSetRelease long");
                     long x = (long) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "success weakCompareAndSetRelease long");
+                    assertEquals(VALUE_2, x, "success weakCompareAndSetRelease long");
                 }
 
                 {
                     boolean success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_3);
                     assertEquals(success, false, "failing weakCompareAndSetRelease long");
                     long x = (long) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "failing weakCompareAndSetRelease long value");
+                    assertEquals(VALUE_2, x, "failing weakCompareAndSetRelease long value");
                 }
 
                 {
@@ -1204,14 +1204,14 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
                     }
                     assertEquals(success, true, "success weakCompareAndSet long");
                     long x = (long) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "success weakCompareAndSet long");
+                    assertEquals(VALUE_1, x, "success weakCompareAndSet long");
                 }
 
                 {
                     boolean success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_3);
                     assertEquals(success, false, "failing weakCompareAndSet long");
                     long x = (long) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "failing weakCompareAndSet long value");
+                    assertEquals(VALUE_1, x, "failing weakCompareAndSet long value");
                 }
 
                 // Compare set and get
@@ -1219,27 +1219,27 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
                     vh.set(array, i, VALUE_1);
 
                     long o = (long) vh.getAndSet(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndSet long");
+                    assertEquals(VALUE_1, o, "getAndSet long");
                     long x = (long) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "getAndSet long value");
+                    assertEquals(VALUE_2, x, "getAndSet long value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     long o = (long) vh.getAndSetAcquire(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndSetAcquire long");
+                    assertEquals(VALUE_1, o, "getAndSetAcquire long");
                     long x = (long) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "getAndSetAcquire long value");
+                    assertEquals(VALUE_2, x, "getAndSetAcquire long value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     long o = (long) vh.getAndSetRelease(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndSetRelease long");
+                    assertEquals(VALUE_1, o, "getAndSetRelease long");
                     long x = (long) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "getAndSetRelease long value");
+                    assertEquals(VALUE_2, x, "getAndSetRelease long value");
                 }
 
                 // get and add, add and get
@@ -1247,27 +1247,27 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
                     vh.set(array, i, VALUE_1);
 
                     long o = (long) vh.getAndAdd(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndAdd long");
+                    assertEquals(VALUE_1, o, "getAndAdd long");
                     long x = (long) vh.get(array, i);
-                    assertEquals(x, VALUE_1 + VALUE_2, "getAndAdd long value");
+                    assertEquals(VALUE_1 + VALUE_2, x,  "getAndAdd long value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     long o = (long) vh.getAndAddAcquire(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndAddAcquire long");
+                    assertEquals(VALUE_1, o, "getAndAddAcquire long");
                     long x = (long) vh.get(array, i);
-                    assertEquals(x, VALUE_1 + VALUE_2, "getAndAddAcquire long value");
+                    assertEquals(VALUE_1 + VALUE_2, x,  "getAndAddAcquire long value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     long o = (long) vh.getAndAddRelease(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndAddRelease long");
+                    assertEquals(VALUE_1, o, "getAndAddRelease long");
                     long x = (long) vh.get(array, i);
-                    assertEquals(x, VALUE_1 + VALUE_2, "getAndAddRelease long value");
+                    assertEquals(VALUE_1 + VALUE_2, x,  "getAndAddRelease long value");
                 }
 
                 // get and bitwise or
@@ -1275,27 +1275,27 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
                     vh.set(array, i, VALUE_1);
 
                     long o = (long) vh.getAndBitwiseOr(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndBitwiseOr long");
+                    assertEquals(VALUE_1, o, "getAndBitwiseOr long");
                     long x = (long) vh.get(array, i);
-                    assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOr long value");
+                    assertEquals(VALUE_1 | VALUE_2, x, "getAndBitwiseOr long value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     long o = (long) vh.getAndBitwiseOrAcquire(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndBitwiseOrAcquire long");
+                    assertEquals(VALUE_1, o, "getAndBitwiseOrAcquire long");
                     long x = (long) vh.get(array, i);
-                    assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrAcquire long value");
+                    assertEquals(VALUE_1 | VALUE_2, x, "getAndBitwiseOrAcquire long value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     long o = (long) vh.getAndBitwiseOrRelease(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndBitwiseOrRelease long");
+                    assertEquals(VALUE_1, o, "getAndBitwiseOrRelease long");
                     long x = (long) vh.get(array, i);
-                    assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrRelease long value");
+                    assertEquals(VALUE_1 | VALUE_2, x, "getAndBitwiseOrRelease long value");
                 }
 
                 // get and bitwise and
@@ -1303,27 +1303,27 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
                     vh.set(array, i, VALUE_1);
 
                     long o = (long) vh.getAndBitwiseAnd(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndBitwiseAnd long");
+                    assertEquals(VALUE_1, o, "getAndBitwiseAnd long");
                     long x = (long) vh.get(array, i);
-                    assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAnd long value");
+                    assertEquals(VALUE_1 & VALUE_2, x, "getAndBitwiseAnd long value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     long o = (long) vh.getAndBitwiseAndAcquire(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndBitwiseAndAcquire long");
+                    assertEquals(VALUE_1, o, "getAndBitwiseAndAcquire long");
                     long x = (long) vh.get(array, i);
-                    assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndAcquire long value");
+                    assertEquals(VALUE_1 & VALUE_2, x, "getAndBitwiseAndAcquire long value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     long o = (long) vh.getAndBitwiseAndRelease(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndBitwiseAndRelease long");
+                    assertEquals(VALUE_1, o, "getAndBitwiseAndRelease long");
                     long x = (long) vh.get(array, i);
-                    assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndRelease long value");
+                    assertEquals(VALUE_1 & VALUE_2, x, "getAndBitwiseAndRelease long value");
                 }
 
                 // get and bitwise xor
@@ -1331,27 +1331,27 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
                     vh.set(array, i, VALUE_1);
 
                     long o = (long) vh.getAndBitwiseXor(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndBitwiseXor long");
+                    assertEquals(VALUE_1, o, "getAndBitwiseXor long");
                     long x = (long) vh.get(array, i);
-                    assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXor long value");
+                    assertEquals(VALUE_1 ^ VALUE_2, x, "getAndBitwiseXor long value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     long o = (long) vh.getAndBitwiseXorAcquire(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndBitwiseXorAcquire long");
+                    assertEquals(VALUE_1, o, "getAndBitwiseXorAcquire long");
                     long x = (long) vh.get(array, i);
-                    assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorAcquire long value");
+                    assertEquals(VALUE_1 ^ VALUE_2, x, "getAndBitwiseXorAcquire long value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     long o = (long) vh.getAndBitwiseXorRelease(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndBitwiseXorRelease long");
+                    assertEquals(VALUE_1, o, "getAndBitwiseXorRelease long");
                     long x = (long) vh.get(array, i);
-                    assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorRelease long value");
+                    assertEquals(VALUE_1 ^ VALUE_2, x, "getAndBitwiseXorRelease long value");
                 }
             }
         }
@@ -1375,26 +1375,26 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
             // Plain
             {
                 long x = (long) vh.get(array, i);
-                assertEquals(x, v, "get long value");
+                assertEquals(v, x, "get long value");
             }
 
             if (iAligned) {
                 // Volatile
                 {
                     long x = (long) vh.getVolatile(array, i);
-                    assertEquals(x, v, "getVolatile long value");
+                    assertEquals(v, x, "getVolatile long value");
                 }
 
                 // Lazy
                 {
                     long x = (long) vh.getAcquire(array, i);
-                    assertEquals(x, v, "getRelease long value");
+                    assertEquals(v, x, "getRelease long value");
                 }
 
                 // Opaque
                 {
                     long x = (long) vh.getOpaque(array, i);
-                    assertEquals(x, v, "getOpaque long value");
+                    assertEquals(v, x, "getOpaque long value");
                 }
             }
         }
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java
index 1ecfef0476e..7a3bc069c22 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,25 +26,25 @@
  * @bug 8154556
  * @comment Set CompileThresholdScaling to 0.1 so that the warmup loop sets to 2000 iterations
  *          to hit compilation thresholds
- * @run testng/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsShort
- * @run testng/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestByteArrayAsShort
- * @run testng/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestByteArrayAsShort
+ * @run junit/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAsShort
+ * @run junit/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestByteArrayAsShort
+ * @run junit/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestByteArrayAsShort
  */
 
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.EnumSet;
 import java.util.List;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest {
     static final int SIZE = Short.BYTES;
 
@@ -107,7 +107,8 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest {
         }
     }
 
-    @Test(dataProvider = "varHandlesProvider")
+    @ParameterizedTest
+    @MethodSource("VarHandleBaseByteArrayTest#varHandlesProvider")
     public void testIsAccessModeSupported(VarHandleSource vhs) {
         VarHandle vh = vhs.s;
 
@@ -158,17 +159,16 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest {
             assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE));
     }
 
-    @Test(dataProvider = "typesProvider")
+    @ParameterizedTest
+    @MethodSource("typesProvider")
     public void testTypes(VarHandle vh, List> pts) {
-        assertEquals(vh.varType(), short.class);
+        assertEquals(short.class, vh.varType());
 
-        assertEquals(vh.coordinateTypes(), pts);
+        assertEquals(pts, vh.coordinateTypes());
 
         testTypes(vh);
     }
 
-
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -230,7 +230,8 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -239,7 +240,6 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest {
         }
     }
 
-
     static void testArrayNPE(ByteArraySource bs, VarHandleSource vhs) {
         VarHandle vh = vhs.s;
         byte[] array = null;
@@ -740,7 +740,7 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest {
             {
                 vh.set(array, i, VALUE_1);
                 short x = (short) vh.get(array, i);
-                assertEquals(x, VALUE_1, "get short value");
+                assertEquals(VALUE_1, x, "get short value");
             }
         }
     }
@@ -759,7 +759,7 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest {
             {
                 vh.set(array, i, VALUE_1);
                 short x = (short) vh.get(array, i);
-                assertEquals(x, VALUE_1, "get short value");
+                assertEquals(VALUE_1, x, "get short value");
             }
 
             if (iAligned) {
@@ -767,21 +767,21 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest {
                 {
                     vh.setVolatile(array, i, VALUE_2);
                     short x = (short) vh.getVolatile(array, i);
-                    assertEquals(x, VALUE_2, "setVolatile short value");
+                    assertEquals(VALUE_2, x, "setVolatile short value");
                 }
 
                 // Lazy
                 {
                     vh.setRelease(array, i, VALUE_1);
                     short x = (short) vh.getAcquire(array, i);
-                    assertEquals(x, VALUE_1, "setRelease short value");
+                    assertEquals(VALUE_1, x, "setRelease short value");
                 }
 
                 // Opaque
                 {
                     vh.setOpaque(array, i, VALUE_2);
                     short x = (short) vh.getOpaque(array, i);
-                    assertEquals(x, VALUE_2, "setOpaque short value");
+                    assertEquals(VALUE_2, x, "setOpaque short value");
                 }
 
 
@@ -807,26 +807,26 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest {
             // Plain
             {
                 short x = (short) vh.get(array, i);
-                assertEquals(x, v, "get short value");
+                assertEquals(v, x, "get short value");
             }
 
             if (iAligned) {
                 // Volatile
                 {
                     short x = (short) vh.getVolatile(array, i);
-                    assertEquals(x, v, "getVolatile short value");
+                    assertEquals(v, x, "getVolatile short value");
                 }
 
                 // Lazy
                 {
                     short x = (short) vh.getAcquire(array, i);
-                    assertEquals(x, v, "getRelease short value");
+                    assertEquals(v, x, "getRelease short value");
                 }
 
                 // Opaque
                 {
                     short x = (short) vh.getOpaque(array, i);
-                    assertEquals(x, v, "getOpaque short value");
+                    assertEquals(v, x, "getOpaque short value");
                 }
             }
         }
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestExact.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestExact.java
index fc706815bce..9960e08a0c7 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestExact.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestExact.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,20 +26,20 @@
  * @modules java.base/jdk.internal.access.foreign
  * @modules java.base/jdk.internal.foreign.layout
  *
- * @run testng/othervm -Xverify:all
+ * @run junit/othervm -Xverify:all
  *   -Djdk.internal.foreign.SHOULD_ADAPT_HANDLES=false
  *   VarHandleTestExact
- * @run testng/othervm -Xverify:all
+ * @run junit/othervm -Xverify:all
  *   -Djdk.internal.foreign.SHOULD_ADAPT_HANDLES=false
  *   -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=true
  *   -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true
  *   VarHandleTestExact
- * @run testng/othervm -Xverify:all
+ * @run junit/othervm -Xverify:all
  *   -Djdk.internal.foreign.SHOULD_ADAPT_HANDLES=false
  *   -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false
  *   -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=false
  *   VarHandleTestExact
- * @run testng/othervm -Xverify:all
+ * @run junit/othervm -Xverify:all
  *   -Djdk.internal.foreign.SHOULD_ADAPT_HANDLES=false
  *   -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false
  *   -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true
@@ -50,9 +50,6 @@ import java.lang.foreign.Arena;
 import java.lang.foreign.MemorySegment;
 
 import jdk.internal.foreign.layout.ValueLayouts;
-import org.testng.SkipException;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
 
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
@@ -64,8 +61,13 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.function.Consumer;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Assumptions;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestExact {
 
     private static class Widget {
@@ -90,12 +92,13 @@ public class VarHandleTestExact {
         final Long aLongField_RO = 1234L;
     }
 
-    @Test(dataProvider = "dataObjectAccess")
+    @ParameterizedTest
+    @MethodSource("dataObjectAccess")
     public void testExactSet(String fieldBaseName, Class fieldType, boolean ro, Object testValue,
                              SetX setter, GetX getter,
                              SetStaticX staticSetter, GetStaticX staticGetter)
             throws NoSuchFieldException, IllegalAccessException {
-        if (ro) throw new SkipException("Can not test setter with read only field");
+        Assumptions.assumeFalse(ro, "Can not test setter with read only field");
         VarHandle vh = MethodHandles.lookup().findVarHandle(Widget.class, fieldBaseName + "_RW", fieldType);
         Widget w = new Widget();
 
@@ -105,7 +108,8 @@ public class VarHandleTestExact {
             ".*\\Qhandle's method type (Widget," + fieldType.getSimpleName() + ")void \\E.*");
     }
 
-    @Test(dataProvider = "dataObjectAccess")
+    @ParameterizedTest
+    @MethodSource("dataObjectAccess")
     public void testExactGet(String fieldBaseName, Class fieldType, boolean ro, Object testValue,
                              SetX setter, GetX getter,
                              SetStaticX staticSetter, GetStaticX staticGetter)
@@ -119,12 +123,13 @@ public class VarHandleTestExact {
             ".*\\Qhandle's method type (Widget)" + fieldType.getSimpleName() + " \\E.*");
     }
 
-    @Test(dataProvider = "dataObjectAccess")
+    @ParameterizedTest
+    @MethodSource("dataObjectAccess")
     public void testExactSetStatic(String fieldBaseName, Class fieldType, boolean ro, Object testValue,
                                    SetX setter, GetX getter,
                                    SetStaticX staticSetter, GetStaticX staticGetter)
             throws NoSuchFieldException, IllegalAccessException {
-        if (ro) throw new SkipException("Can not test setter with read only field");
+        Assumptions.assumeFalse(ro, "Can not test setter with read only field");
         VarHandle vh = MethodHandles.lookup().findStaticVarHandle(Widget.class, fieldBaseName + "_SRW", fieldType);
 
         doTest(vh,
@@ -133,7 +138,8 @@ public class VarHandleTestExact {
             ".*\\Qhandle's method type (" + fieldType.getSimpleName() + ")void \\E.*");
     }
 
-    @Test(dataProvider = "dataObjectAccess")
+    @ParameterizedTest
+    @MethodSource("dataObjectAccess")
     public void testExactGetStatic(String fieldBaseName, Class fieldType, boolean ro, Object testValue,
                                    SetX setter, GetX getter,
                                    SetStaticX staticSetter, GetStaticX staticGetter)
@@ -146,7 +152,8 @@ public class VarHandleTestExact {
             ".*\\Qhandle's method type ()" + fieldType.getSimpleName() + " \\E.*");
     }
 
-    @Test(dataProvider = "dataSetArray")
+    @ParameterizedTest
+    @MethodSource("dataSetArray")
     public void testExactArraySet(Class arrayClass, Object testValue, SetArrayX setter) {
         VarHandle vh = MethodHandles.arrayElementVarHandle(arrayClass);
         Object arr = Array.newInstance(arrayClass.componentType(), 1);
@@ -157,7 +164,8 @@ public class VarHandleTestExact {
             ".*\\Qhandle's method type (" + arrayClass.getSimpleName() + ",int," + arrayClass.componentType().getSimpleName() + ")void \\E.*");
     }
 
-    @Test(dataProvider = "dataSetBuffer")
+    @ParameterizedTest
+    @MethodSource("dataSetBuffer")
     public void testExactBufferSet(Class arrayClass, Object testValue, SetBufferX setter) {
         VarHandle vh = MethodHandles.byteBufferViewVarHandle(arrayClass, ByteOrder.nativeOrder());
         ByteBuffer buff = ByteBuffer.allocateDirect(8);
@@ -168,7 +176,8 @@ public class VarHandleTestExact {
             ".*\\Qhandle's method type (ByteBuffer,int," + arrayClass.componentType().getSimpleName() + ")void \\E.*");
     }
 
-    @Test(dataProvider = "dataSetMemorySegment")
+    @ParameterizedTest
+    @MethodSource("dataSetMemorySegment")
     public void testExactSegmentSet(Class carrier, Object testValue, SetSegmentX setter) {
         VarHandle vh = ValueLayouts.valueLayout(carrier, ByteOrder.nativeOrder()).varHandle();
         try (Arena arena = Arena.ofConfined()) {
@@ -265,7 +274,6 @@ public class VarHandleTestExact {
         cases.add(new Object[] { carrier, testValue, setter });
     }
 
-    @DataProvider
     public static Object[][] dataObjectAccess() {
         List cases = new ArrayList<>();
 
@@ -334,7 +342,6 @@ public class VarHandleTestExact {
         return cases.toArray(Object[][]::new);
     }
 
-    @DataProvider
     public static Object[][] dataSetArray() {
         List cases = new ArrayList<>();
 
@@ -355,7 +362,6 @@ public class VarHandleTestExact {
         return cases.toArray(Object[][]::new);
     }
 
-    @DataProvider
     public static Object[][] dataSetBuffer() {
         List cases = new ArrayList<>();
 
@@ -373,7 +379,6 @@ public class VarHandleTestExact {
         return cases.toArray(Object[][]::new);
     }
 
-    @DataProvider
     public static Object[][] dataSetMemorySegment() {
         List cases = new ArrayList<>();
 
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java
index 14d5c05d3b8..6540693a906 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,22 +25,22 @@
  * @test
  * @comment Set CompileThresholdScaling to 0.1 so that the warmup loop sets to 2000 iterations
  *          to hit compilation thresholds
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 VarHandleTestMethodHandleAccessBoolean
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 VarHandleTestMethodHandleAccessBoolean
  */
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
     static final boolean static_final_v = true;
 
@@ -60,7 +60,7 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
 
     VarHandle vhArray;
 
-    @BeforeClass
+    @BeforeAll
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
                 VarHandleTestMethodHandleAccessBoolean.class, "final_v", boolean.class);
@@ -77,8 +77,6 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
         vhArray = MethodHandles.arrayElementVarHandle(boolean[].class);
     }
 
-
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -111,7 +109,8 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -120,13 +119,12 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
         }
     }
 
-
     static void testInstanceField(VarHandleTestMethodHandleAccessBoolean recv, Handles hs) throws Throwable {
         // Plain
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, true);
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, true, "set boolean value");
+            assertEquals(true, x, "set boolean value");
         }
 
 
@@ -134,21 +132,21 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
         {
             hs.get(TestAccessMode.SET_VOLATILE).invokeExact(recv, false);
             boolean x = (boolean) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(recv);
-            assertEquals(x, false, "setVolatile boolean value");
+            assertEquals(false, x, "setVolatile boolean value");
         }
 
         // Lazy
         {
             hs.get(TestAccessMode.SET_RELEASE).invokeExact(recv, true);
             boolean x = (boolean) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(recv);
-            assertEquals(x, true, "setRelease boolean value");
+            assertEquals(true, x, "setRelease boolean value");
         }
 
         // Opaque
         {
             hs.get(TestAccessMode.SET_OPAQUE).invokeExact(recv, false);
             boolean x = (boolean) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(recv);
-            assertEquals(x, false, "setOpaque boolean value");
+            assertEquals(false, x, "setOpaque boolean value");
         }
 
         hs.get(TestAccessMode.SET).invokeExact(recv, true);
@@ -158,56 +156,56 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, true, false);
             assertEquals(r, true, "success compareAndSet boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, false, "success compareAndSet boolean value");
+            assertEquals(false, x, "success compareAndSet boolean value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, true, false);
             assertEquals(r, false, "failing compareAndSet boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, false, "failing compareAndSet boolean value");
+            assertEquals(false, x, "failing compareAndSet boolean value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(recv, false, true);
             assertEquals(r, false, "success compareAndExchange boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, true, "success compareAndExchange boolean value");
+            assertEquals(true, x, "success compareAndExchange boolean value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(recv, false, false);
             assertEquals(r, true, "failing compareAndExchange boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, true, "failing compareAndExchange boolean value");
+            assertEquals(true, x, "failing compareAndExchange boolean value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, true, false);
             assertEquals(r, true, "success compareAndExchangeAcquire boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, false, "success compareAndExchangeAcquire boolean value");
+            assertEquals(false, x, "success compareAndExchangeAcquire boolean value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, true, false);
             assertEquals(r, false, "failing compareAndExchangeAcquire boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, false, "failing compareAndExchangeAcquire boolean value");
+            assertEquals(false, x, "failing compareAndExchangeAcquire boolean value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, false, true);
             assertEquals(r, false, "success compareAndExchangeRelease boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, true, "success compareAndExchangeRelease boolean value");
+            assertEquals(true, x, "success compareAndExchangeRelease boolean value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, false, false);
             assertEquals(r, true, "failing compareAndExchangeRelease boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, true, "failing compareAndExchangeRelease boolean value");
+            assertEquals(true, x, "failing compareAndExchangeRelease boolean value");
         }
 
         {
@@ -219,14 +217,14 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, false, "success weakCompareAndSetPlain boolean value");
+            assertEquals(false, x, "success weakCompareAndSetPlain boolean value");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, true, false);
             assertEquals(success, false, "failing weakCompareAndSetPlain boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, false, "failing weakCompareAndSetPlain boolean value");
+            assertEquals(false, x, "failing weakCompareAndSetPlain boolean value");
         }
 
         {
@@ -238,14 +236,14 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, true, "success weakCompareAndSetAcquire boolean");
+            assertEquals(true, x, "success weakCompareAndSetAcquire boolean");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, false, false);
             assertEquals(success, false, "failing weakCompareAndSetAcquire boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, true, "failing weakCompareAndSetAcquire boolean value");
+            assertEquals(true, x, "failing weakCompareAndSetAcquire boolean value");
         }
 
         {
@@ -257,14 +255,14 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, false, "success weakCompareAndSetRelease boolean");
+            assertEquals(false, x, "success weakCompareAndSetRelease boolean");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, true, false);
             assertEquals(success, false, "failing weakCompareAndSetRelease boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, false, "failing weakCompareAndSetRelease boolean value");
+            assertEquals(false, x, "failing weakCompareAndSetRelease boolean value");
         }
 
         {
@@ -276,22 +274,22 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, true, "success weakCompareAndSet boolean");
+            assertEquals(true, x, "success weakCompareAndSet boolean");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, false, false);
             assertEquals(success, false, "failing weakCompareAndSet boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, true, "failing weakCompareAndSet boolean value");
+            assertEquals(true, x, "failing weakCompareAndSet boolean value");
         }
 
         // Compare set and get
         {
             boolean o = (boolean) hs.get(TestAccessMode.GET_AND_SET).invokeExact(recv, false);
-            assertEquals(o, true, "getAndSet boolean");
+            assertEquals(true, o, "getAndSet boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, false, "getAndSet boolean value");
+            assertEquals(false, x, "getAndSet boolean value");
         }
 
 
@@ -300,27 +298,27 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(recv, true);
 
             boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(recv, false);
-            assertEquals(o, true, "getAndBitwiseOr boolean");
+            assertEquals(true, o, "getAndBitwiseOr boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (boolean)(true | false), "getAndBitwiseOr boolean value");
+            assertEquals((boolean)(true | false), x, "getAndBitwiseOr boolean value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, true);
 
             boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(recv, false);
-            assertEquals(o, true, "getAndBitwiseOrAcquire boolean");
+            assertEquals(true, o, "getAndBitwiseOrAcquire boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (boolean)(true | false), "getAndBitwiseOrAcquire boolean value");
+            assertEquals((boolean)(true | false), x, "getAndBitwiseOrAcquire boolean value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, true);
 
             boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(recv, false);
-            assertEquals(o, true, "getAndBitwiseOrRelease boolean");
+            assertEquals(true, o, "getAndBitwiseOrRelease boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (boolean)(true | false), "getAndBitwiseOrRelease boolean value");
+            assertEquals((boolean)(true | false), x, "getAndBitwiseOrRelease boolean value");
         }
 
         // get and bitwise and
@@ -328,27 +326,27 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(recv, true);
 
             boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(recv, false);
-            assertEquals(o, true, "getAndBitwiseAnd boolean");
+            assertEquals(true, o, "getAndBitwiseAnd boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (boolean)(true & false), "getAndBitwiseAnd boolean value");
+            assertEquals((boolean)(true & false), x, "getAndBitwiseAnd boolean value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, true);
 
             boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(recv, false);
-            assertEquals(o, true, "getAndBitwiseAndAcquire boolean");
+            assertEquals(true, o, "getAndBitwiseAndAcquire boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (boolean)(true & false), "getAndBitwiseAndAcquire boolean value");
+            assertEquals((boolean)(true & false), x, "getAndBitwiseAndAcquire boolean value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, true);
 
             boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(recv, false);
-            assertEquals(o, true, "getAndBitwiseAndRelease boolean");
+            assertEquals(true, o, "getAndBitwiseAndRelease boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (boolean)(true & false), "getAndBitwiseAndRelease boolean value");
+            assertEquals((boolean)(true & false), x, "getAndBitwiseAndRelease boolean value");
         }
 
         // get and bitwise xor
@@ -356,27 +354,27 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(recv, true);
 
             boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(recv, false);
-            assertEquals(o, true, "getAndBitwiseXor boolean");
+            assertEquals(true, o, "getAndBitwiseXor boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXor boolean value");
+            assertEquals((boolean)(true ^ false), x, "getAndBitwiseXor boolean value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, true);
 
             boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(recv, false);
-            assertEquals(o, true, "getAndBitwiseXorAcquire boolean");
+            assertEquals(true, o, "getAndBitwiseXorAcquire boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorAcquire boolean value");
+            assertEquals((boolean)(true ^ false), x, "getAndBitwiseXorAcquire boolean value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, true);
 
             boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(recv, false);
-            assertEquals(o, true, "getAndBitwiseXorRelease boolean");
+            assertEquals(true, o, "getAndBitwiseXorRelease boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorRelease boolean value");
+            assertEquals((boolean)(true ^ false), x, "getAndBitwiseXorRelease boolean value");
         }
     }
 
@@ -396,7 +394,7 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
         {
             hs.get(TestAccessMode.SET).invokeExact(true);
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, true, "set boolean value");
+            assertEquals(true, x, "set boolean value");
         }
 
 
@@ -404,21 +402,21 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
         {
             hs.get(TestAccessMode.SET_VOLATILE).invokeExact(false);
             boolean x = (boolean) hs.get(TestAccessMode.GET_VOLATILE).invokeExact();
-            assertEquals(x, false, "setVolatile boolean value");
+            assertEquals(false, x, "setVolatile boolean value");
         }
 
         // Lazy
         {
             hs.get(TestAccessMode.SET_RELEASE).invokeExact(true);
             boolean x = (boolean) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact();
-            assertEquals(x, true, "setRelease boolean value");
+            assertEquals(true, x, "setRelease boolean value");
         }
 
         // Opaque
         {
             hs.get(TestAccessMode.SET_OPAQUE).invokeExact(false);
             boolean x = (boolean) hs.get(TestAccessMode.GET_OPAQUE).invokeExact();
-            assertEquals(x, false, "setOpaque boolean value");
+            assertEquals(false, x, "setOpaque boolean value");
         }
 
         hs.get(TestAccessMode.SET).invokeExact(true);
@@ -428,56 +426,56 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(true, false);
             assertEquals(r, true, "success compareAndSet boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, false, "success compareAndSet boolean value");
+            assertEquals(false, x, "success compareAndSet boolean value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(true, false);
             assertEquals(r, false, "failing compareAndSet boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, false, "failing compareAndSet boolean value");
+            assertEquals(false, x, "failing compareAndSet boolean value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(false, true);
             assertEquals(r, false, "success compareAndExchange boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, true, "success compareAndExchange boolean value");
+            assertEquals(true, x, "success compareAndExchange boolean value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(false, false);
             assertEquals(r, true, "failing compareAndExchange boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, true, "failing compareAndExchange boolean value");
+            assertEquals(true, x, "failing compareAndExchange boolean value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(true, false);
             assertEquals(r, true, "success compareAndExchangeAcquire boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, false, "success compareAndExchangeAcquire boolean value");
+            assertEquals(false, x, "success compareAndExchangeAcquire boolean value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(true, false);
             assertEquals(r, false, "failing compareAndExchangeAcquire boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, false, "failing compareAndExchangeAcquire boolean value");
+            assertEquals(false, x, "failing compareAndExchangeAcquire boolean value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(false, true);
             assertEquals(r, false, "success compareAndExchangeRelease boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, true, "success compareAndExchangeRelease boolean value");
+            assertEquals(true, x, "success compareAndExchangeRelease boolean value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(false, false);
             assertEquals(r, true, "failing compareAndExchangeRelease boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, true, "failing compareAndExchangeRelease boolean value");
+            assertEquals(true, x, "failing compareAndExchangeRelease boolean value");
         }
 
         {
@@ -489,14 +487,14 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, false, "success weakCompareAndSetPlain boolean value");
+            assertEquals(false, x, "success weakCompareAndSetPlain boolean value");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(true, false);
             assertEquals(success, false, "failing weakCompareAndSetPlain boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, false, "failing weakCompareAndSetPlain boolean value");
+            assertEquals(false, x, "failing weakCompareAndSetPlain boolean value");
         }
 
         {
@@ -508,7 +506,7 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, true, "success weakCompareAndSetAcquire boolean");
+            assertEquals(true, x, "success weakCompareAndSetAcquire boolean");
         }
 
         {
@@ -516,7 +514,7 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
             boolean success = (boolean) mh.invokeExact(false, false);
             assertEquals(success, false, "failing weakCompareAndSetAcquire boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, true, "failing weakCompareAndSetAcquire boolean value");
+            assertEquals(true, x, "failing weakCompareAndSetAcquire boolean value");
         }
 
         {
@@ -528,14 +526,14 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, false, "success weakCompareAndSetRelease boolean");
+            assertEquals(false, x, "success weakCompareAndSetRelease boolean");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(true, false);
             assertEquals(success, false, "failing weakCompareAndSetRelease boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, false, "failing weakCompareAndSetRelease boolean value");
+            assertEquals(false, x, "failing weakCompareAndSetRelease boolean value");
         }
 
         {
@@ -547,14 +545,14 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, true, "success weakCompareAndSet boolean");
+            assertEquals(true, x, "success weakCompareAndSet boolean");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(false, false);
             assertEquals(success, false, "failing weakCompareAndSet boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, true, "failing weakCompareAndSetRe boolean value");
+            assertEquals(true, x, "failing weakCompareAndSetRe boolean value");
         }
 
         // Compare set and get
@@ -562,9 +560,9 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(true);
 
             boolean o = (boolean) hs.get(TestAccessMode.GET_AND_SET).invokeExact(false);
-            assertEquals(o, true, "getAndSet boolean");
+            assertEquals(true, o, "getAndSet boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, false, "getAndSet boolean value");
+            assertEquals(false, x, "getAndSet boolean value");
         }
 
         // Compare set and get
@@ -572,9 +570,9 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(true);
 
             boolean o = (boolean) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(false);
-            assertEquals(o, true, "getAndSetAcquire boolean");
+            assertEquals(true, o, "getAndSetAcquire boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, false, "getAndSetAcquire boolean value");
+            assertEquals(false, x, "getAndSetAcquire boolean value");
         }
 
         // Compare set and get
@@ -582,9 +580,9 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(true);
 
             boolean o = (boolean) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(false);
-            assertEquals(o, true, "getAndSetRelease boolean");
+            assertEquals(true, o, "getAndSetRelease boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, false, "getAndSetRelease boolean value");
+            assertEquals(false, x, "getAndSetRelease boolean value");
         }
 
 
@@ -593,27 +591,27 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(true);
 
             boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(false);
-            assertEquals(o, true, "getAndBitwiseOr boolean");
+            assertEquals(true, o, "getAndBitwiseOr boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (boolean)(true | false), "getAndBitwiseOr boolean value");
+            assertEquals((boolean)(true | false), x, "getAndBitwiseOr boolean value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(true);
 
             boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(false);
-            assertEquals(o, true, "getAndBitwiseOrAcquire boolean");
+            assertEquals(true, o, "getAndBitwiseOrAcquire boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (boolean)(true | false), "getAndBitwiseOrAcquire boolean value");
+            assertEquals((boolean)(true | false), x, "getAndBitwiseOrAcquire boolean value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(true);
 
             boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(false);
-            assertEquals(o, true, "getAndBitwiseOrRelease boolean");
+            assertEquals(true, o, "getAndBitwiseOrRelease boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (boolean)(true | false), "getAndBitwiseOrRelease boolean value");
+            assertEquals((boolean)(true | false), x, "getAndBitwiseOrRelease boolean value");
         }
 
         // get and bitwise and
@@ -621,27 +619,27 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(true);
 
             boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(false);
-            assertEquals(o, true, "getAndBitwiseAnd boolean");
+            assertEquals(true, o, "getAndBitwiseAnd boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (boolean)(true & false), "getAndBitwiseAnd boolean value");
+            assertEquals((boolean)(true & false), x, "getAndBitwiseAnd boolean value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(true);
 
             boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(false);
-            assertEquals(o, true, "getAndBitwiseAndAcquire boolean");
+            assertEquals(true, o, "getAndBitwiseAndAcquire boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (boolean)(true & false), "getAndBitwiseAndAcquire boolean value");
+            assertEquals((boolean)(true & false), x, "getAndBitwiseAndAcquire boolean value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(true);
 
             boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(false);
-            assertEquals(o, true, "getAndBitwiseAndRelease boolean");
+            assertEquals(true, o, "getAndBitwiseAndRelease boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (boolean)(true & false), "getAndBitwiseAndRelease boolean value");
+            assertEquals((boolean)(true & false), x, "getAndBitwiseAndRelease boolean value");
         }
 
         // get and bitwise xor
@@ -649,27 +647,27 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(true);
 
             boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(false);
-            assertEquals(o, true, "getAndBitwiseXor boolean");
+            assertEquals(true, o, "getAndBitwiseXor boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXor boolean value");
+            assertEquals((boolean)(true ^ false), x, "getAndBitwiseXor boolean value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(true);
 
             boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(false);
-            assertEquals(o, true, "getAndBitwiseXorAcquire boolean");
+            assertEquals(true, o, "getAndBitwiseXorAcquire boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorAcquire boolean value");
+            assertEquals((boolean)(true ^ false), x, "getAndBitwiseXorAcquire boolean value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(true);
 
             boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(false);
-            assertEquals(o, true, "getAndBitwiseXorRelease boolean");
+            assertEquals(true, o, "getAndBitwiseXorRelease boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorRelease boolean value");
+            assertEquals((boolean)(true ^ false), x, "getAndBitwiseXorRelease boolean value");
         }
     }
 
@@ -692,7 +690,7 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, true);
                 boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, true, "get boolean value");
+                assertEquals(true, x, "get boolean value");
             }
 
 
@@ -700,21 +698,21 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
             {
                 hs.get(TestAccessMode.SET_VOLATILE).invokeExact(array, i, false);
                 boolean x = (boolean) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(array, i);
-                assertEquals(x, false, "setVolatile boolean value");
+                assertEquals(false, x, "setVolatile boolean value");
             }
 
             // Lazy
             {
                 hs.get(TestAccessMode.SET_RELEASE).invokeExact(array, i, true);
                 boolean x = (boolean) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(array, i);
-                assertEquals(x, true, "setRelease boolean value");
+                assertEquals(true, x, "setRelease boolean value");
             }
 
             // Opaque
             {
                 hs.get(TestAccessMode.SET_OPAQUE).invokeExact(array, i, false);
                 boolean x = (boolean) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(array, i);
-                assertEquals(x, false, "setOpaque boolean value");
+                assertEquals(false, x, "setOpaque boolean value");
             }
 
             hs.get(TestAccessMode.SET).invokeExact(array, i, true);
@@ -724,56 +722,56 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
                 boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, true, false);
                 assertEquals(r, true, "success compareAndSet boolean");
                 boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, false, "success compareAndSet boolean value");
+                assertEquals(false, x, "success compareAndSet boolean value");
             }
 
             {
                 boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, true, false);
                 assertEquals(r, false, "failing compareAndSet boolean");
                 boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, false, "failing compareAndSet boolean value");
+                assertEquals(false, x, "failing compareAndSet boolean value");
             }
 
             {
                 boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(array, i, false, true);
                 assertEquals(r, false, "success compareAndExchange boolean");
                 boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, true, "success compareAndExchange boolean value");
+                assertEquals(true, x, "success compareAndExchange boolean value");
             }
 
             {
                 boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(array, i, false, false);
                 assertEquals(r, true, "failing compareAndExchange boolean");
                 boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, true, "failing compareAndExchange boolean value");
+                assertEquals(true, x, "failing compareAndExchange boolean value");
             }
 
             {
                 boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, true, false);
                 assertEquals(r, true, "success compareAndExchangeAcquire boolean");
                 boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, false, "success compareAndExchangeAcquire boolean value");
+                assertEquals(false, x, "success compareAndExchangeAcquire boolean value");
             }
 
             {
                 boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, true, false);
                 assertEquals(r, false, "failing compareAndExchangeAcquire boolean");
                 boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, false, "failing compareAndExchangeAcquire boolean value");
+                assertEquals(false, x, "failing compareAndExchangeAcquire boolean value");
             }
 
             {
                 boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, false, true);
                 assertEquals(r, false, "success compareAndExchangeRelease boolean");
                 boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, true, "success compareAndExchangeRelease boolean value");
+                assertEquals(true, x, "success compareAndExchangeRelease boolean value");
             }
 
             {
                 boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, false, false);
                 assertEquals(r, true, "failing compareAndExchangeRelease boolean");
                 boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, true, "failing compareAndExchangeRelease boolean value");
+                assertEquals(true, x, "failing compareAndExchangeRelease boolean value");
             }
 
             {
@@ -785,14 +783,14 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetPlain boolean");
                 boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, false, "success weakCompareAndSetPlain boolean value");
+                assertEquals(false, x, "success weakCompareAndSetPlain boolean value");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, true, false);
                 assertEquals(success, false, "failing weakCompareAndSetPlain boolean");
                 boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, false, "failing weakCompareAndSetPlain boolean value");
+                assertEquals(false, x, "failing weakCompareAndSetPlain boolean value");
             }
 
             {
@@ -804,14 +802,14 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetAcquire boolean");
                 boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, true, "success weakCompareAndSetAcquire boolean");
+                assertEquals(true, x, "success weakCompareAndSetAcquire boolean");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, false, false);
                 assertEquals(success, false, "failing weakCompareAndSetAcquire boolean");
                 boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, true, "failing weakCompareAndSetAcquire boolean value");
+                assertEquals(true, x, "failing weakCompareAndSetAcquire boolean value");
             }
 
             {
@@ -823,14 +821,14 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetRelease boolean");
                 boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, false, "success weakCompareAndSetRelease boolean");
+                assertEquals(false, x, "success weakCompareAndSetRelease boolean");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, true, false);
                 assertEquals(success, false, "failing weakCompareAndSetAcquire boolean");
                 boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, false, "failing weakCompareAndSetAcquire boolean value");
+                assertEquals(false, x, "failing weakCompareAndSetAcquire boolean value");
             }
 
             {
@@ -842,14 +840,14 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSet boolean");
                 boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, true, "success weakCompareAndSet boolean");
+                assertEquals(true, x, "success weakCompareAndSet boolean");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, false, false);
                 assertEquals(success, false, "failing weakCompareAndSet boolean");
                 boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, true, "failing weakCompareAndSet boolean value");
+                assertEquals(true, x, "failing weakCompareAndSet boolean value");
             }
 
             // Compare set and get
@@ -857,27 +855,27 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, true);
 
                 boolean o = (boolean) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, false);
-                assertEquals(o, true, "getAndSet boolean");
+                assertEquals(true, o, "getAndSet boolean");
                 boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, false, "getAndSet boolean value");
+                assertEquals(false, x, "getAndSet boolean value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, true);
 
                 boolean o = (boolean) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, false);
-                assertEquals(o, true, "getAndSetAcquire boolean");
+                assertEquals(true, o, "getAndSetAcquire boolean");
                 boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, false, "getAndSetAcquire boolean value");
+                assertEquals(false, x, "getAndSetAcquire boolean value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, true);
 
                 boolean o = (boolean) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, false);
-                assertEquals(o, true, "getAndSetRelease boolean");
+                assertEquals(true, o, "getAndSetRelease boolean");
                 boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, false, "getAndSetRelease boolean value");
+                assertEquals(false, x, "getAndSetRelease boolean value");
             }
 
 
@@ -886,27 +884,27 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(array, i, true);
 
             boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(array, i, false);
-            assertEquals(o, true, "getAndBitwiseOr boolean");
+            assertEquals(true, o, "getAndBitwiseOr boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (boolean)(true | false), "getAndBitwiseOr boolean value");
+            assertEquals((boolean)(true | false), x, "getAndBitwiseOr boolean value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, true);
 
             boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(array, i, false);
-            assertEquals(o, true, "getAndBitwiseOrAcquire boolean");
+            assertEquals(true, o, "getAndBitwiseOrAcquire boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (boolean)(true | false), "getAndBitwiseOrAcquire boolean value");
+            assertEquals((boolean)(true | false), x, "getAndBitwiseOrAcquire boolean value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, true);
 
             boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(array, i, false);
-            assertEquals(o, true, "getAndBitwiseOrRelease boolean");
+            assertEquals(true, o, "getAndBitwiseOrRelease boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (boolean)(true | false), "getAndBitwiseOrRelease boolean value");
+            assertEquals((boolean)(true | false), x, "getAndBitwiseOrRelease boolean value");
         }
 
         // get and bitwise and
@@ -914,27 +912,27 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(array, i, true);
 
             boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(array, i, false);
-            assertEquals(o, true, "getAndBitwiseAnd boolean");
+            assertEquals(true, o, "getAndBitwiseAnd boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (boolean)(true & false), "getAndBitwiseAnd boolean value");
+            assertEquals((boolean)(true & false), x, "getAndBitwiseAnd boolean value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, true);
 
             boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(array, i, false);
-            assertEquals(o, true, "getAndBitwiseAndAcquire boolean");
+            assertEquals(true, o, "getAndBitwiseAndAcquire boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (boolean)(true & false), "getAndBitwiseAndAcquire boolean value");
+            assertEquals((boolean)(true & false), x, "getAndBitwiseAndAcquire boolean value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, true);
 
             boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(array, i, false);
-            assertEquals(o, true, "getAndBitwiseAndRelease boolean");
+            assertEquals(true, o, "getAndBitwiseAndRelease boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (boolean)(true & false), "getAndBitwiseAndRelease boolean value");
+            assertEquals((boolean)(true & false), x, "getAndBitwiseAndRelease boolean value");
         }
 
         // get and bitwise xor
@@ -942,27 +940,27 @@ public class VarHandleTestMethodHandleAccessBoolean extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(array, i, true);
 
             boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(array, i, false);
-            assertEquals(o, true, "getAndBitwiseXor boolean");
+            assertEquals(true, o, "getAndBitwiseXor boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXor boolean value");
+            assertEquals((boolean)(true ^ false), x, "getAndBitwiseXor boolean value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, true);
 
             boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(array, i, false);
-            assertEquals(o, true, "getAndBitwiseXorAcquire boolean");
+            assertEquals(true, o, "getAndBitwiseXorAcquire boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorAcquire boolean value");
+            assertEquals((boolean)(true ^ false), x, "getAndBitwiseXorAcquire boolean value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, true);
 
             boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(array, i, false);
-            assertEquals(o, true, "getAndBitwiseXorRelease boolean");
+            assertEquals(true, o, "getAndBitwiseXorRelease boolean");
             boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorRelease boolean value");
+            assertEquals((boolean)(true ^ false), x, "getAndBitwiseXorRelease boolean value");
         }
         }
     }
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java
index 5b3eafba63b..6f7f54a57f5 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,22 +25,22 @@
  * @test
  * @comment Set CompileThresholdScaling to 0.1 so that the warmup loop sets to 2000 iterations
  *          to hit compilation thresholds
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 VarHandleTestMethodHandleAccessByte
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 VarHandleTestMethodHandleAccessByte
  */
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
     static final byte static_final_v = (byte)0x01;
 
@@ -60,7 +60,7 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
 
     VarHandle vhArray;
 
-    @BeforeClass
+    @BeforeAll
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
                 VarHandleTestMethodHandleAccessByte.class, "final_v", byte.class);
@@ -77,8 +77,6 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
         vhArray = MethodHandles.arrayElementVarHandle(byte[].class);
     }
 
-
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -111,7 +109,8 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -120,13 +119,12 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
         }
     }
 
-
     static void testInstanceField(VarHandleTestMethodHandleAccessByte recv, Handles hs) throws Throwable {
         // Plain
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01);
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (byte)0x01, "set byte value");
+            assertEquals((byte)0x01, x, "set byte value");
         }
 
 
@@ -134,21 +132,21 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
         {
             hs.get(TestAccessMode.SET_VOLATILE).invokeExact(recv, (byte)0x23);
             byte x = (byte) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(recv);
-            assertEquals(x, (byte)0x23, "setVolatile byte value");
+            assertEquals((byte)0x23, x, "setVolatile byte value");
         }
 
         // Lazy
         {
             hs.get(TestAccessMode.SET_RELEASE).invokeExact(recv, (byte)0x01);
             byte x = (byte) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(recv);
-            assertEquals(x, (byte)0x01, "setRelease byte value");
+            assertEquals((byte)0x01, x, "setRelease byte value");
         }
 
         // Opaque
         {
             hs.get(TestAccessMode.SET_OPAQUE).invokeExact(recv, (byte)0x23);
             byte x = (byte) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(recv);
-            assertEquals(x, (byte)0x23, "setOpaque byte value");
+            assertEquals((byte)0x23, x, "setOpaque byte value");
         }
 
         hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01);
@@ -158,56 +156,56 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, (byte)0x01, (byte)0x23);
             assertEquals(r, true, "success compareAndSet byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (byte)0x23, "success compareAndSet byte value");
+            assertEquals((byte)0x23, x, "success compareAndSet byte value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, (byte)0x01, (byte)0x45);
             assertEquals(r, false, "failing compareAndSet byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (byte)0x23, "failing compareAndSet byte value");
+            assertEquals((byte)0x23, x, "failing compareAndSet byte value");
         }
 
         {
             byte r = (byte) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(recv, (byte)0x23, (byte)0x01);
             assertEquals(r, (byte)0x23, "success compareAndExchange byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (byte)0x01, "success compareAndExchange byte value");
+            assertEquals((byte)0x01, x, "success compareAndExchange byte value");
         }
 
         {
             byte r = (byte) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(recv, (byte)0x23, (byte)0x45);
             assertEquals(r, (byte)0x01, "failing compareAndExchange byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (byte)0x01, "failing compareAndExchange byte value");
+            assertEquals((byte)0x01, x, "failing compareAndExchange byte value");
         }
 
         {
             byte r = (byte) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, (byte)0x01, (byte)0x23);
             assertEquals(r, (byte)0x01, "success compareAndExchangeAcquire byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (byte)0x23, "success compareAndExchangeAcquire byte value");
+            assertEquals((byte)0x23, x, "success compareAndExchangeAcquire byte value");
         }
 
         {
             byte r = (byte) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, (byte)0x01, (byte)0x45);
             assertEquals(r, (byte)0x23, "failing compareAndExchangeAcquire byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (byte)0x23, "failing compareAndExchangeAcquire byte value");
+            assertEquals((byte)0x23, x, "failing compareAndExchangeAcquire byte value");
         }
 
         {
             byte r = (byte) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, (byte)0x23, (byte)0x01);
             assertEquals(r, (byte)0x23, "success compareAndExchangeRelease byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (byte)0x01, "success compareAndExchangeRelease byte value");
+            assertEquals((byte)0x01, x, "success compareAndExchangeRelease byte value");
         }
 
         {
             byte r = (byte) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, (byte)0x23, (byte)0x45);
             assertEquals(r, (byte)0x01, "failing compareAndExchangeRelease byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (byte)0x01, "failing compareAndExchangeRelease byte value");
+            assertEquals((byte)0x01, x, "failing compareAndExchangeRelease byte value");
         }
 
         {
@@ -219,14 +217,14 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (byte)0x23, "success weakCompareAndSetPlain byte value");
+            assertEquals((byte)0x23, x, "success weakCompareAndSetPlain byte value");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, (byte)0x01, (byte)0x45);
             assertEquals(success, false, "failing weakCompareAndSetPlain byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (byte)0x23, "failing weakCompareAndSetPlain byte value");
+            assertEquals((byte)0x23, x, "failing weakCompareAndSetPlain byte value");
         }
 
         {
@@ -238,14 +236,14 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (byte)0x01, "success weakCompareAndSetAcquire byte");
+            assertEquals((byte)0x01, x, "success weakCompareAndSetAcquire byte");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, (byte)0x23, (byte)0x45);
             assertEquals(success, false, "failing weakCompareAndSetAcquire byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (byte)0x01, "failing weakCompareAndSetAcquire byte value");
+            assertEquals((byte)0x01, x, "failing weakCompareAndSetAcquire byte value");
         }
 
         {
@@ -257,14 +255,14 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (byte)0x23, "success weakCompareAndSetRelease byte");
+            assertEquals((byte)0x23, x, "success weakCompareAndSetRelease byte");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, (byte)0x01, (byte)0x45);
             assertEquals(success, false, "failing weakCompareAndSetRelease byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (byte)0x23, "failing weakCompareAndSetRelease byte value");
+            assertEquals((byte)0x23, x, "failing weakCompareAndSetRelease byte value");
         }
 
         {
@@ -276,22 +274,22 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (byte)0x01, "success weakCompareAndSet byte");
+            assertEquals((byte)0x01, x, "success weakCompareAndSet byte");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, (byte)0x23, (byte)0x45);
             assertEquals(success, false, "failing weakCompareAndSet byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (byte)0x01, "failing weakCompareAndSet byte value");
+            assertEquals((byte)0x01, x, "failing weakCompareAndSet byte value");
         }
 
         // Compare set and get
         {
             byte o = (byte) hs.get(TestAccessMode.GET_AND_SET).invokeExact(recv, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndSet byte");
+            assertEquals((byte)0x01, o, "getAndSet byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (byte)0x23, "getAndSet byte value");
+            assertEquals((byte)0x23, x, "getAndSet byte value");
         }
 
         // get and add, add and get
@@ -299,27 +297,27 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndAdd byte");
+            assertEquals((byte)0x01, o, "getAndAdd byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAdd byte value");
+            assertEquals((byte)((byte)0x01 + (byte)0x23), x, "getAndAdd byte value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndAddAcquire byte");
+            assertEquals((byte)0x01, o, "getAndAddAcquire byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddAcquire byte value");
+            assertEquals((byte)((byte)0x01 + (byte)0x23), x, "getAndAddAcquire byte value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndAddRelease byte");
+            assertEquals((byte)0x01, o, "getAndAddRelease byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddRelease byte value");
+            assertEquals((byte)((byte)0x01 + (byte)0x23), x, "getAndAddRelease byte value");
         }
 
         // get and bitwise or
@@ -327,27 +325,27 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(recv, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseOr byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseOr byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOr byte value");
+            assertEquals((byte)((byte)0x01 | (byte)0x23), x, "getAndBitwiseOr byte value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(recv, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseOrAcquire byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseOrAcquire byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrAcquire byte value");
+            assertEquals((byte)((byte)0x01 | (byte)0x23), x, "getAndBitwiseOrAcquire byte value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(recv, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseOrRelease byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseOrRelease byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrRelease byte value");
+            assertEquals((byte)((byte)0x01 | (byte)0x23), x, "getAndBitwiseOrRelease byte value");
         }
 
         // get and bitwise and
@@ -355,27 +353,27 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(recv, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseAnd byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseAnd byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAnd byte value");
+            assertEquals((byte)((byte)0x01 & (byte)0x23), x, "getAndBitwiseAnd byte value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(recv, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseAndAcquire byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseAndAcquire byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndAcquire byte value");
+            assertEquals((byte)((byte)0x01 & (byte)0x23), x, "getAndBitwiseAndAcquire byte value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(recv, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseAndRelease byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseAndRelease byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndRelease byte value");
+            assertEquals((byte)((byte)0x01 & (byte)0x23), x, "getAndBitwiseAndRelease byte value");
         }
 
         // get and bitwise xor
@@ -383,27 +381,27 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(recv, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseXor byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseXor byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXor byte value");
+            assertEquals((byte)((byte)0x01 ^ (byte)0x23), x, "getAndBitwiseXor byte value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(recv, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseXorAcquire byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseXorAcquire byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorAcquire byte value");
+            assertEquals((byte)((byte)0x01 ^ (byte)0x23), x, "getAndBitwiseXorAcquire byte value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(recv, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseXorRelease byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseXorRelease byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorRelease byte value");
+            assertEquals((byte)((byte)0x01 ^ (byte)0x23), x, "getAndBitwiseXorRelease byte value");
         }
     }
 
@@ -418,7 +416,7 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
         {
             hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)0x01, "set byte value");
+            assertEquals((byte)0x01, x, "set byte value");
         }
 
 
@@ -426,21 +424,21 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
         {
             hs.get(TestAccessMode.SET_VOLATILE).invokeExact((byte)0x23);
             byte x = (byte) hs.get(TestAccessMode.GET_VOLATILE).invokeExact();
-            assertEquals(x, (byte)0x23, "setVolatile byte value");
+            assertEquals((byte)0x23, x, "setVolatile byte value");
         }
 
         // Lazy
         {
             hs.get(TestAccessMode.SET_RELEASE).invokeExact((byte)0x01);
             byte x = (byte) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact();
-            assertEquals(x, (byte)0x01, "setRelease byte value");
+            assertEquals((byte)0x01, x, "setRelease byte value");
         }
 
         // Opaque
         {
             hs.get(TestAccessMode.SET_OPAQUE).invokeExact((byte)0x23);
             byte x = (byte) hs.get(TestAccessMode.GET_OPAQUE).invokeExact();
-            assertEquals(x, (byte)0x23, "setOpaque byte value");
+            assertEquals((byte)0x23, x, "setOpaque byte value");
         }
 
         hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
@@ -450,56 +448,56 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact((byte)0x01, (byte)0x23);
             assertEquals(r, true, "success compareAndSet byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)0x23, "success compareAndSet byte value");
+            assertEquals((byte)0x23, x, "success compareAndSet byte value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact((byte)0x01, (byte)0x45);
             assertEquals(r, false, "failing compareAndSet byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)0x23, "failing compareAndSet byte value");
+            assertEquals((byte)0x23, x, "failing compareAndSet byte value");
         }
 
         {
             byte r = (byte) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact((byte)0x23, (byte)0x01);
             assertEquals(r, (byte)0x23, "success compareAndExchange byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)0x01, "success compareAndExchange byte value");
+            assertEquals((byte)0x01, x, "success compareAndExchange byte value");
         }
 
         {
             byte r = (byte) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact((byte)0x23, (byte)0x45);
             assertEquals(r, (byte)0x01, "failing compareAndExchange byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)0x01, "failing compareAndExchange byte value");
+            assertEquals((byte)0x01, x, "failing compareAndExchange byte value");
         }
 
         {
             byte r = (byte) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact((byte)0x01, (byte)0x23);
             assertEquals(r, (byte)0x01, "success compareAndExchangeAcquire byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)0x23, "success compareAndExchangeAcquire byte value");
+            assertEquals((byte)0x23, x, "success compareAndExchangeAcquire byte value");
         }
 
         {
             byte r = (byte) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact((byte)0x01, (byte)0x45);
             assertEquals(r, (byte)0x23, "failing compareAndExchangeAcquire byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)0x23, "failing compareAndExchangeAcquire byte value");
+            assertEquals((byte)0x23, x, "failing compareAndExchangeAcquire byte value");
         }
 
         {
             byte r = (byte) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact((byte)0x23, (byte)0x01);
             assertEquals(r, (byte)0x23, "success compareAndExchangeRelease byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)0x01, "success compareAndExchangeRelease byte value");
+            assertEquals((byte)0x01, x, "success compareAndExchangeRelease byte value");
         }
 
         {
             byte r = (byte) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact((byte)0x23, (byte)0x45);
             assertEquals(r, (byte)0x01, "failing compareAndExchangeRelease byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)0x01, "failing compareAndExchangeRelease byte value");
+            assertEquals((byte)0x01, x, "failing compareAndExchangeRelease byte value");
         }
 
         {
@@ -511,14 +509,14 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)0x23, "success weakCompareAndSetPlain byte value");
+            assertEquals((byte)0x23, x, "success weakCompareAndSetPlain byte value");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact((byte)0x01, (byte)0x45);
             assertEquals(success, false, "failing weakCompareAndSetPlain byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)0x23, "failing weakCompareAndSetPlain byte value");
+            assertEquals((byte)0x23, x, "failing weakCompareAndSetPlain byte value");
         }
 
         {
@@ -530,7 +528,7 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)0x01, "success weakCompareAndSetAcquire byte");
+            assertEquals((byte)0x01, x, "success weakCompareAndSetAcquire byte");
         }
 
         {
@@ -538,7 +536,7 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
             boolean success = (boolean) mh.invokeExact((byte)0x23, (byte)0x45);
             assertEquals(success, false, "failing weakCompareAndSetAcquire byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)0x01, "failing weakCompareAndSetAcquire byte value");
+            assertEquals((byte)0x01, x, "failing weakCompareAndSetAcquire byte value");
         }
 
         {
@@ -550,14 +548,14 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)0x23, "success weakCompareAndSetRelease byte");
+            assertEquals((byte)0x23, x, "success weakCompareAndSetRelease byte");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact((byte)0x01, (byte)0x45);
             assertEquals(success, false, "failing weakCompareAndSetRelease byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)0x23, "failing weakCompareAndSetRelease byte value");
+            assertEquals((byte)0x23, x, "failing weakCompareAndSetRelease byte value");
         }
 
         {
@@ -569,14 +567,14 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)0x01, "success weakCompareAndSet byte");
+            assertEquals((byte)0x01, x, "success weakCompareAndSet byte");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact((byte)0x23, (byte)0x45);
             assertEquals(success, false, "failing weakCompareAndSet byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)0x01, "failing weakCompareAndSetRe byte value");
+            assertEquals((byte)0x01, x, "failing weakCompareAndSetRe byte value");
         }
 
         // Compare set and get
@@ -584,9 +582,9 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_SET).invokeExact((byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndSet byte");
+            assertEquals((byte)0x01, o, "getAndSet byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)0x23, "getAndSet byte value");
+            assertEquals((byte)0x23, x, "getAndSet byte value");
         }
 
         // Compare set and get
@@ -594,9 +592,9 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact((byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndSetAcquire byte");
+            assertEquals((byte)0x01, o, "getAndSetAcquire byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)0x23, "getAndSetAcquire byte value");
+            assertEquals((byte)0x23, x, "getAndSetAcquire byte value");
         }
 
         // Compare set and get
@@ -604,9 +602,9 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact((byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndSetRelease byte");
+            assertEquals((byte)0x01, o, "getAndSetRelease byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)0x23, "getAndSetRelease byte value");
+            assertEquals((byte)0x23, x, "getAndSetRelease byte value");
         }
 
         // get and add, add and get
@@ -614,27 +612,27 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD).invokeExact((byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndAdd byte");
+            assertEquals((byte)0x01, o, "getAndAdd byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAdd byte value");
+            assertEquals((byte)((byte)0x01 + (byte)0x23), x, "getAndAdd byte value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact((byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndAddAcquire byte");
+            assertEquals((byte)0x01, o, "getAndAddAcquire byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddAcquire byte value");
+            assertEquals((byte)((byte)0x01 + (byte)0x23), x, "getAndAddAcquire byte value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact((byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndAddRelease byte");
+            assertEquals((byte)0x01, o, "getAndAddRelease byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddRelease byte value");
+            assertEquals((byte)((byte)0x01 + (byte)0x23), x, "getAndAddRelease byte value");
         }
 
         // get and bitwise or
@@ -642,27 +640,27 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact((byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseOr byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseOr byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOr byte value");
+            assertEquals((byte)((byte)0x01 | (byte)0x23), x, "getAndBitwiseOr byte value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact((byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseOrAcquire byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseOrAcquire byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrAcquire byte value");
+            assertEquals((byte)((byte)0x01 | (byte)0x23), x, "getAndBitwiseOrAcquire byte value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact((byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseOrRelease byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseOrRelease byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrRelease byte value");
+            assertEquals((byte)((byte)0x01 | (byte)0x23), x, "getAndBitwiseOrRelease byte value");
         }
 
         // get and bitwise and
@@ -670,27 +668,27 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact((byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseAnd byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseAnd byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAnd byte value");
+            assertEquals((byte)((byte)0x01 & (byte)0x23), x, "getAndBitwiseAnd byte value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact((byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseAndAcquire byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseAndAcquire byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndAcquire byte value");
+            assertEquals((byte)((byte)0x01 & (byte)0x23), x, "getAndBitwiseAndAcquire byte value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact((byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseAndRelease byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseAndRelease byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndRelease byte value");
+            assertEquals((byte)((byte)0x01 & (byte)0x23), x, "getAndBitwiseAndRelease byte value");
         }
 
         // get and bitwise xor
@@ -698,27 +696,27 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact((byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseXor byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseXor byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXor byte value");
+            assertEquals((byte)((byte)0x01 ^ (byte)0x23), x, "getAndBitwiseXor byte value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact((byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseXorAcquire byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseXorAcquire byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorAcquire byte value");
+            assertEquals((byte)((byte)0x01 ^ (byte)0x23), x, "getAndBitwiseXorAcquire byte value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact((byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact((byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseXorRelease byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseXorRelease byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorRelease byte value");
+            assertEquals((byte)((byte)0x01 ^ (byte)0x23), x, "getAndBitwiseXorRelease byte value");
         }
     }
 
@@ -736,7 +734,7 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
                 byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (byte)0x01, "get byte value");
+                assertEquals((byte)0x01, x, "get byte value");
             }
 
 
@@ -744,21 +742,21 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
             {
                 hs.get(TestAccessMode.SET_VOLATILE).invokeExact(array, i, (byte)0x23);
                 byte x = (byte) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(array, i);
-                assertEquals(x, (byte)0x23, "setVolatile byte value");
+                assertEquals((byte)0x23, x, "setVolatile byte value");
             }
 
             // Lazy
             {
                 hs.get(TestAccessMode.SET_RELEASE).invokeExact(array, i, (byte)0x01);
                 byte x = (byte) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(array, i);
-                assertEquals(x, (byte)0x01, "setRelease byte value");
+                assertEquals((byte)0x01, x, "setRelease byte value");
             }
 
             // Opaque
             {
                 hs.get(TestAccessMode.SET_OPAQUE).invokeExact(array, i, (byte)0x23);
                 byte x = (byte) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(array, i);
-                assertEquals(x, (byte)0x23, "setOpaque byte value");
+                assertEquals((byte)0x23, x, "setOpaque byte value");
             }
 
             hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
@@ -768,56 +766,56 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
                 boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, (byte)0x01, (byte)0x23);
                 assertEquals(r, true, "success compareAndSet byte");
                 byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (byte)0x23, "success compareAndSet byte value");
+                assertEquals((byte)0x23, x, "success compareAndSet byte value");
             }
 
             {
                 boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, (byte)0x01, (byte)0x45);
                 assertEquals(r, false, "failing compareAndSet byte");
                 byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (byte)0x23, "failing compareAndSet byte value");
+                assertEquals((byte)0x23, x, "failing compareAndSet byte value");
             }
 
             {
                 byte r = (byte) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(array, i, (byte)0x23, (byte)0x01);
                 assertEquals(r, (byte)0x23, "success compareAndExchange byte");
                 byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (byte)0x01, "success compareAndExchange byte value");
+                assertEquals((byte)0x01, x, "success compareAndExchange byte value");
             }
 
             {
                 byte r = (byte) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(array, i, (byte)0x23, (byte)0x45);
                 assertEquals(r, (byte)0x01, "failing compareAndExchange byte");
                 byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (byte)0x01, "failing compareAndExchange byte value");
+                assertEquals((byte)0x01, x, "failing compareAndExchange byte value");
             }
 
             {
                 byte r = (byte) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, (byte)0x01, (byte)0x23);
                 assertEquals(r, (byte)0x01, "success compareAndExchangeAcquire byte");
                 byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (byte)0x23, "success compareAndExchangeAcquire byte value");
+                assertEquals((byte)0x23, x, "success compareAndExchangeAcquire byte value");
             }
 
             {
                 byte r = (byte) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, (byte)0x01, (byte)0x45);
                 assertEquals(r, (byte)0x23, "failing compareAndExchangeAcquire byte");
                 byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (byte)0x23, "failing compareAndExchangeAcquire byte value");
+                assertEquals((byte)0x23, x, "failing compareAndExchangeAcquire byte value");
             }
 
             {
                 byte r = (byte) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, (byte)0x23, (byte)0x01);
                 assertEquals(r, (byte)0x23, "success compareAndExchangeRelease byte");
                 byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (byte)0x01, "success compareAndExchangeRelease byte value");
+                assertEquals((byte)0x01, x, "success compareAndExchangeRelease byte value");
             }
 
             {
                 byte r = (byte) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, (byte)0x23, (byte)0x45);
                 assertEquals(r, (byte)0x01, "failing compareAndExchangeRelease byte");
                 byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (byte)0x01, "failing compareAndExchangeRelease byte value");
+                assertEquals((byte)0x01, x, "failing compareAndExchangeRelease byte value");
             }
 
             {
@@ -829,14 +827,14 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetPlain byte");
                 byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (byte)0x23, "success weakCompareAndSetPlain byte value");
+                assertEquals((byte)0x23, x, "success weakCompareAndSetPlain byte value");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, (byte)0x01, (byte)0x45);
                 assertEquals(success, false, "failing weakCompareAndSetPlain byte");
                 byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (byte)0x23, "failing weakCompareAndSetPlain byte value");
+                assertEquals((byte)0x23, x, "failing weakCompareAndSetPlain byte value");
             }
 
             {
@@ -848,14 +846,14 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetAcquire byte");
                 byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (byte)0x01, "success weakCompareAndSetAcquire byte");
+                assertEquals((byte)0x01, x, "success weakCompareAndSetAcquire byte");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, (byte)0x23, (byte)0x45);
                 assertEquals(success, false, "failing weakCompareAndSetAcquire byte");
                 byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (byte)0x01, "failing weakCompareAndSetAcquire byte value");
+                assertEquals((byte)0x01, x, "failing weakCompareAndSetAcquire byte value");
             }
 
             {
@@ -867,14 +865,14 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetRelease byte");
                 byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (byte)0x23, "success weakCompareAndSetRelease byte");
+                assertEquals((byte)0x23, x, "success weakCompareAndSetRelease byte");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, (byte)0x01, (byte)0x45);
                 assertEquals(success, false, "failing weakCompareAndSetAcquire byte");
                 byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (byte)0x23, "failing weakCompareAndSetAcquire byte value");
+                assertEquals((byte)0x23, x, "failing weakCompareAndSetAcquire byte value");
             }
 
             {
@@ -886,14 +884,14 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSet byte");
                 byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (byte)0x01, "success weakCompareAndSet byte");
+                assertEquals((byte)0x01, x, "success weakCompareAndSet byte");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, (byte)0x23, (byte)0x45);
                 assertEquals(success, false, "failing weakCompareAndSet byte");
                 byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (byte)0x01, "failing weakCompareAndSet byte value");
+                assertEquals((byte)0x01, x, "failing weakCompareAndSet byte value");
             }
 
             // Compare set and get
@@ -901,27 +899,27 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
 
                 byte o = (byte) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, (byte)0x23);
-                assertEquals(o, (byte)0x01, "getAndSet byte");
+                assertEquals((byte)0x01, o, "getAndSet byte");
                 byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (byte)0x23, "getAndSet byte value");
+                assertEquals((byte)0x23, x, "getAndSet byte value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
 
                 byte o = (byte) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, (byte)0x23);
-                assertEquals(o, (byte)0x01, "getAndSetAcquire byte");
+                assertEquals((byte)0x01, o, "getAndSetAcquire byte");
                 byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (byte)0x23, "getAndSetAcquire byte value");
+                assertEquals((byte)0x23, x, "getAndSetAcquire byte value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
 
                 byte o = (byte) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, (byte)0x23);
-                assertEquals(o, (byte)0x01, "getAndSetRelease byte");
+                assertEquals((byte)0x01, o, "getAndSetRelease byte");
                 byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (byte)0x23, "getAndSetRelease byte value");
+                assertEquals((byte)0x23, x, "getAndSetRelease byte value");
             }
 
             // get and add, add and get
@@ -929,27 +927,27 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
 
                 byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, (byte)0x23);
-                assertEquals(o, (byte)0x01, "getAndAdd byte");
+                assertEquals((byte)0x01, o, "getAndAdd byte");
                 byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAdd byte value");
+                assertEquals((byte)((byte)0x01 + (byte)0x23), x, "getAndAdd byte value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
 
                 byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, (byte)0x23);
-                assertEquals(o, (byte)0x01, "getAndAddAcquire byte");
+                assertEquals((byte)0x01, o, "getAndAddAcquire byte");
                 byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddAcquire byte value");
+                assertEquals((byte)((byte)0x01 + (byte)0x23), x, "getAndAddAcquire byte value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
 
                 byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, (byte)0x23);
-                assertEquals(o, (byte)0x01, "getAndAddRelease byte");
+                assertEquals((byte)0x01, o, "getAndAddRelease byte");
                 byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddRelease byte value");
+                assertEquals((byte)((byte)0x01 + (byte)0x23), x, "getAndAddRelease byte value");
             }
 
         // get and bitwise or
@@ -957,27 +955,27 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(array, i, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseOr byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseOr byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOr byte value");
+            assertEquals((byte)((byte)0x01 | (byte)0x23), x, "getAndBitwiseOr byte value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(array, i, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseOrAcquire byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseOrAcquire byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrAcquire byte value");
+            assertEquals((byte)((byte)0x01 | (byte)0x23), x, "getAndBitwiseOrAcquire byte value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(array, i, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseOrRelease byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseOrRelease byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrRelease byte value");
+            assertEquals((byte)((byte)0x01 | (byte)0x23), x, "getAndBitwiseOrRelease byte value");
         }
 
         // get and bitwise and
@@ -985,27 +983,27 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(array, i, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseAnd byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseAnd byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAnd byte value");
+            assertEquals((byte)((byte)0x01 & (byte)0x23), x, "getAndBitwiseAnd byte value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(array, i, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseAndAcquire byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseAndAcquire byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndAcquire byte value");
+            assertEquals((byte)((byte)0x01 & (byte)0x23), x, "getAndBitwiseAndAcquire byte value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(array, i, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseAndRelease byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseAndRelease byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndRelease byte value");
+            assertEquals((byte)((byte)0x01 & (byte)0x23), x, "getAndBitwiseAndRelease byte value");
         }
 
         // get and bitwise xor
@@ -1013,27 +1011,27 @@ public class VarHandleTestMethodHandleAccessByte extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(array, i, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseXor byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseXor byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXor byte value");
+            assertEquals((byte)((byte)0x01 ^ (byte)0x23), x, "getAndBitwiseXor byte value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(array, i, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseXorAcquire byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseXorAcquire byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorAcquire byte value");
+            assertEquals((byte)((byte)0x01 ^ (byte)0x23), x, "getAndBitwiseXorAcquire byte value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01);
 
             byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(array, i, (byte)0x23);
-            assertEquals(o, (byte)0x01, "getAndBitwiseXorRelease byte");
+            assertEquals((byte)0x01, o, "getAndBitwiseXorRelease byte");
             byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorRelease byte value");
+            assertEquals((byte)((byte)0x01 ^ (byte)0x23), x, "getAndBitwiseXorRelease byte value");
         }
         }
     }
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java
index d191b507366..3e31ee282ff 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,22 +25,22 @@
  * @test
  * @comment Set CompileThresholdScaling to 0.1 so that the warmup loop sets to 2000 iterations
  *          to hit compilation thresholds
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 VarHandleTestMethodHandleAccessChar
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 VarHandleTestMethodHandleAccessChar
  */
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
     static final char static_final_v = '\u0123';
 
@@ -60,7 +60,7 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
 
     VarHandle vhArray;
 
-    @BeforeClass
+    @BeforeAll
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
                 VarHandleTestMethodHandleAccessChar.class, "final_v", char.class);
@@ -77,8 +77,6 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
         vhArray = MethodHandles.arrayElementVarHandle(char[].class);
     }
 
-
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -111,7 +109,8 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -120,13 +119,12 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
         }
     }
 
-
     static void testInstanceField(VarHandleTestMethodHandleAccessChar recv, Handles hs) throws Throwable {
         // Plain
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123');
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, '\u0123', "set char value");
+            assertEquals('\u0123', x, "set char value");
         }
 
 
@@ -134,21 +132,21 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
         {
             hs.get(TestAccessMode.SET_VOLATILE).invokeExact(recv, '\u4567');
             char x = (char) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(recv);
-            assertEquals(x, '\u4567', "setVolatile char value");
+            assertEquals('\u4567', x, "setVolatile char value");
         }
 
         // Lazy
         {
             hs.get(TestAccessMode.SET_RELEASE).invokeExact(recv, '\u0123');
             char x = (char) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(recv);
-            assertEquals(x, '\u0123', "setRelease char value");
+            assertEquals('\u0123', x, "setRelease char value");
         }
 
         // Opaque
         {
             hs.get(TestAccessMode.SET_OPAQUE).invokeExact(recv, '\u4567');
             char x = (char) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(recv);
-            assertEquals(x, '\u4567', "setOpaque char value");
+            assertEquals('\u4567', x, "setOpaque char value");
         }
 
         hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123');
@@ -158,56 +156,56 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, '\u0123', '\u4567');
             assertEquals(r, true, "success compareAndSet char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, '\u4567', "success compareAndSet char value");
+            assertEquals('\u4567', x, "success compareAndSet char value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, '\u0123', '\u89AB');
             assertEquals(r, false, "failing compareAndSet char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, '\u4567', "failing compareAndSet char value");
+            assertEquals('\u4567', x, "failing compareAndSet char value");
         }
 
         {
             char r = (char) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(recv, '\u4567', '\u0123');
             assertEquals(r, '\u4567', "success compareAndExchange char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, '\u0123', "success compareAndExchange char value");
+            assertEquals('\u0123', x, "success compareAndExchange char value");
         }
 
         {
             char r = (char) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(recv, '\u4567', '\u89AB');
             assertEquals(r, '\u0123', "failing compareAndExchange char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, '\u0123', "failing compareAndExchange char value");
+            assertEquals('\u0123', x, "failing compareAndExchange char value");
         }
 
         {
             char r = (char) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, '\u0123', '\u4567');
             assertEquals(r, '\u0123', "success compareAndExchangeAcquire char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, '\u4567', "success compareAndExchangeAcquire char value");
+            assertEquals('\u4567', x, "success compareAndExchangeAcquire char value");
         }
 
         {
             char r = (char) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, '\u0123', '\u89AB');
             assertEquals(r, '\u4567', "failing compareAndExchangeAcquire char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, '\u4567', "failing compareAndExchangeAcquire char value");
+            assertEquals('\u4567', x, "failing compareAndExchangeAcquire char value");
         }
 
         {
             char r = (char) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, '\u4567', '\u0123');
             assertEquals(r, '\u4567', "success compareAndExchangeRelease char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, '\u0123', "success compareAndExchangeRelease char value");
+            assertEquals('\u0123', x, "success compareAndExchangeRelease char value");
         }
 
         {
             char r = (char) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, '\u4567', '\u89AB');
             assertEquals(r, '\u0123', "failing compareAndExchangeRelease char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, '\u0123', "failing compareAndExchangeRelease char value");
+            assertEquals('\u0123', x, "failing compareAndExchangeRelease char value");
         }
 
         {
@@ -219,14 +217,14 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, '\u4567', "success weakCompareAndSetPlain char value");
+            assertEquals('\u4567', x, "success weakCompareAndSetPlain char value");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, '\u0123', '\u89AB');
             assertEquals(success, false, "failing weakCompareAndSetPlain char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, '\u4567', "failing weakCompareAndSetPlain char value");
+            assertEquals('\u4567', x, "failing weakCompareAndSetPlain char value");
         }
 
         {
@@ -238,14 +236,14 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, '\u0123', "success weakCompareAndSetAcquire char");
+            assertEquals('\u0123', x, "success weakCompareAndSetAcquire char");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, '\u4567', '\u89AB');
             assertEquals(success, false, "failing weakCompareAndSetAcquire char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, '\u0123', "failing weakCompareAndSetAcquire char value");
+            assertEquals('\u0123', x, "failing weakCompareAndSetAcquire char value");
         }
 
         {
@@ -257,14 +255,14 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, '\u4567', "success weakCompareAndSetRelease char");
+            assertEquals('\u4567', x, "success weakCompareAndSetRelease char");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, '\u0123', '\u89AB');
             assertEquals(success, false, "failing weakCompareAndSetRelease char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, '\u4567', "failing weakCompareAndSetRelease char value");
+            assertEquals('\u4567', x, "failing weakCompareAndSetRelease char value");
         }
 
         {
@@ -276,22 +274,22 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, '\u0123', "success weakCompareAndSet char");
+            assertEquals('\u0123', x, "success weakCompareAndSet char");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, '\u4567', '\u89AB');
             assertEquals(success, false, "failing weakCompareAndSet char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, '\u0123', "failing weakCompareAndSet char value");
+            assertEquals('\u0123', x, "failing weakCompareAndSet char value");
         }
 
         // Compare set and get
         {
             char o = (char) hs.get(TestAccessMode.GET_AND_SET).invokeExact(recv, '\u4567');
-            assertEquals(o, '\u0123', "getAndSet char");
+            assertEquals('\u0123', o, "getAndSet char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, '\u4567', "getAndSet char value");
+            assertEquals('\u4567', x, "getAndSet char value");
         }
 
         // get and add, add and get
@@ -299,27 +297,27 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, '\u4567');
-            assertEquals(o, '\u0123', "getAndAdd char");
+            assertEquals('\u0123', o, "getAndAdd char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAdd char value");
+            assertEquals((char)('\u0123' + '\u4567'), x, "getAndAdd char value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, '\u4567');
-            assertEquals(o, '\u0123', "getAndAddAcquire char");
+            assertEquals('\u0123', o, "getAndAddAcquire char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddAcquire char value");
+            assertEquals((char)('\u0123' + '\u4567'), x, "getAndAddAcquire char value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, '\u4567');
-            assertEquals(o, '\u0123', "getAndAddRelease char");
+            assertEquals('\u0123', o, "getAndAddRelease char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddRelease char value");
+            assertEquals((char)('\u0123' + '\u4567'), x, "getAndAddRelease char value");
         }
 
         // get and bitwise or
@@ -327,27 +325,27 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(recv, '\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseOr char");
+            assertEquals('\u0123', o, "getAndBitwiseOr char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOr char value");
+            assertEquals((char)('\u0123' | '\u4567'), x, "getAndBitwiseOr char value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(recv, '\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseOrAcquire char");
+            assertEquals('\u0123', o, "getAndBitwiseOrAcquire char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrAcquire char value");
+            assertEquals((char)('\u0123' | '\u4567'), x, "getAndBitwiseOrAcquire char value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(recv, '\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseOrRelease char");
+            assertEquals('\u0123', o, "getAndBitwiseOrRelease char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrRelease char value");
+            assertEquals((char)('\u0123' | '\u4567'), x, "getAndBitwiseOrRelease char value");
         }
 
         // get and bitwise and
@@ -355,27 +353,27 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(recv, '\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseAnd char");
+            assertEquals('\u0123', o, "getAndBitwiseAnd char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAnd char value");
+            assertEquals((char)('\u0123' & '\u4567'), x, "getAndBitwiseAnd char value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(recv, '\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseAndAcquire char");
+            assertEquals('\u0123', o, "getAndBitwiseAndAcquire char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndAcquire char value");
+            assertEquals((char)('\u0123' & '\u4567'), x, "getAndBitwiseAndAcquire char value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(recv, '\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseAndRelease char");
+            assertEquals('\u0123', o, "getAndBitwiseAndRelease char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndRelease char value");
+            assertEquals((char)('\u0123' & '\u4567'), x, "getAndBitwiseAndRelease char value");
         }
 
         // get and bitwise xor
@@ -383,27 +381,27 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(recv, '\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseXor char");
+            assertEquals('\u0123', o, "getAndBitwiseXor char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXor char value");
+            assertEquals((char)('\u0123' ^ '\u4567'), x, "getAndBitwiseXor char value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(recv, '\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseXorAcquire char");
+            assertEquals('\u0123', o, "getAndBitwiseXorAcquire char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorAcquire char value");
+            assertEquals((char)('\u0123' ^ '\u4567'), x, "getAndBitwiseXorAcquire char value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(recv, '\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseXorRelease char");
+            assertEquals('\u0123', o, "getAndBitwiseXorRelease char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorRelease char value");
+            assertEquals((char)('\u0123' ^ '\u4567'), x, "getAndBitwiseXorRelease char value");
         }
     }
 
@@ -418,7 +416,7 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
         {
             hs.get(TestAccessMode.SET).invokeExact('\u0123');
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, '\u0123', "set char value");
+            assertEquals('\u0123', x, "set char value");
         }
 
 
@@ -426,21 +424,21 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
         {
             hs.get(TestAccessMode.SET_VOLATILE).invokeExact('\u4567');
             char x = (char) hs.get(TestAccessMode.GET_VOLATILE).invokeExact();
-            assertEquals(x, '\u4567', "setVolatile char value");
+            assertEquals('\u4567', x, "setVolatile char value");
         }
 
         // Lazy
         {
             hs.get(TestAccessMode.SET_RELEASE).invokeExact('\u0123');
             char x = (char) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact();
-            assertEquals(x, '\u0123', "setRelease char value");
+            assertEquals('\u0123', x, "setRelease char value");
         }
 
         // Opaque
         {
             hs.get(TestAccessMode.SET_OPAQUE).invokeExact('\u4567');
             char x = (char) hs.get(TestAccessMode.GET_OPAQUE).invokeExact();
-            assertEquals(x, '\u4567', "setOpaque char value");
+            assertEquals('\u4567', x, "setOpaque char value");
         }
 
         hs.get(TestAccessMode.SET).invokeExact('\u0123');
@@ -450,56 +448,56 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact('\u0123', '\u4567');
             assertEquals(r, true, "success compareAndSet char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, '\u4567', "success compareAndSet char value");
+            assertEquals('\u4567', x, "success compareAndSet char value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact('\u0123', '\u89AB');
             assertEquals(r, false, "failing compareAndSet char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, '\u4567', "failing compareAndSet char value");
+            assertEquals('\u4567', x, "failing compareAndSet char value");
         }
 
         {
             char r = (char) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact('\u4567', '\u0123');
             assertEquals(r, '\u4567', "success compareAndExchange char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, '\u0123', "success compareAndExchange char value");
+            assertEquals('\u0123', x, "success compareAndExchange char value");
         }
 
         {
             char r = (char) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact('\u4567', '\u89AB');
             assertEquals(r, '\u0123', "failing compareAndExchange char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, '\u0123', "failing compareAndExchange char value");
+            assertEquals('\u0123', x, "failing compareAndExchange char value");
         }
 
         {
             char r = (char) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact('\u0123', '\u4567');
             assertEquals(r, '\u0123', "success compareAndExchangeAcquire char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, '\u4567', "success compareAndExchangeAcquire char value");
+            assertEquals('\u4567', x, "success compareAndExchangeAcquire char value");
         }
 
         {
             char r = (char) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact('\u0123', '\u89AB');
             assertEquals(r, '\u4567', "failing compareAndExchangeAcquire char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, '\u4567', "failing compareAndExchangeAcquire char value");
+            assertEquals('\u4567', x, "failing compareAndExchangeAcquire char value");
         }
 
         {
             char r = (char) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact('\u4567', '\u0123');
             assertEquals(r, '\u4567', "success compareAndExchangeRelease char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, '\u0123', "success compareAndExchangeRelease char value");
+            assertEquals('\u0123', x, "success compareAndExchangeRelease char value");
         }
 
         {
             char r = (char) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact('\u4567', '\u89AB');
             assertEquals(r, '\u0123', "failing compareAndExchangeRelease char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, '\u0123', "failing compareAndExchangeRelease char value");
+            assertEquals('\u0123', x, "failing compareAndExchangeRelease char value");
         }
 
         {
@@ -511,14 +509,14 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, '\u4567', "success weakCompareAndSetPlain char value");
+            assertEquals('\u4567', x, "success weakCompareAndSetPlain char value");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact('\u0123', '\u89AB');
             assertEquals(success, false, "failing weakCompareAndSetPlain char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, '\u4567', "failing weakCompareAndSetPlain char value");
+            assertEquals('\u4567', x, "failing weakCompareAndSetPlain char value");
         }
 
         {
@@ -530,7 +528,7 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, '\u0123', "success weakCompareAndSetAcquire char");
+            assertEquals('\u0123', x, "success weakCompareAndSetAcquire char");
         }
 
         {
@@ -538,7 +536,7 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
             boolean success = (boolean) mh.invokeExact('\u4567', '\u89AB');
             assertEquals(success, false, "failing weakCompareAndSetAcquire char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, '\u0123', "failing weakCompareAndSetAcquire char value");
+            assertEquals('\u0123', x, "failing weakCompareAndSetAcquire char value");
         }
 
         {
@@ -550,14 +548,14 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, '\u4567', "success weakCompareAndSetRelease char");
+            assertEquals('\u4567', x, "success weakCompareAndSetRelease char");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact('\u0123', '\u89AB');
             assertEquals(success, false, "failing weakCompareAndSetRelease char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, '\u4567', "failing weakCompareAndSetRelease char value");
+            assertEquals('\u4567', x, "failing weakCompareAndSetRelease char value");
         }
 
         {
@@ -569,14 +567,14 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, '\u0123', "success weakCompareAndSet char");
+            assertEquals('\u0123', x, "success weakCompareAndSet char");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact('\u4567', '\u89AB');
             assertEquals(success, false, "failing weakCompareAndSet char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, '\u0123', "failing weakCompareAndSetRe char value");
+            assertEquals('\u0123', x, "failing weakCompareAndSetRe char value");
         }
 
         // Compare set and get
@@ -584,9 +582,9 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact('\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_SET).invokeExact('\u4567');
-            assertEquals(o, '\u0123', "getAndSet char");
+            assertEquals('\u0123', o, "getAndSet char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, '\u4567', "getAndSet char value");
+            assertEquals('\u4567', x, "getAndSet char value");
         }
 
         // Compare set and get
@@ -594,9 +592,9 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact('\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact('\u4567');
-            assertEquals(o, '\u0123', "getAndSetAcquire char");
+            assertEquals('\u0123', o, "getAndSetAcquire char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, '\u4567', "getAndSetAcquire char value");
+            assertEquals('\u4567', x, "getAndSetAcquire char value");
         }
 
         // Compare set and get
@@ -604,9 +602,9 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact('\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact('\u4567');
-            assertEquals(o, '\u0123', "getAndSetRelease char");
+            assertEquals('\u0123', o, "getAndSetRelease char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, '\u4567', "getAndSetRelease char value");
+            assertEquals('\u4567', x, "getAndSetRelease char value");
         }
 
         // get and add, add and get
@@ -614,27 +612,27 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact('\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_ADD).invokeExact('\u4567');
-            assertEquals(o, '\u0123', "getAndAdd char");
+            assertEquals('\u0123', o, "getAndAdd char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAdd char value");
+            assertEquals((char)('\u0123' + '\u4567'), x, "getAndAdd char value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact('\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact('\u4567');
-            assertEquals(o, '\u0123', "getAndAddAcquire char");
+            assertEquals('\u0123', o, "getAndAddAcquire char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddAcquire char value");
+            assertEquals((char)('\u0123' + '\u4567'), x, "getAndAddAcquire char value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact('\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact('\u4567');
-            assertEquals(o, '\u0123', "getAndAddRelease char");
+            assertEquals('\u0123', o, "getAndAddRelease char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddRelease char value");
+            assertEquals((char)('\u0123' + '\u4567'), x, "getAndAddRelease char value");
         }
 
         // get and bitwise or
@@ -642,27 +640,27 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact('\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact('\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseOr char");
+            assertEquals('\u0123', o, "getAndBitwiseOr char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOr char value");
+            assertEquals((char)('\u0123' | '\u4567'), x, "getAndBitwiseOr char value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact('\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact('\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseOrAcquire char");
+            assertEquals('\u0123', o, "getAndBitwiseOrAcquire char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrAcquire char value");
+            assertEquals((char)('\u0123' | '\u4567'), x, "getAndBitwiseOrAcquire char value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact('\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact('\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseOrRelease char");
+            assertEquals('\u0123', o, "getAndBitwiseOrRelease char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrRelease char value");
+            assertEquals((char)('\u0123' | '\u4567'), x, "getAndBitwiseOrRelease char value");
         }
 
         // get and bitwise and
@@ -670,27 +668,27 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact('\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact('\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseAnd char");
+            assertEquals('\u0123', o, "getAndBitwiseAnd char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAnd char value");
+            assertEquals((char)('\u0123' & '\u4567'), x, "getAndBitwiseAnd char value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact('\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact('\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseAndAcquire char");
+            assertEquals('\u0123', o, "getAndBitwiseAndAcquire char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndAcquire char value");
+            assertEquals((char)('\u0123' & '\u4567'), x, "getAndBitwiseAndAcquire char value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact('\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact('\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseAndRelease char");
+            assertEquals('\u0123', o, "getAndBitwiseAndRelease char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndRelease char value");
+            assertEquals((char)('\u0123' & '\u4567'), x, "getAndBitwiseAndRelease char value");
         }
 
         // get and bitwise xor
@@ -698,27 +696,27 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact('\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact('\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseXor char");
+            assertEquals('\u0123', o, "getAndBitwiseXor char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXor char value");
+            assertEquals((char)('\u0123' ^ '\u4567'), x, "getAndBitwiseXor char value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact('\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact('\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseXorAcquire char");
+            assertEquals('\u0123', o, "getAndBitwiseXorAcquire char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorAcquire char value");
+            assertEquals((char)('\u0123' ^ '\u4567'), x, "getAndBitwiseXorAcquire char value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact('\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact('\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseXorRelease char");
+            assertEquals('\u0123', o, "getAndBitwiseXorRelease char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorRelease char value");
+            assertEquals((char)('\u0123' ^ '\u4567'), x, "getAndBitwiseXorRelease char value");
         }
     }
 
@@ -736,7 +734,7 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
                 char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, '\u0123', "get char value");
+                assertEquals('\u0123', x, "get char value");
             }
 
 
@@ -744,21 +742,21 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
             {
                 hs.get(TestAccessMode.SET_VOLATILE).invokeExact(array, i, '\u4567');
                 char x = (char) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(array, i);
-                assertEquals(x, '\u4567', "setVolatile char value");
+                assertEquals('\u4567', x, "setVolatile char value");
             }
 
             // Lazy
             {
                 hs.get(TestAccessMode.SET_RELEASE).invokeExact(array, i, '\u0123');
                 char x = (char) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(array, i);
-                assertEquals(x, '\u0123', "setRelease char value");
+                assertEquals('\u0123', x, "setRelease char value");
             }
 
             // Opaque
             {
                 hs.get(TestAccessMode.SET_OPAQUE).invokeExact(array, i, '\u4567');
                 char x = (char) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(array, i);
-                assertEquals(x, '\u4567', "setOpaque char value");
+                assertEquals('\u4567', x, "setOpaque char value");
             }
 
             hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
@@ -768,56 +766,56 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
                 boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, '\u0123', '\u4567');
                 assertEquals(r, true, "success compareAndSet char");
                 char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, '\u4567', "success compareAndSet char value");
+                assertEquals('\u4567', x, "success compareAndSet char value");
             }
 
             {
                 boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, '\u0123', '\u89AB');
                 assertEquals(r, false, "failing compareAndSet char");
                 char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, '\u4567', "failing compareAndSet char value");
+                assertEquals('\u4567', x, "failing compareAndSet char value");
             }
 
             {
                 char r = (char) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(array, i, '\u4567', '\u0123');
                 assertEquals(r, '\u4567', "success compareAndExchange char");
                 char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, '\u0123', "success compareAndExchange char value");
+                assertEquals('\u0123', x, "success compareAndExchange char value");
             }
 
             {
                 char r = (char) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(array, i, '\u4567', '\u89AB');
                 assertEquals(r, '\u0123', "failing compareAndExchange char");
                 char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, '\u0123', "failing compareAndExchange char value");
+                assertEquals('\u0123', x, "failing compareAndExchange char value");
             }
 
             {
                 char r = (char) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, '\u0123', '\u4567');
                 assertEquals(r, '\u0123', "success compareAndExchangeAcquire char");
                 char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, '\u4567', "success compareAndExchangeAcquire char value");
+                assertEquals('\u4567', x, "success compareAndExchangeAcquire char value");
             }
 
             {
                 char r = (char) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, '\u0123', '\u89AB');
                 assertEquals(r, '\u4567', "failing compareAndExchangeAcquire char");
                 char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, '\u4567', "failing compareAndExchangeAcquire char value");
+                assertEquals('\u4567', x, "failing compareAndExchangeAcquire char value");
             }
 
             {
                 char r = (char) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, '\u4567', '\u0123');
                 assertEquals(r, '\u4567', "success compareAndExchangeRelease char");
                 char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, '\u0123', "success compareAndExchangeRelease char value");
+                assertEquals('\u0123', x, "success compareAndExchangeRelease char value");
             }
 
             {
                 char r = (char) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, '\u4567', '\u89AB');
                 assertEquals(r, '\u0123', "failing compareAndExchangeRelease char");
                 char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, '\u0123', "failing compareAndExchangeRelease char value");
+                assertEquals('\u0123', x, "failing compareAndExchangeRelease char value");
             }
 
             {
@@ -829,14 +827,14 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetPlain char");
                 char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, '\u4567', "success weakCompareAndSetPlain char value");
+                assertEquals('\u4567', x, "success weakCompareAndSetPlain char value");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, '\u0123', '\u89AB');
                 assertEquals(success, false, "failing weakCompareAndSetPlain char");
                 char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, '\u4567', "failing weakCompareAndSetPlain char value");
+                assertEquals('\u4567', x, "failing weakCompareAndSetPlain char value");
             }
 
             {
@@ -848,14 +846,14 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetAcquire char");
                 char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, '\u0123', "success weakCompareAndSetAcquire char");
+                assertEquals('\u0123', x, "success weakCompareAndSetAcquire char");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, '\u4567', '\u89AB');
                 assertEquals(success, false, "failing weakCompareAndSetAcquire char");
                 char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, '\u0123', "failing weakCompareAndSetAcquire char value");
+                assertEquals('\u0123', x, "failing weakCompareAndSetAcquire char value");
             }
 
             {
@@ -867,14 +865,14 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetRelease char");
                 char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, '\u4567', "success weakCompareAndSetRelease char");
+                assertEquals('\u4567', x, "success weakCompareAndSetRelease char");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, '\u0123', '\u89AB');
                 assertEquals(success, false, "failing weakCompareAndSetAcquire char");
                 char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, '\u4567', "failing weakCompareAndSetAcquire char value");
+                assertEquals('\u4567', x, "failing weakCompareAndSetAcquire char value");
             }
 
             {
@@ -886,14 +884,14 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSet char");
                 char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, '\u0123', "success weakCompareAndSet char");
+                assertEquals('\u0123', x, "success weakCompareAndSet char");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, '\u4567', '\u89AB');
                 assertEquals(success, false, "failing weakCompareAndSet char");
                 char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, '\u0123', "failing weakCompareAndSet char value");
+                assertEquals('\u0123', x, "failing weakCompareAndSet char value");
             }
 
             // Compare set and get
@@ -901,27 +899,27 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
 
                 char o = (char) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, '\u4567');
-                assertEquals(o, '\u0123', "getAndSet char");
+                assertEquals('\u0123', o, "getAndSet char");
                 char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, '\u4567', "getAndSet char value");
+                assertEquals('\u4567', x, "getAndSet char value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
 
                 char o = (char) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, '\u4567');
-                assertEquals(o, '\u0123', "getAndSetAcquire char");
+                assertEquals('\u0123', o, "getAndSetAcquire char");
                 char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, '\u4567', "getAndSetAcquire char value");
+                assertEquals('\u4567', x, "getAndSetAcquire char value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
 
                 char o = (char) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, '\u4567');
-                assertEquals(o, '\u0123', "getAndSetRelease char");
+                assertEquals('\u0123', o, "getAndSetRelease char");
                 char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, '\u4567', "getAndSetRelease char value");
+                assertEquals('\u4567', x, "getAndSetRelease char value");
             }
 
             // get and add, add and get
@@ -929,27 +927,27 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
 
                 char o = (char) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, '\u4567');
-                assertEquals(o, '\u0123', "getAndAdd char");
+                assertEquals('\u0123', o, "getAndAdd char");
                 char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAdd char value");
+                assertEquals((char)('\u0123' + '\u4567'), x, "getAndAdd char value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
 
                 char o = (char) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, '\u4567');
-                assertEquals(o, '\u0123', "getAndAddAcquire char");
+                assertEquals('\u0123', o, "getAndAddAcquire char");
                 char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddAcquire char value");
+                assertEquals((char)('\u0123' + '\u4567'), x, "getAndAddAcquire char value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
 
                 char o = (char) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, '\u4567');
-                assertEquals(o, '\u0123', "getAndAddRelease char");
+                assertEquals('\u0123', o, "getAndAddRelease char");
                 char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddRelease char value");
+                assertEquals((char)('\u0123' + '\u4567'), x, "getAndAddRelease char value");
             }
 
         // get and bitwise or
@@ -957,27 +955,27 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(array, i, '\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseOr char");
+            assertEquals('\u0123', o, "getAndBitwiseOr char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOr char value");
+            assertEquals((char)('\u0123' | '\u4567'), x, "getAndBitwiseOr char value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(array, i, '\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseOrAcquire char");
+            assertEquals('\u0123', o, "getAndBitwiseOrAcquire char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrAcquire char value");
+            assertEquals((char)('\u0123' | '\u4567'), x, "getAndBitwiseOrAcquire char value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(array, i, '\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseOrRelease char");
+            assertEquals('\u0123', o, "getAndBitwiseOrRelease char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrRelease char value");
+            assertEquals((char)('\u0123' | '\u4567'), x, "getAndBitwiseOrRelease char value");
         }
 
         // get and bitwise and
@@ -985,27 +983,27 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(array, i, '\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseAnd char");
+            assertEquals('\u0123', o, "getAndBitwiseAnd char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAnd char value");
+            assertEquals((char)('\u0123' & '\u4567'), x, "getAndBitwiseAnd char value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(array, i, '\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseAndAcquire char");
+            assertEquals('\u0123', o, "getAndBitwiseAndAcquire char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndAcquire char value");
+            assertEquals((char)('\u0123' & '\u4567'), x, "getAndBitwiseAndAcquire char value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(array, i, '\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseAndRelease char");
+            assertEquals('\u0123', o, "getAndBitwiseAndRelease char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndRelease char value");
+            assertEquals((char)('\u0123' & '\u4567'), x, "getAndBitwiseAndRelease char value");
         }
 
         // get and bitwise xor
@@ -1013,27 +1011,27 @@ public class VarHandleTestMethodHandleAccessChar extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(array, i, '\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseXor char");
+            assertEquals('\u0123', o, "getAndBitwiseXor char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXor char value");
+            assertEquals((char)('\u0123' ^ '\u4567'), x, "getAndBitwiseXor char value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(array, i, '\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseXorAcquire char");
+            assertEquals('\u0123', o, "getAndBitwiseXorAcquire char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorAcquire char value");
+            assertEquals((char)('\u0123' ^ '\u4567'), x, "getAndBitwiseXorAcquire char value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123');
 
             char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(array, i, '\u4567');
-            assertEquals(o, '\u0123', "getAndBitwiseXorRelease char");
+            assertEquals('\u0123', o, "getAndBitwiseXorRelease char");
             char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorRelease char value");
+            assertEquals((char)('\u0123' ^ '\u4567'), x, "getAndBitwiseXorRelease char value");
         }
         }
     }
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessDouble.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessDouble.java
index fe0455d2375..056d45478ed 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessDouble.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessDouble.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,22 +25,22 @@
  * @test
  * @comment Set CompileThresholdScaling to 0.1 so that the warmup loop sets to 2000 iterations
  *          to hit compilation thresholds
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 VarHandleTestMethodHandleAccessDouble
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 VarHandleTestMethodHandleAccessDouble
  */
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
     static final double static_final_v = 1.0d;
 
@@ -60,7 +60,7 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
 
     VarHandle vhArray;
 
-    @BeforeClass
+    @BeforeAll
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
                 VarHandleTestMethodHandleAccessDouble.class, "final_v", double.class);
@@ -77,8 +77,6 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
         vhArray = MethodHandles.arrayElementVarHandle(double[].class);
     }
 
-
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -111,7 +109,8 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -120,13 +119,12 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
         }
     }
 
-
     static void testInstanceField(VarHandleTestMethodHandleAccessDouble recv, Handles hs) throws Throwable {
         // Plain
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, 1.0d);
             double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 1.0d, "set double value");
+            assertEquals(1.0d, x, "set double value");
         }
 
 
@@ -134,21 +132,21 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
         {
             hs.get(TestAccessMode.SET_VOLATILE).invokeExact(recv, 2.0d);
             double x = (double) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(recv);
-            assertEquals(x, 2.0d, "setVolatile double value");
+            assertEquals(2.0d, x, "setVolatile double value");
         }
 
         // Lazy
         {
             hs.get(TestAccessMode.SET_RELEASE).invokeExact(recv, 1.0d);
             double x = (double) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(recv);
-            assertEquals(x, 1.0d, "setRelease double value");
+            assertEquals(1.0d, x, "setRelease double value");
         }
 
         // Opaque
         {
             hs.get(TestAccessMode.SET_OPAQUE).invokeExact(recv, 2.0d);
             double x = (double) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(recv);
-            assertEquals(x, 2.0d, "setOpaque double value");
+            assertEquals(2.0d, x, "setOpaque double value");
         }
 
         hs.get(TestAccessMode.SET).invokeExact(recv, 1.0d);
@@ -158,56 +156,56 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, 1.0d, 2.0d);
             assertEquals(r, true, "success compareAndSet double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 2.0d, "success compareAndSet double value");
+            assertEquals(2.0d, x, "success compareAndSet double value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, 1.0d, 3.0d);
             assertEquals(r, false, "failing compareAndSet double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 2.0d, "failing compareAndSet double value");
+            assertEquals(2.0d, x, "failing compareAndSet double value");
         }
 
         {
             double r = (double) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(recv, 2.0d, 1.0d);
             assertEquals(r, 2.0d, "success compareAndExchange double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 1.0d, "success compareAndExchange double value");
+            assertEquals(1.0d, x, "success compareAndExchange double value");
         }
 
         {
             double r = (double) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(recv, 2.0d, 3.0d);
             assertEquals(r, 1.0d, "failing compareAndExchange double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 1.0d, "failing compareAndExchange double value");
+            assertEquals(1.0d, x, "failing compareAndExchange double value");
         }
 
         {
             double r = (double) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, 1.0d, 2.0d);
             assertEquals(r, 1.0d, "success compareAndExchangeAcquire double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 2.0d, "success compareAndExchangeAcquire double value");
+            assertEquals(2.0d, x, "success compareAndExchangeAcquire double value");
         }
 
         {
             double r = (double) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, 1.0d, 3.0d);
             assertEquals(r, 2.0d, "failing compareAndExchangeAcquire double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 2.0d, "failing compareAndExchangeAcquire double value");
+            assertEquals(2.0d, x, "failing compareAndExchangeAcquire double value");
         }
 
         {
             double r = (double) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, 2.0d, 1.0d);
             assertEquals(r, 2.0d, "success compareAndExchangeRelease double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 1.0d, "success compareAndExchangeRelease double value");
+            assertEquals(1.0d, x, "success compareAndExchangeRelease double value");
         }
 
         {
             double r = (double) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, 2.0d, 3.0d);
             assertEquals(r, 1.0d, "failing compareAndExchangeRelease double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 1.0d, "failing compareAndExchangeRelease double value");
+            assertEquals(1.0d, x, "failing compareAndExchangeRelease double value");
         }
 
         {
@@ -219,14 +217,14 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 2.0d, "success weakCompareAndSetPlain double value");
+            assertEquals(2.0d, x, "success weakCompareAndSetPlain double value");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, 1.0d, 3.0d);
             assertEquals(success, false, "failing weakCompareAndSetPlain double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 2.0d, "failing weakCompareAndSetPlain double value");
+            assertEquals(2.0d, x, "failing weakCompareAndSetPlain double value");
         }
 
         {
@@ -238,14 +236,14 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 1.0d, "success weakCompareAndSetAcquire double");
+            assertEquals(1.0d, x, "success weakCompareAndSetAcquire double");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, 2.0d, 3.0d);
             assertEquals(success, false, "failing weakCompareAndSetAcquire double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 1.0d, "failing weakCompareAndSetAcquire double value");
+            assertEquals(1.0d, x, "failing weakCompareAndSetAcquire double value");
         }
 
         {
@@ -257,14 +255,14 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 2.0d, "success weakCompareAndSetRelease double");
+            assertEquals(2.0d, x, "success weakCompareAndSetRelease double");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, 1.0d, 3.0d);
             assertEquals(success, false, "failing weakCompareAndSetRelease double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 2.0d, "failing weakCompareAndSetRelease double value");
+            assertEquals(2.0d, x, "failing weakCompareAndSetRelease double value");
         }
 
         {
@@ -276,22 +274,22 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 1.0d, "success weakCompareAndSet double");
+            assertEquals(1.0d, x, "success weakCompareAndSet double");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 2.0d, 3.0d);
             assertEquals(success, false, "failing weakCompareAndSet double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 1.0d, "failing weakCompareAndSet double value");
+            assertEquals(1.0d, x, "failing weakCompareAndSet double value");
         }
 
         // Compare set and get
         {
             double o = (double) hs.get(TestAccessMode.GET_AND_SET).invokeExact(recv, 2.0d);
-            assertEquals(o, 1.0d, "getAndSet double");
+            assertEquals(1.0d, o, "getAndSet double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 2.0d, "getAndSet double value");
+            assertEquals(2.0d, x, "getAndSet double value");
         }
 
         // get and add, add and get
@@ -299,27 +297,27 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(recv, 1.0d);
 
             double o = (double) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, 2.0d);
-            assertEquals(o, 1.0d, "getAndAdd double");
+            assertEquals(1.0d, o, "getAndAdd double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (double)(1.0d + 2.0d), "getAndAdd double value");
+            assertEquals((double)(1.0d + 2.0d), x, "getAndAdd double value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, 1.0d);
 
             double o = (double) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, 2.0d);
-            assertEquals(o, 1.0d, "getAndAddAcquire double");
+            assertEquals(1.0d, o, "getAndAddAcquire double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (double)(1.0d + 2.0d), "getAndAddAcquire double value");
+            assertEquals((double)(1.0d + 2.0d), x, "getAndAddAcquire double value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, 1.0d);
 
             double o = (double) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, 2.0d);
-            assertEquals(o, 1.0d, "getAndAddRelease double");
+            assertEquals(1.0d, o, "getAndAddRelease double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (double)(1.0d + 2.0d), "getAndAddRelease double value");
+            assertEquals((double)(1.0d + 2.0d), x, "getAndAddRelease double value");
         }
 
     }
@@ -340,7 +338,7 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
         {
             hs.get(TestAccessMode.SET).invokeExact(1.0d);
             double x = (double) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 1.0d, "set double value");
+            assertEquals(1.0d, x, "set double value");
         }
 
 
@@ -348,21 +346,21 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
         {
             hs.get(TestAccessMode.SET_VOLATILE).invokeExact(2.0d);
             double x = (double) hs.get(TestAccessMode.GET_VOLATILE).invokeExact();
-            assertEquals(x, 2.0d, "setVolatile double value");
+            assertEquals(2.0d, x, "setVolatile double value");
         }
 
         // Lazy
         {
             hs.get(TestAccessMode.SET_RELEASE).invokeExact(1.0d);
             double x = (double) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact();
-            assertEquals(x, 1.0d, "setRelease double value");
+            assertEquals(1.0d, x, "setRelease double value");
         }
 
         // Opaque
         {
             hs.get(TestAccessMode.SET_OPAQUE).invokeExact(2.0d);
             double x = (double) hs.get(TestAccessMode.GET_OPAQUE).invokeExact();
-            assertEquals(x, 2.0d, "setOpaque double value");
+            assertEquals(2.0d, x, "setOpaque double value");
         }
 
         hs.get(TestAccessMode.SET).invokeExact(1.0d);
@@ -372,56 +370,56 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(1.0d, 2.0d);
             assertEquals(r, true, "success compareAndSet double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 2.0d, "success compareAndSet double value");
+            assertEquals(2.0d, x, "success compareAndSet double value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(1.0d, 3.0d);
             assertEquals(r, false, "failing compareAndSet double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 2.0d, "failing compareAndSet double value");
+            assertEquals(2.0d, x, "failing compareAndSet double value");
         }
 
         {
             double r = (double) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(2.0d, 1.0d);
             assertEquals(r, 2.0d, "success compareAndExchange double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 1.0d, "success compareAndExchange double value");
+            assertEquals(1.0d, x, "success compareAndExchange double value");
         }
 
         {
             double r = (double) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(2.0d, 3.0d);
             assertEquals(r, 1.0d, "failing compareAndExchange double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 1.0d, "failing compareAndExchange double value");
+            assertEquals(1.0d, x, "failing compareAndExchange double value");
         }
 
         {
             double r = (double) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(1.0d, 2.0d);
             assertEquals(r, 1.0d, "success compareAndExchangeAcquire double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 2.0d, "success compareAndExchangeAcquire double value");
+            assertEquals(2.0d, x, "success compareAndExchangeAcquire double value");
         }
 
         {
             double r = (double) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(1.0d, 3.0d);
             assertEquals(r, 2.0d, "failing compareAndExchangeAcquire double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 2.0d, "failing compareAndExchangeAcquire double value");
+            assertEquals(2.0d, x, "failing compareAndExchangeAcquire double value");
         }
 
         {
             double r = (double) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(2.0d, 1.0d);
             assertEquals(r, 2.0d, "success compareAndExchangeRelease double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 1.0d, "success compareAndExchangeRelease double value");
+            assertEquals(1.0d, x, "success compareAndExchangeRelease double value");
         }
 
         {
             double r = (double) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(2.0d, 3.0d);
             assertEquals(r, 1.0d, "failing compareAndExchangeRelease double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 1.0d, "failing compareAndExchangeRelease double value");
+            assertEquals(1.0d, x, "failing compareAndExchangeRelease double value");
         }
 
         {
@@ -433,14 +431,14 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 2.0d, "success weakCompareAndSetPlain double value");
+            assertEquals(2.0d, x, "success weakCompareAndSetPlain double value");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(1.0d, 3.0d);
             assertEquals(success, false, "failing weakCompareAndSetPlain double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 2.0d, "failing weakCompareAndSetPlain double value");
+            assertEquals(2.0d, x, "failing weakCompareAndSetPlain double value");
         }
 
         {
@@ -452,7 +450,7 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 1.0d, "success weakCompareAndSetAcquire double");
+            assertEquals(1.0d, x, "success weakCompareAndSetAcquire double");
         }
 
         {
@@ -460,7 +458,7 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
             boolean success = (boolean) mh.invokeExact(2.0d, 3.0d);
             assertEquals(success, false, "failing weakCompareAndSetAcquire double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 1.0d, "failing weakCompareAndSetAcquire double value");
+            assertEquals(1.0d, x, "failing weakCompareAndSetAcquire double value");
         }
 
         {
@@ -472,14 +470,14 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 2.0d, "success weakCompareAndSetRelease double");
+            assertEquals(2.0d, x, "success weakCompareAndSetRelease double");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(1.0d, 3.0d);
             assertEquals(success, false, "failing weakCompareAndSetRelease double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 2.0d, "failing weakCompareAndSetRelease double value");
+            assertEquals(2.0d, x, "failing weakCompareAndSetRelease double value");
         }
 
         {
@@ -491,14 +489,14 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 1.0d, "success weakCompareAndSet double");
+            assertEquals(1.0d, x, "success weakCompareAndSet double");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(2.0d, 3.0d);
             assertEquals(success, false, "failing weakCompareAndSet double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 1.0d, "failing weakCompareAndSetRe double value");
+            assertEquals(1.0d, x, "failing weakCompareAndSetRe double value");
         }
 
         // Compare set and get
@@ -506,9 +504,9 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(1.0d);
 
             double o = (double) hs.get(TestAccessMode.GET_AND_SET).invokeExact(2.0d);
-            assertEquals(o, 1.0d, "getAndSet double");
+            assertEquals(1.0d, o, "getAndSet double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 2.0d, "getAndSet double value");
+            assertEquals(2.0d, x, "getAndSet double value");
         }
 
         // Compare set and get
@@ -516,9 +514,9 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(1.0d);
 
             double o = (double) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(2.0d);
-            assertEquals(o, 1.0d, "getAndSetAcquire double");
+            assertEquals(1.0d, o, "getAndSetAcquire double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 2.0d, "getAndSetAcquire double value");
+            assertEquals(2.0d, x, "getAndSetAcquire double value");
         }
 
         // Compare set and get
@@ -526,9 +524,9 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(1.0d);
 
             double o = (double) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(2.0d);
-            assertEquals(o, 1.0d, "getAndSetRelease double");
+            assertEquals(1.0d, o, "getAndSetRelease double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 2.0d, "getAndSetRelease double value");
+            assertEquals(2.0d, x, "getAndSetRelease double value");
         }
 
         // get and add, add and get
@@ -536,27 +534,27 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(1.0d);
 
             double o = (double) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(2.0d);
-            assertEquals(o, 1.0d, "getAndAdd double");
+            assertEquals(1.0d, o, "getAndAdd double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (double)(1.0d + 2.0d), "getAndAdd double value");
+            assertEquals((double)(1.0d + 2.0d), x, "getAndAdd double value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(1.0d);
 
             double o = (double) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(2.0d);
-            assertEquals(o, 1.0d, "getAndAddAcquire double");
+            assertEquals(1.0d, o, "getAndAddAcquire double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (double)(1.0d + 2.0d), "getAndAddAcquire double value");
+            assertEquals((double)(1.0d + 2.0d), x, "getAndAddAcquire double value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(1.0d);
 
             double o = (double) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(2.0d);
-            assertEquals(o, 1.0d, "getAndAddRelease double");
+            assertEquals(1.0d, o, "getAndAddRelease double");
             double x = (double) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (double)(1.0d + 2.0d), "getAndAddRelease double value");
+            assertEquals((double)(1.0d + 2.0d), x, "getAndAddRelease double value");
         }
 
     }
@@ -580,7 +578,7 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0d);
                 double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 1.0d, "get double value");
+                assertEquals(1.0d, x, "get double value");
             }
 
 
@@ -588,21 +586,21 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
             {
                 hs.get(TestAccessMode.SET_VOLATILE).invokeExact(array, i, 2.0d);
                 double x = (double) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(array, i);
-                assertEquals(x, 2.0d, "setVolatile double value");
+                assertEquals(2.0d, x, "setVolatile double value");
             }
 
             // Lazy
             {
                 hs.get(TestAccessMode.SET_RELEASE).invokeExact(array, i, 1.0d);
                 double x = (double) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(array, i);
-                assertEquals(x, 1.0d, "setRelease double value");
+                assertEquals(1.0d, x, "setRelease double value");
             }
 
             // Opaque
             {
                 hs.get(TestAccessMode.SET_OPAQUE).invokeExact(array, i, 2.0d);
                 double x = (double) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(array, i);
-                assertEquals(x, 2.0d, "setOpaque double value");
+                assertEquals(2.0d, x, "setOpaque double value");
             }
 
             hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0d);
@@ -612,56 +610,56 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
                 boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, 1.0d, 2.0d);
                 assertEquals(r, true, "success compareAndSet double");
                 double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 2.0d, "success compareAndSet double value");
+                assertEquals(2.0d, x, "success compareAndSet double value");
             }
 
             {
                 boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, 1.0d, 3.0d);
                 assertEquals(r, false, "failing compareAndSet double");
                 double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 2.0d, "failing compareAndSet double value");
+                assertEquals(2.0d, x, "failing compareAndSet double value");
             }
 
             {
                 double r = (double) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(array, i, 2.0d, 1.0d);
                 assertEquals(r, 2.0d, "success compareAndExchange double");
                 double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 1.0d, "success compareAndExchange double value");
+                assertEquals(1.0d, x, "success compareAndExchange double value");
             }
 
             {
                 double r = (double) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(array, i, 2.0d, 3.0d);
                 assertEquals(r, 1.0d, "failing compareAndExchange double");
                 double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 1.0d, "failing compareAndExchange double value");
+                assertEquals(1.0d, x, "failing compareAndExchange double value");
             }
 
             {
                 double r = (double) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, 1.0d, 2.0d);
                 assertEquals(r, 1.0d, "success compareAndExchangeAcquire double");
                 double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 2.0d, "success compareAndExchangeAcquire double value");
+                assertEquals(2.0d, x, "success compareAndExchangeAcquire double value");
             }
 
             {
                 double r = (double) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, 1.0d, 3.0d);
                 assertEquals(r, 2.0d, "failing compareAndExchangeAcquire double");
                 double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 2.0d, "failing compareAndExchangeAcquire double value");
+                assertEquals(2.0d, x, "failing compareAndExchangeAcquire double value");
             }
 
             {
                 double r = (double) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, 2.0d, 1.0d);
                 assertEquals(r, 2.0d, "success compareAndExchangeRelease double");
                 double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 1.0d, "success compareAndExchangeRelease double value");
+                assertEquals(1.0d, x, "success compareAndExchangeRelease double value");
             }
 
             {
                 double r = (double) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, 2.0d, 3.0d);
                 assertEquals(r, 1.0d, "failing compareAndExchangeRelease double");
                 double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 1.0d, "failing compareAndExchangeRelease double value");
+                assertEquals(1.0d, x, "failing compareAndExchangeRelease double value");
             }
 
             {
@@ -673,14 +671,14 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetPlain double");
                 double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 2.0d, "success weakCompareAndSetPlain double value");
+                assertEquals(2.0d, x, "success weakCompareAndSetPlain double value");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, 1.0d, 3.0d);
                 assertEquals(success, false, "failing weakCompareAndSetPlain double");
                 double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 2.0d, "failing weakCompareAndSetPlain double value");
+                assertEquals(2.0d, x, "failing weakCompareAndSetPlain double value");
             }
 
             {
@@ -692,14 +690,14 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetAcquire double");
                 double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 1.0d, "success weakCompareAndSetAcquire double");
+                assertEquals(1.0d, x, "success weakCompareAndSetAcquire double");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, 2.0d, 3.0d);
                 assertEquals(success, false, "failing weakCompareAndSetAcquire double");
                 double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 1.0d, "failing weakCompareAndSetAcquire double value");
+                assertEquals(1.0d, x, "failing weakCompareAndSetAcquire double value");
             }
 
             {
@@ -711,14 +709,14 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetRelease double");
                 double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 2.0d, "success weakCompareAndSetRelease double");
+                assertEquals(2.0d, x, "success weakCompareAndSetRelease double");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, 1.0d, 3.0d);
                 assertEquals(success, false, "failing weakCompareAndSetAcquire double");
                 double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 2.0d, "failing weakCompareAndSetAcquire double value");
+                assertEquals(2.0d, x, "failing weakCompareAndSetAcquire double value");
             }
 
             {
@@ -730,14 +728,14 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSet double");
                 double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 1.0d, "success weakCompareAndSet double");
+                assertEquals(1.0d, x, "success weakCompareAndSet double");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 2.0d, 3.0d);
                 assertEquals(success, false, "failing weakCompareAndSet double");
                 double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 1.0d, "failing weakCompareAndSet double value");
+                assertEquals(1.0d, x, "failing weakCompareAndSet double value");
             }
 
             // Compare set and get
@@ -745,27 +743,27 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0d);
 
                 double o = (double) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, 2.0d);
-                assertEquals(o, 1.0d, "getAndSet double");
+                assertEquals(1.0d, o, "getAndSet double");
                 double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 2.0d, "getAndSet double value");
+                assertEquals(2.0d, x, "getAndSet double value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0d);
 
                 double o = (double) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, 2.0d);
-                assertEquals(o, 1.0d, "getAndSetAcquire double");
+                assertEquals(1.0d, o, "getAndSetAcquire double");
                 double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 2.0d, "getAndSetAcquire double value");
+                assertEquals(2.0d, x, "getAndSetAcquire double value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0d);
 
                 double o = (double) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, 2.0d);
-                assertEquals(o, 1.0d, "getAndSetRelease double");
+                assertEquals(1.0d, o, "getAndSetRelease double");
                 double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 2.0d, "getAndSetRelease double value");
+                assertEquals(2.0d, x, "getAndSetRelease double value");
             }
 
             // get and add, add and get
@@ -773,27 +771,27 @@ public class VarHandleTestMethodHandleAccessDouble extends VarHandleBaseTest {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0d);
 
                 double o = (double) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, 2.0d);
-                assertEquals(o, 1.0d, "getAndAdd double");
+                assertEquals(1.0d, o, "getAndAdd double");
                 double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (double)(1.0d + 2.0d), "getAndAdd double value");
+                assertEquals((double)(1.0d + 2.0d), x, "getAndAdd double value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0d);
 
                 double o = (double) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, 2.0d);
-                assertEquals(o, 1.0d, "getAndAddAcquire double");
+                assertEquals(1.0d, o, "getAndAddAcquire double");
                 double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (double)(1.0d + 2.0d), "getAndAddAcquire double value");
+                assertEquals((double)(1.0d + 2.0d), x, "getAndAddAcquire double value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0d);
 
                 double o = (double) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, 2.0d);
-                assertEquals(o, 1.0d, "getAndAddRelease double");
+                assertEquals(1.0d, o, "getAndAddRelease double");
                 double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (double)(1.0d + 2.0d), "getAndAddRelease double value");
+                assertEquals((double)(1.0d + 2.0d), x, "getAndAddRelease double value");
             }
 
         }
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessFloat.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessFloat.java
index 256e4723eec..98eb72301cb 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessFloat.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessFloat.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,22 +25,22 @@
  * @test
  * @comment Set CompileThresholdScaling to 0.1 so that the warmup loop sets to 2000 iterations
  *          to hit compilation thresholds
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 VarHandleTestMethodHandleAccessFloat
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 VarHandleTestMethodHandleAccessFloat
  */
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
     static final float static_final_v = 1.0f;
 
@@ -60,7 +60,7 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
 
     VarHandle vhArray;
 
-    @BeforeClass
+    @BeforeAll
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
                 VarHandleTestMethodHandleAccessFloat.class, "final_v", float.class);
@@ -77,8 +77,6 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
         vhArray = MethodHandles.arrayElementVarHandle(float[].class);
     }
 
-
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -111,7 +109,8 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -120,13 +119,12 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
         }
     }
 
-
     static void testInstanceField(VarHandleTestMethodHandleAccessFloat recv, Handles hs) throws Throwable {
         // Plain
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, 1.0f);
             float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 1.0f, "set float value");
+            assertEquals(1.0f, x, "set float value");
         }
 
 
@@ -134,21 +132,21 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
         {
             hs.get(TestAccessMode.SET_VOLATILE).invokeExact(recv, 2.0f);
             float x = (float) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(recv);
-            assertEquals(x, 2.0f, "setVolatile float value");
+            assertEquals(2.0f, x, "setVolatile float value");
         }
 
         // Lazy
         {
             hs.get(TestAccessMode.SET_RELEASE).invokeExact(recv, 1.0f);
             float x = (float) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(recv);
-            assertEquals(x, 1.0f, "setRelease float value");
+            assertEquals(1.0f, x, "setRelease float value");
         }
 
         // Opaque
         {
             hs.get(TestAccessMode.SET_OPAQUE).invokeExact(recv, 2.0f);
             float x = (float) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(recv);
-            assertEquals(x, 2.0f, "setOpaque float value");
+            assertEquals(2.0f, x, "setOpaque float value");
         }
 
         hs.get(TestAccessMode.SET).invokeExact(recv, 1.0f);
@@ -158,56 +156,56 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, 1.0f, 2.0f);
             assertEquals(r, true, "success compareAndSet float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 2.0f, "success compareAndSet float value");
+            assertEquals(2.0f, x, "success compareAndSet float value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, 1.0f, 3.0f);
             assertEquals(r, false, "failing compareAndSet float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 2.0f, "failing compareAndSet float value");
+            assertEquals(2.0f, x, "failing compareAndSet float value");
         }
 
         {
             float r = (float) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(recv, 2.0f, 1.0f);
             assertEquals(r, 2.0f, "success compareAndExchange float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 1.0f, "success compareAndExchange float value");
+            assertEquals(1.0f, x, "success compareAndExchange float value");
         }
 
         {
             float r = (float) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(recv, 2.0f, 3.0f);
             assertEquals(r, 1.0f, "failing compareAndExchange float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 1.0f, "failing compareAndExchange float value");
+            assertEquals(1.0f, x, "failing compareAndExchange float value");
         }
 
         {
             float r = (float) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, 1.0f, 2.0f);
             assertEquals(r, 1.0f, "success compareAndExchangeAcquire float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 2.0f, "success compareAndExchangeAcquire float value");
+            assertEquals(2.0f, x, "success compareAndExchangeAcquire float value");
         }
 
         {
             float r = (float) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, 1.0f, 3.0f);
             assertEquals(r, 2.0f, "failing compareAndExchangeAcquire float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 2.0f, "failing compareAndExchangeAcquire float value");
+            assertEquals(2.0f, x, "failing compareAndExchangeAcquire float value");
         }
 
         {
             float r = (float) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, 2.0f, 1.0f);
             assertEquals(r, 2.0f, "success compareAndExchangeRelease float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 1.0f, "success compareAndExchangeRelease float value");
+            assertEquals(1.0f, x, "success compareAndExchangeRelease float value");
         }
 
         {
             float r = (float) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, 2.0f, 3.0f);
             assertEquals(r, 1.0f, "failing compareAndExchangeRelease float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 1.0f, "failing compareAndExchangeRelease float value");
+            assertEquals(1.0f, x, "failing compareAndExchangeRelease float value");
         }
 
         {
@@ -219,14 +217,14 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 2.0f, "success weakCompareAndSetPlain float value");
+            assertEquals(2.0f, x, "success weakCompareAndSetPlain float value");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, 1.0f, 3.0f);
             assertEquals(success, false, "failing weakCompareAndSetPlain float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 2.0f, "failing weakCompareAndSetPlain float value");
+            assertEquals(2.0f, x, "failing weakCompareAndSetPlain float value");
         }
 
         {
@@ -238,14 +236,14 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 1.0f, "success weakCompareAndSetAcquire float");
+            assertEquals(1.0f, x, "success weakCompareAndSetAcquire float");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, 2.0f, 3.0f);
             assertEquals(success, false, "failing weakCompareAndSetAcquire float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 1.0f, "failing weakCompareAndSetAcquire float value");
+            assertEquals(1.0f, x, "failing weakCompareAndSetAcquire float value");
         }
 
         {
@@ -257,14 +255,14 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 2.0f, "success weakCompareAndSetRelease float");
+            assertEquals(2.0f, x, "success weakCompareAndSetRelease float");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, 1.0f, 3.0f);
             assertEquals(success, false, "failing weakCompareAndSetRelease float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 2.0f, "failing weakCompareAndSetRelease float value");
+            assertEquals(2.0f, x, "failing weakCompareAndSetRelease float value");
         }
 
         {
@@ -276,22 +274,22 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 1.0f, "success weakCompareAndSet float");
+            assertEquals(1.0f, x, "success weakCompareAndSet float");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 2.0f, 3.0f);
             assertEquals(success, false, "failing weakCompareAndSet float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 1.0f, "failing weakCompareAndSet float value");
+            assertEquals(1.0f, x, "failing weakCompareAndSet float value");
         }
 
         // Compare set and get
         {
             float o = (float) hs.get(TestAccessMode.GET_AND_SET).invokeExact(recv, 2.0f);
-            assertEquals(o, 1.0f, "getAndSet float");
+            assertEquals(1.0f, o, "getAndSet float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 2.0f, "getAndSet float value");
+            assertEquals(2.0f, x, "getAndSet float value");
         }
 
         // get and add, add and get
@@ -299,27 +297,27 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(recv, 1.0f);
 
             float o = (float) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, 2.0f);
-            assertEquals(o, 1.0f, "getAndAdd float");
+            assertEquals(1.0f, o, "getAndAdd float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (float)(1.0f + 2.0f), "getAndAdd float value");
+            assertEquals((float)(1.0f + 2.0f), x, "getAndAdd float value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, 1.0f);
 
             float o = (float) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, 2.0f);
-            assertEquals(o, 1.0f, "getAndAddAcquire float");
+            assertEquals(1.0f, o, "getAndAddAcquire float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (float)(1.0f + 2.0f), "getAndAddAcquire float value");
+            assertEquals((float)(1.0f + 2.0f), x, "getAndAddAcquire float value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, 1.0f);
 
             float o = (float) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, 2.0f);
-            assertEquals(o, 1.0f, "getAndAddRelease float");
+            assertEquals(1.0f, o, "getAndAddRelease float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (float)(1.0f + 2.0f), "getAndAddRelease float value");
+            assertEquals((float)(1.0f + 2.0f), x, "getAndAddRelease float value");
         }
 
     }
@@ -340,7 +338,7 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
         {
             hs.get(TestAccessMode.SET).invokeExact(1.0f);
             float x = (float) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 1.0f, "set float value");
+            assertEquals(1.0f, x, "set float value");
         }
 
 
@@ -348,21 +346,21 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
         {
             hs.get(TestAccessMode.SET_VOLATILE).invokeExact(2.0f);
             float x = (float) hs.get(TestAccessMode.GET_VOLATILE).invokeExact();
-            assertEquals(x, 2.0f, "setVolatile float value");
+            assertEquals(2.0f, x, "setVolatile float value");
         }
 
         // Lazy
         {
             hs.get(TestAccessMode.SET_RELEASE).invokeExact(1.0f);
             float x = (float) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact();
-            assertEquals(x, 1.0f, "setRelease float value");
+            assertEquals(1.0f, x, "setRelease float value");
         }
 
         // Opaque
         {
             hs.get(TestAccessMode.SET_OPAQUE).invokeExact(2.0f);
             float x = (float) hs.get(TestAccessMode.GET_OPAQUE).invokeExact();
-            assertEquals(x, 2.0f, "setOpaque float value");
+            assertEquals(2.0f, x, "setOpaque float value");
         }
 
         hs.get(TestAccessMode.SET).invokeExact(1.0f);
@@ -372,56 +370,56 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(1.0f, 2.0f);
             assertEquals(r, true, "success compareAndSet float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 2.0f, "success compareAndSet float value");
+            assertEquals(2.0f, x, "success compareAndSet float value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(1.0f, 3.0f);
             assertEquals(r, false, "failing compareAndSet float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 2.0f, "failing compareAndSet float value");
+            assertEquals(2.0f, x, "failing compareAndSet float value");
         }
 
         {
             float r = (float) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(2.0f, 1.0f);
             assertEquals(r, 2.0f, "success compareAndExchange float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 1.0f, "success compareAndExchange float value");
+            assertEquals(1.0f, x, "success compareAndExchange float value");
         }
 
         {
             float r = (float) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(2.0f, 3.0f);
             assertEquals(r, 1.0f, "failing compareAndExchange float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 1.0f, "failing compareAndExchange float value");
+            assertEquals(1.0f, x, "failing compareAndExchange float value");
         }
 
         {
             float r = (float) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(1.0f, 2.0f);
             assertEquals(r, 1.0f, "success compareAndExchangeAcquire float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 2.0f, "success compareAndExchangeAcquire float value");
+            assertEquals(2.0f, x, "success compareAndExchangeAcquire float value");
         }
 
         {
             float r = (float) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(1.0f, 3.0f);
             assertEquals(r, 2.0f, "failing compareAndExchangeAcquire float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 2.0f, "failing compareAndExchangeAcquire float value");
+            assertEquals(2.0f, x, "failing compareAndExchangeAcquire float value");
         }
 
         {
             float r = (float) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(2.0f, 1.0f);
             assertEquals(r, 2.0f, "success compareAndExchangeRelease float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 1.0f, "success compareAndExchangeRelease float value");
+            assertEquals(1.0f, x, "success compareAndExchangeRelease float value");
         }
 
         {
             float r = (float) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(2.0f, 3.0f);
             assertEquals(r, 1.0f, "failing compareAndExchangeRelease float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 1.0f, "failing compareAndExchangeRelease float value");
+            assertEquals(1.0f, x, "failing compareAndExchangeRelease float value");
         }
 
         {
@@ -433,14 +431,14 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 2.0f, "success weakCompareAndSetPlain float value");
+            assertEquals(2.0f, x, "success weakCompareAndSetPlain float value");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(1.0f, 3.0f);
             assertEquals(success, false, "failing weakCompareAndSetPlain float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 2.0f, "failing weakCompareAndSetPlain float value");
+            assertEquals(2.0f, x, "failing weakCompareAndSetPlain float value");
         }
 
         {
@@ -452,7 +450,7 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 1.0f, "success weakCompareAndSetAcquire float");
+            assertEquals(1.0f, x, "success weakCompareAndSetAcquire float");
         }
 
         {
@@ -460,7 +458,7 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
             boolean success = (boolean) mh.invokeExact(2.0f, 3.0f);
             assertEquals(success, false, "failing weakCompareAndSetAcquire float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 1.0f, "failing weakCompareAndSetAcquire float value");
+            assertEquals(1.0f, x, "failing weakCompareAndSetAcquire float value");
         }
 
         {
@@ -472,14 +470,14 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 2.0f, "success weakCompareAndSetRelease float");
+            assertEquals(2.0f, x, "success weakCompareAndSetRelease float");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(1.0f, 3.0f);
             assertEquals(success, false, "failing weakCompareAndSetRelease float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 2.0f, "failing weakCompareAndSetRelease float value");
+            assertEquals(2.0f, x, "failing weakCompareAndSetRelease float value");
         }
 
         {
@@ -491,14 +489,14 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 1.0f, "success weakCompareAndSet float");
+            assertEquals(1.0f, x, "success weakCompareAndSet float");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(2.0f, 3.0f);
             assertEquals(success, false, "failing weakCompareAndSet float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 1.0f, "failing weakCompareAndSetRe float value");
+            assertEquals(1.0f, x, "failing weakCompareAndSetRe float value");
         }
 
         // Compare set and get
@@ -506,9 +504,9 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(1.0f);
 
             float o = (float) hs.get(TestAccessMode.GET_AND_SET).invokeExact(2.0f);
-            assertEquals(o, 1.0f, "getAndSet float");
+            assertEquals(1.0f, o, "getAndSet float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 2.0f, "getAndSet float value");
+            assertEquals(2.0f, x, "getAndSet float value");
         }
 
         // Compare set and get
@@ -516,9 +514,9 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(1.0f);
 
             float o = (float) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(2.0f);
-            assertEquals(o, 1.0f, "getAndSetAcquire float");
+            assertEquals(1.0f, o, "getAndSetAcquire float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 2.0f, "getAndSetAcquire float value");
+            assertEquals(2.0f, x, "getAndSetAcquire float value");
         }
 
         // Compare set and get
@@ -526,9 +524,9 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(1.0f);
 
             float o = (float) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(2.0f);
-            assertEquals(o, 1.0f, "getAndSetRelease float");
+            assertEquals(1.0f, o, "getAndSetRelease float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 2.0f, "getAndSetRelease float value");
+            assertEquals(2.0f, x, "getAndSetRelease float value");
         }
 
         // get and add, add and get
@@ -536,27 +534,27 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(1.0f);
 
             float o = (float) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(2.0f);
-            assertEquals(o, 1.0f, "getAndAdd float");
+            assertEquals(1.0f, o, "getAndAdd float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (float)(1.0f + 2.0f), "getAndAdd float value");
+            assertEquals((float)(1.0f + 2.0f), x, "getAndAdd float value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(1.0f);
 
             float o = (float) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(2.0f);
-            assertEquals(o, 1.0f, "getAndAddAcquire float");
+            assertEquals(1.0f, o, "getAndAddAcquire float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (float)(1.0f + 2.0f), "getAndAddAcquire float value");
+            assertEquals((float)(1.0f + 2.0f), x, "getAndAddAcquire float value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(1.0f);
 
             float o = (float) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(2.0f);
-            assertEquals(o, 1.0f, "getAndAddRelease float");
+            assertEquals(1.0f, o, "getAndAddRelease float");
             float x = (float) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (float)(1.0f + 2.0f), "getAndAddRelease float value");
+            assertEquals((float)(1.0f + 2.0f), x, "getAndAddRelease float value");
         }
 
     }
@@ -580,7 +578,7 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0f);
                 float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 1.0f, "get float value");
+                assertEquals(1.0f, x, "get float value");
             }
 
 
@@ -588,21 +586,21 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
             {
                 hs.get(TestAccessMode.SET_VOLATILE).invokeExact(array, i, 2.0f);
                 float x = (float) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(array, i);
-                assertEquals(x, 2.0f, "setVolatile float value");
+                assertEquals(2.0f, x, "setVolatile float value");
             }
 
             // Lazy
             {
                 hs.get(TestAccessMode.SET_RELEASE).invokeExact(array, i, 1.0f);
                 float x = (float) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(array, i);
-                assertEquals(x, 1.0f, "setRelease float value");
+                assertEquals(1.0f, x, "setRelease float value");
             }
 
             // Opaque
             {
                 hs.get(TestAccessMode.SET_OPAQUE).invokeExact(array, i, 2.0f);
                 float x = (float) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(array, i);
-                assertEquals(x, 2.0f, "setOpaque float value");
+                assertEquals(2.0f, x, "setOpaque float value");
             }
 
             hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0f);
@@ -612,56 +610,56 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
                 boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, 1.0f, 2.0f);
                 assertEquals(r, true, "success compareAndSet float");
                 float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 2.0f, "success compareAndSet float value");
+                assertEquals(2.0f, x, "success compareAndSet float value");
             }
 
             {
                 boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, 1.0f, 3.0f);
                 assertEquals(r, false, "failing compareAndSet float");
                 float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 2.0f, "failing compareAndSet float value");
+                assertEquals(2.0f, x, "failing compareAndSet float value");
             }
 
             {
                 float r = (float) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(array, i, 2.0f, 1.0f);
                 assertEquals(r, 2.0f, "success compareAndExchange float");
                 float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 1.0f, "success compareAndExchange float value");
+                assertEquals(1.0f, x, "success compareAndExchange float value");
             }
 
             {
                 float r = (float) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(array, i, 2.0f, 3.0f);
                 assertEquals(r, 1.0f, "failing compareAndExchange float");
                 float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 1.0f, "failing compareAndExchange float value");
+                assertEquals(1.0f, x, "failing compareAndExchange float value");
             }
 
             {
                 float r = (float) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, 1.0f, 2.0f);
                 assertEquals(r, 1.0f, "success compareAndExchangeAcquire float");
                 float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 2.0f, "success compareAndExchangeAcquire float value");
+                assertEquals(2.0f, x, "success compareAndExchangeAcquire float value");
             }
 
             {
                 float r = (float) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, 1.0f, 3.0f);
                 assertEquals(r, 2.0f, "failing compareAndExchangeAcquire float");
                 float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 2.0f, "failing compareAndExchangeAcquire float value");
+                assertEquals(2.0f, x, "failing compareAndExchangeAcquire float value");
             }
 
             {
                 float r = (float) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, 2.0f, 1.0f);
                 assertEquals(r, 2.0f, "success compareAndExchangeRelease float");
                 float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 1.0f, "success compareAndExchangeRelease float value");
+                assertEquals(1.0f, x, "success compareAndExchangeRelease float value");
             }
 
             {
                 float r = (float) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, 2.0f, 3.0f);
                 assertEquals(r, 1.0f, "failing compareAndExchangeRelease float");
                 float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 1.0f, "failing compareAndExchangeRelease float value");
+                assertEquals(1.0f, x, "failing compareAndExchangeRelease float value");
             }
 
             {
@@ -673,14 +671,14 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetPlain float");
                 float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 2.0f, "success weakCompareAndSetPlain float value");
+                assertEquals(2.0f, x, "success weakCompareAndSetPlain float value");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, 1.0f, 3.0f);
                 assertEquals(success, false, "failing weakCompareAndSetPlain float");
                 float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 2.0f, "failing weakCompareAndSetPlain float value");
+                assertEquals(2.0f, x, "failing weakCompareAndSetPlain float value");
             }
 
             {
@@ -692,14 +690,14 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetAcquire float");
                 float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 1.0f, "success weakCompareAndSetAcquire float");
+                assertEquals(1.0f, x, "success weakCompareAndSetAcquire float");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, 2.0f, 3.0f);
                 assertEquals(success, false, "failing weakCompareAndSetAcquire float");
                 float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 1.0f, "failing weakCompareAndSetAcquire float value");
+                assertEquals(1.0f, x, "failing weakCompareAndSetAcquire float value");
             }
 
             {
@@ -711,14 +709,14 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetRelease float");
                 float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 2.0f, "success weakCompareAndSetRelease float");
+                assertEquals(2.0f, x, "success weakCompareAndSetRelease float");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, 1.0f, 3.0f);
                 assertEquals(success, false, "failing weakCompareAndSetAcquire float");
                 float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 2.0f, "failing weakCompareAndSetAcquire float value");
+                assertEquals(2.0f, x, "failing weakCompareAndSetAcquire float value");
             }
 
             {
@@ -730,14 +728,14 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSet float");
                 float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 1.0f, "success weakCompareAndSet float");
+                assertEquals(1.0f, x, "success weakCompareAndSet float");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 2.0f, 3.0f);
                 assertEquals(success, false, "failing weakCompareAndSet float");
                 float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 1.0f, "failing weakCompareAndSet float value");
+                assertEquals(1.0f, x, "failing weakCompareAndSet float value");
             }
 
             // Compare set and get
@@ -745,27 +743,27 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0f);
 
                 float o = (float) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, 2.0f);
-                assertEquals(o, 1.0f, "getAndSet float");
+                assertEquals(1.0f, o, "getAndSet float");
                 float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 2.0f, "getAndSet float value");
+                assertEquals(2.0f, x, "getAndSet float value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0f);
 
                 float o = (float) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, 2.0f);
-                assertEquals(o, 1.0f, "getAndSetAcquire float");
+                assertEquals(1.0f, o, "getAndSetAcquire float");
                 float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 2.0f, "getAndSetAcquire float value");
+                assertEquals(2.0f, x, "getAndSetAcquire float value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0f);
 
                 float o = (float) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, 2.0f);
-                assertEquals(o, 1.0f, "getAndSetRelease float");
+                assertEquals(1.0f, o, "getAndSetRelease float");
                 float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 2.0f, "getAndSetRelease float value");
+                assertEquals(2.0f, x, "getAndSetRelease float value");
             }
 
             // get and add, add and get
@@ -773,27 +771,27 @@ public class VarHandleTestMethodHandleAccessFloat extends VarHandleBaseTest {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0f);
 
                 float o = (float) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, 2.0f);
-                assertEquals(o, 1.0f, "getAndAdd float");
+                assertEquals(1.0f, o, "getAndAdd float");
                 float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (float)(1.0f + 2.0f), "getAndAdd float value");
+                assertEquals((float)(1.0f + 2.0f), x, "getAndAdd float value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0f);
 
                 float o = (float) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, 2.0f);
-                assertEquals(o, 1.0f, "getAndAddAcquire float");
+                assertEquals(1.0f, o, "getAndAddAcquire float");
                 float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (float)(1.0f + 2.0f), "getAndAddAcquire float value");
+                assertEquals((float)(1.0f + 2.0f), x, "getAndAddAcquire float value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0f);
 
                 float o = (float) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, 2.0f);
-                assertEquals(o, 1.0f, "getAndAddRelease float");
+                assertEquals(1.0f, o, "getAndAddRelease float");
                 float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (float)(1.0f + 2.0f), "getAndAddRelease float value");
+                assertEquals((float)(1.0f + 2.0f), x, "getAndAddRelease float value");
             }
 
         }
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java
index d8558e0b070..920d8453bab 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,22 +25,22 @@
  * @test
  * @comment Set CompileThresholdScaling to 0.1 so that the warmup loop sets to 2000 iterations
  *          to hit compilation thresholds
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 VarHandleTestMethodHandleAccessInt
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 VarHandleTestMethodHandleAccessInt
  */
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
     static final int static_final_v = 0x01234567;
 
@@ -60,7 +60,7 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
 
     VarHandle vhArray;
 
-    @BeforeClass
+    @BeforeAll
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
                 VarHandleTestMethodHandleAccessInt.class, "final_v", int.class);
@@ -77,8 +77,6 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
         vhArray = MethodHandles.arrayElementVarHandle(int[].class);
     }
 
-
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -111,7 +109,8 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -120,13 +119,12 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
         }
     }
 
-
     static void testInstanceField(VarHandleTestMethodHandleAccessInt recv, Handles hs) throws Throwable {
         // Plain
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567);
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0x01234567, "set int value");
+            assertEquals(0x01234567, x, "set int value");
         }
 
 
@@ -134,21 +132,21 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
         {
             hs.get(TestAccessMode.SET_VOLATILE).invokeExact(recv, 0x89ABCDEF);
             int x = (int) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(recv);
-            assertEquals(x, 0x89ABCDEF, "setVolatile int value");
+            assertEquals(0x89ABCDEF, x, "setVolatile int value");
         }
 
         // Lazy
         {
             hs.get(TestAccessMode.SET_RELEASE).invokeExact(recv, 0x01234567);
             int x = (int) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(recv);
-            assertEquals(x, 0x01234567, "setRelease int value");
+            assertEquals(0x01234567, x, "setRelease int value");
         }
 
         // Opaque
         {
             hs.get(TestAccessMode.SET_OPAQUE).invokeExact(recv, 0x89ABCDEF);
             int x = (int) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(recv);
-            assertEquals(x, 0x89ABCDEF, "setOpaque int value");
+            assertEquals(0x89ABCDEF, x, "setOpaque int value");
         }
 
         hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567);
@@ -158,56 +156,56 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, 0x01234567, 0x89ABCDEF);
             assertEquals(r, true, "success compareAndSet int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0x89ABCDEF, "success compareAndSet int value");
+            assertEquals(0x89ABCDEF, x, "success compareAndSet int value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, 0x01234567, 0xCAFEBABE);
             assertEquals(r, false, "failing compareAndSet int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0x89ABCDEF, "failing compareAndSet int value");
+            assertEquals(0x89ABCDEF, x, "failing compareAndSet int value");
         }
 
         {
             int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(recv, 0x89ABCDEF, 0x01234567);
             assertEquals(r, 0x89ABCDEF, "success compareAndExchange int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0x01234567, "success compareAndExchange int value");
+            assertEquals(0x01234567, x, "success compareAndExchange int value");
         }
 
         {
             int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(recv, 0x89ABCDEF, 0xCAFEBABE);
             assertEquals(r, 0x01234567, "failing compareAndExchange int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0x01234567, "failing compareAndExchange int value");
+            assertEquals(0x01234567, x, "failing compareAndExchange int value");
         }
 
         {
             int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, 0x01234567, 0x89ABCDEF);
             assertEquals(r, 0x01234567, "success compareAndExchangeAcquire int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0x89ABCDEF, "success compareAndExchangeAcquire int value");
+            assertEquals(0x89ABCDEF, x, "success compareAndExchangeAcquire int value");
         }
 
         {
             int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, 0x01234567, 0xCAFEBABE);
             assertEquals(r, 0x89ABCDEF, "failing compareAndExchangeAcquire int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0x89ABCDEF, "failing compareAndExchangeAcquire int value");
+            assertEquals(0x89ABCDEF, x, "failing compareAndExchangeAcquire int value");
         }
 
         {
             int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, 0x89ABCDEF, 0x01234567);
             assertEquals(r, 0x89ABCDEF, "success compareAndExchangeRelease int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0x01234567, "success compareAndExchangeRelease int value");
+            assertEquals(0x01234567, x, "success compareAndExchangeRelease int value");
         }
 
         {
             int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, 0x89ABCDEF, 0xCAFEBABE);
             assertEquals(r, 0x01234567, "failing compareAndExchangeRelease int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0x01234567, "failing compareAndExchangeRelease int value");
+            assertEquals(0x01234567, x, "failing compareAndExchangeRelease int value");
         }
 
         {
@@ -219,14 +217,14 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0x89ABCDEF, "success weakCompareAndSetPlain int value");
+            assertEquals(0x89ABCDEF, x, "success weakCompareAndSetPlain int value");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, 0x01234567, 0xCAFEBABE);
             assertEquals(success, false, "failing weakCompareAndSetPlain int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0x89ABCDEF, "failing weakCompareAndSetPlain int value");
+            assertEquals(0x89ABCDEF, x, "failing weakCompareAndSetPlain int value");
         }
 
         {
@@ -238,14 +236,14 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0x01234567, "success weakCompareAndSetAcquire int");
+            assertEquals(0x01234567, x, "success weakCompareAndSetAcquire int");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, 0x89ABCDEF, 0xCAFEBABE);
             assertEquals(success, false, "failing weakCompareAndSetAcquire int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0x01234567, "failing weakCompareAndSetAcquire int value");
+            assertEquals(0x01234567, x, "failing weakCompareAndSetAcquire int value");
         }
 
         {
@@ -257,14 +255,14 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0x89ABCDEF, "success weakCompareAndSetRelease int");
+            assertEquals(0x89ABCDEF, x, "success weakCompareAndSetRelease int");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, 0x01234567, 0xCAFEBABE);
             assertEquals(success, false, "failing weakCompareAndSetRelease int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0x89ABCDEF, "failing weakCompareAndSetRelease int value");
+            assertEquals(0x89ABCDEF, x, "failing weakCompareAndSetRelease int value");
         }
 
         {
@@ -276,22 +274,22 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0x01234567, "success weakCompareAndSet int");
+            assertEquals(0x01234567, x, "success weakCompareAndSet int");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 0x89ABCDEF, 0xCAFEBABE);
             assertEquals(success, false, "failing weakCompareAndSet int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0x01234567, "failing weakCompareAndSet int value");
+            assertEquals(0x01234567, x, "failing weakCompareAndSet int value");
         }
 
         // Compare set and get
         {
             int o = (int) hs.get(TestAccessMode.GET_AND_SET).invokeExact(recv, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndSet int");
+            assertEquals(0x01234567, o, "getAndSet int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0x89ABCDEF, "getAndSet int value");
+            assertEquals(0x89ABCDEF, x, "getAndSet int value");
         }
 
         // get and add, add and get
@@ -299,27 +297,27 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndAdd int");
+            assertEquals(0x01234567, o, "getAndAdd int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAdd int value");
+            assertEquals((int)(0x01234567 + 0x89ABCDEF), x, "getAndAdd int value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndAddAcquire int");
+            assertEquals(0x01234567, o, "getAndAddAcquire int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddAcquire int value");
+            assertEquals((int)(0x01234567 + 0x89ABCDEF), x, "getAndAddAcquire int value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndAddRelease int");
+            assertEquals(0x01234567, o, "getAndAddRelease int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddRelease int value");
+            assertEquals((int)(0x01234567 + 0x89ABCDEF), x, "getAndAddRelease int value");
         }
 
         // get and bitwise or
@@ -327,27 +325,27 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(recv, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseOr int");
+            assertEquals(0x01234567, o, "getAndBitwiseOr int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOr int value");
+            assertEquals((int)(0x01234567 | 0x89ABCDEF), x, "getAndBitwiseOr int value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(recv, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseOrAcquire int");
+            assertEquals(0x01234567, o, "getAndBitwiseOrAcquire int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrAcquire int value");
+            assertEquals((int)(0x01234567 | 0x89ABCDEF), x, "getAndBitwiseOrAcquire int value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(recv, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseOrRelease int");
+            assertEquals(0x01234567, o, "getAndBitwiseOrRelease int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrRelease int value");
+            assertEquals((int)(0x01234567 | 0x89ABCDEF), x, "getAndBitwiseOrRelease int value");
         }
 
         // get and bitwise and
@@ -355,27 +353,27 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(recv, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseAnd int");
+            assertEquals(0x01234567, o, "getAndBitwiseAnd int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAnd int value");
+            assertEquals((int)(0x01234567 & 0x89ABCDEF), x, "getAndBitwiseAnd int value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(recv, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseAndAcquire int");
+            assertEquals(0x01234567, o, "getAndBitwiseAndAcquire int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndAcquire int value");
+            assertEquals((int)(0x01234567 & 0x89ABCDEF), x, "getAndBitwiseAndAcquire int value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(recv, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseAndRelease int");
+            assertEquals(0x01234567, o, "getAndBitwiseAndRelease int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndRelease int value");
+            assertEquals((int)(0x01234567 & 0x89ABCDEF), x, "getAndBitwiseAndRelease int value");
         }
 
         // get and bitwise xor
@@ -383,27 +381,27 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(recv, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseXor int");
+            assertEquals(0x01234567, o, "getAndBitwiseXor int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXor int value");
+            assertEquals((int)(0x01234567 ^ 0x89ABCDEF), x, "getAndBitwiseXor int value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(recv, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseXorAcquire int");
+            assertEquals(0x01234567, o, "getAndBitwiseXorAcquire int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorAcquire int value");
+            assertEquals((int)(0x01234567 ^ 0x89ABCDEF), x, "getAndBitwiseXorAcquire int value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(recv, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseXorRelease int");
+            assertEquals(0x01234567, o, "getAndBitwiseXorRelease int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorRelease int value");
+            assertEquals((int)(0x01234567 ^ 0x89ABCDEF), x, "getAndBitwiseXorRelease int value");
         }
     }
 
@@ -418,7 +416,7 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
         {
             hs.get(TestAccessMode.SET).invokeExact(0x01234567);
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0x01234567, "set int value");
+            assertEquals(0x01234567, x, "set int value");
         }
 
 
@@ -426,21 +424,21 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
         {
             hs.get(TestAccessMode.SET_VOLATILE).invokeExact(0x89ABCDEF);
             int x = (int) hs.get(TestAccessMode.GET_VOLATILE).invokeExact();
-            assertEquals(x, 0x89ABCDEF, "setVolatile int value");
+            assertEquals(0x89ABCDEF, x, "setVolatile int value");
         }
 
         // Lazy
         {
             hs.get(TestAccessMode.SET_RELEASE).invokeExact(0x01234567);
             int x = (int) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact();
-            assertEquals(x, 0x01234567, "setRelease int value");
+            assertEquals(0x01234567, x, "setRelease int value");
         }
 
         // Opaque
         {
             hs.get(TestAccessMode.SET_OPAQUE).invokeExact(0x89ABCDEF);
             int x = (int) hs.get(TestAccessMode.GET_OPAQUE).invokeExact();
-            assertEquals(x, 0x89ABCDEF, "setOpaque int value");
+            assertEquals(0x89ABCDEF, x, "setOpaque int value");
         }
 
         hs.get(TestAccessMode.SET).invokeExact(0x01234567);
@@ -450,56 +448,56 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(0x01234567, 0x89ABCDEF);
             assertEquals(r, true, "success compareAndSet int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0x89ABCDEF, "success compareAndSet int value");
+            assertEquals(0x89ABCDEF, x, "success compareAndSet int value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(0x01234567, 0xCAFEBABE);
             assertEquals(r, false, "failing compareAndSet int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0x89ABCDEF, "failing compareAndSet int value");
+            assertEquals(0x89ABCDEF, x, "failing compareAndSet int value");
         }
 
         {
             int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(0x89ABCDEF, 0x01234567);
             assertEquals(r, 0x89ABCDEF, "success compareAndExchange int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0x01234567, "success compareAndExchange int value");
+            assertEquals(0x01234567, x, "success compareAndExchange int value");
         }
 
         {
             int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(0x89ABCDEF, 0xCAFEBABE);
             assertEquals(r, 0x01234567, "failing compareAndExchange int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0x01234567, "failing compareAndExchange int value");
+            assertEquals(0x01234567, x, "failing compareAndExchange int value");
         }
 
         {
             int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(0x01234567, 0x89ABCDEF);
             assertEquals(r, 0x01234567, "success compareAndExchangeAcquire int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0x89ABCDEF, "success compareAndExchangeAcquire int value");
+            assertEquals(0x89ABCDEF, x, "success compareAndExchangeAcquire int value");
         }
 
         {
             int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(0x01234567, 0xCAFEBABE);
             assertEquals(r, 0x89ABCDEF, "failing compareAndExchangeAcquire int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0x89ABCDEF, "failing compareAndExchangeAcquire int value");
+            assertEquals(0x89ABCDEF, x, "failing compareAndExchangeAcquire int value");
         }
 
         {
             int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(0x89ABCDEF, 0x01234567);
             assertEquals(r, 0x89ABCDEF, "success compareAndExchangeRelease int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0x01234567, "success compareAndExchangeRelease int value");
+            assertEquals(0x01234567, x, "success compareAndExchangeRelease int value");
         }
 
         {
             int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(0x89ABCDEF, 0xCAFEBABE);
             assertEquals(r, 0x01234567, "failing compareAndExchangeRelease int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0x01234567, "failing compareAndExchangeRelease int value");
+            assertEquals(0x01234567, x, "failing compareAndExchangeRelease int value");
         }
 
         {
@@ -511,14 +509,14 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0x89ABCDEF, "success weakCompareAndSetPlain int value");
+            assertEquals(0x89ABCDEF, x, "success weakCompareAndSetPlain int value");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(0x01234567, 0xCAFEBABE);
             assertEquals(success, false, "failing weakCompareAndSetPlain int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0x89ABCDEF, "failing weakCompareAndSetPlain int value");
+            assertEquals(0x89ABCDEF, x, "failing weakCompareAndSetPlain int value");
         }
 
         {
@@ -530,7 +528,7 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0x01234567, "success weakCompareAndSetAcquire int");
+            assertEquals(0x01234567, x, "success weakCompareAndSetAcquire int");
         }
 
         {
@@ -538,7 +536,7 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
             boolean success = (boolean) mh.invokeExact(0x89ABCDEF, 0xCAFEBABE);
             assertEquals(success, false, "failing weakCompareAndSetAcquire int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0x01234567, "failing weakCompareAndSetAcquire int value");
+            assertEquals(0x01234567, x, "failing weakCompareAndSetAcquire int value");
         }
 
         {
@@ -550,14 +548,14 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0x89ABCDEF, "success weakCompareAndSetRelease int");
+            assertEquals(0x89ABCDEF, x, "success weakCompareAndSetRelease int");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(0x01234567, 0xCAFEBABE);
             assertEquals(success, false, "failing weakCompareAndSetRelease int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0x89ABCDEF, "failing weakCompareAndSetRelease int value");
+            assertEquals(0x89ABCDEF, x, "failing weakCompareAndSetRelease int value");
         }
 
         {
@@ -569,14 +567,14 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0x01234567, "success weakCompareAndSet int");
+            assertEquals(0x01234567, x, "success weakCompareAndSet int");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(0x89ABCDEF, 0xCAFEBABE);
             assertEquals(success, false, "failing weakCompareAndSet int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0x01234567, "failing weakCompareAndSetRe int value");
+            assertEquals(0x01234567, x, "failing weakCompareAndSetRe int value");
         }
 
         // Compare set and get
@@ -584,9 +582,9 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_SET).invokeExact(0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndSet int");
+            assertEquals(0x01234567, o, "getAndSet int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0x89ABCDEF, "getAndSet int value");
+            assertEquals(0x89ABCDEF, x, "getAndSet int value");
         }
 
         // Compare set and get
@@ -594,9 +592,9 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndSetAcquire int");
+            assertEquals(0x01234567, o, "getAndSetAcquire int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0x89ABCDEF, "getAndSetAcquire int value");
+            assertEquals(0x89ABCDEF, x, "getAndSetAcquire int value");
         }
 
         // Compare set and get
@@ -604,9 +602,9 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndSetRelease int");
+            assertEquals(0x01234567, o, "getAndSetRelease int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0x89ABCDEF, "getAndSetRelease int value");
+            assertEquals(0x89ABCDEF, x, "getAndSetRelease int value");
         }
 
         // get and add, add and get
@@ -614,27 +612,27 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndAdd int");
+            assertEquals(0x01234567, o, "getAndAdd int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAdd int value");
+            assertEquals((int)(0x01234567 + 0x89ABCDEF), x, "getAndAdd int value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndAddAcquire int");
+            assertEquals(0x01234567, o, "getAndAddAcquire int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddAcquire int value");
+            assertEquals((int)(0x01234567 + 0x89ABCDEF), x, "getAndAddAcquire int value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndAddRelease int");
+            assertEquals(0x01234567, o, "getAndAddRelease int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddRelease int value");
+            assertEquals((int)(0x01234567 + 0x89ABCDEF), x, "getAndAddRelease int value");
         }
 
         // get and bitwise or
@@ -642,27 +640,27 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseOr int");
+            assertEquals(0x01234567, o, "getAndBitwiseOr int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOr int value");
+            assertEquals((int)(0x01234567 | 0x89ABCDEF), x, "getAndBitwiseOr int value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseOrAcquire int");
+            assertEquals(0x01234567, o, "getAndBitwiseOrAcquire int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrAcquire int value");
+            assertEquals((int)(0x01234567 | 0x89ABCDEF), x, "getAndBitwiseOrAcquire int value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseOrRelease int");
+            assertEquals(0x01234567, o, "getAndBitwiseOrRelease int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrRelease int value");
+            assertEquals((int)(0x01234567 | 0x89ABCDEF), x, "getAndBitwiseOrRelease int value");
         }
 
         // get and bitwise and
@@ -670,27 +668,27 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseAnd int");
+            assertEquals(0x01234567, o, "getAndBitwiseAnd int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAnd int value");
+            assertEquals((int)(0x01234567 & 0x89ABCDEF), x, "getAndBitwiseAnd int value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseAndAcquire int");
+            assertEquals(0x01234567, o, "getAndBitwiseAndAcquire int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndAcquire int value");
+            assertEquals((int)(0x01234567 & 0x89ABCDEF), x, "getAndBitwiseAndAcquire int value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseAndRelease int");
+            assertEquals(0x01234567, o, "getAndBitwiseAndRelease int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndRelease int value");
+            assertEquals((int)(0x01234567 & 0x89ABCDEF), x, "getAndBitwiseAndRelease int value");
         }
 
         // get and bitwise xor
@@ -698,27 +696,27 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseXor int");
+            assertEquals(0x01234567, o, "getAndBitwiseXor int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXor int value");
+            assertEquals((int)(0x01234567 ^ 0x89ABCDEF), x, "getAndBitwiseXor int value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseXorAcquire int");
+            assertEquals(0x01234567, o, "getAndBitwiseXorAcquire int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorAcquire int value");
+            assertEquals((int)(0x01234567 ^ 0x89ABCDEF), x, "getAndBitwiseXorAcquire int value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseXorRelease int");
+            assertEquals(0x01234567, o, "getAndBitwiseXorRelease int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorRelease int value");
+            assertEquals((int)(0x01234567 ^ 0x89ABCDEF), x, "getAndBitwiseXorRelease int value");
         }
     }
 
@@ -736,7 +734,7 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
                 int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0x01234567, "get int value");
+                assertEquals(0x01234567, x, "get int value");
             }
 
 
@@ -744,21 +742,21 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
             {
                 hs.get(TestAccessMode.SET_VOLATILE).invokeExact(array, i, 0x89ABCDEF);
                 int x = (int) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(array, i);
-                assertEquals(x, 0x89ABCDEF, "setVolatile int value");
+                assertEquals(0x89ABCDEF, x, "setVolatile int value");
             }
 
             // Lazy
             {
                 hs.get(TestAccessMode.SET_RELEASE).invokeExact(array, i, 0x01234567);
                 int x = (int) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(array, i);
-                assertEquals(x, 0x01234567, "setRelease int value");
+                assertEquals(0x01234567, x, "setRelease int value");
             }
 
             // Opaque
             {
                 hs.get(TestAccessMode.SET_OPAQUE).invokeExact(array, i, 0x89ABCDEF);
                 int x = (int) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(array, i);
-                assertEquals(x, 0x89ABCDEF, "setOpaque int value");
+                assertEquals(0x89ABCDEF, x, "setOpaque int value");
             }
 
             hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
@@ -768,56 +766,56 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
                 boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, 0x01234567, 0x89ABCDEF);
                 assertEquals(r, true, "success compareAndSet int");
                 int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0x89ABCDEF, "success compareAndSet int value");
+                assertEquals(0x89ABCDEF, x, "success compareAndSet int value");
             }
 
             {
                 boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, 0x01234567, 0xCAFEBABE);
                 assertEquals(r, false, "failing compareAndSet int");
                 int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0x89ABCDEF, "failing compareAndSet int value");
+                assertEquals(0x89ABCDEF, x, "failing compareAndSet int value");
             }
 
             {
                 int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(array, i, 0x89ABCDEF, 0x01234567);
                 assertEquals(r, 0x89ABCDEF, "success compareAndExchange int");
                 int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0x01234567, "success compareAndExchange int value");
+                assertEquals(0x01234567, x, "success compareAndExchange int value");
             }
 
             {
                 int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(array, i, 0x89ABCDEF, 0xCAFEBABE);
                 assertEquals(r, 0x01234567, "failing compareAndExchange int");
                 int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0x01234567, "failing compareAndExchange int value");
+                assertEquals(0x01234567, x, "failing compareAndExchange int value");
             }
 
             {
                 int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, 0x01234567, 0x89ABCDEF);
                 assertEquals(r, 0x01234567, "success compareAndExchangeAcquire int");
                 int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0x89ABCDEF, "success compareAndExchangeAcquire int value");
+                assertEquals(0x89ABCDEF, x, "success compareAndExchangeAcquire int value");
             }
 
             {
                 int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, 0x01234567, 0xCAFEBABE);
                 assertEquals(r, 0x89ABCDEF, "failing compareAndExchangeAcquire int");
                 int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0x89ABCDEF, "failing compareAndExchangeAcquire int value");
+                assertEquals(0x89ABCDEF, x, "failing compareAndExchangeAcquire int value");
             }
 
             {
                 int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, 0x89ABCDEF, 0x01234567);
                 assertEquals(r, 0x89ABCDEF, "success compareAndExchangeRelease int");
                 int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0x01234567, "success compareAndExchangeRelease int value");
+                assertEquals(0x01234567, x, "success compareAndExchangeRelease int value");
             }
 
             {
                 int r = (int) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, 0x89ABCDEF, 0xCAFEBABE);
                 assertEquals(r, 0x01234567, "failing compareAndExchangeRelease int");
                 int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0x01234567, "failing compareAndExchangeRelease int value");
+                assertEquals(0x01234567, x, "failing compareAndExchangeRelease int value");
             }
 
             {
@@ -829,14 +827,14 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetPlain int");
                 int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0x89ABCDEF, "success weakCompareAndSetPlain int value");
+                assertEquals(0x89ABCDEF, x, "success weakCompareAndSetPlain int value");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, 0x01234567, 0xCAFEBABE);
                 assertEquals(success, false, "failing weakCompareAndSetPlain int");
                 int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0x89ABCDEF, "failing weakCompareAndSetPlain int value");
+                assertEquals(0x89ABCDEF, x, "failing weakCompareAndSetPlain int value");
             }
 
             {
@@ -848,14 +846,14 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetAcquire int");
                 int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0x01234567, "success weakCompareAndSetAcquire int");
+                assertEquals(0x01234567, x, "success weakCompareAndSetAcquire int");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, 0x89ABCDEF, 0xCAFEBABE);
                 assertEquals(success, false, "failing weakCompareAndSetAcquire int");
                 int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0x01234567, "failing weakCompareAndSetAcquire int value");
+                assertEquals(0x01234567, x, "failing weakCompareAndSetAcquire int value");
             }
 
             {
@@ -867,14 +865,14 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetRelease int");
                 int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0x89ABCDEF, "success weakCompareAndSetRelease int");
+                assertEquals(0x89ABCDEF, x, "success weakCompareAndSetRelease int");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, 0x01234567, 0xCAFEBABE);
                 assertEquals(success, false, "failing weakCompareAndSetAcquire int");
                 int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0x89ABCDEF, "failing weakCompareAndSetAcquire int value");
+                assertEquals(0x89ABCDEF, x, "failing weakCompareAndSetAcquire int value");
             }
 
             {
@@ -886,14 +884,14 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSet int");
                 int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0x01234567, "success weakCompareAndSet int");
+                assertEquals(0x01234567, x, "success weakCompareAndSet int");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 0x89ABCDEF, 0xCAFEBABE);
                 assertEquals(success, false, "failing weakCompareAndSet int");
                 int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0x01234567, "failing weakCompareAndSet int value");
+                assertEquals(0x01234567, x, "failing weakCompareAndSet int value");
             }
 
             // Compare set and get
@@ -901,27 +899,27 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
 
                 int o = (int) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, 0x89ABCDEF);
-                assertEquals(o, 0x01234567, "getAndSet int");
+                assertEquals(0x01234567, o, "getAndSet int");
                 int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0x89ABCDEF, "getAndSet int value");
+                assertEquals(0x89ABCDEF, x, "getAndSet int value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
 
                 int o = (int) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, 0x89ABCDEF);
-                assertEquals(o, 0x01234567, "getAndSetAcquire int");
+                assertEquals(0x01234567, o, "getAndSetAcquire int");
                 int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0x89ABCDEF, "getAndSetAcquire int value");
+                assertEquals(0x89ABCDEF, x, "getAndSetAcquire int value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
 
                 int o = (int) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, 0x89ABCDEF);
-                assertEquals(o, 0x01234567, "getAndSetRelease int");
+                assertEquals(0x01234567, o, "getAndSetRelease int");
                 int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0x89ABCDEF, "getAndSetRelease int value");
+                assertEquals(0x89ABCDEF, x, "getAndSetRelease int value");
             }
 
             // get and add, add and get
@@ -929,27 +927,27 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
 
                 int o = (int) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, 0x89ABCDEF);
-                assertEquals(o, 0x01234567, "getAndAdd int");
+                assertEquals(0x01234567, o, "getAndAdd int");
                 int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAdd int value");
+                assertEquals((int)(0x01234567 + 0x89ABCDEF), x, "getAndAdd int value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
 
                 int o = (int) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, 0x89ABCDEF);
-                assertEquals(o, 0x01234567, "getAndAddAcquire int");
+                assertEquals(0x01234567, o, "getAndAddAcquire int");
                 int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddAcquire int value");
+                assertEquals((int)(0x01234567 + 0x89ABCDEF), x, "getAndAddAcquire int value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
 
                 int o = (int) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, 0x89ABCDEF);
-                assertEquals(o, 0x01234567, "getAndAddRelease int");
+                assertEquals(0x01234567, o, "getAndAddRelease int");
                 int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddRelease int value");
+                assertEquals((int)(0x01234567 + 0x89ABCDEF), x, "getAndAddRelease int value");
             }
 
         // get and bitwise or
@@ -957,27 +955,27 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(array, i, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseOr int");
+            assertEquals(0x01234567, o, "getAndBitwiseOr int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOr int value");
+            assertEquals((int)(0x01234567 | 0x89ABCDEF), x, "getAndBitwiseOr int value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(array, i, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseOrAcquire int");
+            assertEquals(0x01234567, o, "getAndBitwiseOrAcquire int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrAcquire int value");
+            assertEquals((int)(0x01234567 | 0x89ABCDEF), x, "getAndBitwiseOrAcquire int value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(array, i, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseOrRelease int");
+            assertEquals(0x01234567, o, "getAndBitwiseOrRelease int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrRelease int value");
+            assertEquals((int)(0x01234567 | 0x89ABCDEF), x, "getAndBitwiseOrRelease int value");
         }
 
         // get and bitwise and
@@ -985,27 +983,27 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(array, i, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseAnd int");
+            assertEquals(0x01234567, o, "getAndBitwiseAnd int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAnd int value");
+            assertEquals((int)(0x01234567 & 0x89ABCDEF), x, "getAndBitwiseAnd int value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(array, i, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseAndAcquire int");
+            assertEquals(0x01234567, o, "getAndBitwiseAndAcquire int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndAcquire int value");
+            assertEquals((int)(0x01234567 & 0x89ABCDEF), x, "getAndBitwiseAndAcquire int value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(array, i, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseAndRelease int");
+            assertEquals(0x01234567, o, "getAndBitwiseAndRelease int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndRelease int value");
+            assertEquals((int)(0x01234567 & 0x89ABCDEF), x, "getAndBitwiseAndRelease int value");
         }
 
         // get and bitwise xor
@@ -1013,27 +1011,27 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(array, i, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseXor int");
+            assertEquals(0x01234567, o, "getAndBitwiseXor int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXor int value");
+            assertEquals((int)(0x01234567 ^ 0x89ABCDEF), x, "getAndBitwiseXor int value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(array, i, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseXorAcquire int");
+            assertEquals(0x01234567, o, "getAndBitwiseXorAcquire int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorAcquire int value");
+            assertEquals((int)(0x01234567 ^ 0x89ABCDEF), x, "getAndBitwiseXorAcquire int value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567);
 
             int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(array, i, 0x89ABCDEF);
-            assertEquals(o, 0x01234567, "getAndBitwiseXorRelease int");
+            assertEquals(0x01234567, o, "getAndBitwiseXorRelease int");
             int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorRelease int value");
+            assertEquals((int)(0x01234567 ^ 0x89ABCDEF), x, "getAndBitwiseXorRelease int value");
         }
         }
     }
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java
index 0e73063395d..90f6dd12c47 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,22 +25,22 @@
  * @test
  * @comment Set CompileThresholdScaling to 0.1 so that the warmup loop sets to 2000 iterations
  *          to hit compilation thresholds
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 VarHandleTestMethodHandleAccessLong
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 VarHandleTestMethodHandleAccessLong
  */
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
     static final long static_final_v = 0x0123456789ABCDEFL;
 
@@ -60,7 +60,7 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
 
     VarHandle vhArray;
 
-    @BeforeClass
+    @BeforeAll
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
                 VarHandleTestMethodHandleAccessLong.class, "final_v", long.class);
@@ -77,8 +77,6 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
         vhArray = MethodHandles.arrayElementVarHandle(long[].class);
     }
 
-
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -111,7 +109,8 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -120,13 +119,12 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
         }
     }
 
-
     static void testInstanceField(VarHandleTestMethodHandleAccessLong recv, Handles hs) throws Throwable {
         // Plain
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL);
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0x0123456789ABCDEFL, "set long value");
+            assertEquals(0x0123456789ABCDEFL, x, "set long value");
         }
 
 
@@ -134,21 +132,21 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
         {
             hs.get(TestAccessMode.SET_VOLATILE).invokeExact(recv, 0xCAFEBABECAFEBABEL);
             long x = (long) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(recv);
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "setVolatile long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "setVolatile long value");
         }
 
         // Lazy
         {
             hs.get(TestAccessMode.SET_RELEASE).invokeExact(recv, 0x0123456789ABCDEFL);
             long x = (long) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(recv);
-            assertEquals(x, 0x0123456789ABCDEFL, "setRelease long value");
+            assertEquals(0x0123456789ABCDEFL, x, "setRelease long value");
         }
 
         // Opaque
         {
             hs.get(TestAccessMode.SET_OPAQUE).invokeExact(recv, 0xCAFEBABECAFEBABEL);
             long x = (long) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(recv);
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "setOpaque long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "setOpaque long value");
         }
 
         hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL);
@@ -158,56 +156,56 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
             assertEquals(r, true, "success compareAndSet long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "success compareAndSet long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "success compareAndSet long value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, 0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
             assertEquals(r, false, "failing compareAndSet long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "failing compareAndSet long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "failing compareAndSet long value");
         }
 
         {
             long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(recv, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
             assertEquals(r, 0xCAFEBABECAFEBABEL, "success compareAndExchange long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0x0123456789ABCDEFL, "success compareAndExchange long value");
+            assertEquals(0x0123456789ABCDEFL, x, "success compareAndExchange long value");
         }
 
         {
             long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(recv, 0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
             assertEquals(r, 0x0123456789ABCDEFL, "failing compareAndExchange long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0x0123456789ABCDEFL, "failing compareAndExchange long value");
+            assertEquals(0x0123456789ABCDEFL, x, "failing compareAndExchange long value");
         }
 
         {
             long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
             assertEquals(r, 0x0123456789ABCDEFL, "success compareAndExchangeAcquire long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "success compareAndExchangeAcquire long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "success compareAndExchangeAcquire long value");
         }
 
         {
             long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, 0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
             assertEquals(r, 0xCAFEBABECAFEBABEL, "failing compareAndExchangeAcquire long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "failing compareAndExchangeAcquire long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "failing compareAndExchangeAcquire long value");
         }
 
         {
             long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
             assertEquals(r, 0xCAFEBABECAFEBABEL, "success compareAndExchangeRelease long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0x0123456789ABCDEFL, "success compareAndExchangeRelease long value");
+            assertEquals(0x0123456789ABCDEFL, x, "success compareAndExchangeRelease long value");
         }
 
         {
             long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, 0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
             assertEquals(r, 0x0123456789ABCDEFL, "failing compareAndExchangeRelease long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0x0123456789ABCDEFL, "failing compareAndExchangeRelease long value");
+            assertEquals(0x0123456789ABCDEFL, x, "failing compareAndExchangeRelease long value");
         }
 
         {
@@ -219,14 +217,14 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "success weakCompareAndSetPlain long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "success weakCompareAndSetPlain long value");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, 0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
             assertEquals(success, false, "failing weakCompareAndSetPlain long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "failing weakCompareAndSetPlain long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "failing weakCompareAndSetPlain long value");
         }
 
         {
@@ -238,14 +236,14 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0x0123456789ABCDEFL, "success weakCompareAndSetAcquire long");
+            assertEquals(0x0123456789ABCDEFL, x, "success weakCompareAndSetAcquire long");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, 0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
             assertEquals(success, false, "failing weakCompareAndSetAcquire long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0x0123456789ABCDEFL, "failing weakCompareAndSetAcquire long value");
+            assertEquals(0x0123456789ABCDEFL, x, "failing weakCompareAndSetAcquire long value");
         }
 
         {
@@ -257,14 +255,14 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "success weakCompareAndSetRelease long");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "success weakCompareAndSetRelease long");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, 0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
             assertEquals(success, false, "failing weakCompareAndSetRelease long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "failing weakCompareAndSetRelease long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "failing weakCompareAndSetRelease long value");
         }
 
         {
@@ -276,22 +274,22 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0x0123456789ABCDEFL, "success weakCompareAndSet long");
+            assertEquals(0x0123456789ABCDEFL, x, "success weakCompareAndSet long");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
             assertEquals(success, false, "failing weakCompareAndSet long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0x0123456789ABCDEFL, "failing weakCompareAndSet long value");
+            assertEquals(0x0123456789ABCDEFL, x, "failing weakCompareAndSet long value");
         }
 
         // Compare set and get
         {
             long o = (long) hs.get(TestAccessMode.GET_AND_SET).invokeExact(recv, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndSet long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndSet long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSet long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "getAndSet long value");
         }
 
         // get and add, add and get
@@ -299,27 +297,27 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndAdd long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndAdd long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAdd long value");
+            assertEquals((long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), x, "getAndAdd long value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndAddAcquire long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndAddAcquire long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddAcquire long value");
+            assertEquals((long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), x, "getAndAddAcquire long value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndAddRelease long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndAddRelease long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddRelease long value");
+            assertEquals((long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), x, "getAndAddRelease long value");
         }
 
         // get and bitwise or
@@ -327,27 +325,27 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(recv, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOr long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseOr long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOr long value");
+            assertEquals((long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), x, "getAndBitwiseOr long value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(recv, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrAcquire long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseOrAcquire long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrAcquire long value");
+            assertEquals((long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), x, "getAndBitwiseOrAcquire long value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(recv, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrRelease long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseOrRelease long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrRelease long value");
+            assertEquals((long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), x, "getAndBitwiseOrRelease long value");
         }
 
         // get and bitwise and
@@ -355,27 +353,27 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(recv, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAnd long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseAnd long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAnd long value");
+            assertEquals((long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), x, "getAndBitwiseAnd long value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(recv, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndAcquire long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseAndAcquire long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndAcquire long value");
+            assertEquals((long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), x, "getAndBitwiseAndAcquire long value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(recv, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndRelease long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseAndRelease long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndRelease long value");
+            assertEquals((long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), x, "getAndBitwiseAndRelease long value");
         }
 
         // get and bitwise xor
@@ -383,27 +381,27 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(recv, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXor long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseXor long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXor long value");
+            assertEquals((long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), x, "getAndBitwiseXor long value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(recv, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorAcquire long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseXorAcquire long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorAcquire long value");
+            assertEquals((long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), x, "getAndBitwiseXorAcquire long value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(recv, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorRelease long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseXorRelease long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorRelease long value");
+            assertEquals((long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), x, "getAndBitwiseXorRelease long value");
         }
     }
 
@@ -418,7 +416,7 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
         {
             hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0x0123456789ABCDEFL, "set long value");
+            assertEquals(0x0123456789ABCDEFL, x, "set long value");
         }
 
 
@@ -426,21 +424,21 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
         {
             hs.get(TestAccessMode.SET_VOLATILE).invokeExact(0xCAFEBABECAFEBABEL);
             long x = (long) hs.get(TestAccessMode.GET_VOLATILE).invokeExact();
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "setVolatile long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "setVolatile long value");
         }
 
         // Lazy
         {
             hs.get(TestAccessMode.SET_RELEASE).invokeExact(0x0123456789ABCDEFL);
             long x = (long) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact();
-            assertEquals(x, 0x0123456789ABCDEFL, "setRelease long value");
+            assertEquals(0x0123456789ABCDEFL, x, "setRelease long value");
         }
 
         // Opaque
         {
             hs.get(TestAccessMode.SET_OPAQUE).invokeExact(0xCAFEBABECAFEBABEL);
             long x = (long) hs.get(TestAccessMode.GET_OPAQUE).invokeExact();
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "setOpaque long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "setOpaque long value");
         }
 
         hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
@@ -450,56 +448,56 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
             assertEquals(r, true, "success compareAndSet long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "success compareAndSet long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "success compareAndSet long value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
             assertEquals(r, false, "failing compareAndSet long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "failing compareAndSet long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "failing compareAndSet long value");
         }
 
         {
             long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
             assertEquals(r, 0xCAFEBABECAFEBABEL, "success compareAndExchange long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0x0123456789ABCDEFL, "success compareAndExchange long value");
+            assertEquals(0x0123456789ABCDEFL, x, "success compareAndExchange long value");
         }
 
         {
             long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
             assertEquals(r, 0x0123456789ABCDEFL, "failing compareAndExchange long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0x0123456789ABCDEFL, "failing compareAndExchange long value");
+            assertEquals(0x0123456789ABCDEFL, x, "failing compareAndExchange long value");
         }
 
         {
             long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
             assertEquals(r, 0x0123456789ABCDEFL, "success compareAndExchangeAcquire long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "success compareAndExchangeAcquire long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "success compareAndExchangeAcquire long value");
         }
 
         {
             long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
             assertEquals(r, 0xCAFEBABECAFEBABEL, "failing compareAndExchangeAcquire long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "failing compareAndExchangeAcquire long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "failing compareAndExchangeAcquire long value");
         }
 
         {
             long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
             assertEquals(r, 0xCAFEBABECAFEBABEL, "success compareAndExchangeRelease long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0x0123456789ABCDEFL, "success compareAndExchangeRelease long value");
+            assertEquals(0x0123456789ABCDEFL, x, "success compareAndExchangeRelease long value");
         }
 
         {
             long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
             assertEquals(r, 0x0123456789ABCDEFL, "failing compareAndExchangeRelease long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0x0123456789ABCDEFL, "failing compareAndExchangeRelease long value");
+            assertEquals(0x0123456789ABCDEFL, x, "failing compareAndExchangeRelease long value");
         }
 
         {
@@ -511,14 +509,14 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "success weakCompareAndSetPlain long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "success weakCompareAndSetPlain long value");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
             assertEquals(success, false, "failing weakCompareAndSetPlain long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "failing weakCompareAndSetPlain long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "failing weakCompareAndSetPlain long value");
         }
 
         {
@@ -530,7 +528,7 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0x0123456789ABCDEFL, "success weakCompareAndSetAcquire long");
+            assertEquals(0x0123456789ABCDEFL, x, "success weakCompareAndSetAcquire long");
         }
 
         {
@@ -538,7 +536,7 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
             boolean success = (boolean) mh.invokeExact(0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
             assertEquals(success, false, "failing weakCompareAndSetAcquire long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0x0123456789ABCDEFL, "failing weakCompareAndSetAcquire long value");
+            assertEquals(0x0123456789ABCDEFL, x, "failing weakCompareAndSetAcquire long value");
         }
 
         {
@@ -550,14 +548,14 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "success weakCompareAndSetRelease long");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "success weakCompareAndSetRelease long");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
             assertEquals(success, false, "failing weakCompareAndSetRelease long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "failing weakCompareAndSetRelease long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "failing weakCompareAndSetRelease long value");
         }
 
         {
@@ -569,14 +567,14 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0x0123456789ABCDEFL, "success weakCompareAndSet long");
+            assertEquals(0x0123456789ABCDEFL, x, "success weakCompareAndSet long");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
             assertEquals(success, false, "failing weakCompareAndSet long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0x0123456789ABCDEFL, "failing weakCompareAndSetRe long value");
+            assertEquals(0x0123456789ABCDEFL, x, "failing weakCompareAndSetRe long value");
         }
 
         // Compare set and get
@@ -584,9 +582,9 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_SET).invokeExact(0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndSet long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndSet long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSet long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "getAndSet long value");
         }
 
         // Compare set and get
@@ -594,9 +592,9 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndSetAcquire long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndSetAcquire long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetAcquire long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "getAndSetAcquire long value");
         }
 
         // Compare set and get
@@ -604,9 +602,9 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndSetRelease long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndSetRelease long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetRelease long value");
+            assertEquals(0xCAFEBABECAFEBABEL, x, "getAndSetRelease long value");
         }
 
         // get and add, add and get
@@ -614,27 +612,27 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndAdd long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndAdd long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAdd long value");
+            assertEquals((long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), x, "getAndAdd long value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndAddAcquire long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndAddAcquire long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddAcquire long value");
+            assertEquals((long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), x, "getAndAddAcquire long value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndAddRelease long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndAddRelease long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddRelease long value");
+            assertEquals((long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), x, "getAndAddRelease long value");
         }
 
         // get and bitwise or
@@ -642,27 +640,27 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOr long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseOr long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOr long value");
+            assertEquals((long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), x, "getAndBitwiseOr long value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrAcquire long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseOrAcquire long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrAcquire long value");
+            assertEquals((long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), x, "getAndBitwiseOrAcquire long value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrRelease long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseOrRelease long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrRelease long value");
+            assertEquals((long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), x, "getAndBitwiseOrRelease long value");
         }
 
         // get and bitwise and
@@ -670,27 +668,27 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAnd long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseAnd long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAnd long value");
+            assertEquals((long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), x, "getAndBitwiseAnd long value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndAcquire long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseAndAcquire long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndAcquire long value");
+            assertEquals((long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), x, "getAndBitwiseAndAcquire long value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndRelease long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseAndRelease long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndRelease long value");
+            assertEquals((long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), x, "getAndBitwiseAndRelease long value");
         }
 
         // get and bitwise xor
@@ -698,27 +696,27 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXor long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseXor long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXor long value");
+            assertEquals((long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), x, "getAndBitwiseXor long value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorAcquire long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseXorAcquire long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorAcquire long value");
+            assertEquals((long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), x, "getAndBitwiseXorAcquire long value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorRelease long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseXorRelease long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorRelease long value");
+            assertEquals((long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), x, "getAndBitwiseXorRelease long value");
         }
     }
 
@@ -736,7 +734,7 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
                 long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0x0123456789ABCDEFL, "get long value");
+                assertEquals(0x0123456789ABCDEFL, x, "get long value");
             }
 
 
@@ -744,21 +742,21 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
             {
                 hs.get(TestAccessMode.SET_VOLATILE).invokeExact(array, i, 0xCAFEBABECAFEBABEL);
                 long x = (long) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(array, i);
-                assertEquals(x, 0xCAFEBABECAFEBABEL, "setVolatile long value");
+                assertEquals(0xCAFEBABECAFEBABEL, x, "setVolatile long value");
             }
 
             // Lazy
             {
                 hs.get(TestAccessMode.SET_RELEASE).invokeExact(array, i, 0x0123456789ABCDEFL);
                 long x = (long) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(array, i);
-                assertEquals(x, 0x0123456789ABCDEFL, "setRelease long value");
+                assertEquals(0x0123456789ABCDEFL, x, "setRelease long value");
             }
 
             // Opaque
             {
                 hs.get(TestAccessMode.SET_OPAQUE).invokeExact(array, i, 0xCAFEBABECAFEBABEL);
                 long x = (long) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(array, i);
-                assertEquals(x, 0xCAFEBABECAFEBABEL, "setOpaque long value");
+                assertEquals(0xCAFEBABECAFEBABEL, x, "setOpaque long value");
             }
 
             hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
@@ -768,56 +766,56 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
                 boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
                 assertEquals(r, true, "success compareAndSet long");
                 long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0xCAFEBABECAFEBABEL, "success compareAndSet long value");
+                assertEquals(0xCAFEBABECAFEBABEL, x, "success compareAndSet long value");
             }
 
             {
                 boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, 0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
                 assertEquals(r, false, "failing compareAndSet long");
                 long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0xCAFEBABECAFEBABEL, "failing compareAndSet long value");
+                assertEquals(0xCAFEBABECAFEBABEL, x, "failing compareAndSet long value");
             }
 
             {
                 long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(array, i, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
                 assertEquals(r, 0xCAFEBABECAFEBABEL, "success compareAndExchange long");
                 long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0x0123456789ABCDEFL, "success compareAndExchange long value");
+                assertEquals(0x0123456789ABCDEFL, x, "success compareAndExchange long value");
             }
 
             {
                 long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(array, i, 0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
                 assertEquals(r, 0x0123456789ABCDEFL, "failing compareAndExchange long");
                 long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0x0123456789ABCDEFL, "failing compareAndExchange long value");
+                assertEquals(0x0123456789ABCDEFL, x, "failing compareAndExchange long value");
             }
 
             {
                 long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
                 assertEquals(r, 0x0123456789ABCDEFL, "success compareAndExchangeAcquire long");
                 long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0xCAFEBABECAFEBABEL, "success compareAndExchangeAcquire long value");
+                assertEquals(0xCAFEBABECAFEBABEL, x, "success compareAndExchangeAcquire long value");
             }
 
             {
                 long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, 0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
                 assertEquals(r, 0xCAFEBABECAFEBABEL, "failing compareAndExchangeAcquire long");
                 long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0xCAFEBABECAFEBABEL, "failing compareAndExchangeAcquire long value");
+                assertEquals(0xCAFEBABECAFEBABEL, x, "failing compareAndExchangeAcquire long value");
             }
 
             {
                 long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
                 assertEquals(r, 0xCAFEBABECAFEBABEL, "success compareAndExchangeRelease long");
                 long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0x0123456789ABCDEFL, "success compareAndExchangeRelease long value");
+                assertEquals(0x0123456789ABCDEFL, x, "success compareAndExchangeRelease long value");
             }
 
             {
                 long r = (long) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, 0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
                 assertEquals(r, 0x0123456789ABCDEFL, "failing compareAndExchangeRelease long");
                 long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0x0123456789ABCDEFL, "failing compareAndExchangeRelease long value");
+                assertEquals(0x0123456789ABCDEFL, x, "failing compareAndExchangeRelease long value");
             }
 
             {
@@ -829,14 +827,14 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetPlain long");
                 long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0xCAFEBABECAFEBABEL, "success weakCompareAndSetPlain long value");
+                assertEquals(0xCAFEBABECAFEBABEL, x, "success weakCompareAndSetPlain long value");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, 0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
                 assertEquals(success, false, "failing weakCompareAndSetPlain long");
                 long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0xCAFEBABECAFEBABEL, "failing weakCompareAndSetPlain long value");
+                assertEquals(0xCAFEBABECAFEBABEL, x, "failing weakCompareAndSetPlain long value");
             }
 
             {
@@ -848,14 +846,14 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetAcquire long");
                 long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0x0123456789ABCDEFL, "success weakCompareAndSetAcquire long");
+                assertEquals(0x0123456789ABCDEFL, x, "success weakCompareAndSetAcquire long");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, 0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
                 assertEquals(success, false, "failing weakCompareAndSetAcquire long");
                 long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0x0123456789ABCDEFL, "failing weakCompareAndSetAcquire long value");
+                assertEquals(0x0123456789ABCDEFL, x, "failing weakCompareAndSetAcquire long value");
             }
 
             {
@@ -867,14 +865,14 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetRelease long");
                 long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0xCAFEBABECAFEBABEL, "success weakCompareAndSetRelease long");
+                assertEquals(0xCAFEBABECAFEBABEL, x, "success weakCompareAndSetRelease long");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, 0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
                 assertEquals(success, false, "failing weakCompareAndSetAcquire long");
                 long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0xCAFEBABECAFEBABEL, "failing weakCompareAndSetAcquire long value");
+                assertEquals(0xCAFEBABECAFEBABEL, x, "failing weakCompareAndSetAcquire long value");
             }
 
             {
@@ -886,14 +884,14 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSet long");
                 long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0x0123456789ABCDEFL, "success weakCompareAndSet long");
+                assertEquals(0x0123456789ABCDEFL, x, "success weakCompareAndSet long");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
                 assertEquals(success, false, "failing weakCompareAndSet long");
                 long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0x0123456789ABCDEFL, "failing weakCompareAndSet long value");
+                assertEquals(0x0123456789ABCDEFL, x, "failing weakCompareAndSet long value");
             }
 
             // Compare set and get
@@ -901,27 +899,27 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
 
                 long o = (long) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, 0xCAFEBABECAFEBABEL);
-                assertEquals(o, 0x0123456789ABCDEFL, "getAndSet long");
+                assertEquals(0x0123456789ABCDEFL, o, "getAndSet long");
                 long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSet long value");
+                assertEquals(0xCAFEBABECAFEBABEL, x, "getAndSet long value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
 
                 long o = (long) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, 0xCAFEBABECAFEBABEL);
-                assertEquals(o, 0x0123456789ABCDEFL, "getAndSetAcquire long");
+                assertEquals(0x0123456789ABCDEFL, o, "getAndSetAcquire long");
                 long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetAcquire long value");
+                assertEquals(0xCAFEBABECAFEBABEL, x, "getAndSetAcquire long value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
 
                 long o = (long) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, 0xCAFEBABECAFEBABEL);
-                assertEquals(o, 0x0123456789ABCDEFL, "getAndSetRelease long");
+                assertEquals(0x0123456789ABCDEFL, o, "getAndSetRelease long");
                 long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetRelease long value");
+                assertEquals(0xCAFEBABECAFEBABEL, x, "getAndSetRelease long value");
             }
 
             // get and add, add and get
@@ -929,27 +927,27 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
 
                 long o = (long) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, 0xCAFEBABECAFEBABEL);
-                assertEquals(o, 0x0123456789ABCDEFL, "getAndAdd long");
+                assertEquals(0x0123456789ABCDEFL, o, "getAndAdd long");
                 long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAdd long value");
+                assertEquals((long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), x, "getAndAdd long value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
 
                 long o = (long) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, 0xCAFEBABECAFEBABEL);
-                assertEquals(o, 0x0123456789ABCDEFL, "getAndAddAcquire long");
+                assertEquals(0x0123456789ABCDEFL, o, "getAndAddAcquire long");
                 long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddAcquire long value");
+                assertEquals((long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), x, "getAndAddAcquire long value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
 
                 long o = (long) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, 0xCAFEBABECAFEBABEL);
-                assertEquals(o, 0x0123456789ABCDEFL, "getAndAddRelease long");
+                assertEquals(0x0123456789ABCDEFL, o, "getAndAddRelease long");
                 long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddRelease long value");
+                assertEquals((long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), x, "getAndAddRelease long value");
             }
 
         // get and bitwise or
@@ -957,27 +955,27 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(array, i, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOr long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseOr long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOr long value");
+            assertEquals((long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), x, "getAndBitwiseOr long value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(array, i, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrAcquire long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseOrAcquire long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrAcquire long value");
+            assertEquals((long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), x, "getAndBitwiseOrAcquire long value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(array, i, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrRelease long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseOrRelease long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrRelease long value");
+            assertEquals((long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), x, "getAndBitwiseOrRelease long value");
         }
 
         // get and bitwise and
@@ -985,27 +983,27 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(array, i, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAnd long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseAnd long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAnd long value");
+            assertEquals((long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), x, "getAndBitwiseAnd long value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(array, i, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndAcquire long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseAndAcquire long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndAcquire long value");
+            assertEquals((long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), x, "getAndBitwiseAndAcquire long value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(array, i, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndRelease long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseAndRelease long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndRelease long value");
+            assertEquals((long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), x, "getAndBitwiseAndRelease long value");
         }
 
         // get and bitwise xor
@@ -1013,27 +1011,27 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(array, i, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXor long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseXor long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXor long value");
+            assertEquals((long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), x, "getAndBitwiseXor long value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(array, i, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorAcquire long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseXorAcquire long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorAcquire long value");
+            assertEquals((long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), x, "getAndBitwiseXorAcquire long value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL);
 
             long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(array, i, 0xCAFEBABECAFEBABEL);
-            assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorRelease long");
+            assertEquals(0x0123456789ABCDEFL, o, "getAndBitwiseXorRelease long");
             long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorRelease long value");
+            assertEquals((long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), x, "getAndBitwiseXorRelease long value");
         }
         }
     }
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java
index 8fb23d7dc55..d8f548fe2d6 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,22 +25,22 @@
  * @test
  * @comment Set CompileThresholdScaling to 0.1 so that the warmup loop sets to 2000 iterations
  *          to hit compilation thresholds
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 VarHandleTestMethodHandleAccessShort
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 VarHandleTestMethodHandleAccessShort
  */
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
     static final short static_final_v = (short)0x0123;
 
@@ -60,7 +60,7 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
 
     VarHandle vhArray;
 
-    @BeforeClass
+    @BeforeAll
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
                 VarHandleTestMethodHandleAccessShort.class, "final_v", short.class);
@@ -77,8 +77,6 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
         vhArray = MethodHandles.arrayElementVarHandle(short[].class);
     }
 
-
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -111,7 +109,8 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -120,13 +119,12 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
         }
     }
 
-
     static void testInstanceField(VarHandleTestMethodHandleAccessShort recv, Handles hs) throws Throwable {
         // Plain
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123);
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (short)0x0123, "set short value");
+            assertEquals((short)0x0123, x, "set short value");
         }
 
 
@@ -134,21 +132,21 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
         {
             hs.get(TestAccessMode.SET_VOLATILE).invokeExact(recv, (short)0x4567);
             short x = (short) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(recv);
-            assertEquals(x, (short)0x4567, "setVolatile short value");
+            assertEquals((short)0x4567, x, "setVolatile short value");
         }
 
         // Lazy
         {
             hs.get(TestAccessMode.SET_RELEASE).invokeExact(recv, (short)0x0123);
             short x = (short) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(recv);
-            assertEquals(x, (short)0x0123, "setRelease short value");
+            assertEquals((short)0x0123, x, "setRelease short value");
         }
 
         // Opaque
         {
             hs.get(TestAccessMode.SET_OPAQUE).invokeExact(recv, (short)0x4567);
             short x = (short) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(recv);
-            assertEquals(x, (short)0x4567, "setOpaque short value");
+            assertEquals((short)0x4567, x, "setOpaque short value");
         }
 
         hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123);
@@ -158,56 +156,56 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, (short)0x0123, (short)0x4567);
             assertEquals(r, true, "success compareAndSet short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (short)0x4567, "success compareAndSet short value");
+            assertEquals((short)0x4567, x, "success compareAndSet short value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, (short)0x0123, (short)0x89AB);
             assertEquals(r, false, "failing compareAndSet short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (short)0x4567, "failing compareAndSet short value");
+            assertEquals((short)0x4567, x, "failing compareAndSet short value");
         }
 
         {
             short r = (short) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(recv, (short)0x4567, (short)0x0123);
             assertEquals(r, (short)0x4567, "success compareAndExchange short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (short)0x0123, "success compareAndExchange short value");
+            assertEquals((short)0x0123, x, "success compareAndExchange short value");
         }
 
         {
             short r = (short) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(recv, (short)0x4567, (short)0x89AB);
             assertEquals(r, (short)0x0123, "failing compareAndExchange short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (short)0x0123, "failing compareAndExchange short value");
+            assertEquals((short)0x0123, x, "failing compareAndExchange short value");
         }
 
         {
             short r = (short) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, (short)0x0123, (short)0x4567);
             assertEquals(r, (short)0x0123, "success compareAndExchangeAcquire short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (short)0x4567, "success compareAndExchangeAcquire short value");
+            assertEquals((short)0x4567, x, "success compareAndExchangeAcquire short value");
         }
 
         {
             short r = (short) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, (short)0x0123, (short)0x89AB);
             assertEquals(r, (short)0x4567, "failing compareAndExchangeAcquire short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (short)0x4567, "failing compareAndExchangeAcquire short value");
+            assertEquals((short)0x4567, x, "failing compareAndExchangeAcquire short value");
         }
 
         {
             short r = (short) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, (short)0x4567, (short)0x0123);
             assertEquals(r, (short)0x4567, "success compareAndExchangeRelease short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (short)0x0123, "success compareAndExchangeRelease short value");
+            assertEquals((short)0x0123, x, "success compareAndExchangeRelease short value");
         }
 
         {
             short r = (short) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, (short)0x4567, (short)0x89AB);
             assertEquals(r, (short)0x0123, "failing compareAndExchangeRelease short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (short)0x0123, "failing compareAndExchangeRelease short value");
+            assertEquals((short)0x0123, x, "failing compareAndExchangeRelease short value");
         }
 
         {
@@ -219,14 +217,14 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (short)0x4567, "success weakCompareAndSetPlain short value");
+            assertEquals((short)0x4567, x, "success weakCompareAndSetPlain short value");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, (short)0x0123, (short)0x89AB);
             assertEquals(success, false, "failing weakCompareAndSetPlain short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (short)0x4567, "failing weakCompareAndSetPlain short value");
+            assertEquals((short)0x4567, x, "failing weakCompareAndSetPlain short value");
         }
 
         {
@@ -238,14 +236,14 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (short)0x0123, "success weakCompareAndSetAcquire short");
+            assertEquals((short)0x0123, x, "success weakCompareAndSetAcquire short");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, (short)0x4567, (short)0x89AB);
             assertEquals(success, false, "failing weakCompareAndSetAcquire short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (short)0x0123, "failing weakCompareAndSetAcquire short value");
+            assertEquals((short)0x0123, x, "failing weakCompareAndSetAcquire short value");
         }
 
         {
@@ -257,14 +255,14 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (short)0x4567, "success weakCompareAndSetRelease short");
+            assertEquals((short)0x4567, x, "success weakCompareAndSetRelease short");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, (short)0x0123, (short)0x89AB);
             assertEquals(success, false, "failing weakCompareAndSetRelease short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (short)0x4567, "failing weakCompareAndSetRelease short value");
+            assertEquals((short)0x4567, x, "failing weakCompareAndSetRelease short value");
         }
 
         {
@@ -276,22 +274,22 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (short)0x0123, "success weakCompareAndSet short");
+            assertEquals((short)0x0123, x, "success weakCompareAndSet short");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, (short)0x4567, (short)0x89AB);
             assertEquals(success, false, "failing weakCompareAndSet short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (short)0x0123, "failing weakCompareAndSet short value");
+            assertEquals((short)0x0123, x, "failing weakCompareAndSet short value");
         }
 
         // Compare set and get
         {
             short o = (short) hs.get(TestAccessMode.GET_AND_SET).invokeExact(recv, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndSet short");
+            assertEquals((short)0x0123, o, "getAndSet short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (short)0x4567, "getAndSet short value");
+            assertEquals((short)0x4567, x, "getAndSet short value");
         }
 
         // get and add, add and get
@@ -299,27 +297,27 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndAdd short");
+            assertEquals((short)0x0123, o, "getAndAdd short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAdd short value");
+            assertEquals((short)((short)0x0123 + (short)0x4567), x, "getAndAdd short value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndAddAcquire short");
+            assertEquals((short)0x0123, o, "getAndAddAcquire short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddAcquire short value");
+            assertEquals((short)((short)0x0123 + (short)0x4567), x, "getAndAddAcquire short value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndAddRelease short");
+            assertEquals((short)0x0123, o, "getAndAddRelease short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddRelease short value");
+            assertEquals((short)((short)0x0123 + (short)0x4567), x, "getAndAddRelease short value");
         }
 
         // get and bitwise or
@@ -327,27 +325,27 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(recv, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseOr short");
+            assertEquals((short)0x0123, o, "getAndBitwiseOr short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOr short value");
+            assertEquals((short)((short)0x0123 | (short)0x4567), x, "getAndBitwiseOr short value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(recv, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseOrAcquire short");
+            assertEquals((short)0x0123, o, "getAndBitwiseOrAcquire short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrAcquire short value");
+            assertEquals((short)((short)0x0123 | (short)0x4567), x, "getAndBitwiseOrAcquire short value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(recv, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseOrRelease short");
+            assertEquals((short)0x0123, o, "getAndBitwiseOrRelease short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrRelease short value");
+            assertEquals((short)((short)0x0123 | (short)0x4567), x, "getAndBitwiseOrRelease short value");
         }
 
         // get and bitwise and
@@ -355,27 +353,27 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(recv, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseAnd short");
+            assertEquals((short)0x0123, o, "getAndBitwiseAnd short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAnd short value");
+            assertEquals((short)((short)0x0123 & (short)0x4567), x, "getAndBitwiseAnd short value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(recv, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseAndAcquire short");
+            assertEquals((short)0x0123, o, "getAndBitwiseAndAcquire short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndAcquire short value");
+            assertEquals((short)((short)0x0123 & (short)0x4567), x, "getAndBitwiseAndAcquire short value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(recv, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseAndRelease short");
+            assertEquals((short)0x0123, o, "getAndBitwiseAndRelease short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndRelease short value");
+            assertEquals((short)((short)0x0123 & (short)0x4567), x, "getAndBitwiseAndRelease short value");
         }
 
         // get and bitwise xor
@@ -383,27 +381,27 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(recv, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseXor short");
+            assertEquals((short)0x0123, o, "getAndBitwiseXor short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXor short value");
+            assertEquals((short)((short)0x0123 ^ (short)0x4567), x, "getAndBitwiseXor short value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(recv, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseXorAcquire short");
+            assertEquals((short)0x0123, o, "getAndBitwiseXorAcquire short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorAcquire short value");
+            assertEquals((short)((short)0x0123 ^ (short)0x4567), x, "getAndBitwiseXorAcquire short value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(recv, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseXorRelease short");
+            assertEquals((short)0x0123, o, "getAndBitwiseXorRelease short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorRelease short value");
+            assertEquals((short)((short)0x0123 ^ (short)0x4567), x, "getAndBitwiseXorRelease short value");
         }
     }
 
@@ -418,7 +416,7 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
         {
             hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)0x0123, "set short value");
+            assertEquals((short)0x0123, x, "set short value");
         }
 
 
@@ -426,21 +424,21 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
         {
             hs.get(TestAccessMode.SET_VOLATILE).invokeExact((short)0x4567);
             short x = (short) hs.get(TestAccessMode.GET_VOLATILE).invokeExact();
-            assertEquals(x, (short)0x4567, "setVolatile short value");
+            assertEquals((short)0x4567, x, "setVolatile short value");
         }
 
         // Lazy
         {
             hs.get(TestAccessMode.SET_RELEASE).invokeExact((short)0x0123);
             short x = (short) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact();
-            assertEquals(x, (short)0x0123, "setRelease short value");
+            assertEquals((short)0x0123, x, "setRelease short value");
         }
 
         // Opaque
         {
             hs.get(TestAccessMode.SET_OPAQUE).invokeExact((short)0x4567);
             short x = (short) hs.get(TestAccessMode.GET_OPAQUE).invokeExact();
-            assertEquals(x, (short)0x4567, "setOpaque short value");
+            assertEquals((short)0x4567, x, "setOpaque short value");
         }
 
         hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
@@ -450,56 +448,56 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact((short)0x0123, (short)0x4567);
             assertEquals(r, true, "success compareAndSet short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)0x4567, "success compareAndSet short value");
+            assertEquals((short)0x4567, x, "success compareAndSet short value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact((short)0x0123, (short)0x89AB);
             assertEquals(r, false, "failing compareAndSet short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)0x4567, "failing compareAndSet short value");
+            assertEquals((short)0x4567, x, "failing compareAndSet short value");
         }
 
         {
             short r = (short) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact((short)0x4567, (short)0x0123);
             assertEquals(r, (short)0x4567, "success compareAndExchange short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)0x0123, "success compareAndExchange short value");
+            assertEquals((short)0x0123, x, "success compareAndExchange short value");
         }
 
         {
             short r = (short) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact((short)0x4567, (short)0x89AB);
             assertEquals(r, (short)0x0123, "failing compareAndExchange short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)0x0123, "failing compareAndExchange short value");
+            assertEquals((short)0x0123, x, "failing compareAndExchange short value");
         }
 
         {
             short r = (short) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact((short)0x0123, (short)0x4567);
             assertEquals(r, (short)0x0123, "success compareAndExchangeAcquire short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)0x4567, "success compareAndExchangeAcquire short value");
+            assertEquals((short)0x4567, x, "success compareAndExchangeAcquire short value");
         }
 
         {
             short r = (short) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact((short)0x0123, (short)0x89AB);
             assertEquals(r, (short)0x4567, "failing compareAndExchangeAcquire short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)0x4567, "failing compareAndExchangeAcquire short value");
+            assertEquals((short)0x4567, x, "failing compareAndExchangeAcquire short value");
         }
 
         {
             short r = (short) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact((short)0x4567, (short)0x0123);
             assertEquals(r, (short)0x4567, "success compareAndExchangeRelease short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)0x0123, "success compareAndExchangeRelease short value");
+            assertEquals((short)0x0123, x, "success compareAndExchangeRelease short value");
         }
 
         {
             short r = (short) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact((short)0x4567, (short)0x89AB);
             assertEquals(r, (short)0x0123, "failing compareAndExchangeRelease short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)0x0123, "failing compareAndExchangeRelease short value");
+            assertEquals((short)0x0123, x, "failing compareAndExchangeRelease short value");
         }
 
         {
@@ -511,14 +509,14 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)0x4567, "success weakCompareAndSetPlain short value");
+            assertEquals((short)0x4567, x, "success weakCompareAndSetPlain short value");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact((short)0x0123, (short)0x89AB);
             assertEquals(success, false, "failing weakCompareAndSetPlain short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)0x4567, "failing weakCompareAndSetPlain short value");
+            assertEquals((short)0x4567, x, "failing weakCompareAndSetPlain short value");
         }
 
         {
@@ -530,7 +528,7 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)0x0123, "success weakCompareAndSetAcquire short");
+            assertEquals((short)0x0123, x, "success weakCompareAndSetAcquire short");
         }
 
         {
@@ -538,7 +536,7 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
             boolean success = (boolean) mh.invokeExact((short)0x4567, (short)0x89AB);
             assertEquals(success, false, "failing weakCompareAndSetAcquire short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)0x0123, "failing weakCompareAndSetAcquire short value");
+            assertEquals((short)0x0123, x, "failing weakCompareAndSetAcquire short value");
         }
 
         {
@@ -550,14 +548,14 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)0x4567, "success weakCompareAndSetRelease short");
+            assertEquals((short)0x4567, x, "success weakCompareAndSetRelease short");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact((short)0x0123, (short)0x89AB);
             assertEquals(success, false, "failing weakCompareAndSetRelease short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)0x4567, "failing weakCompareAndSetRelease short value");
+            assertEquals((short)0x4567, x, "failing weakCompareAndSetRelease short value");
         }
 
         {
@@ -569,14 +567,14 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)0x0123, "success weakCompareAndSet short");
+            assertEquals((short)0x0123, x, "success weakCompareAndSet short");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact((short)0x4567, (short)0x89AB);
             assertEquals(success, false, "failing weakCompareAndSet short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)0x0123, "failing weakCompareAndSetRe short value");
+            assertEquals((short)0x0123, x, "failing weakCompareAndSetRe short value");
         }
 
         // Compare set and get
@@ -584,9 +582,9 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_SET).invokeExact((short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndSet short");
+            assertEquals((short)0x0123, o, "getAndSet short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)0x4567, "getAndSet short value");
+            assertEquals((short)0x4567, x, "getAndSet short value");
         }
 
         // Compare set and get
@@ -594,9 +592,9 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact((short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndSetAcquire short");
+            assertEquals((short)0x0123, o, "getAndSetAcquire short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)0x4567, "getAndSetAcquire short value");
+            assertEquals((short)0x4567, x, "getAndSetAcquire short value");
         }
 
         // Compare set and get
@@ -604,9 +602,9 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact((short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndSetRelease short");
+            assertEquals((short)0x0123, o, "getAndSetRelease short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)0x4567, "getAndSetRelease short value");
+            assertEquals((short)0x4567, x, "getAndSetRelease short value");
         }
 
         // get and add, add and get
@@ -614,27 +612,27 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_ADD).invokeExact((short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndAdd short");
+            assertEquals((short)0x0123, o, "getAndAdd short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAdd short value");
+            assertEquals((short)((short)0x0123 + (short)0x4567), x, "getAndAdd short value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact((short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndAddAcquire short");
+            assertEquals((short)0x0123, o, "getAndAddAcquire short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddAcquire short value");
+            assertEquals((short)((short)0x0123 + (short)0x4567), x, "getAndAddAcquire short value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact((short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndAddRelease short");
+            assertEquals((short)0x0123, o, "getAndAddRelease short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddRelease short value");
+            assertEquals((short)((short)0x0123 + (short)0x4567), x, "getAndAddRelease short value");
         }
 
         // get and bitwise or
@@ -642,27 +640,27 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact((short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseOr short");
+            assertEquals((short)0x0123, o, "getAndBitwiseOr short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOr short value");
+            assertEquals((short)((short)0x0123 | (short)0x4567), x, "getAndBitwiseOr short value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact((short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseOrAcquire short");
+            assertEquals((short)0x0123, o, "getAndBitwiseOrAcquire short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrAcquire short value");
+            assertEquals((short)((short)0x0123 | (short)0x4567), x, "getAndBitwiseOrAcquire short value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact((short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseOrRelease short");
+            assertEquals((short)0x0123, o, "getAndBitwiseOrRelease short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrRelease short value");
+            assertEquals((short)((short)0x0123 | (short)0x4567), x, "getAndBitwiseOrRelease short value");
         }
 
         // get and bitwise and
@@ -670,27 +668,27 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact((short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseAnd short");
+            assertEquals((short)0x0123, o, "getAndBitwiseAnd short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAnd short value");
+            assertEquals((short)((short)0x0123 & (short)0x4567), x, "getAndBitwiseAnd short value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact((short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseAndAcquire short");
+            assertEquals((short)0x0123, o, "getAndBitwiseAndAcquire short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndAcquire short value");
+            assertEquals((short)((short)0x0123 & (short)0x4567), x, "getAndBitwiseAndAcquire short value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact((short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseAndRelease short");
+            assertEquals((short)0x0123, o, "getAndBitwiseAndRelease short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndRelease short value");
+            assertEquals((short)((short)0x0123 & (short)0x4567), x, "getAndBitwiseAndRelease short value");
         }
 
         // get and bitwise xor
@@ -698,27 +696,27 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact((short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseXor short");
+            assertEquals((short)0x0123, o, "getAndBitwiseXor short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXor short value");
+            assertEquals((short)((short)0x0123 ^ (short)0x4567), x, "getAndBitwiseXor short value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact((short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseXorAcquire short");
+            assertEquals((short)0x0123, o, "getAndBitwiseXorAcquire short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorAcquire short value");
+            assertEquals((short)((short)0x0123 ^ (short)0x4567), x, "getAndBitwiseXorAcquire short value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact((short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact((short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseXorRelease short");
+            assertEquals((short)0x0123, o, "getAndBitwiseXorRelease short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorRelease short value");
+            assertEquals((short)((short)0x0123 ^ (short)0x4567), x, "getAndBitwiseXorRelease short value");
         }
     }
 
@@ -736,7 +734,7 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
                 short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (short)0x0123, "get short value");
+                assertEquals((short)0x0123, x, "get short value");
             }
 
 
@@ -744,21 +742,21 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
             {
                 hs.get(TestAccessMode.SET_VOLATILE).invokeExact(array, i, (short)0x4567);
                 short x = (short) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(array, i);
-                assertEquals(x, (short)0x4567, "setVolatile short value");
+                assertEquals((short)0x4567, x, "setVolatile short value");
             }
 
             // Lazy
             {
                 hs.get(TestAccessMode.SET_RELEASE).invokeExact(array, i, (short)0x0123);
                 short x = (short) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(array, i);
-                assertEquals(x, (short)0x0123, "setRelease short value");
+                assertEquals((short)0x0123, x, "setRelease short value");
             }
 
             // Opaque
             {
                 hs.get(TestAccessMode.SET_OPAQUE).invokeExact(array, i, (short)0x4567);
                 short x = (short) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(array, i);
-                assertEquals(x, (short)0x4567, "setOpaque short value");
+                assertEquals((short)0x4567, x, "setOpaque short value");
             }
 
             hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
@@ -768,56 +766,56 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
                 boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, (short)0x0123, (short)0x4567);
                 assertEquals(r, true, "success compareAndSet short");
                 short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (short)0x4567, "success compareAndSet short value");
+                assertEquals((short)0x4567, x, "success compareAndSet short value");
             }
 
             {
                 boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, (short)0x0123, (short)0x89AB);
                 assertEquals(r, false, "failing compareAndSet short");
                 short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (short)0x4567, "failing compareAndSet short value");
+                assertEquals((short)0x4567, x, "failing compareAndSet short value");
             }
 
             {
                 short r = (short) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(array, i, (short)0x4567, (short)0x0123);
                 assertEquals(r, (short)0x4567, "success compareAndExchange short");
                 short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (short)0x0123, "success compareAndExchange short value");
+                assertEquals((short)0x0123, x, "success compareAndExchange short value");
             }
 
             {
                 short r = (short) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(array, i, (short)0x4567, (short)0x89AB);
                 assertEquals(r, (short)0x0123, "failing compareAndExchange short");
                 short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (short)0x0123, "failing compareAndExchange short value");
+                assertEquals((short)0x0123, x, "failing compareAndExchange short value");
             }
 
             {
                 short r = (short) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, (short)0x0123, (short)0x4567);
                 assertEquals(r, (short)0x0123, "success compareAndExchangeAcquire short");
                 short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (short)0x4567, "success compareAndExchangeAcquire short value");
+                assertEquals((short)0x4567, x, "success compareAndExchangeAcquire short value");
             }
 
             {
                 short r = (short) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, (short)0x0123, (short)0x89AB);
                 assertEquals(r, (short)0x4567, "failing compareAndExchangeAcquire short");
                 short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (short)0x4567, "failing compareAndExchangeAcquire short value");
+                assertEquals((short)0x4567, x, "failing compareAndExchangeAcquire short value");
             }
 
             {
                 short r = (short) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, (short)0x4567, (short)0x0123);
                 assertEquals(r, (short)0x4567, "success compareAndExchangeRelease short");
                 short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (short)0x0123, "success compareAndExchangeRelease short value");
+                assertEquals((short)0x0123, x, "success compareAndExchangeRelease short value");
             }
 
             {
                 short r = (short) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, (short)0x4567, (short)0x89AB);
                 assertEquals(r, (short)0x0123, "failing compareAndExchangeRelease short");
                 short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (short)0x0123, "failing compareAndExchangeRelease short value");
+                assertEquals((short)0x0123, x, "failing compareAndExchangeRelease short value");
             }
 
             {
@@ -829,14 +827,14 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetPlain short");
                 short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (short)0x4567, "success weakCompareAndSetPlain short value");
+                assertEquals((short)0x4567, x, "success weakCompareAndSetPlain short value");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, (short)0x0123, (short)0x89AB);
                 assertEquals(success, false, "failing weakCompareAndSetPlain short");
                 short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (short)0x4567, "failing weakCompareAndSetPlain short value");
+                assertEquals((short)0x4567, x, "failing weakCompareAndSetPlain short value");
             }
 
             {
@@ -848,14 +846,14 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetAcquire short");
                 short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (short)0x0123, "success weakCompareAndSetAcquire short");
+                assertEquals((short)0x0123, x, "success weakCompareAndSetAcquire short");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, (short)0x4567, (short)0x89AB);
                 assertEquals(success, false, "failing weakCompareAndSetAcquire short");
                 short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (short)0x0123, "failing weakCompareAndSetAcquire short value");
+                assertEquals((short)0x0123, x, "failing weakCompareAndSetAcquire short value");
             }
 
             {
@@ -867,14 +865,14 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetRelease short");
                 short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (short)0x4567, "success weakCompareAndSetRelease short");
+                assertEquals((short)0x4567, x, "success weakCompareAndSetRelease short");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, (short)0x0123, (short)0x89AB);
                 assertEquals(success, false, "failing weakCompareAndSetAcquire short");
                 short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (short)0x4567, "failing weakCompareAndSetAcquire short value");
+                assertEquals((short)0x4567, x, "failing weakCompareAndSetAcquire short value");
             }
 
             {
@@ -886,14 +884,14 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSet short");
                 short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (short)0x0123, "success weakCompareAndSet short");
+                assertEquals((short)0x0123, x, "success weakCompareAndSet short");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, (short)0x4567, (short)0x89AB);
                 assertEquals(success, false, "failing weakCompareAndSet short");
                 short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (short)0x0123, "failing weakCompareAndSet short value");
+                assertEquals((short)0x0123, x, "failing weakCompareAndSet short value");
             }
 
             // Compare set and get
@@ -901,27 +899,27 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
 
                 short o = (short) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, (short)0x4567);
-                assertEquals(o, (short)0x0123, "getAndSet short");
+                assertEquals((short)0x0123, o, "getAndSet short");
                 short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (short)0x4567, "getAndSet short value");
+                assertEquals((short)0x4567, x, "getAndSet short value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
 
                 short o = (short) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, (short)0x4567);
-                assertEquals(o, (short)0x0123, "getAndSetAcquire short");
+                assertEquals((short)0x0123, o, "getAndSetAcquire short");
                 short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (short)0x4567, "getAndSetAcquire short value");
+                assertEquals((short)0x4567, x, "getAndSetAcquire short value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
 
                 short o = (short) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, (short)0x4567);
-                assertEquals(o, (short)0x0123, "getAndSetRelease short");
+                assertEquals((short)0x0123, o, "getAndSetRelease short");
                 short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (short)0x4567, "getAndSetRelease short value");
+                assertEquals((short)0x4567, x, "getAndSetRelease short value");
             }
 
             // get and add, add and get
@@ -929,27 +927,27 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
 
                 short o = (short) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, (short)0x4567);
-                assertEquals(o, (short)0x0123, "getAndAdd short");
+                assertEquals((short)0x0123, o, "getAndAdd short");
                 short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAdd short value");
+                assertEquals((short)((short)0x0123 + (short)0x4567), x, "getAndAdd short value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
 
                 short o = (short) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, (short)0x4567);
-                assertEquals(o, (short)0x0123, "getAndAddAcquire short");
+                assertEquals((short)0x0123, o, "getAndAddAcquire short");
                 short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddAcquire short value");
+                assertEquals((short)((short)0x0123 + (short)0x4567), x, "getAndAddAcquire short value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
 
                 short o = (short) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, (short)0x4567);
-                assertEquals(o, (short)0x0123, "getAndAddRelease short");
+                assertEquals((short)0x0123, o, "getAndAddRelease short");
                 short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddRelease short value");
+                assertEquals((short)((short)0x0123 + (short)0x4567), x, "getAndAddRelease short value");
             }
 
         // get and bitwise or
@@ -957,27 +955,27 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(array, i, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseOr short");
+            assertEquals((short)0x0123, o, "getAndBitwiseOr short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOr short value");
+            assertEquals((short)((short)0x0123 | (short)0x4567), x, "getAndBitwiseOr short value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(array, i, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseOrAcquire short");
+            assertEquals((short)0x0123, o, "getAndBitwiseOrAcquire short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrAcquire short value");
+            assertEquals((short)((short)0x0123 | (short)0x4567), x, "getAndBitwiseOrAcquire short value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(array, i, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseOrRelease short");
+            assertEquals((short)0x0123, o, "getAndBitwiseOrRelease short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrRelease short value");
+            assertEquals((short)((short)0x0123 | (short)0x4567), x, "getAndBitwiseOrRelease short value");
         }
 
         // get and bitwise and
@@ -985,27 +983,27 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(array, i, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseAnd short");
+            assertEquals((short)0x0123, o, "getAndBitwiseAnd short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAnd short value");
+            assertEquals((short)((short)0x0123 & (short)0x4567), x, "getAndBitwiseAnd short value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(array, i, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseAndAcquire short");
+            assertEquals((short)0x0123, o, "getAndBitwiseAndAcquire short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndAcquire short value");
+            assertEquals((short)((short)0x0123 & (short)0x4567), x, "getAndBitwiseAndAcquire short value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(array, i, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseAndRelease short");
+            assertEquals((short)0x0123, o, "getAndBitwiseAndRelease short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndRelease short value");
+            assertEquals((short)((short)0x0123 & (short)0x4567), x, "getAndBitwiseAndRelease short value");
         }
 
         // get and bitwise xor
@@ -1013,27 +1011,27 @@ public class VarHandleTestMethodHandleAccessShort extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(array, i, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseXor short");
+            assertEquals((short)0x0123, o, "getAndBitwiseXor short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXor short value");
+            assertEquals((short)((short)0x0123 ^ (short)0x4567), x, "getAndBitwiseXor short value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(array, i, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseXorAcquire short");
+            assertEquals((short)0x0123, o, "getAndBitwiseXorAcquire short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorAcquire short value");
+            assertEquals((short)((short)0x0123 ^ (short)0x4567), x, "getAndBitwiseXorAcquire short value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123);
 
             short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(array, i, (short)0x4567);
-            assertEquals(o, (short)0x0123, "getAndBitwiseXorRelease short");
+            assertEquals((short)0x0123, o, "getAndBitwiseXorRelease short");
             short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorRelease short value");
+            assertEquals((short)((short)0x0123 ^ (short)0x4567), x, "getAndBitwiseXorRelease short value");
         }
         }
     }
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java
index 8ccede760c9..35723f63d27 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,22 +25,22 @@
  * @test
  * @comment Set CompileThresholdScaling to 0.1 so that the warmup loop sets to 2000 iterations
  *          to hit compilation thresholds
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 VarHandleTestMethodHandleAccessString
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 VarHandleTestMethodHandleAccessString
  */
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
     static final String static_final_v = "foo";
 
@@ -60,7 +60,7 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
 
     VarHandle vhArray;
 
-    @BeforeClass
+    @BeforeAll
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
                 VarHandleTestMethodHandleAccessString.class, "final_v", String.class);
@@ -77,8 +77,6 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
         vhArray = MethodHandles.arrayElementVarHandle(String[].class);
     }
 
-
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -111,7 +109,8 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -120,13 +119,12 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
         }
     }
 
-
     static void testInstanceField(VarHandleTestMethodHandleAccessString recv, Handles hs) throws Throwable {
         // Plain
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, "foo");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, "foo", "set String value");
+            assertEquals("foo", x, "set String value");
         }
 
 
@@ -134,21 +132,21 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
         {
             hs.get(TestAccessMode.SET_VOLATILE).invokeExact(recv, "bar");
             String x = (String) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(recv);
-            assertEquals(x, "bar", "setVolatile String value");
+            assertEquals("bar", x, "setVolatile String value");
         }
 
         // Lazy
         {
             hs.get(TestAccessMode.SET_RELEASE).invokeExact(recv, "foo");
             String x = (String) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(recv);
-            assertEquals(x, "foo", "setRelease String value");
+            assertEquals("foo", x, "setRelease String value");
         }
 
         // Opaque
         {
             hs.get(TestAccessMode.SET_OPAQUE).invokeExact(recv, "bar");
             String x = (String) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(recv);
-            assertEquals(x, "bar", "setOpaque String value");
+            assertEquals("bar", x, "setOpaque String value");
         }
 
         hs.get(TestAccessMode.SET).invokeExact(recv, "foo");
@@ -158,56 +156,56 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, "foo", "bar");
             assertEquals(r, true, "success compareAndSet String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, "bar", "success compareAndSet String value");
+            assertEquals("bar", x, "success compareAndSet String value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, "foo", "baz");
             assertEquals(r, false, "failing compareAndSet String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, "bar", "failing compareAndSet String value");
+            assertEquals("bar", x, "failing compareAndSet String value");
         }
 
         {
             String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(recv, "bar", "foo");
             assertEquals(r, "bar", "success compareAndExchange String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, "foo", "success compareAndExchange String value");
+            assertEquals("foo", x, "success compareAndExchange String value");
         }
 
         {
             String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(recv, "bar", "baz");
             assertEquals(r, "foo", "failing compareAndExchange String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, "foo", "failing compareAndExchange String value");
+            assertEquals("foo", x, "failing compareAndExchange String value");
         }
 
         {
             String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, "foo", "bar");
             assertEquals(r, "foo", "success compareAndExchangeAcquire String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, "bar", "success compareAndExchangeAcquire String value");
+            assertEquals("bar", x, "success compareAndExchangeAcquire String value");
         }
 
         {
             String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, "foo", "baz");
             assertEquals(r, "bar", "failing compareAndExchangeAcquire String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, "bar", "failing compareAndExchangeAcquire String value");
+            assertEquals("bar", x, "failing compareAndExchangeAcquire String value");
         }
 
         {
             String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, "bar", "foo");
             assertEquals(r, "bar", "success compareAndExchangeRelease String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, "foo", "success compareAndExchangeRelease String value");
+            assertEquals("foo", x, "success compareAndExchangeRelease String value");
         }
 
         {
             String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, "bar", "baz");
             assertEquals(r, "foo", "failing compareAndExchangeRelease String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, "foo", "failing compareAndExchangeRelease String value");
+            assertEquals("foo", x, "failing compareAndExchangeRelease String value");
         }
 
         {
@@ -219,14 +217,14 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, "bar", "success weakCompareAndSetPlain String value");
+            assertEquals("bar", x, "success weakCompareAndSetPlain String value");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, "foo", "baz");
             assertEquals(success, false, "failing weakCompareAndSetPlain String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, "bar", "failing weakCompareAndSetPlain String value");
+            assertEquals("bar", x, "failing weakCompareAndSetPlain String value");
         }
 
         {
@@ -238,14 +236,14 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, "foo", "success weakCompareAndSetAcquire String");
+            assertEquals("foo", x, "success weakCompareAndSetAcquire String");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, "bar", "baz");
             assertEquals(success, false, "failing weakCompareAndSetAcquire String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, "foo", "failing weakCompareAndSetAcquire String value");
+            assertEquals("foo", x, "failing weakCompareAndSetAcquire String value");
         }
 
         {
@@ -257,14 +255,14 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, "bar", "success weakCompareAndSetRelease String");
+            assertEquals("bar", x, "success weakCompareAndSetRelease String");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, "foo", "baz");
             assertEquals(success, false, "failing weakCompareAndSetRelease String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, "bar", "failing weakCompareAndSetRelease String value");
+            assertEquals("bar", x, "failing weakCompareAndSetRelease String value");
         }
 
         {
@@ -276,22 +274,22 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, "foo", "success weakCompareAndSet String");
+            assertEquals("foo", x, "success weakCompareAndSet String");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, "bar", "baz");
             assertEquals(success, false, "failing weakCompareAndSet String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, "foo", "failing weakCompareAndSet String value");
+            assertEquals("foo", x, "failing weakCompareAndSet String value");
         }
 
         // Compare set and get
         {
             String o = (String) hs.get(TestAccessMode.GET_AND_SET).invokeExact(recv, "bar");
-            assertEquals(o, "foo", "getAndSet String");
+            assertEquals("foo", o, "getAndSet String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, "bar", "getAndSet String value");
+            assertEquals("bar", x, "getAndSet String value");
         }
 
 
@@ -318,7 +316,7 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
         {
             hs.get(TestAccessMode.SET).invokeExact("foo");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, "foo", "set String value");
+            assertEquals("foo", x, "set String value");
         }
 
 
@@ -326,21 +324,21 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
         {
             hs.get(TestAccessMode.SET_VOLATILE).invokeExact("bar");
             String x = (String) hs.get(TestAccessMode.GET_VOLATILE).invokeExact();
-            assertEquals(x, "bar", "setVolatile String value");
+            assertEquals("bar", x, "setVolatile String value");
         }
 
         // Lazy
         {
             hs.get(TestAccessMode.SET_RELEASE).invokeExact("foo");
             String x = (String) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact();
-            assertEquals(x, "foo", "setRelease String value");
+            assertEquals("foo", x, "setRelease String value");
         }
 
         // Opaque
         {
             hs.get(TestAccessMode.SET_OPAQUE).invokeExact("bar");
             String x = (String) hs.get(TestAccessMode.GET_OPAQUE).invokeExact();
-            assertEquals(x, "bar", "setOpaque String value");
+            assertEquals("bar", x, "setOpaque String value");
         }
 
         hs.get(TestAccessMode.SET).invokeExact("foo");
@@ -350,56 +348,56 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact("foo", "bar");
             assertEquals(r, true, "success compareAndSet String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, "bar", "success compareAndSet String value");
+            assertEquals("bar", x, "success compareAndSet String value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact("foo", "baz");
             assertEquals(r, false, "failing compareAndSet String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, "bar", "failing compareAndSet String value");
+            assertEquals("bar", x, "failing compareAndSet String value");
         }
 
         {
             String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact("bar", "foo");
             assertEquals(r, "bar", "success compareAndExchange String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, "foo", "success compareAndExchange String value");
+            assertEquals("foo", x, "success compareAndExchange String value");
         }
 
         {
             String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact("bar", "baz");
             assertEquals(r, "foo", "failing compareAndExchange String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, "foo", "failing compareAndExchange String value");
+            assertEquals("foo", x, "failing compareAndExchange String value");
         }
 
         {
             String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact("foo", "bar");
             assertEquals(r, "foo", "success compareAndExchangeAcquire String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, "bar", "success compareAndExchangeAcquire String value");
+            assertEquals("bar", x, "success compareAndExchangeAcquire String value");
         }
 
         {
             String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact("foo", "baz");
             assertEquals(r, "bar", "failing compareAndExchangeAcquire String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, "bar", "failing compareAndExchangeAcquire String value");
+            assertEquals("bar", x, "failing compareAndExchangeAcquire String value");
         }
 
         {
             String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact("bar", "foo");
             assertEquals(r, "bar", "success compareAndExchangeRelease String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, "foo", "success compareAndExchangeRelease String value");
+            assertEquals("foo", x, "success compareAndExchangeRelease String value");
         }
 
         {
             String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact("bar", "baz");
             assertEquals(r, "foo", "failing compareAndExchangeRelease String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, "foo", "failing compareAndExchangeRelease String value");
+            assertEquals("foo", x, "failing compareAndExchangeRelease String value");
         }
 
         {
@@ -411,14 +409,14 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, "bar", "success weakCompareAndSetPlain String value");
+            assertEquals("bar", x, "success weakCompareAndSetPlain String value");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact("foo", "baz");
             assertEquals(success, false, "failing weakCompareAndSetPlain String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, "bar", "failing weakCompareAndSetPlain String value");
+            assertEquals("bar", x, "failing weakCompareAndSetPlain String value");
         }
 
         {
@@ -430,7 +428,7 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, "foo", "success weakCompareAndSetAcquire String");
+            assertEquals("foo", x, "success weakCompareAndSetAcquire String");
         }
 
         {
@@ -438,7 +436,7 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
             boolean success = (boolean) mh.invokeExact("bar", "baz");
             assertEquals(success, false, "failing weakCompareAndSetAcquire String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, "foo", "failing weakCompareAndSetAcquire String value");
+            assertEquals("foo", x, "failing weakCompareAndSetAcquire String value");
         }
 
         {
@@ -450,14 +448,14 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, "bar", "success weakCompareAndSetRelease String");
+            assertEquals("bar", x, "success weakCompareAndSetRelease String");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact("foo", "baz");
             assertEquals(success, false, "failing weakCompareAndSetRelease String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, "bar", "failing weakCompareAndSetRelease String value");
+            assertEquals("bar", x, "failing weakCompareAndSetRelease String value");
         }
 
         {
@@ -469,14 +467,14 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, "foo", "success weakCompareAndSet String");
+            assertEquals("foo", x, "success weakCompareAndSet String");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact("bar", "baz");
             assertEquals(success, false, "failing weakCompareAndSet String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, "foo", "failing weakCompareAndSetRe String value");
+            assertEquals("foo", x, "failing weakCompareAndSetRe String value");
         }
 
         // Compare set and get
@@ -484,9 +482,9 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact("foo");
 
             String o = (String) hs.get(TestAccessMode.GET_AND_SET).invokeExact("bar");
-            assertEquals(o, "foo", "getAndSet String");
+            assertEquals("foo", o, "getAndSet String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, "bar", "getAndSet String value");
+            assertEquals("bar", x, "getAndSet String value");
         }
 
         // Compare set and get
@@ -494,9 +492,9 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact("foo");
 
             String o = (String) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact("bar");
-            assertEquals(o, "foo", "getAndSetAcquire String");
+            assertEquals("foo", o, "getAndSetAcquire String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, "bar", "getAndSetAcquire String value");
+            assertEquals("bar", x, "getAndSetAcquire String value");
         }
 
         // Compare set and get
@@ -504,9 +502,9 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact("foo");
 
             String o = (String) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact("bar");
-            assertEquals(o, "foo", "getAndSetRelease String");
+            assertEquals("foo", o, "getAndSetRelease String");
             String x = (String) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, "bar", "getAndSetRelease String value");
+            assertEquals("bar", x, "getAndSetRelease String value");
         }
 
 
@@ -536,7 +534,7 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, "foo");
                 String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, "foo", "get String value");
+                assertEquals("foo", x, "get String value");
             }
 
 
@@ -544,21 +542,21 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
             {
                 hs.get(TestAccessMode.SET_VOLATILE).invokeExact(array, i, "bar");
                 String x = (String) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(array, i);
-                assertEquals(x, "bar", "setVolatile String value");
+                assertEquals("bar", x, "setVolatile String value");
             }
 
             // Lazy
             {
                 hs.get(TestAccessMode.SET_RELEASE).invokeExact(array, i, "foo");
                 String x = (String) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(array, i);
-                assertEquals(x, "foo", "setRelease String value");
+                assertEquals("foo", x, "setRelease String value");
             }
 
             // Opaque
             {
                 hs.get(TestAccessMode.SET_OPAQUE).invokeExact(array, i, "bar");
                 String x = (String) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(array, i);
-                assertEquals(x, "bar", "setOpaque String value");
+                assertEquals("bar", x, "setOpaque String value");
             }
 
             hs.get(TestAccessMode.SET).invokeExact(array, i, "foo");
@@ -568,56 +566,56 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
                 boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, "foo", "bar");
                 assertEquals(r, true, "success compareAndSet String");
                 String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, "bar", "success compareAndSet String value");
+                assertEquals("bar", x, "success compareAndSet String value");
             }
 
             {
                 boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, "foo", "baz");
                 assertEquals(r, false, "failing compareAndSet String");
                 String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, "bar", "failing compareAndSet String value");
+                assertEquals("bar", x, "failing compareAndSet String value");
             }
 
             {
                 String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(array, i, "bar", "foo");
                 assertEquals(r, "bar", "success compareAndExchange String");
                 String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, "foo", "success compareAndExchange String value");
+                assertEquals("foo", x, "success compareAndExchange String value");
             }
 
             {
                 String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(array, i, "bar", "baz");
                 assertEquals(r, "foo", "failing compareAndExchange String");
                 String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, "foo", "failing compareAndExchange String value");
+                assertEquals("foo", x, "failing compareAndExchange String value");
             }
 
             {
                 String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, "foo", "bar");
                 assertEquals(r, "foo", "success compareAndExchangeAcquire String");
                 String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, "bar", "success compareAndExchangeAcquire String value");
+                assertEquals("bar", x, "success compareAndExchangeAcquire String value");
             }
 
             {
                 String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, "foo", "baz");
                 assertEquals(r, "bar", "failing compareAndExchangeAcquire String");
                 String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, "bar", "failing compareAndExchangeAcquire String value");
+                assertEquals("bar", x, "failing compareAndExchangeAcquire String value");
             }
 
             {
                 String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, "bar", "foo");
                 assertEquals(r, "bar", "success compareAndExchangeRelease String");
                 String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, "foo", "success compareAndExchangeRelease String value");
+                assertEquals("foo", x, "success compareAndExchangeRelease String value");
             }
 
             {
                 String r = (String) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, "bar", "baz");
                 assertEquals(r, "foo", "failing compareAndExchangeRelease String");
                 String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, "foo", "failing compareAndExchangeRelease String value");
+                assertEquals("foo", x, "failing compareAndExchangeRelease String value");
             }
 
             {
@@ -629,14 +627,14 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetPlain String");
                 String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, "bar", "success weakCompareAndSetPlain String value");
+                assertEquals("bar", x, "success weakCompareAndSetPlain String value");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, "foo", "baz");
                 assertEquals(success, false, "failing weakCompareAndSetPlain String");
                 String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, "bar", "failing weakCompareAndSetPlain String value");
+                assertEquals("bar", x, "failing weakCompareAndSetPlain String value");
             }
 
             {
@@ -648,14 +646,14 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetAcquire String");
                 String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, "foo", "success weakCompareAndSetAcquire String");
+                assertEquals("foo", x, "success weakCompareAndSetAcquire String");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, "bar", "baz");
                 assertEquals(success, false, "failing weakCompareAndSetAcquire String");
                 String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, "foo", "failing weakCompareAndSetAcquire String value");
+                assertEquals("foo", x, "failing weakCompareAndSetAcquire String value");
             }
 
             {
@@ -667,14 +665,14 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetRelease String");
                 String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, "bar", "success weakCompareAndSetRelease String");
+                assertEquals("bar", x, "success weakCompareAndSetRelease String");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, "foo", "baz");
                 assertEquals(success, false, "failing weakCompareAndSetAcquire String");
                 String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, "bar", "failing weakCompareAndSetAcquire String value");
+                assertEquals("bar", x, "failing weakCompareAndSetAcquire String value");
             }
 
             {
@@ -686,14 +684,14 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSet String");
                 String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, "foo", "success weakCompareAndSet String");
+                assertEquals("foo", x, "success weakCompareAndSet String");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, "bar", "baz");
                 assertEquals(success, false, "failing weakCompareAndSet String");
                 String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, "foo", "failing weakCompareAndSet String value");
+                assertEquals("foo", x, "failing weakCompareAndSet String value");
             }
 
             // Compare set and get
@@ -701,27 +699,27 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, "foo");
 
                 String o = (String) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, "bar");
-                assertEquals(o, "foo", "getAndSet String");
+                assertEquals("foo", o, "getAndSet String");
                 String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, "bar", "getAndSet String value");
+                assertEquals("bar", x, "getAndSet String value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, "foo");
 
                 String o = (String) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, "bar");
-                assertEquals(o, "foo", "getAndSetAcquire String");
+                assertEquals("foo", o, "getAndSetAcquire String");
                 String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, "bar", "getAndSetAcquire String value");
+                assertEquals("bar", x, "getAndSetAcquire String value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, "foo");
 
                 String o = (String) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, "bar");
-                assertEquals(o, "foo", "getAndSetRelease String");
+                assertEquals("foo", o, "getAndSetRelease String");
                 String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, "bar", "getAndSetRelease String value");
+                assertEquals("bar", x, "getAndSetRelease String value");
             }
 
 
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeBoolean.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeBoolean.java
index eb6327d4c55..b10466a1fc7 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeBoolean.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeBoolean.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,26 +24,26 @@
 /*
  * @test
  * @bug 8156486
- * @run testng/othervm VarHandleTestMethodTypeBoolean
- * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=true -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeBoolean
- * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=false VarHandleTestMethodTypeBoolean
- * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeBoolean
+ * @run junit/othervm VarHandleTestMethodTypeBoolean
+ * @run junit/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=true -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeBoolean
+ * @run junit/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=false VarHandleTestMethodTypeBoolean
+ * @run junit/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeBoolean
  */
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import static org.testng.Assert.*;
-
 import static java.lang.invoke.MethodType.*;
 
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest {
     static final boolean static_final_v = true;
 
@@ -63,7 +63,7 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest {
 
     VarHandle vhArray;
 
-    @BeforeClass
+    @BeforeAll
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
                 VarHandleTestMethodTypeBoolean.class, "final_v", boolean.class);
@@ -80,7 +80,6 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest {
         vhArray = MethodHandles.arrayElementVarHandle(boolean[].class);
     }
 
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -115,7 +114,8 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -124,7 +124,6 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest {
         }
     }
 
-
     static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeBoolean recv, VarHandle vh) throws Throwable {
         // Get
         // Incorrect argument types
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeByte.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeByte.java
index 08b834699af..ce8686ebd74 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeByte.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeByte.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,26 +24,26 @@
 /*
  * @test
  * @bug 8156486
- * @run testng/othervm VarHandleTestMethodTypeByte
- * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=true -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeByte
- * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=false VarHandleTestMethodTypeByte
- * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeByte
+ * @run junit/othervm VarHandleTestMethodTypeByte
+ * @run junit/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=true -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeByte
+ * @run junit/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=false VarHandleTestMethodTypeByte
+ * @run junit/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeByte
  */
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import static org.testng.Assert.*;
-
 import static java.lang.invoke.MethodType.*;
 
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestMethodTypeByte extends VarHandleBaseTest {
     static final byte static_final_v = (byte)0x01;
 
@@ -63,7 +63,7 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest {
 
     VarHandle vhArray;
 
-    @BeforeClass
+    @BeforeAll
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
                 VarHandleTestMethodTypeByte.class, "final_v", byte.class);
@@ -80,7 +80,6 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest {
         vhArray = MethodHandles.arrayElementVarHandle(byte[].class);
     }
 
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -115,7 +114,8 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -124,7 +124,6 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest {
         }
     }
 
-
     static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeByte recv, VarHandle vh) throws Throwable {
         // Get
         // Incorrect argument types
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeChar.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeChar.java
index 25aa62825b7..d89af7f212c 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeChar.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeChar.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,26 +24,26 @@
 /*
  * @test
  * @bug 8156486
- * @run testng/othervm VarHandleTestMethodTypeChar
- * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=true -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeChar
- * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=false VarHandleTestMethodTypeChar
- * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeChar
+ * @run junit/othervm VarHandleTestMethodTypeChar
+ * @run junit/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=true -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeChar
+ * @run junit/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=false VarHandleTestMethodTypeChar
+ * @run junit/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeChar
  */
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import static org.testng.Assert.*;
-
 import static java.lang.invoke.MethodType.*;
 
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestMethodTypeChar extends VarHandleBaseTest {
     static final char static_final_v = '\u0123';
 
@@ -63,7 +63,7 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest {
 
     VarHandle vhArray;
 
-    @BeforeClass
+    @BeforeAll
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
                 VarHandleTestMethodTypeChar.class, "final_v", char.class);
@@ -80,7 +80,6 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest {
         vhArray = MethodHandles.arrayElementVarHandle(char[].class);
     }
 
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -115,7 +114,8 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -124,7 +124,6 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest {
         }
     }
 
-
     static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeChar recv, VarHandle vh) throws Throwable {
         // Get
         // Incorrect argument types
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeDouble.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeDouble.java
index c3f8d22435b..0363a996ceb 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeDouble.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeDouble.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,26 +24,26 @@
 /*
  * @test
  * @bug 8156486
- * @run testng/othervm VarHandleTestMethodTypeDouble
- * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=true -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeDouble
- * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=false VarHandleTestMethodTypeDouble
- * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeDouble
+ * @run junit/othervm VarHandleTestMethodTypeDouble
+ * @run junit/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=true -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeDouble
+ * @run junit/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=false VarHandleTestMethodTypeDouble
+ * @run junit/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeDouble
  */
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import static org.testng.Assert.*;
-
 import static java.lang.invoke.MethodType.*;
 
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest {
     static final double static_final_v = 1.0d;
 
@@ -63,7 +63,7 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest {
 
     VarHandle vhArray;
 
-    @BeforeClass
+    @BeforeAll
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
                 VarHandleTestMethodTypeDouble.class, "final_v", double.class);
@@ -80,7 +80,6 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest {
         vhArray = MethodHandles.arrayElementVarHandle(double[].class);
     }
 
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -115,7 +114,8 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -124,7 +124,6 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest {
         }
     }
 
-
     static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeDouble recv, VarHandle vh) throws Throwable {
         // Get
         // Incorrect argument types
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeFloat.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeFloat.java
index 0d05270b3ac..c8b965e41df 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeFloat.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeFloat.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,26 +24,26 @@
 /*
  * @test
  * @bug 8156486
- * @run testng/othervm VarHandleTestMethodTypeFloat
- * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=true -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeFloat
- * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=false VarHandleTestMethodTypeFloat
- * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeFloat
+ * @run junit/othervm VarHandleTestMethodTypeFloat
+ * @run junit/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=true -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeFloat
+ * @run junit/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=false VarHandleTestMethodTypeFloat
+ * @run junit/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeFloat
  */
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import static org.testng.Assert.*;
-
 import static java.lang.invoke.MethodType.*;
 
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest {
     static final float static_final_v = 1.0f;
 
@@ -63,7 +63,7 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest {
 
     VarHandle vhArray;
 
-    @BeforeClass
+    @BeforeAll
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
                 VarHandleTestMethodTypeFloat.class, "final_v", float.class);
@@ -80,7 +80,6 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest {
         vhArray = MethodHandles.arrayElementVarHandle(float[].class);
     }
 
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -115,7 +114,8 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -124,7 +124,6 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest {
         }
     }
 
-
     static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeFloat recv, VarHandle vh) throws Throwable {
         // Get
         // Incorrect argument types
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeInt.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeInt.java
index a431c0a889e..e09427c55c7 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeInt.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeInt.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,26 +24,26 @@
 /*
  * @test
  * @bug 8156486
- * @run testng/othervm VarHandleTestMethodTypeInt
- * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=true -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeInt
- * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=false VarHandleTestMethodTypeInt
- * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeInt
+ * @run junit/othervm VarHandleTestMethodTypeInt
+ * @run junit/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=true -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeInt
+ * @run junit/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=false VarHandleTestMethodTypeInt
+ * @run junit/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeInt
  */
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import static org.testng.Assert.*;
-
 import static java.lang.invoke.MethodType.*;
 
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
     static final int static_final_v = 0x01234567;
 
@@ -63,7 +63,7 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
 
     VarHandle vhArray;
 
-    @BeforeClass
+    @BeforeAll
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
                 VarHandleTestMethodTypeInt.class, "final_v", int.class);
@@ -80,7 +80,6 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
         vhArray = MethodHandles.arrayElementVarHandle(int[].class);
     }
 
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -115,7 +114,8 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -124,7 +124,6 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest {
         }
     }
 
-
     static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeInt recv, VarHandle vh) throws Throwable {
         // Get
         // Incorrect argument types
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeLong.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeLong.java
index 53b9257d700..5944e935877 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeLong.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeLong.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,26 +24,26 @@
 /*
  * @test
  * @bug 8156486
- * @run testng/othervm VarHandleTestMethodTypeLong
- * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=true -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeLong
- * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=false VarHandleTestMethodTypeLong
- * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeLong
+ * @run junit/othervm VarHandleTestMethodTypeLong
+ * @run junit/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=true -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeLong
+ * @run junit/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=false VarHandleTestMethodTypeLong
+ * @run junit/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeLong
  */
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import static org.testng.Assert.*;
-
 import static java.lang.invoke.MethodType.*;
 
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
     static final long static_final_v = 0x0123456789ABCDEFL;
 
@@ -63,7 +63,7 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
 
     VarHandle vhArray;
 
-    @BeforeClass
+    @BeforeAll
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
                 VarHandleTestMethodTypeLong.class, "final_v", long.class);
@@ -80,7 +80,6 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
         vhArray = MethodHandles.arrayElementVarHandle(long[].class);
     }
 
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -115,7 +114,8 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -124,7 +124,6 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest {
         }
     }
 
-
     static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeLong recv, VarHandle vh) throws Throwable {
         // Get
         // Incorrect argument types
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeShort.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeShort.java
index 10dd5832c9b..fdb30ee88aa 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeShort.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeShort.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,26 +24,26 @@
 /*
  * @test
  * @bug 8156486
- * @run testng/othervm VarHandleTestMethodTypeShort
- * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=true -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeShort
- * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=false VarHandleTestMethodTypeShort
- * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeShort
+ * @run junit/othervm VarHandleTestMethodTypeShort
+ * @run junit/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=true -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeShort
+ * @run junit/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=false VarHandleTestMethodTypeShort
+ * @run junit/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeShort
  */
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import static org.testng.Assert.*;
-
 import static java.lang.invoke.MethodType.*;
 
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestMethodTypeShort extends VarHandleBaseTest {
     static final short static_final_v = (short)0x0123;
 
@@ -63,7 +63,7 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest {
 
     VarHandle vhArray;
 
-    @BeforeClass
+    @BeforeAll
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
                 VarHandleTestMethodTypeShort.class, "final_v", short.class);
@@ -80,7 +80,6 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest {
         vhArray = MethodHandles.arrayElementVarHandle(short[].class);
     }
 
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -115,7 +114,8 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -124,7 +124,6 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest {
         }
     }
 
-
     static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeShort recv, VarHandle vh) throws Throwable {
         // Get
         // Incorrect argument types
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeString.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeString.java
index d823a21d69f..2a5284ca36e 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeString.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestMethodTypeString.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,26 +24,26 @@
 /*
  * @test
  * @bug 8156486
- * @run testng/othervm VarHandleTestMethodTypeString
- * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=true -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeString
- * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=false VarHandleTestMethodTypeString
- * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeString
+ * @run junit/othervm VarHandleTestMethodTypeString
+ * @run junit/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=true -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeString
+ * @run junit/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=false VarHandleTestMethodTypeString
+ * @run junit/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodTypeString
  */
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import static org.testng.Assert.*;
-
 import static java.lang.invoke.MethodType.*;
 
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
     static final String static_final_v = "foo";
 
@@ -63,7 +63,7 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
 
     VarHandle vhArray;
 
-    @BeforeClass
+    @BeforeAll
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
                 VarHandleTestMethodTypeString.class, "final_v", String.class);
@@ -80,7 +80,6 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
         vhArray = MethodHandles.arrayElementVarHandle(String[].class);
     }
 
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -115,7 +114,8 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -124,7 +124,6 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest {
         }
     }
 
-
     static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeString recv, VarHandle vh) throws Throwable {
         // Get
         // Incorrect argument types
diff --git a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestReflection.java b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestReflection.java
index b20e18d263e..2c22fd5595b 100644
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleTestReflection.java
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleTestReflection.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2026, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,11 +23,9 @@
 
 /*
  * @test
- * @run testng VarHandleTestReflection
+ * @run junit VarHandleTestReflection
  */
 
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
 
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandleInfo;
@@ -36,11 +34,16 @@ import java.lang.invoke.VarHandle;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.stream.Stream;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestReflection extends VarHandleBaseTest {
     String string;
 
-    @DataProvider
     public static Object[][] accessModesProvider() {
         return Stream.of(VarHandle.AccessMode.values()).
                 map(am -> new Object[]{am}).
@@ -52,17 +55,19 @@ public class VarHandleTestReflection extends VarHandleBaseTest {
                 findVarHandle(VarHandleTestReflection.class, "string", String.class);
     }
 
-    @Test(dataProvider = "accessModesProvider", expectedExceptions = IllegalArgumentException.class)
+    @ParameterizedTest
+    @MethodSource("accessModesProvider")
     public void methodInvocationArgumentMismatch(VarHandle.AccessMode accessMode) throws Exception {
         VarHandle v = handle();
 
         // Try a reflective invoke using a Method, with no arguments
 
         Method vhm = VarHandle.class.getMethod(accessMode.methodName(), Object[].class);
-        vhm.invoke(v, new Object[]{});
+        assertThrows(IllegalArgumentException.class, () -> vhm.invoke(v, new Object[]{}));
     }
 
-    @Test(dataProvider = "accessModesProvider")
+    @ParameterizedTest
+    @MethodSource("accessModesProvider")
     public void methodInvocationMatchingArguments(VarHandle.AccessMode accessMode) throws Exception {
         VarHandle v = handle();
 
@@ -70,17 +75,15 @@ public class VarHandleTestReflection extends VarHandleBaseTest {
 
         Method vhm = VarHandle.class.getMethod(accessMode.methodName(), Object[].class);
         Object arg = new Object[0];
-        try {
-            vhm.invoke(v, arg);
-        } catch (InvocationTargetException e) {
-            if (!(e.getCause() instanceof UnsupportedOperationException)) {
-                throw new RuntimeException("expected UnsupportedOperationException but got: "
-                                           + e.getCause().getClass().getName(), e);
-            }
+        var e = assertThrows(InvocationTargetException.class, () -> vhm.invoke(v, arg));
+        if (!(e.getCause() instanceof UnsupportedOperationException)) {
+            throw new RuntimeException("expected UnsupportedOperationException but got: "
+                    + e.getCause().getClass().getName(), e);
         }
     }
 
-    @Test(dataProvider = "accessModesProvider", expectedExceptions = UnsupportedOperationException.class)
+    @ParameterizedTest
+    @MethodSource("accessModesProvider")
     public void methodHandleInvoke(VarHandle.AccessMode accessMode) throws Throwable {
         VarHandle v = handle();
 
@@ -90,10 +93,13 @@ public class VarHandleTestReflection extends VarHandleBaseTest {
                 VarHandle.class.getMethod(accessMode.methodName(), Object[].class));
         // Use invoke to avoid WrongMethodTypeException for
         // non-signature-polymorphic return types
-        Object o = (Object) mh.invoke(v, new Object[]{});
+        assertThrows(UnsupportedOperationException.class, () -> {
+            Object o = (Object) mh.invoke(v, new Object[]{});
+        });
     }
 
-    @Test(dataProvider = "accessModesProvider", expectedExceptions = IllegalArgumentException.class)
+    @ParameterizedTest
+    @MethodSource("accessModesProvider")
     public void methodInvocationFromMethodInfo(VarHandle.AccessMode accessMode) throws Exception {
         VarHandle v = handle();
 
@@ -104,10 +110,13 @@ public class VarHandleTestReflection extends VarHandleBaseTest {
                 VarHandle.class.getMethod(accessMode.methodName(), Object[].class));
         MethodHandleInfo info = MethodHandles.lookup().revealDirect(mh);
         Method im = info.reflectAs(Method.class, MethodHandles.lookup());
-        im.invoke(v, new Object[]{});
+        assertThrows(IllegalArgumentException.class, () -> {
+            im.invoke(v, new Object[]{});
+        });
     }
 
-    @Test(dataProvider = "accessModesProvider", expectedExceptions = IllegalArgumentException.class)
+    @ParameterizedTest
+    @MethodSource("accessModesProvider")
     public void reflectAsFromVarHandleInvoker(VarHandle.AccessMode accessMode) throws Exception {
         VarHandle v = handle();
 
@@ -116,10 +125,11 @@ public class VarHandleTestReflection extends VarHandleBaseTest {
 
         MethodHandleInfo info = MethodHandles.lookup().revealDirect(mh);
 
-        info.reflectAs(Method.class, MethodHandles.lookup());
+        assertThrows(IllegalArgumentException.class, () -> info.reflectAs(Method.class, MethodHandles.lookup()));
     }
 
-    @Test(dataProvider = "accessModesProvider", expectedExceptions = IllegalArgumentException.class)
+    @ParameterizedTest
+    @MethodSource("accessModesProvider")
     public void reflectAsFromFindVirtual(VarHandle.AccessMode accessMode) throws Exception {
         VarHandle v = handle();
 
@@ -128,6 +138,6 @@ public class VarHandleTestReflection extends VarHandleBaseTest {
 
         MethodHandleInfo info = MethodHandles.lookup().revealDirect(mh);
 
-        info.reflectAs(Method.class, MethodHandles.lookup());
+        assertThrows(IllegalArgumentException.class, () -> info.reflectAs(Method.class, MethodHandles.lookup()));
     }
 }
diff --git a/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template b/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template
index f3c90c5e8cc..b18dbb6e1b0 100644
--- a/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template
+++ b/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,28 +23,30 @@
 
 /*
  * @test
- * @run testng/othervm -Diters=10   -Xint                                                   VarHandleTestAccess$Type$
+ * @run junit/othervm -Diters=10   -Xint                                                   VarHandleTestAccess$Type$
  *
  * @comment Set CompileThresholdScaling to 0.1 so that the warmup loop sets to 2000 iterations
  *          to hit compilation thresholds
  *
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestAccess$Type$
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestAccess$Type$
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestAccess$Type$
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestAccess$Type$
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestAccess$Type$
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestAccess$Type$
  */
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
     static final $type$ static_final_v = $value1$;
 
@@ -115,7 +117,7 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
         return vhs.toArray(new VarHandle[0]);
     }
 
-    @BeforeClass
+    @BeforeAll
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
                 VarHandleTestAccess$Type$.class, "final_v", $type$.class);
@@ -135,8 +137,6 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
 #end[String]
     }
 
-
-    @DataProvider
     public Object[][] varHandlesProvider() throws Exception {
         List vhs = new ArrayList<>();
         vhs.add(vhField);
@@ -166,7 +166,8 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
         }
     }
 
-    @Test(dataProvider = "varHandlesProvider")
+    @ParameterizedTest
+    @MethodSource("varHandlesProvider")
     public void testIsAccessModeSupported(VarHandle vh) {
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET));
         assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.SET));
@@ -236,8 +237,6 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
 #end[Bitwise]
     }
 
-
-    @DataProvider
     public Object[][] typesProvider() throws Exception {
         List types = new ArrayList<>();
         types.add(new Object[] {vhField, Arrays.asList(VarHandleTestAccess$Type$.class)});
@@ -247,16 +246,16 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
         return types.stream().toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "typesProvider")
+    @ParameterizedTest
+    @MethodSource("typesProvider")
     public void testTypes(VarHandle vh, List> pts) {
-        assertEquals(vh.varType(), $type$.class);
+        assertEquals($type$.class, vh.varType());
 
-        assertEquals(vh.coordinateTypes(), pts);
+        assertEquals(pts, vh.coordinateTypes());
 
         testTypes(vh);
     }
 
-
     @Test
     public void testLookupInstanceToStatic() {
         checkIAE("Lookup of static final field to instance final field", () -> {
@@ -283,8 +282,6 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
         });
     }
 
-
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -335,7 +332,8 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -348,26 +346,26 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
         // Plain
         {
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, $value1$, "get $type$ value");
+            assertEquals($value1$, x, "get $type$ value");
         }
 
 
         // Volatile
         {
             $type$ x = ($type$) vh.getVolatile(recv);
-            assertEquals(x, $value1$, "getVolatile $type$ value");
+            assertEquals($value1$, x, "getVolatile $type$ value");
         }
 
         // Lazy
         {
             $type$ x = ($type$) vh.getAcquire(recv);
-            assertEquals(x, $value1$, "getRelease $type$ value");
+            assertEquals($value1$, x, "getRelease $type$ value");
         }
 
         // Opaque
         {
             $type$ x = ($type$) vh.getOpaque(recv);
-            assertEquals(x, $value1$, "getOpaque $type$ value");
+            assertEquals($value1$, x, "getOpaque $type$ value");
         }
     }
 
@@ -492,26 +490,26 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
         // Plain
         {
             $type$ x = ($type$) vh.get();
-            assertEquals(x, $value1$, "get $type$ value");
+            assertEquals($value1$, x, "get $type$ value");
         }
 
 
         // Volatile
         {
             $type$ x = ($type$) vh.getVolatile();
-            assertEquals(x, $value1$, "getVolatile $type$ value");
+            assertEquals($value1$, x, "getVolatile $type$ value");
         }
 
         // Lazy
         {
             $type$ x = ($type$) vh.getAcquire();
-            assertEquals(x, $value1$, "getRelease $type$ value");
+            assertEquals($value1$, x, "getRelease $type$ value");
         }
 
         // Opaque
         {
             $type$ x = ($type$) vh.getOpaque();
-            assertEquals(x, $value1$, "getOpaque $type$ value");
+            assertEquals($value1$, x, "getOpaque $type$ value");
         }
     }
 
@@ -637,7 +635,7 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
         {
             vh.set(recv, $value1$);
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, $value1$, "set $type$ value");
+            assertEquals($value1$, x, "set $type$ value");
         }
 
 
@@ -645,21 +643,21 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
         {
             vh.setVolatile(recv, $value2$);
             $type$ x = ($type$) vh.getVolatile(recv);
-            assertEquals(x, $value2$, "setVolatile $type$ value");
+            assertEquals($value2$, x, "setVolatile $type$ value");
         }
 
         // Lazy
         {
             vh.setRelease(recv, $value1$);
             $type$ x = ($type$) vh.getAcquire(recv);
-            assertEquals(x, $value1$, "setRelease $type$ value");
+            assertEquals($value1$, x, "setRelease $type$ value");
         }
 
         // Opaque
         {
             vh.setOpaque(recv, $value2$);
             $type$ x = ($type$) vh.getOpaque(recv);
-            assertEquals(x, $value2$, "setOpaque $type$ value");
+            assertEquals($value2$, x, "setOpaque $type$ value");
         }
 
 #if[CAS]
@@ -670,56 +668,56 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
             boolean r = vh.compareAndSet(recv, $value1$, $value2$);
             assertEquals(r, true, "success compareAndSet $type$");
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, $value2$, "success compareAndSet $type$ value");
+            assertEquals($value2$, x, "success compareAndSet $type$ value");
         }
 
         {
             boolean r = vh.compareAndSet(recv, $value1$, $value3$);
             assertEquals(r, false, "failing compareAndSet $type$");
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, $value2$, "failing compareAndSet $type$ value");
+            assertEquals($value2$, x, "failing compareAndSet $type$ value");
         }
 
         {
             $type$ r = ($type$) vh.compareAndExchange(recv, $value2$, $value1$);
             assertEquals(r, $value2$, "success compareAndExchange $type$");
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, $value1$, "success compareAndExchange $type$ value");
+            assertEquals($value1$, x, "success compareAndExchange $type$ value");
         }
 
         {
             $type$ r = ($type$) vh.compareAndExchange(recv, $value2$, $value3$);
             assertEquals(r, $value1$, "failing compareAndExchange $type$");
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, $value1$, "failing compareAndExchange $type$ value");
+            assertEquals($value1$, x, "failing compareAndExchange $type$ value");
         }
 
         {
             $type$ r = ($type$) vh.compareAndExchangeAcquire(recv, $value1$, $value2$);
             assertEquals(r, $value1$, "success compareAndExchangeAcquire $type$");
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, $value2$, "success compareAndExchangeAcquire $type$ value");
+            assertEquals($value2$, x, "success compareAndExchangeAcquire $type$ value");
         }
 
         {
             $type$ r = ($type$) vh.compareAndExchangeAcquire(recv, $value1$, $value3$);
             assertEquals(r, $value2$, "failing compareAndExchangeAcquire $type$");
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, $value2$, "failing compareAndExchangeAcquire $type$ value");
+            assertEquals($value2$, x, "failing compareAndExchangeAcquire $type$ value");
         }
 
         {
             $type$ r = ($type$) vh.compareAndExchangeRelease(recv, $value2$, $value1$);
             assertEquals(r, $value2$, "success compareAndExchangeRelease $type$");
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, $value1$, "success compareAndExchangeRelease $type$ value");
+            assertEquals($value1$, x, "success compareAndExchangeRelease $type$ value");
         }
 
         {
             $type$ r = ($type$) vh.compareAndExchangeRelease(recv, $value2$, $value3$);
             assertEquals(r, $value1$, "failing compareAndExchangeRelease $type$");
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, $value1$, "failing compareAndExchangeRelease $type$ value");
+            assertEquals($value1$, x, "failing compareAndExchangeRelease $type$ value");
         }
 
         {
@@ -730,14 +728,14 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain $type$");
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, $value2$, "success weakCompareAndSetPlain $type$ value");
+            assertEquals($value2$, x, "success weakCompareAndSetPlain $type$ value");
         }
 
         {
             boolean success = vh.weakCompareAndSetPlain(recv, $value1$, $value3$);
             assertEquals(success, false, "failing weakCompareAndSetPlain $type$");
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, $value2$, "failing weakCompareAndSetPlain $type$ value");
+            assertEquals($value2$, x, "failing weakCompareAndSetPlain $type$ value");
         }
 
         {
@@ -748,14 +746,14 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire $type$");
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, $value1$, "success weakCompareAndSetAcquire $type$");
+            assertEquals($value1$, x, "success weakCompareAndSetAcquire $type$");
         }
 
         {
             boolean success = vh.weakCompareAndSetAcquire(recv, $value2$, $value3$);
             assertEquals(success, false, "failing weakCompareAndSetAcquire $type$");
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, $value1$, "failing weakCompareAndSetAcquire $type$ value");
+            assertEquals($value1$, x, "failing weakCompareAndSetAcquire $type$ value");
         }
 
         {
@@ -766,14 +764,14 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease $type$");
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, $value2$, "success weakCompareAndSetRelease $type$");
+            assertEquals($value2$, x, "success weakCompareAndSetRelease $type$");
         }
 
         {
             boolean success = vh.weakCompareAndSetRelease(recv, $value1$, $value3$);
             assertEquals(success, false, "failing weakCompareAndSetRelease $type$");
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, $value2$, "failing weakCompareAndSetRelease $type$ value");
+            assertEquals($value2$, x, "failing weakCompareAndSetRelease $type$ value");
         }
 
         {
@@ -784,14 +782,14 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet $type$");
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, $value1$, "success weakCompareAndSet $type$ value");
+            assertEquals($value1$, x, "success weakCompareAndSet $type$ value");
         }
 
         {
             boolean success = vh.weakCompareAndSet(recv, $value2$, $value3$);
             assertEquals(success, false, "failing weakCompareAndSet $type$");
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, $value1$, "failing weakCompareAndSet $type$ value");
+            assertEquals($value1$, x, "failing weakCompareAndSet $type$ value");
         }
 
         // Compare set and get
@@ -799,27 +797,27 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
             vh.set(recv, $value1$);
 
             $type$ o = ($type$) vh.getAndSet(recv, $value2$);
-            assertEquals(o, $value1$, "getAndSet $type$");
+            assertEquals($value1$, o, "getAndSet $type$");
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, $value2$, "getAndSet $type$ value");
+            assertEquals($value2$, x, "getAndSet $type$ value");
         }
 
         {
             vh.set(recv, $value1$);
 
             $type$ o = ($type$) vh.getAndSetAcquire(recv, $value2$);
-            assertEquals(o, $value1$, "getAndSetAcquire $type$");
+            assertEquals($value1$, o, "getAndSetAcquire $type$");
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, $value2$, "getAndSetAcquire $type$ value");
+            assertEquals($value2$, x, "getAndSetAcquire $type$ value");
         }
 
         {
             vh.set(recv, $value1$);
 
             $type$ o = ($type$) vh.getAndSetRelease(recv, $value2$);
-            assertEquals(o, $value1$, "getAndSetRelease $type$");
+            assertEquals($value1$, o, "getAndSetRelease $type$");
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, $value2$, "getAndSetRelease $type$ value");
+            assertEquals($value2$, x, "getAndSetRelease $type$ value");
         }
 #end[CAS]
 
@@ -829,27 +827,27 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
             vh.set(recv, $value1$);
 
             $type$ o = ($type$) vh.getAndAdd(recv, $value2$);
-            assertEquals(o, $value1$, "getAndAdd $type$");
+            assertEquals($value1$, o, "getAndAdd $type$");
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, ($type$)($value1$ + $value2$), "getAndAdd $type$ value");
+            assertEquals(($type$)($value1$ + $value2$), x, "getAndAdd $type$ value");
         }
 
         {
             vh.set(recv, $value1$);
 
             $type$ o = ($type$) vh.getAndAddAcquire(recv, $value2$);
-            assertEquals(o, $value1$, "getAndAddAcquire $type$");
+            assertEquals($value1$, o, "getAndAddAcquire $type$");
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddAcquire $type$ value");
+            assertEquals(($type$)($value1$ + $value2$), x, "getAndAddAcquire $type$ value");
         }
 
         {
             vh.set(recv, $value1$);
 
             $type$ o = ($type$) vh.getAndAddRelease(recv, $value2$);
-            assertEquals(o, $value1$, "getAndAddRelease$type$");
+            assertEquals($value1$, o, "getAndAddRelease$type$");
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddRelease $type$ value");
+            assertEquals(($type$)($value1$ + $value2$), x, "getAndAddRelease $type$ value");
         }
 #end[AtomicAdd]
 
@@ -859,27 +857,27 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
             vh.set(recv, $value1$);
 
             $type$ o = ($type$) vh.getAndBitwiseOr(recv, $value2$);
-            assertEquals(o, $value1$, "getAndBitwiseOr $type$");
+            assertEquals($value1$, o, "getAndBitwiseOr $type$");
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOr $type$ value");
+            assertEquals(($type$)($value1$ | $value2$), x, "getAndBitwiseOr $type$ value");
         }
 
         {
             vh.set(recv, $value1$);
 
             $type$ o = ($type$) vh.getAndBitwiseOrAcquire(recv, $value2$);
-            assertEquals(o, $value1$, "getAndBitwiseOrAcquire $type$");
+            assertEquals($value1$, o, "getAndBitwiseOrAcquire $type$");
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrAcquire $type$ value");
+            assertEquals(($type$)($value1$ | $value2$), x, "getAndBitwiseOrAcquire $type$ value");
         }
 
         {
             vh.set(recv, $value1$);
 
             $type$ o = ($type$) vh.getAndBitwiseOrRelease(recv, $value2$);
-            assertEquals(o, $value1$, "getAndBitwiseOrRelease $type$");
+            assertEquals($value1$, o, "getAndBitwiseOrRelease $type$");
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrRelease $type$ value");
+            assertEquals(($type$)($value1$ | $value2$), x, "getAndBitwiseOrRelease $type$ value");
         }
 
         // get and bitwise and
@@ -887,27 +885,27 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
             vh.set(recv, $value1$);
 
             $type$ o = ($type$) vh.getAndBitwiseAnd(recv, $value2$);
-            assertEquals(o, $value1$, "getAndBitwiseAnd $type$");
+            assertEquals($value1$, o, "getAndBitwiseAnd $type$");
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAnd $type$ value");
+            assertEquals(($type$)($value1$ & $value2$), x, "getAndBitwiseAnd $type$ value");
         }
 
         {
             vh.set(recv, $value1$);
 
             $type$ o = ($type$) vh.getAndBitwiseAndAcquire(recv, $value2$);
-            assertEquals(o, $value1$, "getAndBitwiseAndAcquire $type$");
+            assertEquals($value1$, o, "getAndBitwiseAndAcquire $type$");
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndAcquire $type$ value");
+            assertEquals(($type$)($value1$ & $value2$), x, "getAndBitwiseAndAcquire $type$ value");
         }
 
         {
             vh.set(recv, $value1$);
 
             $type$ o = ($type$) vh.getAndBitwiseAndRelease(recv, $value2$);
-            assertEquals(o, $value1$, "getAndBitwiseAndRelease $type$");
+            assertEquals($value1$, o, "getAndBitwiseAndRelease $type$");
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndRelease $type$ value");
+            assertEquals(($type$)($value1$ & $value2$), x, "getAndBitwiseAndRelease $type$ value");
         }
 
         // get and bitwise xor
@@ -915,27 +913,27 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
             vh.set(recv, $value1$);
 
             $type$ o = ($type$) vh.getAndBitwiseXor(recv, $value2$);
-            assertEquals(o, $value1$, "getAndBitwiseXor $type$");
+            assertEquals($value1$, o, "getAndBitwiseXor $type$");
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXor $type$ value");
+            assertEquals(($type$)($value1$ ^ $value2$), x, "getAndBitwiseXor $type$ value");
         }
 
         {
             vh.set(recv, $value1$);
 
             $type$ o = ($type$) vh.getAndBitwiseXorAcquire(recv, $value2$);
-            assertEquals(o, $value1$, "getAndBitwiseXorAcquire $type$");
+            assertEquals($value1$, o, "getAndBitwiseXorAcquire $type$");
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorAcquire $type$ value");
+            assertEquals(($type$)($value1$ ^ $value2$), x, "getAndBitwiseXorAcquire $type$ value");
         }
 
         {
             vh.set(recv, $value1$);
 
             $type$ o = ($type$) vh.getAndBitwiseXorRelease(recv, $value2$);
-            assertEquals(o, $value1$, "getAndBitwiseXorRelease $type$");
+            assertEquals($value1$, o, "getAndBitwiseXorRelease $type$");
             $type$ x = ($type$) vh.get(recv);
-            assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorRelease $type$ value");
+            assertEquals(($type$)($value1$ ^ $value2$), x, "getAndBitwiseXorRelease $type$ value");
         }
 #end[Bitwise]
     }
@@ -1046,7 +1044,7 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
         {
             vh.set($value1$);
             $type$ x = ($type$) vh.get();
-            assertEquals(x, $value1$, "set $type$ value");
+            assertEquals($value1$, x, "set $type$ value");
         }
 
 
@@ -1054,21 +1052,21 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
         {
             vh.setVolatile($value2$);
             $type$ x = ($type$) vh.getVolatile();
-            assertEquals(x, $value2$, "setVolatile $type$ value");
+            assertEquals($value2$, x, "setVolatile $type$ value");
         }
 
         // Lazy
         {
             vh.setRelease($value1$);
             $type$ x = ($type$) vh.getAcquire();
-            assertEquals(x, $value1$, "setRelease $type$ value");
+            assertEquals($value1$, x, "setRelease $type$ value");
         }
 
         // Opaque
         {
             vh.setOpaque($value2$);
             $type$ x = ($type$) vh.getOpaque();
-            assertEquals(x, $value2$, "setOpaque $type$ value");
+            assertEquals($value2$, x, "setOpaque $type$ value");
         }
 
 #if[CAS]
@@ -1079,56 +1077,56 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
             boolean r = vh.compareAndSet($value1$, $value2$);
             assertEquals(r, true, "success compareAndSet $type$");
             $type$ x = ($type$) vh.get();
-            assertEquals(x, $value2$, "success compareAndSet $type$ value");
+            assertEquals($value2$, x, "success compareAndSet $type$ value");
         }
 
         {
             boolean r = vh.compareAndSet($value1$, $value3$);
             assertEquals(r, false, "failing compareAndSet $type$");
             $type$ x = ($type$) vh.get();
-            assertEquals(x, $value2$, "failing compareAndSet $type$ value");
+            assertEquals($value2$, x, "failing compareAndSet $type$ value");
         }
 
         {
             $type$ r = ($type$) vh.compareAndExchange($value2$, $value1$);
             assertEquals(r, $value2$, "success compareAndExchange $type$");
             $type$ x = ($type$) vh.get();
-            assertEquals(x, $value1$, "success compareAndExchange $type$ value");
+            assertEquals($value1$, x, "success compareAndExchange $type$ value");
         }
 
         {
             $type$ r = ($type$) vh.compareAndExchange($value2$, $value3$);
             assertEquals(r, $value1$, "failing compareAndExchange $type$");
             $type$ x = ($type$) vh.get();
-            assertEquals(x, $value1$, "failing compareAndExchange $type$ value");
+            assertEquals($value1$, x, "failing compareAndExchange $type$ value");
         }
 
         {
             $type$ r = ($type$) vh.compareAndExchangeAcquire($value1$, $value2$);
             assertEquals(r, $value1$, "success compareAndExchangeAcquire $type$");
             $type$ x = ($type$) vh.get();
-            assertEquals(x, $value2$, "success compareAndExchangeAcquire $type$ value");
+            assertEquals($value2$, x, "success compareAndExchangeAcquire $type$ value");
         }
 
         {
             $type$ r = ($type$) vh.compareAndExchangeAcquire($value1$, $value3$);
             assertEquals(r, $value2$, "failing compareAndExchangeAcquire $type$");
             $type$ x = ($type$) vh.get();
-            assertEquals(x, $value2$, "failing compareAndExchangeAcquire $type$ value");
+            assertEquals($value2$, x, "failing compareAndExchangeAcquire $type$ value");
         }
 
         {
             $type$ r = ($type$) vh.compareAndExchangeRelease($value2$, $value1$);
             assertEquals(r, $value2$, "success compareAndExchangeRelease $type$");
             $type$ x = ($type$) vh.get();
-            assertEquals(x, $value1$, "success compareAndExchangeRelease $type$ value");
+            assertEquals($value1$, x, "success compareAndExchangeRelease $type$ value");
         }
 
         {
             $type$ r = ($type$) vh.compareAndExchangeRelease($value2$, $value3$);
             assertEquals(r, $value1$, "failing compareAndExchangeRelease $type$");
             $type$ x = ($type$) vh.get();
-            assertEquals(x, $value1$, "failing compareAndExchangeRelease $type$ value");
+            assertEquals($value1$, x, "failing compareAndExchangeRelease $type$ value");
         }
 
         {
@@ -1139,14 +1137,14 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain $type$");
             $type$ x = ($type$) vh.get();
-            assertEquals(x, $value2$, "success weakCompareAndSetPlain $type$ value");
+            assertEquals($value2$, x, "success weakCompareAndSetPlain $type$ value");
         }
 
         {
             boolean success = vh.weakCompareAndSetPlain($value1$, $value3$);
             assertEquals(success, false, "failing weakCompareAndSetPlain $type$");
             $type$ x = ($type$) vh.get();
-            assertEquals(x, $value2$, "failing weakCompareAndSetPlain $type$ value");
+            assertEquals($value2$, x, "failing weakCompareAndSetPlain $type$ value");
         }
 
         {
@@ -1157,14 +1155,14 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire $type$");
             $type$ x = ($type$) vh.get();
-            assertEquals(x, $value1$, "success weakCompareAndSetAcquire $type$");
+            assertEquals($value1$, x, "success weakCompareAndSetAcquire $type$");
         }
 
         {
             boolean success = vh.weakCompareAndSetAcquire($value2$, $value3$);
             assertEquals(success, false, "failing weakCompareAndSetAcquire $type$");
             $type$ x = ($type$) vh.get();
-            assertEquals(x, $value1$, "failing weakCompareAndSetAcquire $type$ value");
+            assertEquals($value1$, x, "failing weakCompareAndSetAcquire $type$ value");
         }
 
         {
@@ -1175,14 +1173,14 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease $type$");
             $type$ x = ($type$) vh.get();
-            assertEquals(x, $value2$, "success weakCompareAndSetRelease $type$");
+            assertEquals($value2$, x, "success weakCompareAndSetRelease $type$");
         }
 
         {
             boolean success = vh.weakCompareAndSetRelease($value1$, $value3$);
             assertEquals(success, false, "failing weakCompareAndSetRelease $type$");
             $type$ x = ($type$) vh.get();
-            assertEquals(x, $value2$, "failing weakCompareAndSetRelease $type$ value");
+            assertEquals($value2$, x, "failing weakCompareAndSetRelease $type$ value");
         }
 
         {
@@ -1193,14 +1191,14 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet $type$");
             $type$ x = ($type$) vh.get();
-            assertEquals(x, $value1$, "success weakCompareAndSet $type$");
+            assertEquals($value1$, x, "success weakCompareAndSet $type$");
         }
 
         {
             boolean success = vh.weakCompareAndSet($value2$, $value3$);
             assertEquals(success, false, "failing weakCompareAndSet $type$");
             $type$ x = ($type$) vh.get();
-            assertEquals(x, $value1$, "failing weakCompareAndSet $type$ value");
+            assertEquals($value1$, x, "failing weakCompareAndSet $type$ value");
         }
 
         // Compare set and get
@@ -1208,27 +1206,27 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
             vh.set($value1$);
 
             $type$ o = ($type$) vh.getAndSet($value2$);
-            assertEquals(o, $value1$, "getAndSet $type$");
+            assertEquals($value1$, o, "getAndSet $type$");
             $type$ x = ($type$) vh.get();
-            assertEquals(x, $value2$, "getAndSet $type$ value");
+            assertEquals($value2$, x, "getAndSet $type$ value");
         }
 
         {
             vh.set($value1$);
 
             $type$ o = ($type$) vh.getAndSetAcquire($value2$);
-            assertEquals(o, $value1$, "getAndSetAcquire $type$");
+            assertEquals($value1$, o, "getAndSetAcquire $type$");
             $type$ x = ($type$) vh.get();
-            assertEquals(x, $value2$, "getAndSetAcquire $type$ value");
+            assertEquals($value2$, x, "getAndSetAcquire $type$ value");
         }
 
         {
             vh.set($value1$);
 
             $type$ o = ($type$) vh.getAndSetRelease($value2$);
-            assertEquals(o, $value1$, "getAndSetRelease $type$");
+            assertEquals($value1$, o, "getAndSetRelease $type$");
             $type$ x = ($type$) vh.get();
-            assertEquals(x, $value2$, "getAndSetRelease $type$ value");
+            assertEquals($value2$, x, "getAndSetRelease $type$ value");
         }
 #end[CAS]
 
@@ -1238,27 +1236,27 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
             vh.set($value1$);
 
             $type$ o = ($type$) vh.getAndAdd($value2$);
-            assertEquals(o, $value1$, "getAndAdd $type$");
+            assertEquals($value1$, o, "getAndAdd $type$");
             $type$ x = ($type$) vh.get();
-            assertEquals(x, ($type$)($value1$ + $value2$), "getAndAdd $type$ value");
+            assertEquals(($type$)($value1$ + $value2$), x, "getAndAdd $type$ value");
         }
 
         {
             vh.set($value1$);
 
             $type$ o = ($type$) vh.getAndAddAcquire($value2$);
-            assertEquals(o, $value1$, "getAndAddAcquire $type$");
+            assertEquals($value1$, o, "getAndAddAcquire $type$");
             $type$ x = ($type$) vh.get();
-            assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddAcquire $type$ value");
+            assertEquals(($type$)($value1$ + $value2$), x, "getAndAddAcquire $type$ value");
         }
 
         {
             vh.set($value1$);
 
             $type$ o = ($type$) vh.getAndAddRelease($value2$);
-            assertEquals(o, $value1$, "getAndAddRelease$type$");
+            assertEquals($value1$, o, "getAndAddRelease$type$");
             $type$ x = ($type$) vh.get();
-            assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddRelease $type$ value");
+            assertEquals(($type$)($value1$ + $value2$), x, "getAndAddRelease $type$ value");
         }
 #end[AtomicAdd]
 
@@ -1268,27 +1266,27 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
             vh.set($value1$);
 
             $type$ o = ($type$) vh.getAndBitwiseOr($value2$);
-            assertEquals(o, $value1$, "getAndBitwiseOr $type$");
+            assertEquals($value1$, o, "getAndBitwiseOr $type$");
             $type$ x = ($type$) vh.get();
-            assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOr $type$ value");
+            assertEquals(($type$)($value1$ | $value2$), x, "getAndBitwiseOr $type$ value");
         }
 
         {
             vh.set($value1$);
 
             $type$ o = ($type$) vh.getAndBitwiseOrAcquire($value2$);
-            assertEquals(o, $value1$, "getAndBitwiseOrAcquire $type$");
+            assertEquals($value1$, o, "getAndBitwiseOrAcquire $type$");
             $type$ x = ($type$) vh.get();
-            assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrAcquire $type$ value");
+            assertEquals(($type$)($value1$ | $value2$), x, "getAndBitwiseOrAcquire $type$ value");
         }
 
         {
             vh.set($value1$);
 
             $type$ o = ($type$) vh.getAndBitwiseOrRelease($value2$);
-            assertEquals(o, $value1$, "getAndBitwiseOrRelease $type$");
+            assertEquals($value1$, o, "getAndBitwiseOrRelease $type$");
             $type$ x = ($type$) vh.get();
-            assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrRelease $type$ value");
+            assertEquals(($type$)($value1$ | $value2$), x, "getAndBitwiseOrRelease $type$ value");
         }
 
         // get and bitwise and
@@ -1296,27 +1294,27 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
             vh.set($value1$);
 
             $type$ o = ($type$) vh.getAndBitwiseAnd($value2$);
-            assertEquals(o, $value1$, "getAndBitwiseAnd $type$");
+            assertEquals($value1$, o, "getAndBitwiseAnd $type$");
             $type$ x = ($type$) vh.get();
-            assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAnd $type$ value");
+            assertEquals(($type$)($value1$ & $value2$), x, "getAndBitwiseAnd $type$ value");
         }
 
         {
             vh.set($value1$);
 
             $type$ o = ($type$) vh.getAndBitwiseAndAcquire($value2$);
-            assertEquals(o, $value1$, "getAndBitwiseAndAcquire $type$");
+            assertEquals($value1$, o, "getAndBitwiseAndAcquire $type$");
             $type$ x = ($type$) vh.get();
-            assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndAcquire $type$ value");
+            assertEquals(($type$)($value1$ & $value2$), x, "getAndBitwiseAndAcquire $type$ value");
         }
 
         {
             vh.set($value1$);
 
             $type$ o = ($type$) vh.getAndBitwiseAndRelease($value2$);
-            assertEquals(o, $value1$, "getAndBitwiseAndRelease $type$");
+            assertEquals($value1$, o, "getAndBitwiseAndRelease $type$");
             $type$ x = ($type$) vh.get();
-            assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndRelease $type$ value");
+            assertEquals(($type$)($value1$ & $value2$), x, "getAndBitwiseAndRelease $type$ value");
         }
 
         // get and bitwise xor
@@ -1324,27 +1322,27 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
             vh.set($value1$);
 
             $type$ o = ($type$) vh.getAndBitwiseXor($value2$);
-            assertEquals(o, $value1$, "getAndBitwiseXor $type$");
+            assertEquals($value1$, o, "getAndBitwiseXor $type$");
             $type$ x = ($type$) vh.get();
-            assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXor $type$ value");
+            assertEquals(($type$)($value1$ ^ $value2$), x, "getAndBitwiseXor $type$ value");
         }
 
         {
             vh.set($value1$);
 
             $type$ o = ($type$) vh.getAndBitwiseXorAcquire($value2$);
-            assertEquals(o, $value1$, "getAndBitwiseXorAcquire $type$");
+            assertEquals($value1$, o, "getAndBitwiseXorAcquire $type$");
             $type$ x = ($type$) vh.get();
-            assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorAcquire $type$ value");
+            assertEquals(($type$)($value1$ ^ $value2$), x, "getAndBitwiseXorAcquire $type$ value");
         }
 
         {
             vh.set($value1$);
 
             $type$ o = ($type$) vh.getAndBitwiseXorRelease($value2$);
-            assertEquals(o, $value1$, "getAndBitwiseXorRelease $type$");
+            assertEquals($value1$, o, "getAndBitwiseXorRelease $type$");
             $type$ x = ($type$) vh.get();
-            assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorRelease $type$ value");
+            assertEquals(($type$)($value1$ ^ $value2$), x, "getAndBitwiseXorRelease $type$ value");
         }
 #end[Bitwise]
     }
@@ -1458,7 +1456,7 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
             {
                 vh.set(array, i, $value1$);
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, $value1$, "get $type$ value");
+                assertEquals($value1$, x, "get $type$ value");
             }
 
 
@@ -1466,21 +1464,21 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
             {
                 vh.setVolatile(array, i, $value2$);
                 $type$ x = ($type$) vh.getVolatile(array, i);
-                assertEquals(x, $value2$, "setVolatile $type$ value");
+                assertEquals($value2$, x, "setVolatile $type$ value");
             }
 
             // Lazy
             {
                 vh.setRelease(array, i, $value1$);
                 $type$ x = ($type$) vh.getAcquire(array, i);
-                assertEquals(x, $value1$, "setRelease $type$ value");
+                assertEquals($value1$, x, "setRelease $type$ value");
             }
 
             // Opaque
             {
                 vh.setOpaque(array, i, $value2$);
                 $type$ x = ($type$) vh.getOpaque(array, i);
-                assertEquals(x, $value2$, "setOpaque $type$ value");
+                assertEquals($value2$, x, "setOpaque $type$ value");
             }
 
 #if[CAS]
@@ -1491,56 +1489,56 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
                 boolean r = vh.compareAndSet(array, i, $value1$, $value2$);
                 assertEquals(r, true, "success compareAndSet $type$");
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, $value2$, "success compareAndSet $type$ value");
+                assertEquals($value2$, x, "success compareAndSet $type$ value");
             }
 
             {
                 boolean r = vh.compareAndSet(array, i, $value1$, $value3$);
                 assertEquals(r, false, "failing compareAndSet $type$");
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, $value2$, "failing compareAndSet $type$ value");
+                assertEquals($value2$, x, "failing compareAndSet $type$ value");
             }
 
             {
                 $type$ r = ($type$) vh.compareAndExchange(array, i, $value2$, $value1$);
                 assertEquals(r, $value2$, "success compareAndExchange $type$");
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, $value1$, "success compareAndExchange $type$ value");
+                assertEquals($value1$, x, "success compareAndExchange $type$ value");
             }
 
             {
                 $type$ r = ($type$) vh.compareAndExchange(array, i, $value2$, $value3$);
                 assertEquals(r, $value1$, "failing compareAndExchange $type$");
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, $value1$, "failing compareAndExchange $type$ value");
+                assertEquals($value1$, x, "failing compareAndExchange $type$ value");
             }
 
             {
                 $type$ r = ($type$) vh.compareAndExchangeAcquire(array, i, $value1$, $value2$);
                 assertEquals(r, $value1$, "success compareAndExchangeAcquire $type$");
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, $value2$, "success compareAndExchangeAcquire $type$ value");
+                assertEquals($value2$, x, "success compareAndExchangeAcquire $type$ value");
             }
 
             {
                 $type$ r = ($type$) vh.compareAndExchangeAcquire(array, i, $value1$, $value3$);
                 assertEquals(r, $value2$, "failing compareAndExchangeAcquire $type$");
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, $value2$, "failing compareAndExchangeAcquire $type$ value");
+                assertEquals($value2$, x, "failing compareAndExchangeAcquire $type$ value");
             }
 
             {
                 $type$ r = ($type$) vh.compareAndExchangeRelease(array, i, $value2$, $value1$);
                 assertEquals(r, $value2$, "success compareAndExchangeRelease $type$");
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, $value1$, "success compareAndExchangeRelease $type$ value");
+                assertEquals($value1$, x, "success compareAndExchangeRelease $type$ value");
             }
 
             {
                 $type$ r = ($type$) vh.compareAndExchangeRelease(array, i, $value2$, $value3$);
                 assertEquals(r, $value1$, "failing compareAndExchangeRelease $type$");
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, $value1$, "failing compareAndExchangeRelease $type$ value");
+                assertEquals($value1$, x, "failing compareAndExchangeRelease $type$ value");
             }
 
             {
@@ -1551,14 +1549,14 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetPlain $type$");
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, $value2$, "success weakCompareAndSetPlain $type$ value");
+                assertEquals($value2$, x, "success weakCompareAndSetPlain $type$ value");
             }
 
             {
                 boolean success = vh.weakCompareAndSetPlain(array, i, $value1$, $value3$);
                 assertEquals(success, false, "failing weakCompareAndSetPlain $type$");
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, $value2$, "failing weakCompareAndSetPlain $type$ value");
+                assertEquals($value2$, x, "failing weakCompareAndSetPlain $type$ value");
             }
 
             {
@@ -1569,14 +1567,14 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetAcquire $type$");
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, $value1$, "success weakCompareAndSetAcquire $type$");
+                assertEquals($value1$, x, "success weakCompareAndSetAcquire $type$");
             }
 
             {
                 boolean success = vh.weakCompareAndSetAcquire(array, i, $value2$, $value3$);
                 assertEquals(success, false, "failing weakCompareAndSetAcquire $type$");
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, $value1$, "failing weakCompareAndSetAcquire $type$ value");
+                assertEquals($value1$, x, "failing weakCompareAndSetAcquire $type$ value");
             }
 
             {
@@ -1587,14 +1585,14 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetRelease $type$");
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, $value2$, "success weakCompareAndSetRelease $type$");
+                assertEquals($value2$, x, "success weakCompareAndSetRelease $type$");
             }
 
             {
                 boolean success = vh.weakCompareAndSetRelease(array, i, $value1$, $value3$);
                 assertEquals(success, false, "failing weakCompareAndSetRelease $type$");
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, $value2$, "failing weakCompareAndSetRelease $type$ value");
+                assertEquals($value2$, x, "failing weakCompareAndSetRelease $type$ value");
             }
 
             {
@@ -1605,14 +1603,14 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSet $type$");
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, $value1$, "success weakCompareAndSet $type$");
+                assertEquals($value1$, x, "success weakCompareAndSet $type$");
             }
 
             {
                 boolean success = vh.weakCompareAndSet(array, i, $value2$, $value3$);
                 assertEquals(success, false, "failing weakCompareAndSet $type$");
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, $value1$, "failing weakCompareAndSet $type$ value");
+                assertEquals($value1$, x, "failing weakCompareAndSet $type$ value");
             }
 
             // Compare set and get
@@ -1620,27 +1618,27 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
                 vh.set(array, i, $value1$);
 
                 $type$ o = ($type$) vh.getAndSet(array, i, $value2$);
-                assertEquals(o, $value1$, "getAndSet $type$");
+                assertEquals($value1$, o, "getAndSet $type$");
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, $value2$, "getAndSet $type$ value");
+                assertEquals($value2$, x, "getAndSet $type$ value");
             }
 
             {
                 vh.set(array, i, $value1$);
 
                 $type$ o = ($type$) vh.getAndSetAcquire(array, i, $value2$);
-                assertEquals(o, $value1$, "getAndSetAcquire $type$");
+                assertEquals($value1$, o, "getAndSetAcquire $type$");
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, $value2$, "getAndSetAcquire $type$ value");
+                assertEquals($value2$, x, "getAndSetAcquire $type$ value");
             }
 
             {
                 vh.set(array, i, $value1$);
 
                 $type$ o = ($type$) vh.getAndSetRelease(array, i, $value2$);
-                assertEquals(o, $value1$, "getAndSetRelease $type$");
+                assertEquals($value1$, o, "getAndSetRelease $type$");
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, $value2$, "getAndSetRelease $type$ value");
+                assertEquals($value2$, x, "getAndSetRelease $type$ value");
             }
 #end[CAS]
 
@@ -1650,27 +1648,27 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
                 vh.set(array, i, $value1$);
 
                 $type$ o = ($type$) vh.getAndAdd(array, i, $value2$);
-                assertEquals(o, $value1$, "getAndAdd $type$");
+                assertEquals($value1$, o, "getAndAdd $type$");
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, ($type$)($value1$ + $value2$), "getAndAdd $type$ value");
+                assertEquals(($type$)($value1$ + $value2$), x, "getAndAdd $type$ value");
             }
 
             {
                 vh.set(array, i, $value1$);
 
                 $type$ o = ($type$) vh.getAndAddAcquire(array, i, $value2$);
-                assertEquals(o, $value1$, "getAndAddAcquire $type$");
+                assertEquals($value1$, o, "getAndAddAcquire $type$");
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddAcquire $type$ value");
+                assertEquals(($type$)($value1$ + $value2$), x, "getAndAddAcquire $type$ value");
             }
 
             {
                 vh.set(array, i, $value1$);
 
                 $type$ o = ($type$) vh.getAndAddRelease(array, i, $value2$);
-                assertEquals(o, $value1$, "getAndAddRelease$type$");
+                assertEquals($value1$, o, "getAndAddRelease$type$");
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddRelease $type$ value");
+                assertEquals(($type$)($value1$ + $value2$), x, "getAndAddRelease $type$ value");
             }
 #end[AtomicAdd]
 
@@ -1680,27 +1678,27 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
                 vh.set(array, i, $value1$);
 
                 $type$ o = ($type$) vh.getAndBitwiseOr(array, i, $value2$);
-                assertEquals(o, $value1$, "getAndBitwiseOr $type$");
+                assertEquals($value1$, o, "getAndBitwiseOr $type$");
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOr $type$ value");
+                assertEquals(($type$)($value1$ | $value2$), x, "getAndBitwiseOr $type$ value");
             }
 
             {
                 vh.set(array, i, $value1$);
 
                 $type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, i, $value2$);
-                assertEquals(o, $value1$, "getAndBitwiseOrAcquire $type$");
+                assertEquals($value1$, o, "getAndBitwiseOrAcquire $type$");
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrAcquire $type$ value");
+                assertEquals(($type$)($value1$ | $value2$), x, "getAndBitwiseOrAcquire $type$ value");
             }
 
             {
                 vh.set(array, i, $value1$);
 
                 $type$ o = ($type$) vh.getAndBitwiseOrRelease(array, i, $value2$);
-                assertEquals(o, $value1$, "getAndBitwiseOrRelease $type$");
+                assertEquals($value1$, o, "getAndBitwiseOrRelease $type$");
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrRelease $type$ value");
+                assertEquals(($type$)($value1$ | $value2$), x, "getAndBitwiseOrRelease $type$ value");
             }
 
             // get and bitwise and
@@ -1708,27 +1706,27 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
                 vh.set(array, i, $value1$);
 
                 $type$ o = ($type$) vh.getAndBitwiseAnd(array, i, $value2$);
-                assertEquals(o, $value1$, "getAndBitwiseAnd $type$");
+                assertEquals($value1$, o, "getAndBitwiseAnd $type$");
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAnd $type$ value");
+                assertEquals(($type$)($value1$ & $value2$), x, "getAndBitwiseAnd $type$ value");
             }
 
             {
                 vh.set(array, i, $value1$);
 
                 $type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, i, $value2$);
-                assertEquals(o, $value1$, "getAndBitwiseAndAcquire $type$");
+                assertEquals($value1$, o, "getAndBitwiseAndAcquire $type$");
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndAcquire $type$ value");
+                assertEquals(($type$)($value1$ & $value2$), x, "getAndBitwiseAndAcquire $type$ value");
             }
 
             {
                 vh.set(array, i, $value1$);
 
                 $type$ o = ($type$) vh.getAndBitwiseAndRelease(array, i, $value2$);
-                assertEquals(o, $value1$, "getAndBitwiseAndRelease $type$");
+                assertEquals($value1$, o, "getAndBitwiseAndRelease $type$");
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndRelease $type$ value");
+                assertEquals(($type$)($value1$ & $value2$), x, "getAndBitwiseAndRelease $type$ value");
             }
 
             // get and bitwise xor
@@ -1736,27 +1734,27 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
                 vh.set(array, i, $value1$);
 
                 $type$ o = ($type$) vh.getAndBitwiseXor(array, i, $value2$);
-                assertEquals(o, $value1$, "getAndBitwiseXor $type$");
+                assertEquals($value1$, o, "getAndBitwiseXor $type$");
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXor $type$ value");
+                assertEquals(($type$)($value1$ ^ $value2$), x, "getAndBitwiseXor $type$ value");
             }
 
             {
                 vh.set(array, i, $value1$);
 
                 $type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, i, $value2$);
-                assertEquals(o, $value1$, "getAndBitwiseXorAcquire $type$");
+                assertEquals($value1$, o, "getAndBitwiseXorAcquire $type$");
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorAcquire $type$ value");
+                assertEquals(($type$)($value1$ ^ $value2$), x, "getAndBitwiseXorAcquire $type$ value");
             }
 
             {
                 vh.set(array, i, $value1$);
 
                 $type$ o = ($type$) vh.getAndBitwiseXorRelease(array, i, $value2$);
-                assertEquals(o, $value1$, "getAndBitwiseXorRelease $type$");
+                assertEquals($value1$, o, "getAndBitwiseXorRelease $type$");
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorRelease $type$ value");
+                assertEquals(($type$)($value1$ ^ $value2$), x, "getAndBitwiseXorRelease $type$ value");
             }
 #end[Bitwise]
         }
diff --git a/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template b/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template
index c21709d6d37..9a40bfb2780 100644
--- a/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template
+++ b/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,25 +26,25 @@
  * @bug 8154556
  * @comment Set CompileThresholdScaling to 0.1 so that the warmup loop sets to 2000 iterations
  *          to hit compilation thresholds
- * @run testng/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAs$Type$
- * @run testng/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestByteArrayAs$Type$
- * @run testng/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestByteArrayAs$Type$
+ * @run junit/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:TieredStopAtLevel=1 VarHandleTestByteArrayAs$Type$
+ * @run junit/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1                         VarHandleTestByteArrayAs$Type$
+ * @run junit/othervm/timeout=360 -Diters=2000 -XX:CompileThresholdScaling=0.1 -XX:-TieredCompilation  VarHandleTestByteArrayAs$Type$
  */
 
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.EnumSet;
 import java.util.List;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
     static final int SIZE = $BoxType$.BYTES;
 
@@ -111,7 +111,8 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
         }
     }
 
-    @Test(dataProvider = "varHandlesProvider")
+    @ParameterizedTest
+    @MethodSource("VarHandleBaseByteArrayTest#varHandlesProvider")
     public void testIsAccessModeSupported(VarHandleSource vhs) {
         VarHandle vh = vhs.s;
 
@@ -206,17 +207,16 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
 #end[Bitwise]
     }
 
-    @Test(dataProvider = "typesProvider")
+    @ParameterizedTest
+    @MethodSource("typesProvider")
     public void testTypes(VarHandle vh, List> pts) {
-        assertEquals(vh.varType(), $type$.class);
+        assertEquals($type$.class, vh.varType());
 
-        assertEquals(vh.coordinateTypes(), pts);
+        assertEquals(pts, vh.coordinateTypes());
 
         testTypes(vh);
     }
 
-
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -278,7 +278,8 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -287,7 +288,6 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
         }
     }
 
-
     static void testArrayNPE(ByteArraySource bs, VarHandleSource vhs) {
         VarHandle vh = vhs.s;
         byte[] array = null;
@@ -1272,7 +1272,7 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
             {
                 vh.set(array, i, VALUE_1);
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, VALUE_1, "get $type$ value");
+                assertEquals(VALUE_1, x, "get $type$ value");
             }
         }
     }
@@ -1291,7 +1291,7 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
             {
                 vh.set(array, i, VALUE_1);
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, VALUE_1, "get $type$ value");
+                assertEquals(VALUE_1, x, "get $type$ value");
             }
 
             if (iAligned) {
@@ -1299,21 +1299,21 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
                 {
                     vh.setVolatile(array, i, VALUE_2);
                     $type$ x = ($type$) vh.getVolatile(array, i);
-                    assertEquals(x, VALUE_2, "setVolatile $type$ value");
+                    assertEquals(VALUE_2, x, "setVolatile $type$ value");
                 }
 
                 // Lazy
                 {
                     vh.setRelease(array, i, VALUE_1);
                     $type$ x = ($type$) vh.getAcquire(array, i);
-                    assertEquals(x, VALUE_1, "setRelease $type$ value");
+                    assertEquals(VALUE_1, x, "setRelease $type$ value");
                 }
 
                 // Opaque
                 {
                     vh.setOpaque(array, i, VALUE_2);
                     $type$ x = ($type$) vh.getOpaque(array, i);
-                    assertEquals(x, VALUE_2, "setOpaque $type$ value");
+                    assertEquals(VALUE_2, x, "setOpaque $type$ value");
                 }
 #if[CAS]
 
@@ -1324,56 +1324,56 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
                     boolean r = vh.compareAndSet(array, i, VALUE_1, VALUE_2);
                     assertEquals(r, true, "success compareAndSet $type$");
                     $type$ x = ($type$) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "success compareAndSet $type$ value");
+                    assertEquals(VALUE_2, x, "success compareAndSet $type$ value");
                 }
 
                 {
                     boolean r = vh.compareAndSet(array, i, VALUE_1, VALUE_3);
                     assertEquals(r, false, "failing compareAndSet $type$");
                     $type$ x = ($type$) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "failing compareAndSet $type$ value");
+                    assertEquals(VALUE_2, x, "failing compareAndSet $type$ value");
                 }
 
                 {
                     $type$ r = ($type$) vh.compareAndExchange(array, i, VALUE_2, VALUE_1);
                     assertEquals(r, VALUE_2, "success compareAndExchange $type$");
                     $type$ x = ($type$) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "success compareAndExchange $type$ value");
+                    assertEquals(VALUE_1, x, "success compareAndExchange $type$ value");
                 }
 
                 {
                     $type$ r = ($type$) vh.compareAndExchange(array, i, VALUE_2, VALUE_3);
                     assertEquals(r, VALUE_1, "failing compareAndExchange $type$");
                     $type$ x = ($type$) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "failing compareAndExchange $type$ value");
+                    assertEquals(VALUE_1, x, "failing compareAndExchange $type$ value");
                 }
 
                 {
                     $type$ r = ($type$) vh.compareAndExchangeAcquire(array, i, VALUE_1, VALUE_2);
                     assertEquals(r, VALUE_1, "success compareAndExchangeAcquire $type$");
                     $type$ x = ($type$) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "success compareAndExchangeAcquire $type$ value");
+                    assertEquals(VALUE_2, x, "success compareAndExchangeAcquire $type$ value");
                 }
 
                 {
                     $type$ r = ($type$) vh.compareAndExchangeAcquire(array, i, VALUE_1, VALUE_3);
                     assertEquals(r, VALUE_2, "failing compareAndExchangeAcquire $type$");
                     $type$ x = ($type$) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "failing compareAndExchangeAcquire $type$ value");
+                    assertEquals(VALUE_2, x, "failing compareAndExchangeAcquire $type$ value");
                 }
 
                 {
                     $type$ r = ($type$) vh.compareAndExchangeRelease(array, i, VALUE_2, VALUE_1);
                     assertEquals(r, VALUE_2, "success compareAndExchangeRelease $type$");
                     $type$ x = ($type$) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "success compareAndExchangeRelease $type$ value");
+                    assertEquals(VALUE_1, x, "success compareAndExchangeRelease $type$ value");
                 }
 
                 {
                     $type$ r = ($type$) vh.compareAndExchangeRelease(array, i, VALUE_2, VALUE_3);
                     assertEquals(r, VALUE_1, "failing compareAndExchangeRelease $type$");
                     $type$ x = ($type$) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "failing compareAndExchangeRelease $type$ value");
+                    assertEquals(VALUE_1, x, "failing compareAndExchangeRelease $type$ value");
                 }
 
                 {
@@ -1384,14 +1384,14 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
                     }
                     assertEquals(success, true, "success weakCompareAndSetPlain $type$");
                     $type$ x = ($type$) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "success weakCompareAndSetPlain $type$ value");
+                    assertEquals(VALUE_2, x, "success weakCompareAndSetPlain $type$ value");
                 }
 
                 {
                     boolean success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_3);
                     assertEquals(success, false, "failing weakCompareAndSetPlain $type$");
                     $type$ x = ($type$) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "failing weakCompareAndSetPlain $type$ value");
+                    assertEquals(VALUE_2, x, "failing weakCompareAndSetPlain $type$ value");
                 }
 
                 {
@@ -1402,14 +1402,14 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
                     }
                     assertEquals(success, true, "success weakCompareAndSetAcquire $type$");
                     $type$ x = ($type$) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "success weakCompareAndSetAcquire $type$");
+                    assertEquals(VALUE_1, x, "success weakCompareAndSetAcquire $type$");
                 }
 
                 {
                     boolean success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_3);
                     assertEquals(success, false, "failing weakCompareAndSetAcquire $type$");
                     $type$ x = ($type$) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "failing weakCompareAndSetAcquire $type$ value");
+                    assertEquals(VALUE_1, x, "failing weakCompareAndSetAcquire $type$ value");
                 }
 
                 {
@@ -1420,14 +1420,14 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
                     }
                     assertEquals(success, true, "success weakCompareAndSetRelease $type$");
                     $type$ x = ($type$) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "success weakCompareAndSetRelease $type$");
+                    assertEquals(VALUE_2, x, "success weakCompareAndSetRelease $type$");
                 }
 
                 {
                     boolean success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_3);
                     assertEquals(success, false, "failing weakCompareAndSetRelease $type$");
                     $type$ x = ($type$) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "failing weakCompareAndSetRelease $type$ value");
+                    assertEquals(VALUE_2, x, "failing weakCompareAndSetRelease $type$ value");
                 }
 
                 {
@@ -1438,14 +1438,14 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
                     }
                     assertEquals(success, true, "success weakCompareAndSet $type$");
                     $type$ x = ($type$) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "success weakCompareAndSet $type$");
+                    assertEquals(VALUE_1, x, "success weakCompareAndSet $type$");
                 }
 
                 {
                     boolean success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_3);
                     assertEquals(success, false, "failing weakCompareAndSet $type$");
                     $type$ x = ($type$) vh.get(array, i);
-                    assertEquals(x, VALUE_1, "failing weakCompareAndSet $type$ value");
+                    assertEquals(VALUE_1, x, "failing weakCompareAndSet $type$ value");
                 }
 
                 // Compare set and get
@@ -1453,27 +1453,27 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
                     vh.set(array, i, VALUE_1);
 
                     $type$ o = ($type$) vh.getAndSet(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndSet $type$");
+                    assertEquals(VALUE_1, o, "getAndSet $type$");
                     $type$ x = ($type$) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "getAndSet $type$ value");
+                    assertEquals(VALUE_2, x, "getAndSet $type$ value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     $type$ o = ($type$) vh.getAndSetAcquire(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndSetAcquire $type$");
+                    assertEquals(VALUE_1, o, "getAndSetAcquire $type$");
                     $type$ x = ($type$) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "getAndSetAcquire $type$ value");
+                    assertEquals(VALUE_2, x, "getAndSetAcquire $type$ value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     $type$ o = ($type$) vh.getAndSetRelease(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndSetRelease $type$");
+                    assertEquals(VALUE_1, o, "getAndSetRelease $type$");
                     $type$ x = ($type$) vh.get(array, i);
-                    assertEquals(x, VALUE_2, "getAndSetRelease $type$ value");
+                    assertEquals(VALUE_2, x, "getAndSetRelease $type$ value");
                 }
 #end[CAS]
 
@@ -1483,27 +1483,27 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
                     vh.set(array, i, VALUE_1);
 
                     $type$ o = ($type$) vh.getAndAdd(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndAdd $type$");
+                    assertEquals(VALUE_1, o, "getAndAdd $type$");
                     $type$ x = ($type$) vh.get(array, i);
-                    assertEquals(x, VALUE_1 + VALUE_2, "getAndAdd $type$ value");
+                    assertEquals(VALUE_1 + VALUE_2, x,  "getAndAdd $type$ value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     $type$ o = ($type$) vh.getAndAddAcquire(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndAddAcquire $type$");
+                    assertEquals(VALUE_1, o, "getAndAddAcquire $type$");
                     $type$ x = ($type$) vh.get(array, i);
-                    assertEquals(x, VALUE_1 + VALUE_2, "getAndAddAcquire $type$ value");
+                    assertEquals(VALUE_1 + VALUE_2, x,  "getAndAddAcquire $type$ value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     $type$ o = ($type$) vh.getAndAddRelease(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndAddRelease $type$");
+                    assertEquals(VALUE_1, o, "getAndAddRelease $type$");
                     $type$ x = ($type$) vh.get(array, i);
-                    assertEquals(x, VALUE_1 + VALUE_2, "getAndAddRelease $type$ value");
+                    assertEquals(VALUE_1 + VALUE_2, x,  "getAndAddRelease $type$ value");
                 }
 #end[AtomicAdd]
 
@@ -1513,27 +1513,27 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
                     vh.set(array, i, VALUE_1);
 
                     $type$ o = ($type$) vh.getAndBitwiseOr(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndBitwiseOr $type$");
+                    assertEquals(VALUE_1, o, "getAndBitwiseOr $type$");
                     $type$ x = ($type$) vh.get(array, i);
-                    assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOr $type$ value");
+                    assertEquals(VALUE_1 | VALUE_2, x, "getAndBitwiseOr $type$ value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     $type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndBitwiseOrAcquire $type$");
+                    assertEquals(VALUE_1, o, "getAndBitwiseOrAcquire $type$");
                     $type$ x = ($type$) vh.get(array, i);
-                    assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrAcquire $type$ value");
+                    assertEquals(VALUE_1 | VALUE_2, x, "getAndBitwiseOrAcquire $type$ value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     $type$ o = ($type$) vh.getAndBitwiseOrRelease(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndBitwiseOrRelease $type$");
+                    assertEquals(VALUE_1, o, "getAndBitwiseOrRelease $type$");
                     $type$ x = ($type$) vh.get(array, i);
-                    assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrRelease $type$ value");
+                    assertEquals(VALUE_1 | VALUE_2, x, "getAndBitwiseOrRelease $type$ value");
                 }
 
                 // get and bitwise and
@@ -1541,27 +1541,27 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
                     vh.set(array, i, VALUE_1);
 
                     $type$ o = ($type$) vh.getAndBitwiseAnd(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndBitwiseAnd $type$");
+                    assertEquals(VALUE_1, o, "getAndBitwiseAnd $type$");
                     $type$ x = ($type$) vh.get(array, i);
-                    assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAnd $type$ value");
+                    assertEquals(VALUE_1 & VALUE_2, x, "getAndBitwiseAnd $type$ value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     $type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndBitwiseAndAcquire $type$");
+                    assertEquals(VALUE_1, o, "getAndBitwiseAndAcquire $type$");
                     $type$ x = ($type$) vh.get(array, i);
-                    assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndAcquire $type$ value");
+                    assertEquals(VALUE_1 & VALUE_2, x, "getAndBitwiseAndAcquire $type$ value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     $type$ o = ($type$) vh.getAndBitwiseAndRelease(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndBitwiseAndRelease $type$");
+                    assertEquals(VALUE_1, o, "getAndBitwiseAndRelease $type$");
                     $type$ x = ($type$) vh.get(array, i);
-                    assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndRelease $type$ value");
+                    assertEquals(VALUE_1 & VALUE_2, x, "getAndBitwiseAndRelease $type$ value");
                 }
 
                 // get and bitwise xor
@@ -1569,27 +1569,27 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
                     vh.set(array, i, VALUE_1);
 
                     $type$ o = ($type$) vh.getAndBitwiseXor(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndBitwiseXor $type$");
+                    assertEquals(VALUE_1, o, "getAndBitwiseXor $type$");
                     $type$ x = ($type$) vh.get(array, i);
-                    assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXor $type$ value");
+                    assertEquals(VALUE_1 ^ VALUE_2, x, "getAndBitwiseXor $type$ value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     $type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndBitwiseXorAcquire $type$");
+                    assertEquals(VALUE_1, o, "getAndBitwiseXorAcquire $type$");
                     $type$ x = ($type$) vh.get(array, i);
-                    assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorAcquire $type$ value");
+                    assertEquals(VALUE_1 ^ VALUE_2, x, "getAndBitwiseXorAcquire $type$ value");
                 }
 
                 {
                     vh.set(array, i, VALUE_1);
 
                     $type$ o = ($type$) vh.getAndBitwiseXorRelease(array, i, VALUE_2);
-                    assertEquals(o, VALUE_1, "getAndBitwiseXorRelease $type$");
+                    assertEquals(VALUE_1, o, "getAndBitwiseXorRelease $type$");
                     $type$ x = ($type$) vh.get(array, i);
-                    assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorRelease $type$ value");
+                    assertEquals(VALUE_1 ^ VALUE_2, x, "getAndBitwiseXorRelease $type$ value");
                 }
 #end[Bitwise]
             }
@@ -1614,26 +1614,26 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
             // Plain
             {
                 $type$ x = ($type$) vh.get(array, i);
-                assertEquals(x, v, "get $type$ value");
+                assertEquals(v, x, "get $type$ value");
             }
 
             if (iAligned) {
                 // Volatile
                 {
                     $type$ x = ($type$) vh.getVolatile(array, i);
-                    assertEquals(x, v, "getVolatile $type$ value");
+                    assertEquals(v, x, "getVolatile $type$ value");
                 }
 
                 // Lazy
                 {
                     $type$ x = ($type$) vh.getAcquire(array, i);
-                    assertEquals(x, v, "getRelease $type$ value");
+                    assertEquals(v, x, "getRelease $type$ value");
                 }
 
                 // Opaque
                 {
                     $type$ x = ($type$) vh.getOpaque(array, i);
-                    assertEquals(x, v, "getOpaque $type$ value");
+                    assertEquals(v, x, "getOpaque $type$ value");
                 }
             }
         }
diff --git a/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template b/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template
index 4a9fa7c4fe8..a347b232d7e 100644
--- a/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template
+++ b/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,22 +25,22 @@
  * @test
  * @comment Set CompileThresholdScaling to 0.1 so that the warmup loop sets to 2000 iterations
  *          to hit compilation thresholds
- * @run testng/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 VarHandleTestMethodHandleAccess$Type$
+ * @run junit/othervm -Diters=2000 -XX:CompileThresholdScaling=0.1 VarHandleTestMethodHandleAccess$Type$
  */
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
     static final $type$ static_final_v = $value1$;
 
@@ -60,7 +60,7 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
 
     VarHandle vhArray;
 
-    @BeforeClass
+    @BeforeAll
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
                 VarHandleTestMethodHandleAccess$Type$.class, "final_v", $type$.class);
@@ -77,8 +77,6 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
         vhArray = MethodHandles.arrayElementVarHandle($type$[].class);
     }
 
-
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -111,7 +109,8 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -120,13 +119,12 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
         }
     }
 
-
     static void testInstanceField(VarHandleTestMethodHandleAccess$Type$ recv, Handles hs) throws Throwable {
         // Plain
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, $value1$, "set $type$ value");
+            assertEquals($value1$, x, "set $type$ value");
         }
 
 
@@ -134,21 +132,21 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
         {
             hs.get(TestAccessMode.SET_VOLATILE).invokeExact(recv, $value2$);
             $type$ x = ($type$) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(recv);
-            assertEquals(x, $value2$, "setVolatile $type$ value");
+            assertEquals($value2$, x, "setVolatile $type$ value");
         }
 
         // Lazy
         {
             hs.get(TestAccessMode.SET_RELEASE).invokeExact(recv, $value1$);
             $type$ x = ($type$) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(recv);
-            assertEquals(x, $value1$, "setRelease $type$ value");
+            assertEquals($value1$, x, "setRelease $type$ value");
         }
 
         // Opaque
         {
             hs.get(TestAccessMode.SET_OPAQUE).invokeExact(recv, $value2$);
             $type$ x = ($type$) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(recv);
-            assertEquals(x, $value2$, "setOpaque $type$ value");
+            assertEquals($value2$, x, "setOpaque $type$ value");
         }
 
 #if[CAS]
@@ -159,56 +157,56 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, $value1$, $value2$);
             assertEquals(r, true, "success compareAndSet $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, $value2$, "success compareAndSet $type$ value");
+            assertEquals($value2$, x, "success compareAndSet $type$ value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(recv, $value1$, $value3$);
             assertEquals(r, false, "failing compareAndSet $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, $value2$, "failing compareAndSet $type$ value");
+            assertEquals($value2$, x, "failing compareAndSet $type$ value");
         }
 
         {
             $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(recv, $value2$, $value1$);
             assertEquals(r, $value2$, "success compareAndExchange $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, $value1$, "success compareAndExchange $type$ value");
+            assertEquals($value1$, x, "success compareAndExchange $type$ value");
         }
 
         {
             $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(recv, $value2$, $value3$);
             assertEquals(r, $value1$, "failing compareAndExchange $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, $value1$, "failing compareAndExchange $type$ value");
+            assertEquals($value1$, x, "failing compareAndExchange $type$ value");
         }
 
         {
             $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, $value1$, $value2$);
             assertEquals(r, $value1$, "success compareAndExchangeAcquire $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, $value2$, "success compareAndExchangeAcquire $type$ value");
+            assertEquals($value2$, x, "success compareAndExchangeAcquire $type$ value");
         }
 
         {
             $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(recv, $value1$, $value3$);
             assertEquals(r, $value2$, "failing compareAndExchangeAcquire $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, $value2$, "failing compareAndExchangeAcquire $type$ value");
+            assertEquals($value2$, x, "failing compareAndExchangeAcquire $type$ value");
         }
 
         {
             $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, $value2$, $value1$);
             assertEquals(r, $value2$, "success compareAndExchangeRelease $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, $value1$, "success compareAndExchangeRelease $type$ value");
+            assertEquals($value1$, x, "success compareAndExchangeRelease $type$ value");
         }
 
         {
             $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(recv, $value2$, $value3$);
             assertEquals(r, $value1$, "failing compareAndExchangeRelease $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, $value1$, "failing compareAndExchangeRelease $type$ value");
+            assertEquals($value1$, x, "failing compareAndExchangeRelease $type$ value");
         }
 
         {
@@ -220,14 +218,14 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, $value2$, "success weakCompareAndSetPlain $type$ value");
+            assertEquals($value2$, x, "success weakCompareAndSetPlain $type$ value");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, $value1$, $value3$);
             assertEquals(success, false, "failing weakCompareAndSetPlain $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, $value2$, "failing weakCompareAndSetPlain $type$ value");
+            assertEquals($value2$, x, "failing weakCompareAndSetPlain $type$ value");
         }
 
         {
@@ -239,14 +237,14 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, $value1$, "success weakCompareAndSetAcquire $type$");
+            assertEquals($value1$, x, "success weakCompareAndSetAcquire $type$");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, $value2$, $value3$);
             assertEquals(success, false, "failing weakCompareAndSetAcquire $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, $value1$, "failing weakCompareAndSetAcquire $type$ value");
+            assertEquals($value1$, x, "failing weakCompareAndSetAcquire $type$ value");
         }
 
         {
@@ -258,14 +256,14 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, $value2$, "success weakCompareAndSetRelease $type$");
+            assertEquals($value2$, x, "success weakCompareAndSetRelease $type$");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, $value1$, $value3$);
             assertEquals(success, false, "failing weakCompareAndSetRelease $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, $value2$, "failing weakCompareAndSetRelease $type$ value");
+            assertEquals($value2$, x, "failing weakCompareAndSetRelease $type$ value");
         }
 
         {
@@ -277,22 +275,22 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, $value1$, "success weakCompareAndSet $type$");
+            assertEquals($value1$, x, "success weakCompareAndSet $type$");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, $value2$, $value3$);
             assertEquals(success, false, "failing weakCompareAndSet $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, $value1$, "failing weakCompareAndSet $type$ value");
+            assertEquals($value1$, x, "failing weakCompareAndSet $type$ value");
         }
 
         // Compare set and get
         {
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET).invokeExact(recv, $value2$);
-            assertEquals(o, $value1$, "getAndSet $type$");
+            assertEquals($value1$, o, "getAndSet $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, $value2$, "getAndSet $type$ value");
+            assertEquals($value2$, x, "getAndSet $type$ value");
         }
 #end[CAS]
 
@@ -302,27 +300,27 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, $value2$);
-            assertEquals(o, $value1$, "getAndAdd $type$");
+            assertEquals($value1$, o, "getAndAdd $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, ($type$)($value1$ + $value2$), "getAndAdd $type$ value");
+            assertEquals(($type$)($value1$ + $value2$), x, "getAndAdd $type$ value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, $value2$);
-            assertEquals(o, $value1$, "getAndAddAcquire $type$");
+            assertEquals($value1$, o, "getAndAddAcquire $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddAcquire $type$ value");
+            assertEquals(($type$)($value1$ + $value2$), x, "getAndAddAcquire $type$ value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, $value2$);
-            assertEquals(o, $value1$, "getAndAddRelease $type$");
+            assertEquals($value1$, o, "getAndAddRelease $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddRelease $type$ value");
+            assertEquals(($type$)($value1$ + $value2$), x, "getAndAddRelease $type$ value");
         }
 #end[AtomicAdd]
 
@@ -332,27 +330,27 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(recv, $value2$);
-            assertEquals(o, $value1$, "getAndBitwiseOr $type$");
+            assertEquals($value1$, o, "getAndBitwiseOr $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOr $type$ value");
+            assertEquals(($type$)($value1$ | $value2$), x, "getAndBitwiseOr $type$ value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(recv, $value2$);
-            assertEquals(o, $value1$, "getAndBitwiseOrAcquire $type$");
+            assertEquals($value1$, o, "getAndBitwiseOrAcquire $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrAcquire $type$ value");
+            assertEquals(($type$)($value1$ | $value2$), x, "getAndBitwiseOrAcquire $type$ value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(recv, $value2$);
-            assertEquals(o, $value1$, "getAndBitwiseOrRelease $type$");
+            assertEquals($value1$, o, "getAndBitwiseOrRelease $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrRelease $type$ value");
+            assertEquals(($type$)($value1$ | $value2$), x, "getAndBitwiseOrRelease $type$ value");
         }
 
         // get and bitwise and
@@ -360,27 +358,27 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(recv, $value2$);
-            assertEquals(o, $value1$, "getAndBitwiseAnd $type$");
+            assertEquals($value1$, o, "getAndBitwiseAnd $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAnd $type$ value");
+            assertEquals(($type$)($value1$ & $value2$), x, "getAndBitwiseAnd $type$ value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(recv, $value2$);
-            assertEquals(o, $value1$, "getAndBitwiseAndAcquire $type$");
+            assertEquals($value1$, o, "getAndBitwiseAndAcquire $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndAcquire $type$ value");
+            assertEquals(($type$)($value1$ & $value2$), x, "getAndBitwiseAndAcquire $type$ value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(recv, $value2$);
-            assertEquals(o, $value1$, "getAndBitwiseAndRelease $type$");
+            assertEquals($value1$, o, "getAndBitwiseAndRelease $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndRelease $type$ value");
+            assertEquals(($type$)($value1$ & $value2$), x, "getAndBitwiseAndRelease $type$ value");
         }
 
         // get and bitwise xor
@@ -388,27 +386,27 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(recv, $value2$);
-            assertEquals(o, $value1$, "getAndBitwiseXor $type$");
+            assertEquals($value1$, o, "getAndBitwiseXor $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXor $type$ value");
+            assertEquals(($type$)($value1$ ^ $value2$), x, "getAndBitwiseXor $type$ value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(recv, $value2$);
-            assertEquals(o, $value1$, "getAndBitwiseXorAcquire $type$");
+            assertEquals($value1$, o, "getAndBitwiseXorAcquire $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorAcquire $type$ value");
+            assertEquals(($type$)($value1$ ^ $value2$), x, "getAndBitwiseXorAcquire $type$ value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(recv, $value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(recv, $value2$);
-            assertEquals(o, $value1$, "getAndBitwiseXorRelease $type$");
+            assertEquals($value1$, o, "getAndBitwiseXorRelease $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
-            assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorRelease $type$ value");
+            assertEquals(($type$)($value1$ ^ $value2$), x, "getAndBitwiseXorRelease $type$ value");
         }
 #end[Bitwise]
     }
@@ -457,7 +455,7 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
         {
             hs.get(TestAccessMode.SET).invokeExact($value1$);
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, $value1$, "set $type$ value");
+            assertEquals($value1$, x, "set $type$ value");
         }
 
 
@@ -465,21 +463,21 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
         {
             hs.get(TestAccessMode.SET_VOLATILE).invokeExact($value2$);
             $type$ x = ($type$) hs.get(TestAccessMode.GET_VOLATILE).invokeExact();
-            assertEquals(x, $value2$, "setVolatile $type$ value");
+            assertEquals($value2$, x, "setVolatile $type$ value");
         }
 
         // Lazy
         {
             hs.get(TestAccessMode.SET_RELEASE).invokeExact($value1$);
             $type$ x = ($type$) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact();
-            assertEquals(x, $value1$, "setRelease $type$ value");
+            assertEquals($value1$, x, "setRelease $type$ value");
         }
 
         // Opaque
         {
             hs.get(TestAccessMode.SET_OPAQUE).invokeExact($value2$);
             $type$ x = ($type$) hs.get(TestAccessMode.GET_OPAQUE).invokeExact();
-            assertEquals(x, $value2$, "setOpaque $type$ value");
+            assertEquals($value2$, x, "setOpaque $type$ value");
         }
 
 #if[CAS]
@@ -490,56 +488,56 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact($value1$, $value2$);
             assertEquals(r, true, "success compareAndSet $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, $value2$, "success compareAndSet $type$ value");
+            assertEquals($value2$, x, "success compareAndSet $type$ value");
         }
 
         {
             boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact($value1$, $value3$);
             assertEquals(r, false, "failing compareAndSet $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, $value2$, "failing compareAndSet $type$ value");
+            assertEquals($value2$, x, "failing compareAndSet $type$ value");
         }
 
         {
             $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact($value2$, $value1$);
             assertEquals(r, $value2$, "success compareAndExchange $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, $value1$, "success compareAndExchange $type$ value");
+            assertEquals($value1$, x, "success compareAndExchange $type$ value");
         }
 
         {
             $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact($value2$, $value3$);
             assertEquals(r, $value1$, "failing compareAndExchange $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, $value1$, "failing compareAndExchange $type$ value");
+            assertEquals($value1$, x, "failing compareAndExchange $type$ value");
         }
 
         {
             $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact($value1$, $value2$);
             assertEquals(r, $value1$, "success compareAndExchangeAcquire $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, $value2$, "success compareAndExchangeAcquire $type$ value");
+            assertEquals($value2$, x, "success compareAndExchangeAcquire $type$ value");
         }
 
         {
             $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact($value1$, $value3$);
             assertEquals(r, $value2$, "failing compareAndExchangeAcquire $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, $value2$, "failing compareAndExchangeAcquire $type$ value");
+            assertEquals($value2$, x, "failing compareAndExchangeAcquire $type$ value");
         }
 
         {
             $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact($value2$, $value1$);
             assertEquals(r, $value2$, "success compareAndExchangeRelease $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, $value1$, "success compareAndExchangeRelease $type$ value");
+            assertEquals($value1$, x, "success compareAndExchangeRelease $type$ value");
         }
 
         {
             $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact($value2$, $value3$);
             assertEquals(r, $value1$, "failing compareAndExchangeRelease $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, $value1$, "failing compareAndExchangeRelease $type$ value");
+            assertEquals($value1$, x, "failing compareAndExchangeRelease $type$ value");
         }
 
         {
@@ -551,14 +549,14 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetPlain $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, $value2$, "success weakCompareAndSetPlain $type$ value");
+            assertEquals($value2$, x, "success weakCompareAndSetPlain $type$ value");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact($value1$, $value3$);
             assertEquals(success, false, "failing weakCompareAndSetPlain $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, $value2$, "failing weakCompareAndSetPlain $type$ value");
+            assertEquals($value2$, x, "failing weakCompareAndSetPlain $type$ value");
         }
 
         {
@@ -570,7 +568,7 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetAcquire $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, $value1$, "success weakCompareAndSetAcquire $type$");
+            assertEquals($value1$, x, "success weakCompareAndSetAcquire $type$");
         }
 
         {
@@ -578,7 +576,7 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
             boolean success = (boolean) mh.invokeExact($value2$, $value3$);
             assertEquals(success, false, "failing weakCompareAndSetAcquire $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, $value1$, "failing weakCompareAndSetAcquire $type$ value");
+            assertEquals($value1$, x, "failing weakCompareAndSetAcquire $type$ value");
         }
 
         {
@@ -590,14 +588,14 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSetRelease $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, $value2$, "success weakCompareAndSetRelease $type$");
+            assertEquals($value2$, x, "success weakCompareAndSetRelease $type$");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact($value1$, $value3$);
             assertEquals(success, false, "failing weakCompareAndSetRelease $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, $value2$, "failing weakCompareAndSetRelease $type$ value");
+            assertEquals($value2$, x, "failing weakCompareAndSetRelease $type$ value");
         }
 
         {
@@ -609,14 +607,14 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
             }
             assertEquals(success, true, "success weakCompareAndSet $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, $value1$, "success weakCompareAndSet $type$");
+            assertEquals($value1$, x, "success weakCompareAndSet $type$");
         }
 
         {
             boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact($value2$, $value3$);
             assertEquals(success, false, "failing weakCompareAndSet $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, $value1$, "failing weakCompareAndSetRe $type$ value");
+            assertEquals($value1$, x, "failing weakCompareAndSetRe $type$ value");
         }
 
         // Compare set and get
@@ -624,9 +622,9 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact($value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET).invokeExact($value2$);
-            assertEquals(o, $value1$, "getAndSet $type$");
+            assertEquals($value1$, o, "getAndSet $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, $value2$, "getAndSet $type$ value");
+            assertEquals($value2$, x, "getAndSet $type$ value");
         }
 
         // Compare set and get
@@ -634,9 +632,9 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact($value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact($value2$);
-            assertEquals(o, $value1$, "getAndSetAcquire $type$");
+            assertEquals($value1$, o, "getAndSetAcquire $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, $value2$, "getAndSetAcquire $type$ value");
+            assertEquals($value2$, x, "getAndSetAcquire $type$ value");
         }
 
         // Compare set and get
@@ -644,9 +642,9 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact($value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact($value2$);
-            assertEquals(o, $value1$, "getAndSetRelease $type$");
+            assertEquals($value1$, o, "getAndSetRelease $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, $value2$, "getAndSetRelease $type$ value");
+            assertEquals($value2$, x, "getAndSetRelease $type$ value");
         }
 #end[CAS]
 
@@ -656,27 +654,27 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact($value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD).invokeExact($value2$);
-            assertEquals(o, $value1$, "getAndAdd $type$");
+            assertEquals($value1$, o, "getAndAdd $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, ($type$)($value1$ + $value2$), "getAndAdd $type$ value");
+            assertEquals(($type$)($value1$ + $value2$), x, "getAndAdd $type$ value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact($value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact($value2$);
-            assertEquals(o, $value1$, "getAndAddAcquire $type$");
+            assertEquals($value1$, o, "getAndAddAcquire $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddAcquire $type$ value");
+            assertEquals(($type$)($value1$ + $value2$), x, "getAndAddAcquire $type$ value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact($value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact($value2$);
-            assertEquals(o, $value1$, "getAndAddRelease $type$");
+            assertEquals($value1$, o, "getAndAddRelease $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddRelease $type$ value");
+            assertEquals(($type$)($value1$ + $value2$), x, "getAndAddRelease $type$ value");
         }
 #end[AtomicAdd]
 
@@ -686,27 +684,27 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact($value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact($value2$);
-            assertEquals(o, $value1$, "getAndBitwiseOr $type$");
+            assertEquals($value1$, o, "getAndBitwiseOr $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOr $type$ value");
+            assertEquals(($type$)($value1$ | $value2$), x, "getAndBitwiseOr $type$ value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact($value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact($value2$);
-            assertEquals(o, $value1$, "getAndBitwiseOrAcquire $type$");
+            assertEquals($value1$, o, "getAndBitwiseOrAcquire $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrAcquire $type$ value");
+            assertEquals(($type$)($value1$ | $value2$), x, "getAndBitwiseOrAcquire $type$ value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact($value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact($value2$);
-            assertEquals(o, $value1$, "getAndBitwiseOrRelease $type$");
+            assertEquals($value1$, o, "getAndBitwiseOrRelease $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrRelease $type$ value");
+            assertEquals(($type$)($value1$ | $value2$), x, "getAndBitwiseOrRelease $type$ value");
         }
 
         // get and bitwise and
@@ -714,27 +712,27 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact($value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact($value2$);
-            assertEquals(o, $value1$, "getAndBitwiseAnd $type$");
+            assertEquals($value1$, o, "getAndBitwiseAnd $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAnd $type$ value");
+            assertEquals(($type$)($value1$ & $value2$), x, "getAndBitwiseAnd $type$ value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact($value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact($value2$);
-            assertEquals(o, $value1$, "getAndBitwiseAndAcquire $type$");
+            assertEquals($value1$, o, "getAndBitwiseAndAcquire $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndAcquire $type$ value");
+            assertEquals(($type$)($value1$ & $value2$), x, "getAndBitwiseAndAcquire $type$ value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact($value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact($value2$);
-            assertEquals(o, $value1$, "getAndBitwiseAndRelease $type$");
+            assertEquals($value1$, o, "getAndBitwiseAndRelease $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndRelease $type$ value");
+            assertEquals(($type$)($value1$ & $value2$), x, "getAndBitwiseAndRelease $type$ value");
         }
 
         // get and bitwise xor
@@ -742,27 +740,27 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact($value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact($value2$);
-            assertEquals(o, $value1$, "getAndBitwiseXor $type$");
+            assertEquals($value1$, o, "getAndBitwiseXor $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXor $type$ value");
+            assertEquals(($type$)($value1$ ^ $value2$), x, "getAndBitwiseXor $type$ value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact($value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact($value2$);
-            assertEquals(o, $value1$, "getAndBitwiseXorAcquire $type$");
+            assertEquals($value1$, o, "getAndBitwiseXorAcquire $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorAcquire $type$ value");
+            assertEquals(($type$)($value1$ ^ $value2$), x, "getAndBitwiseXorAcquire $type$ value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact($value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact($value2$);
-            assertEquals(o, $value1$, "getAndBitwiseXorRelease $type$");
+            assertEquals($value1$, o, "getAndBitwiseXorRelease $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
-            assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorRelease $type$ value");
+            assertEquals(($type$)($value1$ ^ $value2$), x, "getAndBitwiseXorRelease $type$ value");
         }
 #end[Bitwise]
     }
@@ -814,7 +812,7 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
                 $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, $value1$, "get $type$ value");
+                assertEquals($value1$, x, "get $type$ value");
             }
 
 
@@ -822,21 +820,21 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
             {
                 hs.get(TestAccessMode.SET_VOLATILE).invokeExact(array, i, $value2$);
                 $type$ x = ($type$) hs.get(TestAccessMode.GET_VOLATILE).invokeExact(array, i);
-                assertEquals(x, $value2$, "setVolatile $type$ value");
+                assertEquals($value2$, x, "setVolatile $type$ value");
             }
 
             // Lazy
             {
                 hs.get(TestAccessMode.SET_RELEASE).invokeExact(array, i, $value1$);
                 $type$ x = ($type$) hs.get(TestAccessMode.GET_ACQUIRE).invokeExact(array, i);
-                assertEquals(x, $value1$, "setRelease $type$ value");
+                assertEquals($value1$, x, "setRelease $type$ value");
             }
 
             // Opaque
             {
                 hs.get(TestAccessMode.SET_OPAQUE).invokeExact(array, i, $value2$);
                 $type$ x = ($type$) hs.get(TestAccessMode.GET_OPAQUE).invokeExact(array, i);
-                assertEquals(x, $value2$, "setOpaque $type$ value");
+                assertEquals($value2$, x, "setOpaque $type$ value");
             }
 
 #if[CAS]
@@ -847,56 +845,56 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
                 boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, $value1$, $value2$);
                 assertEquals(r, true, "success compareAndSet $type$");
                 $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, $value2$, "success compareAndSet $type$ value");
+                assertEquals($value2$, x, "success compareAndSet $type$ value");
             }
 
             {
                 boolean r = (boolean) hs.get(TestAccessMode.COMPARE_AND_SET).invokeExact(array, i, $value1$, $value3$);
                 assertEquals(r, false, "failing compareAndSet $type$");
                 $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, $value2$, "failing compareAndSet $type$ value");
+                assertEquals($value2$, x, "failing compareAndSet $type$ value");
             }
 
             {
                 $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(array, i, $value2$, $value1$);
                 assertEquals(r, $value2$, "success compareAndExchange $type$");
                 $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, $value1$, "success compareAndExchange $type$ value");
+                assertEquals($value1$, x, "success compareAndExchange $type$ value");
             }
 
             {
                 $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE).invokeExact(array, i, $value2$, $value3$);
                 assertEquals(r, $value1$, "failing compareAndExchange $type$");
                 $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, $value1$, "failing compareAndExchange $type$ value");
+                assertEquals($value1$, x, "failing compareAndExchange $type$ value");
             }
 
             {
                 $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, $value1$, $value2$);
                 assertEquals(r, $value1$, "success compareAndExchangeAcquire $type$");
                 $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, $value2$, "success compareAndExchangeAcquire $type$ value");
+                assertEquals($value2$, x, "success compareAndExchangeAcquire $type$ value");
             }
 
             {
                 $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_ACQUIRE).invokeExact(array, i, $value1$, $value3$);
                 assertEquals(r, $value2$, "failing compareAndExchangeAcquire $type$");
                 $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, $value2$, "failing compareAndExchangeAcquire $type$ value");
+                assertEquals($value2$, x, "failing compareAndExchangeAcquire $type$ value");
             }
 
             {
                 $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, $value2$, $value1$);
                 assertEquals(r, $value2$, "success compareAndExchangeRelease $type$");
                 $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, $value1$, "success compareAndExchangeRelease $type$ value");
+                assertEquals($value1$, x, "success compareAndExchangeRelease $type$ value");
             }
 
             {
                 $type$ r = ($type$) hs.get(TestAccessMode.COMPARE_AND_EXCHANGE_RELEASE).invokeExact(array, i, $value2$, $value3$);
                 assertEquals(r, $value1$, "failing compareAndExchangeRelease $type$");
                 $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, $value1$, "failing compareAndExchangeRelease $type$ value");
+                assertEquals($value1$, x, "failing compareAndExchangeRelease $type$ value");
             }
 
             {
@@ -908,14 +906,14 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetPlain $type$");
                 $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, $value2$, "success weakCompareAndSetPlain $type$ value");
+                assertEquals($value2$, x, "success weakCompareAndSetPlain $type$ value");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, $value1$, $value3$);
                 assertEquals(success, false, "failing weakCompareAndSetPlain $type$");
                 $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, $value2$, "failing weakCompareAndSetPlain $type$ value");
+                assertEquals($value2$, x, "failing weakCompareAndSetPlain $type$ value");
             }
 
             {
@@ -927,14 +925,14 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetAcquire $type$");
                 $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, $value1$, "success weakCompareAndSetAcquire $type$");
+                assertEquals($value1$, x, "success weakCompareAndSetAcquire $type$");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, $value2$, $value3$);
                 assertEquals(success, false, "failing weakCompareAndSetAcquire $type$");
                 $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, $value1$, "failing weakCompareAndSetAcquire $type$ value");
+                assertEquals($value1$, x, "failing weakCompareAndSetAcquire $type$ value");
             }
 
             {
@@ -946,14 +944,14 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSetRelease $type$");
                 $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, $value2$, "success weakCompareAndSetRelease $type$");
+                assertEquals($value2$, x, "success weakCompareAndSetRelease $type$");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, $value1$, $value3$);
                 assertEquals(success, false, "failing weakCompareAndSetAcquire $type$");
                 $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, $value2$, "failing weakCompareAndSetAcquire $type$ value");
+                assertEquals($value2$, x, "failing weakCompareAndSetAcquire $type$ value");
             }
 
             {
@@ -965,14 +963,14 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
                 }
                 assertEquals(success, true, "success weakCompareAndSet $type$");
                 $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, $value1$, "success weakCompareAndSet $type$");
+                assertEquals($value1$, x, "success weakCompareAndSet $type$");
             }
 
             {
                 boolean success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, $value2$, $value3$);
                 assertEquals(success, false, "failing weakCompareAndSet $type$");
                 $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, $value1$, "failing weakCompareAndSet $type$ value");
+                assertEquals($value1$, x, "failing weakCompareAndSet $type$ value");
             }
 
             // Compare set and get
@@ -980,27 +978,27 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
 
                 $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, $value2$);
-                assertEquals(o, $value1$, "getAndSet $type$");
+                assertEquals($value1$, o, "getAndSet $type$");
                 $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, $value2$, "getAndSet $type$ value");
+                assertEquals($value2$, x, "getAndSet $type$ value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
 
                 $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, $value2$);
-                assertEquals(o, $value1$, "getAndSetAcquire $type$");
+                assertEquals($value1$, o, "getAndSetAcquire $type$");
                 $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, $value2$, "getAndSetAcquire $type$ value");
+                assertEquals($value2$, x, "getAndSetAcquire $type$ value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
 
                 $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, $value2$);
-                assertEquals(o, $value1$, "getAndSetRelease $type$");
+                assertEquals($value1$, o, "getAndSetRelease $type$");
                 $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, $value2$, "getAndSetRelease $type$ value");
+                assertEquals($value2$, x, "getAndSetRelease $type$ value");
             }
 #end[CAS]
 
@@ -1010,27 +1008,27 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
 
                 $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, $value2$);
-                assertEquals(o, $value1$, "getAndAdd $type$");
+                assertEquals($value1$, o, "getAndAdd $type$");
                 $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, ($type$)($value1$ + $value2$), "getAndAdd $type$ value");
+                assertEquals(($type$)($value1$ + $value2$), x, "getAndAdd $type$ value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
 
                 $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, $value2$);
-                assertEquals(o, $value1$, "getAndAddAcquire $type$");
+                assertEquals($value1$, o, "getAndAddAcquire $type$");
                 $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddAcquire $type$ value");
+                assertEquals(($type$)($value1$ + $value2$), x, "getAndAddAcquire $type$ value");
             }
 
             {
                 hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
 
                 $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, $value2$);
-                assertEquals(o, $value1$, "getAndAddRelease $type$");
+                assertEquals($value1$, o, "getAndAddRelease $type$");
                 $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-                assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddRelease $type$ value");
+                assertEquals(($type$)($value1$ + $value2$), x, "getAndAddRelease $type$ value");
             }
 #end[AtomicAdd]
 
@@ -1040,27 +1038,27 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(array, i, $value2$);
-            assertEquals(o, $value1$, "getAndBitwiseOr $type$");
+            assertEquals($value1$, o, "getAndBitwiseOr $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOr $type$ value");
+            assertEquals(($type$)($value1$ | $value2$), x, "getAndBitwiseOr $type$ value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(array, i, $value2$);
-            assertEquals(o, $value1$, "getAndBitwiseOrAcquire $type$");
+            assertEquals($value1$, o, "getAndBitwiseOrAcquire $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrAcquire $type$ value");
+            assertEquals(($type$)($value1$ | $value2$), x, "getAndBitwiseOrAcquire $type$ value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(array, i, $value2$);
-            assertEquals(o, $value1$, "getAndBitwiseOrRelease $type$");
+            assertEquals($value1$, o, "getAndBitwiseOrRelease $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrRelease $type$ value");
+            assertEquals(($type$)($value1$ | $value2$), x, "getAndBitwiseOrRelease $type$ value");
         }
 
         // get and bitwise and
@@ -1068,27 +1066,27 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(array, i, $value2$);
-            assertEquals(o, $value1$, "getAndBitwiseAnd $type$");
+            assertEquals($value1$, o, "getAndBitwiseAnd $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAnd $type$ value");
+            assertEquals(($type$)($value1$ & $value2$), x, "getAndBitwiseAnd $type$ value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(array, i, $value2$);
-            assertEquals(o, $value1$, "getAndBitwiseAndAcquire $type$");
+            assertEquals($value1$, o, "getAndBitwiseAndAcquire $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndAcquire $type$ value");
+            assertEquals(($type$)($value1$ & $value2$), x, "getAndBitwiseAndAcquire $type$ value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(array, i, $value2$);
-            assertEquals(o, $value1$, "getAndBitwiseAndRelease $type$");
+            assertEquals($value1$, o, "getAndBitwiseAndRelease $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndRelease $type$ value");
+            assertEquals(($type$)($value1$ & $value2$), x, "getAndBitwiseAndRelease $type$ value");
         }
 
         // get and bitwise xor
@@ -1096,27 +1094,27 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
             hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(array, i, $value2$);
-            assertEquals(o, $value1$, "getAndBitwiseXor $type$");
+            assertEquals($value1$, o, "getAndBitwiseXor $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXor $type$ value");
+            assertEquals(($type$)($value1$ ^ $value2$), x, "getAndBitwiseXor $type$ value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(array, i, $value2$);
-            assertEquals(o, $value1$, "getAndBitwiseXorAcquire $type$");
+            assertEquals($value1$, o, "getAndBitwiseXorAcquire $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorAcquire $type$ value");
+            assertEquals(($type$)($value1$ ^ $value2$), x, "getAndBitwiseXorAcquire $type$ value");
         }
 
         {
             hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$);
 
             $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(array, i, $value2$);
-            assertEquals(o, $value1$, "getAndBitwiseXorRelease $type$");
+            assertEquals($value1$, o, "getAndBitwiseXorRelease $type$");
             $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
-            assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorRelease $type$ value");
+            assertEquals(($type$)($value1$ ^ $value2$), x, "getAndBitwiseXorRelease $type$ value");
         }
 #end[Bitwise]
         }
diff --git a/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template b/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template
index 85ecf9bb95c..77531cc309f 100644
--- a/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template
+++ b/test/jdk/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,26 +24,26 @@
 /*
  * @test
  * @bug 8156486
- * @run testng/othervm VarHandleTestMethodType$Type$
- * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=true -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodType$Type$
- * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=false VarHandleTestMethodType$Type$
- * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodType$Type$
+ * @run junit/othervm VarHandleTestMethodType$Type$
+ * @run junit/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=true -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodType$Type$
+ * @run junit/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=false VarHandleTestMethodType$Type$
+ * @run junit/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false -Djava.lang.invoke.VarHandle.VAR_HANDLE_IDENTITY_ADAPT=true VarHandleTestMethodType$Type$
  */
 
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.VarHandle;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import static org.testng.Assert.*;
-
 import static java.lang.invoke.MethodType.*;
 
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
     static final $type$ static_final_v = $value1$;
 
@@ -63,7 +63,7 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
 
     VarHandle vhArray;
 
-    @BeforeClass
+    @BeforeAll
     public void setup() throws Exception {
         vhFinalField = MethodHandles.lookup().findVarHandle(
                 VarHandleTestMethodType$Type$.class, "final_v", $type$.class);
@@ -80,7 +80,6 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
         vhArray = MethodHandles.arrayElementVarHandle($type$[].class);
     }
 
-    @DataProvider
     public Object[][] accessTestCaseProvider() throws Exception {
         List> cases = new ArrayList<>();
 
@@ -115,7 +114,8 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
         return cases.stream().map(tc -> new Object[]{tc.toString(), tc}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "accessTestCaseProvider")
+    @ParameterizedTest
+    @MethodSource("accessTestCaseProvider")
     public  void testAccess(String desc, AccessTestCase atc) throws Throwable {
         T t = atc.get();
         int iters = atc.requiresLoop() ? ITERS : 1;
@@ -124,7 +124,6 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest {
         }
     }
 
-
     static void testInstanceFieldWrongMethodType(VarHandleTestMethodType$Type$ recv, VarHandle vh) throws Throwable {
         // Get
         // Incorrect argument types
diff --git a/test/jdk/java/lang/invoke/VarHandles/accessibility/TestFieldLookupAccessibility.java b/test/jdk/java/lang/invoke/VarHandles/accessibility/TestFieldLookupAccessibility.java
index 343b15a1caf..11cd6ec233c 100644
--- a/test/jdk/java/lang/invoke/VarHandles/accessibility/TestFieldLookupAccessibility.java
+++ b/test/jdk/java/lang/invoke/VarHandles/accessibility/TestFieldLookupAccessibility.java
@@ -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
@@ -27,14 +27,11 @@
  * @compile TestFieldLookupAccessibility.java
  *          pkg/A.java pkg/B_extends_A.java pkg/C.java
  *          pkg/subpkg/B_extends_A.java pkg/subpkg/C.java
- * @run testng/othervm --enable-final-field-mutation=ALL-UNNAMED -DwriteAccess=true TestFieldLookupAccessibility
- * @run testng/othervm --illegal-final-field-mutation=deny -DwriteAccess=false TestFieldLookupAccessibility
+ * @run junit/othervm --enable-final-field-mutation=ALL-UNNAMED -DwriteAccess=true TestFieldLookupAccessibility
+ * @run junit/othervm --illegal-final-field-mutation=deny -DwriteAccess=false TestFieldLookupAccessibility
  */
 
-import static org.testng.Assert.*;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
+import static org.junit.jupiter.api.Assertions.*;
 import pkg.B_extends_A;
 
 import java.lang.invoke.MethodHandles;
@@ -48,11 +45,14 @@ import java.util.Map;
 import java.util.Set;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 public class TestFieldLookupAccessibility {
     static boolean writeAccess;
 
-    @BeforeClass
+    @BeforeAll
     static void setup() {
         String s = System.getProperty("writeAccess");
         assertNotNull(s);
@@ -188,8 +188,7 @@ public class TestFieldLookupAccessibility {
         }
     }
 
-    @DataProvider
-    public Object[][] lookupProvider() throws Exception {
+    public static Object[][] lookupProvider() throws Exception {
         Stream> baseCases = Stream.of(
                 // Look up from same package
                 List.of(pkg.A.class, pkg.A.lookup(), pkg.A.inaccessibleFields()),
@@ -215,7 +214,8 @@ public class TestFieldLookupAccessibility {
         return pl.toArray();
     }
 
-    @Test(dataProvider = "lookupProvider")
+    @ParameterizedTest
+    @MethodSource("lookupProvider")
     public void test(FieldLookup fl, Class src, MethodHandles.Lookup l, Set inaccessibleFields) {
         // Add to the expected failures all inaccessible fields due to accessibility modifiers
         Set expected = fl.inaccessibleFields(inaccessibleFields);
@@ -240,10 +240,10 @@ public class TestFieldLookupAccessibility {
                 collect(Collectors.toSet());
         if (!actualFieldNames.equals(expected)) {
             if (actualFieldNames.isEmpty()) {
-                assertEquals(actualFieldNames, expected, "No accessibility failures:");
+                assertEquals(expected, actualFieldNames, "No accessibility failures:");
             }
             else {
-                assertEquals(actualFieldNames, expected, "Accessibility failures differ:");
+                assertEquals(expected, actualFieldNames, "Accessibility failures differ:");
             }
         }
         else {
diff --git a/test/jdk/java/lang/invoke/WrongMethodTypeTest.java b/test/jdk/java/lang/invoke/WrongMethodTypeTest.java
index be0c59e0d77..32cbfc545ce 100644
--- a/test/jdk/java/lang/invoke/WrongMethodTypeTest.java
+++ b/test/jdk/java/lang/invoke/WrongMethodTypeTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,8 +21,9 @@
  * questions.
  */
 
-/* @test 8299183
- * @run testng WrongMethodTypeTest
+/* @test
+ * @bug 8299183
+ * @run junit WrongMethodTypeTest
  */
 
 import java.lang.invoke.MethodHandle;
@@ -33,9 +34,10 @@ import java.lang.invoke.WrongMethodTypeException;
 
 import static java.lang.invoke.MethodType.methodType;
 
-import static org.testng.AssertJUnit.*;
+import org.junit.jupiter.api.Test;
 
-import org.testng.annotations.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 public class WrongMethodTypeTest {
     static final Lookup LOOKUP = MethodHandles.lookup();
@@ -43,13 +45,11 @@ public class WrongMethodTypeTest {
     @Test
     public void checkExactType() throws Throwable {
         String expectedMessage = "handle's method type (int)int but found ()boolean";
-        try {
-            MethodHandle mh = LOOKUP.findStatic(WrongMethodTypeTest.class, "m", methodType(int.class, int.class));
+        MethodHandle mh = LOOKUP.findStatic(WrongMethodTypeTest.class, "m", methodType(int.class, int.class));
+        var ex = assertThrows(WrongMethodTypeException.class, () -> {
             boolean b = (boolean)mh.invokeExact();
-            fail("Expected WrongMethodTypeException");
-        } catch (WrongMethodTypeException ex) {
-            assertEquals(expectedMessage, ex.getMessage());
-        }
+        });
+        assertEquals(expectedMessage, ex.getMessage());
     }
 
     @Test
@@ -57,11 +57,10 @@ public class WrongMethodTypeTest {
         String expectedMessage = "handle's method type ()int but found ()Void";
         VarHandle vh = LOOKUP.findStaticVarHandle(WrongMethodTypeTest.class, "x", int.class)
                              .withInvokeExactBehavior();
-        try {
+        var ex = assertThrows(WrongMethodTypeException.class, () -> {
             Void o = (Void) vh.get();
-        } catch (WrongMethodTypeException ex) {
-            assertEquals(expectedMessage, ex.getMessage());
-        }
+        });
+        assertEquals(expectedMessage, ex.getMessage());
     }
 
     @Test
@@ -69,11 +68,10 @@ public class WrongMethodTypeTest {
         String expectedMessage = "handle's method type (WrongMethodTypeTest)boolean but found (WrongMethodTypeTest)int";
         VarHandle vh = LOOKUP.findVarHandle(WrongMethodTypeTest.class, "y", boolean.class)
                              .withInvokeExactBehavior();
-        try {
+        var ex = assertThrows(WrongMethodTypeException.class, () -> {
             int o = (int) vh.get(new WrongMethodTypeTest());
-        } catch (WrongMethodTypeException ex) {
-            assertEquals(expectedMessage, ex.getMessage());
-        }
+        });
+        assertEquals(expectedMessage, ex.getMessage());
     }
 
     static int m(int x) {
diff --git a/test/jdk/java/lang/invoke/accessClassAndFindClass/TestAccessClass.java b/test/jdk/java/lang/invoke/accessClassAndFindClass/TestAccessClass.java
index 083a357a430..23893655c0a 100644
--- a/test/jdk/java/lang/invoke/accessClassAndFindClass/TestAccessClass.java
+++ b/test/jdk/java/lang/invoke/accessClassAndFindClass/TestAccessClass.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, 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
@@ -24,7 +24,7 @@
 /* @test
  * @bug 8150782 8207027 8266269
  * @compile TestAccessClass.java TestCls.java p/Foo.java q/Bar.java
- * @run testng/othervm -ea -esa test.java.lang.invoke.TestAccessClass
+ * @run junit/othervm -ea -esa test.java.lang.invoke.TestAccessClass
  */
 package test.java.lang.invoke;
 
@@ -36,9 +36,11 @@ import q.Bar;
 
 import static java.lang.invoke.MethodHandles.*;
 
-import static org.testng.AssertJUnit.*;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
-import org.testng.annotations.*;
+import static org.junit.jupiter.api.Assertions.*;
 
 public class TestAccessClass {
 
@@ -68,17 +70,19 @@ public class TestAccessClass {
         assertEquals(Class1[].class, aClass);
     }
 
-    @DataProvider
-    Object[][] illegalAccessAccess() {
+    static Object[][] illegalAccessAccess() {
         return new Object[][] {
                 {publicLookup(), Class1.class},
                 {publicLookup(), TestCls.getPrivateSIC()}
         };
     }
 
-    @Test(dataProvider = "illegalAccessAccess", expectedExceptions = {IllegalAccessException.class})
+    @ParameterizedTest
+    @MethodSource("illegalAccessAccess")
     public void illegalAccessExceptionTest(Lookup lookup, Class klass) throws IllegalAccessException {
-        lookup.accessClass(klass);
+        assertThrows(IllegalAccessException.class, () -> {
+            lookup.accessClass(klass);
+        });
     }
 
     @Test
@@ -98,8 +102,8 @@ public class TestAccessClass {
         mh.invoke(null);
     }
 
-    @Test(expectedExceptions = {NullPointerException.class})
+    @Test
     public void illegalArgument() throws IllegalAccessException {
-        lookup().accessClass(null);
+        assertThrows(NullPointerException.class, () -> lookup().accessClass(null));
     }
 }
diff --git a/test/jdk/java/lang/invoke/accessClassAndFindClass/TestFindClass.java b/test/jdk/java/lang/invoke/accessClassAndFindClass/TestFindClass.java
index 54674729fe3..94ec3c54b4f 100644
--- a/test/jdk/java/lang/invoke/accessClassAndFindClass/TestFindClass.java
+++ b/test/jdk/java/lang/invoke/accessClassAndFindClass/TestFindClass.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, 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
@@ -24,7 +24,7 @@
 /* @test
  * @bug 8150782 8207027 8266269
  * @compile TestFindClass.java TestCls.java p/Foo.java q/Bar.java
- * @run testng/othervm -ea -esa test.java.lang.invoke.TestFindClass
+ * @run junit/othervm -ea -esa test.java.lang.invoke.TestFindClass
  */
 package test.java.lang.invoke;
 
@@ -34,9 +34,11 @@ import q.Bar;
 
 import static java.lang.invoke.MethodHandles.*;
 
-import static org.testng.AssertJUnit.*;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
-import org.testng.annotations.*;
+import static org.junit.jupiter.api.Assertions.*;
 
 public class TestFindClass {
 
@@ -68,13 +70,12 @@ public class TestFindClass {
         assertEquals(Class1[].class, aClass);
     }
 
-    @Test(expectedExceptions = {ClassNotFoundException.class})
+    @Test
     public void classNotFoundExceptionTest() throws IllegalAccessException, ClassNotFoundException {
-        lookup().findClass(PACKAGE_PREFIX + "TestFindClass$NonExistent");
+        assertThrows(ClassNotFoundException.class, () -> lookup().findClass(PACKAGE_PREFIX + "TestFindClass$NonExistent"));
     }
 
-    @DataProvider
-    Object[][] illegalAccessFind() {
+    static Object[][] illegalAccessFind() {
         return new Object[][] {
                 {publicLookup(), PACKAGE_PREFIX + "TestFindClass$Class1"},
                 {publicLookup(), PACKAGE_PREFIX + "TestCls$PrivateSIC"}
@@ -84,9 +85,10 @@ public class TestFindClass {
     /**
      * Assertion: @throws IllegalAccessException if the class is not accessible, using the allowed access modes.
      */
-    @Test(dataProvider = "illegalAccessFind", expectedExceptions = {ClassNotFoundException.class})
+    @ParameterizedTest
+    @MethodSource("illegalAccessFind")
     public void illegalAccessExceptionTest(Lookup lookup, String className) throws IllegalAccessException, ClassNotFoundException {
-        lookup.findClass(className);
+        assertThrows(ClassNotFoundException.class, () -> lookup.findClass(className));
     }
 
     @Test
@@ -104,8 +106,8 @@ public class TestFindClass {
         lookup().findClass("[Lp.Foo$T;");
     }
 
-    @Test(expectedExceptions = {NullPointerException.class})
+    @Test
     public void illegalArgument() throws IllegalAccessException, ClassNotFoundException {
-        lookup().findClass(null);
+        assertThrows(NullPointerException.class, () -> lookup().findClass(null));
     }
 }
diff --git a/test/jdk/java/lang/invoke/accessClassAndFindClass/TestLookup.java b/test/jdk/java/lang/invoke/accessClassAndFindClass/TestLookup.java
index 555213bedcc..b0f2e00adbc 100644
--- a/test/jdk/java/lang/invoke/accessClassAndFindClass/TestLookup.java
+++ b/test/jdk/java/lang/invoke/accessClassAndFindClass/TestLookup.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 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
@@ -23,15 +23,15 @@
 
 /* @test
  * @compile TestLookup.java TestCls.java
- * @run testng/othervm -ea -esa test.java.lang.invoke.TestLookup
+ * @run junit/othervm -ea -esa test.java.lang.invoke.TestLookup
  */
 package test.java.lang.invoke;
 
-import org.testng.annotations.Test;
-
 import static java.lang.invoke.MethodHandles.*;
 
-import static org.testng.AssertJUnit.*;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
 
 public class TestLookup {
 
@@ -43,10 +43,10 @@ public class TestLookup {
         assertNull(lookup2.lookupClass().getClassLoader());
     }
 
-    @Test(expectedExceptions = {ClassNotFoundException.class})
+    @Test
     public void testPublicCannotLoadUserClass() throws IllegalAccessException, ClassNotFoundException {
         Lookup lookup = publicLookup();
-        lookup.findClass("test.java.lang.invoke.TestCls");
+        assertThrows(ClassNotFoundException.class, () -> lookup.findClass("test.java.lang.invoke.TestCls"));
     }
 
     @Test
diff --git a/test/jdk/java/lang/invoke/callerSensitive/CallerSensitiveAccess.java b/test/jdk/java/lang/invoke/callerSensitive/CallerSensitiveAccess.java
index a6359162629..67aa90ba99c 100644
--- a/test/jdk/java/lang/invoke/callerSensitive/CallerSensitiveAccess.java
+++ b/test/jdk/java/lang/invoke/callerSensitive/CallerSensitiveAccess.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2021, 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
@@ -24,7 +24,7 @@
 /* @test
  * @bug 8196830 8235351 8257874
  * @modules java.base/jdk.internal.reflect
- * @run testng/othervm CallerSensitiveAccess
+ * @run junit/othervm CallerSensitiveAccess
  * @summary Check Lookup findVirtual, findStatic and unreflect behavior with
  *          caller sensitive methods with focus on AccessibleObject.setAccessible
  */
@@ -50,17 +50,16 @@ import java.util.stream.Stream;
 
 import jdk.internal.reflect.CallerSensitive;
 
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.NoInjection;
-import org.testng.annotations.Test;
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 public class CallerSensitiveAccess {
 
     /**
      * Caller sensitive methods in APIs exported by java.base.
      */
-    @DataProvider(name = "callerSensitiveMethods")
     static Object[][] callerSensitiveMethods() {
         try (Stream stream = callerSensitiveMethods(Object.class.getModule())) {
             return stream.map(m -> new Object[]{m, shortDescription(m)})
@@ -72,34 +71,35 @@ public class CallerSensitiveAccess {
      * Using publicLookup, attempt to use findVirtual or findStatic to obtain a
      * method handle to a caller sensitive method.
      */
-    @Test(dataProvider = "callerSensitiveMethods",
-            expectedExceptions = IllegalAccessException.class)
-    public void testPublicLookupFind(@NoInjection Method method, String desc) throws Exception {
+    @ParameterizedTest
+    @MethodSource("callerSensitiveMethods")
+    public void testPublicLookupFind(Method method, String desc) throws Exception {
         Lookup lookup = MethodHandles.publicLookup();
         Class refc = method.getDeclaringClass();
         String name = method.getName();
         MethodType mt = MethodType.methodType(method.getReturnType(), method.getParameterTypes());
-        if (Modifier.isStatic(method.getModifiers())) {
-            lookup.findStatic(refc, name, mt);
-        } else {
-            lookup.findVirtual(refc, name, mt);
-        }
+        assertThrows(IllegalAccessException.class, () -> {
+            if (Modifier.isStatic(method.getModifiers())) {
+                lookup.findStatic(refc, name, mt);
+            } else {
+                lookup.findVirtual(refc, name, mt);
+            }
+        });
     }
 
     /**
      * Using publicLookup, attempt to use unreflect to obtain a method handle to a
      * caller sensitive method.
      */
-    @Test(dataProvider = "callerSensitiveMethods",
-            expectedExceptions = IllegalAccessException.class)
-    public void testPublicLookupUnreflect(@NoInjection Method method, String desc) throws Exception {
-        MethodHandles.publicLookup().unreflect(method);
+    @ParameterizedTest
+    @MethodSource("callerSensitiveMethods")
+    public void testPublicLookupUnreflect(Method method, String desc) throws Exception {
+        assertThrows(IllegalAccessException.class, () -> MethodHandles.publicLookup().unreflect(method));
     }
 
     /**
      * public accessible caller sensitive methods in APIs exported by java.base.
      */
-    @DataProvider(name = "accessibleCallerSensitiveMethods")
     static Object[][] accessibleCallerSensitiveMethods() {
         try (Stream stream = callerSensitiveMethods(Object.class.getModule())) {
             return stream
@@ -114,41 +114,43 @@ public class CallerSensitiveAccess {
      * Using publicLookup, attempt to use unreflect to obtain a method handle to a
      * caller sensitive method.
      */
-    @Test(dataProvider = "accessibleCallerSensitiveMethods",
-            expectedExceptions = IllegalAccessException.class)
-    public void testLookupUnreflect(@NoInjection Method method, String desc) throws Exception {
-        MethodHandles.publicLookup().unreflect(method);
+    @ParameterizedTest
+    @MethodSource("accessibleCallerSensitiveMethods")
+    public void testLookupUnreflect(Method method, String desc) throws Exception {
+        assertThrows(IllegalAccessException.class, () -> MethodHandles.publicLookup().unreflect(method));
     }
 
     /**
      * Using a Lookup with no original access that can't lookup caller-sensitive
      * method
      */
-    @Test(dataProvider = "callerSensitiveMethods",
-            expectedExceptions = IllegalAccessException.class)
-    public void testLookupNoOriginalAccessFind(@NoInjection Method method, String desc) throws Exception {
+    @ParameterizedTest
+    @MethodSource("callerSensitiveMethods")
+    public void testLookupNoOriginalAccessFind(Method method, String desc) throws Exception {
         Lookup lookup = MethodHandles.lookup().dropLookupMode(Lookup.ORIGINAL);
         assertTrue(lookup.hasFullPrivilegeAccess());
         Class refc = method.getDeclaringClass();
         String name = method.getName();
         MethodType mt = MethodType.methodType(method.getReturnType(), method.getParameterTypes());
-        if (Modifier.isStatic(method.getModifiers())) {
-            lookup.findStatic(refc, name, mt);
-        } else {
-            lookup.findVirtual(refc, name, mt);
-        }
+        assertThrows(IllegalAccessException.class, () -> {
+            if (Modifier.isStatic(method.getModifiers())) {
+                lookup.findStatic(refc, name, mt);
+            } else {
+                lookup.findVirtual(refc, name, mt);
+            }
+        });
     }
 
     /**
      * Using a Lookup with no original access that can't unreflect caller-sensitive
      * method
      */
-    @Test(dataProvider = "callerSensitiveMethods",
-            expectedExceptions = IllegalAccessException.class)
-    public void testLookupNoOriginalAccessUnreflect(@NoInjection Method method, String desc) throws Exception {
+    @ParameterizedTest
+    @MethodSource("callerSensitiveMethods")
+    public void testLookupNoOriginalAccessUnreflect(Method method, String desc) throws Exception {
         Lookup lookup = MethodHandles.lookup().dropLookupMode(Lookup.ORIGINAL);
         assertTrue(lookup.hasFullPrivilegeAccess());
-        lookup.unreflect(method);
+        assertThrows(IllegalAccessException.class, () -> lookup.unreflect(method));
     }
 
     // -- Test method handles to setAccessible --
@@ -156,21 +158,12 @@ public class CallerSensitiveAccess {
     private int aField;
 
     Field accessibleField() {
-        try {
-            return getClass().getDeclaredField("aField");
-        } catch (NoSuchFieldException e) {
-            fail();
-            return null;
-        }
+        var clazz = getClass();
+        return assertDoesNotThrow(() -> clazz.getDeclaredField("aField"));
     }
 
     Field inaccessibleField() {
-        try {
-            return String.class.getDeclaredField("hash");
-        } catch (NoSuchFieldException e) {
-            fail();
-            return null;
-        }
+        return assertDoesNotThrow(() -> String.class.getDeclaredField("hash"));
     }
 
     void findAndInvokeSetAccessible(Class refc, Field f) throws Throwable {
@@ -215,23 +208,23 @@ public class CallerSensitiveAccess {
      * Create a method handle to setAccessible and attempt to use it to suppress
      * access to an inaccessible member.
      */
-    @Test(expectedExceptions = InaccessibleObjectException.class)
+    @Test
     public void testSetAccessible5() throws Throwable {
-        findAndInvokeSetAccessible(AccessibleObject.class, inaccessibleField());
+        assertThrows(InaccessibleObjectException.class, () -> findAndInvokeSetAccessible(AccessibleObject.class, inaccessibleField()));
     }
-    @Test(expectedExceptions = InaccessibleObjectException.class)
+    @Test
     public void testSetAccessible6() throws Throwable {
-        findAndInvokeSetAccessible(Field.class, inaccessibleField());
+        assertThrows(InaccessibleObjectException.class, () -> findAndInvokeSetAccessible(Field.class, inaccessibleField()));
     }
-    @Test(expectedExceptions = InaccessibleObjectException.class)
+    @Test
     public void testSetAccessible7() throws Throwable {
         Method m = AccessibleObject.class.getMethod("setAccessible", boolean.class);
-        unreflectAndInvokeSetAccessible(m, inaccessibleField());
+        assertThrows(InaccessibleObjectException.class, () -> unreflectAndInvokeSetAccessible(m, inaccessibleField()));
     }
-    @Test(expectedExceptions = InaccessibleObjectException.class)
+    @Test
     public void testSetAccessible8() throws Throwable {
         Method m = Field.class.getMethod("setAccessible", boolean.class);
-        unreflectAndInvokeSetAccessible(m, inaccessibleField());
+        assertThrows(InaccessibleObjectException.class, () -> unreflectAndInvokeSetAccessible(m, inaccessibleField()));
     }
 
 
@@ -241,7 +234,6 @@ public class CallerSensitiveAccess {
      * Custom AccessibleObject objects. One class overrides setAccessible, the other
      * does not override this method.
      */
-    @DataProvider(name = "customAccessibleObjects")
     static Object[][] customAccessibleObjectClasses() {
         return new Object[][] { { new S1() }, { new S2() } };
     }
@@ -271,20 +263,20 @@ public class CallerSensitiveAccess {
      * Using publicLookup, create a method handle to setAccessible and invoke it
      * on a custom AccessibleObject object.
      */
-    @Test(expectedExceptions = IllegalAccessException.class)
+    @Test
     public void testPublicLookupSubclass1() throws Throwable {
         // S1 does not override setAccessible
-        findAndInvokeSetAccessible(MethodHandles.publicLookup(), new S1());
+        assertThrows(IllegalAccessException.class, () -> findAndInvokeSetAccessible(MethodHandles.publicLookup(), new S1()));
     }
     @Test
     public void testPublicLookupSubclass2() throws Throwable {
         // S2 overrides setAccessible
         findAndInvokeSetAccessible(MethodHandles.publicLookup(), new S2());
     }
-    @Test(expectedExceptions = IllegalAccessException.class)
+    @Test
     public void testPublicLookupSubclass3() throws Throwable {
         // S1 does not override setAccessible
-        unreflectAndInvokeSetAccessible(MethodHandles.publicLookup(), new S1());
+        assertThrows(IllegalAccessException.class, () -> unreflectAndInvokeSetAccessible(MethodHandles.publicLookup(), new S1()));
     }
     @Test
     public void testPublicLookupSubclass4() throws Throwable {
@@ -296,11 +288,13 @@ public class CallerSensitiveAccess {
      * Using a full power lookup, create a method handle to setAccessible and
      * invoke it on a custom AccessibleObject object.
      */
-    @Test(dataProvider = "customAccessibleObjects")
+    @ParameterizedTest
+    @MethodSource("customAccessibleObjectClasses")
     public void testLookupSubclass1(AccessibleObject obj) throws Throwable {
         findAndInvokeSetAccessible(MethodHandles.lookup(), obj);
     }
-    @Test(dataProvider = "customAccessibleObjects")
+    @ParameterizedTest
+    @MethodSource("customAccessibleObjectClasses")
     public void testLookupSubclass2(AccessibleObject obj) throws Throwable {
         unreflectAndInvokeSetAccessible(MethodHandles.lookup(), obj);
     }
@@ -309,13 +303,13 @@ public class CallerSensitiveAccess {
      * Using a full power lookup, create a method handle to setAccessible on a
      * sub-class of AccessibleObject and then attempt to invoke it on a Field object.
      */
-    @Test(dataProvider = "customAccessibleObjects",
-            expectedExceptions = ClassCastException.class)
+    @ParameterizedTest
+    @MethodSource("customAccessibleObjectClasses")
     public void testLookupSubclass3(AccessibleObject obj) throws Throwable {
         MethodType mt = MethodType.methodType(void.class, boolean.class);
         Lookup lookup = MethodHandles.lookup();
         MethodHandle mh = lookup.findVirtual(obj.getClass(), "setAccessible", mt);
-        mh.invoke(accessibleField(), true);  // should throw ClassCastException
+        assertThrows(ClassCastException.class, () -> mh.invoke(accessibleField(), true));
     }
 
     /**
@@ -333,29 +327,29 @@ public class CallerSensitiveAccess {
         mh.invoke(f, true);
         assertTrue(f.isAccessible());
     }
-    @Test(expectedExceptions = InaccessibleObjectException.class)
+    @Test
     public void testLookupSubclass5() throws Throwable {
         // S1 does not override setAccessible
         Method m = S1.class.getMethod("setAccessible", boolean.class);
         assertTrue(m.getDeclaringClass() == AccessibleObject.class);
         MethodHandle mh = MethodHandles.lookup().unreflect(m);
-        mh.invoke(inaccessibleField(), true);  // should throw InaccessibleObjectException
+        assertThrows(InaccessibleObjectException.class, () -> mh.invoke(inaccessibleField(), true));
     }
-    @Test(expectedExceptions = ClassCastException.class)
+    @Test
     public void testLookupSubclass6() throws Throwable {
         // S2 overrides setAccessible
         Method m = S2.class.getMethod("setAccessible", boolean.class);
         assertTrue(m.getDeclaringClass() == S2.class);
         MethodHandle mh = MethodHandles.lookup().unreflect(m);
-        mh.invoke(accessibleField(), true);  // should throw ClassCastException
+        assertThrows(ClassCastException.class, () -> mh.invoke(accessibleField(), true));
     }
-    @Test(expectedExceptions = ClassCastException.class)
+    @Test
     public void testLookupSubclass7() throws Throwable {
         // S2 overrides setAccessible
         Method m = S2.class.getMethod("setAccessible", boolean.class);
         assertTrue(m.getDeclaringClass() == S2.class);
         MethodHandle mh = MethodHandles.lookup().unreflect(m);
-        mh.invoke(inaccessibleField(), true);  // should throw ClassCastException
+        assertThrows(ClassCastException.class, () -> mh.invoke(inaccessibleField(), true));
     }
 
     /**
@@ -373,7 +367,7 @@ public class CallerSensitiveAccess {
         // Field::getInt
         mh = MethodHandles.lookup().findVirtual(Field.class, "getInt", MethodType.methodType(int.class, Object.class));
         int value = (int)mh.invokeExact(f, (Object)null);
-        assertTrue(value == 5);
+        assertEquals(5, value);
     }
 
     private static class Inner {
@@ -400,7 +394,7 @@ public class CallerSensitiveAccess {
      * exported by a named module.
      */
     static Stream callerSensitiveMethods(Module module) {
-        assert module.isNamed();
+        assertTrue(module.isNamed());
         ModuleReference mref = module.getLayer().configuration()
                 .findModule(module.getName())
                 .orElseThrow(() -> new RuntimeException())
diff --git a/test/jdk/java/lang/invoke/condy/BootstrapMethodJumboArgsTest.java b/test/jdk/java/lang/invoke/condy/BootstrapMethodJumboArgsTest.java
index 0357afce668..4a2ad3f3091 100644
--- a/test/jdk/java/lang/invoke/condy/BootstrapMethodJumboArgsTest.java
+++ b/test/jdk/java/lang/invoke/condy/BootstrapMethodJumboArgsTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2026, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,12 +27,10 @@
  * @summary Test bootstrap methods throwing an exception
  * @library /java/lang/invoke/common
  * @build test.java.lang.invoke.lib.InstructionHelper
- * @run testng BootstrapMethodJumboArgsTest
- * @run testng/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 BootstrapMethodJumboArgsTest
+ * @run junit BootstrapMethodJumboArgsTest
+ * @run junit/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 BootstrapMethodJumboArgsTest
  */
 
-import org.testng.Assert;
-import org.testng.annotations.Test;
 import test.java.lang.invoke.lib.InstructionHelper;
 
 import java.lang.invoke.ConstantCallSite;
@@ -43,6 +41,10 @@ import java.util.stream.IntStream;
 
 import static java.lang.invoke.MethodType.methodType;
 
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+
 public class BootstrapMethodJumboArgsTest {
     static final MethodHandles.Lookup L = MethodHandles.lookup();
 
@@ -93,7 +95,7 @@ public class BootstrapMethodJumboArgsTest {
                             Object.class, Object[].class), expected);
 
             Object[] actual = (Object[]) mh.invoke();
-            Assert.assertEquals(actual, expected);
+            assertArrayEquals(expected, actual);
         }
 
         {
@@ -103,7 +105,7 @@ public class BootstrapMethodJumboArgsTest {
                             Object.class, Object.class, Object[].class), expected);
 
             Object[] actual = (Object[]) mh.invoke();
-            Assert.assertEquals(actual, expected);
+            assertArrayEquals(expected, actual);
         }
 
         {
@@ -113,7 +115,7 @@ public class BootstrapMethodJumboArgsTest {
                             Object.class, Object.class, Object.class, Object[].class), expected);
 
             Object[] actual = (Object[]) mh.invoke();
-            Assert.assertEquals(actual, expected);
+            assertArrayEquals(expected, actual);
         }
     }
 
@@ -128,7 +130,7 @@ public class BootstrapMethodJumboArgsTest {
                             Object.class, Object[].class), expected);
 
             Object[] actual = (Object[]) mh.invoke();
-            Assert.assertEquals(actual, expected);
+            assertArrayEquals(expected, actual);
         }
 
         {
@@ -138,7 +140,7 @@ public class BootstrapMethodJumboArgsTest {
                             Object.class, Object.class, Object[].class), expected);
 
             Object[] actual = (Object[]) mh.invoke();
-            Assert.assertEquals(actual, expected);
+            assertArrayEquals(expected, actual);
         }
 
         {
@@ -148,7 +150,7 @@ public class BootstrapMethodJumboArgsTest {
                             Object.class, Object.class, Object.class, Object[].class), expected);
 
             Object[] actual = (Object[]) mh.invoke();
-            Assert.assertEquals(actual, expected);
+            assertArrayEquals(expected, actual);
         }
     }
 }
diff --git a/test/jdk/java/lang/invoke/condy/CondyBSMException.java b/test/jdk/java/lang/invoke/condy/CondyBSMException.java
index 7aa25c5cd95..1c9f867bc8b 100644
--- a/test/jdk/java/lang/invoke/condy/CondyBSMException.java
+++ b/test/jdk/java/lang/invoke/condy/CondyBSMException.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2026, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,12 +27,10 @@
  * @summary Test bootstrap methods throwing an exception
  * @library /java/lang/invoke/common
  * @build test.java.lang.invoke.lib.InstructionHelper
- * @run testng CondyBSMException
- * @run testng/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyBSMException
+ * @run junit CondyBSMException
+ * @run junit/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyBSMException
  */
 
-import org.testng.Assert;
-import org.testng.annotations.Test;
 import test.java.lang.invoke.lib.InstructionHelper;
 
 import java.lang.invoke.MethodHandle;
@@ -41,6 +39,10 @@ import java.lang.reflect.Constructor;
 
 import static java.lang.invoke.MethodType.methodType;
 
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
+
 public class CondyBSMException {
 
     @Test
@@ -70,26 +72,17 @@ public class CondyBSMException {
 
     static void test(String message, Class... ts) {
         MethodHandle mh = thrower(message, ts[ts.length - 1]);
-        Throwable caught = null;
-        try {
-            mh.invoke();
-        } catch (Throwable t) {
-            caught = t;
-        }
-
-        if (caught == null) {
-            Assert.fail("Throwable expected");
-        }
+        Throwable caught = assertThrows(Throwable.class, mh::invoke);
 
         String actualMessage = null;
         for (int i = 0; i < ts.length; i++) {
+            int level = i;
+            assertInstanceOf(ts[i], caught, () -> "Level %d".formatted(level));
             actualMessage = caught.getMessage();
-            Assert.assertNotNull(caught);
-            Assert.assertTrue(ts[i].isAssignableFrom(caught.getClass()));
             caught = caught.getCause();
         }
 
-        Assert.assertEquals(actualMessage, message);
+        assertEquals(message, actualMessage);
     }
 
     static Throwable throwingBsm(MethodHandles.Lookup l, String name, Class type) throws Throwable {
diff --git a/test/jdk/java/lang/invoke/condy/CondyBSMInvocation.java b/test/jdk/java/lang/invoke/condy/CondyBSMInvocation.java
index e9050126a79..897ee40b444 100644
--- a/test/jdk/java/lang/invoke/condy/CondyBSMInvocation.java
+++ b/test/jdk/java/lang/invoke/condy/CondyBSMInvocation.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2026, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,13 +27,10 @@
  * @summary Test basic invocation of bootstrap methods
  * @library /java/lang/invoke/common
  * @build test.java.lang.invoke.lib.InstructionHelper
- * @run testng CondyBSMInvocation
- * @run testng/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyBSMInvocation
+ * @run junit CondyBSMInvocation
+ * @run junit/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyBSMInvocation
  */
 
-
-import org.testng.Assert;
-import org.testng.annotations.Test;
 import test.java.lang.invoke.lib.InstructionHelper;
 
 import java.lang.constant.ConstantDesc;
@@ -48,6 +45,10 @@ import java.util.stream.Stream;
 
 import static java.lang.invoke.MethodType.methodType;
 
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
+
 public class CondyBSMInvocation {
     static final MethodHandles.Lookup L = MethodHandles.lookup();
 
@@ -59,11 +60,7 @@ public class CondyBSMInvocation {
                 "bsm", methodType(Object.class)
         );
 
-        try {
-            mh.invoke();
-            Assert.fail("NoSuchMethodError expected to be thrown");
-        } catch (NoSuchMethodError e) {
-        }
+        assertThrows(NoSuchMethodError.class, mh::invoke);
     }
 
     static MethodHandle[] bsms(String bsmName) {
@@ -114,11 +111,7 @@ public class CondyBSMInvocation {
                     "shape_bsm", bsm.type()
             );
 
-            try {
-                Object r = mh.invoke();
-                Assert.fail("BootstrapMethodError expected to be thrown for " + bsm);
-            } catch (BootstrapMethodError e) {
-            }
+            assertThrows(BootstrapMethodError.class, mh::invoke);
         }
     }
 
@@ -139,11 +132,7 @@ public class CondyBSMInvocation {
                     "sig_bsm", bsm.type()
             );
 
-            try {
-                Object r = mh.invoke();
-                Assert.fail("BootstrapMethodError expected to be thrown for " + bsm);
-            } catch (BootstrapMethodError e) {
-            }
+            assertThrows(BootstrapMethodError.class, mh::invoke);
         }
     }
 
@@ -202,7 +191,7 @@ public class CondyBSMInvocation {
 
     static void assertAll(Object... as) {
         for (int i = 0; i < as.length; i++) {
-            Assert.assertEquals(as[i], i);
+            assertEquals(i, as[i]);
         }
     }
 
@@ -219,7 +208,7 @@ public class CondyBSMInvocation {
             );
 
             Object r = mh.invoke();
-            Assert.assertEquals(r, Integer.toString(n));
+            assertEquals(Integer.toString(n), r);
         }
 
         {
@@ -231,7 +220,7 @@ public class CondyBSMInvocation {
             );
 
             Object r = mh.invoke();
-            Assert.assertEquals(r, Integer.toString(9));
+            assertEquals(Integer.toString(9), r);
 
         }
     }
@@ -248,13 +237,8 @@ public class CondyBSMInvocation {
                     IntStream.range(0, n - 1).boxed().toArray(ConstantDesc[]::new)
             );
 
-            try {
-                Object r = mh.invoke();
-                Assert.fail("BootstrapMethodError expected to be thrown for arrity " + n);
-            } catch (BootstrapMethodError e) {
-                Throwable t = e.getCause();
-                Assert.assertTrue(WrongMethodTypeException.class.isAssignableFrom(t.getClass()));
-            }
+            var e = assertThrows(BootstrapMethodError.class, mh::invoke);
+            assertInstanceOf(WrongMethodTypeException.class, e.getCause());
         }
     }
 }
diff --git a/test/jdk/java/lang/invoke/condy/CondyBSMValidationTest.java b/test/jdk/java/lang/invoke/condy/CondyBSMValidationTest.java
index d255202866f..e6c2aacea63 100644
--- a/test/jdk/java/lang/invoke/condy/CondyBSMValidationTest.java
+++ b/test/jdk/java/lang/invoke/condy/CondyBSMValidationTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2026, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,28 +27,29 @@
  * @summary Test invalid name in name and type
  * @library /java/lang/invoke/common
  * @build test.java.lang.invoke.lib.InstructionHelper
- * @run testng CondyBSMValidationTest
- * @run testng/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyBSMValidationTest
+ * @run junit CondyBSMValidationTest
+ * @run junit/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyBSMValidationTest
  */
 
-import org.testng.Assert;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
 import test.java.lang.invoke.lib.InstructionHelper;
 
-import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.util.stream.Stream;
 
 import static java.lang.invoke.MethodType.methodType;
 
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
 public class CondyBSMValidationTest {
     static final MethodHandles.Lookup L = MethodHandles.lookup();
     static final String BSM_TYPE = methodType(Object.class, MethodHandles.Lookup.class, String.class, Object.class)
             .toMethodDescriptorString();
 
-    @DataProvider
-    public Object[][] invalidSignaturesProvider() throws Exception {
+    public static Object[][] invalidSignaturesProvider() throws Exception {
         return Stream.of(BSM_TYPE.replace("(", ""),
                         BSM_TYPE.replace(")", ""),
                         BSM_TYPE.replace("(", "").replace(")", ""),
@@ -57,15 +58,13 @@ public class CondyBSMValidationTest {
                 .map(e -> new Object[]{e}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "invalidSignaturesProvider")
+    @ParameterizedTest
+    @MethodSource("invalidSignaturesProvider")
     public void testInvalidBSMSignature(String sig) throws Exception {
-        try {
-            MethodHandle mh = InstructionHelper.ldcDynamicConstant(
-                    L, "name", "Ljava/lang/Object;",
-                    "bsm", sig
-            );
-        } catch (IllegalArgumentException e) {
-            Assert.assertTrue(e.getMessage().contains("Bad method descriptor"));
-        }
+        var e = assertThrows(IllegalArgumentException.class, () -> InstructionHelper.ldcDynamicConstant(
+                L, "name", "Ljava/lang/Object;",
+                "bsm", sig
+        ));
+        assertTrue(e.getMessage().contains("Bad method descriptor"));
     }
 }
diff --git a/test/jdk/java/lang/invoke/condy/CondyInterfaceWithOverpassMethods.java b/test/jdk/java/lang/invoke/condy/CondyInterfaceWithOverpassMethods.java
index 9fd35ed21f0..fe477d87657 100644
--- a/test/jdk/java/lang/invoke/condy/CondyInterfaceWithOverpassMethods.java
+++ b/test/jdk/java/lang/invoke/condy/CondyInterfaceWithOverpassMethods.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2024, 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
@@ -27,20 +27,20 @@
  * @summary Test for an interface using condy with default overpass methods
  * @library /java/lang/invoke/common
  * @build test.java.lang.invoke.lib.InstructionHelper
- * @run testng CondyInterfaceWithOverpassMethods
- * @run testng/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyInterfaceWithOverpassMethods
+ * @run junit CondyInterfaceWithOverpassMethods
+ * @run junit/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyInterfaceWithOverpassMethods
  */
 
 import java.lang.classfile.ClassFile;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
 import test.java.lang.invoke.lib.InstructionHelper;
 
 import java.lang.constant.*;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
 
-@Test
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
 public class CondyInterfaceWithOverpassMethods {
     interface A {
         int a();
@@ -52,14 +52,14 @@ public class CondyInterfaceWithOverpassMethods {
 
 
     // Generated class with methods containing condy ldc
-    Class gc;
+    static Class gc;
 
     public static Object bsm(MethodHandles.Lookup l, String name, Class type) {
         return name;
     }
 
-    @BeforeClass
-    public void generateClass() throws Exception {
+    @BeforeAll
+    public static void generateClass() throws Exception {
 //        interface B extends A {
 //            // Overpass for method A.a
 //
diff --git a/test/jdk/java/lang/invoke/condy/CondyNameValidationTest.java b/test/jdk/java/lang/invoke/condy/CondyNameValidationTest.java
index 6178b85236b..b380c28dc94 100644
--- a/test/jdk/java/lang/invoke/condy/CondyNameValidationTest.java
+++ b/test/jdk/java/lang/invoke/condy/CondyNameValidationTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2026, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,13 +27,10 @@
  * @summary Test invalid name in name and type
  * @library /java/lang/invoke/common
  * @build test.java.lang.invoke.lib.InstructionHelper
- * @run testng CondyNameValidationTest
- * @run testng/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyNameValidationTest
+ * @run junit CondyNameValidationTest
+ * @run junit/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyNameValidationTest
  */
 
-import org.testng.Assert;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
 import test.java.lang.invoke.lib.InstructionHelper;
 
 import java.lang.invoke.MethodHandle;
@@ -43,12 +40,17 @@ import java.util.stream.Stream;
 
 import static java.lang.invoke.MethodType.methodType;
 
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
 public class CondyNameValidationTest {
     static final MethodHandles.Lookup L = MethodHandles.lookup();
     static final MethodType BSM_TYPE = methodType(Object.class, MethodHandles.Lookup.class, String.class, Object.class);
 
-    @DataProvider
-    public Object[][] invalidNamesProvider() {
+    public static Object[][] invalidNamesProvider() {
         return Stream.of(
                         new Object[]{"", "zero-length member name"},
                         new Object[]{".", "Invalid member name"},
@@ -59,26 +61,24 @@ public class CondyNameValidationTest {
                 .toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "invalidNamesProvider")
+    @ParameterizedTest
+    @MethodSource("invalidNamesProvider")
     public void testInvalidNames(String name, String errMessContent) throws Exception {
-        try {
-            MethodHandle mh = InstructionHelper.ldcDynamicConstant(
-                    L, name, Object.class,
-                    "bsm", BSM_TYPE
-            );
-        } catch (IllegalArgumentException e) {
-            Assert.assertTrue(e.getMessage().contains(errMessContent));
-        }
+        var e = assertThrows(IllegalArgumentException.class, () -> InstructionHelper.ldcDynamicConstant(
+                L, name, Object.class,
+                "bsm", BSM_TYPE
+        ));
+        assertTrue(e.getMessage().contains(errMessContent));
     }
 
-    @DataProvider
-    public Object[][] validNamesProvider() throws Exception {
+    public static Object[][] validNamesProvider() throws Exception {
         return Stream.of("",
                         "")
                 .map(e -> new Object[]{e}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "validNamesProvider")
+    @ParameterizedTest
+    @MethodSource("validNamesProvider")
     public void testValidNames(String name) throws Exception {
         MethodHandle mh = InstructionHelper.ldcDynamicConstant(
                 L, name, Object.class,
diff --git a/test/jdk/java/lang/invoke/condy/CondyNestedTest.java b/test/jdk/java/lang/invoke/condy/CondyNestedTest.java
index 8eb71ec93a3..192bbeaa46f 100644
--- a/test/jdk/java/lang/invoke/condy/CondyNestedTest.java
+++ b/test/jdk/java/lang/invoke/condy/CondyNestedTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2026, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,24 +26,25 @@
  * @bug 8186046
  * @summary Test nested dynamic constant declarations that are recursive
  * @compile CondyNestedTest_Code.jcod
- * @run testng CondyNestedTest
- * @run testng/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyNestedTest
+ * @run junit CondyNestedTest
+ * @run junit/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyNestedTest
  */
 
-import org.testng.Assert;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandles;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
+
 public class CondyNestedTest {
 
     static final Class[] THROWABLES = {InvocationTargetException.class, StackOverflowError.class};
     private static final MethodHandles.Lookup L = MethodHandles.lookup();
 
-    Class c;
+    static Class c;
 
 //    static final MethodHandles.Lookup L = MethodHandles.lookup();
 //
@@ -243,28 +244,17 @@ public class CondyNestedTest {
 //    }
 
     static void test(Method m, Class... ts) {
-        Throwable caught = null;
-        try {
-            m.invoke(null);
-        } catch (Throwable t) {
-            caught = t;
-        }
+        Throwable caught = assertThrows(Throwable.class, () -> m.invoke(null));
 
-        if (caught == null) {
-            Assert.fail("Throwable expected");
-        }
-
-        String actualMessage = null;
         for (int i = 0; i < ts.length; i++) {
-            actualMessage = caught.getMessage();
-            Assert.assertNotNull(caught);
-            Assert.assertTrue(ts[i].isAssignableFrom(caught.getClass()));
+            int level = i;
+            assertInstanceOf(ts[i], caught, () -> "Level %d".formatted(level));
             caught = caught.getCause();
         }
     }
 
-    @BeforeClass
-    public void findClass() throws Exception {
+    @BeforeAll
+    public static void findClass() throws Exception {
         c = Class.forName("CondyNestedTest_Code");
     }
 
diff --git a/test/jdk/java/lang/invoke/condy/CondyRepeatFailedResolution.java b/test/jdk/java/lang/invoke/condy/CondyRepeatFailedResolution.java
index 7ef5c610150..b7ccb4944fb 100644
--- a/test/jdk/java/lang/invoke/condy/CondyRepeatFailedResolution.java
+++ b/test/jdk/java/lang/invoke/condy/CondyRepeatFailedResolution.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2026, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,28 +26,28 @@
  * @bug 8186211
  * @summary Test basic invocation of multiple ldc's of the same dynamic constant that fail resolution
  * @library /java/lang/invoke/common
- * @run testng CondyRepeatFailedResolution
- * @run testng/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyRepeatFailedResolution
+ * @run junit CondyRepeatFailedResolution
+ * @run junit/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyRepeatFailedResolution
  */
 
 import java.lang.classfile.ClassFile;
-import org.testng.Assert;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
 import java.lang.constant.*;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
-@Test
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
+
 public class CondyRepeatFailedResolution {
     // Counter used to determine if a given BSM is invoked more than once
     static int bsm_called = 0;
 
     // Generated class with methods containing condy ldc
-    Class gc;
+    static Class gc;
 
     // Bootstrap method used to represent primitive values
     // that cannot be represented directly in the constant pool,
@@ -90,8 +90,8 @@ public class CondyRepeatFailedResolution {
         }
     }
 
-    @BeforeClass
-    public void generateClass() throws Exception {
+    @BeforeAll
+    public static void generateClass() throws Exception {
         String genClassName = CondyRepeatFailedResolution.class.getSimpleName() + "$Code";
         String bsmClassDesc = CondyRepeatFailedResolution.class.descriptorString();
         String bsmMethodName = "intConversion";
@@ -319,29 +319,21 @@ public class CondyRepeatFailedResolution {
         Method m = gc.getDeclaredMethod(name);
 
         bsm_called = 0;
-        try {
+        InvocationTargetException e1 = assertThrows(InvocationTargetException.class, () -> {
             Object r1 = m.invoke(null);
-            Assert.fail("InvocationTargetException expected to be thrown after first invocation");
-        } catch (InvocationTargetException e1) {
-            // bsm_called should have been incremented prior to the exception
-            Assert.assertEquals(bsm_called, 1);
-            Assert.assertTrue(e1.getCause() instanceof BootstrapMethodError);
-            // Try invoking method again to ensure that the bootstrap
-            // method is not invoked twice and a resolution failure
-            // results.
-            try {
-                Object r2 = m.invoke(null);
-                Assert.fail("InvocationTargetException expected to be thrown after second invocation");
-            } catch (InvocationTargetException e2) {
-                // bsm_called should remain at 1 since the bootstrap
-                // method should not have been invoked.
-                Assert.assertEquals(bsm_called, 1);
-                Assert.assertTrue(e2.getCause() instanceof BootstrapMethodError);
-            } catch (Throwable t2) {
-                Assert.fail("InvocationTargetException expected to be thrown");
-            }
-        } catch (Throwable t1) {
-                Assert.fail("InvocationTargetException expected to be thrown");
-        }
+        });
+        // bsm_called should have been incremented prior to the exception
+        assertEquals(1, bsm_called);
+        assertInstanceOf(BootstrapMethodError.class, e1.getCause());
+        // Try invoking method again to ensure that the bootstrap
+        // method is not invoked twice and a resolution failure
+        // results.
+        InvocationTargetException e2 = assertThrows(InvocationTargetException.class, () -> {
+            Object r2 = m.invoke(null);
+        });
+        // bsm_called should remain at 1 since the bootstrap
+        // method should not have been invoked.
+        assertEquals(1, bsm_called);
+        assertInstanceOf(BootstrapMethodError.class, e2.getCause());
     }
 }
diff --git a/test/jdk/java/lang/invoke/condy/CondyReturnPrimitiveTest.java b/test/jdk/java/lang/invoke/condy/CondyReturnPrimitiveTest.java
index d6c0748c97c..4c0dd42a1a2 100644
--- a/test/jdk/java/lang/invoke/condy/CondyReturnPrimitiveTest.java
+++ b/test/jdk/java/lang/invoke/condy/CondyReturnPrimitiveTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2026, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,22 +25,23 @@
  * @test
  * @bug 8186046
  * @summary Test for condy BSMs returning primitive values or null
- * @run testng CondyReturnPrimitiveTest
- * @run testng/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyReturnPrimitiveTest
+ * @run junit CondyReturnPrimitiveTest
+ * @run junit/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyReturnPrimitiveTest
  */
 
 import java.lang.classfile.ClassFile;
-import org.testng.Assert;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
 import java.lang.constant.*;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
 import java.lang.reflect.Method;
 import java.util.concurrent.atomic.AtomicInteger;
 
-@Test
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
 public class CondyReturnPrimitiveTest {
     // Counter for number of BSM calls
     // Use of an AtomicInteger is not strictly necessary in this test
@@ -49,7 +50,7 @@ public class CondyReturnPrimitiveTest {
     // constant so care should be taken if a BSM operates on shared state
     static final AtomicInteger callCount = new AtomicInteger();
     // Generated class with methods containing condy ldc
-    Class gc;
+    static Class gc;
 
     // Bootstrap method used to represent primitive values
     // that cannot be represented directly in the constant pool,
@@ -90,8 +91,8 @@ public class CondyReturnPrimitiveTest {
         }
     }
 
-    @BeforeClass
-    public void generateClass() throws Exception {
+    @BeforeAll
+    public static void generateClass() throws Exception {
         String genClassName = CondyReturnPrimitiveTest.class.getSimpleName() + "$Code";
         String bsmClassDesc = CondyReturnPrimitiveTest.class.descriptorString();
         String bsmMethodName = "intConversion";
@@ -293,7 +294,7 @@ public class CondyReturnPrimitiveTest {
         // Ensure when run a second time that the bootstrap method is not
         // invoked and the constants are cached
         testConstants();
-        Assert.assertEquals(callCount.get(), expectedCallCount);
+        assertEquals(expectedCallCount, callCount.get());
     }
 
     @Test
@@ -318,11 +319,16 @@ public class CondyReturnPrimitiveTest {
         testConstant("S", Short.MAX_VALUE);
         testConstant("Z_F", false);
         testConstant("Z_T", true);
-        testConstant("null", null);
+        testConstant("null", (Object) null);
     }
 
     void testConstant(String name, Object expected) throws Exception {
         Method m = gc.getDeclaredMethod(name);
-        Assert.assertEquals(m.invoke(null), expected);
+        assertEquals(expected, m.invoke(null));
+    }
+
+    void testConstant(String name, Object[] expected) throws Exception {
+        Method m = gc.getDeclaredMethod(name);
+        assertArrayEquals(expected, (Object[]) m.invoke(null));
     }
 }
diff --git a/test/jdk/java/lang/invoke/condy/CondyStaticArgumentsTest.java b/test/jdk/java/lang/invoke/condy/CondyStaticArgumentsTest.java
index ba3d0e81488..075eaf4e844 100644
--- a/test/jdk/java/lang/invoke/condy/CondyStaticArgumentsTest.java
+++ b/test/jdk/java/lang/invoke/condy/CondyStaticArgumentsTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2026, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,12 +27,10 @@
  * @summary Test bootstrap arguments for condy
  * @library /java/lang/invoke/common
  * @build test.java.lang.invoke.lib.InstructionHelper
- * @run testng CondyStaticArgumentsTest
- * @run testng/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyStaticArgumentsTest
+ * @run junit CondyStaticArgumentsTest
+ * @run junit/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyStaticArgumentsTest
  */
 
-import org.testng.Assert;
-import org.testng.annotations.Test;
 import test.java.lang.invoke.lib.InstructionHelper;
 
 import java.lang.constant.*;
@@ -44,6 +42,9 @@ import java.util.StringJoiner;
 import java.util.stream.Stream;
 
 import static java.lang.invoke.MethodType.methodType;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class CondyStaticArgumentsTest {
     static final MethodHandles.Lookup L = MethodHandles.lookup();
@@ -109,7 +110,7 @@ public class CondyStaticArgumentsTest {
                         mhi.getName(), MethodTypeDesc.ofDescriptor(mhi.getMethodType().descriptorString()))
         );
 
-        Assert.assertEquals(mh.invoke(), "constant-name-String-1-2-3.0-4.0-Number-something-(int,long,float,double)void-11");
+        assertEquals("constant-name-String-1-2-3.0-4.0-Number-something-(int,long,float,double)void-11", mh.invoke());
     }
 
     static MathContext mathContext(MethodHandles.Lookup l, String value, Class type) {
@@ -161,7 +162,7 @@ public class CondyStaticArgumentsTest {
                         )
                 )
         );
-        Assert.assertEquals(mh.invoke(), "big-decimal-math-context-String-3.141593-7");
+        assertEquals("big-decimal-math-context-String-3.141593-7", mh.invoke());
     }
 
 
@@ -194,7 +195,7 @@ public class CondyStaticArgumentsTest {
                                 InstructionHelper.classDesc(MathContext.class)
                         )
                 ));
-        Assert.assertEquals(mh.invoke(), "big-decimal-math-context-()Ljava/lang/String;-3.141593-7");
+        assertEquals("big-decimal-math-context-()Ljava/lang/String;-3.141593-7", mh.invoke());
     }
 
     private static DirectMethodHandleDesc directMhDesc(String methodName) {
diff --git a/test/jdk/java/lang/invoke/condy/CondyTypeValidationTest.java b/test/jdk/java/lang/invoke/condy/CondyTypeValidationTest.java
index c44179ce13c..4429468bd34 100644
--- a/test/jdk/java/lang/invoke/condy/CondyTypeValidationTest.java
+++ b/test/jdk/java/lang/invoke/condy/CondyTypeValidationTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2026, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,12 +27,9 @@
  * @summary Test invalid name in name and type
  * @library /java/lang/invoke/common
  * @build test.java.lang.invoke.lib.InstructionHelper
- * @run testng/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyTypeValidationTest
+ * @run junit/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyTypeValidationTest
  */
 
-import org.testng.Assert;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
 import test.java.lang.invoke.lib.InstructionHelper;
 
 import java.lang.invoke.MethodHandle;
@@ -43,14 +40,18 @@ import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
 import static java.lang.invoke.MethodType.methodType;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class CondyTypeValidationTest {
     static final MethodHandles.Lookup L = MethodHandles.lookup();
     static final String BSM_TYPE = methodType(Object.class, MethodHandles.Lookup.class, String.class, Object.class)
             .toMethodDescriptorString();
 
-    @DataProvider
-    public Object[][] invalidTypesProvider() {
+    public static Object[][] invalidTypesProvider() {
         return Stream.of(
 //                         ByteCode API checks for the following invalid types
 //                         "",
@@ -66,20 +67,19 @@ public class CondyTypeValidationTest {
         ).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "invalidTypesProvider")
+    @ParameterizedTest
+    @MethodSource("invalidTypesProvider")
     public void testInvalidTypes(String type, String errMessContent) throws Exception {
-        try {
+        var e = assertThrows(IllegalArgumentException.class, () -> {
             MethodHandle mh = InstructionHelper.ldcDynamicConstant(
                     L, "name", type,
                     "bsm", BSM_TYPE
             );
-        } catch (IllegalArgumentException e) {
-            Assert.assertTrue(e.getMessage().contains(errMessContent));
-        }
+        });
+        assertTrue(e.getMessage().contains(errMessContent));
     }
 
-    @DataProvider
-    public Object[][] validTypesProvider() {
+    public static Object[][] validTypesProvider() {
         List t = new ArrayList<>(List.of("B", "C", "D", "F", "I", "J", "Ljava/lang/Object;", "S", "Z"));
         int l = t.size();
         for (int i = 0; i < l; i++) {
@@ -90,7 +90,8 @@ public class CondyTypeValidationTest {
                 .map(e -> new Object[]{e}).toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "validTypesProvider")
+    @ParameterizedTest
+    @MethodSource("validTypesProvider")
     public void testValidTypes(String type) throws Exception {
         MethodHandle mh = InstructionHelper.ldcDynamicConstant(
                 L, "name", type,
diff --git a/test/jdk/java/lang/invoke/condy/CondyWithGarbageTest.java b/test/jdk/java/lang/invoke/condy/CondyWithGarbageTest.java
index 5e301a193dd..a00f93b69b7 100644
--- a/test/jdk/java/lang/invoke/condy/CondyWithGarbageTest.java
+++ b/test/jdk/java/lang/invoke/condy/CondyWithGarbageTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2026, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,21 +27,20 @@
  * @summary Stress test ldc to ensure HotSpot correctly manages oop maps
  * @library /java/lang/invoke/common
  * @build test.java.lang.invoke.lib.InstructionHelper
- * @run testng CondyWithGarbageTest
- * @run testng/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyWithGarbageTest
+ * @run junit CondyWithGarbageTest
+ * @run junit/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyWithGarbageTest
  */
 
-
 import java.lang.classfile.ClassFile;
 import java.lang.classfile.CodeBuilder;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
 import java.lang.constant.*;
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 
 import static java.lang.invoke.MethodType.methodType;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
 import static test.java.lang.invoke.lib.InstructionHelper.classDesc;
 
 public class CondyWithGarbageTest {
@@ -54,7 +53,7 @@ public class CondyWithGarbageTest {
         for (int i = 0; i < 100000; i++) {
             l += +((String) mh.invoke()).length();
         }
-        Assert.assertTrue(l > 0);
+        assertTrue(l > 0);
     }
 
     public static Object bsmString(MethodHandles.Lookup l,
@@ -133,7 +132,7 @@ public class CondyWithGarbageTest {
         for (int i = 0; i < 100000; i++) {
             l += +((String) mh.invoke()).length();
         }
-        Assert.assertTrue(l > 0);
+        assertTrue(l > 0);
     }
 
     public static Object bsmStringArray(MethodHandles.Lookup l,
diff --git a/test/jdk/java/lang/invoke/condy/CondyWrongType.java b/test/jdk/java/lang/invoke/condy/CondyWrongType.java
index 42c69e8ab7d..1c00da922fe 100644
--- a/test/jdk/java/lang/invoke/condy/CondyWrongType.java
+++ b/test/jdk/java/lang/invoke/condy/CondyWrongType.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2026, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,13 +27,10 @@
  * @summary Test bootstrap methods returning the wrong type
  * @library /java/lang/invoke/common
  * @build test.java.lang.invoke.lib.InstructionHelper
- * @run testng CondyWrongType
- * @run testng/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyWrongType
+ * @run junit CondyWrongType
+ * @run junit/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 CondyWrongType
  */
 
-import org.testng.Assert;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
 import test.java.lang.invoke.lib.InstructionHelper;
 
 import java.lang.invoke.MethodHandle;
@@ -46,11 +43,15 @@ import java.util.List;
 import java.util.Map;
 
 import static java.lang.invoke.MethodType.methodType;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import static org.junit.jupiter.api.Assertions.*;
 
 public class CondyWrongType {
 
-    @DataProvider
-    public Object[][] primitivesProvider() throws Exception {
+    public static Object[][] primitivesProvider() throws Exception {
         Map> typeMap = Map.of(
                 "B", byte.class,
                 "C", char.class,
@@ -81,7 +82,8 @@ public class CondyWrongType {
         return cases.stream().toArray(Object[][]::new);
     }
 
-    @Test(dataProvider = "primitivesProvider")
+    @ParameterizedTest
+    @MethodSource("primitivesProvider")
     public void testPrimitives(String name, String type, boolean pass) {
         test(name, type, pass);
     }
@@ -106,27 +108,12 @@ public class CondyWrongType {
 
     static void test(String name, String type, boolean pass) {
         MethodHandle mh = caster(name, type);
-        Throwable caught = null;
-        try {
-            mh.invoke();
-        } catch (Throwable t) {
-            caught = t;
+        if (pass) {
+            assertDoesNotThrow(() -> mh.invoke());
+        } else {
+            Throwable caught = assertThrows(BootstrapMethodError.class, () -> mh.invoke());
+            assertInstanceOf(ClassCastException.class, caught.getCause());
         }
-
-        if (caught == null) {
-            if (pass) {
-                return;
-            } else {
-                Assert.fail("Throwable expected");
-            }
-        } else if (pass) {
-            Assert.fail("Throwable not expected");
-        }
-
-        Assert.assertTrue(BootstrapMethodError.class.isAssignableFrom(caught.getClass()));
-        caught = caught.getCause();
-        Assert.assertNotNull(caught);
-        Assert.assertTrue(ClassCastException.class.isAssignableFrom(caught.getClass()));
     }
 
     static Object bsm(MethodHandles.Lookup l, String name, Class type) {
diff --git a/test/jdk/java/lang/invoke/condy/ConstantBootstrapsTest.java b/test/jdk/java/lang/invoke/condy/ConstantBootstrapsTest.java
index 829f26704f9..cef5a17eda1 100644
--- a/test/jdk/java/lang/invoke/condy/ConstantBootstrapsTest.java
+++ b/test/jdk/java/lang/invoke/condy/ConstantBootstrapsTest.java
@@ -27,27 +27,31 @@
  * @summary Test dynamic constant bootstraps
  * @library /java/lang/invoke/common
  * @build test.java.lang.invoke.lib.InstructionHelper
- * @run testng ConstantBootstrapsTest
- * @run testng/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 ConstantBootstrapsTest
+ * @run junit ConstantBootstrapsTest
+ * @run junit/othervm -XX:+UnlockDiagnosticVMOptions -XX:UseBootstrapCallInfo=3 ConstantBootstrapsTest
  */
 
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-import test.java.lang.invoke.lib.InstructionHelper;
-
 import java.lang.constant.ConstantDescs;
 import java.lang.constant.DirectMethodHandleDesc;
 import java.lang.constant.MethodHandleDesc;
-import java.lang.invoke.*;
+import java.lang.invoke.ConstantBootstraps;
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import java.lang.invoke.VarHandle;
+import java.lang.invoke.WrongMethodTypeException;
 import java.math.BigInteger;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNull;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+import test.java.lang.invoke.lib.InstructionHelper;
+
+import static org.junit.jupiter.api.Assertions.*;
 
-@Test
 public class ConstantBootstrapsTest {
     static final MethodHandles.Lookup L = MethodHandles.lookup();
 
@@ -56,6 +60,7 @@ public class ConstantBootstrapsTest {
                 appendParameterTypes(params);
     }
 
+    @Test
     public void testNullConstant() throws Throwable {
         var handle = InstructionHelper.ldcDynamicConstant(L, "_", Object.class,
                 ConstantBootstraps.class, "nullConstant", lookupMT(Object.class));
@@ -66,12 +71,13 @@ public class ConstantBootstrapsTest {
         assertNull(handle.invoke());
     }
 
-    @Test(expectedExceptions = IllegalArgumentException.class)
+    @Test
     public void testNullConstantPrimitiveClass() {
-        ConstantBootstraps.nullConstant(MethodHandles.lookup(), null, int.class);
+        assertThrows(IllegalArgumentException.class, () -> ConstantBootstraps.nullConstant(MethodHandles.lookup(), null, int.class));
     }
 
 
+    @Test
     public void testPrimitiveClass() throws Throwable {
         var pm = Map.of(
                 "I", int.class,
@@ -88,69 +94,73 @@ public class ConstantBootstrapsTest {
         for (var desc : pm.keySet()) {
             var handle = InstructionHelper.ldcDynamicConstant(L, desc, Class.class,
                     ConstantBootstraps.class, "primitiveClass", lookupMT(Class.class));
-            assertEquals(handle.invoke(), pm.get(desc));
+            assertEquals(pm.get(desc), handle.invoke());
         }
     }
 
-    @Test(expectedExceptions = NullPointerException.class)
+    @Test
     public void testPrimitiveClassNullName() {
-        ConstantBootstraps.primitiveClass(MethodHandles.lookup(), null, Class.class);
+        assertThrows(NullPointerException.class, () -> ConstantBootstraps.primitiveClass(MethodHandles.lookup(), null, Class.class));
     }
 
-    @Test(expectedExceptions = NullPointerException.class)
+    @Test
     public void testPrimitiveClassNullType() {
-        ConstantBootstraps.primitiveClass(MethodHandles.lookup(), "I", null);
+        assertThrows(NullPointerException.class, () -> ConstantBootstraps.primitiveClass(MethodHandles.lookup(), "I", null));
     }
 
-    @Test(expectedExceptions = IllegalArgumentException.class)
+    @Test
     public void testPrimitiveClassEmptyName() {
-        ConstantBootstraps.primitiveClass(MethodHandles.lookup(), "", Class.class);
+        assertThrows(IllegalArgumentException.class, () -> ConstantBootstraps.primitiveClass(MethodHandles.lookup(), "", Class.class));
     }
 
-    @Test(expectedExceptions = IllegalArgumentException.class)
+    @Test
     public void testPrimitiveClassWrongNameChar() {
-        ConstantBootstraps.primitiveClass(MethodHandles.lookup(), "L", Class.class);
+        assertThrows(IllegalArgumentException.class, () -> ConstantBootstraps.primitiveClass(MethodHandles.lookup(), "L", Class.class));
     }
 
-    @Test(expectedExceptions = IllegalArgumentException.class)
+    @Test
     public void testPrimitiveClassWrongNameString() {
-        ConstantBootstraps.primitiveClass(MethodHandles.lookup(), "Ljava/lang/Object;", Class.class);
+        assertThrows(IllegalArgumentException.class, () -> ConstantBootstraps.primitiveClass(MethodHandles.lookup(), "Ljava/lang/Object;", Class.class));
     }
 
 
+    @Test
     public void testEnumConstant() throws Throwable {
         for (var v : StackWalker.Option.values()) {
             var handle = InstructionHelper.ldcDynamicConstant(L, v.name(), StackWalker.Option.class,
                     ConstantBootstraps.class, "enumConstant", lookupMT(Enum.class));
-            assertEquals(handle.invoke(), v);
+            assertEquals(v, handle.invoke());
         }
     }
 
-    @Test(expectedExceptions = IllegalArgumentException.class)
+    @Test
     public void testEnumConstantUnknown() {
-        ConstantBootstraps.enumConstant(MethodHandles.lookup(), "DOES_NOT_EXIST", StackWalker.Option.class);
+        assertThrows(IllegalArgumentException.class, () -> ConstantBootstraps.enumConstant(MethodHandles.lookup(), "DOES_NOT_EXIST", StackWalker.Option.class));
     }
 
 
+    @Test
     public void testGetStaticDecl() throws Throwable {
         var handle = InstructionHelper.ldcDynamicConstant(L, "TYPE", Class.class,
                 ConstantBootstraps.class, "getStaticFinal", lookupMT(Object.class, Class.class),
                 InstructionHelper.classDesc(Integer.class));
-        assertEquals(handle.invoke(), int.class);
+        assertEquals(int.class, handle.invoke());
     }
 
+    @Test
     public void testGetStaticSelf() throws Throwable {
         var handle = InstructionHelper.ldcDynamicConstant(L, "MAX_VALUE", int.class,
                 ConstantBootstraps.class, "getStaticFinal", lookupMT(Object.class));
-        assertEquals(handle.invoke(), Integer.MAX_VALUE);
+        assertEquals(Integer.MAX_VALUE, handle.invoke());
 
 
         handle = InstructionHelper.ldcDynamicConstant(L, "ZERO", BigInteger.class,
                 ConstantBootstraps.class, "getStaticFinal", lookupMT(Object.class));
-        assertEquals(handle.invoke(), BigInteger.ZERO);
+        assertEquals(BigInteger.ZERO, handle.invoke());
     }
 
 
+    @Test
     public void testInvoke() throws Throwable {
         var handle = InstructionHelper.ldcDynamicConstant(
                 L, "_", List.class,
@@ -159,9 +169,10 @@ public class ConstantBootstrapsTest {
                         MethodType.methodType(List.class, Object[].class).toMethodDescriptorString()),
                 1, 2, 3, 4
         );
-        assertEquals(handle.invoke(), List.of(1, 2, 3, 4));
+        assertEquals(List.of(1, 2, 3, 4), handle.invoke());
     }
 
+    @Test
     public void testInvokeAsType() throws Throwable {
         var handle = InstructionHelper.ldcDynamicConstant(
                 L, "_", int.class,
@@ -170,9 +181,10 @@ public class ConstantBootstrapsTest {
                         MethodType.methodType(Integer.class, String.class).toMethodDescriptorString()),
                 "42"
         );
-        assertEquals(handle.invoke(), 42);
+        assertEquals(42, handle.invoke());
     }
 
+    @Test
     public void testInvokeAsTypeVariableArity() throws Throwable {
         // The constant type is Collection but the invoke return type is List
         var handle = InstructionHelper.ldcDynamicConstant(
@@ -182,21 +194,21 @@ public class ConstantBootstrapsTest {
                         MethodType.methodType(List.class, Object[].class).toMethodDescriptorString()),
                 1, 2, 3, 4
         );
-        assertEquals(handle.invoke(), List.of(1, 2, 3, 4));
+        assertEquals(List.of(1, 2, 3, 4), handle.invoke());
     }
 
-    @Test(expectedExceptions = ClassCastException.class)
+    @Test
     public void testInvokeAsTypeClassCast() throws Throwable {
-        ConstantBootstraps.invoke(MethodHandles.lookup(), "_", String.class,
+        assertThrows(ClassCastException.class, () -> ConstantBootstraps.invoke(MethodHandles.lookup(), "_", String.class,
                 MethodHandles.lookup().findStatic(Integer.class, "valueOf", MethodType.methodType(Integer.class, String.class)),
-                "42");
+                "42"));
     }
 
-    @Test(expectedExceptions = WrongMethodTypeException.class)
+    @Test
     public void testInvokeAsTypeWrongReturnType() throws Throwable {
-        ConstantBootstraps.invoke(MethodHandles.lookup(), "_", short.class,
+        assertThrows(WrongMethodTypeException.class, () -> ConstantBootstraps.invoke(MethodHandles.lookup(), "_", short.class,
                 MethodHandles.lookup().findStatic(Integer.class, "parseInt", MethodType.methodType(int.class, String.class)),
-                "42");
+                "42"));
     }
 
 
@@ -205,6 +217,7 @@ public class ConstantBootstrapsTest {
         public static String sf;
     }
 
+    @Test
     public void testVarHandleField() throws Throwable {
         var handle = InstructionHelper.ldcDynamicConstant(
                 L, "f", VarHandle.class,
@@ -214,10 +227,11 @@ public class ConstantBootstrapsTest {
         );
 
         var vhandle = (VarHandle) handle.invoke();
-        assertEquals(vhandle.varType(), String.class);
-        assertEquals(vhandle.coordinateTypes(), List.of(X.class));
+        assertEquals(String.class, vhandle.varType());
+        assertEquals(List.of(X.class), vhandle.coordinateTypes());
     }
 
+    @Test
     public void testVarHandleStaticField() throws Throwable {
         var handle = InstructionHelper.ldcDynamicConstant(
                 L, "sf", VarHandle.class,
@@ -227,10 +241,11 @@ public class ConstantBootstrapsTest {
         );
 
         var vhandle = (VarHandle) handle.invoke();
-        assertEquals(vhandle.varType(), String.class);
-        assertEquals(vhandle.coordinateTypes(), List.of());
+        assertEquals(String.class, vhandle.varType());
+        assertEquals(List.of(), vhandle.coordinateTypes());
     }
 
+    @Test
     public void testVarHandleArray() throws Throwable {
         var handle = InstructionHelper.ldcDynamicConstant(
                 L, "_", VarHandle.class,
@@ -239,11 +254,10 @@ public class ConstantBootstrapsTest {
         );
 
         var vhandle = (VarHandle) handle.invoke();
-        assertEquals(vhandle.varType(), String.class);
-        assertEquals(vhandle.coordinateTypes(), List.of(String[].class, int.class));
+        assertEquals(String.class, vhandle.varType());
+        assertEquals(List.of(String[].class, int.class), vhandle.coordinateTypes());
     }
 
-    @DataProvider
     public static Object[][] cceCasts() {
         return new Object[][]{
                 { void.class, null },
@@ -252,12 +266,12 @@ public class ConstantBootstrapsTest {
         };
     }
 
-    @Test(dataProvider = "cceCasts", expectedExceptions = ClassCastException.class)
+    @ParameterizedTest
+    @MethodSource("cceCasts")
     public void testBadCasts(Class dstType, Object value) {
-        ConstantBootstraps.explicitCast(null, null, dstType, value);
+        assertThrows(ClassCastException.class, () -> ConstantBootstraps.explicitCast(null, null, dstType, value));
     }
 
-    @DataProvider
     public static Object[][] validCasts() {
         Object o = new Object();
         return new Object[][]{
@@ -278,9 +292,10 @@ public class ConstantBootstrapsTest {
         };
     }
 
-    @Test(dataProvider = "validCasts")
+    @ParameterizedTest
+    @MethodSource("validCasts")
     public void testSuccessfulCasts(Class dstType, Object value, Object expected) {
         Object actual = ConstantBootstraps.explicitCast(null, null, dstType, value);
-        assertEquals(actual, expected);
+        assertEquals(expected, actual);
     }
 }
diff --git a/test/jdk/java/lang/invoke/defineHiddenClass/BasicTest.java b/test/jdk/java/lang/invoke/defineHiddenClass/BasicTest.java
index 379ae765a6b..097e7c782a5 100644
--- a/test/jdk/java/lang/invoke/defineHiddenClass/BasicTest.java
+++ b/test/jdk/java/lang/invoke/defineHiddenClass/BasicTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
  *          BadClassFileVersion.jcod
  * @build jdk.test.lib.Utils
  *        jdk.test.lib.compiler.CompilerUtils
- * @run testng/othervm BasicTest
+ * @run junit/othervm BasicTest
  */
 
 import java.io.File;
@@ -52,16 +52,16 @@ import java.util.stream.Stream;
 import jdk.test.lib.compiler.CompilerUtils;
 import jdk.test.lib.Utils;
 
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import static java.lang.classfile.ClassFile.*;
 import static java.lang.constant.ConstantDescs.CD_Enum;
 import static java.lang.constant.ConstantDescs.CD_Object;
 import static java.lang.invoke.MethodHandles.lookup;
 import static java.lang.invoke.MethodHandles.Lookup.ClassOption.*;
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 interface HiddenTest {
     void test();
@@ -75,7 +75,7 @@ public class BasicTest {
 
     private static byte[] hiddenClassBytes;
 
-    @BeforeTest
+    @BeforeAll
     static void setup() throws IOException {
         compileSources(SRC_DIR, CLASSES_DIR);
         hiddenClassBytes = Files.readAllBytes(CLASSES_DIR.resolve("HiddenClass.class"));
@@ -114,9 +114,9 @@ public class BasicTest {
         Class[] intfs = c.getInterfaces();
         assertTrue(c.isHidden());
         assertFalse(c.isPrimitive());
-        assertTrue(intfs.length == 1);
-        assertTrue(intfs[0] == HiddenTest.class);
-        assertTrue(c.getCanonicalName() == null);
+        assertEquals(1, intfs.length);
+        assertSame(HiddenTest.class, intfs[0]);
+        assertNull(c.getCanonicalName());
 
         String hcName = "HiddenClass";
         String hcSuffix = "0x[0-9a-f]+";
@@ -143,7 +143,7 @@ public class BasicTest {
         Object array = Array.newInstance(type, 2);
         Class arrayType = array.getClass();
         assertTrue(arrayType.isArray());
-        assertTrue(Array.getLength(array) == 2);
+        assertEquals(2, Array.getLength(array));
         assertFalse(arrayType.isHidden());
 
         String hcName = "HiddenClass";
@@ -152,11 +152,11 @@ public class BasicTest {
         assertTrue(arrayType.descriptorString().matches("\\[" + "L" + hcName + "." + hcSuffix + ";"));
 
         assertTrue(arrayType.getComponentType().isHidden());
-        assertTrue(arrayType.getComponentType() == type);
+        assertSame(type, arrayType.getComponentType());
         Object t = type.newInstance();
         Array.set(array, 0, t);
         Object o = Array.get(array, 0);
-        assertTrue(o == t);
+        assertSame(t, o);
     }
 
     private void checkSetAccessible(Class c, String name, Class... ptypes) throws Exception {
@@ -170,13 +170,8 @@ public class BasicTest {
     @Test
     public void testLambda() throws Throwable {
         HiddenTest t = (HiddenTest)defineHiddenClass("Lambda").newInstance();
-        try {
-            t.test();
-        } catch (Error e) {
-            if (!e.getMessage().equals("thrown by " + t.getClass().getName())) {
-                throw e;
-            }
-        }
+        var e = assertThrows(Error.class, t::test);
+        assertEquals("thrown by " + t.getClass().getName(), e.getMessage());
     }
 
     // Define a hidden class that uses lambda and contains its implementation
@@ -184,13 +179,8 @@ public class BasicTest {
     @Test
     public void testHiddenLambda() throws Throwable {
         HiddenTest t = (HiddenTest)defineHiddenClass("HiddenLambda").newInstance();
-        try {
-            t.test();
-        } catch (Error e) {
-            if (!e.getMessage().equals("thrown by " + t.getClass().getName())) {
-                throw e;
-            }
-        }
+        var e = assertThrows(Error.class, t::test);
+        assertEquals("thrown by " + t.getClass().getName(), e.getMessage());
     }
 
     // Verify the nest host and nest members of a hidden class and hidden nestmate class
@@ -206,19 +196,18 @@ public class BasicTest {
 
         // test nest membership and reflection API
         assertTrue(host.isNestmateOf(member));
-        assertTrue(host.getNestHost() == host);
+        assertSame(host, host.getNestHost());
         // getNestHost and getNestMembers return the same value when calling
         // on a nest member and the nest host
-        assertTrue(member.getNestHost() == host.getNestHost());
-        assertTrue(Arrays.equals(member.getNestMembers(), host.getNestMembers()));
+        assertSame(host.getNestHost(), member.getNestHost());
+        assertArrayEquals(member.getNestMembers(), host.getNestMembers());
         // getNestMembers includes the nest host that can be a hidden class but
         // only includes static nest members
-        assertTrue(host.getNestMembers().length == 1);
-        assertTrue(host.getNestMembers()[0] == host);
+        assertEquals(1, host.getNestMembers().length);
+        assertSame(host, host.getNestMembers()[0]);
     }
 
-    @DataProvider(name = "hiddenClasses")
-    private Object[][] hiddenClasses() {
+    private static Object[][] hiddenClasses() {
         return new Object[][] {
                 new Object[] { "HiddenInterface", false },
                 new Object[] { "AbstractClass", false },
@@ -240,7 +229,8 @@ public class BasicTest {
      * is not useful as it cannot be referenced and an outer/inner class
      * when defined as a hidden effectively becomes a final top-level class.
      */
-    @Test(dataProvider = "hiddenClasses")
+    @ParameterizedTest
+    @MethodSource("hiddenClasses")
     public void defineHiddenClass(String name, boolean nestmate) throws Exception {
         byte[] bytes = Files.readAllBytes(CLASSES_DIR.resolve(name + ".class"));
         Class hc;
@@ -252,13 +242,12 @@ public class BasicTest {
             hc = lookup().defineHiddenClass(bytes, false).lookupClass();
             host = hc;
         }
-        assertTrue(hc.getNestHost() == host);
-        assertTrue(hc.getNestMembers().length == 1);
-        assertTrue(hc.getNestMembers()[0] == host);
+        assertSame(host, hc.getNestHost());
+        assertEquals(1, hc.getNestMembers().length);
+        assertSame(host, hc.getNestMembers()[0]);
     }
 
-    @DataProvider(name = "emptyClasses")
-    private Object[][] emptyClasses() {
+    private static Object[][] emptyClasses() {
         return new Object[][] {
                 new Object[] { "EmptyHiddenSynthetic", ACC_SYNTHETIC },
                 new Object[] { "EmptyHiddenEnum", ACC_ENUM },
@@ -276,7 +265,8 @@ public class BasicTest {
      * enum class containing constants of its type should not be a hidden
      * class.
      */
-    @Test(dataProvider = "emptyClasses")
+    @ParameterizedTest
+    @MethodSource("emptyClasses")
     public void emptyHiddenClass(String name, int accessFlags) throws Exception {
         byte[] bytes = (accessFlags == ACC_ENUM) ? classBytes(name, CD_Enum, accessFlags)
                 : classBytes(name, accessFlags);
@@ -316,7 +306,7 @@ public class BasicTest {
                 throw new IllegalArgumentException("unexpected access flag: " + accessFlags);
         }
         assertTrue(hc.isHidden());
-        assertTrue(hc.getModifiers() == (ACC_PUBLIC|accessFlags));
+        assertEquals(hc.getModifiers(), ACC_PUBLIC | accessFlags);
         assertFalse(hc.isLocalClass());
         assertFalse(hc.isMemberClass());
         assertFalse(hc.isAnonymousClass());
@@ -324,8 +314,7 @@ public class BasicTest {
     }
 
     // These class files can't be defined as hidden classes
-    @DataProvider(name = "cantBeHiddenClasses")
-    private Object[][] cantBeHiddenClasses() {
+    private static Object[][] cantBeHiddenClasses() {
         return new Object[][] {
                 // a hidden class can't be a field's declaring type
                 // enum class with static final HiddenEnum[] $VALUES:
@@ -342,10 +331,11 @@ public class BasicTest {
     /*
      * These class files
      */
-    @Test(dataProvider = "cantBeHiddenClasses", expectedExceptions = NoClassDefFoundError.class)
+    @ParameterizedTest
+    @MethodSource("cantBeHiddenClasses")
     public void failToDeriveAsHiddenClass(String name) throws Exception {
         byte[] bytes = Files.readAllBytes(CLASSES_DIR.resolve(name + ".class"));
-        Class hc = lookup().defineHiddenClass(bytes, false).lookupClass();
+        assertThrows(NoClassDefFoundError.class, () -> lookup().defineHiddenClass(bytes, false).lookupClass());
     }
 
     /*
@@ -361,22 +351,17 @@ public class BasicTest {
 
         Class c = t.getClass();
         Class[] intfs = c.getInterfaces();
-        assertTrue(intfs.length == 1);
-        assertTrue(intfs[0] == HiddenTest.class);
+        assertEquals(1, intfs.length);
+        assertSame(HiddenTest.class, intfs[0]);
 
-        try {
-            // this would cause loading of class HiddenCantReflect and NCDFE due
-            // to error during verification
-            c.getDeclaredMethods();
-        } catch (NoClassDefFoundError e) {
-            Throwable x = e.getCause();
-            if (x == null || !(x instanceof ClassNotFoundException && x.getMessage().contains("HiddenCantReflect"))) {
-                throw e;
-            }
+        var e = assertThrows(NoClassDefFoundError.class, c::getDeclaredMethods);
+        Throwable x = e.getCause();
+        if (x == null || !(x instanceof ClassNotFoundException && x.getMessage().contains("HiddenCantReflect"))) {
+            throw e;
         }
     }
 
-    @Test(expectedExceptions = { IllegalArgumentException.class })
+    @Test
     public void cantDefineModule() throws Throwable {
         Path src = Paths.get("module-info.java");
         Path dir = CLASSES_DIR.resolve("m");
@@ -384,35 +369,34 @@ public class BasicTest {
         compileSources(src, dir);
 
         byte[] bytes = Files.readAllBytes(dir.resolve("module-info.class"));
-        lookup().defineHiddenClass(bytes, false);
+        assertThrows(IllegalArgumentException.class, () -> lookup().defineHiddenClass(bytes, false));
     }
 
-    @Test(expectedExceptions = { IllegalArgumentException.class })
+    @Test
     public void cantDefineClassInAnotherPackage() throws Throwable {
         Path src = Paths.get("ClassInAnotherPackage.java");
         Files.write(src, List.of("package p;", "public class ClassInAnotherPackage {}"), StandardCharsets.UTF_8);
         compileSources(src, CLASSES_DIR);
 
         byte[] bytes = Files.readAllBytes(CLASSES_DIR.resolve("p").resolve("ClassInAnotherPackage.class"));
-        lookup().defineHiddenClass(bytes, false);
+        assertThrows(IllegalArgumentException.class, () -> lookup().defineHiddenClass(bytes, false));
     }
 
-    @Test(expectedExceptions = { IllegalAccessException.class })
+    @Test
     public void lessPrivilegedLookup() throws Throwable {
         Lookup lookup = lookup().dropLookupMode(Lookup.PRIVATE);
-        lookup.defineHiddenClass(hiddenClassBytes, false);
+        assertThrows(IllegalAccessException.class, () -> lookup.defineHiddenClass(hiddenClassBytes, false));
     }
 
-    @Test(expectedExceptions = { UnsupportedClassVersionError.class })
+    @Test
     public void badClassFileVersion() throws Throwable {
         Path dir = Paths.get(System.getProperty("test.classes", "."));
         byte[] bytes = Files.readAllBytes(dir.resolve("BadClassFileVersion.class"));
-        lookup().defineHiddenClass(bytes, false);
+        assertThrows(UnsupportedClassVersionError.class, () -> lookup().defineHiddenClass(bytes, false));
     }
 
     // malformed class files
-    @DataProvider(name = "malformedClassFiles")
-    private Object[][] malformedClassFiles() throws IOException {
+    private static Object[][] malformedClassFiles() throws IOException {
         Path dir = Paths.get(System.getProperty("test.classes", "."));
         return new Object[][] {
                 // `this_class` has invalid CP entry
@@ -424,13 +408,13 @@ public class BasicTest {
         };
     }
 
-    @Test(dataProvider = "malformedClassFiles", expectedExceptions = ClassFormatError.class)
+    @ParameterizedTest
+    @MethodSource("malformedClassFiles")
     public void badClassFile(byte[] bytes) throws Throwable {
-        lookup().defineHiddenClass(bytes, false);
+        assertThrows(ClassFormatError.class, () -> lookup().defineHiddenClass(bytes, false));
     }
 
-    @DataProvider(name = "nestedTypesOrAnonymousClass")
-    private Object[][] nestedTypesOrAnonymousClass() {
+    private static Object[][] nestedTypesOrAnonymousClass() {
         return new Object[][] {
                 // class file with bad InnerClasses or EnclosingMethod attribute
                 new Object[] { "Outer", null },
@@ -440,7 +424,8 @@ public class BasicTest {
         };
     }
 
-    @Test(dataProvider = "nestedTypesOrAnonymousClass")
+    @ParameterizedTest
+    @MethodSource("nestedTypesOrAnonymousClass")
     public void hasInnerClassesOrEnclosingMethodAttribute(String className, String badDeclaringClassName) throws Throwable {
         byte[] bytes = Files.readAllBytes(CLASSES_10_DIR.resolve(className + ".class"));
         Class hc = lookup().defineHiddenClass(bytes, false).lookupClass();
@@ -460,21 +445,22 @@ public class BasicTest {
         byte[] bytes = Files.readAllBytes(CLASSES_DIR.resolve("Outer.class"));
         Class hc = lookup().defineHiddenClass(bytes, false).lookupClass();
         assertHiddenClass(hc);
-        assertTrue(hc.getNestHost() == hc);
+        assertSame(hc, hc.getNestHost());
         Class[] members = hc.getNestMembers();
-        assertTrue(members.length == 1 && members[0] == hc);
+        assertEquals(1, members.length);
+        assertSame(hc, members[0]);
     }
 
     // a hidden class with bad InnerClasses or EnclosingMethod attribute
     private void hiddenClassWithBadAttribute(Class hc, String badDeclaringClassName) {
         assertTrue(hc.isHidden());
-        assertTrue(hc.getCanonicalName() == null);
+        assertNull(hc.getCanonicalName());
         assertTrue(hc.getName().contains("/"));
 
         if (badDeclaringClassName == null) {
             // the following reflection API assumes a good name in InnerClasses
             // or EnclosingMethod attribute can successfully be resolved.
-            assertTrue(hc.getSimpleName().length() > 0);
+            assertFalse(hc.getSimpleName().isEmpty());
             assertFalse(hc.isAnonymousClass());
             assertFalse(hc.isLocalClass());
             assertFalse(hc.isMemberClass());
@@ -483,43 +469,34 @@ public class BasicTest {
         }
 
         // validation of nest membership
-        assertTrue(hc.getNestHost() == hc);
+        assertSame(hc, hc.getNestHost());
         // validate the static nest membership
         Class[] members = hc.getNestMembers();
-        assertTrue(members.length == 1 && members[0] == hc);
+        assertEquals(1, members.length);
+        assertSame(hc, members[0]);
     }
 
     // Class::getSimpleName, Class::isMemberClass
     private void declaringClassNotFound(Class c, String cn) {
-        try {
-            // fail to find declaring/enclosing class
-            c.isMemberClass();
-            assertTrue(false);
-        } catch (NoClassDefFoundError e) {
-            if (!e.getMessage().equals(cn)) {
-                throw e;
-            }
+        var e = assertThrows(NoClassDefFoundError.class, c::isMemberClass);
+        if (!e.getMessage().equals(cn)) {
+            throw e;
         }
-        try {
-            // fail to find declaring/enclosing class
-            c.getSimpleName();
-            assertTrue(false);
-        } catch (NoClassDefFoundError e) {
-            if (!e.getMessage().equals(cn)) {
-                throw e;
-            }
+        e = assertThrows(NoClassDefFoundError.class, c::getSimpleName);
+        if (!e.getMessage().equals(cn)) {
+            throw e;
         }
     }
 
     private static void singletonNest(Class hc) {
-        assertTrue(hc.getNestHost() == hc);
-        assertTrue(hc.getNestMembers().length == 1);
-        assertTrue(hc.getNestMembers()[0] == hc);
+        assertSame(hc, hc.getNestHost());
+        assertEquals(1, hc.getNestMembers().length);
+        assertSame(hc, hc.getNestMembers()[0]);
     }
 
     private static void assertHiddenClass(Class hc) {
         assertTrue(hc.isHidden());
-        assertTrue(hc.getCanonicalName() == null);
+        assertNull(hc.getCanonicalName());
         assertTrue(hc.getName().contains("/"));
         assertFalse(hc.isAnonymousClass());
         assertFalse(hc.isLocalClass());
diff --git a/test/jdk/java/lang/invoke/defineHiddenClass/HiddenNestmateTest.java b/test/jdk/java/lang/invoke/defineHiddenClass/HiddenNestmateTest.java
index e026a7a1387..a71029dd229 100644
--- a/test/jdk/java/lang/invoke/defineHiddenClass/HiddenNestmateTest.java
+++ b/test/jdk/java/lang/invoke/defineHiddenClass/HiddenNestmateTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
  * @test
  * @library /test/lib
  * @build  HiddenNestmateTest
- * @run testng/othervm HiddenNestmateTest
+ * @run junit/othervm HiddenNestmateTest
  */
 
 import java.lang.classfile.ClassFile;
@@ -37,9 +37,6 @@ import java.lang.reflect.AccessFlag;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.stream.Stream;
-import java.util.Arrays;
-
-import org.testng.annotations.Test;
 
 import static java.lang.constant.ConstantDescs.CD_Object;
 import static java.lang.constant.ConstantDescs.CD_int;
@@ -48,7 +45,8 @@ import static java.lang.constant.ConstantDescs.MTD_void;
 import static java.lang.invoke.MethodHandles.Lookup.ClassOption.*;
 import static java.lang.invoke.MethodHandles.Lookup.*;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Test;
 
 public class HiddenNestmateTest {
     private static final ClassDesc CD_HiddenNestmateTest = HiddenNestmateTest.class.describeConstable().orElseThrow();
@@ -61,12 +59,12 @@ public class HiddenNestmateTest {
         Class hiddenClass = lookup.lookupClass();
         Class nestHost = hiddenClass.getNestHost();
         assertTrue(hiddenClass.isHidden());
-        assertTrue(nestHost == MethodHandles.lookup().lookupClass());
+        assertSame(MethodHandles.lookup().lookupClass(), nestHost);
 
         // hidden nestmate is not listed in the return array of getNestMembers
         assertTrue(Stream.of(nestHost.getNestMembers()).noneMatch(k -> k == hiddenClass));
         assertTrue(hiddenClass.isNestmateOf(lookup.lookupClass()));
-        assertTrue(Arrays.equals(hiddenClass.getNestMembers(), nestHost.getNestMembers()));
+        assertArrayEquals(nestHost.getNestMembers(), hiddenClass.getNestMembers());
     }
 
     /*
@@ -78,23 +76,19 @@ public class HiddenNestmateTest {
         Lookup lookup = MethodHandles.lookup().defineHiddenClass(bytes, false);
         Class c = lookup.lookupClass();
         assertTrue(lookup.hasFullPrivilegeAccess());
-        assertTrue((lookup.lookupModes() & ORIGINAL) == ORIGINAL);
-        assertTrue(c.getNestHost() == c);  // host of its own nest
+        assertEquals(ORIGINAL, lookup.lookupModes() & ORIGINAL);
+        assertSame(c, c.getNestHost());  // host of its own nest
         assertTrue(c.isHidden());
 
         // invoke int test(HiddenNestmateTest o) via MethodHandle
         MethodHandle ctor = lookup.findConstructor(c, MethodType.methodType(void.class));
         MethodHandle mh = lookup.findVirtual(c, "test", MethodType.methodType(int.class, HiddenNestmateTest.class));
-        try {
+        assertThrows(IllegalAccessError.class, () -> {
             int x = (int) mh.bindTo(ctor.invoke()).invokeExact(this);
-            throw new RuntimeException("should fail when accessing HiddenNestmateTest.privMethod()");
-        } catch (IllegalAccessError e) {}
+        });
 
         // invoke int test(HiddenNestmateTest o)
-        try {
-            int x1 = testInjectedClass(c);
-            throw new RuntimeException("should fail when accessing HiddenNestmateTest.privMethod()");
-        } catch (IllegalAccessError e) {}
+        assertThrows(IllegalAccessError.class, () -> testInjectedClass(c));
     }
 
     /*
@@ -111,11 +105,11 @@ public class HiddenNestmateTest {
         MethodHandle ctor = lookup.findConstructor(c, MethodType.methodType(void.class));
         MethodHandle mh = lookup.findVirtual(c, "test", MethodType.methodType(int.class, HiddenNestmateTest.class));
         int x = (int)mh.bindTo(ctor.invoke()).invokeExact( this);
-        assertTrue(x == privMethod());
+        assertEquals(privMethod(), x);
 
         // invoke int test(HiddenNestmateTest o)
         int x1 = testInjectedClass(c);
-        assertTrue(x1 == privMethod());
+        assertEquals(privMethod(), x1);
     }
 
     /*
@@ -131,10 +125,10 @@ public class HiddenNestmateTest {
     /*
      * Fail to create a hidden class if dropping PRIVATE lookup mode
      */
-    @Test(expectedExceptions = IllegalAccessException.class)
+    @Test
     public void noPrivateLookupAccess() throws Throwable {
         Lookup lookup = MethodHandles.lookup().dropLookupMode(Lookup.PRIVATE);
-        lookup.defineHiddenClass(bytes, false, NESTMATE);
+        assertThrows(IllegalAccessException.class, () -> lookup.defineHiddenClass(bytes, false, NESTMATE));
     }
 
     public void teleportToNestmate() throws Throwable {
@@ -143,8 +137,8 @@ public class HiddenNestmateTest {
 
         // Teleport to a hidden nestmate
         Lookup lc =  MethodHandles.lookup().in(lookup.lookupClass());
-        assertTrue((lc.lookupModes() & PRIVATE) != 0);
-        assertTrue((lc.lookupModes() & ORIGINAL) == 0);
+        assertNotEquals(0, lc.lookupModes() & PRIVATE);
+        assertEquals(0, lc.lookupModes() & ORIGINAL);
 
         Lookup lc2 = lc.defineHiddenClass(bytes, false, NESTMATE);
         assertNestmate(lc2);
@@ -153,9 +147,9 @@ public class HiddenNestmateTest {
     /*
      * Fail to create a hidden class in a different package from the lookup class' package
      */
-    @Test(expectedExceptions = IllegalArgumentException.class)
+    @Test
     public void notSamePackage() throws Throwable {
-        MethodHandles.lookup().defineHiddenClass(classBytes("p/HiddenInjected"), false, NESTMATE);
+        assertThrows(IllegalArgumentException.class, () -> MethodHandles.lookup().defineHiddenClass(classBytes("p/HiddenInjected"), false, NESTMATE));
     }
 
     /*
diff --git a/test/jdk/java/lang/invoke/defineHiddenClass/LambdaNestedInnerTest.java b/test/jdk/java/lang/invoke/defineHiddenClass/LambdaNestedInnerTest.java
index 9e3c8a8b318..7524e67bf9e 100644
--- a/test/jdk/java/lang/invoke/defineHiddenClass/LambdaNestedInnerTest.java
+++ b/test/jdk/java/lang/invoke/defineHiddenClass/LambdaNestedInnerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
  * @test
  * @summary define a lambda proxy class whose target class has an invalid
  *          nest membership
- * @run testng/othervm p.LambdaNestedInnerTest
+ * @run junit/othervm p.LambdaNestedInnerTest
  */
 
 package p;
@@ -41,11 +41,10 @@ import java.util.Arrays;
 import java.util.Set;
 import java.util.stream.Collectors;
 
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Test;
-
 import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
 public class LambdaNestedInnerTest {
     private static final String INNER_CLASSNAME = "p.LambdaNestedInnerTest$Inner";
@@ -68,7 +67,7 @@ public class LambdaNestedInnerTest {
             lambda1.run();
         }
 
-        // testng may not be visible to this class
+        // junit may not be visible to this class
         private static void assertTrue(boolean x) {
             if (!x) {
                 throw new AssertionError("expected true but found false");
@@ -79,8 +78,8 @@ public class LambdaNestedInnerTest {
         }
     }
 
-    @BeforeTest
-    public void setup() throws IOException {
+    @BeforeAll
+    public static void setup() throws IOException {
         String filename = INNER_CLASSNAME.replace('.', File.separatorChar) + ".class";
         Path src = Paths.get(System.getProperty("test.classes"), filename);
         Path dest = Paths.get(DIR, filename);
@@ -93,9 +92,9 @@ public class LambdaNestedInnerTest {
         Class inner = Class.forName(INNER_CLASSNAME);
         // inner class is a nest member of LambdaNestedInnerTest
         Class nestHost = inner.getNestHost();
-        assertTrue(nestHost == LambdaNestedInnerTest.class);
+        assertSame(LambdaNestedInnerTest.class, nestHost);
         Set> members = Arrays.stream(nestHost.getNestMembers()).collect(Collectors.toSet());
-        assertEquals(members, Set.of(nestHost, inner, TestLoader.class));
+        assertEquals(Set.of(nestHost, inner, TestLoader.class), members);
 
         // spin lambda proxy hidden class
         Runnable runnable = (Runnable) inner.newInstance();
@@ -107,8 +106,8 @@ public class LambdaNestedInnerTest {
         URL[] urls = new URL[] { Paths.get(DIR).toUri().toURL() };
         URLClassLoader loader = new URLClassLoader(urls, null);
         Class inner = loader.loadClass(INNER_CLASSNAME);
-        assertTrue(inner.getClassLoader() == loader);
-        assertTrue(inner.getNestHost() == inner);   // linkage error ignored
+        assertSame(loader, inner.getClassLoader());
+        assertSame(inner, inner.getNestHost());   // linkage error ignored
 
         Runnable runnable = (Runnable) inner.newInstance();
         // this validates the lambda proxy class
@@ -125,8 +124,8 @@ public class LambdaNestedInnerTest {
         TestLoader loader = new TestLoader(urls);
 
         Class inner = loader.loadClass(INNER_CLASSNAME);
-        assertTrue(inner.getClassLoader() == loader);
-        assertTrue(inner.getNestHost() == inner);   // linkage error ignored.
+        assertSame(loader, inner.getClassLoader());
+        assertSame(inner, inner.getNestHost());   // linkage error ignored.
 
         Runnable runnable = (Runnable) inner.newInstance();
         // this validates the lambda proxy class
diff --git a/test/jdk/java/lang/invoke/defineHiddenClass/PreviewHiddenClass.java b/test/jdk/java/lang/invoke/defineHiddenClass/PreviewHiddenClass.java
index fddbb348517..bd6c87808fe 100644
--- a/test/jdk/java/lang/invoke/defineHiddenClass/PreviewHiddenClass.java
+++ b/test/jdk/java/lang/invoke/defineHiddenClass/PreviewHiddenClass.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
@@ -29,7 +29,7 @@
  * @requires !java.enablePreview
  * @build jdk.test.lib.Utils
  *        jdk.test.lib.compiler.CompilerUtils
- * @run testng PreviewHiddenClass
+ * @run junit PreviewHiddenClass
  * @summary verify UnsupportedClassVersionError thrown when defining a hidden class
  *         with preview minor version but --enable-preview is not set
  * @comment This test itself cannot enablePreview, or hidden class definition
@@ -46,15 +46,15 @@ import java.nio.file.Paths;
 import jdk.test.lib.compiler.CompilerUtils;
 import jdk.test.lib.Utils;
 
-import org.testng.annotations.Test;
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Test;
 
 public class PreviewHiddenClass {
 
     private static final Path SRC_DIR = Paths.get(Utils.TEST_SRC, "src");
     private static final Path CLASSES_DIR = Paths.get("classes");
 
-    @Test(expectedExceptions = { UnsupportedClassVersionError.class })
+    @Test
     public void previewNotEnabled() throws Exception {
         // compile a class with --enable-preview
         Path sourceFile = SRC_DIR.resolve("HiddenInterface.java");
@@ -67,7 +67,7 @@ public class PreviewHiddenClass {
         byte[] bytes = Files.readAllBytes(CLASSES_DIR.resolve("HiddenInterface.class"));
         var dis = new DataInputStream(new ByteArrayInputStream(bytes));
         dis.skipBytes(4); // 0xCAFEBABE
-        assertEquals(dis.readUnsignedShort(), 65535); // Minor version
-        MethodHandles.lookup().defineHiddenClass(bytes, false);
+        assertEquals(65535, dis.readUnsignedShort()); // Minor version
+        assertThrows(UnsupportedClassVersionError.class, () -> MethodHandles.lookup().defineHiddenClass(bytes, false));
     }
 }
diff --git a/test/jdk/java/lang/invoke/defineHiddenClass/StaticInvocableTest.java b/test/jdk/java/lang/invoke/defineHiddenClass/StaticInvocableTest.java
index 1c95caa97d3..ac0a29c247d 100644
--- a/test/jdk/java/lang/invoke/defineHiddenClass/StaticInvocableTest.java
+++ b/test/jdk/java/lang/invoke/defineHiddenClass/StaticInvocableTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 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
@@ -27,7 +27,7 @@
  * @summary hidden class members can't be statically invocable
  * @modules java.base/jdk.internal.misc
  * @build java.base/*
- * @run testng StaticInvocableTest
+ * @run junit StaticInvocableTest
  */
 
 import java.lang.classfile.ClassFile;
@@ -38,7 +38,6 @@ import java.lang.invoke.MethodHandles.Lookup;
 import java.lang.invoke.MethodType;
 import java.lang.invoke.LookupHelper;
 import java.lang.reflect.AccessFlag;
-import org.testng.annotations.Test;
 
 import static java.lang.classfile.ClassFile.ACC_PUBLIC;
 import static java.lang.classfile.ClassFile.ACC_STATIC;
@@ -46,6 +45,7 @@ import static java.lang.constant.ConstantDescs.CD_Object;
 import static java.lang.constant.ConstantDescs.CD_int;
 import static java.lang.constant.ConstantDescs.INIT_NAME;
 import static java.lang.constant.ConstantDescs.MTD_void;
+import org.junit.jupiter.api.Test;
 
 public class StaticInvocableTest {
     public static void main(String[] args) throws Throwable {
diff --git a/test/jdk/java/lang/invoke/defineHiddenClass/TypeDescriptorTest.java b/test/jdk/java/lang/invoke/defineHiddenClass/TypeDescriptorTest.java
index e60cb8a5782..575eac1ccd1 100644
--- a/test/jdk/java/lang/invoke/defineHiddenClass/TypeDescriptorTest.java
+++ b/test/jdk/java/lang/invoke/defineHiddenClass/TypeDescriptorTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,10 +21,10 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 8242013
- * @run testng/othervm test.TypeDescriptorTest
+ * @run junit/othervm test.TypeDescriptorTest
  * @summary Test TypeDescriptor::descriptorString for hidden classes which
  *          cannot be used to produce ConstantDesc via ClassDesc or
  *          MethodTypeDesc factory methods
@@ -42,9 +42,10 @@ import java.nio.file.Files;
 import java.nio.file.Paths;
 import static java.lang.invoke.MethodType.*;
 
-import org.testng.annotations.Test;
-import org.testng.annotations.DataProvider;
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 public class TypeDescriptorTest {
     private static final Lookup HC_LOOKUP = defineHiddenClass();
@@ -61,8 +62,7 @@ public class TypeDescriptorTest {
         }
     }
 
-    @DataProvider(name = "constables")
-    private Object[][] constables() throws Exception {
+    private static Object[][] constables() throws Exception {
         Class hcArray = Array.newInstance(HC, 1).getClass();
         return new Object[][] {
                 new Object[] { HC },
@@ -79,7 +79,8 @@ public class TypeDescriptorTest {
      * Hidden classes have no nominal descriptor.
      * Constable::describeConstable returns empty optional.
      */
-    @Test(dataProvider = "constables")
+    @ParameterizedTest
+    @MethodSource("constables")
     public void noNominalDescriptor(Constable constable) {
         assertTrue(constable.describeConstable().isEmpty());
     }
@@ -90,27 +91,13 @@ public class TypeDescriptorTest {
      */
     @Test
     public void testClassDesc() {
-        try {
-            ClassDesc.ofDescriptor(HC.descriptorString());
-            assertFalse(true);
-        } catch (IllegalArgumentException e) {}
-
-        try {
-            ClassDesc.ofDescriptor(HC.getName());
-            assertFalse(true);
-        } catch (IllegalArgumentException e) {}
-        try {
-            ClassDesc.of(HC.getPackageName(), HC.getSimpleName());
-            assertFalse(true);
-        } catch (IllegalArgumentException e) {}
-        try {
-            ClassDesc.of(HC.getName());
-            assertFalse(true);
-        } catch (IllegalArgumentException e) {}
+        assertThrows(IllegalArgumentException.class, () -> ClassDesc.ofDescriptor(HC.descriptorString()));
+        assertThrows(IllegalArgumentException.class, () -> ClassDesc.ofDescriptor(HC.getName()));
+        assertThrows(IllegalArgumentException.class, () -> ClassDesc.of(HC.getPackageName(), HC.getSimpleName()));
+        assertThrows(IllegalArgumentException.class, () -> ClassDesc.of(HC.getName()));
     }
 
-    @DataProvider(name = "typeDescriptors")
-    private Object[][] typeDescriptors() throws Exception {
+    private static Object[][] typeDescriptors() throws Exception {
         Class hcArray = Array.newInstance(HC, 1, 1).getClass();
         return new Object[][] {
                 new Object[] { HC, "Ltest/HiddenClass.0x[0-9a-f]+;"},
@@ -124,26 +111,20 @@ public class TypeDescriptorTest {
     /*
      * Hidden classes have no nominal type descriptor
      */
-    @Test(dataProvider = "typeDescriptors")
+    @ParameterizedTest
+    @MethodSource("typeDescriptors")
     public void testTypeDescriptor(TypeDescriptor td, String regex) throws Exception {
         String desc = td.descriptorString();
         assertTrue(desc.matches(regex));
 
         if (td instanceof Class) {
-            try {
-                ClassDesc.ofDescriptor(desc);
-                assertFalse(true);
-            } catch (IllegalArgumentException e) {}
+            assertThrows(IllegalArgumentException.class, () -> ClassDesc.ofDescriptor(desc));
         } else if (td instanceof MethodType) {
-            try {
-                MethodTypeDesc.ofDescriptor(desc);
-                assertFalse(true);
-            } catch (IllegalArgumentException e) {}
+            assertThrows(IllegalArgumentException.class, () -> MethodTypeDesc.ofDescriptor(desc));
         }
     }
 
-    @DataProvider(name = "methodTypes")
-    private Object[][] methodTypes() throws Exception {
+    private static Object[][] methodTypes() throws Exception {
         Class hcArray = Array.newInstance(HC, 1, 1).getClass();
         return new Object[][] {
                 new Object[] { methodType(HC), "\\(\\)Ltest/HiddenClass.0x[0-9a-f]+;" },
@@ -155,15 +136,13 @@ public class TypeDescriptorTest {
     /*
      * Test MethodType::toMethodDescriptorString with MethodType referencing to hidden class
      */
-    @Test(dataProvider = "methodTypes")
+    @ParameterizedTest
+    @MethodSource("methodTypes")
     public void testToMethodDescriptorString(MethodType mtype, String regex) throws Exception {
         String desc = mtype.toMethodDescriptorString();
         assertTrue(desc.matches(regex));
 
-        try {
-            MethodType.fromMethodDescriptorString(desc, TypeDescriptorTest.class.getClassLoader());
-            assertFalse(true);
-        } catch (IllegalArgumentException e) {}
+        assertThrows(IllegalArgumentException.class, () -> MethodType.fromMethodDescriptorString(desc, TypeDescriptorTest.class.getClassLoader()));
     }
 }
 
diff --git a/test/jdk/java/lang/invoke/defineHiddenClass/UnloadingTest.java b/test/jdk/java/lang/invoke/defineHiddenClass/UnloadingTest.java
index b016b2f6899..45728f2ed79 100644
--- a/test/jdk/java/lang/invoke/defineHiddenClass/UnloadingTest.java
+++ b/test/jdk/java/lang/invoke/defineHiddenClass/UnloadingTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,7 @@
  * @modules jdk.compiler
  * @library /test/lib/
  * @build jdk.test.lib.util.ForceGC
- * @run testng/othervm UnloadingTest
+ * @run junit/othervm UnloadingTest
  */
 
 import java.io.IOException;
@@ -48,18 +48,16 @@ import jdk.test.lib.util.ForceGC;
 import jdk.test.lib.compiler.CompilerUtils;
 import jdk.test.lib.Utils;
 
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Test;
-
-import static java.lang.invoke.MethodHandles.lookup;
 import static java.lang.invoke.MethodHandles.Lookup.ClassOption.*;
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
 public class UnloadingTest {
     private static final Path CLASSES_DIR = Paths.get("classes");
     private static byte[] hiddenClassBytes;
 
-    @BeforeTest
+    @BeforeAll
     static void setup() throws IOException {
         Path src = Paths.get(Utils.TEST_SRC, "src", "LookupHelper.java");
         if (!CompilerUtils.compile(src, CLASSES_DIR)) {
@@ -116,7 +114,7 @@ public class UnloadingTest {
 
         // keep a strong reference to the nest member class
         Class member = unloaders[1].weakRef.get();
-        assertTrue(member != null);
+        assertNotNull(member);
         // nest host and member will not be unloaded
         assertFalse(unloaders[0].tryUnload());
         assertFalse(unloaders[1].tryUnload());
@@ -180,7 +178,7 @@ public class UnloadingTest {
         } else {
             hc = lookup.defineHiddenClass(hiddenClassBytes, false).lookupClass();
         }
-        assertTrue(hc.getClassLoader() == lookup.lookupClass().getClassLoader());
+        assertSame(lookup.lookupClass().getClassLoader(), hc.getClassLoader());
         return new HiddenClassUnloader(hc);
     }
 
@@ -202,7 +200,7 @@ public class UnloadingTest {
         } else {
             member = hostLookup.defineHiddenClass(hiddenClassBytes, false, NESTMATE).lookupClass();
         }
-        assertTrue(member.getNestHost() == host);
+        assertSame(host, member.getNestHost());
         return new HiddenClassUnloader[] { new HiddenClassUnloader(host), new HiddenClassUnloader(member) };
     }
 
diff --git a/test/jdk/java/lang/invoke/findSpecial/FindSpecialTest.java b/test/jdk/java/lang/invoke/findSpecial/FindSpecialTest.java
index 9b6622a7e9c..5bb7f67c000 100644
--- a/test/jdk/java/lang/invoke/findSpecial/FindSpecialTest.java
+++ b/test/jdk/java/lang/invoke/findSpecial/FindSpecialTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,12 +21,12 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 8209005 8209078
  * @library /test/lib
  * @build m1/* FindSpecialTest
- * @run testng/othervm FindSpecialTest
+ * @run junit/othervm FindSpecialTest
  * @summary Test findSpecial and unreflectSpecial of the declaring class
  *          of the method and the special caller are not in the same module
  *          as the lookup class.
@@ -39,7 +39,7 @@ import java.nio.file.Paths;
 
 import static jdk.test.lib.process.ProcessTools.*;
 
-import org.testng.annotations.Test;
+import org.junit.jupiter.api.Test;
 
 public class FindSpecialTest {
     static final String TEST_CLASSES = System.getProperty("test.classes", ".");
@@ -51,7 +51,7 @@ public class FindSpecialTest {
      * Run test.FindSpecial in unnamed module
      */
     @Test
-    public static void callerInUnnamedModule() throws Throwable {
+    public void callerInUnnamedModule() throws Throwable {
         Path m1 = Paths.get(TEST_CLASSES, "modules", TEST_MODULE);
         if (Files.notExists(m1)) {
             throw new Error(m1 + " not exist");
@@ -66,7 +66,7 @@ public class FindSpecialTest {
      * Run test.FindSpecial in a named module
      */
     @Test
-    public static void callerInNamedModule() throws Throwable {
+    public void callerInNamedModule() throws Throwable {
         Path modules = Paths.get(TEST_CLASSES, "modules");
         if (Files.notExists(modules)) {
             throw new Error(modules + " not exist");
diff --git a/test/jdk/java/lang/invoke/lambda/LambdaFileEncodingSerialization.java b/test/jdk/java/lang/invoke/lambda/LambdaFileEncodingSerialization.java
index 1f950ffce7e..6c505ddf471 100644
--- a/test/jdk/java/lang/invoke/lambda/LambdaFileEncodingSerialization.java
+++ b/test/jdk/java/lang/invoke/lambda/LambdaFileEncodingSerialization.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,36 +21,33 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 8248231
  * @summary Test to verify lambda serialization uses the correct UTF-8 encoding
  * @library /test/lib
  * @build jdk.test.lib.JDKToolFinder
  *        jdk.test.lib.process.ProcessTools
- * @run testng LambdaFileEncodingSerialization
+ * @run junit LambdaFileEncodingSerialization
  */
 import java.io.File;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.io.IOException;
 import java.util.List;
 import java.util.Map;
 import java.util.Arrays;
 import java.util.ArrayList;
 
-import org.testng.annotations.Test;
-import static org.testng.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import jdk.test.lib.JDKToolFinder;
 import jdk.test.lib.process.ProcessTools;
+import org.junit.jupiter.api.Test;
 
 public class LambdaFileEncodingSerialization {
 
     private static final String TEST_NAME = "TestLambdaFileEncodingSerialization";
 
     @Test
-    public static void testDeserializeLambdaEncoding() throws Throwable {
+    public void testDeserializeLambdaEncoding() throws Throwable {
 
         String javac = JDKToolFinder.getTestJDKTool("javac");
         String java = JDKToolFinder.getTestJDKTool("java");
diff --git a/test/jdk/java/lang/invoke/lambda/LambdaHiddenCaller.java b/test/jdk/java/lang/invoke/lambda/LambdaHiddenCaller.java
index aed19e6ca17..0dbdff79230 100644
--- a/test/jdk/java/lang/invoke/lambda/LambdaHiddenCaller.java
+++ b/test/jdk/java/lang/invoke/lambda/LambdaHiddenCaller.java
@@ -29,8 +29,7 @@ import java.util.function.IntSupplier;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
 
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.*;
 
 /*
  * @test
@@ -62,7 +61,7 @@ public class LambdaHiddenCaller {
     void testSerializableLambda() {
         var is = hiddenCaller.callSerializableLambda();
         assertEquals(42, is.getAsInt());
-        assertTrue(Serializable.class.isAssignableFrom(is.getClass()));
+        assertInstanceOf(Serializable.class, is);
         // We do not guarantee serialization functionalities yet
     }
 }
diff --git a/test/jdk/java/lang/invoke/lambda/LogGeneratedClassesTest.java b/test/jdk/java/lang/invoke/lambda/LogGeneratedClassesTest.java
index 60c85753d72..eb013bf01f3 100644
--- a/test/jdk/java/lang/invoke/lambda/LogGeneratedClassesTest.java
+++ b/test/jdk/java/lang/invoke/lambda/LogGeneratedClassesTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2024, 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
@@ -29,7 +29,7 @@
  * @library /java/nio/file
  * @modules jdk.compiler
  *          jdk.zipfs
- * @run testng LogGeneratedClassesTest
+ * @run junit LogGeneratedClassesTest
  * @summary tests logging generated classes for lambda
  */
 import java.io.IOException;
@@ -45,24 +45,24 @@ import java.nio.file.attribute.PosixFileAttributeView;
 
 import jdk.test.lib.compiler.CompilerUtils;
 import jdk.test.lib.process.OutputAnalyzer;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-import org.testng.SkipException;
 
 import static java.nio.file.attribute.PosixFilePermissions.*;
 import static jdk.test.lib.process.ProcessTools.*;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
+import org.junit.jupiter.api.AfterAll;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Assumptions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
 public class LogGeneratedClassesTest {
     static final Path DUMP_LAMBDA_PROXY_CLASS_FILES = Path.of("DUMP_LAMBDA_PROXY_CLASS_FILES");
     static final Path CLASSES = Path.of("classes").toAbsolutePath();
-    String longFQCN;
+    static String longFQCN;
 
-    @BeforeClass
-    public void setup() throws IOException {
+    @BeforeAll
+    public static void setup() throws IOException {
         final List scratch = new ArrayList<>();
         scratch.clear();
         scratch.add("package com.example;");
@@ -102,8 +102,8 @@ public class LogGeneratedClassesTest {
         CompilerUtils.compile(Path.of("."), CLASSES);
     }
 
-    @AfterClass
-    public void cleanup() throws IOException {
+    @AfterAll
+    public static void cleanup() throws IOException {
         Files.delete(Paths.get("TestLambda.java"));
         Files.delete(Paths.get("LongPackageName.java"));
         TestUtil.removeAll(DUMP_LAMBDA_PROXY_CLASS_FILES);
@@ -132,12 +132,11 @@ public class LogGeneratedClassesTest {
         executeProcess(pb).shouldHaveExitValue(0);
 
         // 2 our own class files. We don't care about the others
-        assertEquals(Files.find(
-                        dumpDir,
-                        99,
-                        (p, a) -> p.startsWith(dumpDir.resolve("com/example"))
-                                && a.isRegularFile()).count(),
-                        2, "Two lambda captured");
+        assertEquals(2, Files.find(
+                dumpDir,
+                99,
+                (p, a) -> p.startsWith(dumpDir.resolve("com/example"))
+                        && a.isRegularFile()).count(), "Two lambda captured");
     }
 
     @Test
@@ -155,12 +154,11 @@ public class LogGeneratedClassesTest {
         executeProcess(pb).shouldHaveExitValue(0);
 
         // The dump directory will be created if not exist
-        assertEquals(Files.find(
-                        dumpDir,
-                        99,
-                        (p, a) -> p.startsWith(dumpDir.resolve("com/example"))
-                                && a.isRegularFile()).count(),
-                        2, "Two lambda captured");
+        assertEquals(2, Files.find(
+                dumpDir,
+                99,
+                (p, a) -> p.startsWith(dumpDir.resolve("com/example"))
+                        && a.isRegularFile()).count(), "Two lambda captured");
     }
 
     @Test
@@ -208,12 +206,10 @@ public class LogGeneratedClassesTest {
         try {
             fs = Files.getFileStore(Paths.get("."));
         } catch (IOException e) {
-            throw new SkipException("WARNING: IOException occurred: " + e + ", Skipping testDumpDirNotWritable test.");
-        }
-        if (!fs.supportsFileAttributeView(PosixFileAttributeView.class)) {
-            // No easy way to setup readonly directory without POSIX
-            throw new SkipException("WARNING: POSIX is not supported. Skipping testDumpDirNotWritable test.");
+            Assumptions.assumeTrue(false, "WARNING: IOException occurred: " + e + ", Skipping testDumpDirNotWritable test.");
+            return;
         }
+        Assumptions.assumeFalse(!fs.supportsFileAttributeView(PosixFileAttributeView.class), "WARNING: POSIX is not supported. Skipping testDumpDirNotWritable test."); // No easy way to setup readonly directory without POSIX
 
         Path testDir = Path.of("readOnly");
         Path dumpDir = testDir.resolve(DUMP_LAMBDA_PROXY_CLASS_FILES);
@@ -221,11 +217,8 @@ public class LogGeneratedClassesTest {
         Files.createDirectory(dumpDir,
                               asFileAttribute(fromString("r-xr-xr-x")));
         try {
-            if (isWriteableDirectory(dumpDir)) {
-                // Skipping the test: it's allowed to write into read-only directory
-                // (e.g. current user is super user).
-                throw new SkipException("WARNING: The dump directory is writeable. Skipping testDumpDirNotWritable test.");
-            }
+            Assumptions.assumeFalse(isWriteableDirectory(dumpDir), "WARNING: The dump directory is writeable. Skipping testDumpDirNotWritable test."); // Skipping the test: it's allowed to write into read-only directory
+            // (e.g. current user is super user).
 
             ProcessBuilder pb = createLimitedTestJavaProcessBuilder(
                                    "-cp", CLASSES.toString(),
@@ -251,10 +244,9 @@ public class LogGeneratedClassesTest {
                                longFQCN).directory(testDir.toFile());
         OutputAnalyzer outputAnalyzer = executeProcess(pb);
         outputAnalyzer.shouldHaveExitValue(0);
-        assertEquals(outputAnalyzer.asLines().stream()
-                                  .filter(s -> s.startsWith("WARNING: Exception"))
-                                  .count(),
-                     2, "show error each capture");
+        assertEquals(2, outputAnalyzer.asLines().stream()
+                .filter(s -> s.startsWith("WARNING: Exception"))
+                .count(), "show error each capture");
         // dumpLong/DUMP_LAMBDA_PROXY_CLASS_FILES/com/example/nonsense/nonsense
         Path dumpPath = dumpDir.resolve("com/example/nonsense");
         Predicate filter = p -> p.getParent() == null || dumpPath.startsWith(p) || p.startsWith(dumpPath);
@@ -269,8 +261,8 @@ public class LogGeneratedClassesTest {
                     }
                  });
         }
-        assertEquals(Files.walk(dumpDir)
+        assertEquals(5, Files.walk(dumpDir)
                 .filter(filter)
-                .count(), 5, "Two lambda captured failed to log");
+                .count(), "Two lambda captured failed to log");
     }
 }
diff --git a/test/jdk/java/lang/invoke/lambda/invokeSpecial/InvokeSpecialMethodTest.java b/test/jdk/java/lang/invoke/lambda/invokeSpecial/InvokeSpecialMethodTest.java
index bf1db0f822e..4b74d05f270 100644
--- a/test/jdk/java/lang/invoke/lambda/invokeSpecial/InvokeSpecialMethodTest.java
+++ b/test/jdk/java/lang/invoke/lambda/invokeSpecial/InvokeSpecialMethodTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 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
@@ -24,22 +24,22 @@
 /*
  * @test
  * @bug 8274848
- * @run testng InvokeSpecialMethodTest
+ * @run junit InvokeSpecialMethodTest
  * @summary ensure REF_invokeSpecial on a non-private implementation method
  *          behaves as if `super::m` is invoked regardless of its access flag
  */
 
-import org.testng.Assert;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.CallSite;
 import java.lang.invoke.LambdaMetafactory;
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodHandles.Lookup;
 
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
 import static java.lang.invoke.MethodType.methodType;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class InvokeSpecialMethodTest {
     static class MethodTest {
@@ -95,8 +95,7 @@ public class InvokeSpecialMethodTest {
         String get();
     }
 
-    @DataProvider
-    public Object[][] methodProvider() {
+    public static Object[][] methodProvider() {
         return new Object[][]{
                 {MethodTest.M_PUBLIC, "test_public"},
                 {MethodTest.M_PROTECTED, "test_protected"},
@@ -104,7 +103,8 @@ public class InvokeSpecialMethodTest {
         };
     }
 
-    @Test(dataProvider = "methodProvider")
+    @ParameterizedTest
+    @MethodSource("methodProvider")
     void test(MethodHandle implMethod, String expected) throws Throwable {
         testMetafactory(implMethod, expected);
         testAltMetafactory(implMethod, expected);
@@ -117,7 +117,7 @@ public class InvokeSpecialMethodTest {
         MethodTest o = new MethodTest.SubClass();
         StringFactory factory = (StringFactory) cs.dynamicInvoker().invokeExact(o);
         String actual = factory.get();
-        Assert.assertEquals(actual, expected);
+        assertEquals(expected, actual);
     }
 
     static void testAltMetafactory(MethodHandle implMethod, String expected) throws Throwable {
@@ -128,6 +128,6 @@ public class InvokeSpecialMethodTest {
         MethodTest o = new MethodTest.SubClass();
         StringFactory factory = (StringFactory) cs.dynamicInvoker().invokeExact(o);
         String actual = factory.get();
-        Assert.assertEquals(actual, expected);
+        assertEquals(expected, actual);
     }
 }
diff --git a/test/jdk/java/lang/invoke/lambda/superProtectedMethod/InheritedProtectedMethod.java b/test/jdk/java/lang/invoke/lambda/superProtectedMethod/InheritedProtectedMethod.java
index a5cf6f68c50..fc730d790ac 100644
--- a/test/jdk/java/lang/invoke/lambda/superProtectedMethod/InheritedProtectedMethod.java
+++ b/test/jdk/java/lang/invoke/lambda/superProtectedMethod/InheritedProtectedMethod.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@
  * @library /test/lib
  * @build jdk.test.lib.Utils
  *        jdk.test.lib.compiler.CompilerUtils
- * @run testng/othervm InheritedProtectedMethod
+ * @run junit/othervm InheritedProtectedMethod
  * @summary Test method reference to a method inherited from its
  *          superclass in a different package.  Such method's modifier
  *          is changed from public to protected.
@@ -37,10 +37,6 @@
 import jdk.test.lib.compiler.CompilerUtils;
 import jdk.test.lib.Utils;
 
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.io.IOException;
 import java.lang.reflect.Method;
 import java.net.URL;
@@ -48,13 +44,15 @@ import java.net.URLClassLoader;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
 public class InheritedProtectedMethod {
     private static final Path SRC_DIR = Paths.get(Utils.TEST_SRC, "src");
     private static final Path CLASSES_DIR = Paths.get("classes");
 
-    @BeforeTest
+    @BeforeAll
     static void setup() throws IOException {
         assertTrue(CompilerUtils.compile(SRC_DIR, CLASSES_DIR));
 
@@ -64,13 +62,13 @@ public class InheritedProtectedMethod {
     }
 
     @Test
-    public static void run() throws Exception {
+    public void run() throws Exception {
         URLClassLoader loader = new URLClassLoader("loader", new URL[]{ CLASSES_DIR.toUri().toURL()},
                 ClassLoader.getPlatformClassLoader());
         Class methodInvokeClass = Class.forName("MethodInvoker", false, loader);
         Method invokeMethod = methodInvokeClass.getMethod("invoke");
 
         String result = (String)invokeMethod.invoke(null);
-        assertEquals(result, "protected inherited method");
+        assertEquals("protected inherited method", result);
     }
 }
diff --git a/test/jdk/java/lang/invoke/lambda/superProtectedMethod/ProtectedMethodInOtherPackage.java b/test/jdk/java/lang/invoke/lambda/superProtectedMethod/ProtectedMethodInOtherPackage.java
index 666ba5c254b..980114149a8 100644
--- a/test/jdk/java/lang/invoke/lambda/superProtectedMethod/ProtectedMethodInOtherPackage.java
+++ b/test/jdk/java/lang/invoke/lambda/superProtectedMethod/ProtectedMethodInOtherPackage.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 8227415 8254975 8270056
- * @run testng/othervm p.ProtectedMethodInOtherPackage
+ * @run junit/othervm p.ProtectedMethodInOtherPackage
  * @summary method reference to a protected method inherited from its
  *          superclass in a different runtime package where
  *          lambda proxy class has no access to it.
@@ -47,12 +47,12 @@ import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.function.Function;
 
-import org.testng.annotations.Test;
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Test;
 
 public class ProtectedMethodInOtherPackage  {
     @Test
-    public static void remotePackageSameLoader() {
+    public void remotePackageSameLoader() {
         Sub_I sub = new Sub_I();
         sub.test(Paths.get("test"));
     }
@@ -76,14 +76,14 @@ public class ProtectedMethodInOtherPackage  {
     }
 
     @Test
-    public static void splitPackage() throws Throwable {
+    public void splitPackage() throws Throwable {
         ClassLoader parent = new Loader("loader-A", null, A.class);
         ClassLoader loader = new Loader("loader-B", parent, B.class);
         Class aClass = Class.forName(A.class.getName(), false, loader);
         Class bClass = Class.forName(B.class.getName(), false, loader);
-        assertTrue(aClass.getClassLoader() == parent);
-        assertTrue(bClass.getClassLoader() == loader);
-        assertEquals(aClass.getPackageName(), bClass.getPackageName());
+        assertSame(parent, aClass.getClassLoader());
+        assertSame(loader, bClass.getClassLoader());
+        assertEquals(bClass.getPackageName(), aClass.getPackageName());
 
         Object b = bClass.getDeclaredConstructor().newInstance();
 
@@ -102,14 +102,14 @@ public class ProtectedMethodInOtherPackage  {
     }
 
     @Test
-    public static void protectedStaticMethodInSplitPackage() throws Throwable {
+    public void protectedStaticMethodInSplitPackage() throws Throwable {
         ClassLoader parent = new Loader("loader-A1", null, A1.class);
         ClassLoader loader = new Loader("loader-B1", parent, B1.class);
         Class aClass1 = Class.forName(A1.class.getName(), false, loader);
         Class bClass1 = Class.forName(B1.class.getName(), false, loader);
-        assertTrue(aClass1.getClassLoader() == parent);
-        assertTrue(bClass1.getClassLoader() == loader);
-        assertEquals(aClass1.getPackageName(), bClass1.getPackageName());
+        assertSame(parent, aClass1.getClassLoader());
+        assertSame(loader, bClass1.getClassLoader());
+        assertEquals(bClass1.getPackageName(), aClass1.getPackageName());
 
         // verify subclass can access a static protected method inherited from
         // its superclass in a split package
diff --git a/test/jdk/java/lang/invoke/lookup/ChainedLookupTest.java b/test/jdk/java/lang/invoke/lookup/ChainedLookupTest.java
index 0e81c6a9eec..15a46e6ca2c 100644
--- a/test/jdk/java/lang/invoke/lookup/ChainedLookupTest.java
+++ b/test/jdk/java/lang/invoke/lookup/ChainedLookupTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 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
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 8013527
- * @run testng/othervm ChainedLookupTest
+ * @run junit/othervm ChainedLookupTest
  * @summary Test MethodHandles.lookup method to produce the Lookup object with
  *          proper lookup class if invoked through reflection and method handle.
  */
@@ -33,11 +33,11 @@ import java.lang.invoke.*;
 import java.lang.invoke.MethodHandles.Lookup;
 import java.lang.reflect.Method;
 
-import org.testng.annotations.Test;
 
 import static java.lang.invoke.MethodHandles.*;
 import static java.lang.invoke.MethodType.*;
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Test;
 
 public class ChainedLookupTest {
     /**
@@ -121,7 +121,7 @@ public class ChainedLookupTest {
     }
 
     void test(Lookup lookup, String msg) throws Throwable {
-        assertTrue(lookup.lookupClass() == ChainedLookupTest.class);
+        assertSame(ChainedLookupTest.class, lookup.lookupClass());
         assertTrue(lookup.hasFullPrivilegeAccess());
 
         MethodHandle mh = lookup.findStatic(lookup.lookupClass(), "say", methodType(void.class, String.class));
diff --git a/test/jdk/java/lang/invoke/lookup/LookupClassTest.java b/test/jdk/java/lang/invoke/lookup/LookupClassTest.java
index 205bd3d893e..5970d0331dd 100644
--- a/test/jdk/java/lang/invoke/lookup/LookupClassTest.java
+++ b/test/jdk/java/lang/invoke/lookup/LookupClassTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, 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
@@ -25,44 +25,44 @@
  * @test
  * @bug 8173975
  * @summary Lookup::in throws IAE if the target class is a primitive class or array class
- * @run testng/othervm LookupClassTest
+ * @run junit/othervm LookupClassTest
  */
 
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodHandles.Lookup;
 
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Test;
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
 public class LookupClassTest {
     private static final LookupClassTest[] ARRAY = new LookupClassTest[0];
-    @BeforeTest
-    public void test() {
+    @BeforeAll
+    public static void test() {
         assertTrue(ARRAY.getClass().isArray());
         assertSamePackage(MethodHandles.lookup(), ARRAY.getClass());
         assertSamePackage(MethodHandles.publicLookup(), int.class);
     }
 
-    private void assertSamePackage(Lookup lookup, Class targetClass) {
-        assertEquals(lookup.lookupClass().getPackageName(), targetClass.getPackageName());
+    private static void assertSamePackage(Lookup lookup, Class targetClass) {
+        assertEquals(targetClass.getPackageName(), lookup.lookupClass().getPackageName());
     }
 
-    @Test(expectedExceptions = IllegalArgumentException.class)
+    @Test
     public void arrayLookupClass() {
         Lookup lookup = MethodHandles.lookup();
-        lookup.in(ARRAY.getClass());
+        assertThrows(IllegalArgumentException.class, () -> lookup.in(ARRAY.getClass()));
     }
 
-    @Test(expectedExceptions = IllegalArgumentException.class)
+    @Test
     public void primitiveLookupClass() {
         Lookup lookup = MethodHandles.publicLookup();
-        lookup.in(int.class);
+        assertThrows(IllegalArgumentException.class, () -> lookup.in(int.class));
     }
 
-    @Test(expectedExceptions = IllegalArgumentException.class)
+    @Test
     public void voidLookupClass() {
         Lookup lookup = MethodHandles.publicLookup();
-        lookup.in(void.class);
+        assertThrows(IllegalArgumentException.class, () -> lookup.in(void.class));
     }
 }
diff --git a/test/jdk/java/lang/invoke/lookup/SpecialStatic.java b/test/jdk/java/lang/invoke/lookup/SpecialStatic.java
index 31ded727d66..3ff99b9dfda 100644
--- a/test/jdk/java/lang/invoke/lookup/SpecialStatic.java
+++ b/test/jdk/java/lang/invoke/lookup/SpecialStatic.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
  * @bug 8032400
  * @summary JSR292: invokeSpecial: InternalError attempting to lookup a method
  * @compile -XDignore.symbol.file SpecialStatic.java
- * @run testng test.java.lang.invoke.lookup.SpecialStatic
+ * @run junit test.java.lang.invoke.lookup.SpecialStatic
  */
 package test.java.lang.invoke.lookup;
 
@@ -38,13 +38,13 @@ import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
 import java.lang.reflect.AccessFlag;
 
-import org.testng.annotations.*;
 
 import static java.lang.classfile.ClassFile.ACC_PUBLIC;
 import static java.lang.classfile.ClassFile.ACC_STATIC;
 import static java.lang.constant.ConstantDescs.*;
 import static java.lang.constant.DirectMethodHandleDesc.Kind.SPECIAL;
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.Test;
 
 /**
  * Test case:
@@ -105,7 +105,7 @@ public class SpecialStatic {
     public void testConstant() throws Throwable {
         MethodHandle mh = (MethodHandle)t3.getDeclaredMethod("getMethodHandle").invoke(null);
         int result = (int)mh.invoke(t3.newInstance());
-        assertEquals(result, 1); // T1.m should be invoked.
+        assertEquals(1, result); // T1.m should be invoked.
     }
 
     @Test
@@ -113,7 +113,7 @@ public class SpecialStatic {
         MethodHandles.Lookup lookup = (MethodHandles.Lookup)t3.getDeclaredMethod("getLookup").invoke(null);
         MethodHandle mh = lookup.findSpecial(t1, "m", MethodType.methodType(int.class), t3);
         int result = (int)mh.invoke(t3.newInstance());
-        assertEquals(result, 1); // T1.m should be invoked.
+        assertEquals(1, result); // T1.m should be invoked.
     }
 
     public static byte[] dumpT1() {
diff --git a/test/jdk/java/lang/invoke/modules/Driver.java b/test/jdk/java/lang/invoke/modules/Driver.java
index 5c00de3ad47..11c44280309 100644
--- a/test/jdk/java/lang/invoke/modules/Driver.java
+++ b/test/jdk/java/lang/invoke/modules/Driver.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,9 +21,9 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @build m1/* m2/* Unnamed
- * @run testng/othervm m1/p1.Main
+ * @run junit/othervm m1/p1.Main
  * @summary Basic test case for module access checks and Lookup.in.
  */
diff --git a/test/jdk/java/lang/invoke/modules/Driver1.java b/test/jdk/java/lang/invoke/modules/Driver1.java
index 654ee04c9e0..4ef7130ff94 100644
--- a/test/jdk/java/lang/invoke/modules/Driver1.java
+++ b/test/jdk/java/lang/invoke/modules/Driver1.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,11 +21,11 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 8173978
  * @build m3/* m4/* m5/* Unnamed Unnamed1
- * @run testng/othervm m3/jdk.test.ModuleAccessTest
+ * @run junit/othervm m3/jdk.test.ModuleAccessTest
  * @summary Basic test case for module access checks and Lookup.in and
  *          MethodHandles.privateLookupIn
  */
diff --git a/test/jdk/java/lang/invoke/modules/m1/module-info.java b/test/jdk/java/lang/invoke/modules/m1/module-info.java
index db03841b4d0..ecd133ae6a1 100644
--- a/test/jdk/java/lang/invoke/modules/m1/module-info.java
+++ b/test/jdk/java/lang/invoke/modules/m1/module-info.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,6 @@
  */
 module m1 {
     requires m2;
-    requires org.testng;
+    requires org.junit.platform.console.standalone;
     exports p1;
 }
diff --git a/test/jdk/java/lang/invoke/modules/m1/p1/Main.java b/test/jdk/java/lang/invoke/modules/m1/p1/Main.java
index 0a4d2fff1db..5a2a7c91999 100644
--- a/test/jdk/java/lang/invoke/modules/m1/p1/Main.java
+++ b/test/jdk/java/lang/invoke/modules/m1/p1/Main.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,26 +30,24 @@ import java.lang.invoke.MethodType;
 
 import static java.lang.invoke.MethodHandles.Lookup.*;
 
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Test;
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
 /**
  * Basic test case for module access checks and Lookup.in.
  */
-
-@Test
 public class Main {
 
-    private Class p1_Type1;        // m1, exported
-    private Class p2_Type2;        // m1, not exported
-    private Class q1_Type1;        // m2, exported
-    private Class q2_Type2;        // m2, not exported
-    private Class signalClass;     // java.base, not exported
-    private Class unnamedClass;    // class in unnamed module
+    private static Class p1_Type1;        // m1, exported
+    private static Class p2_Type2;        // m1, not exported
+    private static Class q1_Type1;        // m2, exported
+    private static Class q2_Type2;        // m2, not exported
+    private static Class signalClass;     // java.base, not exported
+    private static Class unnamedClass;    // class in unnamed module
 
-    @BeforeTest
-    public void setup() throws Exception {
+    @BeforeAll
+    public static void setup() throws Exception {
         try {
             p1_Type1 = Class.forName("p1.Type1");
             p2_Type2 = Class.forName("p2.Type2");
@@ -64,15 +62,15 @@ public class Main {
         // check setup
         Module m1 = ModuleLayer.boot().findModule("m1").orElse(null);
         assertNotNull(m1);
-        assertTrue(p1_Type1.getModule() == m1);
-        assertTrue(p2_Type2.getModule() == m1);
+        assertSame(m1, p1_Type1.getModule());
+        assertSame(m1, p2_Type2.getModule());
         assertTrue(m1.isExported("p1"));
         assertFalse(m1.isExported("p2"));
 
         Module m2 = ModuleLayer.boot().findModule("m2").orElse(null);
         assertNotNull(m2);
-        assertTrue(q1_Type1.getModule() == m2);
-        assertTrue(q2_Type2.getModule() == m2);
+        assertSame(m2, q1_Type1.getModule());
+        assertSame(m2, q2_Type2.getModule());
         assertTrue(m2.isExported("q1"));
         assertFalse(m2.isExported("q2"));
 
@@ -91,9 +89,10 @@ public class Main {
      * [A2] can access public types in packages exported by modules that m1 reads
      * [A3] cannot access public types in non-exported modules of modules that m1 reads
      */
+    @Test
     public void testLookup() throws Exception {
         Lookup lookup = MethodHandles.lookup();
-        assertTrue((lookup.lookupModes() & MODULE) == MODULE); // [A0]
+        assertEquals(MODULE, lookup.lookupModes() & MODULE); // [A0]
 
         // m1
         findConstructor(lookup, p1_Type1, void.class); // [A1]
@@ -116,9 +115,10 @@ public class Main {
      *
      * [A0] module and public access is not lost
      */
+    @Test
     public void testToSameModule() throws Exception {
         Lookup lookup = MethodHandles.lookup().in(p2_Type2);
-        assertTrue(lookup.lookupModes() == (MODULE|PUBLIC)); // [A0]
+        assertEquals(MODULE | PUBLIC, lookup.lookupModes()); // [A0]
 
         // m1
         findConstructor(lookup, p1_Type1, void.class);
@@ -142,15 +142,16 @@ public class Main {
      * [A0] has PUBLIC access if accessible; otherwise no access
      * [A1] old lookup class becomes previous lookup class
      */
+    @Test
     public void testFromNamedToNamedModule() throws Exception {
         // m2/q1_Type1 is accessible to m1 whereas m2/q_Type2 is not accessible
         Lookup lookup = MethodHandles.lookup().in(q1_Type1);
-        assertTrue(lookup.lookupModes() == PUBLIC); // [A0]
-        assertTrue(lookup.previousLookupClass() == Main.class); // [A1]
+        assertEquals(PUBLIC, lookup.lookupModes()); // [A0]
+        assertSame(Main.class, lookup.previousLookupClass()); // [A1]
 
         Lookup lookup2 = MethodHandles.lookup().in(q2_Type2);
-        assertTrue(lookup2.lookupModes() == 0);      // [A0]
-        assertTrue(lookup2.previousLookupClass() == Main.class); // [A1]
+        assertEquals(0, lookup2.lookupModes());      // [A0]
+        assertSame(Main.class, lookup2.previousLookupClass()); // [A1]
 
         // m1
         findConstructorExpectingIAE(lookup, p1_Type1, void.class);
@@ -185,9 +186,10 @@ public class Main {
      *
      * [A0] has PUBLIC access
      */
+    @Test
     public void testFromNamedToUnnamedModule() throws Exception {
         Lookup lookup = MethodHandles.lookup().in(unnamedClass);
-        assertTrue(lookup.lookupModes() == PUBLIC); // [A0]
+        assertEquals(PUBLIC, lookup.lookupModes()); // [A0]
 
         // m1
         findConstructor(lookup, p1_Type1, void.class);      // p1 is exported
@@ -210,10 +212,11 @@ public class Main {
      *
      * [A0] retains PUBLIC access
      */
+    @Test
     public void testFromUnnamedToNamedModule() throws Exception {
         Lookup lookup = MethodHandles.lookup();
         lookup = MethodHandles.privateLookupIn(unnamedClass, lookup).in(p1_Type1);
-        assertTrue(lookup.lookupModes() == PUBLIC); // A0
+        assertEquals(PUBLIC, lookup.lookupModes()); // A0
 
         // m1
         findConstructor(lookup, p1_Type1, void.class);
@@ -236,9 +239,10 @@ public class Main {
      *
      * [A0] has UNCONDITIONAL access
      */
+    @Test
     public void testPublicLookup() throws Exception {
         Lookup lookup = MethodHandles.publicLookup();
-        assertTrue(lookup.lookupModes() == UNCONDITIONAL); // A0
+        assertEquals(UNCONDITIONAL, lookup.lookupModes()); // A0
 
         // m1
         findConstructor(lookup, p1_Type1, void.class);
@@ -261,9 +265,10 @@ public class Main {
      *
      * [A0] has UNCONDITIONAL access
      */
+    @Test
     public void testPublicLookupToBaseModule() throws Exception {
         Lookup lookup = MethodHandles.publicLookup().in(String.class);
-        assertTrue(lookup.lookupModes() == UNCONDITIONAL); // A0
+        assertEquals(UNCONDITIONAL, lookup.lookupModes()); // A0
 
         // m1
         findConstructor(lookup, p1_Type1, void.class);
@@ -287,9 +292,10 @@ public class Main {
      *
      * [A0] has UNCONDITIONAL access
      */
+    @Test
     public void testPublicLookupToAccessibleTypeInNamedModule() throws Exception {
         Lookup lookup = MethodHandles.publicLookup().in(p1_Type1);
-        assertTrue(lookup.lookupModes() == UNCONDITIONAL); // A0
+        assertEquals(UNCONDITIONAL, lookup.lookupModes()); // A0
 
         // m1
         findConstructor(lookup, p1_Type1, void.class);
@@ -312,9 +318,10 @@ public class Main {
      *
      * [A0] has no access
      */
+    @Test
     public void testPublicLookupToInaccessibleTypeInNamedModule() throws Exception {
         Lookup lookup = MethodHandles.publicLookup().in(p2_Type2);
-        assertTrue(lookup.lookupModes() == 0); // A0
+        assertEquals(0, lookup.lookupModes()); // A0
 
         // m1
         findConstructorExpectingIAE(lookup, p1_Type1, void.class);
@@ -337,9 +344,10 @@ public class Main {
      *
      * [A0] has UNCONDITIONAL access
      */
+    @Test
     public void testPublicLookupToUnnamedModule() throws Exception {
         Lookup lookup = MethodHandles.publicLookup().in(unnamedClass);
-        assertTrue(lookup.lookupModes() == UNCONDITIONAL); // A0
+        assertEquals(UNCONDITIONAL, lookup.lookupModes()); // A0
 
         // m1
         findConstructor(lookup, p1_Type1, void.class);
@@ -366,10 +374,7 @@ public class Main {
                                             Class clazz,
                                             Class rtype,
                                             Class... ptypes) throws Exception {
-        try {
-            findConstructor(lookup, clazz, rtype, ptypes);
-            assertTrue(false);
-        } catch (IllegalAccessException expected) { }
+        assertThrows(IllegalAccessException.class, () -> findConstructor(lookup, clazz, rtype, ptypes));
     }
 
     /**
diff --git a/test/jdk/java/lang/invoke/modules/m3/jdk/test/ModuleAccessTest.java b/test/jdk/java/lang/invoke/modules/m3/jdk/test/ModuleAccessTest.java
index 6a1e8efe103..235c712926d 100644
--- a/test/jdk/java/lang/invoke/modules/m3/jdk/test/ModuleAccessTest.java
+++ b/test/jdk/java/lang/invoke/modules/m3/jdk/test/ModuleAccessTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,15 +23,12 @@
 
 package jdk.test;
 
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodHandles.Lookup;
 
 import java.lang.invoke.MethodType;
+import java.lang.management.ThreadMXBean;
 import java.lang.reflect.Method;
 import java.util.HashMap;
 import java.util.Map;
@@ -42,7 +39,11 @@ import java.util.stream.Stream;
 import e1.CrackM5Access;
 
 import static java.lang.invoke.MethodHandles.Lookup.*;
-import static org.testng.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 public class ModuleAccessTest {
     static ModuleLookup m3;
@@ -55,8 +56,8 @@ public class ModuleAccessTest {
     static Class unnamed;
     static Class unnamed1;
 
-    @BeforeTest
-    public void setup() throws Exception {
+    @BeforeAll
+    public static void setup() throws Exception {
         m3 = new ModuleLookup("m3", 'C');
         m4 = new ModuleLookup("m4", 'D');
         m5 = new ModuleLookup("m5", 'E');
@@ -76,8 +77,7 @@ public class ModuleAccessTest {
         CrackM5Access.addReads(unnamed.getModule());
     }
 
-    @DataProvider(name = "samePackage")
-    public Object[][] samePackage() throws Exception {
+    public static Object[][] samePackage() throws Exception {
         return new Object[][] {
             { m3.lookup,     m3.type2 },
             { privLookupIn,  m3.type1 },
@@ -93,7 +93,8 @@ public class ModuleAccessTest {
      * [A1] no change in previous lookup class
      * [A2] PROTECTED, PRIVATE and ORIGINAL are dropped
      */
-    @Test(dataProvider = "samePackage")
+    @ParameterizedTest
+    @MethodSource("samePackage")
     public void testLookupInSamePackage(Lookup lookup, Class targetClass) throws Exception {
         Class lookupClass = lookup.lookupClass();
         Lookup lookup2 = lookup.in(targetClass);
@@ -105,8 +106,7 @@ public class ModuleAccessTest {
         assertTrue(lookup2.lookupModes() == (lookup.lookupModes() & ~(PROTECTED|PRIVATE|ORIGINAL)));  // [A2]
     }
 
-    @DataProvider(name = "sameModule")
-    public Object[][] sameModule() throws Exception {
+    public static Object[][] sameModule() throws Exception {
         return new Object[][] {
             { m3.lookup,     m3.type3},
             { privLookupIn,  m3.type3},
@@ -121,20 +121,20 @@ public class ModuleAccessTest {
      * [A1] no change in previous lookup class
      * [A2] PROTECTED, PRIVATE, PACKAGE and ORIGINAL are dropped
      */
-    @Test(dataProvider = "sameModule")
+    @ParameterizedTest
+    @MethodSource("sameModule")
     public void testLookupInSameModule(Lookup lookup, Class targetClass) throws Exception {
         Class lookupClass = lookup.lookupClass();
         Lookup lookup2 = lookup.in(targetClass);
 
-        assertTrue(lookupClass.getPackage() != targetClass.getPackage());
-        assertTrue(lookupClass.getModule() == targetClass.getModule());
-        assertTrue(lookup2.lookupClass() == targetClass);   // [A0]
-        assertTrue(lookup2.previousLookupClass() == lookup.previousLookupClass());  // [A1]
-        assertTrue(lookup2.lookupModes() == (lookup.lookupModes() & ~(PROTECTED|PRIVATE|PACKAGE|ORIGINAL))); // [A2]
+        assertNotSame(targetClass.getPackage(), lookupClass.getPackage());
+        assertSame(targetClass.getModule(), lookupClass.getModule());
+        assertSame(targetClass, lookup2.lookupClass());   // [A0]
+        assertSame(lookup.previousLookupClass(), lookup2.previousLookupClass());  // [A1]
+        assertEquals(lookup.lookupModes() & ~(PROTECTED | PRIVATE | PACKAGE | ORIGINAL), lookup2.lookupModes()); // [A2]
     }
 
-    @DataProvider(name = "anotherModule")
-    public Object[][] anotherModule() throws Exception {
+    public static Object[][] anotherModule() throws Exception {
         return new Object[][] {
             { m3.lookup, m4.type1, m5, m5.accessibleTypesTo(m3.module, m4.module) },
             { m4.lookup, m5.type2, m3, m3.accessibleTypesTo(m4.module, m5.module) },
@@ -154,21 +154,22 @@ public class ModuleAccessTest {
      * [A5] can access public types in m1 exported to m0
      * [A6] can access public types in m2 exported to m0 and m1
      */
-    @Test(dataProvider = "anotherModule")
+    @ParameterizedTest
+    @MethodSource("anotherModule")
     public void testLookupInAnotherModule(Lookup lookup, Class targetClass,
                                           ModuleLookup m2, Set> otherTypes) throws Exception {
         Class lookupClass = lookup.lookupClass();
         Module m0 = lookupClass.getModule();
         Module m1 = targetClass.getModule();
 
-        assertTrue(m0 != m1);
+        assertNotSame(m1, m0);
         assertTrue(m0.canRead(m1));
         assertTrue(m1.isExported(targetClass.getPackageName(), m0));
 
         Lookup lookup2 = lookup.in(targetClass);
-        assertTrue(lookup2.lookupClass() == targetClass);   // [A0]
-        assertTrue(lookup2.previousLookupClass() == lookup.lookupClass());  // [A1]
-        assertTrue(lookup2.lookupModes() == (lookup.lookupModes() & ~(PROTECTED|PRIVATE|PACKAGE|MODULE|ORIGINAL)));  // [A2]
+        assertSame(targetClass, lookup2.lookupClass());   // [A0]
+        assertSame(lookup.lookupClass(), lookup2.previousLookupClass());  // [A1]
+        assertEquals(lookup.lookupModes() & ~(PROTECTED | PRIVATE | PACKAGE | MODULE | ORIGINAL), lookup2.lookupModes());  // [A2]
 
         // [A3] no access to module internal type in m0
         // [A4] if m1 reads m0,
@@ -207,7 +208,7 @@ public class ModuleAccessTest {
         // [A5] can access public types exported from m2 unconditionally
         // [A5] can access public types exported from m2 to m0 and m1
         for (Class type : otherTypes) {
-            assertTrue(type.getModule() == m2.module);
+            assertSame(m2.module, type.getModule());
             testAccess(lookup2, type);
         }
 
@@ -215,10 +216,7 @@ public class ModuleAccessTest {
         for (Class type : Set.of(m2.type1, m2.type2, m2.type3)) {
             if (!otherTypes.contains(type)) {
                 // type is accessible to this lookup
-                try {
-                    lookup2.accessClass(type);
-                    assertTrue(false);
-                } catch (IllegalAccessException e) {}
+                assertThrows(IllegalAccessException.class, () -> lookup2.accessClass(type));
 
                 findConstructorExpectingIAE(lookup2, type, void.class);
             }
@@ -227,7 +225,7 @@ public class ModuleAccessTest {
 
     public void testAccess(Lookup lookup, Class type) throws Exception {
         // type is accessible to this lookup
-        assertTrue(lookup.accessClass(type) == type);
+        assertSame(type, lookup.accessClass(type));
 
         // can find constructor
         findConstructor(lookup, type, void.class);
@@ -237,28 +235,27 @@ public class ModuleAccessTest {
         Module m2 = type.getModule();
 
         assertTrue(m0 != m1 && m0 != null);
-        assertTrue((lookup.lookupModes() & MODULE) == 0);
+        assertEquals(0, lookup.lookupModes() & MODULE);
         assertTrue(m0 != m2 || m1 != m2);
 
         MethodHandles.Lookup lookup2 = lookup.in(type);
         if (m2 == m1) {
             // the same module of the lookup class
-            assertTrue(lookup2.lookupClass() == type);
-            assertTrue(lookup2.previousLookupClass() == lookup.previousLookupClass());
+            assertSame(type, lookup2.lookupClass());
+            assertSame(lookup.previousLookupClass(), lookup2.previousLookupClass());
         } else if (m2 == m0) {
             // hop back to the module of the previous lookup class
-            assertTrue(lookup2.lookupClass() == type);
-            assertTrue(lookup2.previousLookupClass() == lookup.lookupClass());
+            assertSame(type, lookup2.lookupClass());
+            assertSame(lookup.lookupClass(), lookup2.previousLookupClass());
         } else {
             // hop to a third module
-            assertTrue(lookup2.lookupClass() == type);
-            assertTrue(lookup2.previousLookupClass() == lookup.lookupClass());
-            assertTrue(lookup2.lookupModes() == 0);
+            assertSame(type, lookup2.lookupClass());
+            assertSame(lookup.lookupClass(), lookup2.previousLookupClass());
+            assertEquals(0, lookup2.lookupModes());
         }
     }
 
-    @DataProvider(name = "thirdModule")
-    public Object[][] thirdModule() throws Exception {
+    public static Object[][] thirdModule() throws Exception {
         return new Object[][] {
             { m3.lookup, m4.type1, m5.type1},
             { m3.lookup, m4.type2, m5.type1},
@@ -273,7 +270,8 @@ public class ModuleAccessTest {
      * [A1] c1 becomes previous lookup class
      * [A2] all access bits are dropped
      */
-    @Test(dataProvider = "thirdModule")
+    @ParameterizedTest
+    @MethodSource("thirdModule")
     public void testLookupInThirdModule(Lookup lookup, Class c1, Class c2) throws Exception {
         Class c0 = lookup.lookupClass();
         Module m0 = c0.getModule();
@@ -287,18 +285,17 @@ public class ModuleAccessTest {
         assertTrue(m2.isExported(c2.getPackageName(), m0) && m2.isExported(c2.getPackageName(), m1));
 
         Lookup lookup1 = lookup.in(c1);
-        assertTrue(lookup1.lookupClass() == c1);
-        assertTrue(lookup1.previousLookupClass() == c0);
-        assertTrue(lookup1.lookupModes() == (lookup.lookupModes() & ~(PROTECTED|PRIVATE|PACKAGE|MODULE|ORIGINAL)));
+        assertSame(c1, lookup1.lookupClass());
+        assertSame(c0, lookup1.previousLookupClass());
+        assertEquals(lookup.lookupModes() & ~(PROTECTED | PRIVATE | PACKAGE | MODULE | ORIGINAL), lookup1.lookupModes());
 
         Lookup lookup2 = lookup1.in(c2);
-        assertTrue(lookup2.lookupClass() == c2);                    // [A0]
-        assertTrue(lookup2.previousLookupClass() == c1);            // [A1]
-        assertTrue(lookup2.lookupModes() == 0, lookup2.toString()); // [A2]
+        assertSame(c2, lookup2.lookupClass());                    // [A0]
+        assertSame(c1, lookup2.previousLookupClass());            // [A1]
+        assertEquals(0, lookup2.lookupModes(), lookup2.toString()); // [A2]
     }
 
-    @DataProvider(name = "privLookupIn")
-    public Object[][] privLookupIn() throws Exception {
+    public static Object[][] privLookupIn() throws Exception {
         return new Object[][] {
             { m3.lookup,  m4.type1 },
             { m3.lookup,  m5.type1 },
@@ -316,24 +313,22 @@ public class ModuleAccessTest {
      * [A2] the lookup class becomes previous lookup class
      * [A3] IAE thrown if lookup has no MODULE access
      */
-    @Test(dataProvider = "privLookupIn")
+    @ParameterizedTest
+    @MethodSource("privLookupIn")
     public void testPrivateLookupIn(Lookup lookup, Class targetClass) throws Exception {
         Module m0 = lookup.lookupClass().getModule();
         Module m1 = targetClass.getModule();
 
         // privateLookupIn from m0 to m1
-        assertTrue(m0 != m1);
+        assertNotSame(m1, m0);
         assertTrue(m1.isOpen(targetClass.getPackageName(), m0));
         Lookup privLookup1 = MethodHandles.privateLookupIn(targetClass, lookup);
-        assertTrue(privLookup1.lookupModes() == (PROTECTED|PRIVATE|PACKAGE|PUBLIC));  // [A0]
-        assertTrue(privLookup1.lookupClass() == targetClass);                    // [A1]
-        assertTrue(privLookup1.previousLookupClass() == lookup.lookupClass());   // [A2]
+        assertEquals(PROTECTED | PRIVATE | PACKAGE | PUBLIC, privLookup1.lookupModes());  // [A0]
+        assertSame(targetClass, privLookup1.lookupClass());                    // [A1]
+        assertSame(lookup.lookupClass(), privLookup1.previousLookupClass());   // [A2]
 
         // privLookup1 has no MODULE access; can't do privateLookupIn
-        try {
-            Lookup privLookup2 = MethodHandles.privateLookupIn(targetClass, privLookup1); // [A3]
-            assertFalse(privLookup2 != null);
-        } catch (IllegalAccessException e) {}
+        assertThrows(IllegalAccessException.class, () -> MethodHandles.privateLookupIn(targetClass, privLookup1)); // [A3]
     }
 
     /**
@@ -343,9 +338,9 @@ public class ModuleAccessTest {
     public void testPrivateLookupAccess() throws Exception {
         Class staticsClass = e1.Statics.class;
         Lookup privLookup1 = MethodHandles.privateLookupIn(staticsClass, m4.lookup);
-        assertTrue((privLookup1.lookupModes() & MODULE) == 0);
-        assertTrue(privLookup1.lookupClass() == staticsClass);
-        assertTrue(privLookup1.previousLookupClass() == m4.lookup.lookupClass());
+        assertEquals(0, (privLookup1.lookupModes() & MODULE));
+        assertSame(staticsClass, privLookup1.lookupClass());
+        assertSame(m4.lookup.lookupClass(), privLookup1.previousLookupClass());
 
         // access private member and default package member in m5
         MethodType mtype = MethodType.methodType(void.class);
@@ -365,12 +360,9 @@ public class ModuleAccessTest {
         // lose private access
         Lookup privLookup2 = MethodHandles.privateLookupIn(m5.type1, m4.lookup);
         Lookup lookup = privLookup2.in(staticsClass);
-        assertTrue((lookup.lookupModes() & PRIVATE) == 0);
+        assertEquals(0, lookup.lookupModes() & PRIVATE);
         MethodHandle mh3 = lookup.findStatic(staticsClass, "packageMethod", mtype);
-        try {
-            lookup.findStatic(staticsClass, "privateMethod", mtype);
-            assertTrue(false);
-        } catch (IllegalAccessException e) {}
+        assertThrows(IllegalAccessException.class, () -> lookup.findStatic(staticsClass, "privateMethod", mtype));
     }
 
     /**
@@ -380,16 +372,16 @@ public class ModuleAccessTest {
     @Test
     public void testDropLookupMode() throws Exception {
         Lookup lookup = MethodHandles.privateLookupIn(m5.type1, m4.lookup);
-        assertTrue((lookup.lookupModes() & MODULE) == 0);
+        assertEquals(0, lookup.lookupModes() & MODULE);
 
         Lookup lookup1 = lookup.dropLookupMode(PRIVATE);
-        assertTrue(lookup1.lookupModes() == (lookup.lookupModes() & ~(PROTECTED|PRIVATE)));
+        assertEquals(lookup1.lookupModes(), lookup.lookupModes() & ~(PROTECTED | PRIVATE));
         Lookup lookup2 = lookup.dropLookupMode(PACKAGE);
-        assertTrue(lookup2.lookupModes() == (lookup.lookupModes() & ~(PROTECTED|PRIVATE|PACKAGE)));
+        assertEquals(lookup2.lookupModes(), lookup.lookupModes() & ~(PROTECTED | PRIVATE | PACKAGE));
         Lookup lookup3 = lookup.dropLookupMode(MODULE);
-        assertTrue(lookup3.lookupModes() == (lookup.lookupModes() & ~(PROTECTED|PRIVATE|PACKAGE)));
+        assertEquals(lookup3.lookupModes(), lookup.lookupModes() & ~(PROTECTED | PRIVATE | PACKAGE));
         Lookup lookup4 = lookup.dropLookupMode(PUBLIC);
-        assertTrue(lookup4.lookupModes() == 0);
+        assertEquals(0, lookup4.lookupModes());
 
     }
 
@@ -406,11 +398,8 @@ public class ModuleAccessTest {
 
         // drop MODULE access i.e. only PUBLIC access
         Lookup lookup = privLookup.dropLookupMode(MODULE);
-        assertTrue(lookup.lookupModes() == PUBLIC);
-        try {
-            MethodHandle mh2 = lookup.findStatic(nonPUblicType, "publicStatic", mtype);
-            assertFalse(mh2 != null);
-        } catch (IllegalAccessException e) {}
+        assertEquals(PUBLIC, lookup.lookupModes());
+        assertThrows(IllegalAccessException.class, () -> lookup.findStatic(nonPUblicType, "publicStatic", mtype));
     }
 
     @Test
@@ -421,21 +410,18 @@ public class ModuleAccessTest {
         Lookup pub3 = pub2.in(java.lang.management.ThreadMXBean.class);
         Lookup pub4 = pub3.dropLookupMode(UNCONDITIONAL);
 
-        assertTrue(publicLookup.lookupClass() == Object.class);
-        assertTrue(publicLookup.lookupModes() == UNCONDITIONAL);
-        assertTrue(pub1.lookupClass() == m3.type1);
-        assertTrue(pub1.lookupModes() == UNCONDITIONAL);
-        assertTrue(pub2.lookupClass() == String.class);
-        assertTrue(pub2.lookupModes() == UNCONDITIONAL);
-        assertTrue(pub3.lookupClass() == java.lang.management.ThreadMXBean.class);
-        assertTrue(pub3.lookupModes() == UNCONDITIONAL);
-        assertTrue(pub4.lookupModes() == 0);
+        assertSame(Object.class, publicLookup.lookupClass());
+        assertEquals(UNCONDITIONAL, publicLookup.lookupModes());
+        assertSame(m3.type1, pub1.lookupClass());
+        assertEquals(UNCONDITIONAL, pub1.lookupModes());
+        assertSame(String.class, pub2.lookupClass());
+        assertEquals(UNCONDITIONAL, pub2.lookupModes());
+        assertSame(ThreadMXBean.class, pub3.lookupClass());
+        assertEquals(UNCONDITIONAL, pub3.lookupModes());
+        assertEquals(0, pub4.lookupModes());
 
         // publicLookup has no MODULE access; can't do privateLookupIn
-        try {
-            Lookup pub5 = MethodHandles.privateLookupIn(m4.type1, pub1);
-            assertFalse(pub5 != null);
-        } catch (IllegalAccessException e) {}
+        assertThrows(IllegalAccessException.class, () -> MethodHandles.privateLookupIn(m4.type1, pub1));
     }
 
     static class ModuleLookup {
@@ -548,10 +534,7 @@ public class ModuleAccessTest {
                                             Class clazz,
                                             Class rtype,
                                             Class... ptypes) throws Exception {
-        try {
-            MethodHandle mh = findConstructor(lookup, clazz, rtype, ptypes);
-            assertTrue(false);
-        } catch (IllegalAccessException expected) { }
+        assertThrows(IllegalAccessException.class, () -> findConstructor(lookup, clazz, rtype, ptypes));
     }
 
     /**
diff --git a/test/jdk/java/lang/invoke/modules/m3/module-info.java b/test/jdk/java/lang/invoke/modules/m3/module-info.java
index 1f47c42c196..c9d8fab20a5 100644
--- a/test/jdk/java/lang/invoke/modules/m3/module-info.java
+++ b/test/jdk/java/lang/invoke/modules/m3/module-info.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
 module m3 {
     requires m4;
     requires m5;
-    requires org.testng;
+    requires org.junit.platform.console.standalone;
     requires java.management;
     exports c1;
     opens c2 to m5;
diff --git a/test/jdk/java/lang/runtime/SwitchBootstrapsTest.java b/test/jdk/java/lang/runtime/SwitchBootstrapsTest.java
index 8c6132b2815..3a8608866dc 100644
--- a/test/jdk/java/lang/runtime/SwitchBootstrapsTest.java
+++ b/test/jdk/java/lang/runtime/SwitchBootstrapsTest.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
@@ -447,4 +447,31 @@ public class SwitchBootstrapsTest {
                                });
                     });
     }
+
+    public void testNullLookup() throws Throwable {
+        try {
+            MethodType switchType = MethodType.methodType(int.class, Object.class, int.class);
+            BSM_TYPE_SWITCH.invoke(null, "", switchType, Object.class);
+            fail("Didn't get the expected exception.");
+        } catch (NullPointerException ex) {
+            //OK
+        }
+        enum E {}
+        try {
+            MethodType switchType = MethodType.methodType(int.class, E.class, int.class);
+            BSM_ENUM_SWITCH.invoke(null, "", switchType,
+                                   new Object[] {});
+            fail("Didn't get the expected exception.");
+        } catch (NullPointerException ex) {
+            //OK
+        }
+        try {
+            MethodType switchType = MethodType.methodType(int.class, E.class, int.class);
+            BSM_ENUM_SWITCH.invoke(null, "", switchType,
+                                   new Object[] {"A"});
+            fail("Didn't get the expected exception.");
+        } catch (NullPointerException ex) {
+            //OK
+        }
+    }
 }
diff --git a/test/jdk/java/net/httpclient/http3/H3FixedThreadPoolTest.java b/test/jdk/java/net/httpclient/http3/H3FixedThreadPoolTest.java
index c513cd092c7..6c181186fda 100644
--- a/test/jdk/java/net/httpclient/http3/H3FixedThreadPoolTest.java
+++ b/test/jdk/java/net/httpclient/http3/H3FixedThreadPoolTest.java
@@ -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
@@ -30,9 +30,17 @@
  *        jdk.test.lib.Utils
  *        jdk.test.lib.net.SimpleSSLContext
  * @compile ../ReferenceTracker.java
+ *
+ * @comment This test failed on Tier 7, but the failure could not be reproduced.
+ *          The QUIC idle timeout has been increased to a value higher than the
+ *          JTreg on Tier 7 so that, if the client becomes wedged again, the
+ *          JTreg timeout handlers can collect more diagnostic information.
+ *
  * @run testng/othervm  -Djdk.internal.httpclient.debug=err
  *                      -Djdk.httpclient.HttpClient.log=ssl,headers,requests,responses,errors
- *                       H3FixedThreadPoolTest
+ *                      -Djdk.httpclient.quic.idleTimeout=666666
+ *                      -Djdk.test.server.quic.idleTimeout=666666
+ *                      ${test.main.class}
  */
 
 import java.net.URI;
diff --git a/test/jdk/java/nio/file/DirectoryStream/SecureDS.java b/test/jdk/java/nio/file/DirectoryStream/SecureDS.java
index d5d4b1904ea..21204ba980a 100644
--- a/test/jdk/java/nio/file/DirectoryStream/SecureDS.java
+++ b/test/jdk/java/nio/file/DirectoryStream/SecureDS.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
@@ -292,6 +292,27 @@ public class SecureDS {
             }
         }
 
+        // Test: move to cwd
+        final String TEXT = "Sous le pont Mirabeau coule la Seine";
+        Path file = Path.of("file");
+        Path filepath = dir.resolve(file);
+        Path cwd = Path.of(System.getProperty("user.dir"));
+        Path result = cwd.resolve(file);
+        Files.writeString(filepath, TEXT);
+        try (DirectoryStream ds = Files.newDirectoryStream(dir);) {
+            if (ds instanceof SecureDirectoryStream sds) {
+                sds.move(file, null, file);
+                if (!TEXT.equals(Files.readString(result)))
+                    throw new RuntimeException(result + " content incorrect");
+            } else {
+                throw new RuntimeException("Not a SecureDirectoryStream");
+            }
+        } finally {
+            boolean fileDeleted = Files.deleteIfExists(filepath);
+            if (!fileDeleted)
+                Files.deleteIfExists(result);
+        }
+
         // clean-up
         delete(dir1);
         delete(dir2);
@@ -334,10 +355,6 @@ public class SecureDS {
             stream.move(null, stream, file);
             shouldNotGetHere();
         } catch (NullPointerException x) { }
-        try {
-            stream.move(file, null, file);
-            shouldNotGetHere();
-        } catch (NullPointerException x) { }
         try {
             stream.move(file, stream, null);
             shouldNotGetHere();
diff --git a/test/jdk/java/util/concurrent/CopyOnWriteArraySet/SerializationTest.java b/test/jdk/java/util/concurrent/CopyOnWriteArraySet/SerializationTest.java
new file mode 100644
index 00000000000..7700eda6cd6
--- /dev/null
+++ b/test/jdk/java/util/concurrent/CopyOnWriteArraySet/SerializationTest.java
@@ -0,0 +1,84 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8365058
+ * @summary Check basic correctness of de-serialization
+ * @run junit SerializationTest
+ */
+
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArraySet;
+import java.util.stream.Stream;
+
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class SerializationTest {
+
+    // Ensure basic serialization round trip correctness
+    @ParameterizedTest
+    @MethodSource
+    void roundTripTest(CopyOnWriteArraySet expected) {
+        var bytes = ser(expected);
+        var actual = deSer(bytes);
+        assertEquals(CopyOnWriteArraySet.class, actual.getClass());
+        assertEquals(expected, actual);
+    }
+
+    private static Stream> roundTripTest() {
+        return Stream.of(
+                new CopyOnWriteArraySet<>(),
+                new CopyOnWriteArraySet<>(List.of(1, 2, 3)),
+                new CopyOnWriteArraySet<>(Set.of("Foo", "Bar", "Baz"))
+        );
+    }
+
+    private static byte[] ser(Object obj) {
+        return assertDoesNotThrow(() -> {
+            try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+                 ObjectOutputStream oos = new ObjectOutputStream(byteArrayOutputStream)) {
+                oos.writeObject(obj);
+                return byteArrayOutputStream.toByteArray();
+            }
+        }, "Unexpected error during serialization");
+    }
+
+    private static Object deSer(byte[] bytes) {
+        return assertDoesNotThrow(() -> {
+            try (ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
+                 ObjectInputStream ois = new ObjectInputStream(byteArrayInputStream)) {
+                return ois.readObject();
+            }
+        }, "Unexpected error during de-serialization");
+    }
+}
diff --git a/test/jdk/javax/accessibility/JSpinner/CustomSpinnerAccessibilityTest.java b/test/jdk/javax/accessibility/JSpinner/CustomSpinnerAccessibilityTest.java
new file mode 100644
index 00000000000..12c98c95110
--- /dev/null
+++ b/test/jdk/javax/accessibility/JSpinner/CustomSpinnerAccessibilityTest.java
@@ -0,0 +1,86 @@
+/*
+ * 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.awt.GridLayout;
+import java.lang.reflect.InvocationTargetException;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JSpinner;
+import javax.swing.SpinnerListModel;
+
+/*
+ * @test
+ * @bug 8286258
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @requires (os.family == "mac")
+ * @summary Checks that JSpinner with custom model announces
+ *          the value every time it is changed
+ * @run main/manual CustomSpinnerAccessibilityTest
+ */
+
+public class CustomSpinnerAccessibilityTest extends JPanel {
+    private static final String INSTRUCTIONS = """
+            1. Turn on VoiceOver
+            2. In the window named "Test UI" click on the text editor inside the
+               spinner component
+            3. Using up and down arrows change current month
+            4. Wait for the VoiceOver to finish speaking
+            5. Repeat steps 3 and 4 couple more times
+
+            If every time value of the spinner is changed VoiceOver
+            announces the new value click "Pass".
+            If instead the value is narrated only partially
+            and the new value is never fully narrated press "Fail".
+            """;
+
+    public CustomSpinnerAccessibilityTest() {
+        super(new GridLayout(0, 2));
+        String[] monthStrings = new java.text.DateFormatSymbols().getMonths();
+        int lastIndex = monthStrings.length - 1;
+        if (monthStrings[lastIndex] == null
+                || monthStrings[lastIndex].length() <= 0) {
+            String[] tmp = new String[lastIndex];
+            System.arraycopy(monthStrings, 0,
+                    tmp, 0, lastIndex);
+            monthStrings = tmp;
+        }
+
+        SpinnerListModel model = new SpinnerListModel(monthStrings);
+        JLabel label = new JLabel("Month: ");
+        add(label);
+        JSpinner spinner = new JSpinner(model);
+        label.setLabelFor(spinner);
+        add(spinner);
+    }
+
+    public static void main(String[] args) throws InterruptedException,
+            InvocationTargetException {
+        PassFailJFrame.builder()
+                .title("Custom Spinner Accessibility Test")
+                .instructions(INSTRUCTIONS)
+                .testUI(CustomSpinnerAccessibilityTest::new)
+                .build()
+                .awaitAndCheck();
+    }
+}
diff --git a/test/jdk/javax/crypto/Cipher/TestDisabledWithOids.java b/test/jdk/javax/crypto/Cipher/TestDisabledWithOids.java
new file mode 100644
index 00000000000..d1d9fa7a5bb
--- /dev/null
+++ b/test/jdk/javax/crypto/Cipher/TestDisabledWithOids.java
@@ -0,0 +1,47 @@
+/*
+ * 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 8375549
+ * @summary Test JCE layer algorithm restriction using algorithms w/ oids
+ * @library /test/lib
+ * @run main/othervm -Djdk.crypto.disabledAlgorithms=Cipher.DES,Cipher.RSA/ECB/PKCS1Padding TestDisabledWithOids
+ * @run main/othervm -Djdk.crypto.disabledAlgorithms=Cipher.RSA/ECB/PKCS1Padding,Cipher.DES TestDisabledWithOids
+ */
+import java.security.NoSuchAlgorithmException;
+import javax.crypto.Cipher;
+import jdk.test.lib.Utils;
+
+public class TestDisabledWithOids {
+    public static void main(String[] args) throws Exception {
+        String algo1 = "RSA/ECB/PKCS1Padding";
+        String algo2 = "DES";
+
+        Utils.runAndCheckException(() -> Cipher.getInstance(algo1),
+                            NoSuchAlgorithmException.class);
+        Utils.runAndCheckException(() -> Cipher.getInstance(algo2),
+                            NoSuchAlgorithmException.class);
+        System.out.println("Done");
+    }
+}
diff --git a/test/jdk/javax/management/security/SecurityTest.java b/test/jdk/javax/management/security/SecurityTest.java
index 7212aea883f..b46bbfa759f 100644
--- a/test/jdk/javax/management/security/SecurityTest.java
+++ b/test/jdk/javax/management/security/SecurityTest.java
@@ -402,6 +402,8 @@ public class SecurityTest {
         opts.add(JDKToolFinder.getJDKTool("java"));
         opts.addAll(Arrays.asList(jdk.test.lib.Utils.getTestJavaOpts()));
 
+        opts.add("-Djdk.rmi.ssl.client.enableEndpointIdentification=false");
+
         // We need to forward some properties to the client side
         opts.add("-Dtest.src=" + System.getProperty("test.src"));
 
diff --git a/test/jdk/javax/net/ssl/SSLParameters/NamedGroups.java b/test/jdk/javax/net/ssl/SSLParameters/NamedGroups.java
index 25f73606b96..786b907b79a 100644
--- a/test/jdk/javax/net/ssl/SSLParameters/NamedGroups.java
+++ b/test/jdk/javax/net/ssl/SSLParameters/NamedGroups.java
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
  * Copyright (C) 2022, Tencent. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -26,7 +27,7 @@
 
 /*
  * @test
- * @bug 8281236
+ * @bug 8281236 8314323
  * @summary Check TLS connection behaviors for named groups configuration
  * @library /javax/net/ssl/templates
  * @run main/othervm NamedGroups
@@ -136,6 +137,60 @@ public class NamedGroups extends SSLSocketTemplate {
                         "secp256r1"
                 },
                 true);
+
+        runTest(new String[] {
+                        "X25519MLKEM768"
+                },
+                new String[] {
+                        "X25519MLKEM768"
+                },
+                false);
+
+        runTest(new String[] {
+                        "SecP256r1MLKEM768"
+                },
+                new String[] {
+                        "SecP256r1MLKEM768"
+                },
+                false);
+
+        runTest(new String[] {
+                        "SecP384r1MLKEM1024"
+                },
+                new String[] {
+                        "SecP384r1MLKEM1024"
+                },
+                false);
+
+        runTest(new String[] {
+                        "X25519MLKEM768"
+                },
+                new String[] {
+                        "SecP256r1MLKEM768"
+                },
+                true);
+
+        runTest(new String[] {
+                        "X25519MLKEM768"
+                },
+                new String[0],
+                true);
+
+        runTest(new String[] {
+                        "SecP256r1MLKEM768"
+                },
+                null,
+                true);
+
+        runTest(new String[] {
+                        "X25519MLKEM768",
+                        "x25519"
+                },
+                new String[] {
+                        "X25519MLKEM768",
+                        "x25519"
+                },
+                false);
     }
 
     private static void runTest(String[] serverNamedGroups,
diff --git a/test/jdk/javax/net/ssl/TLSCommon/NamedGroup.java b/test/jdk/javax/net/ssl/TLSCommon/NamedGroup.java
index ec89fe0d5b5..432a2bd1b0d 100644
--- a/test/jdk/javax/net/ssl/TLSCommon/NamedGroup.java
+++ b/test/jdk/javax/net/ssl/TLSCommon/NamedGroup.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,11 @@ public enum NamedGroup {
     FFDHE3072("ffdhe3072"),
     FFDHE4096("ffdhe4096"),
     FFDHE6144("ffdhe6144"),
-    FFDHE8192("ffdhe8192");
+    FFDHE8192("ffdhe8192"),
+
+    X25519MLKEM768("X25519MLKEM768"),
+    SECP256R1MLKEM768("SecP256r1MLKEM768"),
+    SECP384R1MLKEM1024("SecP384r1MLKEM1024");
 
     public final String name;
 
diff --git a/test/jdk/javax/net/ssl/TLSv13/ClientHelloKeyShares.java b/test/jdk/javax/net/ssl/TLSv13/ClientHelloKeyShares.java
index efb9895b33c..ed26cf90a8c 100644
--- a/test/jdk/javax/net/ssl/TLSv13/ClientHelloKeyShares.java
+++ b/test/jdk/javax/net/ssl/TLSv13/ClientHelloKeyShares.java
@@ -26,16 +26,21 @@
 
 /*
  * @test
- * @bug 8247630
+ * @bug 8247630 8314323
  * @summary Use two key share entries
- * @run main/othervm ClientHelloKeyShares 29 23
+ * @run main/othervm ClientHelloKeyShares 4588 29
  * @run main/othervm -Djdk.tls.namedGroups=secp384r1,secp521r1,x448,ffdhe2048 ClientHelloKeyShares 24 30
  * @run main/othervm -Djdk.tls.namedGroups=sect163k1,sect163r1,x25519 ClientHelloKeyShares 29
  * @run main/othervm -Djdk.tls.namedGroups=sect163k1,sect163r1,secp256r1 ClientHelloKeyShares 23
  * @run main/othervm -Djdk.tls.namedGroups=sect163k1,sect163r1,ffdhe2048,ffdhe3072,ffdhe4096 ClientHelloKeyShares 256
  * @run main/othervm -Djdk.tls.namedGroups=sect163k1,ffdhe2048,x25519,secp256r1 ClientHelloKeyShares 256 29
  * @run main/othervm -Djdk.tls.namedGroups=secp256r1,secp384r1,ffdhe2048,x25519 ClientHelloKeyShares 23 256
- */
+ * @run main/othervm -Djdk.tls.namedGroups=X25519MLKEM768 ClientHelloKeyShares 4588
+ * @run main/othervm -Djdk.tls.namedGroups=x25519,X25519MLKEM768 ClientHelloKeyShares 29 4588
+ * @run main/othervm -Djdk.tls.namedGroups=SecP256r1MLKEM768,x25519 ClientHelloKeyShares 4587 29
+ * @run main/othervm -Djdk.tls.namedGroups=SecP384r1MLKEM1024,secp256r1 ClientHelloKeyShares 4589 23
+ * @run main/othervm -Djdk.tls.namedGroups=X25519MLKEM768,SecP256r1MLKEM768,X25519,secp256r1 ClientHelloKeyShares 4588 29
+*/
 
 import javax.net.ssl.*;
 import javax.net.ssl.SSLEngineResult.*;
@@ -62,10 +67,6 @@ public class ClientHelloKeyShares {
     private static final int HELLO_EXT_SUPP_VERS = 43;
     private static final int HELLO_EXT_KEY_SHARE = 51;
     private static final int TLS_PROT_VER_13 = 0x0304;
-    private static final int NG_SECP256R1 = 0x0017;
-    private static final int NG_SECP384R1 = 0x0018;
-    private static final int NG_X25519 = 0x001D;
-    private static final int NG_X448 = 0x001E;
 
     public static void main(String args[]) throws Exception {
         if (debug) {
diff --git a/test/jdk/javax/net/ssl/TLSv13/HRRKeyShares.java b/test/jdk/javax/net/ssl/TLSv13/HRRKeyShares.java
index 560faf87049..bd14e465e65 100644
--- a/test/jdk/javax/net/ssl/TLSv13/HRRKeyShares.java
+++ b/test/jdk/javax/net/ssl/TLSv13/HRRKeyShares.java
@@ -26,10 +26,12 @@
 
 /*
  * @test
- * @bug 8247630
+ * @bug 8247630 8314323
  * @summary Use two key share entries
  * @library /test/lib
- * @run main/othervm -Djdk.tls.namedGroups=x25519,secp256r1,secp384r1 HRRKeyShares
+ * @run main/othervm
+ *     -Djdk.tls.namedGroups=x25519,secp256r1,secp384r1,X25519MLKEM768,SecP256r1MLKEM768,SecP384r1MLKEM1024
+ *     HRRKeyShares
  */
 
 import java.io.ByteArrayOutputStream;
@@ -72,6 +74,10 @@ public class HRRKeyShares {
     private static final int NG_SECP384R1 = 0x0018;
     private static final int NG_X25519 = 0x001D;
     private static final int NG_X448 = 0x001E;
+    private static final int NG_X25519_MLKEM768 = 0x11EC;
+    private static final int NG_SECP256R1_MLKEM768 = 0x11EB;
+    private static final int NG_SECP384R1_MLKEM1024 = 0x11ED;
+
     private static final int NG_GC512A = 0x0026;
     private static final int COMP_NONE = 0;
     private static final int ALERT_TYPE_FATAL = 2;
@@ -238,6 +244,18 @@ public class HRRKeyShares {
         System.out.println("Test 4: Bad HRR using known / unasserted x448");
         hrrKeyShareTest(NG_X448, false);
         System.out.println();
+
+        System.out.println("Test 5: Good HRR exchange using X25519MLKEM768");
+        hrrKeyShareTest(NG_X25519_MLKEM768, true);
+        System.out.println();
+
+        System.out.println("Test 6: Good HRR exchange using SecP256r1MLKEM768");
+        hrrKeyShareTest(NG_SECP256R1_MLKEM768, true);
+        System.out.println();
+
+        System.out.println("Test 7: Good HRR exchange using SecP384r1MLKEM1024");
+        hrrKeyShareTest(NG_SECP384R1_MLKEM1024, true);
+        System.out.println();
     }
 
     private static void logResult(String str, SSLEngineResult result) {
@@ -348,7 +366,8 @@ public class HRRKeyShares {
 
         try {
             // Now we're expecting to reissue the ClientHello, this time
-            // with a secp384r1 share.
+            // with a key share for the HRR requested named
+            // group (hrrNamedGroup).
             cTOs.compact();
             clientResult = engine.wrap(clientOut, cTOs);
             logResult("client wrap: ", clientResult);
diff --git a/test/jdk/javax/print/PrintServiceLookup/FlushCustomClassLoader.java b/test/jdk/javax/print/PrintServiceLookup/FlushCustomClassLoader.java
index c16fe0e5a82..8125b656de4 100644
--- a/test/jdk/javax/print/PrintServiceLookup/FlushCustomClassLoader.java
+++ b/test/jdk/javax/print/PrintServiceLookup/FlushCustomClassLoader.java
@@ -56,17 +56,6 @@ public final class FlushCustomClassLoader {
     }
 
     private static Reference getLoader(String m) throws Exception {
-        /*
-         * The print services are stored per the AppContext, and each AppContext
-         * caches the "current" class loader during creation.
-         * see javax.print.PrintServiceLookup.
-         *
-         * To prevent AppContext from cache our test loader we force AppContext
-         * creation early by the invokeAndWait.
-         * The "EventQueue.invokeAndWait(() -> {});" can be removed when the
-         * AppContext usage will be deleted in the PrintServiceLookup
-         */
-        EventQueue.invokeAndWait(() -> {});
 
         URL url = FlushCustomClassLoader.class.getProtectionDomain()
                                               .getCodeSource().getLocation();
diff --git a/test/jdk/javax/print/PrintablePrintDPI.java b/test/jdk/javax/print/PrintablePrintDPI.java
index 6cae2be532c..6b5e83df233 100644
--- a/test/jdk/javax/print/PrintablePrintDPI.java
+++ b/test/jdk/javax/print/PrintablePrintDPI.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.
  * Copyright (c) 2025, BELLSOFT. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -54,7 +54,7 @@ import java.awt.print.PrinterJob;
 
 /*
  * @test
- * @bug 8251928
+ * @bug 8251928 8375221
  * @key printer
  * @summary Printable.print method should reflect printer's DPI
  * @library /java/awt/regtesthelpers
@@ -201,7 +201,9 @@ public class PrintablePrintDPI implements Printable {
             attributeSet.add(OrientationRequested.PORTRAIT);
             job.setPrintService(printService);
             job.setPrintable(this);
-            job.print(attributeSet);
+            if (job.printDialog(attributeSet)) {
+                job.print(attributeSet);
+            }
         } catch (PrinterException ex) {
             throw new RuntimeException(ex);
         }
diff --git a/test/jdk/javax/rmi/ssl/SSLSocketParametersTest.java b/test/jdk/javax/rmi/ssl/SSLSocketParametersTest.java
index 3aa7a98c394..7616b112e39 100644
--- a/test/jdk/javax/rmi/ssl/SSLSocketParametersTest.java
+++ b/test/jdk/javax/rmi/ssl/SSLSocketParametersTest.java
@@ -137,6 +137,7 @@ public class SSLSocketParametersTest extends SSLContextTemplate {
     }
 
     public static void main(String[] args) throws Exception {
+        System.setProperty("jdk.rmi.ssl.client.enableEndpointIdentification", "false");
         SSLSocketParametersTest test = new SSLSocketParametersTest();
         test.runTest(Integer.parseInt(args[0]));
     }
diff --git a/test/jdk/javax/sound/sampled/Clip/AutoCloseTimeCheck.java b/test/jdk/javax/sound/sampled/Clip/AutoCloseTimeCheck.java
index f823175ede8..edacc50fa42 100644
--- a/test/jdk/javax/sound/sampled/Clip/AutoCloseTimeCheck.java
+++ b/test/jdk/javax/sound/sampled/Clip/AutoCloseTimeCheck.java
@@ -39,6 +39,7 @@ import static javax.sound.sampled.AudioSystem.NOT_SPECIFIED;
 
 /**
  * @test
+ * @key sound
  * @bug 8202264
  */
 public final class AutoCloseTimeCheck {
diff --git a/test/jdk/javax/swing/JOptionPane/TestJOptionHTMLTag.java b/test/jdk/javax/swing/JOptionPane/TestJOptionHTMLTag.java
deleted file mode 100644
index 94318492bd9..00000000000
--- a/test/jdk/javax/swing/JOptionPane/TestJOptionHTMLTag.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/* @test
- * @bug 5074006
- * @key headful
- * @library /java/awt/regtesthelpers
- * @build PassFailJFrame
- * @summary Swing JOptionPane shows  tag as a string after newline
- * @run main/manual TestJOptionHTMLTag
-*/
-
-import javax.swing.JDialog;
-import javax.swing.JOptionPane;
-import javax.swing.SwingUtilities;
-
-public class TestJOptionHTMLTag {
-    static String instructions
-            = """
-            INSTRUCTIONS:
-                A dialog will be shown.
-                If it does not contain  string, press Pass else press Fail.
-            """;
-    static PassFailJFrame passFailJFrame;
-
-    public static void main(String[] args) throws Exception {
-
-        SwingUtilities.invokeAndWait(() -> {
-            try {
-                String message = "" + "This is a test\n" + "";
-                JOptionPane optionPane = new JOptionPane();
-                optionPane.setMessage(message);
-                optionPane.setMessageType(JOptionPane.INFORMATION_MESSAGE);
-                JDialog dialog = new JDialog();
-                dialog.setContentPane(optionPane);
-                dialog.pack();
-                dialog.setVisible(true);
-
-                passFailJFrame = new PassFailJFrame(instructions);
-                PassFailJFrame.addTestWindow(dialog);
-                PassFailJFrame.positionTestWindow(dialog, PassFailJFrame.Position.HORIZONTAL);
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        });
-        passFailJFrame.awaitAndCheck();
-    }
-}
-
diff --git a/test/jdk/javax/swing/Security/6938813/bug6938813.java b/test/jdk/javax/swing/Security/6938813/bug6938813.java
deleted file mode 100644
index 8f5e3fc3505..00000000000
--- a/test/jdk/javax/swing/Security/6938813/bug6938813.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @key headful
- * @bug 6938813
- * @summary Swing mutable statics
- * @author Pavel Porvatov
- * @modules java.desktop/javax.swing.text.html.parser:open
- * @modules java.desktop/sun.awt
- */
-
-import sun.awt.AppContext;
-import sun.awt.SunToolkit;
-
-import javax.swing.text.html.HTMLEditorKit;
-import javax.swing.text.html.StyleSheet;
-import javax.swing.text.html.parser.DTD;
-import javax.swing.text.html.parser.ParserDelegator;
-import java.lang.reflect.Field;
-
-public class bug6938813 {
-    public static final String DTD_KEY = "dtd_key";
-
-    private static volatile StyleSheet styleSheet;
-
-    public static void main(String[] args) throws Exception {
-        // Run validation and init values for this AppContext
-        validate();
-
-        Thread thread = new ThreadInAnotherAppContext();
-
-        thread.start();
-        thread.join();
-    }
-
-    private static void validate() throws Exception {
-        AppContext appContext = AppContext.getAppContext();
-
-        assertTrue(DTD.getDTD(DTD_KEY).getName().equals(DTD_KEY), "DTD.getDTD() mixed AppContexts");
-
-        // Spoil hash value
-        DTD invalidDtd = DTD.getDTD("invalid DTD");
-
-        DTD.putDTDHash(DTD_KEY, invalidDtd);
-
-        assertTrue(DTD.getDTD(DTD_KEY) == invalidDtd, "Something wrong with DTD.getDTD()");
-
-        Object dtdKey = getParserDelegator_DTD_KEY();
-
-        assertTrue(appContext.get(dtdKey) == null, "ParserDelegator mixed AppContexts");
-
-        // Init default DTD
-        new ParserDelegator();
-
-        Object dtdValue = appContext.get(dtdKey);
-
-        assertTrue(dtdValue != null, "ParserDelegator.defaultDTD isn't initialized");
-
-        // Try reinit default DTD
-        new ParserDelegator();
-
-        assertTrue(dtdValue == appContext.get(dtdKey), "ParserDelegator.defaultDTD created a duplicate");
-
-        HTMLEditorKit htmlEditorKit = new HTMLEditorKit();
-
-        if (styleSheet == null) {
-            // First AppContext
-            styleSheet = htmlEditorKit.getStyleSheet();
-
-            assertTrue(styleSheet != null, "htmlEditorKit.getStyleSheet() returns null");
-            assertTrue(htmlEditorKit.getStyleSheet() == styleSheet, "Something wrong with htmlEditorKit.getStyleSheet()");
-        } else {
-            assertTrue(htmlEditorKit.getStyleSheet() != styleSheet, "HtmlEditorKit.getStyleSheet() mixed AppContexts");
-        }
-    }
-
-    private static void assertTrue(boolean b, String msg) {
-        if (!b) {
-            throw new RuntimeException("Test failed: " + msg);
-        }
-    }
-
-    private static Object getParserDelegator_DTD_KEY() throws Exception {
-        Field field = ParserDelegator.class.getDeclaredField("DTD_KEY");
-
-        field.setAccessible(true);
-
-        return field.get(null);
-    }
-
-    private static class ThreadInAnotherAppContext extends Thread {
-        public ThreadInAnotherAppContext() {
-            super(new ThreadGroup("6938813"), "ThreadInAnotherAppContext");
-        }
-
-        public void run() {
-            SunToolkit.createNewAppContext();
-
-            try {
-                validate();
-            } catch (Exception e) {
-                throw new RuntimeException(e);
-            }
-        }
-    }
-}
diff --git a/test/jdk/javax/swing/text/LayoutQueue/Test6588003.java b/test/jdk/javax/swing/text/LayoutQueue/Test6588003.java
deleted file mode 100644
index 561ac594a47..00000000000
--- a/test/jdk/javax/swing/text/LayoutQueue/Test6588003.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* @test
-   @bug 6588003
-   @summary LayoutQueue should not share its DefaultQueue across AppContexts
-   @author Peter Zhelezniakov
-   @modules java.desktop/sun.awt
-   @run main Test6588003
-*/
-
-import javax.swing.text.LayoutQueue;
-import sun.awt.SunToolkit;
-
-public class Test6588003 implements Runnable {
-    private static final LayoutQueue DEFAULT = new LayoutQueue();
-
-    public static void main(String[] args) throws InterruptedException {
-        LayoutQueue.setDefaultQueue(DEFAULT);
-
-        ThreadGroup group = new ThreadGroup("Test6588003");
-        Thread thread = new Thread(group, new Test6588003());
-        thread.start();
-        thread.join();
-
-        if (LayoutQueue.getDefaultQueue() != DEFAULT) {
-            throw new RuntimeException("Sharing detected");
-        }
-    }
-
-    public void run() {
-        SunToolkit.createNewAppContext();
-
-        if (LayoutQueue.getDefaultQueue() == DEFAULT) {
-            throw new RuntimeException("Sharing detected");
-        }
-
-        LayoutQueue.setDefaultQueue(new LayoutQueue());
-    }
-}
diff --git a/test/jdk/javax/swing/text/html/parser/Test8017492.java b/test/jdk/javax/swing/text/html/parser/Test8017492.java
deleted file mode 100644
index dbc1e125cf7..00000000000
--- a/test/jdk/javax/swing/text/html/parser/Test8017492.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.util.Vector;
-import javax.swing.text.html.HTML;
-import javax.swing.text.html.HTMLDocument;
-import javax.swing.text.html.HTMLEditorKit;
-import javax.swing.text.html.parser.DTD;
-import javax.swing.text.html.parser.Element;
-import sun.awt.SunToolkit;
-
-/*
- * @test
- * @bug 8017492
- * @modules java.desktop/sun.awt
- * @run main/othervm Test8017492
- * @summary Tests for OutOfMemoryError/NegativeArraySizeException
- * @author Sergey Malenkov
- */
-
-public class Test8017492 {
-    public static void main(String[] args) throws Exception {
-        Runnable task = new Runnable() {
-            @Override
-            public void run() {
-                try {
-                    SunToolkit.createNewAppContext();
-                    DTD dtd = DTD.getDTD("dtd");
-                    dtd.elements = new Vector() {
-                        @Override
-                        public synchronized int size() {
-                            return Integer.MAX_VALUE;
-                        }
-                    };
-                    dtd.getElement("element");
-                }
-                catch (Exception exception) {
-                    throw new Error("unexpected", exception);
-                }
-            }
-        };
-        // run task with different AppContext
-        Thread thread = new Thread(new ThreadGroup("$$$"), task);
-        thread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
-            @Override
-            public void uncaughtException(Thread thread, Throwable throwable) {
-                throwable.printStackTrace();
-                throw new RuntimeException(throwable);
-            }
-        });
-        thread.start();
-        thread.join();
-        // add error handling
-        SunToolkit.createNewAppContext();
-        HTMLDocument document = new HTMLDocument() {
-            @Override
-            public HTMLEditorKit.ParserCallback getReader(int pos) {
-                return getReader(pos, 0, 0, null);
-            }
-
-            @Override
-            public HTMLEditorKit.ParserCallback getReader(int pos, int popDepth, int pushDepth, HTML.Tag insertTag) {
-                return new HTMLDocument.HTMLReader(pos, popDepth, pushDepth, insertTag) {
-                    @Override
-                    public void handleError(String error, int pos) {
-                        throw new Error(error);
-                    }
-                };
-            }
-        };
-        // run parser
-        new HTMLEditorKit().insertHTML(document, 0, "text", 0, 0, null);
-    }
-}
diff --git a/test/jdk/jdk/internal/platform/docker/TestDockerMemoryMetricsSubgroup.java b/test/jdk/jdk/internal/platform/docker/TestDockerMemoryMetricsSubgroup.java
index 7d5dbca6f7c..4b487934169 100644
--- a/test/jdk/jdk/internal/platform/docker/TestDockerMemoryMetricsSubgroup.java
+++ b/test/jdk/jdk/internal/platform/docker/TestDockerMemoryMetricsSubgroup.java
@@ -91,7 +91,8 @@ public class TestDockerMemoryMetricsSubgroup {
             .addDockerOpts("--volume", Utils.TEST_JDK + ":/jdk")
             .addDockerOpts("--privileged")
             .addDockerOpts("--cgroupns=" + (privateNamespace ? "private" : "host"))
-            .addDockerOpts("--memory", outerGroupMemorySize);
+            .addDockerOpts("--memory", outerGroupMemorySize)
+            .addDockerOpts("-e", "LANG=C.UTF-8");
         opts.addClassOptions("mkdir -p /sys/fs/cgroup/memory/test ; " +
             "echo " + innerSize + " > /sys/fs/cgroup/memory/test/memory.limit_in_bytes ; " +
             "echo $$ > /sys/fs/cgroup/memory/test/cgroup.procs ; " +
@@ -112,6 +113,7 @@ public class TestDockerMemoryMetricsSubgroup {
             .addDockerOpts("--volume", Utils.TEST_JDK + ":/jdk")
             .addDockerOpts("--privileged")
             .addDockerOpts("--cgroupns=" + (privateNamespace ? "private" : "host"))
+            .addDockerOpts("-e", "LANG=C.UTF-8")
             .addDockerOpts("--memory", outerGroupMemorySize);
         opts.addClassOptions("mkdir -p /sys/fs/cgroup/memory/test ; " +
             "echo $$ > /sys/fs/cgroup/memory/test/cgroup.procs ; " +
diff --git a/test/jdk/sun/awt/image/ImageRepresentation/LUTCompareTest.java b/test/jdk/sun/awt/image/ImageRepresentation/LUTCompareTest.java
index aca2ff1071c..498fe227651 100644
--- a/test/jdk/sun/awt/image/ImageRepresentation/LUTCompareTest.java
+++ b/test/jdk/sun/awt/image/ImageRepresentation/LUTCompareTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 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
@@ -23,12 +23,13 @@
 
 /*
  * @test
- * @bug     6570475
+ * @bug     6570475 8375338
  * @summary Test verifies that palette comparison procedure of
  *          ImageRepresentation class does not produce extra transparent
  *          pixels.
  *
- * @run     main LUTCompareTest
+ * @run     main/othervm LUTCompareTest
+ * @run     main/othervm -Xcheck:jni LUTCompareTest
  */
 
 
diff --git a/test/jdk/sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java b/test/jdk/sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java
index 61359084297..1f4707fab3b 100644
--- a/test/jdk/sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java
+++ b/test/jdk/sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2015, Red Hat Inc
+ * 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
@@ -205,6 +206,7 @@ public class JMXInterfaceBindingTest {
             // This is needed for testing on loopback
             args.add("-Djava.rmi.server.hostname=" + address);
             if (useSSL) {
+                args.add("-Djdk.rmi.ssl.client.enableEndpointIdentification=false");
                 args.add("-Dcom.sun.management.jmxremote.registry.ssl=true");
                 args.add("-Djavax.net.ssl.keyStore=" + KEYSTORE_LOC);
                 args.add("-Djavax.net.ssl.trustStore=" + TRUSTSTORE_LOC);
diff --git a/test/jdk/sun/management/jmxremote/bootstrap/RmiBootstrapTest.java b/test/jdk/sun/management/jmxremote/bootstrap/RmiBootstrapTest.java
index 2a99c5e7d52..b62d3f1bbd7 100644
--- a/test/jdk/sun/management/jmxremote/bootstrap/RmiBootstrapTest.java
+++ b/test/jdk/sun/management/jmxremote/bootstrap/RmiBootstrapTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -169,6 +169,7 @@ public class RmiBootstrapTest extends RmiTestBase {
         final List credentialFiles = prepareTestFiles(args[0]);
 
         Security.setProperty("jdk.tls.disabledAlgorithms", "");
+        System.setProperty("jdk.rmi.ssl.client.enableEndpointIdentification", "false");
 
         try {
             MAX_GET_FREE_PORT_TRIES = Integer.parseInt(System.getProperty("test.getfreeport.max.tries", "10"));
diff --git a/test/jdk/sun/management/jmxremote/bootstrap/RmiRegistrySslTest.java b/test/jdk/sun/management/jmxremote/bootstrap/RmiRegistrySslTest.java
index 1aa20937962..b4ef5e224f8 100644
--- a/test/jdk/sun/management/jmxremote/bootstrap/RmiRegistrySslTest.java
+++ b/test/jdk/sun/management/jmxremote/bootstrap/RmiRegistrySslTest.java
@@ -179,6 +179,7 @@ public class RmiRegistrySslTest {
             initTestEnvironment();
 
             List command = new ArrayList<>();
+            command.add("-Djdk.rmi.ssl.client.enableEndpointIdentification=false");
             command.add("-Dtest.src=" + TEST_SRC);
             command.add("-Dtest.rmi.port=" + port);
             command.addAll(Arrays.asList(args));
diff --git a/test/jdk/sun/security/pkcs11/tls/fips/FipsModeTLS.java b/test/jdk/sun/security/pkcs11/tls/fips/FipsModeTLS.java
index 8799f2305bf..a54bb501f78 100644
--- a/test/jdk/sun/security/pkcs11/tls/fips/FipsModeTLS.java
+++ b/test/jdk/sun/security/pkcs11/tls/fips/FipsModeTLS.java
@@ -34,8 +34,12 @@
  *      -Djdk.tls.useExtendedMasterSecret=false
  *      -Djdk.tls.client.enableSessionTicketExtension=false FipsModeTLS
  * @comment SunPKCS11 does not support (TLS1.2) SunTlsExtendedMasterSecret yet.
- *   Stateless resumption doesn't currently work with NSS-FIPS, see JDK-8368669
- * @run main/othervm/timeout=120 -Djdk.tls.client.protocols=TLSv1.3 FipsModeTLS
+ *   Stateless resumption doesn't currently work with NSS-FIPS, see JDK-8368669.
+ *   NSS-FIPS does not support ML-KEM, so configures the list of named groups.
+ * @run main/othervm/timeout=120
+ *      -Djdk.tls.client.protocols=TLSv1.3
+ *      -Djdk.tls.namedGroups=x25519,secp256r1,secp384r1,secp521r1,x448,ffdhe2048,ffdhe3072,ffdhe4096,ffdhe6144,ffdhe8192
+ *      FipsModeTLS
  */
 
 import java.io.File;
diff --git a/test/jdk/sun/security/ssl/CipherSuite/DefaultNamedGroups.java b/test/jdk/sun/security/ssl/CipherSuite/DefaultNamedGroups.java
new file mode 100644
index 00000000000..44c9d566dc0
--- /dev/null
+++ b/test/jdk/sun/security/ssl/CipherSuite/DefaultNamedGroups.java
@@ -0,0 +1,85 @@
+/*
+ * 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 static jdk.test.lib.Asserts.assertFalse;
+import static jdk.test.lib.Asserts.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Stream;
+import javax.net.ssl.SSLEngine;
+import jdk.test.lib.security.SecurityUtils;
+
+/*
+ * @test
+ * @bug 8370885
+ * @summary Default namedGroups values are not being filtered against
+ *          algorithm constraints
+ * @library /javax/net/ssl/templates
+ *          /test/lib
+ * @run main/othervm DefaultNamedGroups
+ */
+
+public class DefaultNamedGroups extends SSLEngineTemplate {
+
+    protected static final String DISABLED_NG = "secp256r1";
+    protected static final List REFERENCE_NG = Stream.of(
+                    "X25519MLKEM768",
+                    "x25519",
+                    "secp256r1",
+                    "secp384r1",
+                    "secp521r1",
+                    "x448",
+                    "ffdhe2048",
+                    "ffdhe3072",
+                    "ffdhe4096",
+                    "ffdhe6144",
+                    "ffdhe8192")
+            .sorted()
+            .toList();
+
+    protected DefaultNamedGroups() throws Exception {
+        super();
+    }
+
+    public static void main(String[] args) throws Exception {
+        SecurityUtils.addToDisabledTlsAlgs(DISABLED_NG);
+        var test = new DefaultNamedGroups();
+
+        for (SSLEngine engine :
+                new SSLEngine[]{test.serverEngine, test.clientEngine}) {
+            checkEngineDefaultNG(engine);
+        }
+    }
+
+    private static void checkEngineDefaultNG(SSLEngine engine) {
+        var defaultConfigNG = new ArrayList<>(List.of(
+                engine.getSSLParameters().getNamedGroups()));
+
+        assertFalse(defaultConfigNG.contains(DISABLED_NG));
+        defaultConfigNG.add(DISABLED_NG);
+        assertTrue(REFERENCE_NG.equals(
+                        defaultConfigNG.stream().sorted().toList()),
+                "Named groups returned by engine: " + defaultConfigNG);
+    }
+}
diff --git a/test/jdk/sun/security/ssl/CipherSuite/DisabledCurve.java b/test/jdk/sun/security/ssl/CipherSuite/DisabledCurve.java
index 26304c5df95..a13f8570f14 100644
--- a/test/jdk/sun/security/ssl/CipherSuite/DisabledCurve.java
+++ b/test/jdk/sun/security/ssl/CipherSuite/DisabledCurve.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,12 +23,24 @@
 
 /*
  * @test
- * @bug 8246330
+ * @bug 8246330 8314323
  * @library /javax/net/ssl/templates /test/lib
  * @run main/othervm -Djdk.tls.namedGroups="secp384r1"
         DisabledCurve DISABLE_NONE PASS
  * @run main/othervm -Djdk.tls.namedGroups="secp384r1"
         DisabledCurve secp384r1 FAIL
+ * @run main/othervm -Djdk.tls.namedGroups="X25519MLKEM768"
+        DisabledCurve DISABLE_NONE PASS
+ * @run main/othervm -Djdk.tls.namedGroups="X25519MLKEM768"
+        DisabledCurve X25519MLKEM768 FAIL
+ * @run main/othervm -Djdk.tls.namedGroups="SecP256r1MLKEM768"
+        DisabledCurve DISABLE_NONE PASS
+ * @run main/othervm -Djdk.tls.namedGroups="SecP256r1MLKEM768"
+        DisabledCurve SecP256r1MLKEM768 FAIL
+ * @run main/othervm -Djdk.tls.namedGroups="SecP384r1MLKEM1024"
+        DisabledCurve DISABLE_NONE PASS
+ * @run main/othervm -Djdk.tls.namedGroups="SecP384r1MLKEM1024"
+        DisabledCurve SecP384r1MLKEM1024 FAIL
 */
 import java.security.Security;
 import java.util.Arrays;
@@ -45,8 +57,10 @@ public class DisabledCurve extends SSLSocketTemplate {
     private static final String[][][] protocols = {
             { { "TLSv1.3", "TLSv1.2", "TLSv1.1", "TLSv1" }, { "TLSv1.2" } },
             { { "TLSv1.2" }, { "TLSv1.3", "TLSv1.2", "TLSv1.1", "TLSv1" } },
-            { { "TLSv1.2" }, { "TLSv1.2" } }, { { "TLSv1.1" }, { "TLSv1.1" } },
-            { { "TLSv1" }, { "TLSv1" } } };
+            { { "TLSv1.2" }, { "TLSv1.2" } },
+            { { "TLSv1.1" }, { "TLSv1.1" } },
+            { { "TLSv1" }, { "TLSv1" } },
+            { { "TLSv1.3" }, { "TLSv1.3" } } };
 
     @Override
     protected SSLContext createClientSSLContext() throws Exception {
@@ -94,17 +108,36 @@ public class DisabledCurve extends SSLSocketTemplate {
         String expected = args[1];
         String disabledName = ("DISABLE_NONE".equals(args[0]) ? "" : args[0]);
         boolean disabled = false;
-        if (disabledName.equals("")) {
+
+        if (disabledName.isEmpty()) {
             Security.setProperty("jdk.disabled.namedCurves", "");
+            Security.setProperty("jdk.certpath.disabledAlgorithms", "");
         } else {
             disabled = true;
-            Security.setProperty("jdk.certpath.disabledAlgorithms", "secp384r1");
+            Security.setProperty("jdk.certpath.disabledAlgorithms", disabledName);
+            if (!disabledName.contains("MLKEM")) {
+                Security.setProperty("jdk.disabled.namedCurves", disabledName);
+            } else {
+                Security.setProperty("jdk.disabled.namedCurves", "");
+            }
         }
 
         // Re-enable TLSv1 and TLSv1.1 since test depends on it.
         SecurityUtils.removeFromDisabledTlsAlgs("TLSv1", "TLSv1.1");
 
+        String namedGroups = System.getProperty("jdk.tls.namedGroups", "");
+        boolean hybridGroup = namedGroups.contains("MLKEM");
+
         for (index = 0; index < protocols.length; index++) {
+            if (hybridGroup) {
+                String[] clientProtos = protocols[index][0];
+                String[] serverProtos = protocols[index][1];
+
+                if (!(isTLS13(clientProtos) && isTLS13(serverProtos))) {
+                    continue;
+                }
+            }
+
             try {
                 (new DisabledCurve()).run();
                 if (expected.equals("FAIL")) {
@@ -123,4 +156,8 @@ public class DisabledCurve extends SSLSocketTemplate {
 
         }
     }
+
+    private static boolean isTLS13(String[] protocols) {
+        return protocols.length == 1 && "TLSv1.3".equals(protocols[0]);
+    }
 }
diff --git a/test/jdk/sun/security/ssl/CipherSuite/NamedGroupsWithCipherSuite.java b/test/jdk/sun/security/ssl/CipherSuite/NamedGroupsWithCipherSuite.java
index 5732f42982c..9080f549683 100644
--- a/test/jdk/sun/security/ssl/CipherSuite/NamedGroupsWithCipherSuite.java
+++ b/test/jdk/sun/security/ssl/CipherSuite/NamedGroupsWithCipherSuite.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,6 +21,8 @@
  * questions.
  */
 
+import java.util.Arrays;
+import java.util.List;
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLServerSocket;
 import javax.net.ssl.SSLSocket;
@@ -29,7 +31,7 @@ import jdk.test.lib.security.SecurityUtils;
 
 /*
   * @test
-  * @bug 8224650 8242929
+  * @bug 8224650 8242929 8314323
   * @library /javax/net/ssl/templates
   *          /javax/net/ssl/TLSCommon
   *          /test/lib
@@ -44,17 +46,20 @@ import jdk.test.lib.security.SecurityUtils;
   * @run main/othervm NamedGroupsWithCipherSuite ffdhe4096
   * @run main/othervm NamedGroupsWithCipherSuite ffdhe6144
   * @run main/othervm NamedGroupsWithCipherSuite ffdhe8192
+  * @run main/othervm NamedGroupsWithCipherSuite X25519MLKEM768
+  * @run main/othervm NamedGroupsWithCipherSuite SecP256r1MLKEM768
+  * @run main/othervm NamedGroupsWithCipherSuite SecP384r1MLKEM1024
  */
 public class NamedGroupsWithCipherSuite extends SSLSocketTemplate {
 
-    private static final Protocol[] PROTOCOLS = new Protocol[] {
+    private static final List PROTOCOLS = List.of(
             Protocol.TLSV1_3,
             Protocol.TLSV1_2,
             Protocol.TLSV1_1,
             Protocol.TLSV1
-    };
+    );
 
-    private static final CipherSuite[] CIPHER_SUITES = new CipherSuite[] {
+    private static final List CIPHER_SUITES = List.of(
             CipherSuite.TLS_AES_128_GCM_SHA256,
             CipherSuite.TLS_AES_256_GCM_SHA384,
             CipherSuite.TLS_CHACHA20_POLY1305_SHA256,
@@ -75,7 +80,23 @@ public class NamedGroupsWithCipherSuite extends SSLSocketTemplate {
             CipherSuite.TLS_DHE_RSA_WITH_AES_128_CBC_SHA,
             CipherSuite.TLS_DHE_RSA_WITH_AES_256_CBC_SHA256,
             CipherSuite.TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256
-    };
+    );
+
+    private static final List HYBRID_NAMEDGROUPS = List.of(
+            "X25519MLKEM768",
+            "SecP256r1MLKEM768",
+            "SecP384r1MLKEM1024"
+    );
+
+    private static final List HYBRID_PROTOCOL = List.of(
+            Protocol.TLSV1_3
+    );
+
+    private static final List HYBRID_CIPHER_SUITES = List.of(
+            CipherSuite.TLS_AES_128_GCM_SHA256,
+            CipherSuite.TLS_AES_256_GCM_SHA384,
+            CipherSuite.TLS_CHACHA20_POLY1305_SHA256
+    );
 
     private String protocol;
     private String cipher;
@@ -151,48 +172,59 @@ public class NamedGroupsWithCipherSuite extends SSLSocketTemplate {
         // Re-enable TLSv1 and TLSv1.1 since test depends on it.
         SecurityUtils.removeFromDisabledTlsAlgs("TLSv1", "TLSv1.1");
 
-        for (Protocol protocol : PROTOCOLS) {
-            for (CipherSuite cipherSuite : CIPHER_SUITES) {
-                // Named group converted to lower case just
-                // to satisfy Test condition
+        boolean hybridGroup = HYBRID_NAMEDGROUPS.contains(namedGroup);
+        List protocolList = hybridGroup ?
+                HYBRID_PROTOCOL : PROTOCOLS;
+        List cipherList = hybridGroup ?
+                HYBRID_CIPHER_SUITES : CIPHER_SUITES;
+
+        // non-Hybrid named group converted to lower case just
+        // to satisfy Test condition
+        String normalizedGroup = hybridGroup ?
+                namedGroup : namedGroup.toLowerCase();
+
+        for (Protocol protocol : protocolList) {
+            for (CipherSuite cipherSuite : cipherList) {
                 if (cipherSuite.supportedByProtocol(protocol)
-                        && groupSupportdByCipher(namedGroup.toLowerCase(),
-                                cipherSuite)) {
+                        && groupSupportedByCipher(normalizedGroup,
+                        cipherSuite)) {
                     System.out.printf("Protocol: %s, cipher suite: %s%n",
                             protocol, cipherSuite);
-                    // Named group converted to lower case just
-                    // to satisfy Test condition
                     new NamedGroupsWithCipherSuite(protocol,
-                            cipherSuite, namedGroup.toLowerCase()).run();
+                            cipherSuite, normalizedGroup).run();
                 }
             }
         }
     }
 
-    private static boolean groupSupportdByCipher(String group,
+    private static boolean groupSupportedByCipher(String group,
             CipherSuite cipherSuite) {
+        if (HYBRID_NAMEDGROUPS.contains(group)) {
+            return cipherSuite.keyExAlgorithm == null;
+        }
+
         return (group.startsWith("x")
-                        && xdhGroupSupportdByCipher(cipherSuite))
+                        && xdhGroupSupportedByCipher(cipherSuite))
                 || (group.startsWith("secp")
-                        && ecdhGroupSupportdByCipher(cipherSuite))
+                        && ecdhGroupSupportedByCipher(cipherSuite))
                 || (group.startsWith("ffdhe")
-                        && ffdhGroupSupportdByCipher(cipherSuite));
+                        && ffdhGroupSupportedByCipher(cipherSuite));
     }
 
-    private static boolean xdhGroupSupportdByCipher(
+    private static boolean xdhGroupSupportedByCipher(
             CipherSuite cipherSuite) {
         return cipherSuite.keyExAlgorithm == null
                 || cipherSuite.keyExAlgorithm == KeyExAlgorithm.ECDHE_RSA;
     }
 
-    private static boolean ecdhGroupSupportdByCipher(
+    private static boolean ecdhGroupSupportedByCipher(
             CipherSuite cipherSuite) {
         return cipherSuite.keyExAlgorithm == null
                 || cipherSuite.keyExAlgorithm == KeyExAlgorithm.ECDHE_RSA
                 || cipherSuite.keyExAlgorithm == KeyExAlgorithm.ECDHE_ECDSA;
     }
 
-    private static boolean ffdhGroupSupportdByCipher(
+    private static boolean ffdhGroupSupportedByCipher(
             CipherSuite cipherSuite) {
         return cipherSuite.keyExAlgorithm == null
                 || cipherSuite.keyExAlgorithm == KeyExAlgorithm.DHE_DSS
diff --git a/test/jdk/sun/security/ssl/CipherSuite/RestrictNamedGroup.java b/test/jdk/sun/security/ssl/CipherSuite/RestrictNamedGroup.java
index c4c343bf84e..4ff0c6e6e15 100644
--- a/test/jdk/sun/security/ssl/CipherSuite/RestrictNamedGroup.java
+++ b/test/jdk/sun/security/ssl/CipherSuite/RestrictNamedGroup.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8226374 8242929
+ * @bug 8226374 8242929 8314323
  * @library /javax/net/ssl/templates
  * @summary Restrict signature algorithms and named groups
  * @run main/othervm RestrictNamedGroup x25519
@@ -36,6 +36,9 @@
  * @run main/othervm RestrictNamedGroup ffdhe4096
  * @run main/othervm RestrictNamedGroup ffdhe6144
  * @run main/othervm RestrictNamedGroup ffdhe8192
+ * @run main/othervm RestrictNamedGroup X25519MLKEM768
+ * @run main/othervm RestrictNamedGroup SecP256r1MLKEM768
+ * @run main/othervm RestrictNamedGroup SecP384r1MLKEM1024
  */
 
 import java.security.Security;
diff --git a/test/jdk/sun/security/ssl/CipherSuite/SupportedGroups.java b/test/jdk/sun/security/ssl/CipherSuite/SupportedGroups.java
index 88b0bf2489a..8cf6ee2b5e6 100644
--- a/test/jdk/sun/security/ssl/CipherSuite/SupportedGroups.java
+++ b/test/jdk/sun/security/ssl/CipherSuite/SupportedGroups.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
  /*
   * @test
-  * @bug 8171279
+  * @bug 8171279 8314323
   * @library /javax/net/ssl/templates
   * @summary Test TLS connection with each individual supported group
   * @run main/othervm SupportedGroups x25519
@@ -36,6 +36,9 @@
   * @run main/othervm SupportedGroups ffdhe4096
   * @run main/othervm SupportedGroups ffdhe6144
   * @run main/othervm SupportedGroups ffdhe8192
+  * @run main/othervm SupportedGroups X25519MLKEM768
+  * @run main/othervm SupportedGroups SecP256r1MLKEM768
+  * @run main/othervm SupportedGroups SecP384r1MLKEM1024
  */
 import java.net.InetAddress;
 import java.util.Arrays;
@@ -45,15 +48,24 @@ import javax.net.ssl.SSLServerSocket;
 public class SupportedGroups extends SSLSocketTemplate {
 
     private static volatile int index;
-    private static final String[][][] protocols = {
+    private static final String[][][] protocolsForClassic = {
         {{"TLSv1.3"}, {"TLSv1.3"}},
         {{"TLSv1.3", "TLSv1.2"}, {"TLSv1.2"}},
         {{"TLSv1.2"}, {"TLSv1.3", "TLSv1.2"}},
         {{"TLSv1.2"}, {"TLSv1.2"}}
     };
 
-    public SupportedGroups() {
+    private static final String[][][] protocolsForHybrid = {
+            {{"TLSv1.3"}, {"TLSv1.3"}},
+            {{"TLSv1.3", "TLSv1.2"}, {"TLSv1.3"}},
+            {{"TLSv1.3"}, {"TLSv1.3", "TLSv1.2"}}
+    };
+
+    private final String[][][] protocols;
+
+    public SupportedGroups(String[][][] protocols) {
         this.serverAddress = InetAddress.getLoopbackAddress();
+        this.protocols = protocols;
     }
 
     // Servers are configured before clients, increment test case after.
@@ -85,8 +97,18 @@ public class SupportedGroups extends SSLSocketTemplate {
     public static void main(String[] args) throws Exception {
         System.setProperty("jdk.tls.namedGroups", args[0]);
 
+        boolean hybridGroup = hybridNamedGroup(args[0]);
+        String[][][] protocols = hybridGroup ?
+                protocolsForHybrid : protocolsForClassic;
+
         for (index = 0; index < protocols.length; index++) {
-            (new SupportedGroups()).run();
+            (new SupportedGroups(protocols)).run();
         }
     }
+
+    private static boolean hybridNamedGroup(String namedGroup) {
+        return namedGroup.equals("X25519MLKEM768") ||
+                namedGroup.equals("SecP256r1MLKEM768") ||
+                namedGroup.equals("SecP384r1MLKEM1024");
+    }
 }
diff --git a/test/jdk/sun/security/x509/URICertStore/AIACertTimeout.java b/test/jdk/sun/security/x509/URICertStore/AIACertTimeout.java
index cabb225bf1c..5491d7b0d7a 100644
--- a/test/jdk/sun/security/x509/URICertStore/AIACertTimeout.java
+++ b/test/jdk/sun/security/x509/URICertStore/AIACertTimeout.java
@@ -47,6 +47,7 @@ import com.sun.net.httpserver.*;
 import java.io.*;
 import java.math.BigInteger;
 import java.net.InetSocketAddress;
+import java.security.Security;
 import java.security.cert.*;
 import java.security.KeyPair;
 import java.security.KeyPairGenerator;
@@ -69,6 +70,7 @@ public class AIACertTimeout {
     private static X509Certificate  eeCert;
 
     public static void main(String[] args) throws Exception {
+        Security.setProperty("com.sun.security.allowedAIALocations", "any");
         int servTimeoutMsec = (args != null && args.length >= 1) ?
                 Integer.parseInt(args[0]) : -1;
         boolean expectedPass = args != null && args.length >= 2 &&
diff --git a/test/jdk/sun/security/x509/URICertStore/ExtensionsWithLDAP.java b/test/jdk/sun/security/x509/URICertStore/ExtensionsWithLDAP.java
index 3b598d78d9f..2214e9256c3 100644
--- a/test/jdk/sun/security/x509/URICertStore/ExtensionsWithLDAP.java
+++ b/test/jdk/sun/security/x509/URICertStore/ExtensionsWithLDAP.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,7 @@ import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.net.Socket;
+import java.security.Security;
 import java.security.cert.CertPath;
 import java.security.cert.CertPathValidator;
 import java.security.cert.CertPathValidatorException;
@@ -47,7 +48,6 @@ import java.security.cert.PKIXParameters;
 import java.security.cert.TrustAnchor;
 import java.security.cert.X509Certificate;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
@@ -67,25 +67,27 @@ public class ExtensionsWithLDAP {
      *        Not After : Jan 17 18:03:59 2043 GMT
      *    Subject: CN=Root
      */
-    private static final String CA_CERT = ""
-        + "-----BEGIN CERTIFICATE-----\n"
-        + "MIIC8TCCAdmgAwIBAgIJAJsSNtj5wdqqMA0GCSqGSIb3DQEBDQUAMA8xDTALBgNV\n"
-        + "BAMMBFJvb3QwHhcNMTUwOTAxMTgwMzU5WhcNNDMwMTE3MTgwMzU5WjAPMQ0wCwYD\n"
-        + "VQQDDARSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvj892vPm\n"
-        + "bB++x9QqqyBveP+ZqQ2B1stV7vh5JmDnOTevkZUOcemp3SXu/esNLSbpL+fARYXH\n"
-        + "V5ubnrfip6RbvcxPfVIIDJrRTLIIsU6W7M6/LJLbLkEVGy4ZV4IHkOw9W2O92rcv\n"
-        + "BkoqhzZnOTGR6uT3rRcKx4RevEKBKhZO+OPPf//lnckOybmYL7t7yQrajzHro76b\n"
-        + "QTXYjAUq/DKhglXfC7vF/JzlAvG2IunGmIfjGcnuDo/9X3Bxef/q5TxCS35fvb7t\n"
-        + "svC+g2QhTcBkQh4uNW2jSjlTIVp1uErCfP5aCjLaez5mqmb1hxPIlcvsNR23HwU6\n"
-        + "bQO7z7NBo9Do6QIDAQABo1AwTjAdBgNVHQ4EFgQUmLZNOBBkqdYoElyxklPYHmAb\n"
-        + "QXIwHwYDVR0jBBgwFoAUmLZNOBBkqdYoElyxklPYHmAbQXIwDAYDVR0TBAUwAwEB\n"
-        + "/zANBgkqhkiG9w0BAQ0FAAOCAQEAYV4fOhDi5q7+XNXCxO8Eil2frR9jqdP4LaQp\n"
-        + "3L0evW0gvPX68s2WmkPWzIu4TJcpdGFQqxyQFSXuKBXjthyiln77QItGTHWeafES\n"
-        + "q5ESrKdSaJZq1bTIrrReCIP74f+fY/F4Tnb3dCqzaljXfzpdbeRsIW6gF71xcOUQ\n"
-        + "nnPEjGVPLUegN+Wn/jQpeLxxIB7FmNXncdRUfMfZ43xVSKuMCy1UUYqJqTa/pXZj\n"
-        + "jCMeRPThRjRqHlJ69jStfWUQATbLyj9KN09rUaJxzmUSt61UqJi7sjcGySaCjAJc\n"
-        + "IcCdVmX/DmRLsdv8W36O3MgrvpT1zR3kaAlv2d8HppnBqcL3xg==\n"
-        + "-----END CERTIFICATE-----";
+    private static final String CA_CERT =
+            """
+            -----BEGIN CERTIFICATE-----
+            MIIC8TCCAdmgAwIBAgIJAJsSNtj5wdqqMA0GCSqGSIb3DQEBDQUAMA8xDTALBgNV
+            BAMMBFJvb3QwHhcNMTUwOTAxMTgwMzU5WhcNNDMwMTE3MTgwMzU5WjAPMQ0wCwYD
+            VQQDDARSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvj892vPm
+            bB++x9QqqyBveP+ZqQ2B1stV7vh5JmDnOTevkZUOcemp3SXu/esNLSbpL+fARYXH
+            V5ubnrfip6RbvcxPfVIIDJrRTLIIsU6W7M6/LJLbLkEVGy4ZV4IHkOw9W2O92rcv
+            BkoqhzZnOTGR6uT3rRcKx4RevEKBKhZO+OPPf//lnckOybmYL7t7yQrajzHro76b
+            QTXYjAUq/DKhglXfC7vF/JzlAvG2IunGmIfjGcnuDo/9X3Bxef/q5TxCS35fvb7t
+            svC+g2QhTcBkQh4uNW2jSjlTIVp1uErCfP5aCjLaez5mqmb1hxPIlcvsNR23HwU6
+            bQO7z7NBo9Do6QIDAQABo1AwTjAdBgNVHQ4EFgQUmLZNOBBkqdYoElyxklPYHmAb
+            QXIwHwYDVR0jBBgwFoAUmLZNOBBkqdYoElyxklPYHmAbQXIwDAYDVR0TBAUwAwEB
+            /zANBgkqhkiG9w0BAQ0FAAOCAQEAYV4fOhDi5q7+XNXCxO8Eil2frR9jqdP4LaQp
+            3L0evW0gvPX68s2WmkPWzIu4TJcpdGFQqxyQFSXuKBXjthyiln77QItGTHWeafES
+            q5ESrKdSaJZq1bTIrrReCIP74f+fY/F4Tnb3dCqzaljXfzpdbeRsIW6gF71xcOUQ
+            nnPEjGVPLUegN+Wn/jQpeLxxIB7FmNXncdRUfMfZ43xVSKuMCy1UUYqJqTa/pXZj
+            jCMeRPThRjRqHlJ69jStfWUQATbLyj9KN09rUaJxzmUSt61UqJi7sjcGySaCjAJc
+            IcCdVmX/DmRLsdv8W36O3MgrvpT1zR3kaAlv2d8HppnBqcL3xg==
+            -----END CERTIFICATE-----
+            """;
 
     /*
      *  Certificate:
@@ -106,39 +108,41 @@ public class ExtensionsWithLDAP {
      *       Authority Information Access:
      *           CA Issuers - URI:ldap://ldap.host.for.aia/dc=Root?cACertificate
      */
-    private static final String EE_CERT = ""
-        + "-----BEGIN CERTIFICATE-----\n"
-        + "MIIDHTCCAgWgAwIBAgIBBzANBgkqhkiG9w0BAQ0FADAPMQ0wCwYDVQQDDARSb290\n"
-        + "MB4XDTE1MDkwMTE4MDM1OVoXDTQzMDExNzE4MDM1OVowDTELMAkGA1UEAwwCRUUw\n"
-        + "ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCpyz97liuWPDYcLH9TX8Bi\n"
-        + "T78olCmAfmevvch6ncXUVuCzbdaKuKXwn4EVbDszsVJLoK5zdtP+X3iDhutj+IgK\n"
-        + "mLhuczF3M9VIcWr+JJUyTH4+3h/RT8cjCDZOmk9iXkb5ifruVsLqzb9g+Vp140Oz\n"
-        + "7leikne7KmclHvTfvFd0WDI7Gb9vo4f5rT717BXJ/n+M6pNk8DLpLiEu6eziYvXR\n"
-        + "v5x+t5Go3x0eCXdaxEQUf2j876Wfr2qHRJK7lDfFe1DDsMg/KpKGiILYZ+g2qtVM\n"
-        + "ZSxtp5BZEtfB5qV/IE5kWO+mCIAGpXSZIdbERR6pZUq8GLEe1T9e+sO6H24w2F19\n"
-        + "AgMBAAGjgYUwgYIwNAYDVR0fBC0wKzApoCegJYYjbGRhcDovL2xkYXAuaG9zdC5m\n"
-        + "b3IuY3JsZHAvbWFpbi5jcmwwSgYIKwYBBQUHAQEEPjA8MDoGCCsGAQUFBzAChi5s\n"
-        + "ZGFwOi8vbGRhcC5ob3N0LmZvci5haWEvZGM9Um9vdD9jQUNlcnRpZmljYXRlMA0G\n"
-        + "CSqGSIb3DQEBDQUAA4IBAQBWDfZHpuUx0yn5d3+BuztFqoks1MkGdk+USlH0TB1/\n"
-        + "gWWBd+4S4PCKlpSur0gj2rMW4fP5HQfNlHci8JV8/bG4KuKRAXW56dg1818Hl3pc\n"
-        + "iIrUSRn8uUjH3p9qb+Rb/u3mmVQRyJjN2t/zceNsO8/+Dd808OB9aEwGs8lMT0nn\n"
-        + "ZYaaAqYz1GIY/Ecyx1vfEZEQ1ljo6i/r70C3igbypBUShxSiGsleiVTLOGNA+MN1\n"
-        + "/a/Qh0bkaQyTGqK3bwvzzMeQVqWu2EWTBD/PmND5ExkpRICdv8LBVXfLnpoBr4lL\n"
-        + "hnxn9+e0Ah+t8dS5EKfn44w5bI5PCu2bqxs6RCTxNjcY\n"
-        + "-----END CERTIFICATE-----";
+    private static final String EE_CERT =
+            """
+            -----BEGIN CERTIFICATE-----
+            MIIDHTCCAgWgAwIBAgIBBzANBgkqhkiG9w0BAQ0FADAPMQ0wCwYDVQQDDARSb290
+            MB4XDTE1MDkwMTE4MDM1OVoXDTQzMDExNzE4MDM1OVowDTELMAkGA1UEAwwCRUUw
+            ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCpyz97liuWPDYcLH9TX8Bi
+            T78olCmAfmevvch6ncXUVuCzbdaKuKXwn4EVbDszsVJLoK5zdtP+X3iDhutj+IgK
+            mLhuczF3M9VIcWr+JJUyTH4+3h/RT8cjCDZOmk9iXkb5ifruVsLqzb9g+Vp140Oz
+            7leikne7KmclHvTfvFd0WDI7Gb9vo4f5rT717BXJ/n+M6pNk8DLpLiEu6eziYvXR
+            v5x+t5Go3x0eCXdaxEQUf2j876Wfr2qHRJK7lDfFe1DDsMg/KpKGiILYZ+g2qtVM
+            ZSxtp5BZEtfB5qV/IE5kWO+mCIAGpXSZIdbERR6pZUq8GLEe1T9e+sO6H24w2F19
+            AgMBAAGjgYUwgYIwNAYDVR0fBC0wKzApoCegJYYjbGRhcDovL2xkYXAuaG9zdC5m
+            b3IuY3JsZHAvbWFpbi5jcmwwSgYIKwYBBQUHAQEEPjA8MDoGCCsGAQUFBzAChi5s
+            ZGFwOi8vbGRhcC5ob3N0LmZvci5haWEvZGM9Um9vdD9jQUNlcnRpZmljYXRlMA0G
+            CSqGSIb3DQEBDQUAA4IBAQBWDfZHpuUx0yn5d3+BuztFqoks1MkGdk+USlH0TB1/
+            gWWBd+4S4PCKlpSur0gj2rMW4fP5HQfNlHci8JV8/bG4KuKRAXW56dg1818Hl3pc
+            iIrUSRn8uUjH3p9qb+Rb/u3mmVQRyJjN2t/zceNsO8/+Dd808OB9aEwGs8lMT0nn
+            ZYaaAqYz1GIY/Ecyx1vfEZEQ1ljo6i/r70C3igbypBUShxSiGsleiVTLOGNA+MN1
+            /a/Qh0bkaQyTGqK3bwvzzMeQVqWu2EWTBD/PmND5ExkpRICdv8LBVXfLnpoBr4lL
+            hnxn9+e0Ah+t8dS5EKfn44w5bI5PCu2bqxs6RCTxNjcY
+            -----END CERTIFICATE-----""";
 
     public static void main(String[] args) throws Exception {
         String extension = args[0];
         String targetHost = args[1];
-
+        Security.setProperty("com.sun.security.allowedAIALocations",
+                "ldap://" + targetHost + "/dc=Root");
         X509Certificate trustedCert = loadCertificate(CA_CERT);
         X509Certificate eeCert = loadCertificate(EE_CERT);
 
         Set trustedCertsSet = new HashSet<>();
         trustedCertsSet.add(new TrustAnchor(trustedCert, null));
 
-        CertPath cp = (CertPath) CertificateFactory.getInstance("X509")
-                .generateCertPath(Arrays.asList(eeCert));
+        CertPath cp = CertificateFactory.getInstance("X509")
+                .generateCertPath(List.of(eeCert));
 
         // CertPath validator should try to parse CRLDP and AIA extensions,
         // and load CRLs/certs which they point to.
@@ -151,7 +155,7 @@ public class ExtensionsWithLDAP {
                     = (InetSocketAddress) socket.getRemoteSocketAddress();
             hosts.add(remoteAddress.getHostName());
         };
-        try (SocksProxy proxy = SocksProxy.startProxy(socketConsumer)) {
+        try (SocksProxy _ = SocksProxy.startProxy(socketConsumer)) {
             CertPathValidator.getInstance("PKIX").validate(cp,
                     new PKIXParameters(trustedCertsSet));
             throw new RuntimeException("CertPathValidatorException not thrown");
diff --git a/test/langtools/jdk/jshell/CompletionAPITest.java b/test/langtools/jdk/jshell/CompletionAPITest.java
index ad5dea90a95..932482ce6dc 100644
--- a/test/langtools/jdk/jshell/CompletionAPITest.java
+++ b/test/langtools/jdk/jshell/CompletionAPITest.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,7 +23,7 @@
 
 /*
  * @test
- * @bug 8366691
+ * @bug 8366691 8375015
  * @summary Test JShell Completion API
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
@@ -67,7 +67,7 @@ import org.junit.jupiter.api.Test;
 
 public class CompletionAPITest extends KullaTesting {
 
-    private static final long TIMEOUT = 2_000;
+    private static final long TIMEOUT = 20_000;
 
     @Test
     public void testAPI() {
@@ -144,7 +144,7 @@ public class CompletionAPITest extends KullaTesting {
     }
 
     @Test
-    public void testDocumentation() {
+    public void testDocumentation() throws Exception {
         waitIndexingFinished();
 
         Path classes = prepareZip();
@@ -171,6 +171,7 @@ public class CompletionAPITest extends KullaTesting {
 
         while (clazz.get().get() != null && (System.currentTimeMillis() - start) < TIMEOUT) {
             System.gc();
+            Thread.sleep(100);
         }
 
         assertNull(clazz.get().get());
diff --git a/test/langtools/tools/javac/diags/examples/LambdaDeserializationStat.java b/test/langtools/tools/javac/diags/examples/LambdaDeserializationStat.java
new file mode 100644
index 00000000000..4ab23ed0b3d
--- /dev/null
+++ b/test/langtools/tools/javac/diags/examples/LambdaDeserializationStat.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2026, Google LLC and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.note.lambda.deserialization.stat
+// options: --debug=dumpLambdaDeserializationStats
+
+import java.io.Serializable;
+
+class LambdaDeserializationStat {
+    Runnable r = (Runnable & Serializable) () -> {};
+}
diff --git a/test/langtools/tools/javac/lambda/SerializableObjectMethods.java b/test/langtools/tools/javac/lambda/SerializableObjectMethods.java
index 52d4cfc7bf6..b489a22c7b4 100644
--- a/test/langtools/tools/javac/lambda/SerializableObjectMethods.java
+++ b/test/langtools/tools/javac/lambda/SerializableObjectMethods.java
@@ -25,7 +25,7 @@
  * @test
  * @bug 8282080
  * @summary Check that serializable lambdas referring to j.l.Object methods work.
- * @compile SerializableObjectMethods.java
+ * @compile/ref=SerializableObjectMethods.out -XDrawDiagnostics --debug=dumpLambdaDeserializationStats SerializableObjectMethods.java
  * @run main SerializableObjectMethods
  */
 import java.io.ByteArrayInputStream;
diff --git a/test/langtools/tools/javac/lambda/SerializableObjectMethods.out b/test/langtools/tools/javac/lambda/SerializableObjectMethods.out
new file mode 100644
index 00000000000..d03cc145794
--- /dev/null
+++ b/test/langtools/tools/javac/lambda/SerializableObjectMethods.out
@@ -0,0 +1,4 @@
+SerializableObjectMethods.java:59:35: compiler.note.lambda.deserialization.stat: SerializableObjectMethods$F, apply, (Ljava/lang/Object;)Ljava/lang/Object;, 5, java/lang/Object, hashCode, ()I
+SerializableObjectMethods.java:60:35: compiler.note.lambda.deserialization.stat: SerializableObjectMethods$F, apply, (Ljava/lang/Object;)Ljava/lang/Object;, 9, SerializableObjectMethods$I2, hashCode, ()I
+- compiler.note.unchecked.filename: SerializableObjectMethods.java
+- compiler.note.unchecked.recompile
diff --git a/test/lib/jdk/test/lib/containers/docker/DockerTestUtils.java b/test/lib/jdk/test/lib/containers/docker/DockerTestUtils.java
index b013561be0b..bd9a706e3a4 100644
--- a/test/lib/jdk/test/lib/containers/docker/DockerTestUtils.java
+++ b/test/lib/jdk/test/lib/containers/docker/DockerTestUtils.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
@@ -380,6 +380,7 @@ public class DockerTestUtils {
         }
         template = template + "COPY /jdk /jdk\n" +
             "ENV JAVA_HOME=/jdk\n" +
+            "ENV LANG=C.UTF-8\n" +
             "CMD [\"/bin/bash\"]\n";
         String dockerFileStr = String.format(template, baseImage, baseImageVersion);
         Files.writeString(dockerfile, dockerFileStr);
diff --git a/test/micro/org/openjdk/bench/java/security/SSLHandshake.java b/test/micro/org/openjdk/bench/java/security/SSLHandshake.java
index d8773781b58..b46704a01de 100644
--- a/test/micro/org/openjdk/bench/java/security/SSLHandshake.java
+++ b/test/micro/org/openjdk/bench/java/security/SSLHandshake.java
@@ -44,6 +44,7 @@ import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLEngine;
 import javax.net.ssl.SSLEngineResult;
 import javax.net.ssl.SSLEngineResult.HandshakeStatus;
+import javax.net.ssl.SSLParameters;
 import javax.net.ssl.SSLSession;
 import javax.net.ssl.TrustManagerFactory;
 
@@ -75,8 +76,15 @@ public class SSLHandshake {
     @Param({"true", "false"})
     boolean resume;
 
-    @Param({"TLSv1.2", "TLS"})
-    String tlsVersion;
+    @Param({
+            "TLSv1.2-secp256r1",
+            "TLSv1.3-x25519", "TLSv1.3-secp256r1", "TLSv1.3-secp384r1",
+            "TLSv1.3-X25519MLKEM768", "TLSv1.3-SecP256r1MLKEM768", "TLSv1.3-SecP384r1MLKEM1024"
+    })
+    String versionAndGroup;
+
+    private String tlsVersion;
+    private String namedGroup;
 
     private static SSLContext getServerContext() {
         try {
@@ -96,6 +104,10 @@ public class SSLHandshake {
 
     @Setup(Level.Trial)
     public void init() throws Exception {
+        String[] components = versionAndGroup.split("-", 2);
+        tlsVersion = components[0];
+        namedGroup = components[1];
+
         KeyStore ts = TestCertificates.getTrustStore();
 
         TrustManagerFactory tmf = TrustManagerFactory.getInstance(
@@ -195,5 +207,14 @@ public class SSLHandshake {
          */
         clientEngine = sslClientCtx.createSSLEngine("client", 80);
         clientEngine.setUseClientMode(true);
+
+        // Set the key exchange named group in client and server engines
+        SSLParameters clientParams = clientEngine.getSSLParameters();
+        clientParams.setNamedGroups(new String[]{namedGroup});
+        clientEngine.setSSLParameters(clientParams);
+
+        SSLParameters serverParams = serverEngine.getSSLParameters();
+        serverParams.setNamedGroups(new String[]{namedGroup});
+        serverEngine.setSSLParameters(serverParams);
     }
 }
diff --git a/test/micro/org/openjdk/bench/javax/crypto/full/KEMBench.java b/test/micro/org/openjdk/bench/javax/crypto/full/KEMBench.java
index 3386039c62e..dc6d2060f5e 100644
--- a/test/micro/org/openjdk/bench/javax/crypto/full/KEMBench.java
+++ b/test/micro/org/openjdk/bench/javax/crypto/full/KEMBench.java
@@ -23,34 +23,69 @@
 package org.openjdk.bench.javax.crypto.full;
 
 import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.Fork;
 import org.openjdk.jmh.annotations.OperationsPerInvocation;
 import org.openjdk.jmh.annotations.Param;
 import org.openjdk.jmh.annotations.Setup;
 import org.openjdk.jmh.infra.Blackhole;
 
 import javax.crypto.DecapsulateException;
+import java.security.GeneralSecurityException;
+import java.security.InvalidAlgorithmParameterException;
 import javax.crypto.KEM;
 import java.security.InvalidKeyException;
 import java.security.KeyPair;
 import java.security.KeyPairGenerator;
 import java.security.NoSuchAlgorithmException;
+import java.security.Provider;
+import java.security.Security;
+import java.security.spec.ECGenParameterSpec;
 
-public class KEMBench extends CryptoBase {
+public abstract class KEMBench extends CryptoBase {
 
     public static final int SET_SIZE = 128;
 
-    @Param({"ML-KEM-512", "ML-KEM-768", "ML-KEM-1024" })
+    @Param({})
     private String algorithm;
 
+    @Param({""})        // Used when the KeyPairGenerator Alg != KEM Alg
+    private String kpgSpec;
+
     private KeyPair[] keys;
     private byte[][] messages;
 
     private KEM kem;
 
     @Setup
-    public void setup() throws NoSuchAlgorithmException, InvalidKeyException {
-        kem = (prov == null) ? KEM.getInstance(algorithm) : KEM.getInstance(algorithm, prov);
-        KeyPairGenerator generator = (prov == null) ? KeyPairGenerator.getInstance(algorithm) : KeyPairGenerator.getInstance(algorithm, prov);
+    public void setup() throws NoSuchAlgorithmException, InvalidKeyException,
+            InvalidAlgorithmParameterException {
+        String kpgAlg;
+        String kpgParams;
+        kem = (prov == null) ? KEM.getInstance(algorithm) :
+                KEM.getInstance(algorithm, prov);
+
+        // By default use the same provider for KEM and KPG
+        Provider kpgProv = prov;
+        if (kpgSpec.isEmpty()) {
+            kpgAlg = algorithm;
+            kpgParams = "";
+        } else {
+            // The key pair generation spec is broken down from a colon-
+            // delimited string spec into 3 fields:
+            // [0] - the provider name
+            // [1] - the algorithm name
+            // [2] - the parameters (i.e. the name of the curve)
+            String[] kpgTok = kpgSpec.split(":");
+            kpgProv = Security.getProvider(kpgTok[0]);
+            kpgAlg = kpgTok[1];
+            kpgParams = kpgTok[2];
+        }
+        KeyPairGenerator generator = (kpgProv == null) ?
+                    KeyPairGenerator.getInstance(kpgAlg) :
+                    KeyPairGenerator.getInstance(kpgAlg, kpgProv);
+        if (kpgParams != null && !kpgParams.isEmpty()) {
+            generator.initialize(new ECGenParameterSpec(kpgParams));
+        }
         keys = new KeyPair[SET_SIZE];
         for (int i = 0; i < keys.length; i++) {
             keys[i] = generator.generateKeyPair();
@@ -63,20 +98,79 @@ public class KEMBench extends CryptoBase {
         }
     }
 
+    private static Provider getInternalJce() {
+        try {
+            Class dhClazz = Class.forName("sun.security.ssl.HybridProvider");
+            return (Provider) dhClazz.getField("PROVIDER").get(null);
+        } catch (ReflectiveOperationException exc) {
+            throw new RuntimeException(exc);
+        }
+    }
+
     @Benchmark
     @OperationsPerInvocation(SET_SIZE)
     public void encapsulate(Blackhole bh) throws InvalidKeyException {
         for (KeyPair kp : keys) {
-            bh.consume(kem.newEncapsulator(kp.getPublic()).encapsulate().encapsulation());
+            bh.consume(kem.newEncapsulator(kp.getPublic()).encapsulate().
+                    encapsulation());
         }
     }
 
     @Benchmark
     @OperationsPerInvocation(SET_SIZE)
-    public void decapsulate(Blackhole bh) throws InvalidKeyException, DecapsulateException {
+    public void decapsulate(Blackhole bh) throws InvalidKeyException,
+            DecapsulateException {
         for (int i = 0; i < messages.length; i++) {
-            bh.consume(kem.newDecapsulator(keys[i].getPrivate()).decapsulate(messages[i]));
+            bh.consume(kem.newDecapsulator(keys[i].getPrivate()).
+                    decapsulate(messages[i]));
         }
     }
 
+    public static class MLKEM extends KEMBench {
+        @Param({"ML-KEM-512", "ML-KEM-768", "ML-KEM-1024" })
+        private String algorithm;
+
+        @Param({""})            // ML-KEM uses the same alg for KPG and KEM
+        private String kpgSpec;
+    }
+
+    @Fork(value = 5, jvmArgs = {"-XX:+AlwaysPreTouch", "--add-opens",
+            "java.base/sun.security.ssl=ALL-UNNAMED"})
+    public static class JSSE_DHasKEM extends KEMBench {
+        @Setup
+        public void init() {
+            try {
+                prov = getInternalJce();
+                super.setup();
+            } catch (GeneralSecurityException gse) {
+                throw new RuntimeException(gse);
+            }
+        }
+
+        @Param({"DH"})
+        private String algorithm;
+
+        @Param({"SunEC:XDH:x25519", "SunEC:EC:secp256r1", "SunEC:EC:secp384r1"})
+        private String kpgSpec;
+    }
+
+    @Fork(value = 5, jvmArgs = {"-XX:+AlwaysPreTouch", "--add-opens",
+            "java.base/sun.security.ssl=ALL-UNNAMED"})
+    public static class JSSE_Hybrid extends KEMBench {
+        @Setup
+        public void init() {
+            try {
+                prov = getInternalJce();
+                super.setup();
+            } catch (GeneralSecurityException gse) {
+                throw new RuntimeException(gse);
+            }
+        }
+
+        @Param({"X25519MLKEM768", "SecP256r1MLKEM768", "SecP384r1MLKEM1024"})
+        private String algorithm;
+
+        @Param({""})            // ML-KEM uses the same alg for KPG and KEM
+        private String kpgSpec;
+    }
 }
diff --git a/test/micro/org/openjdk/bench/javax/crypto/full/KeyPairGeneratorBench.java b/test/micro/org/openjdk/bench/javax/crypto/full/KeyPairGeneratorBench.java
index 58daff28d88..5a3c72fb263 100644
--- a/test/micro/org/openjdk/bench/javax/crypto/full/KeyPairGeneratorBench.java
+++ b/test/micro/org/openjdk/bench/javax/crypto/full/KeyPairGeneratorBench.java
@@ -22,13 +22,16 @@
  */
 package org.openjdk.bench.javax.crypto.full;
 
+import org.openjdk.jmh.annotations.Fork;
 import org.openjdk.jmh.annotations.Benchmark;
 import org.openjdk.jmh.annotations.Param;
 import org.openjdk.jmh.annotations.Setup;
 
+import java.security.GeneralSecurityException;
 import java.security.KeyPair;
 import java.security.KeyPairGenerator;
 import java.security.NoSuchAlgorithmException;
+import java.security.Provider;
 
 public class KeyPairGeneratorBench extends CryptoBase {
 
@@ -45,11 +48,21 @@ public class KeyPairGeneratorBench extends CryptoBase {
         setupProvider();
         generator = (prov == null) ? KeyPairGenerator.getInstance(algorithm)
                                 : KeyPairGenerator.getInstance(algorithm, prov);
-        if (keyLength > 0) { // not all key pair generators allow the use of key length
+        // not all key pair generators allow the use of key length
+        if (keyLength > 0) {
             generator.initialize(keyLength);
         }
     }
 
+    private static Provider getInternalJce() {
+        try {
+            Class dhClazz = Class.forName("sun.security.ssl.HybridProvider");
+            return (Provider) dhClazz.getField("PROVIDER").get(null);
+        } catch (ReflectiveOperationException exc) {
+            throw new RuntimeException(exc);
+        }
+    }
+
     @Benchmark
     public KeyPair generateKeyPair() {
         return generator.generateKeyPair();
@@ -118,4 +131,23 @@ public class KeyPairGeneratorBench extends CryptoBase {
         private int keyLength;
     }
 
+    @Fork(value = 5, jvmArgs = {"-XX:+AlwaysPreTouch", "--add-opens",
+            "java.base/sun.security.ssl=ALL-UNNAMED"})
+    public static class JSSE_Hybrid extends KeyPairGeneratorBench {
+        @Setup
+        public void init() {
+            try {
+                prov = getInternalJce();
+                super.setup();
+            } catch (GeneralSecurityException gse) {
+                throw new RuntimeException(gse);
+            }
+        }
+
+        @Param({"X25519MLKEM768", "SecP256r1MLKEM768", "SecP384r1MLKEM1024"})
+        private String algorithm;
+
+        @Param({"0"})       // Hybrid KPGs don't need key lengths
+        private int keyLength;
+    }
 }