diff --git a/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp index fb6c83654b1..56ac2eec0a9 100644 --- a/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp @@ -1111,7 +1111,7 @@ void ShenandoahBarrierStubC2::keepalive(MacroAssembler& masm, Label* L_done) { // Go to runtime and handle the rest there. __ mov(c_rarg0, _obj); - __ mov(lr, keepalive_runtime_entry_addr()); + __ lea(lr, RuntimeAddress(keepalive_runtime_entry_addr())); __ blr(lr); } if (L_done != nullptr) { @@ -1197,7 +1197,7 @@ void ShenandoahBarrierStubC2::lrb(MacroAssembler& masm) { } // Go to runtime and handle the rest there. - __ mov(lr, lrb_runtime_entry_addr()); + __ lea(lr, RuntimeAddress(lrb_runtime_entry_addr())); __ blr(lr); // Save the result where needed. Narrow entries return narrowOop (32 bits) diff --git a/src/hotspot/cpu/ppc/frame_ppc.inline.hpp b/src/hotspot/cpu/ppc/frame_ppc.inline.hpp index 3c05f950d0c..cedcb399a83 100644 --- a/src/hotspot/cpu/ppc/frame_ppc.inline.hpp +++ b/src/hotspot/cpu/ppc/frame_ppc.inline.hpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2025 SAP SE. All rights reserved. + * Copyright (c) 2012, 2026 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -81,7 +81,7 @@ inline void frame::setup(kind knd) { // Continuation frames on the java heap are not aligned. // When thawing interpreted frames the sp can be unaligned (see new_stack_frame()). assert(_on_heap || - ((is_aligned(_sp, alignment_in_bytes) || is_interpreted_frame()) && + ((is_aligned(_sp, alignment_in_bytes) || is_interpreted_frame() || is_deoptimized_frame()) && (is_aligned(_fp, alignment_in_bytes) || !is_fully_initialized())), "invalid alignment sp:" PTR_FORMAT " unextended_sp:" PTR_FORMAT " fp:" PTR_FORMAT, p2i(_sp), p2i(_unextended_sp), p2i(_fp)); } diff --git a/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp b/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp index 82471035138..a1798289b62 100644 --- a/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp +++ b/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2025 SAP SE. All rights reserved. + * Copyright (c) 2012, 2026 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2346,11 +2346,25 @@ void InterpreterMacroAssembler::notify_method_exit(bool is_native_method, TosSta // depth. If it is possible to enter interp_only_mode we add // the code to check if the event should be sent. if (mode == NotifyJVMTI && (JvmtiExport::can_post_interpreter_events() || JvmtiExport::can_post_frame_pop())) { + Label jvmti_post_done; + + // if (thread->jvmti_thread_state() == nullptr) exit; + ld(R11_scratch1, in_bytes(JavaThread::jvmti_thread_state_offset()), R16_thread); + cmpdi(CR0, R11_scratch1, 0); + beq(CR0, jvmti_post_done); + + // if (interp_only_mode() == false && frame_pop_cnt() == 0) exit; + lwz(R12_scratch2, in_bytes(JavaThread::interp_only_mode_offset()), R16_thread); + lwz(R11_scratch1, in_bytes(JvmtiThreadState::frame_pop_cnt_offset()), R11_scratch1); + or_(R0, R11_scratch1, R12_scratch2); + beq(CR0, jvmti_post_done); + if (!is_native_method) { push(state); } // Expose tos to GC. call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::post_method_exit), check_exceptions); if (!is_native_method) { pop(state); } align(32, 12); + bind(jvmti_post_done); } // Dtrace support not implemented. diff --git a/src/hotspot/cpu/riscv/gc/shenandoah/shenandoahBarrierSetAssembler_riscv.cpp b/src/hotspot/cpu/riscv/gc/shenandoah/shenandoahBarrierSetAssembler_riscv.cpp index 7430b675554..ee8ff1b308f 100644 --- a/src/hotspot/cpu/riscv/gc/shenandoah/shenandoahBarrierSetAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/gc/shenandoah/shenandoahBarrierSetAssembler_riscv.cpp @@ -985,7 +985,8 @@ void ShenandoahBarrierStubC2::keepalive(MacroAssembler& masm, Label* L_done) { // Go to runtime and handle the rest there. __ mv(c_rarg0, _obj); - __ rt_call(keepalive_runtime_entry_addr()); + __ la(ra, RuntimeAddress(keepalive_runtime_entry_addr())); + __ jalr(ra); } if (L_done != nullptr) { __ j(*L_done); @@ -1056,7 +1057,8 @@ void ShenandoahBarrierStubC2::lrb(MacroAssembler& masm) { } // Go to runtime and handle the rest there. - __ rt_call(lrb_runtime_entry_addr()); + __ la(ra, RuntimeAddress(lrb_runtime_entry_addr())); + __ jalr(ra); // Save the result where needed. Narrow entries return narrowOop (32 bits) // we need to zero the upper 32 bits of x10. diff --git a/src/hotspot/cpu/x86/assembler_x86.cpp b/src/hotspot/cpu/x86/assembler_x86.cpp index 39e7f1734f1..14ffdb70f3d 100644 --- a/src/hotspot/cpu/x86/assembler_x86.cpp +++ b/src/hotspot/cpu/x86/assembler_x86.cpp @@ -3439,6 +3439,16 @@ void Assembler::movdqa(XMMRegister dst, Address src) { emit_operand(dst, src, 0); } +void Assembler::movdqa(Address dst, XMMRegister src) { + InstructionMark im(this); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); + attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); + attributes.reset_is_clear_context(); + simd_prefix(src, xnoreg, dst, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); + emit_int8(0x7F); + emit_operand(src, dst, 0); +} + void Assembler::movdqu(XMMRegister dst, Address src) { InstructionMark im(this); InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); @@ -3848,6 +3858,26 @@ void Assembler::evmovdqaq(XMMRegister dst, KRegister mask, Address src, bool mer emit_operand(dst, src, 0); } +void Assembler::evmovdqaq(Address dst, XMMRegister src, int vector_len) { + // Unmasked instruction + evmovdqaq(dst, k0, src, /*merge*/ false, vector_len); +} + +void Assembler::evmovdqaq(Address dst, KRegister mask, XMMRegister src, bool merge, int vector_len) { + assert(VM_Version::supports_evex(), ""); + InstructionMark im(this); + InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); + attributes.set_embedded_opmask_register_specifier(mask); + attributes.set_is_evex_instruction(); + if (merge) { + attributes.reset_is_clear_context(); + } + vex_prefix(dst, 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); + emit_int8(0x7F); + emit_operand(src, dst, 0); +} + void Assembler::evmovntdquq(Address dst, XMMRegister src, int vector_len) { // Unmasked instruction evmovntdquq(dst, k0, src, /*merge*/ true, vector_len); @@ -9481,6 +9511,20 @@ void Assembler::vpsllq(XMMRegister dst, XMMRegister src, XMMRegister shift, int emit_int16((unsigned char)0xF3, (0xC0 | encode)); } +void Assembler::vpsllq(XMMRegister dst, XMMRegister src, Address shift, int vector_len) { + assert(UseAVX > 0, "requires some form of AVX"); + assert(vector_len == AVX_128bit ? VM_Version::supports_avx() : + vector_len == AVX_256bit ? VM_Version::supports_avx2() : + vector_len == AVX_512bit ? VM_Version::supports_evex() : 0, ""); + InstructionMark im(this); + InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); + attributes.set_address_attributes(/* tuple_type */ EVEX_M128, /* input_size_in_bits */ EVEX_NObit); + vex_prefix(shift, src->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); + emit_int8((unsigned char)0xF3); + emit_operand(dst, shift, 0); +} + // Shift packed integers logically right by specified number of bits. void Assembler::psrlw(XMMRegister dst, int shift) { InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); @@ -9572,6 +9616,20 @@ void Assembler::vpsrlq(XMMRegister dst, XMMRegister src, XMMRegister shift, int emit_int16((unsigned char)0xD3, (0xC0 | encode)); } +void Assembler::vpsrlq(XMMRegister dst, XMMRegister src, Address shift, int vector_len) { + assert(UseAVX > 0, "requires some form of AVX"); + assert(vector_len == AVX_128bit ? VM_Version::supports_avx() : + vector_len == AVX_256bit ? VM_Version::supports_avx2() : + vector_len == AVX_512bit ? VM_Version::supports_evex() : 0, ""); + InstructionMark im(this); + InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); + attributes.set_address_attributes(/* tuple_type */ EVEX_M128, /* input_size_in_bits */ EVEX_NObit); + vex_prefix(shift, src->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); + emit_int8((unsigned char)0xD3); + emit_operand(dst, shift, 0); +} + void Assembler::evpsrlvw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(VM_Version::supports_avx512bw(), ""); InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); @@ -9712,6 +9770,18 @@ void Assembler::vpsllvq(XMMRegister dst, XMMRegister src, XMMRegister shift, int emit_int16(0x47, (0xC0 | encode)); } +void Assembler::vpsllvq(XMMRegister dst, XMMRegister src, Address shift, int vector_len) { + assert(vector_len == AVX_128bit ? VM_Version::supports_avx2() : + vector_len == AVX_256bit ? VM_Version::supports_avx2() : + vector_len == AVX_512bit ? VM_Version::supports_evex() : 0, ""); + InstructionMark im(this); + InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); + attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_NObit); + vex_prefix(shift, src->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); + emit_int8((unsigned char)0x47); + emit_operand(dst, shift, 0); +} + //Variable Shift packed integers logically right. void Assembler::vpsrlvd(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len) { assert(UseAVX > 1, "requires AVX2"); @@ -9727,6 +9797,18 @@ void Assembler::vpsrlvq(XMMRegister dst, XMMRegister src, XMMRegister shift, int emit_int16(0x45, (0xC0 | encode)); } +void Assembler::vpsrlvq(XMMRegister dst, XMMRegister src, Address shift, int vector_len) { + assert(vector_len == AVX_128bit ? VM_Version::supports_avx2() : + vector_len == AVX_256bit ? VM_Version::supports_avx2() : + vector_len == AVX_512bit ? VM_Version::supports_evex() : 0, ""); + InstructionMark im(this); + InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); + attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_NObit); + vex_prefix(shift, src->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); + emit_int8((unsigned char)0x45); + emit_operand(dst, shift, 0); +} + //Variable right Shift arithmetic packed integers . void Assembler::vpsravd(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len) { assert(UseAVX > 1, "requires AVX2"); diff --git a/src/hotspot/cpu/x86/assembler_x86.hpp b/src/hotspot/cpu/x86/assembler_x86.hpp index 98684752b0c..bc473ba1ca2 100644 --- a/src/hotspot/cpu/x86/assembler_x86.hpp +++ b/src/hotspot/cpu/x86/assembler_x86.hpp @@ -1612,6 +1612,7 @@ private: // Move Aligned Double Quadword void movdqa(XMMRegister dst, XMMRegister src); void movdqa(XMMRegister dst, Address src); + void movdqa(Address dst, XMMRegister src); // Move Unaligned Double Quadword void movdqu(Address dst, XMMRegister src); @@ -1661,8 +1662,10 @@ private: void evmovdquq(Address dst, KRegister mask, XMMRegister src, bool merge, int vector_len); // Move Aligned 512bit Vector - void evmovdqaq(XMMRegister dst, Address src, int vector_len); - void evmovdqaq(XMMRegister dst, KRegister mask, Address src, bool merge, int vector_len); + void evmovdqaq(XMMRegister dst, Address src, int vector_len); + void evmovdqaq(Address dst, XMMRegister src, int vector_len); + void evmovdqaq(XMMRegister dst, KRegister mask, Address src, bool merge, int vector_len); + void evmovdqaq(Address dst, KRegister mask, XMMRegister src, bool merge, int vector_len); void vmovsldup(XMMRegister dst, XMMRegister src, int vector_len); void vmovshdup(XMMRegister dst, XMMRegister src, int vector_len); @@ -2860,6 +2863,7 @@ private: void vpsllw(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len); void vpslld(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len); void vpsllq(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len); + void vpsllq(XMMRegister dst, XMMRegister src, Address shift, int vector_len); void vpslldq(XMMRegister dst, XMMRegister src, int shift, int vector_len); // Logical shift right packed integers @@ -2875,6 +2879,7 @@ private: void vpsrlw(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len); void vpsrld(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len); void vpsrlq(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len); + void vpsrlq(XMMRegister dst, XMMRegister src, Address shift, int vector_len); void vpsrldq(XMMRegister dst, XMMRegister src, int shift, int vector_len); void evpsrlvw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len); void evpsllvw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len); @@ -2895,10 +2900,12 @@ private: // Variable shift left packed integers void vpsllvd(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len); void vpsllvq(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len); + void vpsllvq(XMMRegister dst, XMMRegister src, Address shift, int vector_len); // Variable shift right packed integers void vpsrlvd(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len); void vpsrlvq(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len); + void vpsrlvq(XMMRegister dst, XMMRegister src, Address shift, int vector_len); // Variable shift right arithmetic packed integers void vpsravd(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len); diff --git a/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp b/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp index 7413fe31142..ce8f26fc1b0 100644 --- a/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp @@ -1137,7 +1137,8 @@ void ShenandoahBarrierStubC2::keepalive(MacroAssembler& masm, Label* L_done) { } // Go to runtime and handle the rest there. - __ call(RuntimeAddress(keepalive_runtime_entry_addr())); + // Use rax as scratch, as it will be saved if live. + __ call(RuntimeAddress(keepalive_runtime_entry_addr()), rax); } if (L_done != nullptr) { __ jmp(*L_done); @@ -1260,7 +1261,8 @@ void ShenandoahBarrierStubC2::lrb(MacroAssembler& masm) { } // Go to runtime and handle the rest there. - __ call(RuntimeAddress(lrb_runtime_entry_addr())); + // Use rax as scratch, as it will be clobbered by result anyway. + __ call(RuntimeAddress(lrb_runtime_entry_addr()), rax); // Save the result where needed. if (_narrow) { diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.cpp b/src/hotspot/cpu/x86/macroAssembler_x86.cpp index 398617cf7e0..aa2195d0256 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp @@ -2124,6 +2124,26 @@ void MacroAssembler::vmovdqa(XMMRegister dst, AddressLiteral src, int vector_len } } +void MacroAssembler::vmovdqa(XMMRegister dst, Address src, int vector_len) { + if (vector_len == AVX_512bit) { + Assembler::evmovdqaq(dst, src, AVX_512bit); + } else if (vector_len == AVX_256bit) { + Assembler::vmovdqa(dst, src); + } else { + Assembler::movdqa(dst, src); + } +} + +void MacroAssembler::vmovdqa(Address dst, XMMRegister src, int vector_len) { + if (vector_len == AVX_512bit) { + Assembler::evmovdqaq(dst, src, AVX_512bit); + } else if (vector_len == AVX_256bit) { + Assembler::vmovdqa(dst, src); + } else { + Assembler::movdqa(dst, src); + } +} + void MacroAssembler::kmov(KRegister dst, Address src) { if (VM_Version::supports_avx512bw()) { kmovql(dst, src); diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.hpp b/src/hotspot/cpu/x86/macroAssembler_x86.hpp index 89dca547727..de5ec02fe43 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86.hpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86.hpp @@ -1181,6 +1181,8 @@ public: using Assembler::vmovdqa; void vmovdqa(XMMRegister dst, AddressLiteral src, Register rscratch = noreg); void vmovdqa(XMMRegister dst, AddressLiteral src, int vector_len, Register rscratch = noreg); + void vmovdqa(XMMRegister dst, Address src, int vector_len); + void vmovdqa(Address dst, XMMRegister src, int vector_len); // AVX512 Unaligned void evmovdqu(BasicType type, KRegister kmask, Address dst, XMMRegister src, bool merge, int vector_len); diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_sha3.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_sha3.cpp index 58f81652a0c..edfe89f5af0 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_64_sha3.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64_sha3.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2026, Intel 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 @@ -38,472 +39,1107 @@ #define BIND(label) bind(label); BLOCK_COMMENT(#label ":") -#define xmm(i) as_XMMRegister(i) - -// Constants +// Constant pool ATTRIBUTE_ALIGNED(64) static const uint64_t round_consts_arr[24] = { - 0x0000000000000001L, 0x0000000000008082L, 0x800000000000808AL, - 0x8000000080008000L, 0x000000000000808BL, 0x0000000080000001L, - 0x8000000080008081L, 0x8000000000008009L, 0x000000000000008AL, - 0x0000000000000088L, 0x0000000080008009L, 0x000000008000000AL, - 0x000000008000808BL, 0x800000000000008BL, 0x8000000000008089L, - 0x8000000000008003L, 0x8000000000008002L, 0x8000000000000080L, - 0x000000000000800AL, 0x800000008000000AL, 0x8000000080008081L, - 0x8000000000008080L, 0x0000000080000001L, 0x8000000080008008L - }; + 0x8000000080008008L, 0x0000000080000001L, 0x8000000000008080L, + 0x8000000080008081L, 0x800000008000000AL, 0x000000000000800AL, + 0x8000000000000080L, 0x8000000000008002L, 0x8000000000008003L, + 0x8000000000008089L, 0x800000000000008BL, 0x000000008000808BL, + 0x000000008000000AL, 0x0000000080008009L, 0x0000000000000088L, + 0x000000000000008AL, 0x8000000000008009L, 0x8000000080008081L, + 0x0000000080000001L, 0x000000000000808BL, 0x8000000080008000L, + 0x800000000000808AL, 0x0000000000008082L, 0x0000000000000001L +}; -ATTRIBUTE_ALIGNED(64) static const uint64_t permsAndRots[] = { - // permutation in combined rho and pi - 9, 2, 11, 0, 1, 2, 3, 4, // step 1 and 3 - 8, 1, 9, 2, 11, 4, 12, 0, // step 2 - 9, 2, 10, 3, 11, 4, 12, 0, // step 4 - 8, 9, 2, 3, 4, 5, 6, 7, // step 5 - 0, 8, 9, 10, 15, 0, 0, 0, // step 6 - 4, 5, 8, 9, 6, 7, 10, 11, // step 7 and 8 - 0, 1, 2, 3, 13, 0, 0, 0, // step 9 - 2, 3, 0, 1, 11, 0, 0, 0, // step 10 - 4, 5, 6, 7, 14, 0, 0, 0, // step 11 - 14, 15, 12, 13, 4, 0, 0, 0, // step 12 - // size of rotations (after step 5) - 1, 6, 62, 55, 28, 20, 27, 36, - 3, 45, 10, 15, 25, 8, 39, 41, - 44, 43, 21, 18, 2, 61, 56, 14, - // rotation of row elements - 12, 8, 9, 10, 11, 5, 6, 7, - 9, 10, 11, 12, 8, 5, 6, 7 +ATTRIBUTE_ALIGNED(64) static const uint64_t avx2_round_consts[] = { + 0x8000000080008008L, 0x0L, 0x8000000080008008L, 0x0L, + 0x0000000080000001L, 0x0L, 0x0000000080000001L, 0x0L, + 0x8000000000008080L, 0x0L, 0x8000000000008080L, 0x0L, + 0x8000000080008081L, 0x0L, 0x8000000080008081L, 0x0L, + 0x800000008000000AL, 0x0L, 0x800000008000000AL, 0x0L, + 0x000000000000800AL, 0x0L, 0x000000000000800AL, 0x0L, + 0x8000000000000080L, 0x0L, 0x8000000000000080L, 0x0L, + 0x8000000000008002L, 0x0L, 0x8000000000008002L, 0x0L, + 0x8000000000008003L, 0x0L, 0x8000000000008003L, 0x0L, + 0x8000000000008089L, 0x0L, 0x8000000000008089L, 0x0L, + 0x800000000000008BL, 0x0L, 0x800000000000008BL, 0x0L, + 0x000000008000808BL, 0x0L, 0x000000008000808BL, 0x0L, + 0x000000008000000AL, 0x0L, 0x000000008000000AL, 0x0L, + 0x0000000080008009L, 0x0L, 0x0000000080008009L, 0x0L, + 0x0000000000000088L, 0x0L, 0x0000000000000088L, 0x0L, + 0x000000000000008AL, 0x0L, 0x000000000000008AL, 0x0L, + 0x8000000000008009L, 0x0L, 0x8000000000008009L, 0x0L, + 0x8000000080008081L, 0x0L, 0x8000000080008081L, 0x0L, + 0x0000000080000001L, 0x0L, 0x0000000080000001L, 0x0L, + 0x000000000000808BL, 0x0L, 0x000000000000808BL, 0x0L, + 0x8000000080008000L, 0x0L, 0x8000000080008000L, 0x0L, + 0x800000000000808AL, 0x0L, 0x800000000000808AL, 0x0L, + 0x0000000000008082L, 0x0L, 0x0000000000008082L, 0x0L, + 0x0000000000000001L, 0x0L, 0x0000000000000001L, 0x0L, +}; + +ATTRIBUTE_ALIGNED(64) static const uint64_t avx2_rotate_consts[] = { + // X0 X0 X1 X3 X1 X3 X2 X4 X2 X4 + 1, 28, 1, 28, 62, 27, 62, 27, // A1A3, A2A4 + 36, 41, 36, 41, 44, 55, 44, 55, 6, 20, 6, 20, // A5A15, A6A8, A7A9 + 3, 18, 3, 18, 10, 25, 10, 25, 43, 39, 43, 39, // A10A20, A11A13, A12A14 + 45, 21, 45, 21, 15, 8, 15, 8, // A16A18, A17A19 + 2, 56, 2, 56, 61, 14, 61, 14, // A21A23, A22A24 + + //Offset = 384 = 12*4*8 + // X0 X0 X1 X3 X1 X3 X2 X4 X2 X4 + 64- 1, 64-28, 64- 1, 64-28, 64-62, 64-27, 64-62, 64-27, + 64-36, 64-41, 64-36, 64-41, 64-44, 64-55, 64-44, 64-55, 64- 6, 64-20, 64- 6, 64-20, + 64- 3, 64-18, 64- 3, 64-18, 64-10, 64-25, 64-10, 64-25, 64-43, 64-39, 64-43, 64-39, + 64-45, 64-21, 64-45, 64-21, 64-15, 64- 8, 64-15, 64- 8, + 64- 2, 64-56, 64- 2, 64-56, 64-61, 64-14, 64-61, 64-14, }; static address round_constsAddr() { return (address) round_consts_arr; } -static address permsAndRotsAddr() { - return (address) permsAndRots; +static address avx2_round_constsAddr() { + return (address) avx2_round_consts; } -// Arguments: -// -// Inputs: +static address avx2_rotate_constsAddr() { + return (address) avx2_rotate_consts; +} + +// Inputs (sha3_implCompress|sha3_implCompressMB): // c_rarg0 - byte[] source+offset // c_rarg1 - long[] SHA3.state // c_rarg2 - int block_size // c_rarg3 - int offset // c_rarg4 - int limit // -static address generate_sha3_implCompress(StubId stub_id, +// Inputs (double_keccak): +// c_rarg0 - long[] SHA3.state1 +// c_rarg1 - long[] SHA3.state2 +// +// Inputs (quad_keccak): +// c_rarg0 - long[] SHA3.state1 +// c_rarg1 - long[] SHA3.state2 +// c_rarg2 - long[] SHA3.state3 +// c_rarg3 - long[] SHA3.state4 +// +// Design notes: +// With 32 AVX512 registers, we can fit the entire SHA3 state into first 25 registers +// (using just one element out of each register!). The 'interesting' part of the +// function is just a translation of Java code. This is (surprisingly) very +// efficient; and also makes double_keccak and quad_keccak support fairly trivial. +static address generate_sha3_implCompress_avx512(StubId stub_id, StubGenerator *stubgen, MacroAssembler *_masm) { - bool multiBlock; switch(stub_id) { case StubId::stubgen_sha3_implCompress_id: - multiBlock = false; - break; case StubId::stubgen_sha3_implCompressMB_id: - multiBlock = true; + case StubId::stubgen_double_keccak_id: + case StubId::stubgen_quad_keccak_id: break; default: ShouldNotReachHere(); } + int entry_count = StubInfo::entry_count(stub_id); assert(entry_count == 1, "sanity check"); address start = stubgen->load_archive_data(stub_id); if (start != nullptr) { return start; } + __ align(CodeEntryAlignment); StubCodeMark mark(stubgen, stub_id); start = __ pc(); - - const Register buf = c_rarg0; - const Register state = c_rarg1; - const Register block_size = c_rarg2; - const Register ofs = c_rarg3; -#ifndef _WIN64 - const Register limit = c_rarg4; -#else - const Address limit_mem(rbp, 6 * wordSize); - const Register limit = r12; -#endif - - const Register permsAndRots = r10; - const Register round_consts = r11; - const Register constant2use = r13; - const Register roundsLeft = r14; - - Label sha3_loop; - Label rounds24_loop, block104, block136, block144, block168; - __ enter(); - __ push_ppx(r12); - __ push_ppx(r13); - __ push_ppx(r14); + Register buf, offset, block_size, limit; + Register state1, state2, state3, state4, state5, state6, state7, state8; + Register roundsLeft = r10; + Register round_consts = r11; + int vector_len = Assembler::AVX_128bit; + bool multiBlock = stub_id == StubId::stubgen_sha3_implCompressMB_id; + bool parallelKeccak = true; -#ifdef _WIN64 - // on win64, fill limit from stack position - __ movptr(limit, limit_mem); -#endif + switch (stub_id) { + case StubId::stubgen_quad_keccak_id: + vector_len = Assembler::AVX_256bit; + state1 = c_rarg0; + state2 = c_rarg1; + state3 = c_rarg2; + state4 = c_rarg3; + break; + case StubId::stubgen_double_keccak_id: + state1 = c_rarg0; + state2 = c_rarg1; + break; + default: + parallelKeccak = false; + buf = c_rarg0; + state1 = c_rarg1; + block_size = c_rarg2; + offset = c_rarg3; + #ifndef _WIN64 + limit = c_rarg4; + #else + limit = rdi; + __ push_ppx(rdi); + __ movptr(limit, Address(rbp, 6 * wordSize)); + #endif + } - __ lea(permsAndRots, ExternalAddress(permsAndRotsAddr())); + __ movl(rax, 0x1); + __ kmovwl(k1, rax); __ lea(round_consts, ExternalAddress(round_constsAddr())); - // set up the masks - __ movl(rax, 0x1F); - __ kmovwl(k5, rax); - __ kshiftrwl(k4, k5, 1); - __ kshiftrwl(k3, k5, 2); - __ kshiftrwl(k2, k5, 3); - __ kshiftrwl(k1, k5, 4); + XMMRegister A0 = xmm0; + XMMRegister A1 = xmm1; + XMMRegister A2 = xmm2; + XMMRegister A3 = xmm3; + XMMRegister A4 = xmm4; + XMMRegister A5 = xmm5; + XMMRegister A6 = xmm6; + XMMRegister A7 = xmm7; + XMMRegister A8 = xmm8; + XMMRegister A9 = xmm9; + XMMRegister A10 = xmm10; + XMMRegister A11 = xmm11; + XMMRegister A12 = xmm12; + XMMRegister A13 = xmm13; + XMMRegister A14 = xmm14; + XMMRegister A15 = xmm15; + XMMRegister A16 = xmm16; + XMMRegister A17 = xmm17; + XMMRegister A18 = xmm18; + XMMRegister A19 = xmm19; + XMMRegister A20 = xmm20; + XMMRegister A21 = xmm21; + XMMRegister A22 = xmm22; + XMMRegister A23 = xmm23; + XMMRegister A24 = xmm24; + XMMRegister C0 = xmm25; + XMMRegister C1 = xmm26; + XMMRegister C2 = xmm27; + XMMRegister C3 = xmm28; + XMMRegister C4 = xmm29; + XMMRegister T0 = xmm30; + XMMRegister T1 = xmm31; - // load the state - for (int i = 0; i < 5; i++) { - __ evmovdquq(xmm(i), k5, Address(state, i * 40), false, Assembler::AVX_512bit); - } - - // load the permutation and rotation constants - for (int i = 0; i < 15; i++) { - __ evmovdquq(xmm(i + 17), Address(permsAndRots, i * 64), Assembler::AVX_512bit); + auto loadState = [=](XMMRegister X1, XMMRegister X2, int disp){ + if (stub_id == StubId::stubgen_quad_keccak_id) { + __ vmovdqu(T0, Address(state1, disp), Assembler::AVX_128bit); + __ vmovdqu(T1, Address(state2, disp), Assembler::AVX_128bit); + __ vmovdqu(C0, Address(state3, disp), Assembler::AVX_128bit); + __ vmovdqu(C1, Address(state4, disp), Assembler::AVX_128bit); + __ vshufpd(X1, T0, T1, 0b00, Assembler::AVX_128bit); + __ vshufpd(X2, T0, T1, 0b11, Assembler::AVX_128bit); + __ vshufpd(T0, C0, C1, 0b00, Assembler::AVX_128bit); + __ vshufpd(T1, C0, C1, 0b11, Assembler::AVX_128bit); + __ vinserti128(X1, X1, T0, 1); + __ vinserti128(X2, X2, T1, 1); + } else if (stub_id == StubId::stubgen_double_keccak_id) { + __ vmovdqu(T0, Address(state1, disp), Assembler::AVX_128bit); + __ vmovdqu(T1, Address(state2, disp), Assembler::AVX_128bit); + __ vshufpd(X1, T0, T1, 0b00, Assembler::AVX_128bit); + __ vshufpd(X2, T0, T1, 0b11, Assembler::AVX_128bit); + } else { + // only care about values in first 64bit columns for non-parallel keccak + __ vmovdqu(X1, Address(state1, disp), Assembler::AVX_128bit); + __ vshufpd(X2, X1, X1, 0b1, Assembler::AVX_128bit); + } + }; + + loadState( A0, A1, 0 * 8); + loadState( A2, A3, 2 * 8); + loadState( A4, A5, 4 * 8); + loadState( A6, A7, 6 * 8); + loadState( A8, A9, 8 * 8); + loadState(A10, A11, 10 * 8); + loadState(A12, A13, 12 * 8); + loadState(A14, A15, 14 * 8); + loadState(A16, A17, 16 * 8); + loadState(A18, A19, 18 * 8); + loadState(A20, A21, 20 * 8); + loadState(A22, A23, 22 * 8); + __ movq(A24, Address(state1, 24 * 8)); + if (stub_id == StubId::stubgen_quad_keccak_id) { + __ movq(T0, Address(state2, 24 * 8)); + __ vshufpd(A24, A24, T0, 0b00, Assembler::AVX_128bit); + + __ movq(T0, Address(state3, 24 * 8)); + __ movq(T1, Address(state4, 24 * 8)); + __ vshufpd(T0, T0, T1, 0b00, Assembler::AVX_128bit); + __ vinserti128(A24, A24, T0, 1); + } else if (stub_id == StubId::stubgen_double_keccak_id) { + __ movq(T0, Address(state2, 24 * 8)); + __ vshufpd(A24, A24, T0, 0b00, Assembler::AVX_128bit); } + Label rounds24_loop, multi_loop; __ align(OptoLoopAlignment); - __ BIND(sha3_loop); + __ BIND(multi_loop); + __ movl(roundsLeft, 23); - // there will be 24 keccak rounds - __ movl(roundsLeft, 24); - // load round_constants base - __ movptr(constant2use, round_consts); + if (!parallelKeccak) { + __ evpxorq( A0, k1, A0, Address(buf, 0 * 8), false, Assembler::AVX_128bit); + __ evpxorq( A1, k1, A1, Address(buf, 1 * 8), false, Assembler::AVX_128bit); + __ evpxorq( A2, k1, A2, Address(buf, 2 * 8), false, Assembler::AVX_128bit); + __ evpxorq( A3, k1, A3, Address(buf, 3 * 8), false, Assembler::AVX_128bit); + __ evpxorq( A4, k1, A4, Address(buf, 4 * 8), false, Assembler::AVX_128bit); + __ evpxorq( A5, k1, A5, Address(buf, 5 * 8), false, Assembler::AVX_128bit); + __ evpxorq( A6, k1, A6, Address(buf, 6 * 8), false, Assembler::AVX_128bit); + __ evpxorq( A7, k1, A7, Address(buf, 7 * 8), false, Assembler::AVX_128bit); + __ evpxorq( A8, k1, A8, Address(buf, 8 * 8), false, Assembler::AVX_128bit); + __ cmpl(block_size, 72); + __ jcc(Assembler::equal, rounds24_loop); + __ evpxorq( A9, k1, A9, Address(buf, 9 * 8), false, Assembler::AVX_128bit); + __ evpxorq(A10, k1, A10, Address(buf, 10 * 8), false, Assembler::AVX_128bit); + __ evpxorq(A11, k1, A11, Address(buf, 11 * 8), false, Assembler::AVX_128bit); + __ evpxorq(A12, k1, A12, Address(buf, 12 * 8), false, Assembler::AVX_128bit); + __ cmpl(block_size, 104); + __ jcc(Assembler::equal, rounds24_loop); + __ evpxorq(A13, k1, A13, Address(buf, 13 * 8), false, Assembler::AVX_128bit); + __ evpxorq(A14, k1, A14, Address(buf, 14 * 8), false, Assembler::AVX_128bit); + __ evpxorq(A15, k1, A15, Address(buf, 15 * 8), false, Assembler::AVX_128bit); + __ evpxorq(A16, k1, A16, Address(buf, 16 * 8), false, Assembler::AVX_128bit); + __ cmpl(block_size, 136); + __ jcc(Assembler::equal, rounds24_loop); + __ evpxorq(A17, k1, A17, Address(buf, 17 * 8), false, Assembler::AVX_128bit); + __ cmpl(block_size, 144); + __ jcc(Assembler::equal, rounds24_loop); + __ evpxorq(A18, k1, A18, Address(buf, 18 * 8), false, Assembler::AVX_128bit); + __ evpxorq(A19, k1, A19, Address(buf, 19 * 8), false, Assembler::AVX_128bit); + __ evpxorq(A20, k1, A20, Address(buf, 20 * 8), false, Assembler::AVX_128bit); + } - // load input: 72, 104, 136, 144 or 168 bytes - // i.e. 5+4, 2*5+3, 3*5+2, 3*5+3 or 4*5+1 longs - __ evpxorq(xmm0, k5, xmm0, Address(buf, 0), true, Assembler::AVX_512bit); - - // if(blockSize == 72) SHA3-512 - __ cmpl(block_size, 72); - __ jcc(Assembler::notEqual, block104); - __ evpxorq(xmm1, k4, xmm1, Address(buf, 40), true, Assembler::AVX_512bit); - __ jmp(rounds24_loop); - - // if(blockSize == 104) SHA3-384 - __ BIND(block104); - __ cmpl(block_size, 104); - __ jcc(Assembler::notEqual, block136); - __ evpxorq(xmm1, k5, xmm1, Address(buf, 40), true, Assembler::AVX_512bit); - __ evpxorq(xmm2, k3, xmm2, Address(buf, 80), true, Assembler::AVX_512bit); - __ jmp(rounds24_loop); - - // if(blockSize == 136) SHA3-256 and SHAKE256 - __ BIND(block136); - __ cmpl(block_size, 136); - __ jcc(Assembler::notEqual, block144); - __ evpxorq(xmm1, k5, xmm1, Address(buf, 40), true, Assembler::AVX_512bit); - __ evpxorq(xmm2, k5, xmm2, Address(buf, 80), true, Assembler::AVX_512bit); - __ evpxorq(xmm3, k2, xmm3, Address(buf, 120), true, Assembler::AVX_512bit); - __ jmp(rounds24_loop); - - // if(blockSize == 144) SHA3-224 - __ BIND(block144); - __ cmpl(block_size, 144); - __ jcc(Assembler::notEqual, block168); - __ evpxorq(xmm1, k5, xmm1, Address(buf, 40), true, Assembler::AVX_512bit); - __ evpxorq(xmm2, k5, xmm2, Address(buf, 80), true, Assembler::AVX_512bit); - __ evpxorq(xmm3, k3, xmm3, Address(buf, 120), true, Assembler::AVX_512bit); - __ jmp(rounds24_loop); - - // if(blockSize == 168) SHAKE128 - __ BIND(block168); - __ evpxorq(xmm1, k5, xmm1, Address(buf, 40), true, Assembler::AVX_512bit); - __ evpxorq(xmm2, k5, xmm2, Address(buf, 80), true, Assembler::AVX_512bit); - __ evpxorq(xmm3, k5, xmm3, Address(buf, 120), true, Assembler::AVX_512bit); - __ evpxorq(xmm4, k1, xmm4, Address(buf, 160), true, Assembler::AVX_512bit); - - // The 24 rounds of the keccak transformation. - // The implementation closely follows the Java version, with the state - // array "rows" in the lowest 5 64-bit slots of zmm0 - zmm4, i.e. - // each row of the SHA3 specification is located in one zmm register. __ align(OptoLoopAlignment); __ BIND(rounds24_loop); - __ subl(roundsLeft, 1); - __ evmovdquw(xmm5, xmm0, Assembler::AVX_512bit); - // vpternlogq(x, 150, y, z) does x = x ^ y ^ z - __ vpternlogq(xmm5, 150, xmm1, xmm2, Assembler::AVX_512bit); - __ vpternlogq(xmm5, 150, xmm3, xmm4, Assembler::AVX_512bit); - // Now the "c row", i.e. c0-c4 are in zmm5. - // Rotate each element of the c row by one bit to zmm6, call the - // rotated version c'. - __ evprolq(xmm6, xmm5, 1, Assembler::AVX_512bit); - // Rotate elementwise the c row so that c4 becomes c0, - // c0 becomes c1, etc. - __ evpermt2q(xmm5, xmm30, xmm5, Assembler::AVX_512bit); - // rotate elementwise the c' row so that c'0 becomes c'4, - // c'1 becomes c'0, etc. - __ evpermt2q(xmm6, xmm31, xmm6, Assembler::AVX_512bit); - __ vpternlogq(xmm0, 150, xmm5, xmm6, Assembler::AVX_512bit); - __ vpternlogq(xmm1, 150, xmm5, xmm6, Assembler::AVX_512bit); - __ vpternlogq(xmm2, 150, xmm5, xmm6, Assembler::AVX_512bit); - __ vpternlogq(xmm3, 150, xmm5, xmm6, Assembler::AVX_512bit); - __ vpternlogq(xmm4, 150, xmm5, xmm6, Assembler::AVX_512bit); - // Now the theta mapping has been finished. + // Step mapping Theta as defined in section 3.2.1. + // long c0 = a0^a5^a10^a15^a20; + // long c1 = a1^a6^a11^a16^a21; + // long c2 = a2^a7^a12^a17^a22; + // long c3 = a3^a8^a13^a18^a23; + // long c4 = a4^a9^a14^a19^a24; - // Do the cyclical permutation of the 24 moving state elements - // and the required rotations within each element (the combined - // rho and pi steps). - __ evpermt2q(xmm4, xmm17, xmm3, Assembler::AVX_512bit); - __ evpermt2q(xmm3, xmm18, xmm2, Assembler::AVX_512bit); - __ evpermt2q(xmm2, xmm17, xmm1, Assembler::AVX_512bit); - __ evpermt2q(xmm1, xmm19, xmm0, Assembler::AVX_512bit); - __ evpermt2q(xmm4, xmm20, xmm2, Assembler::AVX_512bit); - // The 24 moving elements are now in zmm1, zmm3 and zmm4, - // do the rotations now. - __ evprolvq(xmm1, xmm1, xmm27, Assembler::AVX_512bit); - __ evprolvq(xmm3, xmm3, xmm28, Assembler::AVX_512bit); - __ evprolvq(xmm4, xmm4, xmm29, Assembler::AVX_512bit); - __ evmovdquw(xmm2, xmm1, Assembler::AVX_512bit); - __ evmovdquw(xmm5, xmm3, Assembler::AVX_512bit); - __ evpermt2q(xmm0, xmm21, xmm4, Assembler::AVX_512bit); - __ evpermt2q(xmm1, xmm22, xmm3, Assembler::AVX_512bit); - __ evpermt2q(xmm5, xmm22, xmm2, Assembler::AVX_512bit); - __ evmovdquw(xmm3, xmm1, Assembler::AVX_512bit); - __ evmovdquw(xmm2, xmm5, Assembler::AVX_512bit); - __ evpermt2q(xmm1, xmm23, xmm4, Assembler::AVX_512bit); - __ evpermt2q(xmm2, xmm24, xmm4, Assembler::AVX_512bit); - __ evpermt2q(xmm3, xmm25, xmm4, Assembler::AVX_512bit); - __ evpermt2q(xmm4, xmm26, xmm5, Assembler::AVX_512bit); - // The combined rho and pi steps are done. + __ evmovdquq(C0, A0, vector_len); + __ evmovdquq(C1, A1, vector_len); + __ evmovdquq(C2, A2, vector_len); + __ evmovdquq(C3, A3, vector_len); + __ evmovdquq(C4, A4, vector_len); - // Do the chi step (the same operation on all 5 rows). - // vpternlogq(x, 180, y, z) does x = x ^ (y & ~z). - __ evpermt2q(xmm5, xmm31, xmm0, Assembler::AVX_512bit); - __ evpermt2q(xmm6, xmm31, xmm5, Assembler::AVX_512bit); - __ vpternlogq(xmm0, 180, xmm6, xmm5, Assembler::AVX_512bit); + __ vpternlogq(C0, 0x96, A5, A10, vector_len); + __ vpternlogq(C1, 0x96, A6, A11, vector_len); + __ vpternlogq(C2, 0x96, A7, A12, vector_len); + __ vpternlogq(C3, 0x96, A8, A13, vector_len); + __ vpternlogq(C4, 0x96, A9, A14, vector_len); - __ evpermt2q(xmm5, xmm31, xmm1, Assembler::AVX_512bit); - __ evpermt2q(xmm6, xmm31, xmm5, Assembler::AVX_512bit); - __ vpternlogq(xmm1, 180, xmm6, xmm5, Assembler::AVX_512bit); + __ vpternlogq(C0, 0x96, A15, A20, vector_len); + __ vpternlogq(C1, 0x96, A16, A21, vector_len); + __ vpternlogq(C2, 0x96, A17, A22, vector_len); + __ vpternlogq(C3, 0x96, A18, A23, vector_len); + __ vpternlogq(C4, 0x96, A19, A24, vector_len); - // xor the round constant into a0 (the lowest 64 bits of zmm0 - __ evpxorq(xmm0, k1, xmm0, Address(constant2use, 0), true, Assembler::AVX_512bit); - __ addptr(constant2use, 8); + // long d0 = c4 ^ Long.rotateLeft(c1, 1); + // long d1 = c0 ^ Long.rotateLeft(c2, 1); + // long d2 = c1 ^ Long.rotateLeft(c3, 1); + // long d3 = c2 ^ Long.rotateLeft(c4, 1); + // long d4 = c3 ^ Long.rotateLeft(c0, 1); + // a0 ^= d0; a1 ^= d1; a2 ^= d2; a3 ^= d3; a4 ^= d4; + // a5 ^= d0; a6 ^= d1; a7 ^= d2; a8 ^= d3; a9 ^= d4; + // a10 ^= d0; a11 ^= d1; a12 ^= d2; a13 ^= d3; a14 ^= d4; + // a15 ^= d0; a16 ^= d1; a17 ^= d2; a18 ^= d3; a19 ^= d4; + // a20 ^= d0; a21 ^= d1; a22 ^= d2; a23 ^= d3; a24 ^= d4; - __ evpermt2q(xmm5, xmm31, xmm2, Assembler::AVX_512bit); - __ evpermt2q(xmm6, xmm31, xmm5, Assembler::AVX_512bit); - __ vpternlogq(xmm2, 180, xmm6, xmm5, Assembler::AVX_512bit); + __ evprolq(T0, C1, 1, vector_len); + __ vpternlogq(A0 , 0x96, T0, C4, vector_len); + __ vpternlogq(A5 , 0x96, T0, C4, vector_len); + __ vpternlogq(A10, 0x96, T0, C4, vector_len); + __ vpternlogq(A15, 0x96, T0, C4, vector_len); + __ vpternlogq(A20, 0x96, T0, C4, vector_len); - __ evpermt2q(xmm5, xmm31, xmm3, Assembler::AVX_512bit); - __ evpermt2q(xmm6, xmm31, xmm5, Assembler::AVX_512bit); - __ vpternlogq(xmm3, 180, xmm6, xmm5, Assembler::AVX_512bit); + __ evprolq(T0, C2, 1, vector_len); + __ vpternlogq(A1 , 0x96, T0, C0, vector_len); + __ vpternlogq(A6 , 0x96, T0, C0, vector_len); + __ vpternlogq(A11, 0x96, T0, C0, vector_len); + __ vpternlogq(A16, 0x96, T0, C0, vector_len); + __ vpternlogq(A21, 0x96, T0, C0, vector_len); - __ evpermt2q(xmm5, xmm31, xmm4, Assembler::AVX_512bit); - __ evpermt2q(xmm6, xmm31, xmm5, Assembler::AVX_512bit); - __ vpternlogq(xmm4, 180, xmm6, xmm5, Assembler::AVX_512bit); - __ cmpl(roundsLeft, 0); - __ jcc(Assembler::notEqual, rounds24_loop); + __ evprolq(T0, C3, 1, vector_len); + __ vpternlogq(A2 , 0x96, T0, C1, vector_len); + __ vpternlogq(A7 , 0x96, T0, C1, vector_len); + __ vpternlogq(A12, 0x96, T0, C1, vector_len); + __ vpternlogq(A17, 0x96, T0, C1, vector_len); + __ vpternlogq(A22, 0x96, T0, C1, vector_len); + + __ evprolq(T0, C4, 1, vector_len); + __ vpternlogq(A3 , 0x96, T0, C2, vector_len); + __ vpternlogq(A8 , 0x96, T0, C2, vector_len); + __ vpternlogq(A13, 0x96, T0, C2, vector_len); + __ vpternlogq(A18, 0x96, T0, C2, vector_len); + __ vpternlogq(A23, 0x96, T0, C2, vector_len); + + __ evprolq(T0, C0, 1, vector_len); + __ vpternlogq(A4 , 0x96, T0, C3, vector_len); + __ vpternlogq(A9 , 0x96, T0, C3, vector_len); + __ vpternlogq(A14, 0x96, T0, C3, vector_len); + __ vpternlogq(A19, 0x96, T0, C3, vector_len); + __ vpternlogq(A24, 0x96, T0, C3, vector_len); + + // Merged Step mapping Rho (section 3.2.2) and Pi (section 3.2.3) + // long ay = Long.rotateLeft(a10, 3); + // a10 = Long.rotateLeft(a1, 1); + // a1 = Long.rotateLeft(a6, 44); + // a6 = Long.rotateLeft(a9, 20); + // a9 = Long.rotateLeft(a22, 61); + // a22 = Long.rotateLeft(a14, 39); + // a14 = Long.rotateLeft(a20, 18); + // a20 = Long.rotateLeft(a2, 62); + // a2 = Long.rotateLeft(a12, 43); + // a12 = Long.rotateLeft(a13, 25); + // a13 = Long.rotateLeft(a19, 8); + // a19 = Long.rotateLeft(a23, 56); + // a23 = Long.rotateLeft(a15, 41); + // a15 = Long.rotateLeft(a4, 27); + // a4 = Long.rotateLeft(a24, 14); + // a24 = Long.rotateLeft(a21, 2); + // a21 = Long.rotateLeft(a8, 55); + // a8 = Long.rotateLeft(a16, 45); + // a16 = Long.rotateLeft(a5, 36); + // a5 = Long.rotateLeft(a3, 28); + // a3 = Long.rotateLeft(a18, 21); + // a18 = Long.rotateLeft(a17, 15); + // a17 = Long.rotateLeft(a11, 10); + // a11 = Long.rotateLeft(a7, 6); + // a7 = ay; + + __ evprolq(T0, A10, 3, vector_len); + __ evprolq(A10, A1, 1, vector_len); + __ evprolq(A1, A6, 44, vector_len); + __ evprolq(A6, A9, 20, vector_len); + __ evprolq(A9, A22, 61, vector_len); + __ evprolq(A22, A14, 39, vector_len); + __ evprolq(A14, A20, 18, vector_len); + __ evprolq(A20, A2, 62, vector_len); + __ evprolq(A2, A12, 43, vector_len); + __ evprolq(A12, A13, 25, vector_len); + __ evprolq(A13, A19, 8, vector_len); + __ evprolq(A19, A23, 56, vector_len); + __ evprolq(A23, A15, 41, vector_len); + __ evprolq(A15, A4, 27, vector_len); + __ evprolq(A4, A24, 14, vector_len); + __ evprolq(A24, A21, 2, vector_len); + __ evprolq(A21, A8, 55, vector_len); + __ evprolq(A8, A16, 45, vector_len); + __ evprolq(A16, A5, 36, vector_len); + __ evprolq(A5, A3, 28, vector_len); + __ evprolq(A3, A18, 21, vector_len); + __ evprolq(A18, A17, 15, vector_len); + __ evprolq(A17, A11, 10, vector_len); + __ evprolq(A11, A7, 6, vector_len); + __ evmovdquq(A7, T0, vector_len); + + // // Step mapping Chi as defined in section 3.2.4. + // long tmp0 = a0; + // long tmp1 = a1; + // long tmp2 = a2; + // long tmp3 = a3; + // long tmp4 = a4; + // a0 = tmp0 ^ ((~tmp1) & tmp2); + // a1 = tmp1 ^ ((~tmp2) & tmp3); + // a2 = tmp2 ^ ((~tmp3) & tmp4); + // a3 = tmp3 ^ ((~tmp4) & tmp0); + // a4 = tmp4 ^ ((~tmp0) & tmp1); + __ evmovdquq(T0, A0, vector_len); + __ evmovdquq(T1, A1, vector_len); + __ vpternlogq(A0 , 0xD2, A1, A2, vector_len); + __ vpternlogq(A1 , 0xD2, A2, A3, vector_len); + __ vpternlogq(A2 , 0xD2, A3, A4, vector_len); + __ vpternlogq(A3 , 0xD2, A4, T0, vector_len); + __ vpternlogq(A4 , 0xD2, T0, T1, vector_len); + + // Step mapping Iota as defined in section 3.2.5. + // a0 ^= RC_CONSTANTS[ir]; + __ vpbroadcastq(T0, Address(round_consts, roundsLeft, Address::times_8), vector_len); + __ evpxorq(A0, A0, T0, vector_len); + + // tmp0 = a5; tmp1 = a6; tmp2 = a7; tmp3 = a8; tmp4 = a9; + // a5 = tmp0 ^ ((~tmp1) & tmp2); + // a6 = tmp1 ^ ((~tmp2) & tmp3); + // a7 = tmp2 ^ ((~tmp3) & tmp4); + // a8 = tmp3 ^ ((~tmp4) & tmp0); + // a9 = tmp4 ^ ((~tmp0) & tmp1); + __ evmovdquq(T0, A5, vector_len); + __ evmovdquq(T1, A6, vector_len); + __ vpternlogq(A5 , 0xD2, A6, A7, vector_len); + __ vpternlogq(A6 , 0xD2, A7, A8, vector_len); + __ vpternlogq(A7 , 0xD2, A8, A9, vector_len); + __ vpternlogq(A8 , 0xD2, A9, T0, vector_len); + __ vpternlogq(A9 , 0xD2, T0, T1, vector_len); + + // tmp0 = a10; tmp1 = a11; tmp2 = a12; tmp3 = a13; tmp4 = a14; + // a10 = tmp0 ^ ((~tmp1) & tmp2); + // a11 = tmp1 ^ ((~tmp2) & tmp3); + // a12 = tmp2 ^ ((~tmp3) & tmp4); + // a13 = tmp3 ^ ((~tmp4) & tmp0); + // a14 = tmp4 ^ ((~tmp0) & tmp1); + __ evmovdquq(T0, A10, vector_len); + __ evmovdquq(T1, A11, vector_len); + __ vpternlogq(A10 , 0xD2, A11, A12, vector_len); + __ vpternlogq(A11 , 0xD2, A12, A13, vector_len); + __ vpternlogq(A12 , 0xD2, A13, A14, vector_len); + __ vpternlogq(A13 , 0xD2, A14, T0, vector_len); + __ vpternlogq(A14 , 0xD2, T0, T1, vector_len); + + // tmp0 = a15; tmp1 = a16; tmp2 = a17; tmp3 = a18; tmp4 = a19; + // a15 = tmp0 ^ ((~tmp1) & tmp2); + // a16 = tmp1 ^ ((~tmp2) & tmp3); + // a17 = tmp2 ^ ((~tmp3) & tmp4); + // a18 = tmp3 ^ ((~tmp4) & tmp0); + // a19 = tmp4 ^ ((~tmp0) & tmp1); + __ evmovdquq(T0, A15, vector_len); + __ evmovdquq(T1, A16, vector_len); + __ vpternlogq(A15 , 0xD2, A16, A17, vector_len); + __ vpternlogq(A16 , 0xD2, A17, A18, vector_len); + __ vpternlogq(A17 , 0xD2, A18, A19, vector_len); + __ vpternlogq(A18 , 0xD2, A19, T0, vector_len); + __ vpternlogq(A19 , 0xD2, T0, T1, vector_len); + + // tmp0 = a20; tmp1 = a21; tmp2 = a22; tmp3 = a23; tmp4 = a24; + // a20 = tmp0 ^ ((~tmp1) & tmp2); + // a21 = tmp1 ^ ((~tmp2) & tmp3); + // a22 = tmp2 ^ ((~tmp3) & tmp4); + // a23 = tmp3 ^ ((~tmp4) & tmp0); + // a24 = tmp4 ^ ((~tmp0) & tmp1); + __ evmovdquq(T0, A20, vector_len); + __ evmovdquq(T1, A21, vector_len); + __ vpternlogq(A20 , 0xD2, A21, A22, vector_len); + __ vpternlogq(A21 , 0xD2, A22, A23, vector_len); + __ vpternlogq(A22 , 0xD2, A23, A24, vector_len); + __ vpternlogq(A23 , 0xD2, A24, T0, vector_len); + __ vpternlogq(A24 , 0xD2, T0, T1, vector_len); + + __ decrementl(roundsLeft); + __ jcc(Assembler::positive, rounds24_loop); if (multiBlock) { __ addptr(buf, block_size); - __ addl(ofs, block_size); - __ cmpl(ofs, limit); - __ jcc(Assembler::lessEqual, sha3_loop); - __ movq(rax, ofs); // return ofs + __ addl(offset, block_size); + __ cmpl(offset, limit); + __ jcc(Assembler::lessEqual, multi_loop); + __ movq(rax, offset); // return offset } else { __ xorq(rax, rax); // return 0 } - // store the state - for (int i = 0; i < 5; i++) { - __ evmovdquq(Address(state, i * 40), k5, xmm(i), true, Assembler::AVX_512bit); + auto storeState = [=](int disp, XMMRegister X1, XMMRegister X2){ + if (stub_id == StubId::stubgen_quad_keccak_id) { + __ vshufpd(T0, X1, X2, 0b0000, Assembler::AVX_256bit); + __ vshufpd(T1, X1, X2, 0b1111, Assembler::AVX_256bit); + __ vmovdqu(Address(state1, disp), T0, Assembler::AVX_128bit); + __ vmovdqu(Address(state2, disp), T1, Assembler::AVX_128bit); + __ vextracti128(Address(state3, disp), T0, 1); + __ vextracti128(Address(state4, disp), T1, 1); + } else if (stub_id == StubId::stubgen_double_keccak_id) { + __ vshufpd(T0, X1, X2, 0b00, Assembler::AVX_128bit); + __ vshufpd(T1, X1, X2, 0b11, Assembler::AVX_128bit); + __ vmovdqu(Address(state1, disp), T0, Assembler::AVX_128bit); + __ vmovdqu(Address(state2, disp), T1, Assembler::AVX_128bit); + } else { + __ pextrq(Address(state1, disp), X1, 0); + __ pextrq(Address(state1, disp+8), X2, 0); + } + }; + + storeState( 0 * 8, A0, A1); + storeState( 2 * 8, A2, A3); + storeState( 4 * 8, A4, A5); + storeState( 6 * 8, A6, A7); + storeState( 8 * 8, A8, A9); + storeState(10 * 8, A10, A11); + storeState(12 * 8, A12, A13); + storeState(14 * 8, A14, A15); + storeState(16 * 8, A16, A17); + storeState(18 * 8, A18, A19); + storeState(20 * 8, A20, A21); + storeState(22 * 8, A22, A23); + __ pextrq(Address(state1, 24 * 8), A24, 0); + if (stub_id == StubId::stubgen_quad_keccak_id) { + __ pextrq(Address(state2, 24 * 8), A24, 1); + __ vextracti32x4(A24, A24, 1); + __ pextrq(Address(state3, 24 * 8), A24, 0); + __ pextrq(Address(state4, 24 * 8), A24, 1); + } else if (stub_id == StubId::stubgen_double_keccak_id) { + __ pextrq(Address(state2, 24 * 8), A24, 1); } - __ pop_ppx(r14); - __ pop_ppx(r13); - __ pop_ppx(r12); + // Cleanup + // Zero out zmm0-zmm31. + __ vzeroall(); + for (XMMRegister rxmm = xmm16; rxmm->is_valid(); rxmm = rxmm->successor()) { + __ vpxorq(rxmm, rxmm, rxmm, vector_len); + } + + if (!parallelKeccak) { +#ifdef _WIN64 + __ pop_ppx(rdi); +#endif + } __ leave(); // required for proper stackwalking of RuntimeStub frame __ ret(0); - // record the stub entry and end stubgen->store_archive_data(stub_id, start, __ pc()); return start; } -// Inputs: -// c_rarg0 - long[] state0 -// c_rarg1 - long[] state1 +// Inputs (sha3_implCompress|sha3_implCompressMB): +// c_rarg0 - byte[] source+offset +// c_rarg1 - long[] SHA3.state +// c_rarg2 - int block_size +// c_rarg3 - int offset +// c_rarg4 - int limit // -// Performs two keccak() computations in parallel. The steps of the -// two computations are executed interleaved. -static address generate_double_keccak(StubGenerator *stubgen, MacroAssembler *_masm) { - StubId stub_id = StubId::stubgen_double_keccak_id; +// Inputs (double_keccak): +// c_rarg0 - long[] SHA3.state1 +// c_rarg1 - long[] SHA3.state2 +// +// Pseudocode: +// loadStates +// xor(buf, state, blocksize) IF !dualKeccak +// shuffle(state) +// LBL: { +// KECCAK() +// IF multiBlock { +// if (buflen) break; +// buf++, buflen--; +// shuffle(buf) +// xor(buf, state, blocksize) +// goto LBL +// } +// } +// storeStates +// +// KECCAK AVX2 design notes: +// (1) - The algorithm was written to fit into 128-bit LANE +// (i.e. hence parallelKeccak takes full 256bit register) +// (2) - a lot of shuffles are inevitable, since there are not enough registers. +// To save some shuffles, column1-column3 and column2-4 are placed into +// the same 128-bit register. Column 0 is also grouped (by rows). +// This means the SHA3 state fits into 12.5 regisers, leaving 3 registers as +// temporaries. This is mostly sufficient, except for the Theta step, where we +// have to buy two slots on the stack +static address generate_sha3_implCompress_avx2(StubId stub_id, + StubGenerator *stubgen, + MacroAssembler *_masm) { + switch(stub_id) { + case StubId::stubgen_sha3_implCompress_id: + case StubId::stubgen_sha3_implCompressMB_id: + case StubId::stubgen_double_keccak_id: + break; + default: + ShouldNotReachHere(); + } + int entry_count = StubInfo::entry_count(stub_id); assert(entry_count == 1, "sanity check"); address start = stubgen->load_archive_data(stub_id); if (start != nullptr) { return start; } + __ align(CodeEntryAlignment); StubCodeMark mark(stubgen, stub_id); start = __ pc(); - - const Register state0 = c_rarg0; - const Register state1 = c_rarg1; - - const Register permsAndRots = c_rarg2; - const Register round_consts = c_rarg3; - const Register constant2use = r10; - const Register roundsLeft = r11; - - Label rounds24_loop; - __ enter(); - __ lea(permsAndRots, ExternalAddress(permsAndRotsAddr())); - __ lea(round_consts, ExternalAddress(round_constsAddr())); + bool multiBlock = stub_id == StubId::stubgen_sha3_implCompressMB_id; + bool parallelKeccak = stub_id == StubId::stubgen_double_keccak_id; + int vector_len, reg_size; + Register buf, offset, block_size, limit; + Register state1, state2; + Register roundsLeft = r10; + Register round_consts = r11; + Register rotate_consts; - // set up the masks - __ movl(rax, 0x1F); - __ kmovwl(k5, rax); - __ kshiftrwl(k4, k5, 1); - __ kshiftrwl(k3, k5, 2); - __ kshiftrwl(k2, k5, 3); - __ kshiftrwl(k1, k5, 4); - - // load the states - for (int i = 0; i < 5; i++) { - __ evmovdquq(xmm(i), k5, Address(state0, i * 40), false, Assembler::AVX_512bit); + if (parallelKeccak) { + vector_len = Assembler::AVX_256bit; + reg_size = 32; + state1 = c_rarg0; + state2 = c_rarg1; + rotate_consts = r9; + } else { + vector_len = Assembler::AVX_128bit; + reg_size = 16; + buf = c_rarg0; + state1 = c_rarg1; + block_size = c_rarg2; + offset = c_rarg3; + #ifndef _WIN64 + limit = c_rarg4; + #else + limit = rdi; + __ push_ppx(rdi); + __ movptr(limit, Address(rbp, 6 * wordSize)); + #endif + rotate_consts = r12; + __ push_ppx(r12); } - for (int i = 0; i < 5; i++) { - __ evmovdquq(xmm(10 + i), k5, Address(state1, i * 40), false, Assembler::AVX_512bit); + __ push_ppx(rbp); + __ movq(rbp, rsp); + __ andq(rsp, -32); + __ subptr(rsp, reg_size*2); + + // Registers for memory load + // Notice the careful 'missalignment' of pairs. + // This helps XOR for all blocksizes + XMMRegister a0a1, _a2, a3a4; + XMMRegister a5a6, a7a8, _a9; + XMMRegister a10a11, _a12, a13a14; + XMMRegister a15a16, _a17, a18a19; + XMMRegister _a20, a21a22, a23a24; + + // Registers for rounds24 + XMMRegister A0_, A1A3, A2A4; + XMMRegister A5A15, A6A8, A7A9; + XMMRegister A10A20, A11A13, A12A14; + XMMRegister A16A18, A17A19; + XMMRegister A21A23, A22A24; + XMMRegister C0_, C1C3, C2C4; + + XMMRegister T0, T1, T2, T3, T4, tmp1; + + // (Very Careful) Register allocation + a0a1 = A0_ = xmm0; + tmp1 = A1A3 = xmm1; + _a2 = A2A4 = xmm2; + a3a4 = A5A15 = xmm3; + a5a6 = A6A8 = xmm4; + a7a8 = A7A9 = xmm5; + _a9 = A10A20 = xmm6; + a10a11 = A11A13 = xmm7; + _a12 = A12A14 = xmm8; + a13a14 = A16A18 = xmm9; + a15a16 = A17A19 = xmm10; + _a17 = A21A23 = T3 = xmm11; + a18a19 = A22A24 = T4 = xmm12; + _a20 = C0_ = T0 = xmm13; + a21a22 = C1C3 = T1 = xmm14; + a23a24 = C2C4 = T2 = xmm15; + + __ lea(round_consts, ExternalAddress(avx2_round_constsAddr())); + __ lea(rotate_consts, ExternalAddress(avx2_rotate_constsAddr())); + + auto loadState = [=](XMMRegister dst, int disp){ + __ vmovdqu(dst, Address(state1, disp), Assembler::AVX_128bit); + if (parallelKeccak) { + __ vinserti128(dst, dst, Address(state2, disp), 1); + } + }; + // load the state + loadState(a0a1, 0 * 8); + loadState(_a2, 1 * 8); + loadState(a3a4, 3 * 8); + loadState(a5a6, 5 * 8); + loadState(a7a8, 7 * 8); + loadState(_a9, 8 * 8); + loadState(a10a11, 10 * 8); + loadState(_a12, 11 * 8); + loadState(a13a14, 13 * 8); + loadState(a15a16, 15 * 8); + loadState(_a17 , 16 * 8); + loadState(a18a19, 18 * 8); + loadState(_a20 , 19 * 8); + loadState(a21a22, 21 * 8); + loadState(a23a24, 23 * 8); + + if (!parallelKeccak) { + Label buffer_done; + // load input from buffer: 72, 104, 136, 144 or 168 bytes + // i.e. 5+4, 2*5+3, 3*5+2, 3*5+3 or 4*5+1 longs + __ vpxor(a0a1, a0a1, Address(buf, 0 * 8), vector_len); + __ vpxor(_a2, _a2, Address(buf, 1 * 8), vector_len); + __ vpxor(a3a4, a3a4, Address(buf, 3 * 8), vector_len); + __ vpxor(a5a6, a5a6, Address(buf, 5 * 8), vector_len); + __ vpxor(a7a8, a7a8, Address(buf, 7 * 8), vector_len); + __ cmpl(block_size, 72); + __ jcc(Assembler::equal, buffer_done); + __ vpxor(_a9, _a9, Address(buf, 8 * 8), vector_len); + __ vpxor(a10a11, a10a11, Address(buf, 10 * 8), vector_len); + __ vpxor(_a12, _a12, Address(buf, 11 * 8), vector_len); + __ cmpl(block_size, 104); + __ jcc(Assembler::equal, buffer_done); + __ vpxor(a13a14, a13a14, Address(buf, 13 * 8), vector_len); + __ vpxor(a15a16, a15a16, Address(buf, 15 * 8), vector_len); + __ cmpl(block_size, 136); + __ jcc(Assembler::equal, buffer_done); + __ vpxor(_a17, _a17, Address(buf, 16 * 8), vector_len); + __ cmpl(block_size, 144); + __ jcc(Assembler::equal, buffer_done); + __ vpxor(a18a19, a18a19, Address(buf, 18 * 8), vector_len); + __ vpxor(_a20, _a20, Address(buf, 19 * 8), vector_len); + __ BIND(buffer_done); } - // load the permutation and rotation constants - - for (int i = 0; i < 15; i++) { - __ evmovdquq(xmm(17 + i), Address(permsAndRots, i * 64), Assembler::AVX_512bit); - } + // Shuffle state registers for the round24 loop + __ vshufpd( A1A3, a0a1, a3a4, 0b0101, vector_len); + __ vshufpd( A2A4, _a2, a3a4, 0b1111, vector_len); + __ vshufpd( A5A15, a5a6, a15a16, 0b0000, vector_len); + __ vshufpd( A6A8, a5a6, a7a8, 0b1111, vector_len); + __ vshufpd( A7A9, a7a8, _a9, 0b1010, vector_len); + __ vshufpd(A10A20, a10a11, _a20, 0b1010, vector_len); + __ vshufpd(A11A13, a10a11, a13a14, 0b0101, vector_len); + __ vshufpd(A12A14, _a12, a13a14, 0b1111, vector_len); + __ vshufpd(A16A18, a15a16, a18a19, 0b0101, vector_len); + __ vshufpd(A17A19, _a17, a18a19, 0b1111, vector_len); + __ vshufpd(A21A23, a21a22, a23a24, 0b0000, vector_len); + __ vshufpd(A22A24, a21a22, a23a24, 0b1111, vector_len); // there will be 24 keccak rounds - // The same operations as the ones in generate_sha3_implCompress are - // performed, but in parallel for two states: one in regs z0-z5, using z6 - // as the scratch register and the other in z10-z15, using z16 as the - // scratch register. - // The permutation and rotation constants, that are loaded into z17-z31, - // are shared between the two computations. - __ movl(roundsLeft, 24); - // load round_constants base - __ movptr(constant2use, round_consts); - + // also use roundsLeft as index into avx2_round_consts array + __ movl(roundsLeft, 23*4); + Label rounds24_loop; __ align(OptoLoopAlignment); __ BIND(rounds24_loop); - __ subl( roundsLeft, 1); - __ evmovdquw(xmm5, xmm0, Assembler::AVX_512bit); - __ evmovdquw(xmm15, xmm10, Assembler::AVX_512bit); - __ vpternlogq(xmm5, 150, xmm1, xmm2, Assembler::AVX_512bit); - __ vpternlogq(xmm15, 150, xmm11, xmm12, Assembler::AVX_512bit); - __ vpternlogq(xmm5, 150, xmm3, xmm4, Assembler::AVX_512bit); - __ vpternlogq(xmm15, 150, xmm13, xmm14, Assembler::AVX_512bit); - __ evprolq(xmm6, xmm5, 1, Assembler::AVX_512bit); - __ evprolq(xmm16, xmm15, 1, Assembler::AVX_512bit); - __ evpermt2q(xmm5, xmm30, xmm5, Assembler::AVX_512bit); - __ evpermt2q(xmm15, xmm30, xmm15, Assembler::AVX_512bit); - __ evpermt2q(xmm6, xmm31, xmm6, Assembler::AVX_512bit); - __ evpermt2q(xmm16, xmm31, xmm16, Assembler::AVX_512bit); - __ vpternlogq(xmm0, 150, xmm5, xmm6, Assembler::AVX_512bit); - __ vpternlogq(xmm10, 150, xmm15, xmm16, Assembler::AVX_512bit); - __ vpternlogq(xmm1, 150, xmm5, xmm6, Assembler::AVX_512bit); - __ vpternlogq(xmm11, 150, xmm15, xmm16, Assembler::AVX_512bit); - __ vpternlogq(xmm2, 150, xmm5, xmm6, Assembler::AVX_512bit); - __ vpternlogq(xmm12, 150, xmm15, xmm16, Assembler::AVX_512bit); - __ vpternlogq(xmm3, 150, xmm5, xmm6, Assembler::AVX_512bit); - __ vpternlogq(xmm13, 150, xmm15, xmm16, Assembler::AVX_512bit); - __ vpternlogq(xmm4, 150, xmm5, xmm6, Assembler::AVX_512bit); - __ vpternlogq(xmm14, 150, xmm15, xmm16, Assembler::AVX_512bit); - __ evpermt2q(xmm4, xmm17, xmm3, Assembler::AVX_512bit); - __ evpermt2q(xmm14, xmm17, xmm13, Assembler::AVX_512bit); - __ evpermt2q(xmm3, xmm18, xmm2, Assembler::AVX_512bit); - __ evpermt2q(xmm13, xmm18, xmm12, Assembler::AVX_512bit); - __ evpermt2q(xmm2, xmm17, xmm1, Assembler::AVX_512bit); - __ evpermt2q(xmm12, xmm17, xmm11, Assembler::AVX_512bit); - __ evpermt2q(xmm1, xmm19, xmm0, Assembler::AVX_512bit); - __ evpermt2q(xmm11, xmm19, xmm10, Assembler::AVX_512bit); - __ evpermt2q(xmm4, xmm20, xmm2, Assembler::AVX_512bit); - __ evpermt2q(xmm14, xmm20, xmm12, Assembler::AVX_512bit); - __ evprolvq(xmm1, xmm1, xmm27, Assembler::AVX_512bit); - __ evprolvq(xmm11, xmm11, xmm27, Assembler::AVX_512bit); - __ evprolvq(xmm3, xmm3, xmm28, Assembler::AVX_512bit); - __ evprolvq(xmm13, xmm13, xmm28, Assembler::AVX_512bit); - __ evprolvq(xmm4, xmm4, xmm29, Assembler::AVX_512bit); - __ evprolvq(xmm14, xmm14, xmm29, Assembler::AVX_512bit); - __ evmovdquw(xmm2, xmm1, Assembler::AVX_512bit); - __ evmovdquw(xmm12, xmm11, Assembler::AVX_512bit); - __ evmovdquw(xmm5, xmm3, Assembler::AVX_512bit); - __ evmovdquw(xmm15, xmm13, Assembler::AVX_512bit); - __ evpermt2q(xmm0, xmm21, xmm4, Assembler::AVX_512bit); - __ evpermt2q(xmm10, xmm21, xmm14, Assembler::AVX_512bit); - __ evpermt2q(xmm1, xmm22, xmm3, Assembler::AVX_512bit); - __ evpermt2q(xmm11, xmm22, xmm13, Assembler::AVX_512bit); - __ evpermt2q(xmm5, xmm22, xmm2, Assembler::AVX_512bit); - __ evpermt2q(xmm15, xmm22, xmm12, Assembler::AVX_512bit); - __ evmovdquw(xmm3, xmm1, Assembler::AVX_512bit); - __ evmovdquw(xmm13, xmm11, Assembler::AVX_512bit); - __ evmovdquw(xmm2, xmm5, Assembler::AVX_512bit); - __ evmovdquw(xmm12, xmm15, Assembler::AVX_512bit); - __ evpermt2q(xmm1, xmm23, xmm4, Assembler::AVX_512bit); - __ evpermt2q(xmm11, xmm23, xmm14, Assembler::AVX_512bit); - __ evpermt2q(xmm2, xmm24, xmm4, Assembler::AVX_512bit); - __ evpermt2q(xmm12, xmm24, xmm14, Assembler::AVX_512bit); - __ evpermt2q(xmm3, xmm25, xmm4, Assembler::AVX_512bit); - __ evpermt2q(xmm13, xmm25, xmm14, Assembler::AVX_512bit); - __ evpermt2q(xmm4, xmm26, xmm5, Assembler::AVX_512bit); - __ evpermt2q(xmm14, xmm26, xmm15, Assembler::AVX_512bit); + __ vmovdqa(Address(rsp, 0), A21A23, vector_len); + __ vmovdqa(Address(rsp, reg_size), A22A24, vector_len); - __ evpermt2q(xmm5, xmm31, xmm0, Assembler::AVX_512bit); - __ evpermt2q(xmm15, xmm31, xmm10, Assembler::AVX_512bit); - __ evpermt2q(xmm6, xmm31, xmm5, Assembler::AVX_512bit); - __ evpermt2q(xmm16, xmm31, xmm15, Assembler::AVX_512bit); - __ vpternlogq(xmm0, 180, xmm6, xmm5, Assembler::AVX_512bit); - __ vpternlogq(xmm10, 180, xmm16, xmm15, Assembler::AVX_512bit); + // Step mapping Theta as defined in section 3.2.1. + // long c0 = a0^a5^a10^a15^a20; + // long c1 = a1^a6^a11^a16^a21; + // long c2 = a2^a7^a12^a17^a22; + // long c3 = a3^a8^a13^a18^a23; + // long c4 = a4^a9^a14^a19^a24; + __ vpxor( C0_, A5A15, A10A20, vector_len); + __ vpxor(A21A23, A21A23, A16A18, vector_len); + __ vpxor(A22A24, A22A24, A17A19, vector_len); + __ vshufpd(C1C3, C0_, C0_, 0b1111, vector_len); + __ vpxor( C0_, C0_, A0_, vector_len); + __ vpxor( C0_, C0_, C1C3, vector_len); + __ vpxor( C1C3, A1A3, A6A8, vector_len); + __ vpxor( C2C4, A2A4, A7A9, vector_len); + __ vpxor(A21A23, A21A23, A11A13, vector_len); + __ vpxor(A22A24, A22A24, A12A14, vector_len); + __ vpxor( C1C3, C1C3, A21A23, vector_len); + __ vpxor( C2C4, C2C4, A22A24, vector_len); - __ evpermt2q(xmm5, xmm31, xmm1, Assembler::AVX_512bit); - __ evpermt2q(xmm15, xmm31, xmm11, Assembler::AVX_512bit); - __ evpermt2q(xmm6, xmm31, xmm5, Assembler::AVX_512bit); - __ evpermt2q(xmm16, xmm31, xmm15, Assembler::AVX_512bit); - __ vpternlogq(xmm1, 180, xmm6, xmm5, Assembler::AVX_512bit); - __ vpternlogq(xmm11, 180, xmm16, xmm15, Assembler::AVX_512bit); + // long d0 = c4 ^ Long.rotateLeft(c1, 1); + // long d1 = c0 ^ Long.rotateLeft(c2, 1); + // long d2 = c1 ^ Long.rotateLeft(c3, 1); + // long d3 = c2 ^ Long.rotateLeft(c4, 1); + // long d4 = c3 ^ Long.rotateLeft(c0, 1); + // C4_ | C0C2 | C1C3 + // C1_ | C2C4 | C3C0 (rot1) + // -----+--------+------- (xor) + // C0C0 | A21A23 | A22A24 - __ evpxorq(xmm0, k1, xmm0, Address(constant2use, 0), true, Assembler::AVX_512bit); - __ evpxorq(xmm10, k1, xmm10, Address(constant2use, 0), true, Assembler::AVX_512bit); - __ addptr(constant2use, 8); + // Even Column: A22A24 (Overloaded with T4) + __ vshufpd(T3, C1C3, C0_, 0b0101, vector_len); //C3C0 + __ vpsrlq(T4, T3, 63, vector_len); + __ vpsllq(T3, T3, 1, vector_len); + __ vpor(T3, T3, T4, vector_len); + __ vpxor(A22A24/*T4*/, T3, C1C3, vector_len); - __ evpermt2q(xmm5, xmm31, xmm2, Assembler::AVX_512bit); - __ evpermt2q(xmm15, xmm31, xmm12, Assembler::AVX_512bit); - __ evpermt2q(xmm6, xmm31, xmm5, Assembler::AVX_512bit); - __ evpermt2q(xmm16, xmm31, xmm15, Assembler::AVX_512bit); - __ vpternlogq(xmm2, 180, xmm6, xmm5, Assembler::AVX_512bit); - __ vpternlogq(xmm12, 180, xmm16, xmm15, Assembler::AVX_512bit); + // First Column C0C0 + __ vpsllq(T3, C1C3, 1, vector_len); + __ vpsrlq(C1C3, C1C3, 63, vector_len); + __ vpor(C1C3, T3, C1C3, vector_len); // C1_ + __ vshufpd(T3, C2C4, C2C4, 0b1111, vector_len); //C4_ + __ vpxor(C1C3, T3, C1C3, vector_len); - __ evpermt2q(xmm5, xmm31, xmm3, Assembler::AVX_512bit); - __ evpermt2q(xmm15, xmm31, xmm13, Assembler::AVX_512bit); - __ evpermt2q(xmm6, xmm31, xmm5, Assembler::AVX_512bit); - __ evpermt2q(xmm16, xmm31, xmm15, Assembler::AVX_512bit); - __ vpternlogq(xmm3, 180, xmm6, xmm5, Assembler::AVX_512bit); - __ vpternlogq(xmm13, 180, xmm16, xmm15, Assembler::AVX_512bit); - __ evpermt2q(xmm5, xmm31, xmm4, Assembler::AVX_512bit); - __ evpermt2q(xmm15, xmm31, xmm14, Assembler::AVX_512bit); - __ evpermt2q(xmm6, xmm31, xmm5, Assembler::AVX_512bit); - __ evpermt2q(xmm16, xmm31, xmm15, Assembler::AVX_512bit); - __ vpternlogq(xmm4, 180, xmm6, xmm5, Assembler::AVX_512bit); - __ vpternlogq(xmm14, 180, xmm16, xmm15, Assembler::AVX_512bit); - __ cmpl(roundsLeft, 0); - __ jcc(Assembler::notEqual, rounds24_loop); + // Odd Column: A21A23 (Overloaded with T3) + __ vshufpd(C0_, C0_, C2C4, 0b0000, vector_len); //C0C2 + __ vpsllq(T3, C2C4, 1, vector_len); + __ vpsrlq(C2C4, C2C4, 63, vector_len); + __ vpor(C2C4, T3, C2C4, vector_len); // C2C4 + __ vpxor(A21A23/*T3*/, C2C4, C0_, vector_len); - // store the states - for (int i = 0; i < 5; i++) { - __ evmovdquq(Address(state0, i * 40), k5, xmm(i), true, Assembler::AVX_512bit); + __ vshufpd(C0_, C1C3, C1C3, 0b0000, vector_len); //C0C0 + + // a0 ^= d0; a1 ^= d1; a2 ^= d2; a3 ^= d3; a4 ^= d4; + // a5 ^= d0; a6 ^= d1; a7 ^= d2; a8 ^= d3; a9 ^= d4; + // a10 ^= d0; a11 ^= d1; a12 ^= d2; a13 ^= d3; a14 ^= d4; + // a15 ^= d0; a16 ^= d1; a17 ^= d2; a18 ^= d3; a19 ^= d4; + // a20 ^= d0; a21 ^= d1; a22 ^= d2; a23 ^= d3; a24 ^= d4; + __ vpxor( A2A4, A2A4, A22A24, vector_len); + __ vpxor( A7A9, A7A9, A22A24, vector_len); + __ vpxor(A12A14, A12A14, A22A24, vector_len); + __ vpxor(A17A19, A17A19, A22A24, vector_len); + __ vpxor(A22A24, A22A24, Address(rsp, reg_size), vector_len); // Restore A22A24 from stack + + __ vpxor( A1A3, A1A3, A21A23, vector_len); + __ vpxor( A6A8, A6A8, A21A23, vector_len); + __ vpxor(A11A13, A11A13, A21A23, vector_len); + __ vpxor(A16A18, A16A18, A21A23, vector_len); + __ vpxor(A21A23, A21A23, Address(rsp, 0), vector_len); // Restore A21A23 from stack + + __ vpxor( A0_, A0_, C0_, vector_len); + __ vpxor( A5A15, A5A15, C0_, vector_len); + __ vpxor(A10A20, A10A20, C0_, vector_len); + + // Rho and Pi steps + // A0_= a0,0|x A1A3=a6,44|a18,21 A2A4=a12,43|a24,14 + // A5A15=a3,28|a4,27 A6A8=a9,20|a16,45 A7A9= a10,3|a22,61 + // A10A20= a1,1|a2,62 A11A13= a7,6|a19,8 A12A14=a13,25|a20,18 + // A16A18=a5,36|a17,15 A17A19=a11,10|a23,56 + // A21A23=a8,55|a15,41 A22A24=a14,39|a21,2 + auto rotate = [=](XMMRegister dst, int disp){ + __ vpsllvq(T0, dst, Address(rotate_consts, disp*4*8), vector_len); + __ vpsrlvq(dst, dst, Address(rotate_consts, 384 + disp*4*8), vector_len); + __ vpor(dst, T0, dst, vector_len); + }; + + rotate( A1A3, 0); + rotate( A2A4, 1); + rotate( A5A15, 2); + rotate( A6A8, 3); + rotate( A7A9, 4); + rotate(A10A20, 5); + rotate(A11A13, 6); + rotate(A12A14, 7); + rotate(A16A18, 8); + rotate(A17A19, 9); + rotate(A21A23, 10); + rotate(A22A24, 11); + + __ vmovdqu(T0, A22A24, vector_len); + __ vmovdqu(T1, A17A19, vector_len); + __ vmovdqu(T2, A1A3, vector_len); + __ vshufpd(A0_, A0_, A1A3, 0b0000, vector_len); // A0_ = A0A1 + __ vshufpd(A22A24, A12A14, A21A23, 0b0101, vector_len); // A22A24 = a14a21 + __ vshufpd(A17A19, A11A13, A21A23, 0b1010, vector_len); // A17A19 = a11a23 + __ vshufpd(A1A3, A6A8, A16A18, 0b1010, vector_len); // A1A3 = a6a18 + __ vshufpd(A21A23, A6A8, A5A15 , 0b1111, vector_len); // A21A23 = a8a15 + __ vshufpd(A6A8, A7A9, A16A18, 0b0101, vector_len); // A6A8 = a9a16 + __ vshufpd(A16A18, A5A15, T1 /*A17A19*/, 0b0000, vector_len); // A16A18 = a5a17 + __ vshufpd(A5A15, T2 /*A1A3*/, A2A4, 0b1111, vector_len); // A5A15 = a3a4 + __ vmovdqu(T2, A10A20, vector_len); + __ vshufpd(A10A20, A0_/*A0A1*/, A2A4, 0b0101, vector_len); // A10A20 = a1a2 + __ vshufpd(A2A4, A12A14, T0 /*A22A24*/, 0b1010, vector_len); // A2A4 = a12a24 + __ vshufpd(A12A14, A11A13, T2 /*A10A20*/, 0b1111, vector_len); // A12A14 = a13a20 + __ vshufpd(A11A13, A7A9, T1 /*A17A19*/, 0b1010, vector_len); // A11A13 = a7a19 + __ vshufpd(A7A9, T2 /*A10A20*/, T0 /*A22A24*/, 0b0000, vector_len); // A7A9 = a10a22 + + // Chi step - First row + // ^=A0_ A1A3 A2A4 + // ~A1_ A2A4 A3A0 + // &A2_ A3A0 A4A1 + __ vshufpd(T0/*A3A0*/, A1A3, A0_, 0b0101, vector_len); + __ vshufpd(T1/*A4A1*/, A2A4, A1A3, 0b0101, vector_len); + __ vpandn( T2, A2A4, T0/*A3A0*/, vector_len); + __ vpandn( T1, T0/*A3A0*/, T1/*A4A1*/, vector_len); + __ vpandn( T0, A1A3, A2A4, vector_len); + __ vpxor(A2A4, A2A4, T1, vector_len); + __ vpxor(A1A3, A1A3, T2, vector_len); + __ vpxor(A0_, A0_, T0, vector_len); + + // Step mapping Iota as defined in section 3.2.5. + // a0 ^= RC_CONSTANTS[ir]; + __ vpxor(A0_, A0_, Address(round_consts, roundsLeft, Address::times_8), vector_len); + + // Chi step - Second&Fourth, Third&Fifth rows + // ^= X5X15 X6X8 X7X9 X16X18 X17X19 + // ~ X6X16 X7X9 X8X5 X17X19 X18X15 + // & X7X17 X8X5 X9X6 X18X15 X19X16 + auto chi_row_pair = [=](XMMRegister X5X15, XMMRegister X6X8, XMMRegister X7X9, + XMMRegister X16X18, XMMRegister X17X19){ + // X6X8 && X7X9 + __ vshufpd(T0/*X8X5*/, X6X8, X5X15, 0b0101, vector_len); + __ vshufpd(T1/*X9X6*/, X7X9, X6X8, 0b0101, vector_len); + __ vpandn( T2, X7X9, T0/*X8X5*/, vector_len); + __ vpandn( T1, T0/*X8X5*/, T1/*X9X6*/, vector_len); + __ vshufpd(T0/*X6X16*/, X6X8, X16X18, 0b0000, vector_len); + __ vpxor(X6X8, X6X8, T2, vector_len); + __ vshufpd(T2/*X7X17*/, X7X9, X17X19, 0b0000, vector_len); + __ vpxor(X7X9, X7X9, T1, vector_len); + + // X5X15 + __ vpandn( T2, T0/*X6X16*/, T2/*X7X17*/, vector_len); + __ vshufpd(T0/*X18X15*/, X16X18, X5X15, 0b1111, vector_len); + __ vpxor(X5X15, X5X15, T2, vector_len); + + // X16X18 && X17X19 + __ vshufpd(T1/*X19X16*/, X17X19, X16X18, 0b0101, vector_len); + __ vpandn( T2, X17X19, T0/*X18X15*/, vector_len); + __ vpandn( T1, T0/*X18X15*/, T1/*X19X16*/, vector_len); + __ vpxor(X16X18, X16X18, T2, vector_len); + __ vpxor(X17X19, X17X19, T1, vector_len); + }; + + chi_row_pair(A5A15, A6A8, A7A9, A16A18, A17A19); + chi_row_pair(A10A20, A11A13, A12A14, A21A23, A22A24); + + __ decrementl(roundsLeft, 4); + __ jcc(Assembler::positive, rounds24_loop); + + if (multiBlock) { + Label multi_done, block104, block136, block144, block168; + __ movl(roundsLeft, 23*4); + __ addptr(buf, block_size); + __ addl(offset, block_size); + __ cmpl(offset, limit); + __ jcc(Assembler::greater, multi_done); + + auto buf_even_odd = [=](int row, XMMRegister X1X3, XMMRegister X2X4) { + __ vmovdqu(T1, Address(buf, (row*5 + 1) * 8), vector_len); //b1b2 + __ vmovdqu(T2, Address(buf, (row*5 + 3) * 8), vector_len); //b3b4 + __ vshufpd(T0, T1, T2, 0b0000, vector_len); // b1b3 + __ vshufpd(T1, T1, T2, 0b1111, vector_len); // b2b4 + __ vpxor(X1X3, X1X3, T0, vector_len); // A1A3 + __ vpxor(X2X4, X2X4, T1, vector_len); // A2A4 + }; + // First Row + __ vpxor(A0_, A0_, Address(buf, 0 * 8), vector_len); + buf_even_odd(0, A1A3, A2A4); + + { + __ cmpl(block_size, 72); + __ jcc(Assembler::notEqual, block104); + __ vmovdqu(T1, Address(buf, 5 * 8), vector_len); //b5b6 A5A15 A6A8 A7A9 + __ vmovdqu(T2, Address(buf, 7 * 8), vector_len); //b7b8 + __ vshufpd(T0, A5A15, A6A8, 0b0000, vector_len); //A5A6 + __ vpxor(T0, T0, T1, vector_len); //A5A6 + __ vshufpd(T1, A7A9, A6A8, 0b1010, vector_len); //A7A8 + __ vpxor(T1, T1, T2, vector_len); //A7A8 + __ vshufpd(A5A15, T0/*A5A6*/, A5A15, 0b1010, vector_len); + __ vshufpd(A6A8, T0/*A5A6*/, T1/*A7A8*/, 0b1111, vector_len); + __ vshufpd(A7A9, T1/*A7A8*/, A7A9, 0b1010, vector_len); + __ jmp(rounds24_loop); + } + __ BIND(block104); + { + __ cmpl(block_size, 104); + __ jcc(Assembler::notEqual, block136); + __ movq(T0, Address(buf, 5 * 8)); //b5 + __ movq(T1, Address(buf, 10 * 8)); //b10 + __ vshufpd(T0, T0, T1, 0b0000, vector_len); //b5b10 + __ vshufpd(T1, A5A15, A10A20, 0b0000, vector_len); //A5A10 + __ vpxor(T0, T0, T1, vector_len); //A5A10 + __ vshufpd(A5A15, T0/*A5A10*/, A5A15, 0b1010, vector_len); + __ vshufpd(A10A20, T0/*A5A10*/, A10A20, 0b1111, vector_len); + + __ vshufpd(T0, A11A13, A12A14, 0b0000, vector_len); //A11A12 + __ vpxor(T0, T0, Address(buf, 11 * 8), vector_len); //b11b12 + __ vshufpd(A11A13, T0/*A11A12*/, A11A13, 0b1010, vector_len); + __ vshufpd(A12A14, T0/*A11A12*/, A12A14, 0b1111, vector_len); + buf_even_odd(1, A6A8, A7A9); + __ jmp(rounds24_loop); + } + __ BIND(block136); + { + __ cmpl(block_size, 136); + __ jcc(Assembler::notEqual, block144); + __ movq(T0, Address(buf, 5 * 8)); //b5 + __ movq(T1, Address(buf, 10 * 8)); //b10 + __ vmovdqu(T2, Address(buf, 15 * 8), vector_len); //b15b16 + __ vshufpd(T0, T0, T2, 0b0000, vector_len); //b5b15 + __ vpxor(A5A15, A5A15, T0, vector_len); + __ vshufpd(T0, T1, T2, 0b1010, vector_len); //b10b16 + __ vshufpd(T1, A10A20, A16A18, 0b0000, vector_len); //A10A16 + __ vpxor(T1, T1, T0, vector_len); + __ vshufpd(A10A20, T1/*A10A16*/, A10A20, 0b1010, vector_len); + __ vshufpd(A16A18, T1/*A10A16*/, A16A18, 0b1111, vector_len); + buf_even_odd(1, A6A8, A7A9); + buf_even_odd(2, A11A13, A12A14); + __ jmp(rounds24_loop); + } + __ BIND(block144); + { + __ cmpl(block_size, 144); + __ jcc(Assembler::notEqual, block168); + __ movq(T0, Address(buf, 5 * 8)); //b5 + __ movq(T1, Address(buf, 15 * 8)); //b15 + __ vshufpd(T0, T0/*b5*/, T1/*b15*/, 0b0000, vector_len); //b5b15 + __ vpxor(A5A15, A5A15, T0, vector_len); + buf_even_odd(1, A6A8, A7A9); + buf_even_odd(2, A11A13, A12A14); + __ movq(T0, Address(buf, 10 * 8)); //b10 + __ vpxor(A10A20, T0, A10A20, vector_len); + + __ vshufpd(T0, A16A18, A17A19, 0b0000, vector_len); //A16A17 + __ vpxor(T0, T0, Address(buf, 16 * 8), vector_len); //b16b17 + __ vshufpd(A16A18, T0/*A16A17*/, A16A18, 0b1010, vector_len); + __ vshufpd(A17A19, T0/*A16A17*/, A17A19, 0b1111, vector_len); + __ jmp(rounds24_loop); + } + __ BIND(block168); + { + __ movq(T0, Address(buf, 5 * 8)); //A5 + __ movq(T1, Address(buf, 15 * 8)); //A15 + __ vshufpd(T0, T0/*A5*/, T1/*A15*/, 0b0000, vector_len); //A5A15 + __ vpxor(A5A15, A5A15, T0, vector_len); + buf_even_odd(1, A6A8, A7A9); + buf_even_odd(2, A11A13, A12A14); + buf_even_odd(3, A16A18, A17A19); + __ movq(T0, Address(buf, 10 * 8)); //A10 + __ movq(T1, Address(buf, 20 * 8)); //A20 + __ vshufpd(T0, T0/*A10*/, T1/*A20*/, 0b0000, vector_len); //A10A20 + __ vpxor(A10A20, A10A20, T0, vector_len); + __ jmp(rounds24_loop); + } + __ BIND(multi_done); + __ movq(rax, offset); // return offset + } else { + __ xorq(rax, rax); // return 0 } - for (int i = 0; i < 5; i++) { - __ evmovdquq(Address(state1, i * 40), k5, xmm(10 + i), true, Assembler::AVX_512bit); + + // Unshuffle + auto extractState = [=](int disp, XMMRegister src) { + int disp1 = disp; + int disp2 = disp+10; + __ pextrq(Address(state1, disp1 * 8), src, 0); + __ pextrq(Address(state1, disp2 * 8), src, 1); + if (parallelKeccak) { + __ vextracti128(src, src, 1); + __ pextrq(Address(state2, disp1 * 8), src, 0); + __ pextrq(Address(state2, disp2 * 8), src, 1); + } + }; + auto storeState = [=](int disp, XMMRegister X1X3, XMMRegister X2X4){ + XMMRegister X1X2 = T0; + XMMRegister X3X4 = T1; + int disp1 = disp; + int disp2 = disp+2; + __ vpunpcklqdq(X1X2, X1X3, X2X4, Assembler::AVX_256bit); + __ vpunpckhqdq(X3X4, X1X3, X2X4, Assembler::AVX_256bit); + __ vmovdqu(Address(state1, disp1 * 8), X1X2, Assembler::AVX_128bit); + __ vmovdqu(Address(state1, disp2 * 8), X3X4, Assembler::AVX_128bit); + if (parallelKeccak) { + __ vextracti128(Address(state2, disp1 * 8), X1X2, 1); + __ vextracti128(Address(state2, disp2 * 8), X3X4, 1); + } + }; + + __ pextrq(Address(state1, 0 * 8), A0_, 0); + if (parallelKeccak) { + __ vextracti128(A0_, A0_, 1); + __ pextrq(Address(state2, 0 * 8), A0_, 0); + } + storeState(1, A1A3, A2A4); + extractState(5, A5A15); + storeState(6, A6A8, A7A9); + extractState(10, A10A20); + storeState(11, A11A13, A12A14); + storeState(16, A16A18, A17A19); + storeState(21, A21A23, A22A24); + + // Cleanup + // Zero out zmm0-zmm15. + __ vpxor(xmm0, xmm0, xmm0, vector_len); + __ vmovdqa(Address(rsp, 0), xmm0, vector_len); + __ vmovdqa(Address(rsp, reg_size), xmm0, vector_len); + __ vzeroall(); + + __ movq(rsp, rbp); + __ pop_ppx(rbp); + if (!parallelKeccak) { + __ pop_ppx(r12); + #ifdef _WIN64 + __ pop_ppx(rdi); + #endif } __ leave(); // required for proper stackwalking of RuntimeStub frame @@ -516,13 +1152,25 @@ static address generate_double_keccak(StubGenerator *stubgen, MacroAssembler *_m } void StubGenerator::generate_sha3_stubs() { + bool avx512Available = VM_Version::supports_evex() && VM_Version::supports_avx512vlbw(); if (UseSHA3Intrinsics) { - StubRoutines::_sha3_implCompress = - generate_sha3_implCompress(StubId::stubgen_sha3_implCompress_id, this, _masm); - StubRoutines::_double_keccak = - generate_double_keccak(this, _masm); - StubRoutines::_sha3_implCompressMB = - generate_sha3_implCompress(StubId::stubgen_sha3_implCompressMB_id, this, _masm); + if (avx512Available) { + StubRoutines::_sha3_implCompress = + generate_sha3_implCompress_avx512(StubId::stubgen_sha3_implCompress_id, this, _masm); + StubRoutines::_sha3_implCompressMB = + generate_sha3_implCompress_avx512(StubId::stubgen_sha3_implCompressMB_id, this, _masm); + StubRoutines::_double_keccak = + generate_sha3_implCompress_avx512(StubId::stubgen_double_keccak_id, this, _masm); + StubRoutines::_quad_keccak = + generate_sha3_implCompress_avx512(StubId::stubgen_quad_keccak_id, this, _masm); + } else { + StubRoutines::_sha3_implCompress = + generate_sha3_implCompress_avx2(StubId::stubgen_sha3_implCompress_id, this, _masm); + StubRoutines::_double_keccak = + generate_sha3_implCompress_avx2(StubId::stubgen_double_keccak_id, this, _masm); + StubRoutines::_sha3_implCompressMB = + generate_sha3_implCompress_avx2(StubId::stubgen_sha3_implCompressMB_id, this, _masm); + } } } @@ -532,7 +1180,8 @@ void StubGenerator::generate_sha3_stubs() { void StubGenerator::init_AOTAddressTable_sha3(GrowableArray
& external_addresses) { #define ADD(addr) external_addresses.append((address)(addr)); ADD(round_constsAddr()); - ADD(permsAndRotsAddr()); + ADD(avx2_round_constsAddr()); + ADD(avx2_rotate_constsAddr()); #undef ADD } #endif // INCLUDE_CDS diff --git a/src/hotspot/cpu/x86/vm_version_x86.cpp b/src/hotspot/cpu/x86/vm_version_x86.cpp index efb282ce3f2..4cdcb1770bb 100644 --- a/src/hotspot/cpu/x86/vm_version_x86.cpp +++ b/src/hotspot/cpu/x86/vm_version_x86.cpp @@ -1323,7 +1323,8 @@ void VM_Version::get_processor_features() { FLAG_SET_DEFAULT(UseSHA512Intrinsics, false); } - if (UseSHA && supports_evex() && supports_avx512bw()) { + if (UseSHA && ((supports_evex() && supports_avx512vlbw()) || + (EnableX86ECoreOpts && !supports_hybrid()))) { if (FLAG_IS_DEFAULT(UseSHA3Intrinsics)) { FLAG_SET_DEFAULT(UseSHA3Intrinsics, true); } diff --git a/src/hotspot/cpu/x86/x86.ad b/src/hotspot/cpu/x86/x86.ad index db87f81d6c4..ab39692b44b 100644 --- a/src/hotspot/cpu/x86/x86.ad +++ b/src/hotspot/cpu/x86/x86.ad @@ -1742,14 +1742,10 @@ static inline void movfp(MacroAssembler* masm, enum FP_PREC pt, // ja -> b # a // jp -> NaN # NaN // jb -> a # b -// je # -// |-jz -> a | b # a & b -// | -> a # +// je -> a | b # a & b static void emit_fp_min_max(MacroAssembler* masm, XMMRegister dst, - XMMRegister a, XMMRegister b, - XMMRegister xmmt, Register rt, + XMMRegister a, XMMRegister b, Register rt, bool min, enum FP_PREC pt) { - Label nan, zero, below, above, done; emit_fp_ucom(masm, pt, a, b); @@ -1759,31 +1755,26 @@ static void emit_fp_min_max(MacroAssembler* masm, XMMRegister dst, } else { __ jccb(Assembler::above, done); } - __ jccb(Assembler::parity, nan); // PF=1 __ jccb(Assembler::below, below); // CF=1 // equal - __ vpxor(xmmt, xmmt, xmmt, Assembler::AVX_128bit); - emit_fp_ucom(masm, pt, a, xmmt); - - __ jccb(Assembler::equal, zero); - movfp(masm, pt, dst, a, rt); - - __ jmp(done); - - __ bind(zero); + // Using bitwise operations is a low cost way to compute the correct result + // for zero and non-zero inputs in this scenario except for NaN, which is + // handled separately. The mantissa and exponent are valid with either + // bitwise operation. For zero inputs, the sign bit is chosen according to + // whether a minimum or maximum value is required. if (min) { + // Negative sign preserved when available (e.g., min(+0, -0) -> -0) __ vpor(dst, a, b, Assembler::AVX_128bit); } else { + // Positive sign preserved when available (e.g., max(+0, -0) -> +0) __ vpand(dst, a, b, Assembler::AVX_128bit); } - __ jmp(done); __ bind(above); movfp(masm, pt, dst, min ? b : a, rt); - __ jmp(done); __ bind(nan); @@ -7376,18 +7367,18 @@ instruct minmaxF_reg_avx10_2(regF dst, regF a, regF b) ins_pipe( pipe_slow ); %} -instruct minmaxF_reduction_reg_avx10_2(regF dst, regF a, regF b, regF xtmp, rRegI rtmp, rFlagsReg cr) +instruct minmaxF_reduction_reg_avx10_2(regF dst, regF a, regF b, rRegI rtmp, rFlagsReg cr) %{ predicate(VM_Version::supports_avx10_2() && VLoopReductions::is_reduction(n)); match(Set dst (MaxF a b)); match(Set dst (MinF a b)); - effect(USE a, USE b, TEMP xtmp, TEMP rtmp, KILL cr); + effect(USE a, USE b, TEMP rtmp, KILL cr); - format %{ "minmaxF_reduction $dst, $a, $b \t! using $xtmp and $rtmp as TEMP" %} + format %{ "minmaxF_reduction $dst, $a, $b \t! using $rtmp as TEMP" %} ins_encode %{ int opcode = this->ideal_Opcode(); bool min = (opcode == Op_MinF) ? true : false; - emit_fp_min_max(masm, $dst$$XMMRegister, $a$$XMMRegister, $b$$XMMRegister, $xtmp$$XMMRegister, $rtmp$$Register, + emit_fp_min_max(masm, $dst$$XMMRegister, $a$$XMMRegister, $b$$XMMRegister, $rtmp$$Register, min, fp_prec_flt /*pt*/); %} ins_pipe( pipe_slow ); @@ -7412,18 +7403,18 @@ instruct minmaxF_reg(legRegF dst, legRegF a, legRegF b, legRegF tmp, legRegF atm ins_pipe( pipe_slow ); %} -instruct minmaxF_reduction_reg(legRegF dst, legRegF a, legRegF b, legRegF xtmp, rRegI rtmp, rFlagsReg cr) +instruct minmaxF_reduction_reg(legRegF dst, legRegF a, legRegF b, rRegI rtmp, rFlagsReg cr) %{ predicate(!VM_Version::supports_avx10_2() && UseAVX > 0 && VLoopReductions::is_reduction(n)); match(Set dst (MaxF a b)); match(Set dst (MinF a b)); - effect(USE a, USE b, TEMP xtmp, TEMP rtmp, KILL cr); + effect(USE a, USE b, TEMP rtmp, KILL cr); - format %{ "minmaxF_reduction $dst, $a, $b \t!using $xtmp and $rtmp as TEMP" %} + format %{ "minmaxF_reduction $dst, $a, $b \t!using $rtmp as TEMP" %} ins_encode %{ int opcode = this->ideal_Opcode(); bool min = (opcode == Op_MinF) ? true : false; - emit_fp_min_max(masm, $dst$$XMMRegister, $a$$XMMRegister, $b$$XMMRegister, $xtmp$$XMMRegister, $rtmp$$Register, + emit_fp_min_max(masm, $dst$$XMMRegister, $a$$XMMRegister, $b$$XMMRegister, $rtmp$$Register, min, fp_prec_flt /*pt*/); %} ins_pipe( pipe_slow ); @@ -7445,18 +7436,18 @@ instruct minmaxD_reg_avx10_2(regD dst, regD a, regD b) ins_pipe( pipe_slow ); %} -instruct minmaxD_reduction_reg_avx10_2(regD dst, regD a, regD b, regD xtmp, rRegI rtmp, rFlagsReg cr) +instruct minmaxD_reduction_reg_avx10_2(regD dst, regD a, regD b, rRegI rtmp, rFlagsReg cr) %{ predicate(VM_Version::supports_avx10_2() && VLoopReductions::is_reduction(n)); match(Set dst (MaxD a b)); match(Set dst (MinD a b)); - effect(USE a, USE b, TEMP xtmp, TEMP rtmp, KILL cr); + effect(USE a, USE b, TEMP rtmp, KILL cr); - format %{ "minmaxD_reduction $dst, $a, $b \t! using $xtmp and $rtmp as TEMP" %} + format %{ "minmaxD_reduction $dst, $a, $b \t! using $rtmp as TEMP" %} ins_encode %{ int opcode = this->ideal_Opcode(); bool min = (opcode == Op_MinD) ? true : false; - emit_fp_min_max(masm, $dst$$XMMRegister, $a$$XMMRegister, $b$$XMMRegister, $xtmp$$XMMRegister, $rtmp$$Register, + emit_fp_min_max(masm, $dst$$XMMRegister, $a$$XMMRegister, $b$$XMMRegister, $rtmp$$Register, min, fp_prec_dbl /*pt*/); %} ins_pipe( pipe_slow ); @@ -7481,18 +7472,18 @@ instruct minmaxD_reg(legRegD dst, legRegD a, legRegD b, legRegD tmp, legRegD atm ins_pipe( pipe_slow ); %} -instruct minmaxD_reduction_reg(legRegD dst, legRegD a, legRegD b, legRegD xtmp, rRegL rtmp, rFlagsReg cr) +instruct minmaxD_reduction_reg(legRegD dst, legRegD a, legRegD b, rRegL rtmp, rFlagsReg cr) %{ predicate(!VM_Version::supports_avx10_2() && UseAVX > 0 && VLoopReductions::is_reduction(n)); match(Set dst (MaxD a b)); match(Set dst (MinD a b)); - effect(USE a, USE b, TEMP xtmp, TEMP rtmp, KILL cr); + effect(USE a, USE b, TEMP rtmp, KILL cr); - format %{ "minmaxD_reduction $dst, $a, $b \t! using $xtmp and $rtmp as TEMP" %} + format %{ "minmaxD_reduction $dst, $a, $b \t! using $rtmp as TEMP" %} ins_encode %{ int opcode = this->ideal_Opcode(); bool min = (opcode == Op_MinD) ? true : false; - emit_fp_min_max(masm, $dst$$XMMRegister, $a$$XMMRegister, $b$$XMMRegister, $xtmp$$XMMRegister, $rtmp$$Register, + emit_fp_min_max(masm, $dst$$XMMRegister, $a$$XMMRegister, $b$$XMMRegister, $rtmp$$Register, min, fp_prec_dbl /*pt*/); %} ins_pipe( pipe_slow ); diff --git a/src/hotspot/share/classfile/javaClasses.hpp b/src/hotspot/share/classfile/javaClasses.hpp index db7a7d5651b..04673e904de 100644 --- a/src/hotspot/share/classfile/javaClasses.hpp +++ b/src/hotspot/share/classfile/javaClasses.hpp @@ -132,6 +132,7 @@ class java_lang_String : AllStatic { static inline bool is_latin1(oop java_string); static inline bool deduplication_forbidden(oop java_string); static inline bool deduplication_requested(oop java_string); + static inline bool deduplication_requested_or_forbidden(oop java_string); static inline int length(oop java_string); static inline int length(oop java_string, typeArrayOop string_value); static size_t utf8_length(oop java_string); diff --git a/src/hotspot/share/classfile/javaClasses.inline.hpp b/src/hotspot/share/classfile/javaClasses.inline.hpp index 21ad62f8408..7843126c870 100644 --- a/src/hotspot/share/classfile/javaClasses.inline.hpp +++ b/src/hotspot/share/classfile/javaClasses.inline.hpp @@ -91,6 +91,10 @@ bool java_lang_String::deduplication_requested(oop java_string) { return is_flag_set(java_string, _deduplication_requested_mask); } +bool java_lang_String::deduplication_requested_or_forbidden(oop java_string) { + return is_flag_set(java_string, _deduplication_requested_mask | _deduplication_forbidden_mask); +} + void java_lang_String::set_deduplication_forbidden(oop java_string) { test_and_set_flag(java_string, _deduplication_forbidden_mask); } diff --git a/src/hotspot/share/classfile/vmIntrinsics.cpp b/src/hotspot/share/classfile/vmIntrinsics.cpp index f9b12df84ca..cec3586a50b 100644 --- a/src/hotspot/share/classfile/vmIntrinsics.cpp +++ b/src/hotspot/share/classfile/vmIntrinsics.cpp @@ -487,6 +487,7 @@ bool vmIntrinsics::disabled_by_jvm_flags(vmIntrinsics::ID id) { if (!UseSHA512Intrinsics) return true; break; case vmIntrinsics::_double_keccak: + case vmIntrinsics::_quad_keccak: case vmIntrinsics::_sha3_implCompress: if (!UseSHA3Intrinsics) return true; break; diff --git a/src/hotspot/share/classfile/vmIntrinsics.hpp b/src/hotspot/share/classfile/vmIntrinsics.hpp index 3f85fd16b61..de4eea669a1 100644 --- a/src/hotspot/share/classfile/vmIntrinsics.hpp +++ b/src/hotspot/share/classfile/vmIntrinsics.hpp @@ -526,9 +526,12 @@ class methodHandle; \ /* support for sun.security.provider.SHAKE128Parallel */ \ do_class(sun_security_provider_sha3_parallel, "sun/security/provider/SHA3Parallel") \ - do_intrinsic(_double_keccak, sun_security_provider_sha3_parallel, double_keccak_name, double_keccak_signature, F_S) \ + do_intrinsic(_double_keccak, sun_security_provider_sha3_parallel, double_keccak_name, double_keccak_signature, F_S) \ do_name( double_keccak_name, "doubleKeccak") \ do_signature(double_keccak_signature, "([J[J)I") \ + do_intrinsic(_quad_keccak, sun_security_provider_sha3_parallel, quad_keccak_name, quad_keccak_signature, F_S) \ + do_name( quad_keccak_name, "quadKeccak") \ + do_signature(quad_keccak_signature, "([J[J[J[J)I") \ \ /* support for sun.security.provider.DigestBase */ \ do_class(sun_security_provider_digestbase, "sun/security/provider/DigestBase") \ diff --git a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.cpp b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.cpp index 929f3b30afe..07eb653bc94 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.cpp @@ -991,7 +991,7 @@ public: // state is cached, therefore, during concurrent class unloading phase, // we will not touch the metadata of unloading nmethods { - ShenandoahWorkerTimingsTracker timer(_phase, ShenandoahPhaseTimings::CodeCacheRoots, worker_id); + ShenandoahWorkerTimingsTracker timer(_phase, ShenandoahPhaseTimings::CodeCache, worker_id); ShenandoahIsNMethodAliveClosure is_nmethod_alive; _nmethod_itr.nmethods_do(&is_nmethod_alive); } @@ -1004,9 +1004,8 @@ void ShenandoahConcurrentGC::op_weak_roots() { assert(heap->is_concurrent_weak_root_in_progress(), "Only during this phase"); { // Concurrent weak root processing - ShenandoahTimingsTracker t(ShenandoahPhaseTimings::conc_weak_roots_work); - ShenandoahGCWorkerPhase worker_phase(ShenandoahPhaseTimings::conc_weak_roots_work); - ShenandoahConcurrentWeakRootsEvacUpdateTask task(_generation, ShenandoahPhaseTimings::conc_weak_roots_work); + ShenandoahGCWorkerPhase worker_phase(ShenandoahPhaseTimings::conc_weak_roots); + ShenandoahConcurrentWeakRootsEvacUpdateTask task(_generation, ShenandoahPhaseTimings::conc_weak_roots); heap->workers()->run_task(&task); } @@ -1080,7 +1079,7 @@ public: } if (!ShenandoahHeap::heap()->unload_classes()) { - ShenandoahWorkerTimingsTracker timer(_phase, ShenandoahPhaseTimings::CodeCacheRoots, worker_id); + ShenandoahWorkerTimingsTracker timer(_phase, ShenandoahPhaseTimings::CodeCache, worker_id); ShenandoahEvacUpdateCodeCacheClosure cl; _nmethod_itr.nmethods_do(&cl); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp index be0da3e54ba..4db8821399f 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp @@ -36,7 +36,6 @@ #include "gc/shenandoah/shenandoahReferenceProcessor.hpp" #include "gc/shenandoah/shenandoahRootProcessor.inline.hpp" #include "gc/shenandoah/shenandoahScanRemembered.inline.hpp" -#include "gc/shenandoah/shenandoahStringDedup.hpp" #include "gc/shenandoah/shenandoahTaskqueue.inline.hpp" #include "gc/shenandoah/shenandoahUtils.hpp" #include "memory/iterator.inline.hpp" @@ -57,12 +56,9 @@ public: void work(uint worker_id) { ShenandoahConcurrentWorkerSession worker_session(worker_id); - ShenandoahWorkerTimingsTracker timer(ShenandoahPhaseTimings::conc_mark, ShenandoahPhaseTimings::ParallelMark, worker_id, true); + ShenandoahWorkerTimingsTracker timer(ShenandoahPhaseTimings::conc_mark, ShenandoahPhaseTimings::Work, worker_id, true); SuspendibleThreadSetJoiner stsj; - StringDedup::Requests requests; - _cm->mark_loop(worker_id, _terminator, GENERATION, true /*cancellable*/, - ShenandoahStringDedup::is_enabled() ? ENQUEUE_DEDUP : NO_DEDUP, - &requests); + _cm->mark_loop(worker_id, _terminator, GENERATION, true /*cancellable*/); } }; @@ -71,20 +67,19 @@ class ShenandoahFinalMarkingTask : public WorkerTask { private: ShenandoahConcurrentMark* _cm; TaskTerminator* _terminator; - bool _dedup_string; ThreadsClaimTokenScope _threads_claim_token_scope; // needed for Threads::possibly_parallel_threads_do public: - ShenandoahFinalMarkingTask(ShenandoahConcurrentMark* cm, TaskTerminator* terminator, bool dedup_string) : - WorkerTask("Shenandoah Final Mark"), _cm(cm), _terminator(terminator), _dedup_string(dedup_string), + ShenandoahFinalMarkingTask(ShenandoahConcurrentMark* cm, TaskTerminator* terminator) : + WorkerTask("Shenandoah Final Mark"), _cm(cm), _terminator(terminator), _threads_claim_token_scope() { } void work(uint worker_id) { ShenandoahHeap* heap = ShenandoahHeap::heap(); + ShenandoahWorkerTimingsTracker timer(ShenandoahPhaseTimings::finish_mark, ShenandoahPhaseTimings::Work, worker_id, true); ShenandoahParallelWorkerSession worker_session(worker_id); - StringDedup::Requests requests; // First drain remaining SATB buffers. { ShenandoahObjToScanQueue* q = _cm->get_queue(worker_id); @@ -98,9 +93,7 @@ public: ShenandoahFlushSATB tc(satb_mq_set); Threads::possibly_parallel_threads_do(true /* is_par */, &tc); } - _cm->mark_loop(worker_id, _terminator, GENERATION, false /*not cancellable*/, - _dedup_string ? ENQUEUE_DEDUP : NO_DEDUP, - &requests); + _cm->mark_loop(worker_id, _terminator, GENERATION, false /*not cancellable*/); assert(_cm->task_queues()->is_empty(), "Should be empty"); } }; @@ -278,22 +271,22 @@ void ShenandoahConcurrentMark::finish_mark_work() { switch (_generation->type()) { case YOUNG:{ - ShenandoahFinalMarkingTask task(this, &terminator, ShenandoahStringDedup::is_enabled()); + ShenandoahFinalMarkingTask task(this, &terminator); heap->workers()->run_task(&task); break; } case OLD:{ - ShenandoahFinalMarkingTask task(this, &terminator, ShenandoahStringDedup::is_enabled()); + ShenandoahFinalMarkingTask task(this, &terminator); heap->workers()->run_task(&task); break; } case GLOBAL:{ - ShenandoahFinalMarkingTask task(this, &terminator, ShenandoahStringDedup::is_enabled()); + ShenandoahFinalMarkingTask task(this, &terminator); heap->workers()->run_task(&task); break; } case NON_GEN:{ - ShenandoahFinalMarkingTask task(this, &terminator, ShenandoahStringDedup::is_enabled()); + ShenandoahFinalMarkingTask task(this, &terminator); heap->workers()->run_task(&task); break; } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahDegeneratedGC.cpp b/src/hotspot/share/gc/shenandoah/shenandoahDegeneratedGC.cpp index 7be3141a4fa..b2d578c599d 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahDegeneratedGC.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahDegeneratedGC.cpp @@ -347,7 +347,7 @@ void ShenandoahDegenGC::op_reset() { void ShenandoahDegenGC::op_mark() { assert(!_generation->is_concurrent_mark_in_progress(), "Should be reset"); - ShenandoahGCPhase phase(ShenandoahPhaseTimings::degen_gc_stw_mark); + ShenandoahGCPhase phase(ShenandoahPhaseTimings::degen_gc_mark); ShenandoahSTWMark mark(_generation, false /*full gc*/); mark.mark(); } @@ -410,7 +410,7 @@ void ShenandoahDegenGC::op_cleanup_early() { } void ShenandoahDegenGC::op_evacuate() { - ShenandoahGCPhase phase(ShenandoahPhaseTimings::degen_gc_stw_evac); + ShenandoahGCPhase phase(ShenandoahPhaseTimings::degen_gc_evac); ShenandoahHeap::heap()->evacuate_collection_set(_generation, false /* concurrent*/); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahGenerationalHeap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahGenerationalHeap.cpp index 1c1011a03e6..4af2c9b1e5d 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahGenerationalHeap.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahGenerationalHeap.cpp @@ -669,7 +669,7 @@ void ShenandoahGenerationalHeap::coalesce_and_fill_old_regions(bool concurrent) void work(uint worker_id) override { ShenandoahWorkerTimingsTracker timer(_phase, - ShenandoahPhaseTimings::ScanClusters, + ShenandoahPhaseTimings::Work, worker_id, true); ShenandoahHeapRegion* region; while ((region = _regions.next()) != nullptr) { diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp index fb35f5861d8..835b2cf3732 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp @@ -1127,10 +1127,12 @@ public: void work(uint worker_id) { if (_concurrent) { + ShenandoahWorkerTimingsTracker timer(ShenandoahPhaseTimings::conc_evac, ShenandoahPhaseTimings::Work, worker_id, true); ShenandoahConcurrentWorkerSession worker_session(worker_id); SuspendibleThreadSetJoiner stsj; do_work(); } else { + ShenandoahWorkerTimingsTracker timer(ShenandoahPhaseTimings::degen_gc_evac, ShenandoahPhaseTimings::Work, worker_id, true); ShenandoahParallelWorkerSession worker_session(worker_id); do_work(); } @@ -2533,10 +2535,12 @@ public: void work(uint worker_id) { if (CONCURRENT) { + ShenandoahWorkerTimingsTracker timer(ShenandoahPhaseTimings::conc_update_refs, ShenandoahPhaseTimings::Work, worker_id, true); ShenandoahConcurrentWorkerSession worker_session(worker_id); SuspendibleThreadSetJoiner stsj; do_work(worker_id); } else { + ShenandoahWorkerTimingsTracker timer(ShenandoahPhaseTimings::degen_gc_update_refs, ShenandoahPhaseTimings::Work, worker_id, true); ShenandoahParallelWorkerSession worker_session(worker_id); do_work(worker_id); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahMark.cpp b/src/hotspot/share/gc/shenandoah/shenandoahMark.cpp index dfd921fdf0b..a72c557a5fe 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahMark.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahMark.cpp @@ -51,10 +51,11 @@ void ShenandoahMark::end_mark() { ShenandoahMark::ShenandoahMark(ShenandoahGeneration* generation) : _generation(generation), _task_queues(generation->task_queues()), - _old_gen_task_queues(generation->old_gen_task_queues()) { + _old_gen_task_queues(generation->old_gen_task_queues()), + _string_dedup(StringDedup::is_enabled()) { } -template +template void ShenandoahMark::mark_loop_prework(uint w, TaskTerminator *t, StringDedup::Requests* const req, bool update_refs) { ShenandoahObjToScanQueue* q = get_queue(w); ShenandoahObjToScanQueue* old_q = get_old_queue(w); @@ -77,7 +78,7 @@ void ShenandoahMark::mark_loop_prework(uint w, TaskTerminator *t, StringDedup::R heap->flush_liveness_cache(w); } -template +template void ShenandoahMark::mark_loop(uint worker_id, TaskTerminator* terminator, ShenandoahGenerationType generation_type, StringDedup::Requests* const req) { bool update_refs = ShenandoahHeap::heap()->has_forwarded_objects(); @@ -102,35 +103,24 @@ void ShenandoahMark::mark_loop(uint worker_id, TaskTerminator* terminator, } void ShenandoahMark::mark_loop(uint worker_id, TaskTerminator* terminator, ShenandoahGenerationType generation_type, - bool cancellable, StringDedupMode dedup_mode, StringDedup::Requests* const req) { - if (cancellable) { - switch(dedup_mode) { - case NO_DEDUP: - mark_loop(worker_id, terminator, generation_type, req); - break; - case ENQUEUE_DEDUP: - mark_loop(worker_id, terminator, generation_type, req); - break; - case ALWAYS_DEDUP: - mark_loop(worker_id, terminator, generation_type, req); - break; + bool cancellable) { + if (_string_dedup) { + StringDedup::Requests req; + if (cancellable) { + mark_loop(worker_id, terminator, generation_type, &req); + } else { + mark_loop(worker_id, terminator, generation_type, &req); } } else { - switch(dedup_mode) { - case NO_DEDUP: - mark_loop(worker_id, terminator, generation_type, req); - break; - case ENQUEUE_DEDUP: - mark_loop(worker_id, terminator, generation_type, req); - break; - case ALWAYS_DEDUP: - mark_loop(worker_id, terminator, generation_type, req); - break; + if (cancellable) { + mark_loop(worker_id, terminator, generation_type, nullptr); + } else { + mark_loop(worker_id, terminator, generation_type, nullptr); } } } -template +template void ShenandoahMark::mark_loop_work(T* cl, ShenandoahLiveData* live_data, uint worker_id, TaskTerminator *terminator, StringDedup::Requests* const req) { uintx stride = ShenandoahMarkLoopStride; diff --git a/src/hotspot/share/gc/shenandoah/shenandoahMark.hpp b/src/hotspot/share/gc/shenandoah/shenandoahMark.hpp index 951779a2ab6..ee29c76dcaf 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahMark.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahMark.hpp @@ -34,12 +34,6 @@ #include "gc/shenandoah/shenandoahHeap.hpp" #include "gc/shenandoah/shenandoahTaskqueue.hpp" -enum StringDedupMode { - NO_DEDUP, // Do not do anything for String deduplication - ENQUEUE_DEDUP, // Enqueue candidate Strings for deduplication, if meet age threshold - ALWAYS_DEDUP // Enqueue Strings for deduplication -}; - class ShenandoahMarkingContext; // Base class for mark @@ -50,6 +44,7 @@ protected: ShenandoahGeneration* const _generation; ShenandoahObjToScanQueueSet* const _task_queues; ShenandoahObjToScanQueueSet* const _old_gen_task_queues; + bool const _string_dedup; protected: ShenandoahMark(ShenandoahGeneration* generation); @@ -76,7 +71,7 @@ public: private: // ---------- Marking loop and tasks - template + template inline void do_task(ShenandoahObjToScanQueue* q, T* cl, ShenandoahLiveData* live_data, StringDedup::Requests* const req, ShenandoahMarkTask* task, uint worker_id); template @@ -88,10 +83,10 @@ private: template inline void count_liveness(ShenandoahLiveData* live_data, oop obj, Klass* klass, uint worker_id); - template + template void mark_loop_work(T* cl, ShenandoahLiveData* live_data, uint worker_id, TaskTerminator *t, StringDedup::Requests* const req); - template + template void mark_loop_prework(uint worker_id, TaskTerminator *terminator, StringDedup::Requests* const req, bool update_refs); template @@ -104,15 +99,14 @@ private: ShenandoahMarkingContext* const mark_context, bool weak, oop obj); - template - inline void dedup_string(oop obj, StringDedup::Requests* const req); + static inline void dedup_string(oop obj, StringDedup::Requests* const req); protected: - template + template void mark_loop(uint worker_id, TaskTerminator* terminator, ShenandoahGenerationType generation_type, StringDedup::Requests* const req); void mark_loop(uint worker_id, TaskTerminator* terminator, ShenandoahGenerationType generation_type, - bool cancellable, StringDedupMode dedup_mode, StringDedup::Requests* const req); + bool cancellable); }; #endif // SHARE_GC_SHENANDOAH_SHENANDOAHMARK_HPP diff --git a/src/hotspot/share/gc/shenandoah/shenandoahMark.inline.hpp b/src/hotspot/share/gc/shenandoah/shenandoahMark.inline.hpp index 78a3a2e1ca9..71ef99b17ac 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahMark.inline.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahMark.inline.hpp @@ -38,7 +38,6 @@ #include "gc/shenandoah/shenandoahMarkingContext.inline.hpp" #include "gc/shenandoah/shenandoahOldGeneration.hpp" #include "gc/shenandoah/shenandoahScanRemembered.inline.hpp" -#include "gc/shenandoah/shenandoahStringDedup.inline.hpp" #include "gc/shenandoah/shenandoahTaskqueue.inline.hpp" #include "gc/shenandoah/shenandoahUtils.hpp" #include "memory/iterator.inline.hpp" @@ -48,21 +47,7 @@ #include "utilities/devirtualizer.inline.hpp" #include "utilities/powerOfTwo.hpp" -template -void ShenandoahMark::dedup_string(oop obj, StringDedup::Requests* const req) { - if (STRING_DEDUP == ENQUEUE_DEDUP) { - if (ShenandoahStringDedup::is_candidate(obj)) { - req->add(obj); - } - } else if (STRING_DEDUP == ALWAYS_DEDUP) { - if (ShenandoahStringDedup::is_string_candidate(obj) && - !ShenandoahStringDedup::dedup_requested(obj)) { - req->add(obj); - } - } -} - -template +template void ShenandoahMark::do_task(ShenandoahObjToScanQueue* q, T* cl, ShenandoahLiveData* live_data, StringDedup::Requests* const req, ShenandoahMarkTask* task, uint worker_id) { oop obj = task->obj(); @@ -78,13 +63,14 @@ void ShenandoahMark::do_task(ShenandoahObjToScanQueue* q, T* cl, ShenandoahLiveD Klass* klass = obj->klass(); if (klass->is_instance_klass()) { // Case 1: Normal oop, process as usual. + if (STRING_DEDUP && (klass == vmClasses::String_klass())) { + dedup_string(obj, req); + } if (klass->is_stack_chunk_instance_klass()) { // Loom doesn't support mixing of weak marking and strong marking of stack chunks. cl->set_weak(false); } - obj->oop_iterate(cl); - dedup_string(obj, req); } else if (klass->is_objArray_klass()) { // Case 2: Object array instance and no chunk is set. Must be the first // time we visit it, start the chunked processing. @@ -108,6 +94,22 @@ void ShenandoahMark::do_task(ShenandoahObjToScanQueue* q, T* cl, ShenandoahLiveD } } +void ShenandoahMark::dedup_string(oop obj, StringDedup::Requests* const req) { + assert(req != nullptr, "Should be available if dedup is enabled"); + + // Skip if already requested or dedup is forbidden. + // The overwhelming majority of Strings would be filtered here. + // These bits are also sticky, so older Strings would be filtered here too. + if (java_lang_String::deduplication_requested_or_forbidden(obj)) { + return; + } + + // Accept deduplication request. + if (!java_lang_String::test_and_set_deduplication_requested(obj)) { + req->add(obj); + } +} + template inline void ShenandoahMark::count_liveness(ShenandoahLiveData* live_data, oop obj, Klass* klass, uint worker_id) { const ShenandoahHeap* const heap = ShenandoahHeap::heap(); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahOldGeneration.cpp b/src/hotspot/share/gc/shenandoah/shenandoahOldGeneration.cpp index 7337ec316af..73ad316a892 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahOldGeneration.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahOldGeneration.cpp @@ -78,7 +78,7 @@ public: } void work(uint worker_id) override { - ShenandoahWorkerTimingsTracker timer(ShenandoahPhaseTimings::conc_coalesce_and_fill, ShenandoahPhaseTimings::ScanClusters, worker_id); + ShenandoahWorkerTimingsTracker timer(ShenandoahPhaseTimings::conc_coalesce_and_fill, ShenandoahPhaseTimings::Work, worker_id); for (uint region_idx = worker_id; region_idx < _coalesce_and_fill_region_count; region_idx += _nworkers) { ShenandoahHeapRegion* r = _coalesce_and_fill_region_array[region_idx]; if (r->is_humongous()) { diff --git a/src/hotspot/share/gc/shenandoah/shenandoahParallelCleaning.cpp b/src/hotspot/share/gc/shenandoah/shenandoahParallelCleaning.cpp index a7a74f30a4b..bad48225f10 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahParallelCleaning.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahParallelCleaning.cpp @@ -41,14 +41,14 @@ ShenandoahClassUnloadingTask::ShenandoahClassUnloadingTask(ShenandoahPhaseTiming void ShenandoahClassUnloadingTask::work(uint worker_id) { { - ShenandoahWorkerTimingsTracker x(_phase, ShenandoahPhaseTimings::CodeCacheUnload, worker_id); + ShenandoahWorkerTimingsTracker x(_phase, ShenandoahPhaseTimings::CodeCache, worker_id); _code_cache_task.work(worker_id); } // Clean all klasses that were not unloaded. // The weak metadata in klass doesn't need to be // processed if there was no unloading. if (_unloading_occurred) { - ShenandoahWorkerTimingsTracker x(_phase, ShenandoahPhaseTimings::CLDUnlink, worker_id); + ShenandoahWorkerTimingsTracker x(_phase, ShenandoahPhaseTimings::Classes, worker_id); _klass_cleaning_task.work(); } } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahParallelCleaning.inline.hpp b/src/hotspot/share/gc/shenandoah/shenandoahParallelCleaning.inline.hpp index 4403e51b62f..1f21971c63d 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahParallelCleaning.inline.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahParallelCleaning.inline.hpp @@ -54,7 +54,7 @@ ShenandoahParallelWeakRootsCleaningTask::~ShenandoahParallel template void ShenandoahParallelWeakRootsCleaningTask::work(uint worker_id) { { - ShenandoahWorkerTimingsTracker x(_phase, ShenandoahPhaseTimings::VMWeakRoots, worker_id); + ShenandoahWorkerTimingsTracker x(_phase, ShenandoahPhaseTimings::VMWeaks, worker_id); _weak_processing_task.work(worker_id, _is_alive, _keep_alive); } } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.cpp b/src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.cpp index ad12bfc5a89..ca418ab45d4 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.cpp @@ -40,14 +40,19 @@ #define SHENANDOAH_US_WORKER_NOTIME_FORMAT "%3s" #define SHENANDOAH_PARALLELISM_FORMAT "%4.2lf" -#define SHENANDOAH_PHASE_DECLARE_NAME(type, title) \ - title, +#define SHENANDOAH_PHASE_DECLARE_DESC(name, desc, has_worker_phase) desc, +#define SHENANDOAH_PHASE_DECLARE_HAS_WORKER_PHASE(name, desc, has_worker_phase) has_worker_phase, -const char* ShenandoahPhaseTimings::_phase_names[] = { - SHENANDOAH_PHASE_DO(SHENANDOAH_PHASE_DECLARE_NAME) +const char* ShenandoahPhaseTimings::_desc[] = { + SHENANDOAH_PHASE_DO(SHENANDOAH_PHASE_DECLARE_DESC) }; -#undef SHENANDOAH_PHASE_DECLARE_NAME +bool ShenandoahPhaseTimings::_has_worker_phase[] = { + SHENANDOAH_PHASE_DO(SHENANDOAH_PHASE_DECLARE_HAS_WORKER_PHASE) +}; + +#undef SHENANDOAH_PHASE_DECLARE_DESC +#undef SHENANDOAH_PHASE_DECLARE_HAS_WORKER_PHASE ShenandoahPhaseTimings::ShenandoahPhaseTimings(uint max_workers) : _max_workers(max_workers) { @@ -55,22 +60,17 @@ ShenandoahPhaseTimings::ShenandoahPhaseTimings(uint max_workers) : // Initialize everything to sane defaults for (uint i = 0; i < _num_phases; i++) { -#define SHENANDOAH_WORKER_DATA_NULL(type, title) \ _worker_data[i] = nullptr; - SHENANDOAH_PAR_PHASE_DO(,, SHENANDOAH_WORKER_DATA_NULL) -#undef SHENANDOAH_WORKER_DATA_NULL _cycle_data[i] = uninitialized(); } // Then punch in the worker-related data. - // Every worker phase get a bunch of internal objects, except - // the very first slot, which is "" and is not populated. for (uint i = 0; i < _num_phases; i++) { - if (is_worker_phase(Phase(i))) { - int c = 0; -#define SHENANDOAH_WORKER_DATA_INIT(type, title) \ - if (c++ != 0) _worker_data[i + c] = new ShenandoahWorkerData(nullptr, title, _max_workers); - SHENANDOAH_PAR_PHASE_DO(,, SHENANDOAH_WORKER_DATA_INIT) + if (has_worker_phases(Phase(i))) { + int c = i + 1; +#define SHENANDOAH_WORKER_DATA_INIT(name, desc, has_worker_phase) \ + _worker_data[c++] = new ShenandoahWorkerData(nullptr, desc, _max_workers); + SHENANDOAH_WORKER_PHASE_DO(,, SHENANDOAH_WORKER_DATA_INIT) #undef SHENANDOAH_WORKER_DATA_INIT } } @@ -79,59 +79,23 @@ ShenandoahPhaseTimings::ShenandoahPhaseTimings(uint max_workers) : assert(_policy != nullptr, "Can not be null"); } -ShenandoahPhaseTimings::Phase ShenandoahPhaseTimings::worker_par_phase(Phase phase, ParPhase par_phase) { - assert(is_worker_phase(phase), "Phase should accept worker phase times: %s", phase_name(phase)); - Phase p = Phase(phase + 1 + par_phase); - assert(p >= 0 && p < _num_phases, "Out of bound for: %s", phase_name(phase)); +ShenandoahPhaseTimings::Phase ShenandoahPhaseTimings::compute_phase_slot(Phase phase, WorkerPhase worker_phase) { + assert(has_worker_phases(phase), "Phase should accept worker phase times: %s", phase_desc(phase)); + Phase p = Phase(phase + 1 + worker_phase); + assert(p >= 0 && p < _num_phases, "Out of bound for: %s", phase_desc(phase)); return p; } -ShenandoahWorkerData* ShenandoahPhaseTimings::worker_data(Phase phase, ParPhase par_phase) { - Phase p = worker_par_phase(phase, par_phase); +ShenandoahWorkerData* ShenandoahPhaseTimings::worker_data(Phase phase, WorkerPhase worker_phase) { + Phase p = compute_phase_slot(phase, worker_phase); ShenandoahWorkerData* wd = _worker_data[p]; - assert(wd != nullptr, "Counter initialized: %s", phase_name(p)); + assert(wd != nullptr, "Counter initialized: %s", phase_desc(p)); return wd; } -bool ShenandoahPhaseTimings::is_worker_phase(Phase phase) { - assert(phase >= 0 && phase < _num_phases, "Out of bounds"); - switch (phase) { - case init_evac: - case init_scan_rset: - case finish_mark: - case purge_weak_par: - case full_gc_mark: - case full_gc_update_roots: - case full_gc_adjust_roots: - case degen_gc_stw_mark: - case degen_gc_mark: - case degen_gc_update_roots: - case full_gc_weakrefs: - case full_gc_purge_class_unload: - case full_gc_purge_weak_par: - case degen_gc_coalesce_and_fill: - case degen_gc_weakrefs: - case degen_gc_purge_class_unload: - case degen_gc_purge_weak_par: - case heap_iteration_roots: - case conc_mark: - case conc_mark_roots: - case conc_thread_roots: - case conc_weak_roots_work: - case conc_weak_refs: - case conc_strong_roots: - case conc_coalesce_and_fill: - case promote_in_place: - return true; - default: - return false; - } -} - bool ShenandoahPhaseTimings::is_root_work_phase(Phase phase) { switch (phase) { case finish_mark: - case init_evac: case degen_gc_update_roots: case full_gc_mark: case full_gc_update_roots: @@ -147,9 +111,7 @@ void ShenandoahPhaseTimings::set_cycle_data(Phase phase, double time, bool shoul if (should_aggregate) { _cycle_data[phase] = (cycle_data == uninitialized()) ? time : (cycle_data + time); } else { -#ifdef ASSERT - assert(cycle_data == uninitialized(), "Should not be set yet: %s, current value: %lf", phase_name(phase), cycle_data); -#endif + assert(cycle_data == uninitialized(), "Should not be set yet: %s, current value: %lf", phase_desc(phase), cycle_data); _cycle_data[phase] = time; } } @@ -161,38 +123,37 @@ void ShenandoahPhaseTimings::record_phase_time(Phase phase, double time, bool sh } void ShenandoahPhaseTimings::record_workers_start(Phase phase) { - assert(is_worker_phase(phase), "Phase should accept worker phase times: %s", phase_name(phase)); + assert(has_worker_phases(phase), "Phase should accept worker phase times: %s", phase_desc(phase)); // Special case: these phases can enter multiple times, need to reset // their worker data every time. if (phase == heap_iteration_roots) { - for (uint i = 1; i < _num_par_phases; i++) { - worker_data(phase, ParPhase(i))->reset(); + for (uint i = 0; i < _num_par_phases; i++) { + worker_data(phase, WorkerPhase(i))->reset(); } } #ifdef ASSERT - for (uint i = 1; i < _num_par_phases; i++) { - ShenandoahWorkerData* wd = worker_data(phase, ParPhase(i)); + for (uint i = 0; i < _num_par_phases; i++) { + ShenandoahWorkerData* wd = worker_data(phase, WorkerPhase(i)); for (uint c = 0; c < _max_workers; c++) { assert(wd->get(c) == ShenandoahWorkerData::uninitialized(), - "Should not be set: %s", phase_name(worker_par_phase(phase, ParPhase(i)))); + "Should not be set: %s", phase_desc(compute_phase_slot(phase, WorkerPhase(i)))); } } #endif } void ShenandoahPhaseTimings::record_workers_end(Phase phase) { - assert(is_worker_phase(phase), "Phase should accept worker phase times: %s", phase_name(phase)); + assert(has_worker_phases(phase), "Phase should accept worker phase times: %s", phase_desc(phase)); } void ShenandoahPhaseTimings::flush_par_workers_to_cycle() { for (uint pi = 0; pi < _num_phases; pi++) { Phase phase = Phase(pi); - if (is_worker_phase(phase)) { - double sum = uninitialized(); - for (uint i = 1; i < _num_par_phases; i++) { - ShenandoahWorkerData* wd = worker_data(phase, ParPhase(i)); + if (has_worker_phases(phase)) { + for (uint i = 0; i < _num_par_phases; i++) { + ShenandoahWorkerData* wd = worker_data(phase, WorkerPhase(i)); double worker_sum = uninitialized(); for (uint c = 0; c < _max_workers; c++) { double worker_time = wd->get(c); @@ -207,17 +168,8 @@ void ShenandoahPhaseTimings::flush_par_workers_to_cycle() { if (worker_sum != uninitialized()) { // add to each line in phase set_cycle_data(Phase(phase + i + 1), worker_sum); - if (sum == uninitialized()) { - sum = worker_sum; - } else { - sum += worker_sum; - } } } - if (sum != uninitialized()) { - // add to total for phase - set_cycle_data(Phase(phase + 1), sum); - } } } } @@ -237,23 +189,29 @@ void ShenandoahPhaseTimings::flush_cycle_to_global() { void ShenandoahPhaseTimings::print_cycle_on(outputStream* out) const { out->cr(); - out->print_cr("All times are wall-clock times, except per-root-class counters, that are sum over"); - out->print_cr("all workers. Dividing the over the root stage time estimates parallelism."); + out->print_cr(" All times are wall-clock times, except for ones explicitly marked as \"total\", those are"); + out->print_cr(" sum over all workers. Dividing the total over the root stage time estimates parallelism."); out->cr(); for (uint i = 0; i < _num_phases; i++) { double v = _cycle_data[i] * 1000000.0; if (v > 0) { - out->print(SHENANDOAH_PHASE_NAME_FORMAT " " SHENANDOAH_US_TIME_FORMAT " us", _phase_names[i], v); + out->print(SHENANDOAH_PHASE_NAME_FORMAT " " SHENANDOAH_US_TIME_FORMAT " us", _desc[i], v); - if (is_worker_phase(Phase(i))) { - double total = _cycle_data[i + 1] * 1000000.0; + if (has_worker_phases(Phase(i))) { + double total = 0; + for (uint pi = 0; pi < _num_par_phases; pi++) { + uint idx = i + 1 + pi; + if (_cycle_data[idx] != uninitialized()) { + total += _cycle_data[idx]; + } + } if (total > 0) { - out->print(", parallelism: " SHENANDOAH_PARALLELISM_FORMAT "x", total / v); + out->print(" with " SHENANDOAH_PARALLELISM_FORMAT "x parallelism", total * 1000000.0 / v); } } if (_worker_data[i] != nullptr) { - out->print(", workers (us): "); + out->print(" total, per worker: "); for (uint c = 0; c < _max_workers; c++) { double tv = _worker_data[i]->get(c); if (tv != ShenandoahWorkerData::uninitialized()) { @@ -277,8 +235,8 @@ void ShenandoahPhaseTimings::print_global_on(outputStream* out) const { out->print_cr(" \"a\" is average time for each phase, look at levels to see if average makes sense."); out->print_cr(" \"lvls\" are quantiles: 0%% (minimum), 25%%, 50%% (median), 75%%, 100%% (maximum)."); out->cr(); - out->print_cr(" All times are wall-clock times, except per-root-class counters, that are sum over"); - out->print_cr(" all workers. Dividing the over the root stage time estimates parallelism."); + out->print_cr(" All times are wall-clock times, except for ones explicitly marked as \"total\", those are"); + out->print_cr(" sum over all workers. Dividing the total over the root stage time estimates parallelism."); out->cr(); for (uint i = 0; i < _num_phases; i++) { @@ -291,7 +249,7 @@ void ShenandoahPhaseTimings::print_global_on(outputStream* out) const { SHENANDOAH_US_TIME_FORMAT ", " SHENANDOAH_US_TIME_FORMAT ", " SHENANDOAH_US_TIME_FORMAT ")", - _phase_names[i], + _desc[i], _global_data[i].sum(), _global_data[i].avg() * 1000000.0, _global_data[i].num(), @@ -306,21 +264,21 @@ void ShenandoahPhaseTimings::print_global_on(outputStream* out) const { } ShenandoahWorkerTimingsTracker::ShenandoahWorkerTimingsTracker(ShenandoahPhaseTimings::Phase phase, - ShenandoahPhaseTimings::ParPhase par_phase, uint worker_id, bool cumulative) : + ShenandoahPhaseTimings::WorkerPhase worker_phase, uint worker_id, bool cumulative) : _timings(ShenandoahHeap::heap()->phase_timings()), - _phase(phase), _par_phase(par_phase), _worker_id(worker_id) { + _phase(phase), _worker_phase(worker_phase), _worker_id(worker_id) { - assert(_timings->worker_data(_phase, _par_phase)->get(_worker_id) == ShenandoahWorkerData::uninitialized() || cumulative, - "Should not be set yet: %s", ShenandoahPhaseTimings::phase_name(_timings->worker_par_phase(_phase, _par_phase))); + assert(_timings->worker_data(_phase, _worker_phase)->get(_worker_id) == ShenandoahWorkerData::uninitialized() || cumulative, + "Should not be set yet: %s", ShenandoahPhaseTimings::phase_desc(_timings->compute_phase_slot(_phase, _worker_phase))); _start_time = os::elapsedTime(); } ShenandoahWorkerTimingsTracker::~ShenandoahWorkerTimingsTracker() { - _timings->worker_data(_phase, _par_phase)->set_or_add(_worker_id, os::elapsedTime() - _start_time); + _timings->worker_data(_phase, _worker_phase)->set_or_add(_worker_id, os::elapsedTime() - _start_time); if (ShenandoahPhaseTimings::is_root_work_phase(_phase)) { ShenandoahPhaseTimings::Phase root_phase = _phase; - ShenandoahPhaseTimings::Phase cur_phase = _timings->worker_par_phase(root_phase, _par_phase); - _event.commit(GCId::current(), _worker_id, ShenandoahPhaseTimings::phase_name(cur_phase)); + ShenandoahPhaseTimings::Phase cur_phase = _timings->compute_phase_slot(root_phase, _worker_phase); + _event.commit(GCId::current(), _worker_id, ShenandoahPhaseTimings::phase_desc(cur_phase)); } } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.hpp b/src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.hpp index bb21cd5be66..385ab10893c 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.hpp @@ -34,177 +34,171 @@ class ShenandoahCollectorPolicy; class outputStream; -#define SHENANDOAH_PAR_PHASE_DO(CNT_PREFIX, DESC_PREFIX, f) \ - f(CNT_PREFIX ## TotalWork, DESC_PREFIX "") \ - f(CNT_PREFIX ## ThreadRoots, DESC_PREFIX "Thread Roots") \ - f(CNT_PREFIX ## CodeCacheRoots, DESC_PREFIX "Code Cache Roots") \ - f(CNT_PREFIX ## VMStrongRoots, DESC_PREFIX "VM Strong Roots") \ - f(CNT_PREFIX ## VMWeakRoots, DESC_PREFIX "VM Weak Roots") \ - f(CNT_PREFIX ## CLDGRoots, DESC_PREFIX "CLDG Roots") \ - f(CNT_PREFIX ## CodeCacheUnload, DESC_PREFIX "Unload Code Caches") \ - f(CNT_PREFIX ## CLDUnlink, DESC_PREFIX "Unlink CLDs") \ - f(CNT_PREFIX ## WeakRefProc, DESC_PREFIX "Weak References") \ - f(CNT_PREFIX ## ParallelMark, DESC_PREFIX "Parallel Mark") \ - f(CNT_PREFIX ## ScanClusters, DESC_PREFIX "Scan Clusters") \ - // end +#define SHENANDOAH_WORKER_PHASE_DO(NAME_PREFIX, DESC_PREFIX, f) \ + f(NAME_PREFIX ## Work, DESC_PREFIX "Work", false) \ + f(NAME_PREFIX ## Threads, DESC_PREFIX "Threads", false) \ + f(NAME_PREFIX ## CodeCache, DESC_PREFIX "Code Cache", false) \ + f(NAME_PREFIX ## VMStrongs, DESC_PREFIX "VM Strongs", false) \ + f(NAME_PREFIX ## VMWeaks, DESC_PREFIX "VM Weaks", false) \ + f(NAME_PREFIX ## Classes, DESC_PREFIX "Classes", false) \ + // END -#define SHENANDOAH_PHASE_DO(f) \ - f(conc_reset, "Concurrent Reset") \ - f(conc_reset_after_collect, "Concurrent Reset After Collect") \ - f(conc_reset_old, "Concurrent Reset (OLD)") \ - f(init_mark_gross, "Pause Init Mark (G)") \ - f(init_mark, "Pause Init Mark (N)") \ - f(init_mark_verify, " Verify") \ - f(init_manage_tlabs, " Manage TLABs") \ - f(init_swap_rset, " Swap Remembered Set") \ - f(init_transfer_satb, " Transfer Old From SATB") \ - f(init_update_region_states, " Update Region States") \ - f(init_propagate_gc_state, " Propagate GC State") \ - \ - f(init_scan_rset, "Concurrent Scan Remembered Set") \ - SHENANDOAH_PAR_PHASE_DO(init_scan_rset_, " RS: ", f) \ - \ - f(conc_mark_roots, "Concurrent Mark Roots ") \ - SHENANDOAH_PAR_PHASE_DO(conc_mark_roots, " CMR: ", f) \ - f(conc_mark, "Concurrent Marking") \ - SHENANDOAH_PAR_PHASE_DO(conc_mark, " CM: ", f) \ - f(conc_mark_satb_flush, " Flush SATB") \ - \ - f(final_mark_gross, "Pause Final Mark (G)") \ - f(final_mark, "Pause Final Mark (N)") \ - f(final_mark_verify, " Verify") \ - f(finish_mark, " Finish Mark") \ - f(final_mark_propagate_gc_state, " Propagate GC State") \ - SHENANDOAH_PAR_PHASE_DO(finish_mark_, " FM: ", f) \ - f(purge, " System Purge") \ - SHENANDOAH_PAR_PHASE_DO(purge_cu_par_, " CU: ", f) \ - f(purge_weak_par, " Weak Roots") \ - SHENANDOAH_PAR_PHASE_DO(purge_weak_par_, " WR: ", f) \ - f(final_update_region_states, " Update Region States") \ - f(final_manage_labs, " Manage GC/TLABs") \ - f(choose_cset, " Choose Collection Set") \ - f(final_rebuild_freeset, " Rebuild Free Set") \ - f(init_evac, " Initial Evacuation") \ - SHENANDOAH_PAR_PHASE_DO(evac_, " E: ", f) \ - \ - f(conc_thread_roots, "Concurrent Thread Roots") \ - SHENANDOAH_PAR_PHASE_DO(conc_thread_roots_, " CTR: ", f) \ - f(conc_weak_refs, "Concurrent Weak References") \ - SHENANDOAH_PAR_PHASE_DO(conc_weak_refs_, " CWRF: ", f) \ - f(conc_weak_roots, "Concurrent Weak Roots") \ - f(conc_weak_roots_work, " Roots") \ - SHENANDOAH_PAR_PHASE_DO(conc_weak_roots_work_, " CWR: ", f) \ - f(conc_weak_roots_rendezvous, " Rendezvous") \ - f(conc_cleanup_early, "Concurrent Cleanup") \ - f(conc_class_unload, "Concurrent Class Unloading") \ - f(conc_class_unload_unlink, " Unlink Stale") \ - f(conc_class_unload_unlink_sd, " System Dictionary") \ - f(conc_class_unload_unlink_weak_klass, " Weak Class Links") \ - f(conc_class_unload_unlink_code_roots, " Code Roots") \ - f(conc_class_unload_rendezvous, " Rendezvous") \ - f(conc_class_unload_purge, " Purge Unlinked") \ - f(conc_class_unload_purge_coderoots, " Code Roots") \ - f(conc_class_unload_purge_cldg, " CLDG") \ - f(conc_class_unload_purge_ec, " Exception Caches") \ - f(conc_strong_roots, "Concurrent Strong Roots") \ - SHENANDOAH_PAR_PHASE_DO(conc_strong_roots_, " CSR: ", f) \ - f(conc_evac, "Concurrent Evacuation") \ - f(conc_update_card_table, "Concurrent Update Cards") \ - f(conc_final_roots, "Concurrent Final Roots") \ - f(promote_in_place, " Promote Regions") \ - f(final_verify_gross, "Pause Final Verify (G)") \ - f(final_verify, "Pause Final Verify (N)") \ - \ - f(init_update_refs_gross, "Pause Init Update Refs (G)") \ - f(init_update_refs, "Pause Init Update Refs (N)") \ - f(init_update_refs_verify, " Verify") \ - \ - f(conc_update_refs_prepare, "Concurrent Update Refs Prepare") \ - f(conc_update_refs, "Concurrent Update Refs") \ - f(conc_update_thread_roots, "Concurrent Update Thread Roots") \ - \ - f(final_update_refs_gross, "Pause Final Update Refs (G)") \ - f(final_update_refs, "Pause Final Update Refs (N)") \ - f(final_update_refs_verify, " Verify") \ - f(final_update_refs_update_region_states, " Update Region States") \ - f(final_update_refs_transfer_satb, " Transfer Old From SATB") \ - f(final_update_refs_trash_cset, " Trash Collection Set") \ - f(final_update_refs_rebuild_freeset, " Rebuild Free Set") \ - f(final_update_refs_propagate_gc_state, " Propagate GC State") \ - \ - f(conc_cleanup_complete, "Concurrent Cleanup") \ - f(conc_coalesce_and_fill, "Concurrent Coalesce and Fill") \ - SHENANDOAH_PAR_PHASE_DO(conc_coalesce_, " CC&F: ", f) \ - \ - f(degen_gc_gross, "Pause Degenerated GC (G)") \ - f(degen_gc, "Pause Degenerated GC (N)") \ - f(degen_gc_un_self_forward, " Un-Self-Forward") \ - f(degen_gc_stw_mark, " Degen STW Mark") \ - SHENANDOAH_PAR_PHASE_DO(degen_gc_stw_mark_, " DSM: ", f) \ - f(degen_gc_mark, " Degen Mark") \ - SHENANDOAH_PAR_PHASE_DO(degen_gc_mark_, " DM: ", f) \ - f(degen_gc_purge, " System Purge") \ - f(degen_gc_weakrefs, " Weak References") \ - SHENANDOAH_PAR_PHASE_DO(degen_gc_weakrefs_p_, " WRP: ", f) \ - f(degen_gc_purge_class_unload, " Unload Classes") \ - SHENANDOAH_PAR_PHASE_DO(degen_gc_purge_cu_par_, " DCU: ", f) \ - f(degen_gc_purge_weak_par, " Weak Roots") \ - SHENANDOAH_PAR_PHASE_DO(degen_gc_purge_weak_p_, " DWR: ", f) \ - f(degen_gc_purge_cldg, " CLDG") \ - f(degen_gc_final_update_region_states, " Update Region States") \ - f(degen_gc_final_manage_labs, " Manage GC/TLABs") \ - f(degen_gc_choose_cset, " Choose Collection Set") \ - f(degen_gc_final_rebuild_freeset, " Rebuild Free Set") \ - f(degen_gc_stw_evac, " Evacuation") \ - f(degen_gc_init_update_refs_manage_gclabs, " Manage GCLABs") \ - f(degen_gc_update_refs, " Update References") \ - f(degen_gc_final_update_refs_update_region_states," Update Region States") \ - f(degen_gc_final_update_refs_trash_cset, " Trash Collection Set") \ - f(degen_gc_final_update_refs_rebuild_freeset, " Rebuild Free Set") \ - f(degen_gc_update_roots, " Degen Update Roots") \ - SHENANDOAH_PAR_PHASE_DO(degen_gc_update_, " DU: ", f) \ - f(degen_gc_cleanup_complete, " Cleanup") \ - f(degen_gc_promote_regions, " Degen Promote Regions") \ - f(degen_gc_coalesce_and_fill, " Degen Coalesce and Fill") \ - SHENANDOAH_PAR_PHASE_DO(degen_coalesce_, " DC&F", f) \ - f(degen_gc_propagate_gc_state, " Propagate GC State") \ - \ - f(full_gc_gross, "Pause Full GC (G)") \ - f(full_gc, "Pause Full GC (N)") \ - f(full_gc_un_self_forward, " Un-Self-Forward") \ - f(full_gc_heapdump_pre, " Pre Heap Dump") \ - f(full_gc_prepare, " Prepare") \ - f(full_gc_update_roots, " Update Roots") \ - SHENANDOAH_PAR_PHASE_DO(full_gc_update_roots_, " FU: ", f) \ - f(full_gc_mark, " Mark") \ - SHENANDOAH_PAR_PHASE_DO(full_gc_mark_, " FM: ", f) \ - f(full_gc_purge, " System Purge") \ - f(full_gc_weakrefs, " Weak References") \ - SHENANDOAH_PAR_PHASE_DO(full_gc_weakrefs_p_, " WRP: ", f) \ - f(full_gc_purge_class_unload, " Unload Classes") \ - SHENANDOAH_PAR_PHASE_DO(full_gc_purge_cu_par_, " CU: ", f) \ - f(full_gc_purge_weak_par, " Weak Roots") \ - SHENANDOAH_PAR_PHASE_DO(full_gc_purge_weak_p_, " WR: ", f) \ - f(full_gc_purge_cldg, " CLDG") \ - f(full_gc_calculate_addresses, " Calculate Addresses") \ - f(full_gc_calculate_addresses_regular, " Regular Objects") \ - f(full_gc_calculate_addresses_humong, " Humongous Objects") \ - f(full_gc_adjust_pointers, " Adjust Pointers") \ - f(full_gc_adjust_roots, " Adjust Roots") \ - SHENANDOAH_PAR_PHASE_DO(full_gc_adjust_roots_, " FA: ", f) \ - f(full_gc_copy_objects, " Copy Objects") \ - f(full_gc_copy_objects_regular, " Regular Objects") \ - f(full_gc_copy_objects_humong, " Humongous Objects") \ - f(full_gc_recompute_generation_usage, " Recompute generation usage") \ - f(full_gc_copy_objects_reset_complete, " Reset Complete Bitmap") \ - f(full_gc_copy_objects_rebuild, " Rebuild Region Sets") \ - f(full_gc_reconstruct_remembered_set, " Reconstruct Remembered Set") \ - f(full_gc_heapdump_post, " Post Heap Dump") \ - f(full_gc_propagate_gc_state, " Propagate GC State") \ - \ - f(heap_iteration_roots, "Heap Iteration") \ - SHENANDOAH_PAR_PHASE_DO(heap_iteration_roots_, " HI: ", f) \ - // end +#define SHENANDOAH_SIMPLE_PHASE_DEF(f, NAME, DESC) \ + f(NAME, DESC, false) + +#define SHENANDOAH_WORKER_PHASE_DEF(f, NAME_PREFIX, MAIN_DESC, DESC_PREFIX) \ + f(NAME_PREFIX, MAIN_DESC, true) \ + SHENANDOAH_WORKER_PHASE_DO(NAME_PREFIX, DESC_PREFIX, f) + +#define SHENANDOAH_PHASE_DO(f) \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, conc_reset, "Concurrent Reset") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, init_mark_gross, "Pause Init Mark (G)") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, init_mark, "Pause Init Mark (N)") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, init_mark_verify, " Verify") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, init_manage_tlabs, " Manage TLABs") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, init_swap_rset, " Swap Remembered Set") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, init_transfer_satb, " Transfer Old From SATB") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, init_update_region_states, " Update Region States") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, init_propagate_gc_state, " Propagate GC State") \ + SHENANDOAH_WORKER_PHASE_DEF(f, init_scan_rset, "Concurrent Scan Remembered Set", \ + " RS: ") \ + SHENANDOAH_WORKER_PHASE_DEF(f, conc_mark_roots, "Concurrent Mark Roots", \ + " CMR: ") \ + SHENANDOAH_WORKER_PHASE_DEF(f, conc_mark, "Concurrent Marking", \ + " CM: ") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, conc_mark_satb_flush, " Flush SATB") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, final_mark_gross, "Pause Final Mark (G)") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, final_mark, "Pause Final Mark (N)") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, final_mark_verify, " Verify") \ + SHENANDOAH_WORKER_PHASE_DEF(f, finish_mark, " Finish Mark", \ + " FM: ") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, final_mark_propagate_gc_state, " Propagate GC State") \ + SHENANDOAH_WORKER_PHASE_DEF(f, purge, " System Purge", \ + " CU: ") \ + SHENANDOAH_WORKER_PHASE_DEF(f, purge_weak_par, " Weak Roots", \ + " WR: ") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, final_update_region_states, " Update Region States") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, final_manage_labs, " Manage GC/TLABs") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, choose_cset, " Choose Collection Set") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, final_rebuild_freeset, " Rebuild Free Set") \ + SHENANDOAH_WORKER_PHASE_DEF(f, conc_thread_roots, "Concurrent Thread Roots", \ + " CTR: ") \ + SHENANDOAH_WORKER_PHASE_DEF(f, conc_weak_refs, "Concurrent Weak References", \ + " CWRF: ") \ + SHENANDOAH_WORKER_PHASE_DEF(f, conc_weak_roots, "Concurrent Weak Roots", \ + " CWR: ") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, conc_weak_roots_rendezvous, " Rendezvous") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, conc_cleanup_early, "Concurrent Cleanup, Early") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, conc_class_unload, "Concurrent Class Unloading") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, conc_class_unload_unlink, " Unlink Stale") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, conc_class_unload_unlink_sd, " System Dictionary") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, conc_class_unload_unlink_weak_klass, " Weak Class Links") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, conc_class_unload_unlink_code_roots, " Code Roots") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, conc_class_unload_rendezvous, " Rendezvous") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, conc_class_unload_purge, " Purge Unlinked") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, conc_class_unload_purge_coderoots, " Code Roots") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, conc_class_unload_purge_cldg, " CLDG") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, conc_class_unload_purge_ec, " Exception Caches") \ + SHENANDOAH_WORKER_PHASE_DEF(f, conc_strong_roots, "Concurrent Strong Roots", \ + " CSR: ") \ + SHENANDOAH_WORKER_PHASE_DEF(f, conc_evac, "Concurrent Evacuation", \ + " CE: ") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, conc_update_card_table, "Concurrent Update Cards") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, conc_final_roots, "Concurrent Final Roots") \ + SHENANDOAH_WORKER_PHASE_DEF(f, promote_in_place, " Promote Regions", \ + " PIP: ") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, final_verify_gross, "Pause Final Verify (G)") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, final_verify, "Pause Final Verify (N)") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, init_update_refs_gross, "Pause Init Update Refs (G)") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, init_update_refs, "Pause Init Update Refs (N)") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, init_update_refs_verify, " Verify") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, conc_update_refs_prepare, "Concurrent Update Refs Prepare") \ + SHENANDOAH_WORKER_PHASE_DEF(f, conc_update_refs, "Concurrent Update Refs", \ + " CUR: ") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, conc_update_thread_roots, "Concurrent Update Thread Roots") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, final_update_refs_gross, "Pause Final Update Refs (G)") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, final_update_refs, "Pause Final Update Refs (N)") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, final_update_refs_verify, " Verify") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, final_update_refs_update_region_states, " Update Region States") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, final_update_refs_transfer_satb, " Transfer Old From SATB") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, final_update_refs_trash_cset, " Trash Collection Set") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, final_update_refs_rebuild_freeset, " Rebuild Free Set") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, final_update_refs_propagate_gc_state, " Propagate GC State") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, conc_cleanup_complete, "Concurrent Cleanup, Complete") \ + SHENANDOAH_WORKER_PHASE_DEF(f, conc_coalesce_and_fill, "Concurrent Coalesce and Fill", \ + " CC&F: ") \ + \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, degen_gc_gross, "Pause Degenerated GC (G)") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, degen_gc, "Pause Degenerated GC (N)") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, degen_gc_un_self_forward, " Un-Self-Forward") \ + SHENANDOAH_WORKER_PHASE_DEF(f, degen_gc_mark, " Mark", \ + " DM: ") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, degen_gc_purge, " System Purge") \ + SHENANDOAH_WORKER_PHASE_DEF(f, degen_gc_weakrefs, " Weak References", \ + " WRP: ") \ + SHENANDOAH_WORKER_PHASE_DEF(f, degen_gc_purge_class_unload, " Unload Classes", \ + " DCU: ") \ + SHENANDOAH_WORKER_PHASE_DEF(f, degen_gc_purge_weak_par, " Weak Roots", \ + " DWR: ") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, degen_gc_purge_cldg, " CLDG") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, degen_gc_final_update_region_states, " Update Region States") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, degen_gc_final_manage_labs, " Manage GC/TLABs") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, degen_gc_choose_cset, " Choose Collection Set") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, degen_gc_final_rebuild_freeset, " Rebuild Free Set") \ + SHENANDOAH_WORKER_PHASE_DEF(f, degen_gc_evac, " Evacuation", \ + " DE: ") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, degen_gc_init_update_refs_manage_gclabs, " Manage GCLABs") \ + SHENANDOAH_WORKER_PHASE_DEF(f, degen_gc_update_refs, " Update References", \ + " DUR: ") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, degen_gc_final_update_refs_update_region_states, " Update Region States") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, degen_gc_final_update_refs_trash_cset, " Trash Collection Set") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, degen_gc_final_update_refs_rebuild_freeset, " Rebuild Free Set") \ + SHENANDOAH_WORKER_PHASE_DEF(f, degen_gc_update_roots, " Degen Update Roots", \ + " DU: ") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, degen_gc_cleanup_complete, " Cleanup") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, degen_gc_promote_regions, " Degen Promote Regions") \ + SHENANDOAH_WORKER_PHASE_DEF(f, degen_gc_coalesce_and_fill, " Degen Coalesce and Fill", \ + " DC&F") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, degen_gc_propagate_gc_state, " Propagate GC State") \ + \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, full_gc_gross, "Pause Full GC (G)") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, full_gc, "Pause Full GC (N)") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, full_gc_un_self_forward, " Un-Self-Forward") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, full_gc_heapdump_pre, " Pre Heap Dump") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, full_gc_prepare, " Prepare") \ + SHENANDOAH_WORKER_PHASE_DEF(f, full_gc_update_roots, " Update Roots", \ + " FU: ") \ + SHENANDOAH_WORKER_PHASE_DEF(f, full_gc_mark, " Mark", \ + " FM: ") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, full_gc_purge, " System Purge") \ + SHENANDOAH_WORKER_PHASE_DEF(f, full_gc_weakrefs, " Weak References", \ + " WRP: ") \ + SHENANDOAH_WORKER_PHASE_DEF(f, full_gc_purge_class_unload, " Unload Classes", \ + " CU: ") \ + SHENANDOAH_WORKER_PHASE_DEF(f, full_gc_purge_weak_par, " Weak Roots", \ + " WR: ") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, full_gc_purge_cldg, " CLDG") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, full_gc_calculate_addresses, " Calculate Addresses") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, full_gc_calculate_addresses_regular, " Regular Objects") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, full_gc_calculate_addresses_humong, " Humongous Objects") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, full_gc_adjust_pointers, " Adjust Pointers") \ + SHENANDOAH_WORKER_PHASE_DEF(f, full_gc_adjust_roots, " Adjust Roots", \ + " FA: ") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, full_gc_copy_objects, " Copy Objects") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, full_gc_copy_objects_regular, " Regular Objects") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, full_gc_copy_objects_humong, " Humongous Objects") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, full_gc_recompute_generation_usage, " Recompute generation usage") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, full_gc_copy_objects_reset_complete, " Reset Complete Bitmap") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, full_gc_copy_objects_rebuild, " Rebuild Region Sets") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, full_gc_reconstruct_remembered_set, " Reconstruct Remembered Set") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, full_gc_heapdump_post, " Post Heap Dump") \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, full_gc_propagate_gc_state, " Propagate GC State") \ + \ + SHENANDOAH_SIMPLE_PHASE_DEF(f, conc_reset_after_collect, "Concurrent Reset After Collect") \ + \ + SHENANDOAH_WORKER_PHASE_DEF(f, heap_iteration_roots, "Heap Iteration", \ + " HI: ") \ + // END typedef WorkerDataArray ShenandoahWorkerData; @@ -212,7 +206,7 @@ class ShenandoahPhaseTimings : public CHeapObj { friend class ShenandoahGCPhase; friend class ShenandoahWorkerTimingsTracker; public: -#define SHENANDOAH_PHASE_DECLARE_ENUM(type, title) type, +#define SHENANDOAH_PHASE_DECLARE_ENUM(name, desc, has_worker_phase) name, enum Phase { SHENANDOAH_PHASE_DO(SHENANDOAH_PHASE_DECLARE_ENUM) @@ -220,8 +214,8 @@ public: _invalid_phase = _num_phases }; - enum ParPhase { - SHENANDOAH_PAR_PHASE_DO(,, SHENANDOAH_PHASE_DECLARE_ENUM) + enum WorkerPhase { + SHENANDOAH_WORKER_PHASE_DO(,, SHENANDOAH_PHASE_DECLARE_ENUM) _num_par_phases }; @@ -231,16 +225,16 @@ private: uint _max_workers; double _cycle_data[_num_phases]; HdrSeq _global_data[_num_phases]; - static const char* _phase_names[_num_phases]; + static const char* _desc[_num_phases]; + static bool _has_worker_phase[_num_phases]; ShenandoahWorkerData* _worker_data[_num_phases]; ShenandoahCollectorPolicy* _policy; - static bool is_worker_phase(Phase phase); static bool is_root_work_phase(Phase phase); - ShenandoahWorkerData* worker_data(Phase phase, ParPhase par_phase); - Phase worker_par_phase(Phase phase, ParPhase par_phase); + ShenandoahWorkerData* worker_data(Phase phase, WorkerPhase par_phase); + static Phase compute_phase_slot(Phase phase, WorkerPhase worker_phase); void set_cycle_data(Phase phase, double time, bool should_aggregate = false); static double uninitialized() { return -1; } @@ -256,9 +250,14 @@ public: void flush_par_workers_to_cycle(); void flush_cycle_to_global(); - static const char* phase_name(Phase phase) { + static const char* phase_desc(Phase phase) { assert(phase >= 0 && phase < _num_phases, "Out of bounds: %d", phase); - return _phase_names[phase]; + return _desc[phase]; + } + + static bool has_worker_phases(Phase phase) { + assert(phase >= 0 && phase < _num_phases, "Out of bounds: %d", phase); + return _has_worker_phase[phase]; } void print_cycle_on(outputStream* out) const; @@ -269,14 +268,14 @@ class ShenandoahWorkerTimingsTracker : public StackObj { private: ShenandoahPhaseTimings* const _timings; ShenandoahPhaseTimings::Phase const _phase; - ShenandoahPhaseTimings::ParPhase const _par_phase; + ShenandoahPhaseTimings::WorkerPhase const _worker_phase; uint const _worker_id; double _start_time; EventGCPhaseParallel _event; public: ShenandoahWorkerTimingsTracker(ShenandoahPhaseTimings::Phase phase, - ShenandoahPhaseTimings::ParPhase par_phase, + ShenandoahPhaseTimings::WorkerPhase worker_phase, uint worker_id, bool cumulative = false); ~ShenandoahWorkerTimingsTracker(); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahReferenceProcessor.cpp b/src/hotspot/share/gc/shenandoah/shenandoahReferenceProcessor.cpp index 37e9729b7ff..c24735b92cf 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahReferenceProcessor.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahReferenceProcessor.cpp @@ -547,11 +547,11 @@ public: virtual void work(uint worker_id) { if (_concurrent) { ShenandoahConcurrentWorkerSession worker_session(worker_id); - ShenandoahWorkerTimingsTracker x(_phase, ShenandoahPhaseTimings::WeakRefProc, worker_id); + ShenandoahWorkerTimingsTracker x(_phase, ShenandoahPhaseTimings::Work, worker_id); _reference_processor->work(); } else { ShenandoahParallelWorkerSession worker_session(worker_id); - ShenandoahWorkerTimingsTracker x(_phase, ShenandoahPhaseTimings::WeakRefProc, worker_id); + ShenandoahWorkerTimingsTracker x(_phase, ShenandoahPhaseTimings::Work, worker_id); _reference_processor->work(); } } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp b/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp index 80825ac43ad..91f6f605a84 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp @@ -49,7 +49,7 @@ uint ShenandoahJavaThreadsIterator::claim() { } void ShenandoahJavaThreadsIterator::threads_do(ThreadClosure* cl, uint worker_id) { - ShenandoahWorkerTimingsTracker timer(_phase, ShenandoahPhaseTimings::ThreadRoots, worker_id); + ShenandoahWorkerTimingsTracker timer(_phase, ShenandoahPhaseTimings::Threads, worker_id); for (uint i = claim(); i < _length; i = claim()) { for (uint t = i; t < MIN2(_length, i + _stride); t++) { cl->do_thread(thread_at(t)); @@ -63,13 +63,13 @@ ShenandoahThreadRoots::ShenandoahThreadRoots(ShenandoahPhaseTimings::Phase phase _threads_claim_token_scope() {} void ShenandoahThreadRoots::oops_do(OopClosure* oops_cl, NMethodClosure* code_cl, uint worker_id) { - ShenandoahWorkerTimingsTracker timer(_phase, ShenandoahPhaseTimings::ThreadRoots, worker_id); + ShenandoahWorkerTimingsTracker timer(_phase, ShenandoahPhaseTimings::Threads, worker_id); ResourceMark rm; Threads::possibly_parallel_oops_do(_is_par, oops_cl, code_cl); } void ShenandoahThreadRoots::threads_do(ThreadClosure* tc, uint worker_id) { - ShenandoahWorkerTimingsTracker timer(_phase, ShenandoahPhaseTimings::ThreadRoots, worker_id); + ShenandoahWorkerTimingsTracker timer(_phase, ShenandoahPhaseTimings::Threads, worker_id); ResourceMark rm; Threads::possibly_parallel_threads_do(_is_par, tc); } @@ -78,7 +78,7 @@ ShenandoahCodeCacheRoots::ShenandoahCodeCacheRoots(ShenandoahPhaseTimings::Phase } void ShenandoahCodeCacheRoots::nmethods_do(NMethodClosure* nmethod_cl, uint worker_id) { - ShenandoahWorkerTimingsTracker timer(_phase, ShenandoahPhaseTimings::CodeCacheRoots, worker_id); + ShenandoahWorkerTimingsTracker timer(_phase, ShenandoahPhaseTimings::CodeCache, worker_id); _coderoots_iterator.possibly_parallel_nmethods_do(nmethod_cl); } @@ -153,7 +153,7 @@ void ShenandoahConcurrentRootScanner::roots_do(OopClosure* oops, uint worker_id) _cld_roots.cld_do(&clds_cl, worker_id); { - ShenandoahWorkerTimingsTracker timer(_phase, ShenandoahPhaseTimings::CodeCacheRoots, worker_id); + ShenandoahWorkerTimingsTracker timer(_phase, ShenandoahPhaseTimings::CodeCache, worker_id); NMethodToOopClosure nmethods(oops, !NMethodToOopClosure::FixRelocations); _codecache_snapshot->parallel_nmethods_do(&nmethods); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.inline.hpp b/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.inline.hpp index a62f1c7fd66..4694a1e0519 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.inline.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.inline.hpp @@ -46,7 +46,7 @@ ShenandoahVMWeakRoots::ShenandoahVMWeakRoots(ShenandoahPhaseTimings: template template void ShenandoahVMWeakRoots::oops_do(T* cl, uint worker_id) { - ShenandoahWorkerTimingsTracker timer(_phase, ShenandoahPhaseTimings::VMWeakRoots, worker_id); + ShenandoahWorkerTimingsTracker timer(_phase, ShenandoahPhaseTimings::VMWeaks, worker_id); _weak_roots.oops_do(cl); } @@ -54,7 +54,7 @@ template template void ShenandoahVMWeakRoots::weak_oops_do(IsAlive* is_alive, KeepAlive* keep_alive, uint worker_id) { ShenandoahCleanUpdateWeakOopsClosure cl(is_alive, keep_alive); - ShenandoahWorkerTimingsTracker timer(_phase, ShenandoahPhaseTimings::VMWeakRoots, worker_id); + ShenandoahWorkerTimingsTracker timer(_phase, ShenandoahPhaseTimings::VMWeaks, worker_id); _weak_roots.oops_do(&cl); } @@ -71,7 +71,7 @@ ShenandoahVMRoots::ShenandoahVMRoots(ShenandoahPhaseTimings::Phase p template template void ShenandoahVMRoots::oops_do(T* cl, uint worker_id) { - ShenandoahWorkerTimingsTracker timer(_phase, ShenandoahPhaseTimings::VMStrongRoots, worker_id); + ShenandoahWorkerTimingsTracker timer(_phase, ShenandoahPhaseTimings::VMStrongs, worker_id); _strong_roots.oops_do(cl); } @@ -104,12 +104,12 @@ template void ShenandoahClassLoaderDataRoots::cld_do_impl(CldDo f, CLDClosure* clds, uint worker_id) { if (CONCURRENT) { if (_semaphore.try_acquire()) { - ShenandoahWorkerTimingsTracker timer(_phase, ShenandoahPhaseTimings::CLDGRoots, worker_id); + ShenandoahWorkerTimingsTracker timer(_phase, ShenandoahPhaseTimings::Classes, worker_id); f(clds); _semaphore.claim_all(); } } else { - ShenandoahWorkerTimingsTracker timer(_phase, ShenandoahPhaseTimings::CLDGRoots, worker_id); + ShenandoahWorkerTimingsTracker timer(_phase, ShenandoahPhaseTimings::Classes, worker_id); f(clds); } } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahRootVerifier.cpp b/src/hotspot/share/gc/shenandoah/shenandoahRootVerifier.cpp index 23edc780e47..c678760faf6 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahRootVerifier.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahRootVerifier.cpp @@ -36,7 +36,6 @@ #include "gc/shenandoah/shenandoahPhaseTimings.hpp" #include "gc/shenandoah/shenandoahRootVerifier.hpp" #include "gc/shenandoah/shenandoahScanRemembered.inline.hpp" -#include "gc/shenandoah/shenandoahStringDedup.hpp" #include "gc/shenandoah/shenandoahUtils.hpp" #include "runtime/javaThread.hpp" #include "runtime/jniHandles.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahSTWMark.cpp b/src/hotspot/share/gc/shenandoah/shenandoahSTWMark.cpp index 73935ed4e91..18fdfff125d 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahSTWMark.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahSTWMark.cpp @@ -63,7 +63,7 @@ void ShenandoahSTWMarkTask::work(uint worker_id) { ShenandoahSTWMark::ShenandoahSTWMark(ShenandoahGeneration* generation, bool full_gc) : ShenandoahMark(generation), - _root_scanner(full_gc ? ShenandoahPhaseTimings::full_gc_mark : ShenandoahPhaseTimings::degen_gc_stw_mark), + _root_scanner(full_gc ? ShenandoahPhaseTimings::full_gc_mark : ShenandoahPhaseTimings::degen_gc_mark), _terminator(ShenandoahHeap::heap()->workers()->active_workers(), task_queues()), _full_gc(full_gc) { assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Must be at a Shenandoah safepoint"); @@ -151,10 +151,8 @@ void ShenandoahSTWMark::mark_roots(uint worker_id) { } void ShenandoahSTWMark::finish_mark(uint worker_id) { - ShenandoahPhaseTimings::Phase phase = _full_gc ? ShenandoahPhaseTimings::full_gc_mark : ShenandoahPhaseTimings::degen_gc_stw_mark; - ShenandoahWorkerTimingsTracker timer(phase, ShenandoahPhaseTimings::ParallelMark, worker_id); - StringDedup::Requests requests; + ShenandoahPhaseTimings::Phase phase = _full_gc ? ShenandoahPhaseTimings::full_gc_mark : ShenandoahPhaseTimings::degen_gc_mark; + ShenandoahWorkerTimingsTracker timer(phase, ShenandoahPhaseTimings::Work, worker_id); - mark_loop(worker_id, &_terminator, _generation->type(), false /* not cancellable */, - ShenandoahStringDedup::is_enabled() ? ALWAYS_DEDUP : NO_DEDUP, &requests); + mark_loop(worker_id, &_terminator, _generation->type(), false /* not cancellable */); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahScanRemembered.cpp b/src/hotspot/share/gc/shenandoah/shenandoahScanRemembered.cpp index 7ae148a7144..c3a82b987e2 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahScanRemembered.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahScanRemembered.cpp @@ -808,7 +808,7 @@ void ShenandoahScanRememberedTask::work(uint worker_id) { } void ShenandoahScanRememberedTask::do_work(uint worker_id) { - ShenandoahWorkerTimingsTracker x(ShenandoahPhaseTimings::init_scan_rset, ShenandoahPhaseTimings::ScanClusters, worker_id); + ShenandoahWorkerTimingsTracker x(ShenandoahPhaseTimings::init_scan_rset, ShenandoahPhaseTimings::Work, worker_id); ShenandoahObjToScanQueue* q = _queue_set->queue(worker_id); ShenandoahObjToScanQueue* old = _old_queue_set == nullptr ? nullptr : _old_queue_set->queue(worker_id); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahStringDedup.inline.hpp b/src/hotspot/share/gc/shenandoah/shenandoahStringDedup.inline.hpp deleted file mode 100644 index 1559dd81849..00000000000 --- a/src/hotspot/share/gc/shenandoah/shenandoahStringDedup.inline.hpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2019, 2021, Red Hat, Inc. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -#ifndef SHARE_GC_SHENANDOAH_SHENANDOAHSTRINGDEDUP_INLINE_HPP -#define SHARE_GC_SHENANDOAH_SHENANDOAHSTRINGDEDUP_INLINE_HPP - -#include "gc/shenandoah/shenandoahStringDedup.hpp" - -#include "classfile/javaClasses.inline.hpp" -#include "gc/shenandoah/shenandoahHeap.inline.hpp" -#include "oops/markWord.hpp" - -bool ShenandoahStringDedup::is_string_candidate(oop obj) { - assert(Thread::current()->is_Worker_thread(), - "Only from a GC worker thread"); - return java_lang_String::is_instance(obj) && - java_lang_String::value(obj) != nullptr; -} - -bool ShenandoahStringDedup::dedup_requested(oop obj) { - return java_lang_String::test_and_set_deduplication_requested(obj); -} - -bool ShenandoahStringDedup::is_candidate(oop obj) { - if (!is_string_candidate(obj)) { - return false; - } - - uint age = ShenandoahHeap::get_object_age(obj); - return (age <= markWord::max_age) && - StringDedup::is_below_threshold_age(age) && - !dedup_requested(obj); -} - -#endif // SHARE_GC_SHENANDOAH_SHENANDOAHSTRINGDEDUP_INLINE_HPP diff --git a/src/hotspot/share/gc/shenandoah/shenandoahUtils.cpp b/src/hotspot/share/gc/shenandoah/shenandoahUtils.cpp index ac6c826a3f2..c4204d852d5 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahUtils.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahUtils.cpp @@ -143,7 +143,7 @@ bool ShenandoahTimingsTracker::is_current_phase_valid() { ShenandoahGCPhase::ShenandoahGCPhase(ShenandoahPhaseTimings::Phase phase) : ShenandoahTimingsTracker(phase), _timer(ShenandoahHeap::heap()->gc_timer()) { - _timer->register_gc_phase_start(ShenandoahPhaseTimings::phase_name(phase), Ticks::now()); + _timer->register_gc_phase_start(ShenandoahPhaseTimings::phase_desc(phase), Ticks::now()); } ShenandoahGCPhase::~ShenandoahGCPhase() { @@ -164,9 +164,9 @@ ShenandoahWorkerSession::ShenandoahWorkerSession(uint worker_id) { } ShenandoahConcurrentWorkerSession::~ShenandoahConcurrentWorkerSession() { - _event.commit(GCId::current(), ShenandoahPhaseTimings::phase_name(ShenandoahGCPhase::current_phase())); + _event.commit(GCId::current(), ShenandoahPhaseTimings::phase_desc(ShenandoahGCPhase::current_phase())); } ShenandoahParallelWorkerSession::~ShenandoahParallelWorkerSession() { - _event.commit(GCId::current(), WorkerThread::worker_id(), ShenandoahPhaseTimings::phase_name(ShenandoahGCPhase::current_phase())); + _event.commit(GCId::current(), WorkerThread::worker_id(), ShenandoahPhaseTimings::phase_desc(ShenandoahGCPhase::current_phase())); } diff --git a/src/hotspot/share/opto/c2compiler.cpp b/src/hotspot/share/opto/c2compiler.cpp index fe4a7f8a5db..2f48fffcaa2 100644 --- a/src/hotspot/share/opto/c2compiler.cpp +++ b/src/hotspot/share/opto/c2compiler.cpp @@ -792,6 +792,7 @@ bool C2Compiler::is_intrinsic_supported(vmIntrinsics::ID id) { case vmIntrinsics::_sha5_implCompress: case vmIntrinsics::_sha3_implCompress: case vmIntrinsics::_double_keccak: + case vmIntrinsics::_quad_keccak: case vmIntrinsics::_digestBase_implCompressMB: case vmIntrinsics::_multiplyToLen: case vmIntrinsics::_squareToLen: diff --git a/src/hotspot/share/opto/escape.cpp b/src/hotspot/share/opto/escape.cpp index 22acbf1c53e..49e59c70c47 100644 --- a/src/hotspot/share/opto/escape.cpp +++ b/src/hotspot/share/opto/escape.cpp @@ -505,19 +505,19 @@ bool ConnectionGraph::can_reduce_phi_check_inputs(PhiNode* ophi) const { // We can reduce the Cmp if it's a comparison between the Phi and a constant. // I require the 'other' input to be a constant so that I can move the Cmp // around safely. -bool ConnectionGraph::can_reduce_cmp(Node* n, Node* cmp) const { +bool ConnectionGraph::can_reduce_cmp(PhiNode* phi, Node* cmp) const { assert(cmp->Opcode() == Op_CmpP || cmp->Opcode() == Op_CmpN, "not expected node: %s", cmp->Name()); Node* left = cmp->in(1); Node* right = cmp->in(2); - return (left == n || right == n) && + return (left == phi || right == phi) && (left->is_Con() || right->is_Con()) && cmp->outcnt() == 1; } // We are going to check if any of the SafePointScalarMerge entries // in the SafePoint reference the Phi that we are checking. -bool ConnectionGraph::has_been_reduced(PhiNode* n, SafePointNode* sfpt) const { +bool ConnectionGraph::has_been_reduced(PhiNode* phi, SafePointNode* sfpt) const { JVMState *jvms = sfpt->jvms(); for (uint i = jvms->debug_start(); i < jvms->debug_end(); i++) { @@ -525,7 +525,7 @@ bool ConnectionGraph::has_been_reduced(PhiNode* n, SafePointNode* sfpt) const { if (sfpt_in->is_SafePointScalarMerge()) { SafePointScalarMergeNode* smerge = sfpt_in->as_SafePointScalarMerge(); Node* nsr_ptr = sfpt->in(smerge->merge_pointer_idx(jvms)); - if (nsr_ptr == n) { + if (nsr_ptr == phi) { return true; } } @@ -542,6 +542,8 @@ bool ConnectionGraph::has_been_reduced(PhiNode* n, SafePointNode* sfpt) const { // - Phi -> CastPP -> SafePoints // - Phi -> CastPP -> AddP -> Load bool ConnectionGraph::can_reduce_check_users(Node* n, uint nesting) const { + assert((n->is_Phi() && nesting == 0) || (n->is_CastPP() && nesting > 0), + "invalid node class %s and nesting %d combination", n->Name(), nesting); for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { Node* use = n->fast_out(i); @@ -582,37 +584,21 @@ bool ConnectionGraph::can_reduce_check_users(Node* n, uint nesting) const { return false; } - bool is_trivial_control = use->in(0) == nullptr || use->in(0) == n->in(0); - if (!is_trivial_control) { - // If it's not a trivial control then we check if we can reduce the - // CmpP/N used by the If controlling the cast. - if (use->in(0)->is_IfTrue() || use->in(0)->is_IfFalse()) { - Node* iff = use->in(0)->in(0); - // We may have an OpaqueConstantBool node between If and Bool nodes. But we could also have a sub class of IfNode, - // for example, an OuterStripMinedLoopEnd or a Parse Predicate. Bail out in all these cases. - bool can_reduce = (iff->Opcode() == Op_If) && iff->in(1)->is_Bool() && iff->in(1)->in(1)->is_Cmp(); - if (can_reduce) { - Node* iff_cmp = iff->in(1)->in(1); - int opc = iff_cmp->Opcode(); - can_reduce = (opc == Op_CmpP || opc == Op_CmpN) && can_reduce_cmp(n, iff_cmp); - } - if (!can_reduce) { -#ifndef PRODUCT - if (TraceReduceAllocationMerges) { - tty->print_cr("Can NOT reduce Phi %d on invocation %d. CastPP %d doesn't have simple control.", n->_idx, _invocation, use->_idx); - n->dump(5); - } -#endif - return false; - } + if (!can_reduce_phi_at_castpp(n->as_Phi(), use->as_CastPP())) { +#ifdef ASSERT + if (TraceReduceAllocationMerges) { + tty->print_cr("Can NOT reduce Phi %d on invocation %d. CastPP %d doesn't have simple control.", n->_idx, _invocation, use->_idx); + n->dump(5); } +#endif + return false; } if (!can_reduce_check_users(use, nesting+1)) { return false; } } else if (use->Opcode() == Op_CmpP || use->Opcode() == Op_CmpN) { - if (!can_reduce_cmp(n, use)) { + if (!can_reduce_cmp(n->as_Phi(), use)) { NOT_PRODUCT(if (TraceReduceAllocationMerges) tty->print_cr("Can NOT reduce Phi %d on invocation %d. CmpP/N %d isn't reducible.", n->_idx, _invocation, use->_idx);) return false; } @@ -625,6 +611,33 @@ bool ConnectionGraph::can_reduce_check_users(Node* n, uint nesting) const { return true; } +// Returns true if the CastPP's control is simple enough to reduce the Phi: +// 1) no control, +// 2) control is the same Region as the Phi, or +// 3) an IfTrue/IfFalse coming from an CmpP/N between the phi and a constant. +bool ConnectionGraph::can_reduce_phi_at_castpp(PhiNode* phi, CastPPNode* castpp) const { + if (castpp->in(0) == nullptr || castpp->in(0) == phi->in(0)) { + return true; + } + // If it's not a trivial control then we check if we can reduce the + // CmpP/N used by the If controlling the cast. + if (!(castpp->in(0)->is_IfTrue() || castpp->in(0)->is_IfFalse())) { + return false; // Only If control is considered + } else { + Node* iff = castpp->in(0)->in(0); + // We may have an OpaqueConstantBool node between If and Bool nodes. But we could also have a sub class of IfNode, + // for example, an OuterStripMinedLoopEnd or a Parse Predicate. Bail out in all these cases. + if (iff->Opcode() == Op_If && iff->in(1)->is_Bool() && iff->in(1)->in(1)->is_Cmp()) { + Node* iff_cmp = iff->in(1)->in(1); + int opc = iff_cmp->Opcode(); + if ((opc == Op_CmpP || opc == Op_CmpN) && can_reduce_cmp(phi, iff_cmp)) { + return true; + } + } + } + return false; +} + // Returns true if: 1) It's profitable to reduce the merge, and 2) The Phi is // only used in some certain code shapes. Check comments in // 'can_reduce_phi_inputs' and 'can_reduce_phi_users' for more @@ -878,9 +891,9 @@ Node* ConnectionGraph::split_castpp_load_through_phi(Node* curr_addp, Node* curr // \|/ // Phi # "Field" Phi // -void ConnectionGraph::reduce_phi_on_castpp_field_load(Node* curr_castpp, GrowableArray &alloc_worklist) { - Node* ophi = curr_castpp->in(1); - assert(ophi->is_Phi(), "Expected this to be a Phi node."); +void ConnectionGraph::reduce_phi_on_castpp_field_load(CastPPNode* curr_castpp, GrowableArray &alloc_worklist) { + PhiNode* ophi = curr_castpp->in(1)->as_Phi(); + precond(can_reduce_phi_at_castpp(ophi, curr_castpp)); // Identify which base should be used for AddP->Load later when spliting the // CastPP->Loads through ophi. Three kind of values may be stored in this @@ -1374,7 +1387,7 @@ void ConnectionGraph::reduce_phi(PhiNode* ophi, GrowableArray &alloc_work // splitting CastPPs we make reference to the inputs of the Cmp that is used // by the If controlling the CastPP. for (uint i = 0; i < castpps.size(); i++) { - reduce_phi_on_castpp_field_load(castpps.at(i), alloc_worklist); + reduce_phi_on_castpp_field_load(castpps.at(i)->as_CastPP(), alloc_worklist); _compile->print_method(PHASE_EA_AFTER_PHI_CASTPP_REDUCTION, 6, castpps.at(i)); } @@ -2285,6 +2298,7 @@ void ConnectionGraph::process_call_arguments(CallNode *call) { strcmp(call->as_CallLeaf()->_name, "sha512_implCompressMB") == 0 || strcmp(call->as_CallLeaf()->_name, "sha3_implCompress") == 0 || strcmp(call->as_CallLeaf()->_name, "double_keccak") == 0 || + strcmp(call->as_CallLeaf()->_name, "quad_keccak") == 0 || strcmp(call->as_CallLeaf()->_name, "sha3_implCompressMB") == 0 || strcmp(call->as_CallLeaf()->_name, "multiplyToLen") == 0 || strcmp(call->as_CallLeaf()->_name, "squareToLen") == 0 || diff --git a/src/hotspot/share/opto/escape.hpp b/src/hotspot/share/opto/escape.hpp index f60807d786a..681f096681a 100644 --- a/src/hotspot/share/opto/escape.hpp +++ b/src/hotspot/share/opto/escape.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -609,14 +609,15 @@ private: Node* specialize_cmp(Node* base, Node* curr_ctrl); Node* specialize_castpp(Node* castpp, Node* base, Node* current_control); - bool can_reduce_cmp(Node* n, Node* cmp) const; + bool can_reduce_cmp(PhiNode* n, Node* cmp) const; bool has_been_reduced(PhiNode* n, SafePointNode* sfpt) const; bool can_reduce_phi(PhiNode* ophi) const; bool can_reduce_check_users(Node* n, uint nesting) const; bool can_reduce_phi_check_inputs(PhiNode* ophi) const; + bool can_reduce_phi_at_castpp(PhiNode* phi, CastPPNode* castpp) const; void reduce_phi_on_field_access(Node* previous_addp, GrowableArray &alloc_worklist); - void reduce_phi_on_castpp_field_load(Node* castpp, GrowableArray &alloc_worklist); + void reduce_phi_on_castpp_field_load(CastPPNode* castpp, GrowableArray &alloc_worklist); void reduce_phi_on_cmp(Node* cmp); bool reduce_phi_on_safepoints(PhiNode* ophi); bool reduce_phi_on_safepoints_helper(Node* ophi, Node* cast, Node* selector, Unique_Node_List& safepoints); diff --git a/src/hotspot/share/opto/library_call.cpp b/src/hotspot/share/opto/library_call.cpp index 21b9aa9ed00..7251783d771 100644 --- a/src/hotspot/share/opto/library_call.cpp +++ b/src/hotspot/share/opto/library_call.cpp @@ -600,7 +600,8 @@ bool LibraryCallKit::try_to_inline(int predicate) { case vmIntrinsics::_sha3_implCompress: return inline_digestBase_implCompress(intrinsic_id()); case vmIntrinsics::_double_keccak: - return inline_double_keccak(); + case vmIntrinsics::_quad_keccak: + return inline_keccak(intrinsic_id()); case vmIntrinsics::_digestBase_implCompressMB: return inline_digestBase_implCompressMB(predicate); @@ -8471,33 +8472,60 @@ bool LibraryCallKit::inline_digestBase_implCompress(vmIntrinsics::ID id) { return true; } -//------------------------------inline_double_keccak -bool LibraryCallKit::inline_double_keccak() { - address stubAddr; +//------------------------------inline_keccak +bool LibraryCallKit::inline_keccak(vmIntrinsics::ID id) { + address stubAddr = nullptr; const char *stubName; assert(UseSHA3Intrinsics, "need SHA3 intrinsics support"); - assert(callee()->signature()->size() == 2, "double_keccak has 2 parameters"); + assert((id == vmIntrinsics::_double_keccak && callee()->signature()->size() == 2) || + (id == vmIntrinsics::_quad_keccak && callee()->signature()->size() == 4), + "double_keccak wrong number of parameters"); + + int parmCnt = 0; + switch (id) { + case vmIntrinsics::_double_keccak: + stubAddr = StubRoutines::double_keccak(); + stubName = "double_keccak"; + parmCnt = 2; + break; + case vmIntrinsics::_quad_keccak: + stubAddr = StubRoutines::quad_keccak(); + stubName = "quad_keccak"; + parmCnt = 4; + break; + default: + ShouldNotReachHere(); + } - stubAddr = StubRoutines::double_keccak(); - stubName = "double_keccak"; if (!stubAddr) return false; - Node* status0 = argument(0); - Node* status1 = argument(1); + Node* state[4]; + for (int i = 0; iskip_assertion_predicates_with_halt(); - Node *iffm = ctrl->in(0); - Node *opqzm = iffm->in(1)->in(1)->in(2); - assert(opqzm->in(1) == main_limit, "do not understand situation"); + Node* const zero_trip_guard_success_proj = cl->skip_assertion_predicates_with_halt(); + DEBUG_ONLY(ensure_zero_trip_guard_proj(zero_trip_guard_success_proj, true)); + Node* const zero_trip_guard = zero_trip_guard_success_proj->in(0); + Node* const opaque_zero_trip_guard = zero_trip_guard->in(1)->in(1)->in(2); + assert(opaque_zero_trip_guard->in(1) == main_limit, "unexpected limit node: %s", opaque_zero_trip_guard->in(1)->Name()); // Find the pre-loop limit; we will expand its iterations to // not ever trip low tests. - Node *p_f = iffm->in(0); + Node* pre_loop_exit_proj = zero_trip_guard->in(0); // pre loop may have been optimized out - if (p_f->Opcode() != Op_IfFalse) { + if (!pre_loop_exit_proj->is_IfFalse()) { return; } - CountedLoopEndNode *pre_end = p_f->in(0)->as_CountedLoopEnd(); - assert(pre_end->loopnode()->is_pre_loop(), ""); - Node *pre_opaq1 = pre_end->limit(); + CountedLoopEndNode* pre_end = pre_loop_exit_proj->in(0)->as_CountedLoopEnd(); + assert(pre_end->loopnode()->is_pre_loop(), "not a pre loop"); + Node* pre_loop_limit = pre_end->limit(); // Occasionally it's possible for a pre-loop Opaque1 node to be // optimized away and then another round of loop opts attempted. // We can not optimize this particular loop in that case. - if (pre_opaq1->Opcode() != Op_Opaque1) { + if (pre_loop_limit->Opcode() != Op_Opaque1) { return; } - Opaque1Node *pre_opaq = (Opaque1Node*)pre_opaq1; - Node *pre_limit = pre_opaq->in(1); + Opaque1Node* pre_loop_limit_opaque = pre_loop_limit->as_Opaque1(); + Node* pre_limit = pre_loop_limit_opaque->in(1); Node* pre_limit_ctrl = get_ctrl(pre_limit); // Where do we put new limit calculations @@ -2777,7 +2778,7 @@ void PhaseIdealLoop::do_range_check(IdealLoopTree* loop) { // Ensure the original loop limit is available from the // pre-loop Opaque1 node. - Node *orig_limit = pre_opaq->original_loop_limit(); + Node *orig_limit = pre_loop_limit_opaque->original_loop_limit(); if (orig_limit == nullptr || _igvn.type(orig_limit) == Type::TOP) { return; } @@ -2846,7 +2847,7 @@ void PhaseIdealLoop::do_range_check(IdealLoopTree* loop) { // 'limit' maybe pinned below the zero trip test (probably from a // previous round of rce), in which case, it can't be used in the // zero trip test expression which must occur before the zero test's if. - if (is_dominator(ctrl, limit_ctrl)) { + if (is_dominator(zero_trip_guard_success_proj, limit_ctrl)) { continue; // Don't rce this check but continue looking for other candidates. } @@ -2867,7 +2868,7 @@ void PhaseIdealLoop::do_range_check(IdealLoopTree* loop) { // As above for the 'limit', the 'offset' maybe pinned below the // zero trip test. - if (is_dominator(ctrl, offset_ctrl)) { + if (is_dominator(zero_trip_guard_success_proj, offset_ctrl)) { continue; // Don't rce this check but continue looking for other candidates. } @@ -2902,16 +2903,15 @@ void PhaseIdealLoop::do_range_check(IdealLoopTree* loop) { Node* int_limit = limit; limit = new ConvI2LNode(limit); register_new_node(limit, next_limit_ctrl); + Node* ctrl_target_for_data_rewire = zero_trip_guard_success_proj; // Adjust pre and main loop limits to guard the correct iteration set if (cmp->Opcode() == Op_CmpU) { // Unsigned compare is really 2 tests - if (b_test._test == BoolTest::lt) { // Range checks always use lt + if (b_test._test == BoolTest::lt) { + // Range checks always use lt // The underflow and overflow limits: 0 <= scale*I+offset < limit add_constraint(stride_con, lscale_con, offset, zero, limit, next_limit_ctrl, &pre_limit, &main_limit); - Node* init = cl->uncasted_init_trip(true); - Node* opaque_init = new OpaqueLoopInitNode(C, init); - register_new_node(opaque_init, loop_entry); InitializedAssertionPredicateCreator initialized_assertion_predicate_creator(this); if (abs_stride_is_one) { @@ -2938,12 +2938,15 @@ void PhaseIdealLoop::do_range_check(IdealLoopTree* loop) { TemplateAssertionPredicateCreator template_assertion_predicate_creator(cl, scale_con , int_offset, int_limit, this); loop_entry = template_assertion_predicate_creator.create(loop_entry); + // Make sure to rewire data dependencies on the removed check to the Template Assertion Predicate in order + // to update them correctly when further splitting the main loop later. + ctrl_target_for_data_rewire = loop_entry; // Initialized Assertion Predicate for the value of the initial main-loop. + Node* init = cl->uncasted_init_trip(true); loop_entry = initialized_assertion_predicate_creator.create(init, loop_entry, stride_con, scale_con, int_offset, int_limit, AssertionPredicateType::InitValue); - } else { if (PrintOpto) { tty->print_cr("missed RCE opportunity"); @@ -2982,6 +2985,7 @@ void PhaseIdealLoop::do_range_check(IdealLoopTree* loop) { continue; // Unhandled case } } + // Only update variable tracking control for new nodes if it's indeed a range check that can be eliminated (and // limits are updated) new_limit_ctrl = next_limit_ctrl; @@ -2996,10 +3000,10 @@ void PhaseIdealLoop::do_range_check(IdealLoopTree* loop) { // Find loads off the surviving projection; remove their control edge for (DUIterator_Fast imax, i = dp->fast_outs(imax); i < imax; i++) { Node* cd = dp->fast_out(i); // Control-dependent node - if (cd->is_Load() && cd->depends_only_on_test()) { // Loads can now float around in the loop - // Allow the load to float around in the loop, or before it - // but NOT before the pre-loop. - _igvn.replace_input_of(cd, 0, ctrl); // ctrl, not null + if (cd->is_Load() && cd->depends_only_on_test()) { + // Allow a load to float around in the loop, or before it but after this loop's Template Assertion Predicates + // or when absent after the loop's zero trip guard. + _igvn.replace_input_of(cd, 0, ctrl_target_for_data_rewire); --i; --imax; } @@ -3020,13 +3024,13 @@ void PhaseIdealLoop::do_range_check(IdealLoopTree* loop) { } // new pre_limit can push Bool/Cmp/Opaque nodes down (when one of the eliminated condition has parameters that are not // loop invariant in the pre loop. - set_ctrl(pre_opaq, new_limit_ctrl); + set_ctrl(pre_loop_limit_opaque, new_limit_ctrl); // Can't use new_limit_ctrl for Bool/Cmp because it can be out of loop while they are loop variant. Conservatively set // control to latest possible one. set_ctrl(pre_end->cmp_node(), pre_end->in(0)); set_ctrl(pre_end->in(1), pre_end->in(0)); - _igvn.replace_input_of(pre_opaq, 1, pre_limit); + _igvn.replace_input_of(pre_loop_limit_opaque, 1, pre_limit); // Note:: we are making the main loop limit no longer precise; // need to round up based on stride. @@ -3062,14 +3066,14 @@ void PhaseIdealLoop::do_range_check(IdealLoopTree* loop) { _igvn.replace_node(final_iv_placeholder, final_iv); } // The OpaqueNode is unshared by design - assert(opqzm->outcnt() == 1, "cannot hack shared node"); - _igvn.replace_input_of(opqzm, 1, main_limit); + assert(opaque_zero_trip_guard->outcnt() == 1, "cannot hack shared node"); + _igvn.replace_input_of(opaque_zero_trip_guard, 1, main_limit); // new main_limit can push opaque node for zero trip guard down (when one of the eliminated condition has parameters // that are not loop invariant in the pre loop). - set_ctrl(opqzm, new_limit_ctrl); + set_ctrl(opaque_zero_trip_guard, new_limit_ctrl); // Bool/Cmp nodes for zero trip guard should have been assigned control between the main and pre loop (because zero // trip guard depends on induction variable value out of pre loop) so shouldn't need to be adjusted - assert(is_dominator(new_limit_ctrl, get_ctrl(iffm->in(1)->in(1))), "control of cmp should be below control of updated input"); + assert(is_dominator(new_limit_ctrl, get_ctrl(zero_trip_guard->in(1)->in(1))), "control of cmp should be below control of updated input"); C->print_method(PHASE_AFTER_RANGE_CHECK_ELIMINATION, 4, cl); } diff --git a/src/hotspot/share/opto/runtime.cpp b/src/hotspot/share/opto/runtime.cpp index 02a7c21fb5d..1afffcadd6e 100644 --- a/src/hotspot/share/opto/runtime.cpp +++ b/src/hotspot/share/opto/runtime.cpp @@ -209,6 +209,7 @@ const TypeFunc* OptoRuntime::_digestBase_implCompress_without_sha3_Type = null const TypeFunc* OptoRuntime::_digestBase_implCompressMB_with_sha3_Type = nullptr; const TypeFunc* OptoRuntime::_digestBase_implCompressMB_without_sha3_Type = nullptr; const TypeFunc* OptoRuntime::_double_keccak_Type = nullptr; +const TypeFunc* OptoRuntime::_quad_keccak_Type = nullptr; const TypeFunc* OptoRuntime::_multiplyToLen_Type = nullptr; const TypeFunc* OptoRuntime::_montgomeryMultiply_Type = nullptr; const TypeFunc* OptoRuntime::_montgomerySquare_Type = nullptr; @@ -1221,6 +1222,26 @@ static const TypeFunc* make_double_keccak_Type() { return TypeFunc::make(domain, range); } +static const TypeFunc* make_quad_keccak_Type() { + int argcnt = 4; + + const Type** fields = TypeTuple::fields(argcnt); + int argp = TypeFunc::Parms; + fields[argp++] = TypePtr::NOTNULL; // status0 + fields[argp++] = TypePtr::NOTNULL; // status1 + fields[argp++] = TypePtr::NOTNULL; // status2 + fields[argp++] = TypePtr::NOTNULL; // status3 + + assert(argp == TypeFunc::Parms + argcnt, "correct decoding"); + const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms + argcnt, fields); + + // result type needed + fields = TypeTuple::fields(1); + fields[TypeFunc::Parms + 0] = TypeInt::INT; + const TypeTuple* range = TypeTuple::make(TypeFunc::Parms + 1, fields); + return TypeFunc::make(domain, range); +} + static const TypeFunc* make_multiplyToLen_Type() { // create input type (domain) int num_args = 5; @@ -2305,6 +2326,7 @@ void OptoRuntime::initialize_types() { _digestBase_implCompressMB_with_sha3_Type = make_digestBase_implCompressMB_Type(/* is_sha3= */ true); _digestBase_implCompressMB_without_sha3_Type = make_digestBase_implCompressMB_Type(/* is_sha3= */ false); _double_keccak_Type = make_double_keccak_Type(); + _quad_keccak_Type = make_quad_keccak_Type(); _multiplyToLen_Type = make_multiplyToLen_Type(); _montgomeryMultiply_Type = make_montgomeryMultiply_Type(); _montgomerySquare_Type = make_montgomerySquare_Type(); diff --git a/src/hotspot/share/opto/runtime.hpp b/src/hotspot/share/opto/runtime.hpp index b8cdd9a962a..af8a206e10c 100644 --- a/src/hotspot/share/opto/runtime.hpp +++ b/src/hotspot/share/opto/runtime.hpp @@ -162,6 +162,7 @@ class OptoRuntime : public AllStatic { static const TypeFunc* _digestBase_implCompressMB_with_sha3_Type; static const TypeFunc* _digestBase_implCompressMB_without_sha3_Type; static const TypeFunc* _double_keccak_Type; + static const TypeFunc* _quad_keccak_Type; static const TypeFunc* _multiplyToLen_Type; static const TypeFunc* _montgomeryMultiply_Type; static const TypeFunc* _montgomerySquare_Type; @@ -537,6 +538,11 @@ private: return _double_keccak_Type; } + static inline const TypeFunc* quad_keccak_Type() { + assert(_quad_keccak_Type != nullptr, "should be initialized"); + return _quad_keccak_Type; + } + static inline const TypeFunc* multiplyToLen_Type() { assert(_multiplyToLen_Type != nullptr, "should be initialized"); return _multiplyToLen_Type; diff --git a/src/hotspot/share/runtime/stubDeclarations.hpp b/src/hotspot/share/runtime/stubDeclarations.hpp index ed1b3ea2e78..bef6a0c27f0 100644 --- a/src/hotspot/share/runtime/stubDeclarations.hpp +++ b/src/hotspot/share/runtime/stubDeclarations.hpp @@ -830,6 +830,8 @@ sha3_implCompress) \ do_stub(compiler, double_keccak) \ do_entry(compiler, double_keccak, double_keccak, double_keccak) \ + do_stub(compiler, quad_keccak) \ + do_entry(compiler, quad_keccak, quad_keccak, quad_keccak) \ do_stub(compiler, sha3_implCompressMB) \ do_entry(compiler, sha3_implCompressMB, sha3_implCompressMB, \ sha3_implCompressMB) \ diff --git a/src/java.base/share/classes/com/sun/crypto/provider/ML_KEM.java b/src/java.base/share/classes/com/sun/crypto/provider/ML_KEM.java index 6564f40545a..6bd70c3cdd6 100644 --- a/src/java.base/share/classes/com/sun/crypto/provider/ML_KEM.java +++ b/src/java.base/share/classes/com/sun/crypto/provider/ML_KEM.java @@ -827,7 +827,7 @@ public final class ML_KEM { private short[][][] generateA(byte[] rho, Boolean transposed) { short[][][] a = new short[mlKem_k][mlKem_k][]; - int nrPar = 2; + int nrPar = 4; int rhoLen = rho.length; byte[] seedBuf = new byte[XOF_BLOCK_LEN]; System.arraycopy(rho, 0, seedBuf, 0, rho.length); diff --git a/src/java.base/share/classes/sun/security/provider/ML_DSA.java b/src/java.base/share/classes/sun/security/provider/ML_DSA.java index 1e27349a5d0..9c4e2c898b6 100644 --- a/src/java.base/share/classes/sun/security/provider/ML_DSA.java +++ b/src/java.base/share/classes/sun/security/provider/ML_DSA.java @@ -1146,7 +1146,7 @@ public class ML_DSA { a[i] = new int[mlDsa_l][]; } - int nrPar = 2; + int nrPar = 4; int rhoLen = seed.length; byte[] seedBuf = new byte[SHAKE128_BLOCK_SIZE]; System.arraycopy(seed, 0, seedBuf, 0, seed.length); diff --git a/src/java.base/share/classes/sun/security/provider/SHA3.java b/src/java.base/share/classes/sun/security/provider/SHA3.java index 5eafface0d3..45599396cdb 100644 --- a/src/java.base/share/classes/sun/security/provider/SHA3.java +++ b/src/java.base/share/classes/sun/security/provider/SHA3.java @@ -97,6 +97,7 @@ public abstract class SHA3 extends DigestBase { private SHA3(String name, int digestLength, byte suffix, int c) { super(name, digestLength, (WIDTH - c)); this.suffix = suffix; + blockSizeCheck(); } @Override @@ -113,6 +114,14 @@ public abstract class SHA3 extends DigestBase { Preconditions.checkIndex(ofs + blockSize - 1, b.length, Preconditions.AIOOBE_FORMATTER); } + private void blockSizeCheck() { + switch(blockSize) { + case 72, 104, 136, 144, 168: break; + default: + throw new ProviderException("Invalid SHA3 blocksize:" + blockSize); + } + } + /** * Core compression function. Processes blockSize bytes at a time * and updates the state of this object. diff --git a/src/java.base/share/classes/sun/security/provider/SHA3Parallel.java b/src/java.base/share/classes/sun/security/provider/SHA3Parallel.java index 0851d4a9216..caf6a7a2899 100644 --- a/src/java.base/share/classes/sun/security/provider/SHA3Parallel.java +++ b/src/java.base/share/classes/sun/security/provider/SHA3Parallel.java @@ -36,7 +36,7 @@ import static sun.security.provider.ByteArrayAccess.l2bLittle; import static sun.security.provider.SHA3.keccak; /* - * This class is for making it possible that NRPAR (= 2) (rather restricted) + * This class is for making it possible that NRPAR (= 4) (rather restricted) * SHAKE computations execute in parallel. * The restrictions are: * 1. The messages processed should be such that the absorb phase should @@ -54,7 +54,7 @@ public class SHA3Parallel { private static final int DM = 5; // dimension of lanesArr private byte[][] buffers; private long[][] lanesArr; - private static final int NRPAR = 2; + private static final int NRPAR = 4; private SHA3Parallel(byte[][] buffers, int blockSize) throws InvalidAlgorithmParameterException { if ((buffers.length != NRPAR) || (buffers[0].length < blockSize)) { @@ -81,13 +81,20 @@ public class SHA3Parallel { } public int squeezeBlock() { - int retVal = doubleKeccak(lanesArr[0], lanesArr[1]); + int retVal = quadKeccak(lanesArr[0], lanesArr[1], lanesArr[2], lanesArr[3]); for (int i = 0; i < NRPAR; i++) { l2bLittle(lanesArr[i], 0, buffers[i], 0, blockSize); } return retVal; } + @IntrinsicCandidate + private static int quadKeccak(long[] lanes0, long[] lanes1, long[] lanes2, long[] lanes3) { + doubleKeccak(lanes0, lanes1); + doubleKeccak(lanes2, lanes3); + return 1; + } + @IntrinsicCandidate private static int doubleKeccak(long[] lanes0, long[] lanes1) { doubleKeccakJava(lanes0, lanes1); diff --git a/src/java.desktop/share/classes/java/awt/EventQueue.java b/src/java.desktop/share/classes/java/awt/EventQueue.java index 5a933a6cdf4..576b4443694 100644 --- a/src/java.desktop/share/classes/java/awt/EventQueue.java +++ b/src/java.desktop/share/classes/java/awt/EventQueue.java @@ -853,8 +853,10 @@ public class EventQueue { newEventQueue.previousQueue = topQueue; topQueue.nextQueue = newEventQueue; - if (SunToolkit.currentEventQueue == topQueue) { - SunToolkit.currentEventQueue = newEventQueue; + synchronized (SunToolkit.class) { + if (SunToolkit.getSystemEventQueueImplPP() == topQueue) { + SunToolkit.currentEventQueue = newEventQueue; + } } pushPopCond.signalAll(); @@ -913,8 +915,10 @@ public class EventQueue { topQueue.dispatchThread.setEventQueue(prevQueue); } - if (SunToolkit.currentEventQueue == this) { - SunToolkit.currentEventQueue = prevQueue; + synchronized (SunToolkit.class) { + if (SunToolkit.getSystemEventQueueImplPP() == this) { + SunToolkit.currentEventQueue = prevQueue; + } } // Wake up EDT waiting in getNextEvent(), so it can diff --git a/src/java.desktop/share/classes/java/awt/TrayIcon.java b/src/java.desktop/share/classes/java/awt/TrayIcon.java index c72c018867c..fd4afc3abda 100644 --- a/src/java.desktop/share/classes/java/awt/TrayIcon.java +++ b/src/java.desktop/share/classes/java/awt/TrayIcon.java @@ -125,7 +125,6 @@ public class TrayIcon { if (!SystemTray.isSupported()) { throw new UnsupportedOperationException(); } - SunToolkit.insertTargetMapping(this); } /** diff --git a/src/java.desktop/share/classes/java/awt/image/MultiPixelPackedSampleModel.java b/src/java.desktop/share/classes/java/awt/image/MultiPixelPackedSampleModel.java index d8f97562c6c..997c3bfd8d9 100644 --- a/src/java.desktop/share/classes/java/awt/image/MultiPixelPackedSampleModel.java +++ b/src/java.desktop/share/classes/java/awt/image/MultiPixelPackedSampleModel.java @@ -99,22 +99,39 @@ public class MultiPixelPackedSampleModel extends SampleModel * either {@code DataBuffer.TYPE_BYTE}, * {@code DataBuffer.TYPE_USHORT}, or * {@code DataBuffer.TYPE_INT} + * @throws IllegalArgumentException if either {@code w} or {@code h} + * is less than or equal to 0 + * @throws RasterFormatException if the number of bits per pixel + * is not a power of 2 or if a power of 2 number of + * pixels do not fit in one data element. */ public MultiPixelPackedSampleModel(int dataType, int w, int h, int numberOfBits) { - this(dataType,w,h, - numberOfBits, - (w*numberOfBits+DataBuffer.getDataTypeSize(dataType)-1)/ - DataBuffer.getDataTypeSize(dataType), - 0); + long size = (long)w * h; + if (w <= 0 || h <= 0) { + throw new IllegalArgumentException("Width ("+w+") and height ("+ + h+") must be > 0"); + } + if (size > Integer.MAX_VALUE) { + throw new IllegalArgumentException("Dimensions (width="+w+ + " height="+h+") are too large"); + } + if (dataType != DataBuffer.TYPE_BYTE && dataType != DataBuffer.TYPE_USHORT && - dataType != DataBuffer.TYPE_INT) { - throw new IllegalArgumentException("Unsupported data type "+ + dataType != DataBuffer.TYPE_INT) + { + throw new IllegalArgumentException("Unsupported dataType: "+ dataType); } + long sls = ((long)w*numberOfBits+DataBuffer.getDataTypeSize(dataType)-1)/ + DataBuffer.getDataTypeSize(dataType); + if (sls > Integer.MAX_VALUE) { + throw new RasterFormatException("Pixels do not fit"); + } + this(dataType, w, h, numberOfBits, (int)sls, 0); } /** @@ -130,15 +147,23 @@ public class MultiPixelPackedSampleModel extends SampleModel * @param scanlineStride the line stride of the image data * @param dataBitOffset the data bit offset for the region of image * data described - * @throws RasterFormatException if the number of bits per pixel - * is not a power of 2 or if a power of 2 number of - * pixels do not fit in one data element. - * @throws IllegalArgumentException if {@code w} or - * {@code h} is not greater than 0 * @throws IllegalArgumentException if {@code dataType} is not * either {@code DataBuffer.TYPE_BYTE}, * {@code DataBuffer.TYPE_USHORT}, or * {@code DataBuffer.TYPE_INT} + * @throws IllegalArgumentException if either {@code w} or {@code h} + * is less than or equal to 0 + * @throws IllegalArgumentException if {@code scanlineStride} + * is less than or equal to 0 + * @throws RasterFormatException if + * {@code ((numberOfBits * (long)w) + DataBuffer.getDataTypeSize(dataType) - 1) + * / DataBuffer.getDataTypeSize(dataType)} + * is greater than {@code scanlineStride} + * @throws RasterFormatException if the number of bits per pixel + * is not a power of 2 or if a power of 2 number of + * pixels do not fit in one data element. + * @throws IllegalArgumentException if {@code dataBitOffset} is less than zero, + * or not a multiple of {@code numberOfBits}. */ public MultiPixelPackedSampleModel(int dataType, int w, int h, int numberOfBits, @@ -151,11 +176,27 @@ public class MultiPixelPackedSampleModel extends SampleModel throw new IllegalArgumentException("Unsupported data type "+ dataType); } + if ((numberOfBits <= 0) || ((numberOfBits & (numberOfBits - 1)) != 0)) { + throw new RasterFormatException("numberOfBits per pixel must be a power of 2"); + } + if (scanlineStride <= 0) { + throw new IllegalArgumentException("scanlineStride must be > 0"); + } + int dataTypeSize = DataBuffer.getDataTypeSize(dataType); + if ((((numberOfBits * (long)w) + dataTypeSize - 1) / dataTypeSize) > scanlineStride) { + throw new RasterFormatException("scanlineStride is too small for width"); + } + if (dataBitOffset < 0) { + throw new IllegalArgumentException("dataBitOffset must be >= 0"); + } + if ((dataBitOffset % numberOfBits) != 0) { + throw new IllegalArgumentException("dataBitOffset must be a multiple of bits per pixel"); + } this.dataType = dataType; this.pixelBitStride = numberOfBits; this.scanlineStride = scanlineStride; this.dataBitOffset = dataBitOffset; - this.dataElementSize = DataBuffer.getDataTypeSize(dataType); + this.dataElementSize = dataTypeSize; this.pixelsPerDataElement = dataElementSize/numberOfBits; if (pixelsPerDataElement*numberOfBits != dataElementSize) { throw new RasterFormatException("MultiPixelPackedSampleModel " + @@ -320,22 +361,12 @@ public class MultiPixelPackedSampleModel extends SampleModel * subset of the bands of this * {@code MultiPixelPackedSampleModel}. Since a * {@code MultiPixelPackedSampleModel} only has one band, the - * bands argument must have a length of one and indicate the zeroth - * band. - * @param bands the specified bands - * @return a new {@code SampleModel} with a subset of bands of + * bands argument is ignored. + * @param bands the specified bands (ignored) + * @return a new {@code SampleModel} with the same bands as * this {@code MultiPixelPackedSampleModel}. - * @throws RasterFormatException if the number of bands requested - * is not one. - * @throws IllegalArgumentException if {@code w} or - * {@code h} is not greater than 0 */ public SampleModel createSubsetSampleModel(int[] bands) { - if (bands != null) { - if (bands.length != 1) - throw new RasterFormatException("MultiPixelPackedSampleModel has " - + "only one band."); - } SampleModel sm = createCompatibleSampleModel(width, height); return sm; } diff --git a/src/java.desktop/share/classes/java/awt/image/Raster.java b/src/java.desktop/share/classes/java/awt/image/Raster.java index 3312a39b693..8f35d5819ab 100644 --- a/src/java.desktop/share/classes/java/awt/image/Raster.java +++ b/src/java.desktop/share/classes/java/awt/image/Raster.java @@ -200,8 +200,8 @@ public class Raster { * @throws IllegalArgumentException if {@code bands} is less than 1 * @throws IllegalArgumentException if {@code w} and {@code h} are not * both > 0 - * @throws IllegalArgumentException if the product of {@code w} - * and {@code h} is greater than {@code Integer.MAX_VALUE} + * @throws IllegalArgumentException if the product of {@code w}, + * {@code h} and {@code bands} is greater than {@code Integer.MAX_VALUE} * @throws RasterFormatException if computing either * {@code location.x + w} or * {@code location.y + h} results in integer overflow @@ -218,6 +218,14 @@ public class Raster { throw new IllegalArgumentException("Dimensions (width="+w+ " height="+h+") are too large"); } + if (bands < 1) { + throw new IllegalArgumentException("Number of bands ("+ + bands+") must be greater than 0"); + } + long slsz = (long)w * bands; + if (slsz > Integer.MAX_VALUE) { + throw new IllegalArgumentException("width * bands is too large"); + } int[] bandOffsets = new int[bands]; for (int i = 0; i < bands; i++) { bandOffsets[i] = i; diff --git a/src/java.desktop/share/classes/sun/awt/AppContext.java b/src/java.desktop/share/classes/sun/awt/AppContext.java deleted file mode 100644 index b81869040b4..00000000000 --- a/src/java.desktop/share/classes/sun/awt/AppContext.java +++ /dev/null @@ -1,692 +0,0 @@ -/* - * 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 - * 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.awt; - -import java.awt.EventQueue; -import java.awt.Window; -import java.awt.SystemTray; -import java.awt.TrayIcon; -import java.awt.Toolkit; -import java.awt.GraphicsEnvironment; -import java.awt.event.InvocationEvent; -import java.util.Collections; -import java.util.HashMap; -import java.util.IdentityHashMap; -import java.util.Map; -import java.util.Set; -import java.util.HashSet; -import java.beans.PropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.lang.ref.SoftReference; - -import sun.util.logging.PlatformLogger; -import java.util.concurrent.atomic.AtomicInteger; - -/** - * The AppContext is a table referenced by ThreadGroup which stores - * application service instances. (If you are not writing an application - * service, or don't know what one is, please do not use this class.) - * The AppContext allows a context access to what would otherwise be - * potentially dangerous services, such as the ability to peek at - * EventQueues or change the look-and-feel of a Swing application.

- * - * Most application services use a singleton object to provide their - * services, either as a default (such as getSystemEventQueue or - * getDefaultToolkit) or as static methods with class data (System). - * The AppContext works with the former method by extending the concept - * of "default" to be ThreadGroup-specific. Application services - * lookup their singleton in the AppContext.

- * - * For example, here we have a Foo service, with its pre-AppContext - * code:

- *

{@code
- *    public class Foo {
- *        private static Foo defaultFoo = new Foo();
- *
- *        public static Foo getDefaultFoo() {
- *            return defaultFoo;
- *        }
- *
- *    ... Foo service methods
- *    }
- * }

- * - * The problem with the above is that the Foo service is global in scope, - * so that untrusted code can execute methods on the - * single, shared Foo instance. The Foo service therefore either needs - * to block its use by untrusted code using a SecurityManager test, or - * restrict its capabilities so that it doesn't matter if untrusted code - * executes it.

- * - * Here's the Foo class written to use the AppContext:

- *

{@code
- *    public class Foo {
- *        public static Foo getDefaultFoo() {
- *            Foo foo = (Foo)AppContext.getAppContext().get(Foo.class);
- *            if (foo == null) {
- *                foo = new Foo();
- *                getAppContext().put(Foo.class, foo);
- *            }
- *            return foo;
- *        }
- *
- *    ... Foo service methods
- *    }
- * }

- * - * Since a separate AppContext can exist for each ThreadGroup, trusted - * and untrusted code have access to different Foo instances. This allows - * untrusted code access to "system-wide" services -- the service remains - * within the AppContext "sandbox". For example, say malicious code - * wants to peek all of the key events on the EventQueue to listen for - * passwords; if separate EventQueues are used for each ThreadGroup - * using AppContexts, the only key events that code will be able to - * listen to are its own. A more reasonable request would be to - * change the Swing default look-and-feel; with that default stored in - * an AppContext, the look-and-feel will change without - * disrupting other contexts. - * - * @author Thomas Ball - * @author Fred Ecks - */ -public final class AppContext { - private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.AppContext"); - - /* Since the contents of an AppContext are unique to each Java - * session, this class should never be serialized. */ - - /* A map of AppContexts, referenced by ThreadGroup. - */ - private static final Map threadGroup2appContext = - Collections.synchronizedMap(new IdentityHashMap()); - - /** - * Returns a set containing all {@code AppContext}s. - */ - public static Set getAppContexts() { - synchronized (threadGroup2appContext) { - return new HashSet(threadGroup2appContext.values()); - } - } - - /* The main "system" AppContext, used by everything not otherwise - contained in another AppContext. It is implicitly created for - standalone apps only. - */ - private static volatile AppContext mainAppContext; - - private static class GetAppContextLock {} - private static final Object getAppContextLock = new GetAppContextLock(); - - /* - * The hash map associated with this AppContext. A private delegate - * is used instead of subclassing HashMap so as to avoid all of - * HashMap's potentially risky methods, such as clear(), elements(), - * putAll(), etc. - */ - private final Map table = new HashMap<>(); - - private final ThreadGroup threadGroup; - - /** - * If any {@code PropertyChangeListeners} have been registered, - * the {@code changeSupport} field describes them. - * - * @see #addPropertyChangeListener - * @see #removePropertyChangeListener - * @see PropertyChangeSupport#firePropertyChange - */ - private PropertyChangeSupport changeSupport = null; - - public static final String DISPOSED_PROPERTY_NAME = "disposed"; - public static final String GUI_DISPOSED = "guidisposed"; - - private enum State { - VALID, - BEING_DISPOSED, - DISPOSED - } - - private volatile State state = State.VALID; - - public boolean isDisposed() { - return state == State.DISPOSED; - } - - /* - * The total number of AppContexts, system-wide. This number is - * incremented at the beginning of the constructor, and decremented - * at the end of dispose(). getAppContext() checks to see if this - * number is 1. If so, it returns the sole AppContext without - * checking Thread.currentThread(). - */ - private static final AtomicInteger numAppContexts = new AtomicInteger(); - - - /* - * The context ClassLoader that was used to create this AppContext. - */ - private final ClassLoader contextClassLoader; - - /** - * Constructor for AppContext. This method is not public, - * nor should it ever be used as such. The proper way to construct - * an AppContext is through the use of SunToolkit.createNewAppContext. - * A ThreadGroup is created for the new AppContext, a Thread is - * created within that ThreadGroup, and that Thread calls - * SunToolkit.createNewAppContext before calling anything else. - * That creates both the new AppContext and its EventQueue. - * - * @param threadGroup The ThreadGroup for the new AppContext - * @see sun.awt.SunToolkit - * @since 1.2 - */ - AppContext(ThreadGroup threadGroup) { - numAppContexts.incrementAndGet(); - - this.threadGroup = threadGroup; - threadGroup2appContext.put(threadGroup, this); - - this.contextClassLoader = Thread.currentThread().getContextClassLoader(); - } - - private static final ThreadLocal threadAppContext = - new ThreadLocal(); - - private static void initMainAppContext() { - // On the main Thread, we get the ThreadGroup, make a corresponding - // AppContext, and instantiate the Java EventQueue. This way, legacy - // code is unaffected by the move to multiple AppContext ability. - ThreadGroup currentThreadGroup = Thread.currentThread().getThreadGroup(); - ThreadGroup parentThreadGroup = currentThreadGroup.getParent(); - while (parentThreadGroup != null) { - // Find the root ThreadGroup to construct our main AppContext - currentThreadGroup = parentThreadGroup; - parentThreadGroup = currentThreadGroup.getParent(); - } - - mainAppContext = SunToolkit.createNewAppContext(currentThreadGroup); - } - - /** - * Returns the appropriate AppContext for the caller, - * as determined by its ThreadGroup. - * - * @return the AppContext for the caller. - * @see java.lang.ThreadGroup - * @since 1.2 - */ - public static AppContext getAppContext() { - // we are standalone app, return the main app context - if (numAppContexts.get() == 1 && mainAppContext != null) { - return mainAppContext; - } - - AppContext appContext = threadAppContext.get(); - - if (null == appContext) { - // Get the current ThreadGroup, and look for it and its - // parents in the hash from ThreadGroup to AppContext -- - // it should be found, because we use createNewContext() - // when new AppContext objects are created. - ThreadGroup currentThreadGroup = Thread.currentThread().getThreadGroup(); - ThreadGroup threadGroup = currentThreadGroup; - - // Special case: we implicitly create the main app context - // if no contexts have been created yet. - synchronized (getAppContextLock) { - if (numAppContexts.get() == 0) { - if (System.getProperty("javaplugin.version") == null && - System.getProperty("javawebstart.version") == null) { - initMainAppContext(); - } else if (System.getProperty("javafx.version") != null && - threadGroup.getParent() != null) { - // Swing inside JavaFX case - SunToolkit.createNewAppContext(); - } - } - } - - AppContext context = threadGroup2appContext.get(threadGroup); - while (context == null) { - threadGroup = threadGroup.getParent(); - if (threadGroup == null) { - // We've got up to the root thread group and did not find an AppContext - // We have nowhere else to look, and this is not supposed to happen. - // return null from this whole method. - return null; - } - context = threadGroup2appContext.get(threadGroup); - } - - // In case we did anything in the above while loop, we add - // all the intermediate ThreadGroups to threadGroup2appContext - // so we won't spin again. - for (ThreadGroup tg = currentThreadGroup; tg != threadGroup; tg = tg.getParent()) { - threadGroup2appContext.put(tg, context); - } - - // Now we're done, so we cache the latest key/value pair. - threadAppContext.set(context); - - appContext = context; - } - - return appContext; - } - - /** - * Returns true if the specified AppContext is the main AppContext. - * - * @param ctx the context to compare with the main context - * @return true if the specified AppContext is the main AppContext. - * @since 1.8 - */ - public static boolean isMainContext(AppContext ctx) { - return (ctx != null && ctx == mainAppContext); - } - - private long DISPOSAL_TIMEOUT = 5000; // Default to 5-second timeout - // for disposal of all Frames - // (we wait for this time twice, - // once for dispose(), and once - // to clear the EventQueue). - - private long THREAD_INTERRUPT_TIMEOUT = 1000; - // Default to 1-second timeout for all - // interrupted Threads to exit, and another - // 1 second for all stopped Threads to die. - - /** - * Disposes of this AppContext, all of its top-level Frames, and - * all Threads and ThreadGroups contained within it. - * - * This method must be called from a Thread which is not contained - * within this AppContext. - * - * @throws IllegalThreadStateException if the current thread is - * contained within this AppContext - * @since 1.2 - */ - public void dispose() throws IllegalThreadStateException { - System.err.println( - """ - WARNING: sun.awt.AppContext.dispose() no longer stops threads. - Additionally AppContext will be removed in a future release. - Remove all uses of this internal class as soon as possible. - There is no replacement. - """); - // Check to be sure that the current Thread isn't in this AppContext - if (this.threadGroup.parentOf(Thread.currentThread().getThreadGroup())) { - throw new IllegalThreadStateException( - "Current Thread is contained within AppContext to be disposed." - ); - } - - synchronized(this) { - if (this.state != State.VALID) { - return; // If already disposed or being disposed, bail. - } - - this.state = State.BEING_DISPOSED; - } - - final PropertyChangeSupport changeSupport = this.changeSupport; - if (changeSupport != null) { - changeSupport.firePropertyChange(DISPOSED_PROPERTY_NAME, false, true); - } - - // First, we post an InvocationEvent to be run on the - // EventDispatchThread which disposes of all top-level Frames and TrayIcons - - final Object notificationLock = new Object(); - - Runnable runnable = new Runnable() { - public void run() { - Window[] windowsToDispose = Window.getOwnerlessWindows(); - for (Window w : windowsToDispose) { - try { - w.dispose(); - } catch (Throwable t) { - log.finer("exception occurred while disposing app context", t); - } - } - if (!GraphicsEnvironment.isHeadless() && SystemTray.isSupported()) { - SystemTray systemTray = SystemTray.getSystemTray(); - TrayIcon[] trayIconsToDispose = systemTray.getTrayIcons(); - for (TrayIcon ti : trayIconsToDispose) { - systemTray.remove(ti); - } - } - // Alert PropertyChangeListeners that the GUI has been disposed. - if (changeSupport != null) { - changeSupport.firePropertyChange(GUI_DISPOSED, false, true); - } - synchronized(notificationLock) { - notificationLock.notifyAll(); // Notify caller that we're done - } - } - }; - synchronized(notificationLock) { - SunToolkit.postEvent(this, - new InvocationEvent(Toolkit.getDefaultToolkit(), runnable)); - try { - notificationLock.wait(DISPOSAL_TIMEOUT); - } catch (InterruptedException e) { } - } - - // Next, we post another InvocationEvent to the end of the - // EventQueue. When it's executed, we know we've executed all - // events in the queue. - - runnable = new Runnable() { public void run() { - synchronized(notificationLock) { - notificationLock.notifyAll(); // Notify caller that we're done - } - } }; - synchronized(notificationLock) { - SunToolkit.postEvent(this, - new InvocationEvent(Toolkit.getDefaultToolkit(), runnable)); - try { - notificationLock.wait(DISPOSAL_TIMEOUT); - } catch (InterruptedException e) { } - } - - // We are done with posting events, so change the state to disposed - synchronized(this) { - this.state = State.DISPOSED; - } - - // Next, we interrupt all Threads in the ThreadGroup - this.threadGroup.interrupt(); - // Note, the EventDispatchThread we've interrupted may dump an - // InterruptedException to the console here. This needs to be - // fixed in the EventDispatchThread, not here. - - // Next, we sleep 10ms at a time, waiting for all of the active - // Threads in the ThreadGroup to exit. - - long startTime = System.currentTimeMillis(); - long endTime = startTime + THREAD_INTERRUPT_TIMEOUT; - while ((this.threadGroup.activeCount() > 0) && - (System.currentTimeMillis() < endTime)) { - try { - Thread.sleep(10); - } catch (InterruptedException e) { } - } - - // Next, we remove this and all subThreadGroups from threadGroup2appContext - int numSubGroups = this.threadGroup.activeGroupCount(); - if (numSubGroups > 0) { - ThreadGroup [] subGroups = new ThreadGroup[numSubGroups]; - numSubGroups = this.threadGroup.enumerate(subGroups); - for (int subGroup = 0; subGroup < numSubGroups; subGroup++) { - threadGroup2appContext.remove(subGroups[subGroup]); - } - } - threadGroup2appContext.remove(this.threadGroup); - - threadAppContext.set(null); - - synchronized (table) { - this.table.clear(); // Clear out the Hashtable to ease garbage collection - } - - numAppContexts.decrementAndGet(); - - mostRecentKeyValue = null; - } - - private MostRecentKeyValue mostRecentKeyValue = null; - private MostRecentKeyValue shadowMostRecentKeyValue = null; - - /** - * Returns the value to which the specified key is mapped in this context. - * - * @param key a key in the AppContext. - * @return the value to which the key is mapped in this AppContext; - * {@code null} if the key is not mapped to any value. - * @see #put(Object, Object) - * @since 1.2 - */ - public Object get(Object key) { - /* - * The most recent reference should be updated inside a synchronized - * block to avoid a race when put() and get() are executed in - * parallel on different threads. - */ - synchronized (table) { - // Note: this most recent key/value caching is thread-hot. - // A simple test using SwingSet found that 72% of lookups - // were matched using the most recent key/value. By instantiating - // a simple MostRecentKeyValue object on cache misses, the - // cache hits can be processed without synchronization. - - MostRecentKeyValue recent = mostRecentKeyValue; - if ((recent != null) && (recent.key == key)) { - return recent.value; - } - - Object value = table.get(key); - if(mostRecentKeyValue == null) { - mostRecentKeyValue = new MostRecentKeyValue(key, value); - shadowMostRecentKeyValue = new MostRecentKeyValue(key, value); - } else { - MostRecentKeyValue auxKeyValue = mostRecentKeyValue; - shadowMostRecentKeyValue.setPair(key, value); - mostRecentKeyValue = shadowMostRecentKeyValue; - shadowMostRecentKeyValue = auxKeyValue; - } - return value; - } - } - - /** - * Maps the specified {@code key} to the specified - * {@code value} in this AppContext. Neither the key nor the - * value can be {@code null}. - *

- * The value can be retrieved by calling the {@code get} method - * with a key that is equal to the original key. - * - * @param key the AppContext key. - * @param value the value. - * @return the previous value of the specified key in this - * AppContext, or {@code null} if it did not have one. - * @throws NullPointerException if the key or value is - * {@code null}. - * @see #get(Object) - * @since 1.2 - */ - public Object put(Object key, Object value) { - synchronized (table) { - MostRecentKeyValue recent = mostRecentKeyValue; - if ((recent != null) && (recent.key == key)) - recent.value = value; - return table.put(key, value); - } - } - - /** - * Removes the key (and its corresponding value) from this - * AppContext. This method does nothing if the key is not in the - * AppContext. - * - * @param key the key that needs to be removed. - * @return the value to which the key had been mapped in this AppContext, - * or {@code null} if the key did not have a mapping. - * @since 1.2 - */ - public Object remove(Object key) { - synchronized (table) { - MostRecentKeyValue recent = mostRecentKeyValue; - if ((recent != null) && (recent.key == key)) - recent.value = null; - return table.remove(key); - } - } - - /** - * Returns the root ThreadGroup for all Threads contained within - * this AppContext. - * @since 1.2 - */ - public ThreadGroup getThreadGroup() { - return threadGroup; - } - - /** - * Returns the context ClassLoader that was used to create this - * AppContext. - * - * @see java.lang.Thread#getContextClassLoader - */ - public ClassLoader getContextClassLoader() { - return contextClassLoader; - } - - /** - * Returns a string representation of this AppContext. - * @since 1.2 - */ - @Override - public String toString() { - return getClass().getName() + "[threadGroup=" + threadGroup.getName() + "]"; - } - - /** - * Returns an array of all the property change listeners - * registered on this component. - * - * @return all of this component's {@code PropertyChangeListener}s - * or an empty array if no property change - * listeners are currently registered - * - * @see #addPropertyChangeListener - * @see #removePropertyChangeListener - * @see #getPropertyChangeListeners(java.lang.String) - * @see java.beans.PropertyChangeSupport#getPropertyChangeListeners - * @since 1.4 - */ - public synchronized PropertyChangeListener[] getPropertyChangeListeners() { - if (changeSupport == null) { - return new PropertyChangeListener[0]; - } - return changeSupport.getPropertyChangeListeners(); - } - - /** - * Adds a PropertyChangeListener to the listener list for a specific - * property. The specified property may be one of the following: - *

    - *
  • if this AppContext is disposed ("disposed")
  • - *
- *
    - *
  • if this AppContext's unowned Windows have been disposed - * ("guidisposed"). Code to cleanup after the GUI is disposed - * (such as LookAndFeel.uninitialize()) should execute in response to - * this property being fired. Notifications for the "guidisposed" - * property are sent on the event dispatch thread.
  • - *
- *

- * If listener is null, no exception is thrown and no action is performed. - * - * @param propertyName one of the property names listed above - * @param listener the PropertyChangeListener to be added - * - * @see #removePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener) - * @see #getPropertyChangeListeners(java.lang.String) - * @see #addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener) - */ - public synchronized void addPropertyChangeListener( - String propertyName, - PropertyChangeListener listener) { - if (listener == null) { - return; - } - if (changeSupport == null) { - changeSupport = new PropertyChangeSupport(this); - } - changeSupport.addPropertyChangeListener(propertyName, listener); - } - - /** - * Removes a PropertyChangeListener from the listener list for a specific - * property. This method should be used to remove PropertyChangeListeners - * that were registered for a specific bound property. - *

- * If listener is null, no exception is thrown and no action is performed. - * - * @param propertyName a valid property name - * @param listener the PropertyChangeListener to be removed - * - * @see #addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener) - * @see #getPropertyChangeListeners(java.lang.String) - * @see PropertyChangeSupport#removePropertyChangeListener(java.beans.PropertyChangeListener) - */ - public synchronized void removePropertyChangeListener( - String propertyName, - PropertyChangeListener listener) { - if (listener == null || changeSupport == null) { - return; - } - changeSupport.removePropertyChangeListener(propertyName, listener); - } - - /** - * Returns an array of all the listeners which have been associated - * with the named property. - * - * @return all of the {@code PropertyChangeListeners} associated with - * the named property or an empty array if no listeners have - * been added - * - * @see #addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener) - * @see #removePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener) - * @see #getPropertyChangeListeners - * @since 1.4 - */ - public synchronized PropertyChangeListener[] getPropertyChangeListeners( - String propertyName) { - if (changeSupport == null) { - return new PropertyChangeListener[0]; - } - return changeSupport.getPropertyChangeListeners(propertyName); - } -} - -final class MostRecentKeyValue { - Object key; - Object value; - MostRecentKeyValue(Object k, Object v) { - key = k; - value = v; - } - void setPair(Object k, Object v) { - key = k; - value = v; - } -} diff --git a/src/java.desktop/share/classes/sun/awt/SunToolkit.java b/src/java.desktop/share/classes/sun/awt/SunToolkit.java index 23ec5f54959..be85260caad 100644 --- a/src/java.desktop/share/classes/sun/awt/SunToolkit.java +++ b/src/java.desktop/share/classes/sun/awt/SunToolkit.java @@ -166,6 +166,7 @@ public abstract class SunToolkit extends Toolkit } public SunToolkit() { + initEQ(); } public boolean useBufferPerWindow() { @@ -258,24 +259,6 @@ public abstract class SunToolkit extends Toolkit return AWT_LOCK.isHeldByCurrentThread(); } - /* - * Create a new AppContext, along with its EventQueue, for a - * new ThreadGroup. - */ - public static AppContext createNewAppContext() { - ThreadGroup threadGroup = Thread.currentThread().getThreadGroup(); - return createNewAppContext(threadGroup); - } - - static final AppContext createNewAppContext(ThreadGroup threadGroup) { - // Create appContext before initialization of EventQueue, so all - // the calls to AppContext.getAppContext() from EventQueue ctor - // return correct values - AppContext appContext = new AppContext(threadGroup); - initEQ(); - return appContext; - } - static void wakeupEventQueue(EventQueue q, boolean isShutdown){ AWTAccessor.getEventQueueAccessor().wakeup(q, isShutdown); } @@ -311,52 +294,6 @@ public abstract class SunToolkit extends Toolkit } } - // Maps from non-Component/MenuComponent to AppContext. - // WeakHashMap - private static final Map appContextMap = - Collections.synchronizedMap(new WeakIdentityHashMap()); - - /** - * Sets the appContext field of target. If target is not a Component or - * MenuComponent, this returns false. - */ - private static boolean setAppContext(Object target, - AppContext context) { - return (target instanceof Component); - } - - /** - * Returns the appContext field for target. If target is not a - * Component or MenuComponent this returns null. - */ - private static AppContext getAppContext(Object target) { - if ((target instanceof Component) || - (target instanceof MenuComponent)) { - return AppContext.getAppContext(); - } else { - return null; - } - } - - /* - * Fetch the AppContext associated with the given target. - * This can be used to determine things like which EventQueue - * to use for posting events to a Component. If the target is - * null or the target can't be found, a null with be returned. - */ - public static AppContext targetToAppContext(Object target) { - if (target == null) { - return null; - } - AppContext context = getAppContext(target); - if (context == null) { - // target is not a Component/MenuComponent, try the - // appContextMap. - context = appContextMap.get(target); - } - return context; - } - /** * Sets the synchronous status of focus requests on lightweight * components in the specified window to the specified value. @@ -394,34 +331,6 @@ public abstract class SunToolkit extends Toolkit cont.setFocusTraversalPolicy(defaultPolicy); } - /* This method should be removed at the same time as targetToAppContext() */ - public static void insertTargetMapping(Object target) { - insertTargetMapping(target, AppContext.getAppContext()); - } - - /* - * Insert a mapping from target to AppContext, for later retrieval - * via targetToAppContext() above. - */ - public static void insertTargetMapping(Object target, AppContext appContext) { - if (!setAppContext(target, appContext)) { - // Target is not a Component/MenuComponent, use the private Map - // instead. - appContextMap.put(target, appContext); - } - } - - public static void postEvent(AWTEvent event) { - /* Adding AppContext is temporary to help migrate away from using app contexts - * It is used by code which has already been subject to that migration. - * However until that is complete, there is a single main app context we - * can retrieve to use which would be the same as if the code had - * not been migrated. - * The overload which accepts the AppContext will eventually be replaced by this. - */ - postEvent(AppContext.getAppContext(), event); - } - /* * Post an AWTEvent to the Java EventQueue, using the PostEventQueue * to avoid possibly calling client code (EventQueueSubclass.postEvent()) @@ -429,7 +338,7 @@ public abstract class SunToolkit extends Toolkit * not be called under another lock since it locks the EventQueue. * See bugids 4632918, 4526597. */ - public static void postEvent(AppContext appContext, AWTEvent event) { + public static void postEvent(AWTEvent event) { if (event == null) { throw new NullPointerException(); } @@ -468,7 +377,7 @@ public abstract class SunToolkit extends Toolkit ((Component)e.getSource()).dispatchEvent(e); } }, PeerEvent.ULTIMATE_PRIORITY_EVENT); - postEvent(targetToAppContext(e.getSource()), pe); + postEvent(pe); } /* @@ -513,25 +422,18 @@ public abstract class SunToolkit extends Toolkit * returning to the caller. */ public static void executeOnEventHandlerThread(PeerEvent peerEvent) { - postEvent(targetToAppContext(peerEvent.getSource()), peerEvent); + postEvent(peerEvent); } - public static void invokeLater(Runnable dispatcher) { - invokeLaterOnAppContext(AppContext.getAppContext(), dispatcher); - } - /* * Execute a chunk of code on the Java event handler thread. The - * method takes into account provided AppContext and sets - * {@code SunToolkit.getDefaultToolkit()} as a target of the + * method sets {@code SunToolkit.getDefaultToolkit()} as a target of the * event. See 6451487 for details. * Does not wait for the execution to occur before returning to * the caller. */ - public static void invokeLaterOnAppContext( - AppContext appContext, Runnable dispatcher) - { - postEvent(appContext, + public static void invokeLater(Runnable dispatcher) { + postEvent( new PeerEvent(Toolkit.getDefaultToolkit(), dispatcher, PeerEvent.PRIORITY_EVENT)); } @@ -1479,8 +1381,7 @@ public abstract class SunToolkit extends Toolkit final AtomicBoolean eventDispatched = new AtomicBoolean(); synchronized (waitLock) { queueWasEmpty = isEQEmpty(); - postEvent(AppContext.getAppContext(), - new PeerEvent(getSystemEventQueueImpl(), null, PeerEvent.LOW_PRIORITY_EVENT) { + postEvent(new PeerEvent(getSystemEventQueueImpl(), null, PeerEvent.LOW_PRIORITY_EVENT) { @Override public void dispatch() { // Here we block EDT. It could have some diff --git a/src/java.desktop/share/legal/freetype.md b/src/java.desktop/share/legal/freetype.md index 7259c27183f..0c972d0fa99 100644 --- a/src/java.desktop/share/legal/freetype.md +++ b/src/java.desktop/share/legal/freetype.md @@ -1,4 +1,4 @@ -## The FreeType Project: Freetype v2.14.2 +## The FreeType Project: Freetype v2.14.3 ### FreeType Notice @@ -21,24 +21,24 @@ which fits your needs best. ### FreeType License ``` -Copyright (C) 1996-2025 by David Turner, Robert Wilhelm, and Werner Lemberg. -Copyright (C) 2007-2025 by Dereg Clegg and Michael Toftdal. -Copyright (C) 1996-2025 by Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. -Copyright (C) 2022-2025 by David Turner, Robert Wilhelm, Werner Lemberg, George Williams, and -Copyright (C) 2004-2025 by Masatake YAMATO and Redhat K.K. -Copyright (C) 2007-2025 by Derek Clegg and Michael Toftdal. -Copyright (C) 2003-2025 by Masatake YAMATO, Red Hat K.K., -Copyright (C) 1996-2025 by David Turner, Robert Wilhelm, Werner Lemberg, and Dominik Röttsches. -Copyright (C) 2007-2025 by David Turner. -Copyright (C) 2022-2025 by David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti. -Copyright (C) 2007-2025 by Rahul Bhalerao , . -Copyright (C) 2025 by Behdad Esfahbod. -Copyright (C) 2008-2025 by David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya. -Copyright (C) 2013-2025 by Google, Inc. -Copyright (C) 2019-2025 by Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg. -Copyright (C) 2009-2025 by Oran Agra and Mickey Gabel. -Copyright (C) 2018-2025 by David Turner, Robert Wilhelm, Dominik Röttsches, and Werner Lemberg. -Copyright (C) 2004-2025 by David Turner, Robert Wilhelm, Werner Lemberg, and George Williams. +Copyright (C) 1996-2026 by David Turner, Robert Wilhelm, and Werner Lemberg. +Copyright (C) 2007-2026 by Dereg Clegg and Michael Toftdal. +Copyright (C) 1996-2026 by Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. +Copyright (C) 2022-2026 by David Turner, Robert Wilhelm, Werner Lemberg, George Williams, and +Copyright (C) 2004-2026 by Masatake YAMATO and Redhat K.K. +Copyright (C) 2007-2026 by Derek Clegg and Michael Toftdal. +Copyright (C) 2003-2026 by Masatake YAMATO, Red Hat K.K., +Copyright (C) 1996-2026 by David Turner, Robert Wilhelm, Werner Lemberg, and Dominik Röttsches. +Copyright (C) 2007-2026 by David Turner. +Copyright (C) 2022-2026 by David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti. +Copyright (C) 2007-2026 by Rahul Bhalerao , . +Copyright (C) 2025-2026 by Behdad Esfahbod. +Copyright (C) 2008-2026 by David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya. +Copyright (C) 2013-2026 by Google, Inc. +Copyright (C) 2019-2026 by Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg. +Copyright (C) 2009-2026 by Oran Agra and Mickey Gabel. +Copyright (C) 2018-2026 by David Turner, Robert Wilhelm, Dominik Röttsches, and Werner Lemberg. +Copyright (C) 2004-2026 by David Turner, Robert Wilhelm, Werner Lemberg, and George Williams. The FreeType Project LICENSE ---------------------------- @@ -90,7 +90,7 @@ Introduction """ Portions of this software are copyright © The FreeType - Project (www.freetype.org). All rights reserved. + Project (https://freetype.org). All rights reserved. """ Please replace with the value from the FreeType version you @@ -204,7 +204,7 @@ Legal Terms Our home page can be found at - https://www.freetype.org + https://freetype.org ``` diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/config/ftconfig.h b/src/java.desktop/share/native/libfreetype/include/freetype/config/ftconfig.h index d66c5df9976..9800e99adf9 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/config/ftconfig.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/config/ftconfig.h @@ -4,7 +4,7 @@ * * ANSI-specific configuration file (specification only). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/config/ftheader.h b/src/java.desktop/share/native/libfreetype/include/freetype/config/ftheader.h index 16eab9048fc..24a9161e2f1 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/config/ftheader.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/config/ftheader.h @@ -4,7 +4,7 @@ * * Build macros of the FreeType 2 library. * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/config/ftoption.h b/src/java.desktop/share/native/libfreetype/include/freetype/config/ftoption.h index a0a1a410b68..a4e9c7f3e83 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/config/ftoption.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/config/ftoption.h @@ -4,7 +4,7 @@ * * User-selectable configuration macros (specification only). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/config/ftstdlib.h b/src/java.desktop/share/native/libfreetype/include/freetype/config/ftstdlib.h index f846b4456c1..1c63e8d654c 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/config/ftstdlib.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/config/ftstdlib.h @@ -5,7 +5,7 @@ * ANSI-specific library and header configuration file (specification * only). * - * Copyright (C) 2002-2025 by + * Copyright (C) 2002-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/config/integer-types.h b/src/java.desktop/share/native/libfreetype/include/freetype/config/integer-types.h index a0b892ece4b..4ab4c0c78bd 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/config/integer-types.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/config/integer-types.h @@ -4,7 +4,7 @@ * * FreeType integer types definitions. * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/config/mac-support.h b/src/java.desktop/share/native/libfreetype/include/freetype/config/mac-support.h index bd350851d56..ac48995320f 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/config/mac-support.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/config/mac-support.h @@ -4,7 +4,7 @@ * * Mac/OS X support configuration header. * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/config/public-macros.h b/src/java.desktop/share/native/libfreetype/include/freetype/config/public-macros.h index 9f28b394737..c76509a99f7 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/config/public-macros.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/config/public-macros.h @@ -4,7 +4,7 @@ * * Define a set of compiler macros used in public FreeType headers. * - * Copyright (C) 2020-2025 by + * Copyright (C) 2020-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/freetype.h b/src/java.desktop/share/native/libfreetype/include/freetype/freetype.h index e8a1b1e2f3e..68a9e0c6bd2 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/freetype.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/freetype.h @@ -4,7 +4,7 @@ * * FreeType high-level API and common types (specification only). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -5169,7 +5169,7 @@ FT_BEGIN_HEADER */ #define FREETYPE_MAJOR 2 #define FREETYPE_MINOR 14 -#define FREETYPE_PATCH 2 +#define FREETYPE_PATCH 3 /************************************************************************** diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftadvanc.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftadvanc.h index 62a856ccbd7..876a8a55cb9 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/ftadvanc.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftadvanc.h @@ -4,7 +4,7 @@ * * Quick computation of advance widths (specification only). * - * Copyright (C) 2008-2025 by + * Copyright (C) 2008-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftbbox.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftbbox.h index 348b4b3a268..0107d94986b 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/ftbbox.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftbbox.h @@ -4,7 +4,7 @@ * * FreeType exact bbox computation (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftbdf.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftbdf.h index ab142249217..fb1f3186486 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/ftbdf.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftbdf.h @@ -4,7 +4,7 @@ * * FreeType API for accessing BDF-specific strings (specification). * - * Copyright (C) 2002-2025 by + * Copyright (C) 2002-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftbitmap.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftbitmap.h index a22d43adf14..1df5f29aca1 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/ftbitmap.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftbitmap.h @@ -4,7 +4,7 @@ * * FreeType utility functions for bitmaps (specification). * - * Copyright (C) 2004-2025 by + * Copyright (C) 2004-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftcid.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftcid.h index 7cda8ff3f39..f9744716d98 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/ftcid.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftcid.h @@ -4,7 +4,7 @@ * * FreeType API for accessing CID font information (specification). * - * Copyright (C) 2007-2025 by + * Copyright (C) 2007-2026 by * Dereg Clegg and Michael Toftdal. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftcolor.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftcolor.h index 129b1a23fb0..1cce7471157 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/ftcolor.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftcolor.h @@ -4,7 +4,7 @@ * * FreeType's glyph color management (specification). * - * Copyright (C) 2018-2025 by + * Copyright (C) 2018-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftdriver.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftdriver.h index b65a06ab69b..39635f86c3e 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/ftdriver.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftdriver.h @@ -4,7 +4,7 @@ * * FreeType API for controlling driver modules (specification only). * - * Copyright (C) 2017-2025 by + * Copyright (C) 2017-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/fterrdef.h b/src/java.desktop/share/native/libfreetype/include/freetype/fterrdef.h index 3e591bede8d..ce3817e55df 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/fterrdef.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/fterrdef.h @@ -4,7 +4,7 @@ * * FreeType error codes (specification). * - * Copyright (C) 2002-2025 by + * Copyright (C) 2002-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/fterrors.h b/src/java.desktop/share/native/libfreetype/include/freetype/fterrors.h index eca494f90c0..218c4610e21 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/fterrors.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/fterrors.h @@ -4,7 +4,7 @@ * * FreeType error code handling (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftfntfmt.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftfntfmt.h index 5df82447d0e..2ea0c5f4d70 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/ftfntfmt.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftfntfmt.h @@ -4,7 +4,7 @@ * * Support functions for font formats. * - * Copyright (C) 2002-2025 by + * Copyright (C) 2002-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftgasp.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftgasp.h index 77e5a7e7bfd..632b536b471 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/ftgasp.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftgasp.h @@ -4,7 +4,7 @@ * * Access of TrueType's 'gasp' table (specification). * - * Copyright (C) 2007-2025 by + * Copyright (C) 2007-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftglyph.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftglyph.h index 3691781cf52..e967110e81e 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/ftglyph.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftglyph.h @@ -4,7 +4,7 @@ * * FreeType convenience functions to handle glyphs (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftgzip.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftgzip.h index e26c334c11a..f0c1550f61d 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/ftgzip.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftgzip.h @@ -4,7 +4,7 @@ * * Gzip-compressed stream support. * - * Copyright (C) 2002-2025 by + * Copyright (C) 2002-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftimage.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftimage.h index a4dc724f349..1fff76b20d9 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/ftimage.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftimage.h @@ -5,7 +5,7 @@ * FreeType glyph image formats and default raster interface * (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftincrem.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftincrem.h index 2233044754e..32637fe5af0 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/ftincrem.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftincrem.h @@ -4,7 +4,7 @@ * * FreeType incremental loading (specification). * - * Copyright (C) 2002-2025 by + * Copyright (C) 2002-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftlcdfil.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftlcdfil.h index 37bb5e1b8fb..72dbe2acccb 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/ftlcdfil.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftlcdfil.h @@ -5,7 +5,7 @@ * FreeType API for color filtering of subpixel bitmap glyphs * (specification). * - * Copyright (C) 2006-2025 by + * Copyright (C) 2006-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftlist.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftlist.h index 14958b0ff37..74b3ffaee9f 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/ftlist.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftlist.h @@ -4,7 +4,7 @@ * * Generic list support for FreeType (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftlogging.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftlogging.h index d155171136c..1670b12caf5 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/ftlogging.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftlogging.h @@ -4,7 +4,7 @@ * * Additional debugging APIs. * - * Copyright (C) 2020-2025 by + * Copyright (C) 2020-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftmac.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftmac.h index c5ac49101a4..a3ed7fba6f7 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/ftmac.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftmac.h @@ -4,7 +4,7 @@ * * Additional Mac-specific API. * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftmm.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftmm.h index ff0bbab59f9..fb239bda122 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/ftmm.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftmm.h @@ -4,7 +4,7 @@ * * FreeType variation font interface (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftmodapi.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftmodapi.h index 2669e4a03b3..7af33e33afe 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/ftmodapi.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftmodapi.h @@ -4,7 +4,7 @@ * * FreeType modules public interface (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftmoderr.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftmoderr.h index 8e2ef2f01f8..7c1b1fd3c04 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/ftmoderr.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftmoderr.h @@ -4,7 +4,7 @@ * * FreeType module error offsets (specification). * - * Copyright (C) 2001-2025 by + * Copyright (C) 2001-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftoutln.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftoutln.h index 2545ca8486b..68cf65bae15 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/ftoutln.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftoutln.h @@ -5,7 +5,7 @@ * Support for the FT_Outline type used to store glyph shapes of * most scalable font formats (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftparams.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftparams.h index 94dcd6399a6..3f6af8681f3 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/ftparams.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftparams.h @@ -4,7 +4,7 @@ * * FreeType API for possible FT_Parameter tags (specification only). * - * Copyright (C) 2017-2025 by + * Copyright (C) 2017-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftrender.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftrender.h index cc3102073b1..292c797cce5 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/ftrender.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftrender.h @@ -4,7 +4,7 @@ * * FreeType renderer modules public interface (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftsizes.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftsizes.h index fdb89f24ccc..f609eb2d76a 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/ftsizes.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftsizes.h @@ -4,7 +4,7 @@ * * FreeType size objects management (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftsnames.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftsnames.h index 99728574db6..f5511495f04 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/ftsnames.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftsnames.h @@ -7,7 +7,7 @@ * * This is _not_ used to retrieve glyph names! * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftstroke.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftstroke.h index 2c4761c768d..c7f1d4643f0 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/ftstroke.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftstroke.h @@ -4,7 +4,7 @@ * * FreeType path stroker (specification). * - * Copyright (C) 2002-2025 by + * Copyright (C) 2002-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftsynth.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftsynth.h index 93499a4b4f1..90b4b19c25f 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/ftsynth.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftsynth.h @@ -5,7 +5,7 @@ * FreeType synthesizing code for emboldening and slanting * (specification). * - * Copyright (C) 2000-2025 by + * Copyright (C) 2000-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftsystem.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftsystem.h index 1de9f8e603d..2ad3d7286dc 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/ftsystem.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftsystem.h @@ -4,7 +4,7 @@ * * FreeType low-level system interface definition (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/fttrigon.h b/src/java.desktop/share/native/libfreetype/include/freetype/fttrigon.h index ed7bd06a78f..ebedc3a8d1e 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/fttrigon.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/fttrigon.h @@ -4,7 +4,7 @@ * * FreeType trigonometric functions (specification). * - * Copyright (C) 2001-2025 by + * Copyright (C) 2001-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/fttypes.h b/src/java.desktop/share/native/libfreetype/include/freetype/fttypes.h index e207c5ebe09..97ddcde65aa 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/fttypes.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/fttypes.h @@ -4,7 +4,7 @@ * * FreeType simple types definitions (specification only). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/autohint.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/autohint.h index 987e704e9b0..a22d8af7cd9 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/autohint.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/autohint.h @@ -4,7 +4,7 @@ * * High-level 'autohint' module-specific interface (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/cffotypes.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/cffotypes.h index 26ee43bb9a9..8d6acbce7ac 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/cffotypes.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/cffotypes.h @@ -4,7 +4,7 @@ * * Basic OpenType/CFF object type definitions (specification). * - * Copyright (C) 2017-2025 by + * Copyright (C) 2017-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/cfftypes.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/cfftypes.h index 754122fa646..d474dcf40ea 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/cfftypes.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/cfftypes.h @@ -5,7 +5,7 @@ * Basic OpenType/CFF type definitions and interface (specification * only). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/compiler-macros.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/compiler-macros.h index e6d0166d888..4863d6de75e 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/compiler-macros.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/compiler-macros.h @@ -4,7 +4,7 @@ * * Compiler-specific macro definitions used internally by FreeType. * - * Copyright (C) 2020-2025 by + * Copyright (C) 2020-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftcalc.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftcalc.h index 16a732224ef..4c4943164a3 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftcalc.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftcalc.h @@ -4,7 +4,7 @@ * * Arithmetic computations (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftdebug.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftdebug.h index d7facf40d12..62b9ec2f79c 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftdebug.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftdebug.h @@ -4,7 +4,7 @@ * * Debugging and logging component (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftdrv.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftdrv.h index 24be4dad36b..d52fc84f0fd 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftdrv.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftdrv.h @@ -4,7 +4,7 @@ * * FreeType internal font driver interface (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftgloadr.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftgloadr.h index 8f2a54c015b..902135e460c 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftgloadr.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftgloadr.h @@ -4,7 +4,7 @@ * * The FreeType glyph loader (specification). * - * Copyright (C) 2002-2025 by + * Copyright (C) 2002-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftmemory.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftmemory.h index c75c33f2895..ca840cb510b 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftmemory.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftmemory.h @@ -4,7 +4,7 @@ * * The FreeType memory management macros (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftmmtypes.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftmmtypes.h index be3747bbf94..a4db9c487b7 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftmmtypes.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftmmtypes.h @@ -5,7 +5,7 @@ * OpenType Variations type definitions for internal use * with the multi-masters service (specification). * - * Copyright (C) 2022-2025 by + * Copyright (C) 2022-2026 by * David Turner, Robert Wilhelm, Werner Lemberg, George Williams, and * Dominik Röttsches. * diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftobjs.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftobjs.h index d4d7bc00fe9..4fa4991dd88 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftobjs.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftobjs.h @@ -4,7 +4,7 @@ * * The FreeType private base classes (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftpsprop.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftpsprop.h index 18a954d22f5..5967199a3bc 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftpsprop.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftpsprop.h @@ -4,7 +4,7 @@ * * Get and set properties of PostScript drivers (specification). * - * Copyright (C) 2017-2025 by + * Copyright (C) 2017-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftrfork.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftrfork.h index e077f98bfb9..d0bb6b5bb00 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftrfork.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftrfork.h @@ -4,7 +4,7 @@ * * Embedded resource forks accessor (specification). * - * Copyright (C) 2004-2025 by + * Copyright (C) 2004-2026 by * Masatake YAMATO and Redhat K.K. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftserv.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftserv.h index ce11bba19b2..9c6406c82d8 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftserv.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftserv.h @@ -4,7 +4,7 @@ * * The FreeType services (specification only). * - * Copyright (C) 2003-2025 by + * Copyright (C) 2003-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftstream.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftstream.h index 20c1dd7c4b0..d60cd481c89 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftstream.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftstream.h @@ -4,7 +4,7 @@ * * Stream handling (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/fttrace.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/fttrace.h index 3fd592800e2..798896cd0c8 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/fttrace.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/fttrace.h @@ -4,7 +4,7 @@ * * Tracing handling (specification only). * - * Copyright (C) 2002-2025 by + * Copyright (C) 2002-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftvalid.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftvalid.h index 03a726c82cb..fbcf2c63efa 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftvalid.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftvalid.h @@ -4,7 +4,7 @@ * * FreeType validation support (specification). * - * Copyright (C) 2004-2025 by + * Copyright (C) 2004-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/psaux.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/psaux.h index 344be0f19a7..ee574fef11b 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/psaux.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/psaux.h @@ -5,7 +5,7 @@ * Auxiliary functions and data structures related to PostScript fonts * (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/pshints.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/pshints.h index 96c5d84f058..e7adcd38058 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/pshints.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/pshints.h @@ -6,7 +6,7 @@ * recorders (specification only). These are used to support native * T1/T2 hints in the 'type1', 'cid', and 'cff' font drivers. * - * Copyright (C) 2001-2025 by + * Copyright (C) 2001-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svbdf.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svbdf.h index 5bd51da23f4..52212cc7a2b 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svbdf.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svbdf.h @@ -4,7 +4,7 @@ * * The FreeType BDF services (specification). * - * Copyright (C) 2003-2025 by + * Copyright (C) 2003-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svcfftl.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svcfftl.h index c97bf84fb2e..ab29dede537 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svcfftl.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svcfftl.h @@ -4,7 +4,7 @@ * * The FreeType CFF tables loader service (specification). * - * Copyright (C) 2017-2025 by + * Copyright (C) 2017-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svcid.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svcid.h index 748a8caf887..9063211ee01 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svcid.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svcid.h @@ -4,7 +4,7 @@ * * The FreeType CID font services (specification). * - * Copyright (C) 2007-2025 by + * Copyright (C) 2007-2026 by * Derek Clegg and Michael Toftdal. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svfntfmt.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svfntfmt.h index 690fdc2a24f..770381da67a 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svfntfmt.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svfntfmt.h @@ -4,7 +4,7 @@ * * The FreeType font format service (specification only). * - * Copyright (C) 2003-2025 by + * Copyright (C) 2003-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svgldict.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svgldict.h index 7128d6f3d7a..6020f9f78a6 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svgldict.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svgldict.h @@ -4,7 +4,7 @@ * * The FreeType glyph dictionary services (specification). * - * Copyright (C) 2003-2025 by + * Copyright (C) 2003-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svgxval.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svgxval.h index 1ca3e0a031b..056114e6f8c 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svgxval.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svgxval.h @@ -4,7 +4,7 @@ * * FreeType API for validating TrueTypeGX/AAT tables (specification). * - * Copyright (C) 2004-2025 by + * Copyright (C) 2004-2026 by * Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svkern.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svkern.h index 8a3d59bec6d..7a06a01e8f0 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svkern.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svkern.h @@ -4,7 +4,7 @@ * * The FreeType Kerning service (specification). * - * Copyright (C) 2006-2025 by + * Copyright (C) 2006-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svmetric.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svmetric.h index 4dde3a8151a..b6559d2b1ad 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svmetric.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svmetric.h @@ -4,7 +4,7 @@ * * The FreeType services for metrics variations (specification). * - * Copyright (C) 2016-2025 by + * Copyright (C) 2016-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svmm.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svmm.h index 9be133e2db0..fd851dba120 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svmm.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svmm.h @@ -4,7 +4,7 @@ * * The FreeType Multiple Masters and GX var services (specification). * - * Copyright (C) 2003-2025 by + * Copyright (C) 2003-2026 by * David Turner, Robert Wilhelm, Werner Lemberg, and Dominik Röttsches. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svotval.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svotval.h index 933e5de98da..487dca3f043 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svotval.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svotval.h @@ -4,7 +4,7 @@ * * The FreeType OpenType validation service (specification). * - * Copyright (C) 2004-2025 by + * Copyright (C) 2004-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpfr.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpfr.h index c81b6a68a8b..94cd695eb00 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpfr.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpfr.h @@ -4,7 +4,7 @@ * * Internal PFR service functions (specification). * - * Copyright (C) 2003-2025 by + * Copyright (C) 2003-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpostnm.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpostnm.h index 33864ebc344..d99f4f681ef 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpostnm.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpostnm.h @@ -4,7 +4,7 @@ * * The FreeType PostScript name services (specification). * - * Copyright (C) 2003-2025 by + * Copyright (C) 2003-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svprop.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svprop.h index 0eb79c885d8..b6cba4c7f42 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svprop.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svprop.h @@ -4,7 +4,7 @@ * * The FreeType property service (specification). * - * Copyright (C) 2012-2025 by + * Copyright (C) 2012-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpscmap.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpscmap.h index 8f85d12157c..310eb53f333 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpscmap.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpscmap.h @@ -4,7 +4,7 @@ * * The FreeType PostScript charmap service (specification). * - * Copyright (C) 2003-2025 by + * Copyright (C) 2003-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpsinfo.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpsinfo.h index 83de04478df..78725a48fa5 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpsinfo.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpsinfo.h @@ -4,7 +4,7 @@ * * The FreeType PostScript info service (specification). * - * Copyright (C) 2003-2025 by + * Copyright (C) 2003-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svsfnt.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svsfnt.h index 9bf5e3473c4..0ce5aca1376 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svsfnt.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svsfnt.h @@ -4,7 +4,7 @@ * * The FreeType SFNT table loading service (specification). * - * Copyright (C) 2003-2025 by + * Copyright (C) 2003-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svttcmap.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svttcmap.h index fc9b0aeb8e3..14921304ebf 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svttcmap.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svttcmap.h @@ -4,7 +4,7 @@ * * The FreeType TrueType/sfnt cmap extra information service. * - * Copyright (C) 2003-2025 by + * Copyright (C) 2003-2026 by * Masatake YAMATO, Redhat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svtteng.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svtteng.h index 979e9ea102e..d4a9bab6ded 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svtteng.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svtteng.h @@ -4,7 +4,7 @@ * * The FreeType TrueType engine query service (specification). * - * Copyright (C) 2006-2025 by + * Copyright (C) 2006-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svttglyf.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svttglyf.h index e4f54c10037..528238024ba 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svttglyf.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svttglyf.h @@ -4,7 +4,7 @@ * * The FreeType TrueType glyph service. * - * Copyright (C) 2007-2025 by + * Copyright (C) 2007-2026 by * David Turner. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svwinfnt.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svwinfnt.h index ff887ffdc03..e5a3a6649b6 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svwinfnt.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svwinfnt.h @@ -4,7 +4,7 @@ * * The FreeType Windows FNT/FONT service (specification). * - * Copyright (C) 2003-2025 by + * Copyright (C) 2003-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/sfnt.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/sfnt.h index adba2178877..cc1ac7a6e4c 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/sfnt.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/sfnt.h @@ -4,7 +4,7 @@ * * High-level 'sfnt' driver interface (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/svginterface.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/svginterface.h index 20c73b2fbd2..3a4ca314ddb 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/svginterface.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/svginterface.h @@ -4,7 +4,7 @@ * * Interface of ot-svg module (specification only). * - * Copyright (C) 2022-2025 by + * Copyright (C) 2022-2026 by * David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/t1types.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/t1types.h index 5b26e4620d0..e39076f1956 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/t1types.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/t1types.h @@ -5,7 +5,7 @@ * Basic Type1/Type2 type definitions and interface (specification * only). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/tttypes.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/tttypes.h index d0e5eee89bc..65341a3a259 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/tttypes.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/tttypes.h @@ -5,7 +5,7 @@ * Basic SFNT/TrueType type definitions and interface (specification * only). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/wofftypes.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/wofftypes.h index 7d5b7df0fa1..b8ef95e27aa 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/wofftypes.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/wofftypes.h @@ -5,7 +5,7 @@ * Basic WOFF/WOFF2 type definitions and interface (specification * only). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/otsvg.h b/src/java.desktop/share/native/libfreetype/include/freetype/otsvg.h index 326bbcd0153..42330a703b0 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/otsvg.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/otsvg.h @@ -4,7 +4,7 @@ * * Interface for OT-SVG support related things (specification). * - * Copyright (C) 2022-2025 by + * Copyright (C) 2022-2026 by * David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/t1tables.h b/src/java.desktop/share/native/libfreetype/include/freetype/t1tables.h index fe769f607fa..badfdf40762 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/t1tables.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/t1tables.h @@ -5,7 +5,7 @@ * Basic Type 1/Type 2 tables definitions and interface (specification * only). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ttnameid.h b/src/java.desktop/share/native/libfreetype/include/freetype/ttnameid.h index 3ef61091cc9..76ddb6f0a51 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/ttnameid.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/ttnameid.h @@ -4,7 +4,7 @@ * * TrueType name ID definitions (specification only). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -169,7 +169,7 @@ FT_BEGIN_HEADER #define TT_MAC_ID_LAOTIAN 22 #define TT_MAC_ID_GEORGIAN 23 #define TT_MAC_ID_ARMENIAN 24 -#define TT_MAC_ID_MALDIVIAN 25 +#define TT_MAC_ID_MALDIVIAN 25 /* TrueType version 1.66 */ #define TT_MAC_ID_SIMPLIFIED_CHINESE 25 #define TT_MAC_ID_TIBETAN 26 #define TT_MAC_ID_MONGOLIAN 27 diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/tttables.h b/src/java.desktop/share/native/libfreetype/include/freetype/tttables.h index aa4336435d9..a2ec304483a 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/tttables.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/tttables.h @@ -5,7 +5,7 @@ * Basic SFNT/TrueType tables definitions and interface * (specification only). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/tttags.h b/src/java.desktop/share/native/libfreetype/include/freetype/tttags.h index 56bb0a3ee5e..3be3e2ff905 100644 --- a/src/java.desktop/share/native/libfreetype/include/freetype/tttags.h +++ b/src/java.desktop/share/native/libfreetype/include/freetype/tttags.h @@ -4,7 +4,7 @@ * * Tags for TrueType and OpenType tables (specification only). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/include/ft2build.h b/src/java.desktop/share/native/libfreetype/include/ft2build.h index 3008aea7cf5..ffbf4a1e6ad 100644 --- a/src/java.desktop/share/native/libfreetype/include/ft2build.h +++ b/src/java.desktop/share/native/libfreetype/include/ft2build.h @@ -4,7 +4,7 @@ * * FreeType 2 build and setup macros. * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afadjust.c b/src/java.desktop/share/native/libfreetype/src/autofit/afadjust.c index a1aa45914d0..6940baf68cc 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/afadjust.c +++ b/src/java.desktop/share/native/libfreetype/src/autofit/afadjust.c @@ -4,7 +4,7 @@ * * Auto-fitter routines to adjust components based on charcode (body). * - * Copyright (C) 2023-2025 by + * Copyright (C) 2023-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Written by Craig White . diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afadjust.h b/src/java.desktop/share/native/libfreetype/src/autofit/afadjust.h index 4837451ae4c..85dbfaad29e 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/afadjust.h +++ b/src/java.desktop/share/native/libfreetype/src/autofit/afadjust.h @@ -4,7 +4,7 @@ * * Auto-fitter routines to adjust components based on charcode (header). * - * Copyright (C) 2023-2025 by + * Copyright (C) 2023-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Written by Craig White . diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afblue.c b/src/java.desktop/share/native/libfreetype/src/autofit/afblue.c index a6219bdfe41..77c8389ec7f 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/afblue.c +++ b/src/java.desktop/share/native/libfreetype/src/autofit/afblue.c @@ -7,7 +7,7 @@ * * Auto-fitter data for blue strings (body). * - * Copyright (C) 2013-2025 by + * Copyright (C) 2013-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afblue.cin b/src/java.desktop/share/native/libfreetype/src/autofit/afblue.cin index 786c6b3b9e6..70b7e025214 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/afblue.cin +++ b/src/java.desktop/share/native/libfreetype/src/autofit/afblue.cin @@ -4,7 +4,7 @@ * * Auto-fitter data for blue strings (body). * - * Copyright (C) 2013-2025 by + * Copyright (C) 2013-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afblue.dat b/src/java.desktop/share/native/libfreetype/src/autofit/afblue.dat index f6e96ff8189..e62754fc7e0 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/afblue.dat +++ b/src/java.desktop/share/native/libfreetype/src/autofit/afblue.dat @@ -2,7 +2,7 @@ // // Auto-fitter data for blue strings. // -// Copyright (C) 2013-2025 by +// Copyright (C) 2013-2026 by // David Turner, Robert Wilhelm, and Werner Lemberg. // // This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afblue.h b/src/java.desktop/share/native/libfreetype/src/autofit/afblue.h index 5bb8406dc2b..f124eedee4d 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/afblue.h +++ b/src/java.desktop/share/native/libfreetype/src/autofit/afblue.h @@ -7,7 +7,7 @@ * * Auto-fitter data for blue strings (specification). * - * Copyright (C) 2013-2025 by + * Copyright (C) 2013-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afblue.hin b/src/java.desktop/share/native/libfreetype/src/autofit/afblue.hin index dbac14548d5..931c5010606 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/afblue.hin +++ b/src/java.desktop/share/native/libfreetype/src/autofit/afblue.hin @@ -4,7 +4,7 @@ * * Auto-fitter data for blue strings (specification). * - * Copyright (C) 2013-2025 by + * Copyright (C) 2013-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afcjk.c b/src/java.desktop/share/native/libfreetype/src/autofit/afcjk.c index 7086601838c..7a1cc32c9d4 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/afcjk.c +++ b/src/java.desktop/share/native/libfreetype/src/autofit/afcjk.c @@ -4,7 +4,7 @@ * * Auto-fitter hinting routines for CJK writing system (body). * - * Copyright (C) 2006-2025 by + * Copyright (C) 2006-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afcjk.h b/src/java.desktop/share/native/libfreetype/src/autofit/afcjk.h index bd1b39358e0..98681868a85 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/afcjk.h +++ b/src/java.desktop/share/native/libfreetype/src/autofit/afcjk.h @@ -4,7 +4,7 @@ * * Auto-fitter hinting routines for CJK writing system (specification). * - * Copyright (C) 2006-2025 by + * Copyright (C) 2006-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afcover.h b/src/java.desktop/share/native/libfreetype/src/autofit/afcover.h index b93bcd1a2c5..d60e0050bec 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/afcover.h +++ b/src/java.desktop/share/native/libfreetype/src/autofit/afcover.h @@ -4,7 +4,7 @@ * * Auto-fitter coverages (specification only). * - * Copyright (C) 2013-2025 by + * Copyright (C) 2013-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afdummy.c b/src/java.desktop/share/native/libfreetype/src/autofit/afdummy.c index 8613544f913..f9d1dd38dba 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/afdummy.c +++ b/src/java.desktop/share/native/libfreetype/src/autofit/afdummy.c @@ -5,7 +5,7 @@ * Auto-fitter dummy routines to be used if no hinting should be * performed (body). * - * Copyright (C) 2003-2025 by + * Copyright (C) 2003-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afdummy.h b/src/java.desktop/share/native/libfreetype/src/autofit/afdummy.h index 78a79439d95..14546b1e50e 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/afdummy.h +++ b/src/java.desktop/share/native/libfreetype/src/autofit/afdummy.h @@ -5,7 +5,7 @@ * Auto-fitter dummy routines to be used if no hinting should be * performed (specification). * - * Copyright (C) 2003-2025 by + * Copyright (C) 2003-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/aferrors.h b/src/java.desktop/share/native/libfreetype/src/autofit/aferrors.h index f3093fc90df..3d7538ba2d8 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/aferrors.h +++ b/src/java.desktop/share/native/libfreetype/src/autofit/aferrors.h @@ -4,7 +4,7 @@ * * Autofitter error codes (specification only). * - * Copyright (C) 2005-2025 by + * Copyright (C) 2005-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afglobal.c b/src/java.desktop/share/native/libfreetype/src/autofit/afglobal.c index e74d8141161..ff6903cc174 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/afglobal.c +++ b/src/java.desktop/share/native/libfreetype/src/autofit/afglobal.c @@ -4,7 +4,7 @@ * * Auto-fitter routines to compute global hinting values (body). * - * Copyright (C) 2003-2025 by + * Copyright (C) 2003-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afglobal.h b/src/java.desktop/share/native/libfreetype/src/autofit/afglobal.h index dc061159492..c4dd9335839 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/afglobal.h +++ b/src/java.desktop/share/native/libfreetype/src/autofit/afglobal.h @@ -5,7 +5,7 @@ * Auto-fitter routines to compute global hinting values * (specification). * - * Copyright (C) 2003-2025 by + * Copyright (C) 2003-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afhints.c b/src/java.desktop/share/native/libfreetype/src/autofit/afhints.c index 11faa655f62..376912a5d12 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/afhints.c +++ b/src/java.desktop/share/native/libfreetype/src/autofit/afhints.c @@ -4,7 +4,7 @@ * * Auto-fitter hinting routines (body). * - * Copyright (C) 2003-2025 by + * Copyright (C) 2003-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afhints.h b/src/java.desktop/share/native/libfreetype/src/autofit/afhints.h index 46b3ed3366f..84244d6f5c7 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/afhints.h +++ b/src/java.desktop/share/native/libfreetype/src/autofit/afhints.h @@ -4,7 +4,7 @@ * * Auto-fitter hinting routines (specification). * - * Copyright (C) 2003-2025 by + * Copyright (C) 2003-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afindic.c b/src/java.desktop/share/native/libfreetype/src/autofit/afindic.c index a2cd14f8817..29b6d22ed65 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/afindic.c +++ b/src/java.desktop/share/native/libfreetype/src/autofit/afindic.c @@ -4,7 +4,7 @@ * * Auto-fitter hinting routines for Indic writing system (body). * - * Copyright (C) 2007-2025 by + * Copyright (C) 2007-2026 by * Rahul Bhalerao , . * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afindic.h b/src/java.desktop/share/native/libfreetype/src/autofit/afindic.h index a2e825e9f86..df4892a9f1c 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/afindic.h +++ b/src/java.desktop/share/native/libfreetype/src/autofit/afindic.h @@ -5,7 +5,7 @@ * Auto-fitter hinting routines for Indic writing system * (specification). * - * Copyright (C) 2007-2025 by + * Copyright (C) 2007-2026 by * Rahul Bhalerao , . * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/aflatin.c b/src/java.desktop/share/native/libfreetype/src/autofit/aflatin.c index 4a42d919474..73addf28eb4 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/aflatin.c +++ b/src/java.desktop/share/native/libfreetype/src/autofit/aflatin.c @@ -4,7 +4,7 @@ * * Auto-fitter hinting routines for latin writing system (body). * - * Copyright (C) 2003-2025 by + * Copyright (C) 2003-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/aflatin.h b/src/java.desktop/share/native/libfreetype/src/autofit/aflatin.h index 82b4b0d480d..b6bdc5177f7 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/aflatin.h +++ b/src/java.desktop/share/native/libfreetype/src/autofit/aflatin.h @@ -5,7 +5,7 @@ * Auto-fitter hinting routines for latin writing system * (specification). * - * Copyright (C) 2003-2025 by + * Copyright (C) 2003-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afloader.c b/src/java.desktop/share/native/libfreetype/src/autofit/afloader.c index 4e2ac1f1ce3..8ac7b53856b 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/afloader.c +++ b/src/java.desktop/share/native/libfreetype/src/autofit/afloader.c @@ -4,7 +4,7 @@ * * Auto-fitter glyph loading routines (body). * - * Copyright (C) 2003-2025 by + * Copyright (C) 2003-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afloader.h b/src/java.desktop/share/native/libfreetype/src/autofit/afloader.h index a04b4df0b3b..8efd0fd57e9 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/afloader.h +++ b/src/java.desktop/share/native/libfreetype/src/autofit/afloader.h @@ -4,7 +4,7 @@ * * Auto-fitter glyph loading routines (specification). * - * Copyright (C) 2003-2025 by + * Copyright (C) 2003-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afmodule.c b/src/java.desktop/share/native/libfreetype/src/autofit/afmodule.c index 22d85a889e8..57d5d47dfbd 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/afmodule.c +++ b/src/java.desktop/share/native/libfreetype/src/autofit/afmodule.c @@ -4,7 +4,7 @@ * * Auto-fitter module implementation (body). * - * Copyright (C) 2003-2025 by + * Copyright (C) 2003-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afmodule.h b/src/java.desktop/share/native/libfreetype/src/autofit/afmodule.h index c62421ef696..1f8a68122d3 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/afmodule.h +++ b/src/java.desktop/share/native/libfreetype/src/autofit/afmodule.h @@ -4,7 +4,7 @@ * * Auto-fitter module implementation (specification). * - * Copyright (C) 2003-2025 by + * Copyright (C) 2003-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afranges.c b/src/java.desktop/share/native/libfreetype/src/autofit/afranges.c index fd54948f3a5..4d0755decb2 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/afranges.c +++ b/src/java.desktop/share/native/libfreetype/src/autofit/afranges.c @@ -4,7 +4,7 @@ * * Auto-fitter Unicode script ranges (body). * - * Copyright (C) 2013-2025 by + * Copyright (C) 2013-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afranges.h b/src/java.desktop/share/native/libfreetype/src/autofit/afranges.h index fa00eb75046..f2936945128 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/afranges.h +++ b/src/java.desktop/share/native/libfreetype/src/autofit/afranges.h @@ -4,7 +4,7 @@ * * Auto-fitter Unicode script ranges (specification). * - * Copyright (C) 2013-2025 by + * Copyright (C) 2013-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afscript.h b/src/java.desktop/share/native/libfreetype/src/autofit/afscript.h index 5c4cbbcb922..d071ed68b7e 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/afscript.h +++ b/src/java.desktop/share/native/libfreetype/src/autofit/afscript.h @@ -4,7 +4,7 @@ * * Auto-fitter scripts (specification only). * - * Copyright (C) 2013-2025 by + * Copyright (C) 2013-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afshaper.c b/src/java.desktop/share/native/libfreetype/src/autofit/afshaper.c index f3c0744fd9d..5c9e5376ad0 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/afshaper.c +++ b/src/java.desktop/share/native/libfreetype/src/autofit/afshaper.c @@ -4,7 +4,7 @@ * * HarfBuzz interface for accessing OpenType features (body). * - * Copyright (C) 2013-2025 by + * Copyright (C) 2013-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afshaper.h b/src/java.desktop/share/native/libfreetype/src/autofit/afshaper.h index 757368fc9c0..6e73b9fb2eb 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/afshaper.h +++ b/src/java.desktop/share/native/libfreetype/src/autofit/afshaper.h @@ -4,7 +4,7 @@ * * HarfBuzz interface for accessing OpenType features (specification). * - * Copyright (C) 2013-2025 by + * Copyright (C) 2013-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afstyles.h b/src/java.desktop/share/native/libfreetype/src/autofit/afstyles.h index 206232efe25..e7a7fe531ba 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/afstyles.h +++ b/src/java.desktop/share/native/libfreetype/src/autofit/afstyles.h @@ -4,7 +4,7 @@ * * Auto-fitter styles (specification only). * - * Copyright (C) 2013-2025 by + * Copyright (C) 2013-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/aftypes.h b/src/java.desktop/share/native/libfreetype/src/autofit/aftypes.h index 959640a12ec..a3a881eedeb 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/aftypes.h +++ b/src/java.desktop/share/native/libfreetype/src/autofit/aftypes.h @@ -4,7 +4,7 @@ * * Auto-fitter types (specification only). * - * Copyright (C) 2003-2025 by + * Copyright (C) 2003-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afws-decl.h b/src/java.desktop/share/native/libfreetype/src/autofit/afws-decl.h index 12fa7a27a2b..ddebdcd1e78 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/afws-decl.h +++ b/src/java.desktop/share/native/libfreetype/src/autofit/afws-decl.h @@ -4,7 +4,7 @@ * * Auto-fitter writing system declarations (specification only). * - * Copyright (C) 2013-2025 by + * Copyright (C) 2013-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afws-iter.h b/src/java.desktop/share/native/libfreetype/src/autofit/afws-iter.h index 1752697b375..720c2dc50c9 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/afws-iter.h +++ b/src/java.desktop/share/native/libfreetype/src/autofit/afws-iter.h @@ -4,7 +4,7 @@ * * Auto-fitter writing systems iterator (specification only). * - * Copyright (C) 2013-2025 by + * Copyright (C) 2013-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/ft-hb.c b/src/java.desktop/share/native/libfreetype/src/autofit/ft-hb.c index 3c145d04640..ed438da6afe 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/ft-hb.c +++ b/src/java.desktop/share/native/libfreetype/src/autofit/ft-hb.c @@ -4,7 +4,7 @@ * * FreeType-HarfBuzz bridge (body). * - * Copyright (C) 2025 by + * Copyright (C) 2025-2026 by * Behdad Esfahbod. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/ft-hb.h b/src/java.desktop/share/native/libfreetype/src/autofit/ft-hb.h index 95914deb8d3..d2cc0482eb6 100644 --- a/src/java.desktop/share/native/libfreetype/src/autofit/ft-hb.h +++ b/src/java.desktop/share/native/libfreetype/src/autofit/ft-hb.h @@ -4,7 +4,7 @@ * * FreeType-HarfBuzz bridge (specification). * - * Copyright (C) 2025 by + * Copyright (C) 2025-2026 by * Behdad Esfahbod. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftadvanc.c b/src/java.desktop/share/native/libfreetype/src/base/ftadvanc.c index 7b965c62d58..64858346666 100644 --- a/src/java.desktop/share/native/libfreetype/src/base/ftadvanc.c +++ b/src/java.desktop/share/native/libfreetype/src/base/ftadvanc.c @@ -4,7 +4,7 @@ * * Quick computation of advance widths (body). * - * Copyright (C) 2008-2025 by + * Copyright (C) 2008-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftbase.h b/src/java.desktop/share/native/libfreetype/src/base/ftbase.h index 66f091165fe..952ac51d503 100644 --- a/src/java.desktop/share/native/libfreetype/src/base/ftbase.h +++ b/src/java.desktop/share/native/libfreetype/src/base/ftbase.h @@ -4,7 +4,7 @@ * * Private functions used in the `base' module (specification). * - * Copyright (C) 2008-2025 by + * Copyright (C) 2008-2026 by * David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftbbox.c b/src/java.desktop/share/native/libfreetype/src/base/ftbbox.c index feccdee5dd7..4641ce27e82 100644 --- a/src/java.desktop/share/native/libfreetype/src/base/ftbbox.c +++ b/src/java.desktop/share/native/libfreetype/src/base/ftbbox.c @@ -4,7 +4,7 @@ * * FreeType bbox computation (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftbitmap.c b/src/java.desktop/share/native/libfreetype/src/base/ftbitmap.c index 364f881e435..f88cbc11e63 100644 --- a/src/java.desktop/share/native/libfreetype/src/base/ftbitmap.c +++ b/src/java.desktop/share/native/libfreetype/src/base/ftbitmap.c @@ -4,7 +4,7 @@ * * FreeType utility functions for bitmaps (body). * - * Copyright (C) 2004-2025 by + * Copyright (C) 2004-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftcalc.c b/src/java.desktop/share/native/libfreetype/src/base/ftcalc.c index 7d6e12e2543..d233dba3d6b 100644 --- a/src/java.desktop/share/native/libfreetype/src/base/ftcalc.c +++ b/src/java.desktop/share/native/libfreetype/src/base/ftcalc.c @@ -4,7 +4,7 @@ * * Arithmetic computations (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftcid.c b/src/java.desktop/share/native/libfreetype/src/base/ftcid.c index 35cd0fcd2be..878c666e129 100644 --- a/src/java.desktop/share/native/libfreetype/src/base/ftcid.c +++ b/src/java.desktop/share/native/libfreetype/src/base/ftcid.c @@ -4,7 +4,7 @@ * * FreeType API for accessing CID font information. * - * Copyright (C) 2007-2025 by + * Copyright (C) 2007-2026 by * Derek Clegg and Michael Toftdal. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftcolor.c b/src/java.desktop/share/native/libfreetype/src/base/ftcolor.c index 90b02b7d2de..ed6b5f0599f 100644 --- a/src/java.desktop/share/native/libfreetype/src/base/ftcolor.c +++ b/src/java.desktop/share/native/libfreetype/src/base/ftcolor.c @@ -4,7 +4,7 @@ * * FreeType's glyph color management (body). * - * Copyright (C) 2018-2025 by + * Copyright (C) 2018-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftdbgmem.c b/src/java.desktop/share/native/libfreetype/src/base/ftdbgmem.c index 7f54e759b16..0335f142562 100644 --- a/src/java.desktop/share/native/libfreetype/src/base/ftdbgmem.c +++ b/src/java.desktop/share/native/libfreetype/src/base/ftdbgmem.c @@ -4,7 +4,7 @@ * * Memory debugger (body). * - * Copyright (C) 2001-2025 by + * Copyright (C) 2001-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftdebug.c b/src/java.desktop/share/native/libfreetype/src/base/ftdebug.c index c615f29e521..27091a55798 100644 --- a/src/java.desktop/share/native/libfreetype/src/base/ftdebug.c +++ b/src/java.desktop/share/native/libfreetype/src/base/ftdebug.c @@ -4,7 +4,7 @@ * * Debugging and logging component (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftfntfmt.c b/src/java.desktop/share/native/libfreetype/src/base/ftfntfmt.c index 7f4f14ffdb0..99e8c2b17df 100644 --- a/src/java.desktop/share/native/libfreetype/src/base/ftfntfmt.c +++ b/src/java.desktop/share/native/libfreetype/src/base/ftfntfmt.c @@ -4,7 +4,7 @@ * * FreeType utility file for font formats (body). * - * Copyright (C) 2002-2025 by + * Copyright (C) 2002-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftfstype.c b/src/java.desktop/share/native/libfreetype/src/base/ftfstype.c index 3a95752ffaa..58d5144a9e0 100644 --- a/src/java.desktop/share/native/libfreetype/src/base/ftfstype.c +++ b/src/java.desktop/share/native/libfreetype/src/base/ftfstype.c @@ -4,7 +4,7 @@ * * FreeType utility file to access FSType data (body). * - * Copyright (C) 2008-2025 by + * Copyright (C) 2008-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftgasp.c b/src/java.desktop/share/native/libfreetype/src/base/ftgasp.c index 2202240b57e..3c13456802e 100644 --- a/src/java.desktop/share/native/libfreetype/src/base/ftgasp.c +++ b/src/java.desktop/share/native/libfreetype/src/base/ftgasp.c @@ -4,7 +4,7 @@ * * Access of TrueType's `gasp' table (body). * - * Copyright (C) 2007-2025 by + * Copyright (C) 2007-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftgloadr.c b/src/java.desktop/share/native/libfreetype/src/base/ftgloadr.c index 47781bc4d5c..bd66e61d1c2 100644 --- a/src/java.desktop/share/native/libfreetype/src/base/ftgloadr.c +++ b/src/java.desktop/share/native/libfreetype/src/base/ftgloadr.c @@ -4,7 +4,7 @@ * * The FreeType glyph loader (body). * - * Copyright (C) 2002-2025 by + * Copyright (C) 2002-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftglyph.c b/src/java.desktop/share/native/libfreetype/src/base/ftglyph.c index 6138cfeec2c..096f4d965e8 100644 --- a/src/java.desktop/share/native/libfreetype/src/base/ftglyph.c +++ b/src/java.desktop/share/native/libfreetype/src/base/ftglyph.c @@ -4,7 +4,7 @@ * * FreeType convenience functions to handle glyphs (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -856,9 +856,9 @@ goto Exit; /* in case of success, copy the bitmap to the glyph bitmap */ - error = ft_bitmap_glyph_init( (FT_Glyph)bitmap, &dummy ); - if ( error ) - goto Exit; + bitmap->left = dummy.bitmap_left; + bitmap->top = dummy.bitmap_top; + bitmap->bitmap = dummy.bitmap; /* copy advance */ bitmap->root.advance = glyph->advance; diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftinit.c b/src/java.desktop/share/native/libfreetype/src/base/ftinit.c index 37d7f87bcb9..b20289316dc 100644 --- a/src/java.desktop/share/native/libfreetype/src/base/ftinit.c +++ b/src/java.desktop/share/native/libfreetype/src/base/ftinit.c @@ -4,7 +4,7 @@ * * FreeType initialization layer (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftlcdfil.c b/src/java.desktop/share/native/libfreetype/src/base/ftlcdfil.c index 51c6fd48a1b..9adbf7518f6 100644 --- a/src/java.desktop/share/native/libfreetype/src/base/ftlcdfil.c +++ b/src/java.desktop/share/native/libfreetype/src/base/ftlcdfil.c @@ -4,7 +4,7 @@ * * FreeType API for color filtering of subpixel bitmap glyphs (body). * - * Copyright (C) 2006-2025 by + * Copyright (C) 2006-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftmac.c b/src/java.desktop/share/native/libfreetype/src/base/ftmac.c index 37d97be1838..7251a4cb962 100644 --- a/src/java.desktop/share/native/libfreetype/src/base/ftmac.c +++ b/src/java.desktop/share/native/libfreetype/src/base/ftmac.c @@ -8,7 +8,7 @@ * This file is for Mac OS X only; see builds/mac/ftoldmac.c for * classic platforms built by MPW. * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftmm.c b/src/java.desktop/share/native/libfreetype/src/base/ftmm.c index 9e67001406c..0d3bf3b77d8 100644 --- a/src/java.desktop/share/native/libfreetype/src/base/ftmm.c +++ b/src/java.desktop/share/native/libfreetype/src/base/ftmm.c @@ -4,7 +4,7 @@ * * Multiple Master font support (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftobjs.c b/src/java.desktop/share/native/libfreetype/src/base/ftobjs.c index 323dd5efac2..f9f64c40fec 100644 --- a/src/java.desktop/share/native/libfreetype/src/base/ftobjs.c +++ b/src/java.desktop/share/native/libfreetype/src/base/ftobjs.c @@ -4,7 +4,7 @@ * * The FreeType private base classes (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -385,6 +385,7 @@ FT_Pos y_shift = 0; FT_Pos x_left, y_top; FT_Pos width, height, pitch; + FT_Bool ret; if ( slot->format == FT_GLYPH_FORMAT_SVG ) @@ -495,6 +496,20 @@ width = pbox.xMax - pbox.xMin; height = pbox.yMax - pbox.yMin; + /* Flag the width or height unsuitable for rendering. */ + /* The limit is based on the ppem value when available. */ + /* FT_Renderer modules should check the return value. */ + ret = FT_BOOL( width >= 0x10000 || height >= 0x10000 || + pbox.xMin < -0x1000000 || pbox.xMax >= 0x1000000 || + pbox.yMin < -0x1000000 || pbox.yMax >= 0x1000000 || + ( slot->face && + ( width > 10 * slot->face->size->metrics.x_ppem || + height > 10 * slot->face->size->metrics.y_ppem ) ) ); + + if ( ret ) + FT_TRACE3(( "ft_glyphslot_preset_bitmap: [%ld %ld %ld %ld]\n", + pbox.xMin, pbox.yMin, pbox.xMax, pbox.yMax )); + switch ( pixel_mode ) { case FT_PIXEL_MODE_MONO: @@ -524,31 +539,7 @@ bitmap->rows = (unsigned int)height; bitmap->pitch = pitch; - /* Flag the bounding box size unsuitable for rendering. */ - /* FT_Renderer modules should check the return value. */ - /* The limit is based on the ppem value when available. */ - { - FT_Face face = slot->face; - FT_Pos xlim = 0x8000; - FT_Pos ylim = 0x8000; - - - if ( face ) - { - xlim = FT_MIN( xlim, 10 * face->size->metrics.x_ppem ); - ylim = FT_MIN( ylim, 10 * face->size->metrics.y_ppem ); - } - - if ( pbox.xMin < -xlim || pbox.xMax >= xlim || - pbox.yMin < -ylim || pbox.yMax >= ylim ) - { - FT_TRACE3(( "ft_glyphslot_preset_bitmap: [%ld %ld %ld %ld]\n", - pbox.xMin, pbox.yMin, pbox.xMax, pbox.yMax )); - return 1; - } - } - - return 0; + return ret; } diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftoutln.c b/src/java.desktop/share/native/libfreetype/src/base/ftoutln.c index 8a15b03eb83..a0a1549adaa 100644 --- a/src/java.desktop/share/native/libfreetype/src/base/ftoutln.c +++ b/src/java.desktop/share/native/libfreetype/src/base/ftoutln.c @@ -4,7 +4,7 @@ * * FreeType outline management (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftpatent.c b/src/java.desktop/share/native/libfreetype/src/base/ftpatent.c index 664bc34deea..3f149eb607f 100644 --- a/src/java.desktop/share/native/libfreetype/src/base/ftpatent.c +++ b/src/java.desktop/share/native/libfreetype/src/base/ftpatent.c @@ -5,7 +5,7 @@ * FreeType API for checking patented TrueType bytecode instructions * (body). Obsolete, retained for backward compatibility. * - * Copyright (C) 2007-2025 by + * Copyright (C) 2007-2026 by * David Turner. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftpsprop.c b/src/java.desktop/share/native/libfreetype/src/base/ftpsprop.c index 0631cd63f62..13f6c5102cc 100644 --- a/src/java.desktop/share/native/libfreetype/src/base/ftpsprop.c +++ b/src/java.desktop/share/native/libfreetype/src/base/ftpsprop.c @@ -5,7 +5,7 @@ * Get and set properties of PostScript drivers (body). * See `ftdriver.h' for available properties. * - * Copyright (C) 2017-2025 by + * Copyright (C) 2017-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftrfork.c b/src/java.desktop/share/native/libfreetype/src/base/ftrfork.c index 1e241f4f95b..fbb8ace7173 100644 --- a/src/java.desktop/share/native/libfreetype/src/base/ftrfork.c +++ b/src/java.desktop/share/native/libfreetype/src/base/ftrfork.c @@ -4,7 +4,7 @@ * * Embedded resource forks accessor (body). * - * Copyright (C) 2004-2025 by + * Copyright (C) 2004-2026 by * Masatake YAMATO and Redhat K.K. * * FT_Raccess_Get_HeaderInfo() and raccess_guess_darwin_hfsplus() are diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftsnames.c b/src/java.desktop/share/native/libfreetype/src/base/ftsnames.c index 34a67a148fc..d8274cccd40 100644 --- a/src/java.desktop/share/native/libfreetype/src/base/ftsnames.c +++ b/src/java.desktop/share/native/libfreetype/src/base/ftsnames.c @@ -7,7 +7,7 @@ * * This is _not_ used to retrieve glyph names! * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftstream.c b/src/java.desktop/share/native/libfreetype/src/base/ftstream.c index c04a0506def..b08a1a9b658 100644 --- a/src/java.desktop/share/native/libfreetype/src/base/ftstream.c +++ b/src/java.desktop/share/native/libfreetype/src/base/ftstream.c @@ -4,7 +4,7 @@ * * I/O stream support (body). * - * Copyright (C) 2000-2025 by + * Copyright (C) 2000-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftstroke.c b/src/java.desktop/share/native/libfreetype/src/base/ftstroke.c index 591f18eaa83..e599ecaf46f 100644 --- a/src/java.desktop/share/native/libfreetype/src/base/ftstroke.c +++ b/src/java.desktop/share/native/libfreetype/src/base/ftstroke.c @@ -4,7 +4,7 @@ * * FreeType path stroker (body). * - * Copyright (C) 2002-2025 by + * Copyright (C) 2002-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -693,6 +693,7 @@ Fail: num_points = 0; num_contours = 0; + error = FT_THROW( Invalid_Outline ); goto Exit; } @@ -2251,7 +2252,7 @@ FT_Stroker stroker, FT_Bool destroy ) { - FT_Error error = FT_ERR( Invalid_Argument ); + FT_Error error = FT_THROW( Invalid_Argument ); FT_Glyph glyph = NULL; @@ -2283,7 +2284,9 @@ if ( error ) goto Fail; - FT_Stroker_GetCounts( stroker, &num_points, &num_contours ); + error = FT_Stroker_GetCounts( stroker, &num_points, &num_contours ); + if ( error ) + goto Fail; FT_Outline_Done( glyph->library, outline ); @@ -2326,7 +2329,7 @@ FT_Bool inside, FT_Bool destroy ) { - FT_Error error = FT_ERR( Invalid_Argument ); + FT_Error error = FT_THROW( Invalid_Argument ); FT_Glyph glyph = NULL; diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftsynth.c b/src/java.desktop/share/native/libfreetype/src/base/ftsynth.c index 08bc1742202..23960eda3a9 100644 --- a/src/java.desktop/share/native/libfreetype/src/base/ftsynth.c +++ b/src/java.desktop/share/native/libfreetype/src/base/ftsynth.c @@ -4,7 +4,7 @@ * * FreeType synthesizing code for emboldening and slanting (body). * - * Copyright (C) 2000-2025 by + * Copyright (C) 2000-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftsystem.c b/src/java.desktop/share/native/libfreetype/src/base/ftsystem.c index 186119d5581..be9159f6141 100644 --- a/src/java.desktop/share/native/libfreetype/src/base/ftsystem.c +++ b/src/java.desktop/share/native/libfreetype/src/base/ftsystem.c @@ -4,7 +4,7 @@ * * ANSI-specific FreeType low-level system interface (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/base/fttrigon.c b/src/java.desktop/share/native/libfreetype/src/base/fttrigon.c index 29eff639c51..baa47eba084 100644 --- a/src/java.desktop/share/native/libfreetype/src/base/fttrigon.c +++ b/src/java.desktop/share/native/libfreetype/src/base/fttrigon.c @@ -4,7 +4,7 @@ * * FreeType trigonometric functions (body). * - * Copyright (C) 2001-2025 by + * Copyright (C) 2001-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/base/fttype1.c b/src/java.desktop/share/native/libfreetype/src/base/fttype1.c index 77978df674d..f9a46801f3c 100644 --- a/src/java.desktop/share/native/libfreetype/src/base/fttype1.c +++ b/src/java.desktop/share/native/libfreetype/src/base/fttype1.c @@ -4,7 +4,7 @@ * * FreeType utility file for PS names support (body). * - * Copyright (C) 2002-2025 by + * Copyright (C) 2002-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftutil.c b/src/java.desktop/share/native/libfreetype/src/base/ftutil.c index f83c4394893..5d8fc7b9bf3 100644 --- a/src/java.desktop/share/native/libfreetype/src/base/ftutil.c +++ b/src/java.desktop/share/native/libfreetype/src/base/ftutil.c @@ -4,7 +4,7 @@ * * FreeType utility file for memory and list management (body). * - * Copyright (C) 2002-2025 by + * Copyright (C) 2002-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/cff/cffcmap.c b/src/java.desktop/share/native/libfreetype/src/cff/cffcmap.c index cb69abdb90f..75e2420d99e 100644 --- a/src/java.desktop/share/native/libfreetype/src/cff/cffcmap.c +++ b/src/java.desktop/share/native/libfreetype/src/cff/cffcmap.c @@ -4,7 +4,7 @@ * * CFF character mapping table (cmap) support (body). * - * Copyright (C) 2002-2025 by + * Copyright (C) 2002-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/cff/cffcmap.h b/src/java.desktop/share/native/libfreetype/src/cff/cffcmap.h index 60e16d94875..e812e7a89e5 100644 --- a/src/java.desktop/share/native/libfreetype/src/cff/cffcmap.h +++ b/src/java.desktop/share/native/libfreetype/src/cff/cffcmap.h @@ -4,7 +4,7 @@ * * CFF character mapping table (cmap) support (specification). * - * Copyright (C) 2002-2025 by + * Copyright (C) 2002-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/cff/cffdrivr.c b/src/java.desktop/share/native/libfreetype/src/cff/cffdrivr.c index 44ff44aecbd..18c7b879048 100644 --- a/src/java.desktop/share/native/libfreetype/src/cff/cffdrivr.c +++ b/src/java.desktop/share/native/libfreetype/src/cff/cffdrivr.c @@ -4,7 +4,7 @@ * * OpenType font driver implementation (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, Werner Lemberg, and Dominik Röttsches. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/cff/cffdrivr.h b/src/java.desktop/share/native/libfreetype/src/cff/cffdrivr.h index 52a1e727a6a..2f3c58b67d7 100644 --- a/src/java.desktop/share/native/libfreetype/src/cff/cffdrivr.h +++ b/src/java.desktop/share/native/libfreetype/src/cff/cffdrivr.h @@ -4,7 +4,7 @@ * * High-level OpenType driver interface (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/cff/cfferrs.h b/src/java.desktop/share/native/libfreetype/src/cff/cfferrs.h index 7491886c7be..ca1158c0dfd 100644 --- a/src/java.desktop/share/native/libfreetype/src/cff/cfferrs.h +++ b/src/java.desktop/share/native/libfreetype/src/cff/cfferrs.h @@ -4,7 +4,7 @@ * * CFF error codes (specification only). * - * Copyright (C) 2001-2025 by + * Copyright (C) 2001-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/cff/cffgload.c b/src/java.desktop/share/native/libfreetype/src/cff/cffgload.c index e8bab3c1e33..0c986930cee 100644 --- a/src/java.desktop/share/native/libfreetype/src/cff/cffgload.c +++ b/src/java.desktop/share/native/libfreetype/src/cff/cffgload.c @@ -4,7 +4,7 @@ * * OpenType Glyph Loader (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/cff/cffgload.h b/src/java.desktop/share/native/libfreetype/src/cff/cffgload.h index 662bb7cff53..eb4b5f30b5e 100644 --- a/src/java.desktop/share/native/libfreetype/src/cff/cffgload.h +++ b/src/java.desktop/share/native/libfreetype/src/cff/cffgload.h @@ -4,7 +4,7 @@ * * OpenType Glyph Loader (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/cff/cffload.c b/src/java.desktop/share/native/libfreetype/src/cff/cffload.c index 39d662eb434..9d067cfeeb8 100644 --- a/src/java.desktop/share/native/libfreetype/src/cff/cffload.c +++ b/src/java.desktop/share/native/libfreetype/src/cff/cffload.c @@ -4,7 +4,7 @@ * * OpenType and CFF data/program tables loader (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/cff/cffload.h b/src/java.desktop/share/native/libfreetype/src/cff/cffload.h index fdc132c8f3f..ab02ca2d7f6 100644 --- a/src/java.desktop/share/native/libfreetype/src/cff/cffload.h +++ b/src/java.desktop/share/native/libfreetype/src/cff/cffload.h @@ -4,7 +4,7 @@ * * OpenType & CFF data/program tables loader (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/cff/cffobjs.c b/src/java.desktop/share/native/libfreetype/src/cff/cffobjs.c index 9e00943a95d..c6ba35e2734 100644 --- a/src/java.desktop/share/native/libfreetype/src/cff/cffobjs.c +++ b/src/java.desktop/share/native/libfreetype/src/cff/cffobjs.c @@ -4,7 +4,7 @@ * * OpenType objects manager (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -16,7 +16,6 @@ */ - #include #include #include @@ -45,6 +44,7 @@ #define CFF_fixedToInt( x ) \ ( (FT_Short)( ( (x) + 0x8000U ) >> 16 ) ) + /************************************************************************** * * The macro FT_COMPONENT is used in trace mode. It is an implicit diff --git a/src/java.desktop/share/native/libfreetype/src/cff/cffobjs.h b/src/java.desktop/share/native/libfreetype/src/cff/cffobjs.h index 982dcd64dd0..c6ab805c5be 100644 --- a/src/java.desktop/share/native/libfreetype/src/cff/cffobjs.h +++ b/src/java.desktop/share/native/libfreetype/src/cff/cffobjs.h @@ -4,7 +4,7 @@ * * OpenType objects manager (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -20,8 +20,6 @@ #define CFFOBJS_H_ - - FT_BEGIN_HEADER diff --git a/src/java.desktop/share/native/libfreetype/src/cff/cffparse.c b/src/java.desktop/share/native/libfreetype/src/cff/cffparse.c index 864b2490b3b..fadc3258c96 100644 --- a/src/java.desktop/share/native/libfreetype/src/cff/cffparse.c +++ b/src/java.desktop/share/native/libfreetype/src/cff/cffparse.c @@ -4,7 +4,7 @@ * * CFF token stream parser (body) * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/cff/cffparse.h b/src/java.desktop/share/native/libfreetype/src/cff/cffparse.h index 47cceb1a4a0..1daf548cbcc 100644 --- a/src/java.desktop/share/native/libfreetype/src/cff/cffparse.h +++ b/src/java.desktop/share/native/libfreetype/src/cff/cffparse.h @@ -4,7 +4,7 @@ * * CFF token stream parser (specification) * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/cff/cfftoken.h b/src/java.desktop/share/native/libfreetype/src/cff/cfftoken.h index a7ee1cb3fe7..0eadc7118fb 100644 --- a/src/java.desktop/share/native/libfreetype/src/cff/cfftoken.h +++ b/src/java.desktop/share/native/libfreetype/src/cff/cfftoken.h @@ -4,7 +4,7 @@ * * CFF token definitions (specification only). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/cid/ciderrs.h b/src/java.desktop/share/native/libfreetype/src/cid/ciderrs.h index 1591979d370..00497b796b3 100644 --- a/src/java.desktop/share/native/libfreetype/src/cid/ciderrs.h +++ b/src/java.desktop/share/native/libfreetype/src/cid/ciderrs.h @@ -4,7 +4,7 @@ * * CID error codes (specification only). * - * Copyright (C) 2001-2025 by + * Copyright (C) 2001-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/cid/cidgload.c b/src/java.desktop/share/native/libfreetype/src/cid/cidgload.c index 249ede5757d..cc68b4a9600 100644 --- a/src/java.desktop/share/native/libfreetype/src/cid/cidgload.c +++ b/src/java.desktop/share/native/libfreetype/src/cid/cidgload.c @@ -4,7 +4,7 @@ * * CID-keyed Type1 Glyph Loader (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -193,6 +193,37 @@ p = (FT_Byte*)glyph_data.pointer; fd_select = cid_get_offset( &p, cid->fd_bytes ); + if ( fd_select >= cid->num_dicts ) + { + /* + * fd_select == 0xFF is often used to indicate that the CID + * has no charstring to be rendered, similar to GID = 0xFFFF + * in TrueType fonts. + */ + if ( ( cid->fd_bytes == 1 && fd_select == 0xFFU ) || + ( cid->fd_bytes == 2 && fd_select == 0xFFFFU ) ) + { + FT_TRACE1(( "cid_load_glyph: fail for glyph index %u:\n", + glyph_index )); + FT_TRACE1(( " FD number %lu is the maximum\n", + fd_select )); + FT_TRACE1(( " integer fitting into %u byte%s\n", + cid->fd_bytes, cid->fd_bytes == 1 ? "" : "s" )); + } + else + { + FT_TRACE0(( "cid_load_glyph: fail for glyph index %u:\n", + glyph_index )); + FT_TRACE0(( " FD number %lu is larger\n", + fd_select )); + FT_TRACE0(( " than number of dictionaries (%u)\n", + cid->num_dicts )); + } + + error = FT_THROW( Invalid_Offset ); + goto Exit; + } + glyph_length = glyph_data.length - cid->fd_bytes; if ( !FT_QALLOC( charstring, glyph_length ) ) diff --git a/src/java.desktop/share/native/libfreetype/src/cid/cidgload.h b/src/java.desktop/share/native/libfreetype/src/cid/cidgload.h index cef96073ded..51b16c75944 100644 --- a/src/java.desktop/share/native/libfreetype/src/cid/cidgload.h +++ b/src/java.desktop/share/native/libfreetype/src/cid/cidgload.h @@ -4,7 +4,7 @@ * * OpenType Glyph Loader (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/cid/cidload.c b/src/java.desktop/share/native/libfreetype/src/cid/cidload.c index bb1bf13e221..1a0e6b1561e 100644 --- a/src/java.desktop/share/native/libfreetype/src/cid/cidload.c +++ b/src/java.desktop/share/native/libfreetype/src/cid/cidload.c @@ -4,7 +4,7 @@ * * CID-keyed Type1 font loader (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/cid/cidload.h b/src/java.desktop/share/native/libfreetype/src/cid/cidload.h index 659dd0e378c..cef7d1c9a6a 100644 --- a/src/java.desktop/share/native/libfreetype/src/cid/cidload.h +++ b/src/java.desktop/share/native/libfreetype/src/cid/cidload.h @@ -4,7 +4,7 @@ * * CID-keyed Type1 font loader (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/cid/cidobjs.c b/src/java.desktop/share/native/libfreetype/src/cid/cidobjs.c index 634bbf2f135..2d11609598b 100644 --- a/src/java.desktop/share/native/libfreetype/src/cid/cidobjs.c +++ b/src/java.desktop/share/native/libfreetype/src/cid/cidobjs.c @@ -4,7 +4,7 @@ * * CID objects manager (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/cid/cidobjs.h b/src/java.desktop/share/native/libfreetype/src/cid/cidobjs.h index 800268efa2f..40664623127 100644 --- a/src/java.desktop/share/native/libfreetype/src/cid/cidobjs.h +++ b/src/java.desktop/share/native/libfreetype/src/cid/cidobjs.h @@ -4,7 +4,7 @@ * * CID objects manager (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/cid/cidparse.c b/src/java.desktop/share/native/libfreetype/src/cid/cidparse.c index 4d1ba335960..fb936bd48d9 100644 --- a/src/java.desktop/share/native/libfreetype/src/cid/cidparse.c +++ b/src/java.desktop/share/native/libfreetype/src/cid/cidparse.c @@ -4,7 +4,7 @@ * * CID-keyed Type1 parser (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/cid/cidparse.h b/src/java.desktop/share/native/libfreetype/src/cid/cidparse.h index 6ae2e542394..555245230b9 100644 --- a/src/java.desktop/share/native/libfreetype/src/cid/cidparse.h +++ b/src/java.desktop/share/native/libfreetype/src/cid/cidparse.h @@ -4,7 +4,7 @@ * * CID-keyed Type1 parser (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/cid/cidriver.c b/src/java.desktop/share/native/libfreetype/src/cid/cidriver.c index a3a587c57bf..ab188776e2f 100644 --- a/src/java.desktop/share/native/libfreetype/src/cid/cidriver.c +++ b/src/java.desktop/share/native/libfreetype/src/cid/cidriver.c @@ -4,7 +4,7 @@ * * CID driver interface (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/cid/cidriver.h b/src/java.desktop/share/native/libfreetype/src/cid/cidriver.h index 55d0b8a0d9b..a4ddccec808 100644 --- a/src/java.desktop/share/native/libfreetype/src/cid/cidriver.h +++ b/src/java.desktop/share/native/libfreetype/src/cid/cidriver.h @@ -4,7 +4,7 @@ * * High-level CID driver interface (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/cid/cidtoken.h b/src/java.desktop/share/native/libfreetype/src/cid/cidtoken.h index d40ebfab86d..22136310cdf 100644 --- a/src/java.desktop/share/native/libfreetype/src/cid/cidtoken.h +++ b/src/java.desktop/share/native/libfreetype/src/cid/cidtoken.h @@ -4,7 +4,7 @@ * * CID token definitions (specification only). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/afmparse.c b/src/java.desktop/share/native/libfreetype/src/psaux/afmparse.c index b813efde4eb..1cc8ab29d46 100644 --- a/src/java.desktop/share/native/libfreetype/src/psaux/afmparse.c +++ b/src/java.desktop/share/native/libfreetype/src/psaux/afmparse.c @@ -4,7 +4,7 @@ * * AFM parser (body). * - * Copyright (C) 2006-2025 by + * Copyright (C) 2006-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/afmparse.h b/src/java.desktop/share/native/libfreetype/src/psaux/afmparse.h index add8597717d..02a9617b8dc 100644 --- a/src/java.desktop/share/native/libfreetype/src/psaux/afmparse.h +++ b/src/java.desktop/share/native/libfreetype/src/psaux/afmparse.h @@ -4,7 +4,7 @@ * * AFM parser (specification). * - * Copyright (C) 2006-2025 by + * Copyright (C) 2006-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/cffdecode.c b/src/java.desktop/share/native/libfreetype/src/psaux/cffdecode.c index 17bdd23c7d4..908a8112615 100644 --- a/src/java.desktop/share/native/libfreetype/src/psaux/cffdecode.c +++ b/src/java.desktop/share/native/libfreetype/src/psaux/cffdecode.c @@ -4,7 +4,7 @@ * * PostScript CFF (Type 2) decoding routines (body). * - * Copyright (C) 2017-2025 by + * Copyright (C) 2017-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/cffdecode.h b/src/java.desktop/share/native/libfreetype/src/psaux/cffdecode.h index e72ec043baa..0836a642b2f 100644 --- a/src/java.desktop/share/native/libfreetype/src/psaux/cffdecode.h +++ b/src/java.desktop/share/native/libfreetype/src/psaux/cffdecode.h @@ -4,7 +4,7 @@ * * PostScript CFF (Type 2) decoding routines (specification). * - * Copyright (C) 2017-2025 by + * Copyright (C) 2017-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/psauxerr.h b/src/java.desktop/share/native/libfreetype/src/psaux/psauxerr.h index 0d7fe2b6121..5766482d1b7 100644 --- a/src/java.desktop/share/native/libfreetype/src/psaux/psauxerr.h +++ b/src/java.desktop/share/native/libfreetype/src/psaux/psauxerr.h @@ -4,7 +4,7 @@ * * PS auxiliary module error codes (specification only). * - * Copyright (C) 2001-2025 by + * Copyright (C) 2001-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/psauxmod.c b/src/java.desktop/share/native/libfreetype/src/psaux/psauxmod.c index 942804190c5..2f9eb87484c 100644 --- a/src/java.desktop/share/native/libfreetype/src/psaux/psauxmod.c +++ b/src/java.desktop/share/native/libfreetype/src/psaux/psauxmod.c @@ -4,7 +4,7 @@ * * FreeType auxiliary PostScript module implementation (body). * - * Copyright (C) 2000-2025 by + * Copyright (C) 2000-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/psauxmod.h b/src/java.desktop/share/native/libfreetype/src/psaux/psauxmod.h index 4a5ebc1b607..e7fa15c34b7 100644 --- a/src/java.desktop/share/native/libfreetype/src/psaux/psauxmod.h +++ b/src/java.desktop/share/native/libfreetype/src/psaux/psauxmod.h @@ -4,7 +4,7 @@ * * FreeType auxiliary PostScript module implementation (specification). * - * Copyright (C) 2000-2025 by + * Copyright (C) 2000-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/psconv.c b/src/java.desktop/share/native/libfreetype/src/psaux/psconv.c index 4567d3f3c06..3a054cbbf6d 100644 --- a/src/java.desktop/share/native/libfreetype/src/psaux/psconv.c +++ b/src/java.desktop/share/native/libfreetype/src/psaux/psconv.c @@ -4,7 +4,7 @@ * * Some convenience conversions (body). * - * Copyright (C) 2006-2025 by + * Copyright (C) 2006-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/psconv.h b/src/java.desktop/share/native/libfreetype/src/psaux/psconv.h index 63735af411f..fc123faea4d 100644 --- a/src/java.desktop/share/native/libfreetype/src/psaux/psconv.h +++ b/src/java.desktop/share/native/libfreetype/src/psaux/psconv.h @@ -4,7 +4,7 @@ * * Some convenience conversions (specification). * - * Copyright (C) 2006-2025 by + * Copyright (C) 2006-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/psobjs.c b/src/java.desktop/share/native/libfreetype/src/psaux/psobjs.c index 8159fd6ef15..5019f9925c1 100644 --- a/src/java.desktop/share/native/libfreetype/src/psaux/psobjs.c +++ b/src/java.desktop/share/native/libfreetype/src/psaux/psobjs.c @@ -4,7 +4,7 @@ * * Auxiliary functions for PostScript fonts (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/psobjs.h b/src/java.desktop/share/native/libfreetype/src/psaux/psobjs.h index 277aa1247c5..04205f891b1 100644 --- a/src/java.desktop/share/native/libfreetype/src/psaux/psobjs.h +++ b/src/java.desktop/share/native/libfreetype/src/psaux/psobjs.h @@ -4,7 +4,7 @@ * * Auxiliary functions for PostScript fonts (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/t1cmap.c b/src/java.desktop/share/native/libfreetype/src/psaux/t1cmap.c index 66493b68123..686ca7abdfa 100644 --- a/src/java.desktop/share/native/libfreetype/src/psaux/t1cmap.c +++ b/src/java.desktop/share/native/libfreetype/src/psaux/t1cmap.c @@ -4,7 +4,7 @@ * * Type 1 character map support (body). * - * Copyright (C) 2002-2025 by + * Copyright (C) 2002-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/t1cmap.h b/src/java.desktop/share/native/libfreetype/src/psaux/t1cmap.h index 114bfbb0410..be66a0c7f6f 100644 --- a/src/java.desktop/share/native/libfreetype/src/psaux/t1cmap.h +++ b/src/java.desktop/share/native/libfreetype/src/psaux/t1cmap.h @@ -4,7 +4,7 @@ * * Type 1 character map support (specification). * - * Copyright (C) 2002-2025 by + * Copyright (C) 2002-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/t1decode.c b/src/java.desktop/share/native/libfreetype/src/psaux/t1decode.c index c3fb343d4c9..ece512412da 100644 --- a/src/java.desktop/share/native/libfreetype/src/psaux/t1decode.c +++ b/src/java.desktop/share/native/libfreetype/src/psaux/t1decode.c @@ -4,7 +4,7 @@ * * PostScript Type 1 decoding routines (body). * - * Copyright (C) 2000-2025 by + * Copyright (C) 2000-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -458,6 +458,7 @@ FT_Bool large_int; FT_Fixed seed; + FT_UInt len_buildchar; T1_Hints_Funcs hinter; #ifdef FT_DEBUG_LEVEL_TRACE @@ -483,13 +484,16 @@ hinter = (T1_Hints_Funcs)builder->hints_funcs; - /* a font that reads BuildCharArray without setting */ - /* its values first is buggy, but ... */ - FT_ASSERT( ( decoder->len_buildchar == 0 ) == - ( decoder->buildchar == NULL ) ); + /* Cache `len_buildchar` locally so that a stray write to the */ + /* decoder structure during charstring processing cannot bypass */ + /* the bounds checks in callothersubr 19/24/25 handlers. */ + len_buildchar = decoder->len_buildchar; - if ( decoder->buildchar && decoder->len_buildchar > 0 ) - FT_ARRAY_ZERO( decoder->buildchar, decoder->len_buildchar ); + FT_ASSERT( ( len_buildchar == 0 ) == + ( decoder->buildchar == NULL ) ); + + if ( decoder->buildchar && len_buildchar > 0 ) + FT_ARRAY_ZERO( decoder->buildchar, len_buildchar ); zone->base = charstring_base; limit = zone->limit = charstring_base + charstring_len; @@ -969,8 +973,8 @@ idx = Fix2Int( top[0] ); - if ( idx < 0 || - (FT_UInt)idx + blend->num_designs > decoder->len_buildchar ) + if ( idx < 0 || + (FT_UInt)idx + blend->num_designs > len_buildchar ) goto Unexpected_OtherSubr; ft_memcpy( &decoder->buildchar[idx], @@ -1037,7 +1041,7 @@ idx = Fix2UInt( top[1] ); - if ( idx >= decoder->len_buildchar ) + if ( idx >= len_buildchar ) goto Unexpected_OtherSubr; decoder->buildchar[idx] = top[0]; @@ -1058,7 +1062,7 @@ idx = Fix2UInt( top[0] ); - if ( idx >= decoder->len_buildchar ) + if ( idx >= len_buildchar ) goto Unexpected_OtherSubr; top[0] = decoder->buildchar[idx]; @@ -1204,14 +1208,14 @@ #ifdef FT_DEBUG_LEVEL_TRACE - if ( decoder->len_buildchar > 0 ) + if ( len_buildchar > 0 ) { FT_UInt i; FT_TRACE4(( "BuildCharArray = [ " )); - for ( i = 0; i < decoder->len_buildchar; i++ ) + for ( i = 0; i < len_buildchar; i++ ) FT_TRACE4(( "%ld ", decoder->buildchar[i] )); FT_TRACE4(( "]\n" )); @@ -1523,6 +1527,15 @@ goto Syntax_Error; } + /* Ensure that popping an unknown 'othersubr' result does not */ + /* push the stack pointer past the end of the stack array. */ + if ( top - decoder->stack >= T1_MAX_CHARSTRINGS_OPERANDS ) + { + FT_ERROR(( "t1_decoder_parse_charstrings:" + " stack overflow in pop\n" )); + goto Syntax_Error; + } + unknown_othersubr_result_cnt--; top++; /* `push' the operand to callothersubr onto the stack */ break; diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/t1decode.h b/src/java.desktop/share/native/libfreetype/src/psaux/t1decode.h index 7b913f55dff..1b5d5205a86 100644 --- a/src/java.desktop/share/native/libfreetype/src/psaux/t1decode.h +++ b/src/java.desktop/share/native/libfreetype/src/psaux/t1decode.h @@ -4,7 +4,7 @@ * * PostScript Type 1 decoding routines (specification). * - * Copyright (C) 2000-2025 by + * Copyright (C) 2000-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/pshinter/pshalgo.c b/src/java.desktop/share/native/libfreetype/src/pshinter/pshalgo.c index e053dba17b2..f169fc3459d 100644 --- a/src/java.desktop/share/native/libfreetype/src/pshinter/pshalgo.c +++ b/src/java.desktop/share/native/libfreetype/src/pshinter/pshalgo.c @@ -4,7 +4,7 @@ * * PostScript hinting algorithm (body). * - * Copyright (C) 2001-2025 by + * Copyright (C) 2001-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used diff --git a/src/java.desktop/share/native/libfreetype/src/pshinter/pshalgo.h b/src/java.desktop/share/native/libfreetype/src/pshinter/pshalgo.h index f4aa8540559..95d41b49aaf 100644 --- a/src/java.desktop/share/native/libfreetype/src/pshinter/pshalgo.h +++ b/src/java.desktop/share/native/libfreetype/src/pshinter/pshalgo.h @@ -4,7 +4,7 @@ * * PostScript hinting algorithm (specification). * - * Copyright (C) 2001-2025 by + * Copyright (C) 2001-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/pshinter/pshglob.c b/src/java.desktop/share/native/libfreetype/src/pshinter/pshglob.c index a772b66f309..2e4efea068c 100644 --- a/src/java.desktop/share/native/libfreetype/src/pshinter/pshglob.c +++ b/src/java.desktop/share/native/libfreetype/src/pshinter/pshglob.c @@ -5,7 +5,7 @@ * PostScript hinter global hinting management (body). * Inspired by the new auto-hinter module. * - * Copyright (C) 2001-2025 by + * Copyright (C) 2001-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used diff --git a/src/java.desktop/share/native/libfreetype/src/pshinter/pshglob.h b/src/java.desktop/share/native/libfreetype/src/pshinter/pshglob.h index 555e99facb2..0158b92ab9d 100644 --- a/src/java.desktop/share/native/libfreetype/src/pshinter/pshglob.h +++ b/src/java.desktop/share/native/libfreetype/src/pshinter/pshglob.h @@ -4,7 +4,7 @@ * * PostScript hinter global hinting management. * - * Copyright (C) 2001-2025 by + * Copyright (C) 2001-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/pshinter/pshmod.c b/src/java.desktop/share/native/libfreetype/src/pshinter/pshmod.c index c9f4a94fe98..f6b2e2df94c 100644 --- a/src/java.desktop/share/native/libfreetype/src/pshinter/pshmod.c +++ b/src/java.desktop/share/native/libfreetype/src/pshinter/pshmod.c @@ -4,7 +4,7 @@ * * FreeType PostScript hinter module implementation (body). * - * Copyright (C) 2001-2025 by + * Copyright (C) 2001-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/pshinter/pshmod.h b/src/java.desktop/share/native/libfreetype/src/pshinter/pshmod.h index de9c398e9fb..d68ef9a8736 100644 --- a/src/java.desktop/share/native/libfreetype/src/pshinter/pshmod.h +++ b/src/java.desktop/share/native/libfreetype/src/pshinter/pshmod.h @@ -4,7 +4,7 @@ * * PostScript hinter module interface (specification). * - * Copyright (C) 2001-2025 by + * Copyright (C) 2001-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/pshinter/pshnterr.h b/src/java.desktop/share/native/libfreetype/src/pshinter/pshnterr.h index 7076664ddde..96bc3a31756 100644 --- a/src/java.desktop/share/native/libfreetype/src/pshinter/pshnterr.h +++ b/src/java.desktop/share/native/libfreetype/src/pshinter/pshnterr.h @@ -4,7 +4,7 @@ * * PS Hinter error codes (specification only). * - * Copyright (C) 2003-2025 by + * Copyright (C) 2003-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/pshinter/pshrec.c b/src/java.desktop/share/native/libfreetype/src/pshinter/pshrec.c index 13754313fbb..f14c9c7cbda 100644 --- a/src/java.desktop/share/native/libfreetype/src/pshinter/pshrec.c +++ b/src/java.desktop/share/native/libfreetype/src/pshinter/pshrec.c @@ -4,7 +4,7 @@ * * FreeType PostScript hints recorder (body). * - * Copyright (C) 2001-2025 by + * Copyright (C) 2001-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/pshinter/pshrec.h b/src/java.desktop/share/native/libfreetype/src/pshinter/pshrec.h index a79069f98d2..0b644f5b964 100644 --- a/src/java.desktop/share/native/libfreetype/src/pshinter/pshrec.h +++ b/src/java.desktop/share/native/libfreetype/src/pshinter/pshrec.h @@ -4,7 +4,7 @@ * * Postscript (Type1/Type2) hints recorder (specification). * - * Copyright (C) 2001-2025 by + * Copyright (C) 2001-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/psnames/psmodule.c b/src/java.desktop/share/native/libfreetype/src/psnames/psmodule.c index c5d71edad88..5409c61fafa 100644 --- a/src/java.desktop/share/native/libfreetype/src/psnames/psmodule.c +++ b/src/java.desktop/share/native/libfreetype/src/psnames/psmodule.c @@ -4,7 +4,7 @@ * * psnames module implementation (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/psnames/psmodule.h b/src/java.desktop/share/native/libfreetype/src/psnames/psmodule.h index 482fd0a36d1..7a619d83fb3 100644 --- a/src/java.desktop/share/native/libfreetype/src/psnames/psmodule.h +++ b/src/java.desktop/share/native/libfreetype/src/psnames/psmodule.h @@ -4,7 +4,7 @@ * * High-level psnames module interface (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/psnames/psnamerr.h b/src/java.desktop/share/native/libfreetype/src/psnames/psnamerr.h index 17987f9cd4f..bef9e797c80 100644 --- a/src/java.desktop/share/native/libfreetype/src/psnames/psnamerr.h +++ b/src/java.desktop/share/native/libfreetype/src/psnames/psnamerr.h @@ -4,7 +4,7 @@ * * PS names module error codes (specification only). * - * Copyright (C) 2001-2025 by + * Copyright (C) 2001-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/psnames/pstables.h b/src/java.desktop/share/native/libfreetype/src/psnames/pstables.h index 65ce6c0b47f..8a32aac325f 100644 --- a/src/java.desktop/share/native/libfreetype/src/psnames/pstables.h +++ b/src/java.desktop/share/native/libfreetype/src/psnames/pstables.h @@ -4,7 +4,7 @@ * * PostScript glyph names. * - * Copyright (C) 2005-2025 by + * Copyright (C) 2005-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/raster/ftmisc.h b/src/java.desktop/share/native/libfreetype/src/raster/ftmisc.h index 9d97223e94e..cf96cd09ed5 100644 --- a/src/java.desktop/share/native/libfreetype/src/raster/ftmisc.h +++ b/src/java.desktop/share/native/libfreetype/src/raster/ftmisc.h @@ -5,7 +5,7 @@ * Miscellaneous macros for stand-alone rasterizer (specification * only). * - * Copyright (C) 2005-2025 by + * Copyright (C) 2005-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used diff --git a/src/java.desktop/share/native/libfreetype/src/raster/ftraster.c b/src/java.desktop/share/native/libfreetype/src/raster/ftraster.c index 807d444e7aa..4165800a1aa 100644 --- a/src/java.desktop/share/native/libfreetype/src/raster/ftraster.c +++ b/src/java.desktop/share/native/libfreetype/src/raster/ftraster.c @@ -4,7 +4,7 @@ * * The FreeType glyph rasterizer (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -546,7 +546,7 @@ * */ - if ( High ) + if ( High && ras.bTop + ras.bRight < 256 ) { ras.precision_bits = 12; ras.precision_step = 256; @@ -1351,17 +1351,9 @@ /* this arc has no given direction, split it! */ Split_Conic( arc ); arc += 2; + continue; } - else if ( y1 == y3 ) - { - /* this arc is flat, advance position */ - /* and pop it from the Bezier stack */ - arc -= 2; - - ras.lastX = x3; - ras.lastY = y3; - } - else + else if ( y1 != y3 ) { /* the arc is y-monotonous, either ascending or descending */ /* detect a change of direction */ @@ -1389,13 +1381,16 @@ if ( Bezier_Down( RAS_VARS 2, arc, Split_Conic, ras.minY, ras.maxY ) ) goto Fail; - arc -= 2; - - ras.lastX = x3; - ras.lastY = y3; } - } while ( arc >= arcs ); + ras.lastX = x3; + ras.lastY = y3; + + if ( arc == arcs ) + break; + arc -= 2; + + } while ( 1 ); return SUCCESS; @@ -1498,17 +1493,9 @@ /* this arc has no given direction, split it! */ Split_Cubic( arc ); arc += 3; + continue; } - else if ( y1 == y4 ) - { - /* this arc is flat, advance position */ - /* and pop it from the Bezier stack */ - arc -= 3; - - ras.lastX = x4; - ras.lastY = y4; - } - else + else if ( y1 != y4 ) { state_bez = y1 < y4 ? Ascending_State : Descending_State; @@ -1535,13 +1522,16 @@ if ( Bezier_Down( RAS_VARS 3, arc, Split_Cubic, ras.minY, ras.maxY ) ) goto Fail; - arc -= 3; - - ras.lastX = x4; - ras.lastY = y4; } - } while ( arc >= arcs ); + ras.lastX = x4; + ras.lastY = y4; + + if ( arc == arcs ) + break; + arc -= 3; + + } while ( 1 ); return SUCCESS; diff --git a/src/java.desktop/share/native/libfreetype/src/raster/ftraster.h b/src/java.desktop/share/native/libfreetype/src/raster/ftraster.h index 64499bf955b..e20184ddc8e 100644 --- a/src/java.desktop/share/native/libfreetype/src/raster/ftraster.h +++ b/src/java.desktop/share/native/libfreetype/src/raster/ftraster.h @@ -4,7 +4,7 @@ * * The FreeType glyph rasterizer (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used diff --git a/src/java.desktop/share/native/libfreetype/src/raster/ftrend1.c b/src/java.desktop/share/native/libfreetype/src/raster/ftrend1.c index 3fa008704e5..6b28cb0bf8d 100644 --- a/src/java.desktop/share/native/libfreetype/src/raster/ftrend1.c +++ b/src/java.desktop/share/native/libfreetype/src/raster/ftrend1.c @@ -4,7 +4,7 @@ * * The FreeType glyph rasterizer interface (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/raster/ftrend1.h b/src/java.desktop/share/native/libfreetype/src/raster/ftrend1.h index d838a942b04..92249a0cb9f 100644 --- a/src/java.desktop/share/native/libfreetype/src/raster/ftrend1.h +++ b/src/java.desktop/share/native/libfreetype/src/raster/ftrend1.h @@ -4,7 +4,7 @@ * * The FreeType glyph rasterizer interface (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/raster/rasterrs.h b/src/java.desktop/share/native/libfreetype/src/raster/rasterrs.h index 39d82a8051a..744d179cd8c 100644 --- a/src/java.desktop/share/native/libfreetype/src/raster/rasterrs.h +++ b/src/java.desktop/share/native/libfreetype/src/raster/rasterrs.h @@ -4,7 +4,7 @@ * * monochrome renderer error codes (specification only). * - * Copyright (C) 2001-2025 by + * Copyright (C) 2001-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/pngshim.c b/src/java.desktop/share/native/libfreetype/src/sfnt/pngshim.c index 24fb3455598..e588e6b380b 100644 --- a/src/java.desktop/share/native/libfreetype/src/sfnt/pngshim.c +++ b/src/java.desktop/share/native/libfreetype/src/sfnt/pngshim.c @@ -4,7 +4,7 @@ * * PNG Bitmap glyph support. * - * Copyright (C) 2013-2025 by + * Copyright (C) 2013-2026 by * Google, Inc. * Written by Stuart Gill and Behdad Esfahbod. * diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/pngshim.h b/src/java.desktop/share/native/libfreetype/src/sfnt/pngshim.h index c59199e60df..f187b639a11 100644 --- a/src/java.desktop/share/native/libfreetype/src/sfnt/pngshim.h +++ b/src/java.desktop/share/native/libfreetype/src/sfnt/pngshim.h @@ -4,7 +4,7 @@ * * PNG Bitmap glyph support. * - * Copyright (C) 2013-2025 by + * Copyright (C) 2013-2026 by * Google, Inc. * Written by Stuart Gill and Behdad Esfahbod. * diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/sfdriver.c b/src/java.desktop/share/native/libfreetype/src/sfnt/sfdriver.c index 32291e23e36..4046b1a0cdb 100644 --- a/src/java.desktop/share/native/libfreetype/src/sfnt/sfdriver.c +++ b/src/java.desktop/share/native/libfreetype/src/sfnt/sfdriver.c @@ -4,7 +4,7 @@ * * High-level SFNT driver interface (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/sfdriver.h b/src/java.desktop/share/native/libfreetype/src/sfnt/sfdriver.h index be4e33166c1..e9eed184b7f 100644 --- a/src/java.desktop/share/native/libfreetype/src/sfnt/sfdriver.h +++ b/src/java.desktop/share/native/libfreetype/src/sfnt/sfdriver.h @@ -4,7 +4,7 @@ * * High-level SFNT driver interface (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/sferrors.h b/src/java.desktop/share/native/libfreetype/src/sfnt/sferrors.h index 2da4ac776b0..05b259c1bfc 100644 --- a/src/java.desktop/share/native/libfreetype/src/sfnt/sferrors.h +++ b/src/java.desktop/share/native/libfreetype/src/sfnt/sferrors.h @@ -4,7 +4,7 @@ * * SFNT error codes (specification only). * - * Copyright (C) 2001-2025 by + * Copyright (C) 2001-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/sfobjs.c b/src/java.desktop/share/native/libfreetype/src/sfnt/sfobjs.c index 6af35787e85..fc855cbb6b9 100644 --- a/src/java.desktop/share/native/libfreetype/src/sfnt/sfobjs.c +++ b/src/java.desktop/share/native/libfreetype/src/sfnt/sfobjs.c @@ -4,7 +4,7 @@ * * SFNT object management (base). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/sfobjs.h b/src/java.desktop/share/native/libfreetype/src/sfnt/sfobjs.h index 8c38b727950..a27ad7064ac 100644 --- a/src/java.desktop/share/native/libfreetype/src/sfnt/sfobjs.h +++ b/src/java.desktop/share/native/libfreetype/src/sfnt/sfobjs.h @@ -4,7 +4,7 @@ * * SFNT object management (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff.c b/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff.c index 015c7b78b4d..b8a3030d9cb 100644 --- a/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff.c +++ b/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff.c @@ -4,7 +4,7 @@ * * WOFF format management (base). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff.h b/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff.h index df7ace5c209..a563fcc682a 100644 --- a/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff.h +++ b/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff.h @@ -4,7 +4,7 @@ * * WOFFF format management (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff2.c b/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff2.c index 41c233597b8..013e30fc520 100644 --- a/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff2.c +++ b/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff2.c @@ -4,7 +4,7 @@ * * WOFF2 format management (base). * - * Copyright (C) 2019-2025 by + * Copyright (C) 2019-2026 by * Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff2.h b/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff2.h index 588761d0c8e..e0296d82603 100644 --- a/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff2.h +++ b/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff2.h @@ -4,7 +4,7 @@ * * WOFFF2 format management (specification). * - * Copyright (C) 2019-2025 by + * Copyright (C) 2019-2026 by * Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttcmap.c b/src/java.desktop/share/native/libfreetype/src/sfnt/ttcmap.c index 91b02344224..f5837e65e86 100644 --- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttcmap.c +++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttcmap.c @@ -4,7 +4,7 @@ * * TrueType character mapping table (cmap) support (body). * - * Copyright (C) 2002-2025 by + * Copyright (C) 2002-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttcmap.h b/src/java.desktop/share/native/libfreetype/src/sfnt/ttcmap.h index 645e9e37e0c..fdb34f525e3 100644 --- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttcmap.h +++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttcmap.h @@ -4,7 +4,7 @@ * * TrueType character mapping table (cmap) support (specification). * - * Copyright (C) 2002-2025 by + * Copyright (C) 2002-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttcmapc.h b/src/java.desktop/share/native/libfreetype/src/sfnt/ttcmapc.h index 65807bb7378..c17ac5bba15 100644 --- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttcmapc.h +++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttcmapc.h @@ -4,7 +4,7 @@ * * TT CMAP classes definitions (specification only). * - * Copyright (C) 2009-2025 by + * Copyright (C) 2009-2026 by * Oran Agra and Mickey Gabel. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttcolr.c b/src/java.desktop/share/native/libfreetype/src/sfnt/ttcolr.c index 7929b7aaf4c..b22e279b346 100644 --- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttcolr.c +++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttcolr.c @@ -4,7 +4,7 @@ * * TrueType and OpenType colored glyph layer support (body). * - * Copyright (C) 2018-2025 by + * Copyright (C) 2018-2026 by * David Turner, Robert Wilhelm, Dominik Röttsches, and Werner Lemberg. * * Originally written by Shao Yu Zhang . @@ -236,8 +236,10 @@ p1 = (FT_Byte*)( table + base_glyphs_offset_v1 ); num_base_glyphs_v1 = FT_PEEK_ULONG( p1 ); - if ( ( table_size - base_glyphs_offset_v1 ) / BASE_GLYPH_PAINT_RECORD_SIZE - < num_base_glyphs_v1 ) + /* Account for 4 byte numBaseGlyphPaintRecords at the beginning of */ + /* the BaseGlyphPaintRecord array. */ + if ( ( table_size - base_glyphs_offset_v1 - 4 ) / + BASE_GLYPH_PAINT_RECORD_SIZE < num_base_glyphs_v1 ) goto InvalidTable; colr->num_base_glyphs_v1 = num_base_glyphs_v1; @@ -451,20 +453,14 @@ FT_UInt *acolor_index, FT_LayerIterator* iterator ) { - Colr* colr = (Colr*)face->colr; - BaseGlyphRecord glyph_record; - - - if ( !colr ) - return 0; - - if ( !iterator->p ) + if ( !iterator->p ) /* first call to function */ { - FT_ULong offset; + Colr* colr = (Colr*)face->colr; + BaseGlyphRecord glyph_record; - /* first call to function */ - iterator->layer = 0; + if ( !colr ) + return 0; if ( !find_base_glyph_record( colr->base_glyphs, colr->num_base_glyphs, @@ -472,21 +468,18 @@ &glyph_record ) ) return 0; - if ( glyph_record.num_layers ) - iterator->num_layers = glyph_record.num_layers; - else + if ( glyph_record.num_layers == 0 || + glyph_record.first_layer_index + glyph_record.num_layers > + colr->num_layers ) return 0; - offset = LAYER_SIZE * glyph_record.first_layer_index; - if ( offset + LAYER_SIZE * glyph_record.num_layers > colr->table_size ) - return 0; - - iterator->p = colr->layers + offset; + iterator->num_layers = glyph_record.num_layers; + iterator->layer = 0; + iterator->p = colr->layers + + LAYER_SIZE * glyph_record.first_layer_index; } - if ( iterator->layer >= iterator->num_layers || - iterator->p < colr->layers || - iterator->p >= ( (FT_Byte*)colr->table + colr->table_size ) ) + if ( iterator->layer >= iterator->num_layers ) return 0; *aglyph_index = FT_NEXT_USHORT( iterator->p ); diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttcolr.h b/src/java.desktop/share/native/libfreetype/src/sfnt/ttcolr.h index 3913acc74d5..c7bf1f2a4a7 100644 --- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttcolr.h +++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttcolr.h @@ -4,7 +4,7 @@ * * TrueType and OpenType colored glyph layer support (specification). * - * Copyright (C) 2018-2025 by + * Copyright (C) 2018-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Originally written by Shao Yu Zhang . diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttcpal.c b/src/java.desktop/share/native/libfreetype/src/sfnt/ttcpal.c index 6d1208f6af2..04e2db1eab5 100644 --- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttcpal.c +++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttcpal.c @@ -4,7 +4,7 @@ * * TrueType and OpenType color palette support (body). * - * Copyright (C) 2018-2025 by + * Copyright (C) 2018-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Originally written by Shao Yu Zhang . diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttcpal.h b/src/java.desktop/share/native/libfreetype/src/sfnt/ttcpal.h index a0b4c9d927f..5c2e660e13d 100644 --- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttcpal.h +++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttcpal.h @@ -4,7 +4,7 @@ * * TrueType and OpenType color palette support (specification). * - * Copyright (C) 2018-2025 by + * Copyright (C) 2018-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Originally written by Shao Yu Zhang . diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttkern.c b/src/java.desktop/share/native/libfreetype/src/sfnt/ttkern.c index 76618b0d3bb..65b249ff4cd 100644 --- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttkern.c +++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttkern.c @@ -4,7 +4,7 @@ * * Routines to parse and access the 'kern' table for kerning (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttkern.h b/src/java.desktop/share/native/libfreetype/src/sfnt/ttkern.h index e0075dce61d..8cc912a79e5 100644 --- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttkern.h +++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttkern.h @@ -5,7 +5,7 @@ * Routines to parse and access the 'kern' table for kerning * (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttload.c b/src/java.desktop/share/native/libfreetype/src/sfnt/ttload.c index 0c257ce4d31..e17d07a971c 100644 --- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttload.c +++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttload.c @@ -5,7 +5,7 @@ * Load the basic TrueType tables, i.e., tables that can be either in * TTF or OTF fonts (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttload.h b/src/java.desktop/share/native/libfreetype/src/sfnt/ttload.h index e3666c901b1..0a0aab24ce6 100644 --- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttload.h +++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttload.h @@ -5,7 +5,7 @@ * Load the basic TrueType tables, i.e., tables that can be either in * TTF or OTF fonts (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttmtx.c b/src/java.desktop/share/native/libfreetype/src/sfnt/ttmtx.c index 541d8447470..60dce87d841 100644 --- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttmtx.c +++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttmtx.c @@ -4,7 +4,7 @@ * * Load the metrics tables common to TTF and OTF fonts (body). * - * Copyright (C) 2006-2025 by + * Copyright (C) 2006-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttmtx.h b/src/java.desktop/share/native/libfreetype/src/sfnt/ttmtx.h index 1ee84507f15..618e04ffd29 100644 --- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttmtx.h +++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttmtx.h @@ -4,7 +4,7 @@ * * Load the metrics tables common to TTF and OTF fonts (specification). * - * Copyright (C) 2006-2025 by + * Copyright (C) 2006-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttpost.c b/src/java.desktop/share/native/libfreetype/src/sfnt/ttpost.c index 4246b6c8eff..98603e115ea 100644 --- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttpost.c +++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttpost.c @@ -5,7 +5,7 @@ * PostScript name table processing for TrueType and OpenType fonts * (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttpost.h b/src/java.desktop/share/native/libfreetype/src/sfnt/ttpost.h index a11b6696854..896118015e1 100644 --- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttpost.h +++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttpost.h @@ -5,7 +5,7 @@ * PostScript name table processing for TrueType and OpenType fonts * (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttsbit.c b/src/java.desktop/share/native/libfreetype/src/sfnt/ttsbit.c index 34e45619817..1655e40b681 100644 --- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttsbit.c +++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttsbit.c @@ -4,7 +4,7 @@ * * TrueType and OpenType embedded bitmap support (body). * - * Copyright (C) 2005-2025 by + * Copyright (C) 2005-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Copyright 2013 by Google, Inc. diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttsbit.h b/src/java.desktop/share/native/libfreetype/src/sfnt/ttsbit.h index 7427149d68f..8fd45223264 100644 --- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttsbit.h +++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttsbit.h @@ -4,7 +4,7 @@ * * TrueType and OpenType embedded bitmap support (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/woff2tags.c b/src/java.desktop/share/native/libfreetype/src/sfnt/woff2tags.c index 0f9e3889aab..1c3779d9f34 100644 --- a/src/java.desktop/share/native/libfreetype/src/sfnt/woff2tags.c +++ b/src/java.desktop/share/native/libfreetype/src/sfnt/woff2tags.c @@ -4,7 +4,7 @@ * * WOFF2 Font table tags (base). * - * Copyright (C) 2019-2025 by + * Copyright (C) 2019-2026 by * Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/woff2tags.h b/src/java.desktop/share/native/libfreetype/src/sfnt/woff2tags.h index e223022962e..200262d3863 100644 --- a/src/java.desktop/share/native/libfreetype/src/sfnt/woff2tags.h +++ b/src/java.desktop/share/native/libfreetype/src/sfnt/woff2tags.h @@ -4,7 +4,7 @@ * * WOFF2 Font table tags (specification). * - * Copyright (C) 2019-2025 by + * Copyright (C) 2019-2026 by * Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.c b/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.c index 3c387aea0ac..0f7b63937d7 100644 --- a/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.c +++ b/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.c @@ -4,7 +4,7 @@ * * A new `perfect' anti-aliasing renderer (body). * - * Copyright (C) 2000-2025 by + * Copyright (C) 2000-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.h b/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.h index e463e5b3eb8..99c7383e76e 100644 --- a/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.h +++ b/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.h @@ -4,7 +4,7 @@ * * FreeType smooth renderer declaration * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/smooth/ftsmerrs.h b/src/java.desktop/share/native/libfreetype/src/smooth/ftsmerrs.h index 8d5068549fa..2f2276bd58c 100644 --- a/src/java.desktop/share/native/libfreetype/src/smooth/ftsmerrs.h +++ b/src/java.desktop/share/native/libfreetype/src/smooth/ftsmerrs.h @@ -4,7 +4,7 @@ * * smooth renderer error codes (specification only). * - * Copyright (C) 2001-2025 by + * Copyright (C) 2001-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/smooth/ftsmooth.c b/src/java.desktop/share/native/libfreetype/src/smooth/ftsmooth.c index 5a7a852a619..7378e6adc46 100644 --- a/src/java.desktop/share/native/libfreetype/src/smooth/ftsmooth.c +++ b/src/java.desktop/share/native/libfreetype/src/smooth/ftsmooth.c @@ -4,7 +4,7 @@ * * Anti-aliasing renderer interface (body). * - * Copyright (C) 2000-2025 by + * Copyright (C) 2000-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/smooth/ftsmooth.h b/src/java.desktop/share/native/libfreetype/src/smooth/ftsmooth.h index f76708ae701..56c7ac70b5c 100644 --- a/src/java.desktop/share/native/libfreetype/src/smooth/ftsmooth.h +++ b/src/java.desktop/share/native/libfreetype/src/smooth/ftsmooth.h @@ -4,7 +4,7 @@ * * Anti-aliasing renderer interface (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/truetype/ttdriver.c b/src/java.desktop/share/native/libfreetype/src/truetype/ttdriver.c index 6369d83d6d5..90d6e810578 100644 --- a/src/java.desktop/share/native/libfreetype/src/truetype/ttdriver.c +++ b/src/java.desktop/share/native/libfreetype/src/truetype/ttdriver.c @@ -4,7 +4,7 @@ * * TrueType font driver implementation (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/truetype/ttdriver.h b/src/java.desktop/share/native/libfreetype/src/truetype/ttdriver.h index 943eaae3482..c00bba066e3 100644 --- a/src/java.desktop/share/native/libfreetype/src/truetype/ttdriver.h +++ b/src/java.desktop/share/native/libfreetype/src/truetype/ttdriver.h @@ -4,7 +4,7 @@ * * High-level TrueType driver interface (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/truetype/tterrors.h b/src/java.desktop/share/native/libfreetype/src/truetype/tterrors.h index 631dbf5a80f..1ae4b087ac8 100644 --- a/src/java.desktop/share/native/libfreetype/src/truetype/tterrors.h +++ b/src/java.desktop/share/native/libfreetype/src/truetype/tterrors.h @@ -4,7 +4,7 @@ * * TrueType error codes (specification only). * - * Copyright (C) 2001-2025 by + * Copyright (C) 2001-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/truetype/ttgload.c b/src/java.desktop/share/native/libfreetype/src/truetype/ttgload.c index 4dd68ab1019..dcff7c3bb71 100644 --- a/src/java.desktop/share/native/libfreetype/src/truetype/ttgload.c +++ b/src/java.desktop/share/native/libfreetype/src/truetype/ttgload.c @@ -4,7 +4,7 @@ * * TrueType Glyph Loader (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -1185,9 +1185,7 @@ /* make room for phantom points */ - error = FT_GLYPHLOADER_CHECK_POINTS( loader->gloader, - outline->n_points + 4, - 0 ); + error = FT_GLYPHLOADER_CHECK_POINTS( loader->gloader, 4, 0 ); if ( error ) return error; @@ -1425,6 +1423,14 @@ FT_TRACE5(( " nesting level: %u\n", recurse_count )); #endif + /* arbitrary recursion limit */ + if ( recurse_count > 100 ) + { + FT_TRACE4(( "load_truetype_glyph: recursion depth exceeded\n" )); + error = FT_THROW( Invalid_Composite ); + goto Exit; + } + /* some fonts have an incorrect value of `maxComponentDepth' */ if ( recurse_count > face->max_profile.maxComponentDepth ) { diff --git a/src/java.desktop/share/native/libfreetype/src/truetype/ttgload.h b/src/java.desktop/share/native/libfreetype/src/truetype/ttgload.h index 39d6ae3664c..3d6a762d1f7 100644 --- a/src/java.desktop/share/native/libfreetype/src/truetype/ttgload.h +++ b/src/java.desktop/share/native/libfreetype/src/truetype/ttgload.h @@ -4,7 +4,7 @@ * * TrueType Glyph Loader (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/truetype/ttgxvar.c b/src/java.desktop/share/native/libfreetype/src/truetype/ttgxvar.c index f8842795f14..d392e9bc1c2 100644 --- a/src/java.desktop/share/native/libfreetype/src/truetype/ttgxvar.c +++ b/src/java.desktop/share/native/libfreetype/src/truetype/ttgxvar.c @@ -4,7 +4,7 @@ * * TrueType GX Font Variation loader * - * Copyright (C) 2004-2025 by + * Copyright (C) 2004-2026 by * David Turner, Robert Wilhelm, Werner Lemberg, and George Williams. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/truetype/ttgxvar.h b/src/java.desktop/share/native/libfreetype/src/truetype/ttgxvar.h index 568c8027bbf..8a59c0cd6e6 100644 --- a/src/java.desktop/share/native/libfreetype/src/truetype/ttgxvar.h +++ b/src/java.desktop/share/native/libfreetype/src/truetype/ttgxvar.h @@ -4,7 +4,7 @@ * * TrueType GX Font Variation loader (specification) * - * Copyright (C) 2004-2025 by + * Copyright (C) 2004-2026 by * David Turner, Robert Wilhelm, Werner Lemberg and George Williams. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/truetype/ttinterp.c b/src/java.desktop/share/native/libfreetype/src/truetype/ttinterp.c index f46cc77fe5f..f850bc418e7 100644 --- a/src/java.desktop/share/native/libfreetype/src/truetype/ttinterp.c +++ b/src/java.desktop/share/native/libfreetype/src/truetype/ttinterp.c @@ -4,7 +4,7 @@ * * TrueType bytecode interpreter (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/truetype/ttinterp.h b/src/java.desktop/share/native/libfreetype/src/truetype/ttinterp.h index 5cdc8f59f1a..05ac831dfd1 100644 --- a/src/java.desktop/share/native/libfreetype/src/truetype/ttinterp.h +++ b/src/java.desktop/share/native/libfreetype/src/truetype/ttinterp.h @@ -4,7 +4,7 @@ * * TrueType bytecode interpreter (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/truetype/ttobjs.c b/src/java.desktop/share/native/libfreetype/src/truetype/ttobjs.c index 2aedbd842c1..dc897688584 100644 --- a/src/java.desktop/share/native/libfreetype/src/truetype/ttobjs.c +++ b/src/java.desktop/share/native/libfreetype/src/truetype/ttobjs.c @@ -4,7 +4,7 @@ * * Objects manager (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -734,6 +734,10 @@ /* a `loca' table is not valid */ if ( face->glyf_len && FT_ERR_EQ( error, Table_Missing ) ) goto Exit; + /* if both `glyf' and `loca' tables are missing, */ + /* we don't have a valid font file either */ + if ( face->glyf_len == 0 && FT_ERR_EQ( error, Locations_Missing ) ) + goto Bad_Format; if ( error ) goto Exit; } @@ -1057,9 +1061,23 @@ exec->maxFunc = 0; exec->maxIns = 0; - /* XXX: We reserve a little more elements on the stack to deal */ - /* with broken fonts like arialbs, courbs, timesbs, etc. */ - exec->stackSize = maxp->maxStackElements + 32; + /* We reserve extra elements on the stack to deal with broken fonts. */ + /* */ + /* Some fonts (e.g., `Rubik-Italic.ttf`) have buggy hinting bytecode */ + /* that pushes more values than `maxStackElements` declared in the */ + /* 'maxp' table. For example, `Rubik-Italic.ttf`'s 'prep' program */ + /* pushes 255 values but `maxStackElements` is only set to 153. */ + /* */ + /* To alleviate this situation we increase the value of */ + /* `maxStackElements` based on a percentage of `maxStackElements`, */ + /* with a minimum of 128 extra slots. This allows most broken fonts */ + /* to work without completely disabling hinting, while adding only a */ + /* small overhead for correctly authored fonts. */ + + /* Use 50% more than declared, with minimum safety margin of 128. */ + exec->stackSize = maxp->maxStackElements + + FT_MAX( maxp->maxStackElements / 2, 128 ); + exec->storeSize = maxp->maxStorage; exec->cvtSize = face->cvt_size; diff --git a/src/java.desktop/share/native/libfreetype/src/truetype/ttobjs.h b/src/java.desktop/share/native/libfreetype/src/truetype/ttobjs.h index 28d6c7d855f..9b2f412ac47 100644 --- a/src/java.desktop/share/native/libfreetype/src/truetype/ttobjs.h +++ b/src/java.desktop/share/native/libfreetype/src/truetype/ttobjs.h @@ -4,7 +4,7 @@ * * Objects manager (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/truetype/ttpload.c b/src/java.desktop/share/native/libfreetype/src/truetype/ttpload.c index 827454d8574..5b0a3944d6a 100644 --- a/src/java.desktop/share/native/libfreetype/src/truetype/ttpload.c +++ b/src/java.desktop/share/native/libfreetype/src/truetype/ttpload.c @@ -4,7 +4,7 @@ * * TrueType-specific tables loader (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/truetype/ttpload.h b/src/java.desktop/share/native/libfreetype/src/truetype/ttpload.h index bb4d3c9cc55..ad0a9eb7a6d 100644 --- a/src/java.desktop/share/native/libfreetype/src/truetype/ttpload.h +++ b/src/java.desktop/share/native/libfreetype/src/truetype/ttpload.h @@ -4,7 +4,7 @@ * * TrueType-specific tables loader (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/type1/t1afm.c b/src/java.desktop/share/native/libfreetype/src/type1/t1afm.c index b1a0d23bed6..cc94a0d4a45 100644 --- a/src/java.desktop/share/native/libfreetype/src/type1/t1afm.c +++ b/src/java.desktop/share/native/libfreetype/src/type1/t1afm.c @@ -4,7 +4,7 @@ * * AFM support for Type 1 fonts (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/type1/t1afm.h b/src/java.desktop/share/native/libfreetype/src/type1/t1afm.h index 92ff627dd0d..f31c9d100f0 100644 --- a/src/java.desktop/share/native/libfreetype/src/type1/t1afm.h +++ b/src/java.desktop/share/native/libfreetype/src/type1/t1afm.h @@ -4,7 +4,7 @@ * * AFM support for Type 1 fonts (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/type1/t1driver.c b/src/java.desktop/share/native/libfreetype/src/type1/t1driver.c index 5ded7714021..1d7a342708d 100644 --- a/src/java.desktop/share/native/libfreetype/src/type1/t1driver.c +++ b/src/java.desktop/share/native/libfreetype/src/type1/t1driver.c @@ -4,7 +4,7 @@ * * Type 1 driver interface (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/type1/t1driver.h b/src/java.desktop/share/native/libfreetype/src/type1/t1driver.h index 1cc3d24e7dd..2869adab6e7 100644 --- a/src/java.desktop/share/native/libfreetype/src/type1/t1driver.h +++ b/src/java.desktop/share/native/libfreetype/src/type1/t1driver.h @@ -4,7 +4,7 @@ * * High-level Type 1 driver interface (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/type1/t1errors.h b/src/java.desktop/share/native/libfreetype/src/type1/t1errors.h index 46bddbc30fd..efe53be1f4c 100644 --- a/src/java.desktop/share/native/libfreetype/src/type1/t1errors.h +++ b/src/java.desktop/share/native/libfreetype/src/type1/t1errors.h @@ -4,7 +4,7 @@ * * Type 1 error codes (specification only). * - * Copyright (C) 2001-2025 by + * Copyright (C) 2001-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/type1/t1gload.c b/src/java.desktop/share/native/libfreetype/src/type1/t1gload.c index b9bc0b56ce8..dd9b6cd80fc 100644 --- a/src/java.desktop/share/native/libfreetype/src/type1/t1gload.c +++ b/src/java.desktop/share/native/libfreetype/src/type1/t1gload.c @@ -4,7 +4,7 @@ * * Type 1 Glyph Loader (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/type1/t1gload.h b/src/java.desktop/share/native/libfreetype/src/type1/t1gload.h index 6bedd132c5f..b3de427a2f3 100644 --- a/src/java.desktop/share/native/libfreetype/src/type1/t1gload.h +++ b/src/java.desktop/share/native/libfreetype/src/type1/t1gload.h @@ -4,7 +4,7 @@ * * Type 1 Glyph Loader (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/type1/t1load.c b/src/java.desktop/share/native/libfreetype/src/type1/t1load.c index 0f11445bef0..1d095f8ac1f 100644 --- a/src/java.desktop/share/native/libfreetype/src/type1/t1load.c +++ b/src/java.desktop/share/native/libfreetype/src/type1/t1load.c @@ -4,7 +4,7 @@ * * Type 1 font loader (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/type1/t1load.h b/src/java.desktop/share/native/libfreetype/src/type1/t1load.h index 2cd8241968d..39d4b94e9dc 100644 --- a/src/java.desktop/share/native/libfreetype/src/type1/t1load.h +++ b/src/java.desktop/share/native/libfreetype/src/type1/t1load.h @@ -4,7 +4,7 @@ * * Type 1 font loader (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/type1/t1objs.c b/src/java.desktop/share/native/libfreetype/src/type1/t1objs.c index 7f25208f875..4ee0a591096 100644 --- a/src/java.desktop/share/native/libfreetype/src/type1/t1objs.c +++ b/src/java.desktop/share/native/libfreetype/src/type1/t1objs.c @@ -4,7 +4,7 @@ * * Type 1 objects manager (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/type1/t1objs.h b/src/java.desktop/share/native/libfreetype/src/type1/t1objs.h index 6c71977c154..f152f630a86 100644 --- a/src/java.desktop/share/native/libfreetype/src/type1/t1objs.h +++ b/src/java.desktop/share/native/libfreetype/src/type1/t1objs.h @@ -4,7 +4,7 @@ * * Type 1 objects manager (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/type1/t1parse.c b/src/java.desktop/share/native/libfreetype/src/type1/t1parse.c index ef643e298f4..a9b8d18a6ff 100644 --- a/src/java.desktop/share/native/libfreetype/src/type1/t1parse.c +++ b/src/java.desktop/share/native/libfreetype/src/type1/t1parse.c @@ -4,7 +4,7 @@ * * Type 1 parser (body). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/type1/t1parse.h b/src/java.desktop/share/native/libfreetype/src/type1/t1parse.h index f4ad426e9e1..ebd7c3fb340 100644 --- a/src/java.desktop/share/native/libfreetype/src/type1/t1parse.h +++ b/src/java.desktop/share/native/libfreetype/src/type1/t1parse.h @@ -4,7 +4,7 @@ * * Type 1 parser (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/share/native/libfreetype/src/type1/t1tokens.h b/src/java.desktop/share/native/libfreetype/src/type1/t1tokens.h index a526406a411..745351a34c9 100644 --- a/src/java.desktop/share/native/libfreetype/src/type1/t1tokens.h +++ b/src/java.desktop/share/native/libfreetype/src/type1/t1tokens.h @@ -4,7 +4,7 @@ * * Type 1 tokenizer (specification). * - * Copyright (C) 1996-2025 by + * Copyright (C) 1996-2026 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XSelection.java b/src/java.desktop/unix/classes/sun/awt/X11/XSelection.java index e93b311633d..0e6e9b38f05 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XSelection.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XSelection.java @@ -478,8 +478,6 @@ final class XSelection { int count = 0; try { - SunToolkit.insertTargetMapping(this); - byteData = DataTransferer.getInstance().convertData(this, contents, format, diff --git a/src/java.management/share/classes/javax/management/remote/JMXServiceURL.java b/src/java.management/share/classes/javax/management/remote/JMXServiceURL.java index da47f7a1eda..44fdd75ec7b 100644 --- a/src/java.management/share/classes/javax/management/remote/JMXServiceURL.java +++ b/src/java.management/share/classes/javax/management/remote/JMXServiceURL.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -291,7 +291,7 @@ public class JMXServiceURL implements Serializable { String urlPath) throws MalformedURLException { if (protocol == null) { - throw new MalformedURLException("Misssing protocol name"); + throw new MalformedURLException("Missing protocol name"); } if (host == null) { InetAddress local; diff --git a/src/jdk.attach/share/classes/com/sun/tools/attach/VirtualMachine.java b/src/jdk.attach/share/classes/com/sun/tools/attach/VirtualMachine.java index f283f9e08a8..d31e364f03d 100644 --- a/src/jdk.attach/share/classes/com/sun/tools/attach/VirtualMachine.java +++ b/src/jdk.attach/share/classes/com/sun/tools/attach/VirtualMachine.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, 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 @@ -38,7 +38,7 @@ import java.io.IOException; *

A {@code VirtualMachine} represents a Java virtual machine to which this * Java virtual machine has attached. The Java virtual machine to which it is * attached is sometimes called the target virtual machine, or target VM. - * An application (typically a tool such as a managemet console or profiler) uses a + * An application (typically a tool such as a management console or profiler) uses a * VirtualMachine to load an agent into the target VM. For example, a profiler tool * written in the Java Language might attach to a running application and load its * profiler agent to profile the running application.

diff --git a/src/jdk.attach/share/classes/sun/tools/attach/HotSpotAttachProvider.java b/src/jdk.attach/share/classes/sun/tools/attach/HotSpotAttachProvider.java index f833ee1afb3..e04b58167f4 100644 --- a/src/jdk.attach/share/classes/sun/tools/attach/HotSpotAttachProvider.java +++ b/src/jdk.attach/share/classes/sun/tools/attach/HotSpotAttachProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, 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 @@ -118,7 +118,7 @@ public abstract class HotSpotAttachProvider extends AttachProvider { mvm = host.getMonitoredVm(vmid); if (MonitoredVmUtil.isAttachable(mvm)) { - // it's attachable; so return false + // it's attachable return; } } catch (Throwable t) { diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java index caa081505b6..e49ffa92128 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java @@ -1233,27 +1233,9 @@ public class TypeAnnotations { try { currentLambda = tree; - int i = 0; - for (JCVariableDecl param : tree.params) { - if (!param.mods.annotations.isEmpty()) { - // Nothing to do for separateAnnotationsKinds if - // there are no annotations of either kind. - final TypeAnnotationPosition pos = TypeAnnotationPosition - .methodParameter(tree, i, param.vartype.pos); - push(param); - try { - if (!param.declaredUsingVar()) { - separateAnnotationsKinds(param, param.vartype, param.sym.type, param.sym, pos); - } - } finally { - pop(); - } - } - ++i; - } - scan(tree.body); - scan(tree.params); + + //parameters are handled separately as variables } finally { currentLambda = prevLambda; } @@ -1278,8 +1260,12 @@ public class TypeAnnotations { TypeAnnotationPosition.exceptionParameter(currentLambda, tree.pos); separateAnnotationsKinds(tree, tree.vartype, tree.sym.type, tree.sym, pos); + } else if (currentLambda != null && !tree.declaredUsingVar() && currentLambda.params.contains(tree)) { + final TypeAnnotationPosition pos = TypeAnnotationPosition + .methodParameter(currentLambda, currentLambda.params.indexOf(tree), tree.vartype.pos); + separateAnnotationsKinds(tree, tree.vartype, tree.sym.type, tree.sym, pos); } else { - // (real) parameters are handled in visitMethodDef or visitLambda. + // method parameters are handled in visitMethodDef. } } } else if (tree.sym.getKind() == ElementKind.FIELD) { diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java index a38ca7c01a1..30f08fad265 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java @@ -895,7 +895,7 @@ public class Attr extends JCTree.Visitor { tree.type : attribType(tree, env); try { - return checkBase(t, tree, env, classExpected, interfaceExpected, checkExtensible); + return tree.type = checkBase(t, tree, env, classExpected, interfaceExpected, checkExtensible); } catch (CompletionFailure ex) { chk.completionError(tree.pos(), ex); return t; diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java index 84920aaf556..34427765107 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java @@ -268,17 +268,17 @@ public class Check { * @param pos Position to be used for error reporting. * @param required An internationalized string describing the type tag * required. - * @param found The type that was found. + * @param type The type that was found. */ - Type typeTagError(DiagnosticPosition pos, JCDiagnostic required, Object found) { + Type typeTagError(DiagnosticPosition pos, JCDiagnostic required, Type type) { // this error used to be raised by the parser, // but has been delayed to this point: - if (found instanceof Type type && type.hasTag(VOID)) { + if (type.hasTag(VOID)) { log.error(pos, Errors.IllegalStartOfType); return syms.errType; } - log.error(pos, Errors.TypeFoundReq(found, required)); - return types.createErrorType(found instanceof Type type ? type : syms.errType); + log.error(pos, Errors.TypeFoundReq(asTypeParam(type), required)); + return types.createErrorType(type); } /** Report duplicate declaration error. @@ -645,7 +645,7 @@ public class Check { if (!t.hasTag(CLASS) && !t.hasTag(ARRAY) && !t.hasTag(ERROR)) { return typeTagError(pos, diags.fragment(Fragments.TypeReqClassArray), - asTypeParam(t)); + t); } else { return t; } @@ -659,7 +659,7 @@ public class Check { if (!t.hasTag(CLASS) && !t.hasTag(ERROR)) { return typeTagError(pos, diags.fragment(Fragments.TypeReqClass), - asTypeParam(t)); + t); } else { return t; } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/MemoryContext.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/MemoryContext.java index 3f3f5e2f27b..8f24d161947 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/MemoryContext.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/MemoryContext.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 @@ -225,17 +225,11 @@ final class MemoryContext { var memoryConfig = parentLayer.configuration().resolveAndBind(memoryFinder, ModuleFinder.of(), Set.of(applicationModule.name())); var memoryClassLoader = new MemoryClassLoader(inMemoryClasses, parentLoader, applicationModule, descriptor, this::compileJavaFileByName); var memoryController = ModuleLayer.defineModules(memoryConfig, List.of(parentLayer), __ -> memoryClassLoader); - var memoryLayer = memoryController.layer(); - - // Make application class accessible from the calling (unnamed) module, that loaded this class. - var module = memoryLayer.findModule(applicationModule.name()).orElseThrow(); - var mainClassNamePackageName = mainClassName.substring(0, lastDotInMainClassName); - memoryController.addOpens(module, mainClassNamePackageName, getClass().getModule()); // Configure native access for the modular application. enableNativeAccess(memoryController, true); - return memoryLayer.findLoader(applicationModule.name()); + return memoryClassLoader; } private static ModuleFinder createModuleFinderFromModulePath() { diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/ProgramDescriptor.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/ProgramDescriptor.java index fd99838427b..8589b916504 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/ProgramDescriptor.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/ProgramDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, 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 @@ -114,7 +114,8 @@ public record ProgramDescriptor( } public boolean isModular() { - return Files.exists(sourceRootPath.resolve("module-info.java")); + return !fileObject.isFirstLineIgnored() // programs with "shebang" lines are never modular + && Files.exists(sourceRootPath.resolve("module-info.java")); } public Set computePackageNames() { diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/SourceLauncher.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/SourceLauncher.java index e8ab1b9349c..d9743f3208c 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/SourceLauncher.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/SourceLauncher.java @@ -42,6 +42,7 @@ import java.util.Arrays; import jdk.internal.misc.MethodFinder; import jdk.internal.misc.VM; +import jdk.internal.module.Modules; /** * Compiles a source file, and executes the main method it contains. @@ -217,6 +218,13 @@ public final class SourceLauncher { } } + // Open packages needed for reflection for main class construction and + // main method invocation. + var thisModule = getClass().getModule(); + var mainMethodDeclaringClass = mainMethod.getDeclaringClass(); + openPackageTo(mainMethodDeclaringClass.getModule(), mainMethodDeclaringClass.getPackageName(), thisModule); + openPackageTo(mainClass.getModule(), mainClass.getPackageName(), thisModule); + String mainClassName = mainClass.getName(); var isStatic = Modifier.isStatic(mainMethod.getModifiers()); @@ -278,4 +286,11 @@ public final class SourceLauncher { return mainClass; } + + private static void openPackageTo(Module module, String packageName, Module target) { + // Packages outside named modules are already open + if (module.isNamed()) { + Modules.addOpens(module, packageName, target); + } + } } diff --git a/src/jdk.unsupported.desktop/share/classes/jdk/swing/interop/SwingInterOpUtils.java b/src/jdk.unsupported.desktop/share/classes/jdk/swing/interop/SwingInterOpUtils.java index aaed4d3e048..5c7ac4fd71a 100644 --- a/src/jdk.unsupported.desktop/share/classes/jdk/swing/interop/SwingInterOpUtils.java +++ b/src/jdk.unsupported.desktop/share/classes/jdk/swing/interop/SwingInterOpUtils.java @@ -33,8 +33,7 @@ import sun.awt.UngrabEvent; /** * This class provides static utility methods to be used by FX swing interop - * to access and use jdk internal classes like SunToolkit, AppContext - * and UngrabEvent. + * to access and use jdk internal classes like SunToolkit and UngrabEvent. * * @since 11 */ diff --git a/test/failure_handler/Makefile b/test/failure_handler/Makefile deleted file mode 100644 index ec0361abdd1..00000000000 --- a/test/failure_handler/Makefile +++ /dev/null @@ -1,109 +0,0 @@ -# -# Copyright (c) 2015, 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. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -# -# This is a temporary standalone makefile -# - -BUILD_DIR := $(shell pwd)/build -CLASSES_DIR := ${BUILD_DIR}/classes -IMAGE_DIR := ${BUILD_DIR}/image -RUN_DIR := $(shell pwd)/run -CLASSPATH := ${JTREG_HOME}/lib/jtreg.jar:${JAVA_HOME}/lib/tools.jar -SRC_DIR := src/share/classes/ -SOURCES := ${SRC_DIR}/jdk/test/failurehandler/*.java \ - ${SRC_DIR}/jdk/test/failurehandler/action/*.java \ - ${SRC_DIR}/jdk/test/failurehandler/jtreg/*.java \ - ${SRC_DIR}/jdk/test/failurehandler/value/*.java - -CONF_DIR = src/share/conf - -JAVA_RELEASE = 15 - -TARGET_JAR = ${IMAGE_DIR}/lib/jtregFailureHandler.jar - -OS_NAME := $(shell uname -o 2>&1) - -ifeq ("${OS_NAME}", "Cygwin") -BUILD_DIR := $(shell cygpath -m "${BUILD_DIR}") -CLASSES_DIR := $(shell cygpath -m "${CLASSES_DIR}") -IMAGE_DIR := $(shell cygpath -m "${IMAGE_DIR}") -RUN_DIR := $(shell cygpath -m "${RUN_DIR}") -SRC_DIR := $(shell cygpath -m "${SRC_DIR}") -JAVA_HOME := $(shell cygpath -m "${JAVA_HOME}") -JTREG_HOME := $(shell cygpath -m "${JTREG_HOME}") -CLASSPATH := $(shell cygpath -pm "${CLASSPATH}") -endif - -all: clean test - -check_defined = $(foreach 1,$1,$(__check_defined)) -__check_defined = $(if $(value $1),, $(error $1 is not set)) - -classes: require_env - mkdir -p ${IMAGE_DIR}/bin ${IMAGE_DIR}/lib ${CLASSES_DIR} - "${JAVA_HOME}"/bin/javac -target ${JAVA_RELEASE} -source ${JAVA_RELEASE} \ - -sourcepath "$(shell pwd)" \ - -cp "${CLASSPATH}" \ - -d ${CLASSES_DIR} \ - ${SOURCES} - "${JAVA_HOME}"/bin/jar cf "${TARGET_JAR}" -C "${CLASSES_DIR}" . - "${JAVA_HOME}"/bin/jar uf "${TARGET_JAR}" -C "${CONF_DIR}" . - -# -# Use JTREG_TEST_OPTS for test VM options -# Use JTREG_TESTS for jtreg tests parameter -# -test: require_env build - rm -rf "${RUN_DIR}" - mkdir -p "${RUN_DIR}" - "${JTREG_HOME}"/bin/jtreg \ - -jdk:"${JAVA_HOME}" \ - ${JTREG_TEST_OPTS} \ - -timeout:0.1 -va -retain:all \ - -noreport \ - -agentvm \ - -thd:"${TARGET_JAR}" \ - -th:jdk.test.failurehandler.jtreg.GatherProcessInfoTimeoutHandler \ - -thtimeout:0 \ - -od:"${TARGET_JAR}" \ - -o:jdk.test.failurehandler.jtreg.GatherDiagnosticInfoObserver \ - -w:"${RUN_DIR}/JTwork" \ - -r:"${RUN_DIR}/JTreport" \ - $(if ${JTREG_TESTS}, ${JTREG_TESTS}, test) \ - && false || true - -debug: JTREG_TEST_OPTS += "-J-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005'" -debug: test - -require_env: - $(call check_defined, JAVA_HOME) - $(call check_defined, JTREG_HOME) - -clean: - rm -rf "${BUILD_DIR}" "${RUN_DIR}" - -build: classes - -.PHONY: all build classes test require_env clean -.DEFAULT: all diff --git a/test/failure_handler/README b/test/failure_handler/README index 4271bfbceaf..77979217b69 100644 --- a/test/failure_handler/README +++ b/test/failure_handler/README @@ -1,4 +1,4 @@ -Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. This code is free software; you can redistribute it and/or modify it @@ -106,7 +106,6 @@ $ ${JTREG_HOME}/bin/jtreg -jdk:${JAVA_HOME} \ TESTING There are a few make targets for testing the failure_handler itself. - - Everything in `test/failure_handler/Makefile` - The `test-failure-handler` target in `make/RunTests.gmk` - The `test` target in `make/test/BuildFailureHandler.gmk` All of these targets are written for manual testing only. They rely on diff --git a/test/hotspot/jtreg/compiler/predicates/assertion/TestAssertionPredicates.java b/test/hotspot/jtreg/compiler/predicates/assertion/TestAssertionPredicates.java index c3ccf4eff43..5ff35ea7df2 100644 --- a/test/hotspot/jtreg/compiler/predicates/assertion/TestAssertionPredicates.java +++ b/test/hotspot/jtreg/compiler/predicates/assertion/TestAssertionPredicates.java @@ -147,7 +147,7 @@ /* * @test id=DataUpdateZGC * @key randomness - * @bug 8288981 8350577 0360510 + * @bug 8288981 8350577 8360510 * @requires vm.compiler2.enabled * @requires vm.gc.Z * @run main/othervm -Xcomp -XX:+UnlockDiagnosticVMOptions -XX:+StressGCM -XX:+AbortVMOnCompilationFailure -XX:+UseZGC @@ -157,6 +157,18 @@ * compiler.predicates.assertion.TestAssertionPredicates DataUpdate */ +/* + * @test id=DataUpdateRangeCheckElimination + * @key randomness + * @bug 8379125 + * @requires vm.compiler2.enabled + * @requires vm.gc.Z + * @run main/othervm -Xcomp -XX:+UnlockDiagnosticVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:-UseLoopPredicate + * -XX:+StressGCM -XX:+UseZGC -XX:+AbortVMOnCompilationFailure -XX:-KillPathsReachableByDeadTypeNode + * -XX:CompileCommand=compileonly,compiler.predicates.assertion.TestAssertionPredicates::* + * compiler.predicates.assertion.TestAssertionPredicates DataUpdate + */ + /* * @test id=CloneDown * @bug 8288981 8350577 @@ -350,6 +362,7 @@ public class TestAssertionPredicates { testDataUpdateUnroll(); testDataUpdatePeelingUnroll(); testPeelingThreeTimesDataUpdate(); + testRangeCheckEliminationPeelMainLoopDataUpdate(); } } case "CloneDown" -> { @@ -1418,6 +1431,71 @@ public class TestAssertionPredicates { } } + // JDK-8379125 + //-Xcomp -XX:CompileCommand=compileonly,Test*::test* -XX:+StressGCM -XX:-UseLoopPredicate -XX:+StressGCM -XX:+UseZGC + static void testRangeCheckEliminationPeelMainLoopDataUpdate() { + int zero = 34; + int x = 2; + for (; x < 4; x *= 2); + for (int i = 2; i < x; i++) { + zero = 0; + } + + Foo[] fooArr; + int limit; + if (flagTrue) { + limit = 4; + fooArr = new Foo[30_000_001]; + } else { + limit = 5; + fooArr = new Foo[40_000_001]; + } + + // Initialize to prevent null pointers. + for (int i = 0; i < limit; i++) { + fooArr[10_000_000 * i] = foo; + } + + + // 1) Pre-Main-Post loop created + for (int i = 0; i < limit; i++) { + + if (i > 0) { // 4) In main-loop: Always true and folded because of executing pre-loop at least once -> i = [1..5] + int k = iFld + i * zero; // 5) Loop variant before CCP, after CCP: folded to k = iFld + if (k == 40) { // 6) After CCP: Loop Invariant -> Triggers Loop Peeling of main loop + return; + } + } + + // 2) Range Check Elimination (there is no Loop Predication when run with -XX:-UseLoopPredicate): + // - Removes this range check from main loop. + // - Pins the previously pinned LoadP for the fooArr access to the zero-trip-guard of the main loop. + // - Adds a Template Assertion Predicate for the eliminated range check. + // 3) Loop is unrolled once. We now have two LoadP for both fooArr accesses at the zero-trip-guard: + // - LoadP 1: fooArr[i * 10^7] + // - LoadP 2: fooArr[(i+1) * 10^7 = i * 10^7 + 10^7] + // 7) After peeling the main-loop, we have 4 Load nodes: Two for the peeled iteration and two for + // the remaining loop. Both are pinned at the zero-trip-guard for the main-loop. Here is the bug: + // We should actually update the 2 LoadP pins belonging to the remaining loop to only get executed + // when the zero-trip-guard is true and we are actually enter the remaining loop but forget to do that! + // - LoadP 1: fooArr[i * 10^7] + // - LoadP 2: fooArr[(i+1) * 10^7 = i * 10^7 + 10^7] + // - LoadP 3: fooArr[(i+2) * 10^7 = i * 10^7 + 2*10^7] + // - LoadP 4: fooArr[(i+3) * 10^7 = i * 10^7 + 3*10^7] + // 8) During runtime, we have: + // - flagTrue = true + // - limit = 4 + // - fooArr = new Foo[30000001] + // We enter the main-loop with i = 1. We execute the peeled iteration but we do not enter the remaining loop + // because i = 3 and we only require one more iteration but the remaining loop ill perform two iterations. + // So, the zero-trip-guard for the remaining loop fails. + // But all LoadP nodes are pinned at the zero-trip-guard for the main-loop. When using -XX:+StressGCM, we could + // schedule LoadP 4 before actually checking the zero-trip-guard and we crash with an out-of-bounds-access: + // - LoadP 4: fooArr[(i+3) * 10^7 = i * 10^7 + 3*10^7 = 4*10^7 > 3*10^7 (max-index)] -> crash! + fooArr[i * 10_000_000].iFld += 34; + } + } + /* * Tests collected in JBS and duplicated issues */ diff --git a/test/hotspot/jtreg/gc/shenandoah/TestStringDedup.java b/test/hotspot/jtreg/gc/shenandoah/TestStringDedup.java index 8432eff8045..760e396beb1 100644 --- a/test/hotspot/jtreg/gc/shenandoah/TestStringDedup.java +++ b/test/hotspot/jtreg/gc/shenandoah/TestStringDedup.java @@ -33,12 +33,12 @@ * @modules java.base/java.lang:open * java.management * - * @run main/othervm -Xmx256m -Xlog:gc+stats -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication + * @run main/othervm -Xmx256m -Xlog:stringdedup -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive * -XX:+ShenandoahDegeneratedGC -DGCCount=1 * TestStringDedup * - * @run main/othervm -Xmx256m -Xlog:gc+stats -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication + * @run main/othervm -Xmx256m -Xlog:stringdedup -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive * -XX:-ShenandoahDegeneratedGC -DGCCount=1 * TestStringDedup @@ -53,16 +53,16 @@ * @modules java.base/java.lang:open * java.management * - * @run main/othervm -Xmx256m -Xlog:gc+stats -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication - * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive -XX:StringDeduplicationAgeThreshold=3 + * @run main/othervm -Xmx256m -Xlog:stringdedup -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication + * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive * TestStringDedup * - * @run main/othervm -Xmx256m -Xlog:gc+stats -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication - * -XX:+UseShenandoahGC -XX:StringDeduplicationAgeThreshold=3 + * @run main/othervm -Xmx256m -Xlog:stringdedup -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication + * -XX:+UseShenandoahGC * TestStringDedup * - * @run main/othervm -Xmx256m -Xlog:gc+stats -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication - * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact -XX:StringDeduplicationAgeThreshold=3 + * @run main/othervm -Xmx256m -Xlog:stringdedup -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication + * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact * TestStringDedup */ @@ -75,8 +75,8 @@ * @modules java.base/java.lang:open * java.management * - * @run main/othervm -Xmx256m -Xlog:gc+stats -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication - * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=generational -XX:StringDeduplicationAgeThreshold=3 + * @run main/othervm -Xmx256m -Xlog:stringdedup -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication + * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=generational * TestStringDedup */ diff --git a/test/hotspot/jtreg/gc/shenandoah/TestStringDedupStress.java b/test/hotspot/jtreg/gc/shenandoah/TestStringDedupStress.java index 1c3c68f7f4f..fa8c67e095d 100644 --- a/test/hotspot/jtreg/gc/shenandoah/TestStringDedupStress.java +++ b/test/hotspot/jtreg/gc/shenandoah/TestStringDedupStress.java @@ -32,12 +32,12 @@ * @modules java.base/java.lang:open * java.management * - * @run main/othervm -Xmx1g -Xlog:gc+stats -Xlog:gc -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication + * @run main/othervm -Xmx1g -Xlog:stringdedup -Xlog:gc -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive * -XX:+ShenandoahDegeneratedGC * TestStringDedupStress * - * @run main/othervm -Xmx1g -Xlog:gc+stats -Xlog:gc -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication + * @run main/othervm -Xmx1g -Xlog:stringdedup -Xlog:gc -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive * -XX:-ShenandoahDegeneratedGC * TestStringDedupStress @@ -52,7 +52,7 @@ * @modules java.base/java.lang:open * java.management * - * @run main/othervm -Xmx1g -Xlog:gc+stats -Xlog:gc -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication + * @run main/othervm -Xmx1g -Xlog:stringdedup -Xlog:gc -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=generational * -XX:+ShenandoahDegeneratedGC * -DtargetStrings=3000000 @@ -68,23 +68,23 @@ * @modules java.base/java.lang:open * java.management * - * @run main/othervm -Xmx1g -Xlog:gc+stats -Xlog:gc -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication + * @run main/othervm -Xmx1g -Xlog:stringdedup -Xlog:gc -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication * -XX:+UseShenandoahGC * -DtargetStrings=3000000 * TestStringDedupStress * - * @run main/othervm -Xmx1g -Xlog:gc+stats -Xlog:gc -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication + * @run main/othervm -Xmx1g -Xlog:stringdedup -Xlog:gc -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive * -DtargetStrings=2000000 * TestStringDedupStress * - * @run main/othervm -Xmx1g -Xlog:gc+stats -Xlog:gc -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication + * @run main/othervm -Xmx1g -Xlog:stringdedup -Xlog:gc -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive * -XX:+ShenandoahOOMDuringEvacALot * -DtargetStrings=2000000 * TestStringDedupStress * - * @run main/othervm -Xmx1g -Xlog:gc+stats -Xlog:gc -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication + * @run main/othervm -Xmx1g -Xlog:stringdedup -Xlog:gc -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact * TestStringDedupStress */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdb/exclude/exclude001/exclude001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdb/exclude/exclude001/exclude001a.java index b1283935290..f2f09573b72 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdb/exclude/exclude001/exclude001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/exclude/exclude001/exclude001a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,8 +35,13 @@ import java.util.*; /* This is debuggee aplication */ public class exclude001a { public static void main(String args[]) { - exclude001a _exclude001a = new exclude001a(); - System.exit(exclude001.JCK_STATUS_BASE + _exclude001a.runIt(args, System.out)); + // The following will cause intialization of a bunch of classes before we + // enable MethoEntry/Exit events, which would otherwise result in long test runs. + // See JDK-8375062. Also see MyThread.run() below, which is where this came from. + String caltype = GregorianCalendar.getInstance().getCalendarType(); + + exclude001a _exclude001a = new exclude001a(); + System.exit(exclude001.JCK_STATUS_BASE + _exclude001a.runIt(args, System.out)); } static void lastBreak () {} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x004.java index 771313f4c1a..d23744e5d26 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x004.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x004.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -227,5 +227,10 @@ public class tc02x004 { display(""); brkpEventCount++; + if (brkpEventCount == tc02x004a.threadCount) { + // When done we disable the MethodEntryRequest because we don't + // want it enabled while the debuggee exits. See JDK-8375076 and JDK-8384569. + event.request().disable(); + } } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc04x001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc04x001.java index 612acbcc55a..6900653e9fb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc04x001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc04x001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -209,6 +209,14 @@ public class tc04x001 { display("\tmethod\t- " + event.location().method().name()); display("\tline\t- " + event.location().lineNumber()); + // When done() is called we disable the MethodEntryRequest because we don't + // want it enabled while the debuggee exits. See JDK-8375076 and JDK-8384569. + if (event.method().name().equals("done")) { + display("done() called - disabling MethodEntryRequest\n"); + event.request().disable(); + return; + } + if (!event.method().name().equals(methodName)) { display("the event skipped, method - " + event.method().name() + "\n"); return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc04x001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc04x001a.java index a343c6c5116..1a380132b2f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc04x001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc04x001a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,14 +29,14 @@ import nsk.share.jdi.*; // THIS TEST IS LINE NUMBER SENSITIVE /** - * tc04x001a is deugee's part of the tc04x001. + * tc04x001a is debugee's part of the tc04x001. */ public class tc04x001a { public final static int threadCount = 3; static Log log; - public final static int checkMethodBrkpLine = 73; + public final static int checkMethodBrkpLine = 74; Thread[] thrds = new Thread[threadCount]; public static void main (String argv[]) { @@ -58,6 +58,7 @@ public class tc04x001a { System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE); } } + done(); // Signal the disabling of MethodEntryRequest log.display("completed succesfully."); System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE); } @@ -77,6 +78,10 @@ public class tc04x001a { log.display(caller + "::bar is called"); } + public static void done() { + log.display("done is called"); + } + static class Thready extends NamedTask { Thready(String name) { super(name); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001.java index 022f8ceff9b..eaad7f4ffce 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001.java @@ -160,10 +160,9 @@ public class popframes001 { if (eventIterator != null) { while (eventIterator.hasNext()) { event = eventIterator.nextEvent(); -// display("\nevent ===>>> " + event); + display("\nevent ===>>> " + event); if (event instanceof ClassPrepareEvent) { - display("\nevent ===>>> " + event); testedClass = (ClassType )debugee.classByName(testedClassName); debugeeClass = (ClassType )debugee.classByName(debugeeName); @@ -179,11 +178,9 @@ public class popframes001 { debugee.resume(); } else if (event instanceof MethodExitEvent) { - display("\nevent ===>>> " + event); hitMethodExitEvent((MethodExitEvent )event); } else if (event instanceof MethodEntryEvent) { - display("\nevent ===>>> " + event); hitMethodEntryEvent((MethodEntryEvent )event); display("\nresuming..."); debugee.resume(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001a.java index 42d8f5446c6..a6cd451333a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ import nsk.share.jdi.*; import java.io.*; /** - * popframes001a is deugee's part of the popframes001. + * popframes001a is debugee's part of the popframes001. */ public class popframes001a { @@ -38,6 +38,11 @@ public class popframes001a { volatile public static boolean finishIt = false; public static void main(String argv[]) { + // The following will cause intialization of a bunch of classes before we + // enable MethodEntry/Exit events, which would otherwise result in long test runs. + // See JDK-8375076 and JDK-8384569. + System.getLogger("java.lang.Runtime"); + ArgumentHandler argHandler = new ArgumentHandler(argv); Log log = new Log(System.out, argHandler); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes003.java index 117a626752c..fb6ce0be740 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes003.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -408,6 +408,7 @@ public class popframes003 extends JDIBase { } log2("......disabling requests and resuming vm"); + meRequest.disable(); meRequest3.disable(); vm.resume(); diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index 275848d3ab9..fcde1d9c01d 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -142,7 +142,6 @@ java/awt/Focus/ToFrontFocusTest/ToFrontFocus.java 7156130 linux-all java/awt/Focus/WrongKeyTypedConsumedTest/WrongKeyTypedConsumedTest.java 8169096 macosx-all java/awt/Focus/TestDisabledAutoTransfer.java 8159871 macosx-all,windows-all java/awt/Focus/TestDisabledAutoTransferSwing.java 6962362 windows-all -java/awt/Focus/ActivateOnProperAppContextTest.java 8136516 macosx-all java/awt/Focus/FocusPolicyTest.java 7160904 linux-all java/awt/Graphics/SmallPrimitives.java 8047070 macosx-all,linux-all java/awt/EventQueue/6980209/bug6980209.java 8198615 macosx-all diff --git a/test/jdk/com/sun/jdi/ClassUnloadEventTest.java b/test/jdk/com/sun/jdi/ClassUnloadEventTest.java index 0948f2cc994..297046ee6bb 100644 --- a/test/jdk/com/sun/jdi/ClassUnloadEventTest.java +++ b/test/jdk/com/sun/jdi/ClassUnloadEventTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -202,7 +202,8 @@ public class ClassUnloadEventTest { LaunchingConnector launchingConnector = Bootstrap.virtualMachineManager().defaultConnector(); Map arguments = launchingConnector.defaultArguments(); arguments.get("main").setValue(ClassUnloadEventTest.class.getName()); - arguments.get("options").setValue("-Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xlog:class+unload=info -Xlog:gc"); + String testOpts = System.getProperty("test.vm.opts", "") + " " + System.getProperty("test.java.opts", ""); + arguments.get("options").setValue(testOpts + " -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xlog:class+unload=info -Xlog:gc"); return launchingConnector.launch(arguments); } } diff --git a/test/jdk/com/sun/jdi/JdbOptions.java b/test/jdk/com/sun/jdi/JdbOptions.java index 4a6c8550fc6..33a8a87333d 100644 --- a/test/jdk/com/sun/jdi/JdbOptions.java +++ b/test/jdk/com/sun/jdi/JdbOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022, 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 @@ * @test * @bug 8234808 * + * @requires vm.flagless * @library /test/lib * @run main/othervm JdbOptions */ diff --git a/test/jdk/com/sun/jdi/OomDebugTest.java b/test/jdk/com/sun/jdi/OomDebugTest.java index 4f824b71612..7be0047e889 100644 --- a/test/jdk/com/sun/jdi/OomDebugTest.java +++ b/test/jdk/com/sun/jdi/OomDebugTest.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2016 Red Hat Inc. + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -30,6 +31,7 @@ * @author Severin Gehwolf * * @requires vm.gc != "Z" + * @requires vm.flagless * @library .. * @run build TestScaffold VMConnection TargetListener TargetAdapter * @run compile -g OomDebugTest.java diff --git a/test/jdk/com/sun/jdi/SunBootClassPathEmptyTest.java b/test/jdk/com/sun/jdi/SunBootClassPathEmptyTest.java index b1eacad1e90..f54ed54a752 100644 --- a/test/jdk/com/sun/jdi/SunBootClassPathEmptyTest.java +++ b/test/jdk/com/sun/jdi/SunBootClassPathEmptyTest.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 @@ -61,6 +61,12 @@ public class SunBootClassPathEmptyTest { } PathSearchingVirtualMachine launchVm(String cmdLine, String options) throws Exception { + String testOpts = System.getProperty("test.vm.opts", "") + " " + System.getProperty("test.java.opts", ""); + if (options != null) { + options = testOpts + " " + options; + } else { + options = testOpts; + } Map vmArgs = lc.defaultArguments(); vmArgs.get("main").setValue(cmdLine); if (options != null) { diff --git a/test/jdk/com/sun/jdi/connect/spi/DebugUsingCustomConnector.java b/test/jdk/com/sun/jdi/connect/spi/DebugUsingCustomConnector.java index a9928bc57ee..d702e627b54 100644 --- a/test/jdk/com/sun/jdi/connect/spi/DebugUsingCustomConnector.java +++ b/test/jdk/com/sun/jdi/connect/spi/DebugUsingCustomConnector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,7 @@ * * This tests launches a debuggee using a custom LaunchingConnector. * + * @requires vm.flagless * @modules jdk.jdi/com.sun.tools.jdi * @build DebugUsingCustomConnector SimpleLaunchingConnector Foo NullTransportService * @run main/othervm DebugUsingCustomConnector diff --git a/test/jdk/java/awt/Dialog/JaWSTest.java b/test/jdk/java/awt/Dialog/JaWSTest.java index 8b7e8838258..46474ed1b79 100644 --- a/test/jdk/java/awt/Dialog/JaWSTest.java +++ b/test/jdk/java/awt/Dialog/JaWSTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,6 @@ import java.awt.event.WindowEvent; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import sun.awt.SunToolkit; -import sun.awt.AppContext; public class JaWSTest implements ActionListener, Runnable { @@ -52,7 +51,6 @@ public class JaWSTest implements ActionListener, Runnable { static volatile JaWSTest worker; static volatile Dialog dummyDialog; static final Object signalObject = new Object(); - static volatile AppContext appContextObject = null; static volatile Button button = null; static final CountDownLatch dialogFinished = new CountDownLatch(1); @@ -115,9 +113,6 @@ public class JaWSTest implements ActionListener, Runnable { e.printStackTrace(); dummyDialog.setVisible(false); } - if (appContextObject != null) { - appContextObject = null; - } dummyDialog.dispose(); } System.err.println("Show Something"); @@ -127,21 +122,17 @@ public class JaWSTest implements ActionListener, Runnable { public void run() { System.err.println("Running"); try { - appContextObject = SunToolkit.createNewAppContext(); - } finally { - try { - Thread.sleep(1000); - } catch (InterruptedException ie) { - ie.printStackTrace(); - } - System.err.println("Before Hiding 1"); - dummyDialog.setVisible(false); - System.err.println("Before Synchronized"); - synchronized (signalObject) { - System.err.println("In Synchronized"); - signalObject.notify(); - System.err.println("After Notify"); - } + Thread.sleep(1000); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + System.err.println("Before Hiding 1"); + dummyDialog.setVisible(false); + System.err.println("Before Synchronized"); + synchronized (signalObject) { + System.err.println("In Synchronized"); + signalObject.notify(); + System.err.println("After Notify"); } System.err.println("Stop Running"); } diff --git a/test/jdk/java/awt/EventQueue/MainAppContext/MainAppContext.java b/test/jdk/java/awt/EventQueue/MainAppContext/MainAppContext.java deleted file mode 100644 index 7846ba79c77..00000000000 --- a/test/jdk/java/awt/EventQueue/MainAppContext/MainAppContext.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2011, 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 8004584 - * @summary Tests 8004584 - * @author anthony.petrov@oracle.com, petr.pchelko@oracle.com - * @modules java.desktop/sun.awt - */ - -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; -import sun.awt.*; - -public class MainAppContext { - - public static void main(String[] args) { - ThreadGroup secondGroup = new ThreadGroup("test"); - new Thread(secondGroup, () -> { - SunToolkit.createNewAppContext(); - test(true); - }).start(); - - // Sleep on the main thread so that the AWT Toolkit is initialized - // in a user AppContext first - try { Thread.sleep(2000); } catch (Exception e) {} - - test(false); - } - - private static void test(boolean expectAppContext) { - boolean appContextIsCreated = AppContext.getAppContext() != null; - if (expectAppContext != appContextIsCreated) { - throw new RuntimeException("AppContext is created: " + appContextIsCreated - + " expected: " + expectAppContext); - } - } -} diff --git a/test/jdk/java/awt/EventQueue/PostEventOrderingTest/PostEventOrderingTest.java b/test/jdk/java/awt/EventQueue/PostEventOrderingTest/PostEventOrderingTest.java index 7b75001f42d..06bfdeb8a8f 100644 --- a/test/jdk/java/awt/EventQueue/PostEventOrderingTest/PostEventOrderingTest.java +++ b/test/jdk/java/awt/EventQueue/PostEventOrderingTest/PostEventOrderingTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,6 @@ import java.awt.*; import java.awt.event.*; -import sun.awt.AppContext; import sun.awt.SunToolkit; public class PostEventOrderingTest { @@ -45,11 +44,11 @@ public class PostEventOrderingTest { for (int j = 0; j < 100; j++) { q.postEvent(new PostActionEvent()); for (int k = 0; k < 10; k++) { - SunToolkit.postEvent(AppContext.getAppContext(), new PostActionEvent()); + SunToolkit.postEvent(new PostActionEvent()); } } for (int k = 0; k < 100; k++) { - SunToolkit.postEvent(AppContext.getAppContext(), new PostActionEvent()); + SunToolkit.postEvent(new PostActionEvent()); } } diff --git a/test/jdk/java/awt/EventQueue/PushPopDeadlock2/PushPopTest.java b/test/jdk/java/awt/EventQueue/PushPopDeadlock2/PushPopTest.java index f28b5ccc0f4..aecb3c7513a 100644 --- a/test/jdk/java/awt/EventQueue/PushPopDeadlock2/PushPopTest.java +++ b/test/jdk/java/awt/EventQueue/PushPopDeadlock2/PushPopTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2016, 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 @@ -66,7 +66,7 @@ public class PushPopTest { }; InvocationEvent ie = new InvocationEvent(eq2, runnable, null, false); // System.err.println(ie); - SunToolkit.postEvent(SunToolkit.targetToAppContext(frame), ie); + SunToolkit.postEvent(ie); eq1.pop(); frame.dispose(); } @@ -94,7 +94,7 @@ class MyEventQueue2 extends EventQueue { } }; InvocationEvent ie = new InvocationEvent(MyEventQueue2.this, runnable, null, false); - SunToolkit.postEvent(SunToolkit.targetToAppContext(PushPopTest.frame), ie); + SunToolkit.postEvent(ie); postEvent(ie); } }); diff --git a/test/jdk/java/awt/Focus/ActivateOnProperAppContextTest.java b/test/jdk/java/awt/Focus/ActivateOnProperAppContextTest.java deleted file mode 100644 index ab083983321..00000000000 --- a/test/jdk/java/awt/Focus/ActivateOnProperAppContextTest.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. - * 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 6385277 -* @key headful -* @summary Tests that activation happens on correct AppContext. -* @modules java.desktop/sun.awt -* @run main ActivateOnProperAppContextTest -*/ - -import sun.awt.AppContext; -import sun.awt.SunToolkit; - -import java.awt.Button; -import java.awt.Component; -import java.awt.Container; -import java.awt.Cursor; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Frame; -import java.awt.Label; -import java.awt.Point; -import java.awt.Robot; -import java.awt.Toolkit; -import java.awt.Window; -import java.awt.event.InputEvent; -import java.util.concurrent.atomic.AtomicBoolean; - -public class ActivateOnProperAppContextTest { - static Robot robot; - SunToolkit toolkit; - - ThreadGroup threadGroup = new ThreadGroup("Test_Thread_Group"); - AppContext appContext; - Frame frame; - volatile boolean passed = true; - AtomicBoolean cond = new AtomicBoolean(false); - - public static void main(String[] args) throws Exception { - ActivateOnProperAppContextTest app = new ActivateOnProperAppContextTest(); - robot = new Robot(); - app.start(); - } - - public void start() { - toolkit = (SunToolkit)Toolkit.getDefaultToolkit(); - - Runnable runnable = new Runnable() { - public void run() { - test(); - - synchronized (cond) { - cond.set(true); - cond.notifyAll(); - } - } - }; - - Thread thread = new Thread(threadGroup, runnable, "Test Thread"); - - synchronized (cond) { - - thread.start(); - - while (!cond.get()) { - try { - cond.wait(); - } catch (InterruptedException ie) { - ie.printStackTrace(); - } - } - } - - if (passed) { - System.out.println("Test passed."); - } else { - throw new TestFailedException("Test failed!"); - } - } - - void test() { - appContext = SunToolkit.createNewAppContext(); - System.out.println("Created new AppContext: " + appContext); - - frame = new Frame("ActivateOnProperAppContextTest Frame") { - public boolean isActive() { - verifyAppContext("Frame.isActive()"); - return super.isActive(); - } - public boolean isFocused() { - verifyAppContext("Frame.isFocused()"); - return super.isFocused(); - } - public boolean isFocusable() { - verifyAppContext("Frame.isFocusable()"); - return super.isFocusable(); - } - public Window getOwner() { - verifyAppContext("Frame.getOwner()"); - return super.getOwner(); - } - public boolean isEnabled() { - verifyAppContext("Frame.isEnabled()"); - return super.isEnabled(); - } - public boolean isVisible() { - verifyAppContext("Frame.isVisible()"); - return super.isVisible(); - } - public Container getParent() { - verifyAppContext("Frame.getParent()"); - return super.getParent(); - } - public Cursor getCursor() { - verifyAppContext("Frame.getCursor()"); - return super.getCursor(); - } - public Point getLocation() { - verifyAppContext("Frame.getLocation()"); - return super.getLocation(); - } - public Point getLocationOnScreen() { - verifyAppContext("Frame.getLocationOnScreen()"); - return super.getLocationOnScreen(); - } - }; - Window window = new Window(frame) { - public boolean isFocused() { - verifyAppContext("Window.isFocused()"); - return super.isFocused(); - } - public boolean isFocusable() { - verifyAppContext("Window.isFocusable()"); - return super.isFocusable(); - } - public Window getOwner() { - verifyAppContext("Window.getOwner()"); - return super.getOwner(); - } - public boolean isEnabled() { - verifyAppContext("Window.isEnabled()"); - return super.isEnabled(); - } - public boolean isVisible() { - verifyAppContext("Window.isVisible()"); - return super.isVisible(); - } - public Container getParent() { - verifyAppContext("Window.getParent()"); - return super.getParent(); - } - public Cursor getCursor() { - verifyAppContext("Window.getCursor()"); - return super.getCursor(); - } - public Point getLocation() { - verifyAppContext("Window.getLocation()"); - return super.getLocation(); - } - public Point getLocationOnScreen() { - verifyAppContext("Window.getLocationOnScreen()"); - return super.getLocationOnScreen(); - } - }; - Button button = new Button("button"); - Label label = new Label("label"); - - window.setLayout(new FlowLayout()); - window.add(button); - window.add(label); - window.setLocation(800, 0); - window.pack(); - window.setVisible(true); - - frame.setBounds(800, 100, 100, 50); - frame.setVisible(true); - - toolkit.realSync(); - - /* - * When the label is clicked in the window some of - * the owner's public method get called. - */ - clickOn(label); - } - - void verifyAppContext(String methodName) { - AppContext ac = AppContext.getAppContext(); - println(methodName + " called on AppContext: " + ac); - - if (ac != appContext) { - passed = false; - System.err.println("Test failed: " + methodName + " is called on wrong AppContext!"); - Thread.dumpStack(); - } - } - - void clickOn(Component c) { - Point p = c.getLocationOnScreen(); - Dimension d = c.getSize(); - - robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + (int)(d.getHeight()/2)); - - robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); - robot.delay(20); - robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); - - toolkit.realSync(); - } - - void println(final String msg) { - SunToolkit.executeOnEventHandlerThread(frame, new Runnable() { - public void run() { - System.out.println(msg); - } - }); - } -} - -class TestFailedException extends RuntimeException { - TestFailedException(String msg) { - super(msg); - } -} diff --git a/test/jdk/java/awt/GraphicsEnvironment/TestDetectHeadless/TestDetectHeadless.sh b/test/jdk/java/awt/GraphicsEnvironment/TestDetectHeadless/TestDetectHeadless.sh index 2e1fd42c588..010ed17382b 100644 --- a/test/jdk/java/awt/GraphicsEnvironment/TestDetectHeadless/TestDetectHeadless.sh +++ b/test/jdk/java/awt/GraphicsEnvironment/TestDetectHeadless/TestDetectHeadless.sh @@ -36,7 +36,7 @@ OS=`uname -s` case "$OS" in - Windows* | CYGWIN* | Darwin) + Windows* | CYGWIN* | MSYS* | MINGW* | Darwin) echo "Passed"; exit 0 ;; * ) unset DISPLAY ;; esac diff --git a/test/jdk/java/awt/JAWT/JAWT.sh b/test/jdk/java/awt/JAWT/JAWT.sh index f0e0118cbef..2ffe3b72a2e 100644 --- a/test/jdk/java/awt/JAWT/JAWT.sh +++ b/test/jdk/java/awt/JAWT/JAWT.sh @@ -83,7 +83,7 @@ case "$OS" in fi SYST="windows" ;; - CYGWIN* ) + CYGWIN* | MSYS* | MINGW* ) NULL=/dev/null PS=":" FS="/" diff --git a/test/jdk/java/awt/Toolkit/AutoShutdown/EventQueuePush/EventQueuePushAutoshutdown.sh b/test/jdk/java/awt/Toolkit/AutoShutdown/EventQueuePush/EventQueuePushAutoshutdown.sh index e550221c50f..e860f5786a3 100644 --- a/test/jdk/java/awt/Toolkit/AutoShutdown/EventQueuePush/EventQueuePushAutoshutdown.sh +++ b/test/jdk/java/awt/Toolkit/AutoShutdown/EventQueuePush/EventQueuePushAutoshutdown.sh @@ -60,7 +60,7 @@ pass() # The beginning of the script proper OS=`uname -s` case "$OS" in - AIX | CYGWIN* | Darwin | Linux ) + AIX | CYGWIN* | MSYS* | MINGW* | Darwin | Linux ) FILESEP="/" ;; diff --git a/test/jdk/java/awt/Toolkit/AutoShutdown/ShowExitTest/ShowExitTest.sh b/test/jdk/java/awt/Toolkit/AutoShutdown/ShowExitTest/ShowExitTest.sh index 8de5f6554d7..15d5378a676 100644 --- a/test/jdk/java/awt/Toolkit/AutoShutdown/ShowExitTest/ShowExitTest.sh +++ b/test/jdk/java/awt/Toolkit/AutoShutdown/ShowExitTest/ShowExitTest.sh @@ -87,7 +87,7 @@ case "$OS" in TMP=`cd "${SystemRoot}/Temp"; echo ${PWD}` ;; - CYGWIN* ) + CYGWIN* | MSYS* | MINGW* ) VAR="A different value for Cygwin" DEFAULT_JDK="/cygdrive/c/Program\ Files/Java/jdk1.8.0" FILESEP="/" diff --git a/test/jdk/java/awt/Toolkit/BadDisplayTest/BadDisplayTest.sh b/test/jdk/java/awt/Toolkit/BadDisplayTest/BadDisplayTest.sh index acd31541dc8..fc5cb058a14 100644 --- a/test/jdk/java/awt/Toolkit/BadDisplayTest/BadDisplayTest.sh +++ b/test/jdk/java/awt/Toolkit/BadDisplayTest/BadDisplayTest.sh @@ -23,7 +23,7 @@ ${TESTJAVA}/bin/javac -cp ${TESTSRC} -d . ${TESTSRC}/BadDisplayTest.java OS=`uname -s` case "$OS" in - Windows* | CYGWIN* | Darwin) + Windows* | CYGWIN* | MSYS* | MINGW* | Darwin) echo "Passed"; exit 0 ;; esac diff --git a/test/jdk/java/awt/Window/WindowsLeak/WindowsLeak.java b/test/jdk/java/awt/Window/WindowsLeak/WindowsLeak.java index 7dca9e9c2c2..207b3c0595b 100644 --- a/test/jdk/java/awt/Window/WindowsLeak/WindowsLeak.java +++ b/test/jdk/java/awt/Window/WindowsLeak/WindowsLeak.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,8 +27,7 @@ * @bug 8013563 8028486 * @summary Tests that windows are removed from windows list * @library /javax/swing/regtesthelpers - * @modules java.desktop/sun.awt - * java.desktop/sun.java2d + * @modules java.desktop/sun.java2d * @build Util * @run main/othervm -Xms32M -Xmx32M WindowsLeak */ @@ -39,7 +38,6 @@ import java.awt.Window; import java.lang.ref.WeakReference; import java.util.Vector; -import sun.awt.AppContext; import sun.java2d.Disposer; public class WindowsLeak { @@ -61,11 +59,10 @@ public class WindowsLeak { Util.generateOOME(); } - Vector> windowList = - (Vector>) AppContext.getAppContext().get(Window.class); + Window[] windowList = Window.getWindows(); - if (windowList != null && !windowList.isEmpty()) { - throw new RuntimeException("Test FAILED: Window list is not empty: " + windowList.size()); + if (windowList != null && (windowList.length != 0)) { + throw new RuntimeException("Test FAILED: Window list is not empty: " + windowList.length); } System.out.println("Test PASSED"); diff --git a/test/jdk/java/awt/image/MultiPixelPackedSampleModelConstructor.java b/test/jdk/java/awt/image/MultiPixelPackedSampleModelConstructor.java new file mode 100644 index 00000000000..182fc93cba0 --- /dev/null +++ b/test/jdk/java/awt/image/MultiPixelPackedSampleModelConstructor.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. + */ + +import static java.awt.image.DataBuffer.TYPE_BYTE; +import static java.awt.image.DataBuffer.TYPE_INT; +import static java.awt.image.DataBuffer.TYPE_SHORT; +import static java.awt.image.DataBuffer.TYPE_USHORT; + +import java.awt.image.MultiPixelPackedSampleModel; +import java.awt.image.RasterFormatException; + +/* + * @test + * @bug 8381007 + * @summary test MultiPixelPackedSampleModel Constructors + */ + +public class MultiPixelPackedSampleModelConstructor { + + public static void main(String[] args) { + for (Args4 a : args4) { + test4(a); + } + for (Args6 a : args6) { + test6(a); + } + + // Also verify createSubsetSampleModel ignores bands. + MultiPixelPackedSampleModel m = + new MultiPixelPackedSampleModel(TYPE_BYTE, 1, 1, 1); + int[] bands = new int[5]; + m.createSubsetSampleModel(bands); + } + + static record Args4(int dType, int w, int h, int bits, Class eType) { } + + static final Args4[] args4 = { + new Args4(TYPE_BYTE, 1, 1, -1, RasterFormatException.class), + new Args4(TYPE_BYTE, 1, 1, 0, RasterFormatException.class), + new Args4(TYPE_BYTE, 1, 1, 1, null), + new Args4(TYPE_BYTE, 1, 1, 3, RasterFormatException.class), + new Args4(TYPE_BYTE, 1, 1, 4, null), + new Args4(TYPE_BYTE, 1, 1, 16, RasterFormatException.class), + new Args4(TYPE_BYTE, -1, 1, 1, IllegalArgumentException.class), + new Args4(TYPE_SHORT, -1, 1, 1, IllegalArgumentException.class), + new Args4(TYPE_SHORT, 1, 1, 16, IllegalArgumentException.class), + new Args4(TYPE_USHORT, 1, 1, 16, null), + new Args4(TYPE_INT, 1, 1, 16, null), + new Args4(TYPE_BYTE, 1, 30, 0, RasterFormatException.class), + new Args4(TYPE_BYTE, 0, 1, 4, IllegalArgumentException.class), + new Args4(TYPE_BYTE, 1<<29, 1, 4, null), + new Args4(TYPE_BYTE, 1<<30, 1, 16, RasterFormatException.class), + new Args4(TYPE_BYTE, 32, 1, 1<<30, RasterFormatException.class), + new Args4(99, 8, 1, 1, IllegalArgumentException.class), + }; + + static record Args6(int dType, int w, int h, int bits, int stride, int bitOffset, Class eType) { } + + static final Args6[] args6 = { + new Args6(TYPE_BYTE, 1, 1, -1, 1, 0, RasterFormatException.class), + new Args6(TYPE_BYTE, 1, 1, 0, 1, 0, RasterFormatException.class), + new Args6(TYPE_BYTE, 1, 1, 1, 1, 0, null), + new Args6(TYPE_BYTE, 1, 1, 3, 1, 0, RasterFormatException.class), + new Args6(TYPE_BYTE, 1, 1, 4, 1, 0, null), + new Args6(TYPE_BYTE, 1, 1, 16, 2, 0, RasterFormatException.class), + new Args6(TYPE_BYTE, 9, 1, 1, 1, 0, RasterFormatException.class), + new Args6(TYPE_SHORT, 1, 1, 16, 2, 0, IllegalArgumentException.class), + new Args6(TYPE_USHORT, 1, 1, 16, 2, 0, null), + new Args6(TYPE_INT, 1, 1, 16, 1, 0, null), + new Args6(TYPE_BYTE, 1, 30, 0, 4, 0, RasterFormatException.class), + new Args6(TYPE_BYTE, 0, 1, 4, 1, 0, IllegalArgumentException.class), + new Args6(TYPE_BYTE, 1, 1, 2, 1, 0, null), + new Args6(TYPE_BYTE, 4, 1, 4, 1, 0, RasterFormatException.class), + new Args6(TYPE_BYTE, 1, 1, 2, 1, 1, IllegalArgumentException.class), + new Args6(TYPE_BYTE, 1, 1, 2, 1, -1, IllegalArgumentException.class), + new Args6(TYPE_BYTE, 1, 1, 1, -1, 1, IllegalArgumentException.class), + new Args6(TYPE_BYTE, -1, 1, 1, 1, 1, IllegalArgumentException.class), + new Args6(TYPE_BYTE, 1, 1, 1, 1, 1, null), + new Args6(TYPE_INT, 77777777, 2, 32, 1, 0, RasterFormatException.class), + new Args6(TYPE_BYTE, 1<<29, 1, 4, 1<<28, 0, null), + new Args6(99, 8, 1, 1, 1, 0, IllegalArgumentException.class), + }; + + static void test4(Args4 a) { + try { + new MultiPixelPackedSampleModel(a.dType, a.w, a.h, a.bits); + } catch (Exception e) { + if (a.eType == null || !(a.eType.isInstance(e))) { + throw new RuntimeException("failed for " + a + " got " + e); + } else { + return; + } + } + if (a.eType != null) { + throw new RuntimeException("No exception for " + a); + } + } + + + static void test6(Args6 a) { + try { + new MultiPixelPackedSampleModel(a.dType, a.w, a.h, a.bits, a.stride, a.bitOffset); + } catch (Exception e) { + if (a.eType == null || !(a.eType.isInstance(e))) { + throw new RuntimeException("failed for " + a + " got " + e); + } else { + return; + } + } + if (a.eType != null) { + throw new RuntimeException("No exception for " + a); + } + } +} diff --git a/src/hotspot/share/gc/shenandoah/shenandoahStringDedup.hpp b/test/jdk/java/awt/image/Raster/InterleavedRasterTest.java similarity index 53% rename from src/hotspot/share/gc/shenandoah/shenandoahStringDedup.hpp rename to test/jdk/java/awt/image/Raster/InterleavedRasterTest.java index da4b1a6f470..af9a80de8bb 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahStringDedup.hpp +++ b/test/jdk/java/awt/image/Raster/InterleavedRasterTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Red Hat, Inc. 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,19 +19,42 @@ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. - * */ -#ifndef SHARE_GC_SHENANDOAH_SHENANDOAHSTRINGDEDUP_HPP -#define SHARE_GC_SHENANDOAH_SHENANDOAHSTRINGDEDUP_HPP +/** + * @test + * @bug 8383605 + * @summary test some out of bounds parameters for createInterleavedRaster() + */ -#include "gc/shared/stringdedup/stringDedup.hpp" +import java.awt.image.DataBuffer; +import java.awt.image.Raster; -class ShenandoahStringDedup : public StringDedup { -public: - static inline bool is_string_candidate(oop obj); - static inline bool is_candidate(oop obj); - static inline bool dedup_requested(oop obj); -}; +public class InterleavedRasterTest { -#endif // SHARE_GC_SHENANDOAH_SHENANDOAHSTRINGDEDUP_HPP + public static void main(String[] args) { + + int w = 1; + int h = 1; + int b = -1; + test(w, h, b); + + w = 100_000; + h = 1; + b = 100_000; + test(w, h, b); + + w = 10_000; + h = 10_000; + b = 10_000; + test(w, h, b); + } + + static void test(int w, int h, int b) { + try { + Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, w, h, b, null); + throw new RuntimeException("No IllegalArgumentException"); + } catch (IllegalArgumentException e) { + } + } +} diff --git a/test/jdk/java/lang/instrument/BootClassPath/BootClassPathTest.sh b/test/jdk/java/lang/instrument/BootClassPath/BootClassPathTest.sh index 32306c97fbc..5765ab98966 100644 --- a/test/jdk/java/lang/instrument/BootClassPath/BootClassPathTest.sh +++ b/test/jdk/java/lang/instrument/BootClassPath/BootClassPathTest.sh @@ -66,7 +66,7 @@ echo "Creating manifest file..." OS=`uname -s` case ${OS} in - CYGWIN*) + CYGWIN* | MSYS* | MINGW*) CYGWIN="CYGWIN" ;; *) diff --git a/test/jdk/java/lang/instrument/appendToClassLoaderSearch/CommonSetup.sh b/test/jdk/java/lang/instrument/appendToClassLoaderSearch/CommonSetup.sh index 91aedeca234..f2412a92a43 100644 --- a/test/jdk/java/lang/instrument/appendToClassLoaderSearch/CommonSetup.sh +++ b/test/jdk/java/lang/instrument/appendToClassLoaderSearch/CommonSetup.sh @@ -52,7 +52,7 @@ case "$OS" in OS="Windows" FS="\\" ;; - CYGWIN*) + CYGWIN* | MSYS* | MINGW*) PS=";" OS="Windows" FS="\\" diff --git a/test/jdk/java/util/logging/TestMainAppContext.java b/test/jdk/java/util/logging/TestMainAppContext.java deleted file mode 100644 index 83c6769b02d..00000000000 --- a/test/jdk/java/util/logging/TestMainAppContext.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. - * 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.logging.Logger; -import sun.awt.AppContext; -import sun.awt.SunToolkit; - - -/** - * @test - * @bug 8026404 - * @summary checks that calling getLogger() from a Thread whose ThreadGroup is - * a child of the main root group doesn't throw an exception. - * @modules java.desktop/sun.awt - * java.logging - * @build TestMainAppContext - * @run main/othervm TestMainAppContext - * @author danielfuchs - */ -public class TestMainAppContext { - - static volatile Throwable thrown = null; - - public static void main(String... args) throws Exception { - ThreadGroup rootTG = Thread.currentThread().getThreadGroup(); - while (rootTG.getParent() != null) { - rootTG = rootTG.getParent(); - } - - ThreadGroup tg = new ThreadGroup(rootTG, "main"); - final Thread t1 = new Thread(tg, "child") { - @Override - public void run() { - try { - AppContext context = SunToolkit.createNewAppContext(); - } catch(Throwable t) { - thrown = t; - } - } - }; - t1.start(); - t1.join(); - if (thrown != null) { - throw new RuntimeException("Unexpected exception: " + thrown, thrown); - } - Thread t2 = new Thread(tg, "BugDetector") { - - @Override - public void run() { - try { - Logger.getLogger("foo").info("Done"); - } catch (Throwable x) { - thrown = x; - } - } - - }; - t2.start(); - t2.join(); - if (thrown != null) { - throw new RuntimeException("Test failed: " + thrown, thrown); - } - } - -} diff --git a/test/jdk/javax/imageio/metadata/IIOMetadataFormat/runMetadataFormatTest.sh b/test/jdk/javax/imageio/metadata/IIOMetadataFormat/runMetadataFormatTest.sh index 60b3df59acc..0d14ec822a4 100644 --- a/test/jdk/javax/imageio/metadata/IIOMetadataFormat/runMetadataFormatTest.sh +++ b/test/jdk/javax/imageio/metadata/IIOMetadataFormat/runMetadataFormatTest.sh @@ -96,7 +96,7 @@ case "$OS" in FILESEP="\\" ;; - CYGWIN* ) + CYGWIN* | MSYS* | MINGW* ) VAR="A different value for CYGWIN" DEFAULT_JDK=/none FILESEP="/" diff --git a/test/jdk/javax/imageio/metadata/IIOMetadataFormat/runMetadataFormatThreadTest.sh b/test/jdk/javax/imageio/metadata/IIOMetadataFormat/runMetadataFormatThreadTest.sh index 24ee627f614..246d5babbb8 100644 --- a/test/jdk/javax/imageio/metadata/IIOMetadataFormat/runMetadataFormatThreadTest.sh +++ b/test/jdk/javax/imageio/metadata/IIOMetadataFormat/runMetadataFormatThreadTest.sh @@ -97,7 +97,7 @@ case "$OS" in FILESEP="\\" ;; - CYGWIN* ) + CYGWIN* | MSYS* | MINGW* ) VAR="A different value for CYGWIN" DEFAULT_JDK=/none FILESEP="/" diff --git a/test/jdk/javax/imageio/plugins/external_plugin_tests/TestClassPathPlugin.sh b/test/jdk/javax/imageio/plugins/external_plugin_tests/TestClassPathPlugin.sh index 03444e96302..853cb1cc6ac 100644 --- a/test/jdk/javax/imageio/plugins/external_plugin_tests/TestClassPathPlugin.sh +++ b/test/jdk/javax/imageio/plugins/external_plugin_tests/TestClassPathPlugin.sh @@ -60,7 +60,7 @@ $JAR cf $PLUGINDIR/simp.jar -C $TESTCLASSES/tmpdir META-INF/services \ OS=`uname -s` case "$OS" in - Windows_* | CYGWIN* ) + Windows_* | CYGWIN* | MSYS* | MINGW* ) CPSEP=";" ;; * ) diff --git a/test/jdk/javax/imageio/spi/AppletContextTest/BadPluginConfigurationTest.sh b/test/jdk/javax/imageio/spi/AppletContextTest/BadPluginConfigurationTest.sh index 66c890a1cd4..9d3f78975e3 100644 --- a/test/jdk/javax/imageio/spi/AppletContextTest/BadPluginConfigurationTest.sh +++ b/test/jdk/javax/imageio/spi/AppletContextTest/BadPluginConfigurationTest.sh @@ -115,7 +115,7 @@ case "$OS" in TMP=`cd "${SystemRoot}/Temp"; echo ${PWD}` ;; - CYGWIN* ) + CYGWIN* | MSYS* | MINGW* ) FILESEP="/" PATHSEP=";" TMP="/tmp" @@ -243,7 +243,7 @@ echo case "$OS" in - CYGWIN* ) + CYGWIN* | MSYS* | MINGW* ) TEST_CODEBASE=$(cygpath -m ${PWD}) TEST_PLUGIN_JAR=$(cygpath -m ${PLUGINDST_DIR}${FILESEP}${TEST_PLUGIN}) ;; diff --git a/test/jdk/javax/imageio/stream/StreamCloserLeak/run_test.sh b/test/jdk/javax/imageio/stream/StreamCloserLeak/run_test.sh deleted file mode 100644 index 4d0391b830a..00000000000 --- a/test/jdk/javax/imageio/stream/StreamCloserLeak/run_test.sh +++ /dev/null @@ -1,224 +0,0 @@ -#!/bin/ksh -p -# -# Copyright (c) 2009, 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. -# - -# -# @test -# @bug 6788096 -# @key intermittent -# @summary Test simulates the case of multiple applets executed in -# the same VM and verifies that ImageIO shutdown hook -# StreamCloser does not cause a leak of classloaders. -# -# @modules java.desktop/sun.awt -# @build test.Main -# @build testapp.Main -# @run shell run_test.sh - -# There are several resources which need to be present before many -# shell scripts can run. Following are examples of how to check for -# many common ones. -# -# Note that the shell used is the Korn Shell, KSH -# -# Also note, it is recommended that make files NOT be used. Rather, -# put the individual commands directly into this file. That way, -# it is possible to use command line arguments and other shell tech- -# niques to find the compiler, etc on different systems. For example, -# a different path could be used depending on whether this were a -# Solaris or Win32 machine, which is more difficult (if even possible) -# in a make file. - - -# Beginning of subroutines: -status=1 - -#Call this from anywhere to fail the test with an error message -# usage: fail "reason why the test failed" -fail() - { echo "The test failed :-(" - echo "$*" 1>&2 - echo "exit status was $status" - exit $status - } #end of fail() - -#Call this from anywhere to pass the test with a message -# usage: pass "reason why the test passed if applicable" -pass() - { echo "The test passed!!!" - echo "$*" 1>&2 - exit 0 - } #end of pass() - -# end of subroutines - - -# The beginning of the script proper - -# Checking for proper OS -OS=`uname -s` -case "$OS" in - Linux ) - VAR="A different value for Linux" - DEFAULT_JDK=/ - FILESEP="/" - PATHSEP=":" - TMP="/tmp" - ;; - - AIX ) - VAR="A different value for AIX" - DEFAULT_JDK=/ - FILESEP="/" - PATHSEP=":" - TMP="/tmp" - ;; - - Darwin ) - VAR="A different value for MacOSX" - DEFAULT_JDK=/usr - FILESEP="/" - PATHSEP=":" - TMP="/tmp" - ;; - - Windows* ) - VAR="A different value for Win32" - DEFAULT_JDK="C:/Program Files/Java/jdk1.8.0" - FILESEP="\\" - PATHSEP=";" - TMP=`cd "${SystemRoot}/Temp"; echo ${PWD}` - ;; - - CYGWIN* ) - VAR="A different value for Cygwin" - DEFAULT_JDK="/cygdrive/c/Program\ Files/Java/jdk1.8.0" - FILESEP="/" - PATHSEP=";" - TMP=`cd "${SystemRoot}/Temp"; echo ${PWD}` - ;; - - # catch all other OSs - * ) - echo "Unrecognized system! $OS" - fail "Unrecognized system! $OS" - ;; -esac - -# Want this test to run standalone as well as in the harness, so do the -# following to copy the test's directory into the harness's scratch directory -# and set all appropriate variables: - -if [ -z "${TESTJAVA}" ] ; then - # TESTJAVA is not set, so the test is running stand-alone. - # TESTJAVA holds the path to the root directory of the build of the JDK - # to be tested. That is, any java files run explicitly in this shell - # should use TESTJAVA in the path to the java interpreter. - # So, we'll set this to the JDK spec'd on the command line. If none - # is given on the command line, tell the user that and use a cheesy - # default. - # THIS IS THE JDK BEING TESTED. - if [ -n "$1" ] ; - then TESTJAVA=$1 - else echo "no JDK specified on command line so using default!" - TESTJAVA=$DEFAULT_JDK - fi - TESTSRC=. - TESTCLASSES=. - STANDALONE=1; -fi -echo "JDK under test is: $TESTJAVA" - - -############### YOUR TEST CODE HERE!!!!!!! ############# - -#All files required for the test should be in the same directory with -# this file. If converting a standalone test to run with the harness, -# as long as all files are in the same directory and it returns 0 for -# pass, you should be able to cut and paste it into here and it will -# run with the test harness. - -# This is an example of running something -- test -# The stuff below catches the exit status of test then passes or fails -# this shell test as appropriate ( 0 status is considered a pass here ) - -echo "Create TestApp.jar..." - -if [ -f TestApp.jar ] ; then - rm -f TestApp.jar -fi - -${TESTJAVA}/bin/jar -cvf TestApp.jar -C ${TESTCLASSES} testapp - -if [ $? -ne "0" ] ; then - fail "Failed to create TestApp.jar" -fi - -echo "Create Test.jar..." -if [ -f Test.jar ] ; then - rm -f Test.jar -fi - -${TESTJAVA}/bin/jar -cvf Test.jar -C ${TESTCLASSES} test - -if [ $? -ne 0 ] ; then - fail "Failed to create Test.jar" -fi - -# Prepare temp dir for cahce files -mkdir ./tmp -if [ $? -ne 0 ] ; then - fail "Unable to create temp directory." -fi - -# Verify that all classloaders are destroyed -${TESTJAVA}/bin/java --add-exports java.desktop/sun.awt=ALL-UNNAMED ${TESTVMOPTS} -cp Test.jar test.Main -if [ $? -ne 0 ] ; then - fail "Test FAILED: some classloaders weren't destroyed." -fi - - -# Verify that ImageIO shutdown hook works correcly -${TESTJAVA}/bin/java --add-exports java.desktop/sun.awt=ALL-UNNAMED ${TESTVMOPTS} \ - -cp Test.jar -DforgetSomeStreams=true test.Main -if [ $? -ne 0 ] ; then - fail "Test FAILED: some classloaders weren't destroyed of shutdown hook failed." -fi - -# sanity check: verify that all cache files were deleted -cache_files=`ls tmp` - -if [ "x${cache_files}" != "x" ] ; then - echo "WARNING: some cache files was not deleted: ${cache_files}" -fi - -echo "Test done." - -status=$? - -if [ $status -eq "0" ] ; then - pass "" -else - fail "Test failed due to test plugin was not found." -fi - diff --git a/test/jdk/javax/imageio/stream/StreamCloserLeak/test/Main.java b/test/jdk/javax/imageio/stream/StreamCloserLeak/test/Main.java deleted file mode 100644 index 8ffe8dcad3e..00000000000 --- a/test/jdk/javax/imageio/stream/StreamCloserLeak/test/Main.java +++ /dev/null @@ -1,284 +0,0 @@ -/* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. - * 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 test; - -import java.io.File; -import java.io.IOException; -import java.lang.ref.Reference; -import java.lang.ref.ReferenceQueue; -import java.lang.ref.WeakReference; -import java.lang.reflect.Constructor; -import java.lang.reflect.Method; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.HashMap; -import java.util.Map.Entry; -import java.util.Set; -import java.util.WeakHashMap; -import java.util.concurrent.ConcurrentLinkedQueue; -import java.util.concurrent.CountDownLatch; -import javax.imageio.stream.ImageInputStream; -import sun.awt.AppContext; -import sun.awt.SunToolkit; - -public class Main { - - private static ThreadGroup appsThreadGroup; - - private static WeakHashMap refs = - new WeakHashMap(); - - /** Collection to simulate forgrotten streams **/ - private static HashMap strongRefs = - new HashMap(); - - private static ConcurrentLinkedQueue problems = - new ConcurrentLinkedQueue(); - - private static AppContext mainAppContext = null; - - private static CountDownLatch doneSignal; - - private static final int gcTimeout = - Integer.getInteger("gcTimeout", 10).intValue(); - - private static boolean forgetSomeStreams = - Boolean.getBoolean("forgetSomeStreams"); - - public static void main(String[] args) throws IOException { - mainAppContext = SunToolkit.createNewAppContext(); - System.out.println("Current context class loader: " + - Thread.currentThread().getContextClassLoader()); - - appsThreadGroup = new ThreadGroup("MyAppsThreadGroup"); - - File jar = new File("TestApp.jar"); - if (!jar.exists()) { - System.out.println(jar.getAbsolutePath() + " was not found!\n" + - "Please install the jar with test application correctly!"); - throw new RuntimeException("Test failed: no TestApp.jar"); - } - - URL[] urls = new URL[]{jar.toURL()}; - - int numApps = Integer.getInteger("numApps", 20).intValue(); - - doneSignal = new CountDownLatch(numApps); - int cnt = 0; - while (cnt++ < numApps) { - launch(urls, "testapp.Main", "launch"); - - checkErrors(); - } - - System.out.println("Wait for apps completion...."); - - try { - doneSignal.await(); - } catch (InterruptedException e) { - } - - System.out.println("All apps finished."); - - System.gc(); - - System.out.flush(); - - System.out.println("Enumerate strong refs:"); - for (String is : strongRefs.keySet()) { - System.out.println("-> " + is); - } - - System.out.println("======================="); - - // wait few seconds - waitAndGC(gcTimeout); - - doneSignal = new CountDownLatch(1); - - Runnable workaround = new Runnable() { - - public void run() { - AppContext ctx = null; - try { - ctx = SunToolkit.createNewAppContext(); - } catch (Throwable e) { - // ignore... - } finally { - doneSignal.countDown(); - } - } - }; - - Thread wt = new Thread(appsThreadGroup, workaround, "Workaround"); - wt.setContextClassLoader(new MyClassLoader(urls, "workaround")); - wt.start(); - wt = null; - workaround = null; - - System.out.println("Wait for workaround completion..."); - - try { - doneSignal.await(); - } catch (InterruptedException e) { - } - - // give a chance to GC - waitAndGC(gcTimeout); - - if (!refs.isEmpty()) { - System.out.println("Classloaders still alive:"); - - for (MyClassLoader l : refs.keySet()) { - String val = refs.get(l); - - if (val == null) { - throw new RuntimeException("Test FAILED: Invalid classloader name"); - } - System.out.println("->" + val + (strongRefs.get(val) != null ? - " (has strong ref)" : "")); - if (strongRefs.get(val) == null) { - throw new RuntimeException("Test FAILED: exta class loader is detected! "); - } - } - } else { - System.out.println("No alive class loaders!!"); - } - System.out.println("Test PASSED."); - } - - private static void waitAndGC(int sec) { - int cnt = sec; - System.out.print("Wait "); - while (cnt-- > 0) { - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - } - // do GC every 3 seconds - if (cnt % 3 == 2) { - System.gc(); - System.out.print("+"); - } else { - System.out.print("."); - } - checkErrors(); - } - System.out.println(""); - } - - private static void checkErrors() { - while (!problems.isEmpty()) { - Throwable theProblem = problems.poll(); - System.out.println("Test FAILED!"); - do { - theProblem.printStackTrace(System.out); - theProblem = theProblem.getCause(); - } while (theProblem != null); - throw new RuntimeException("Test FAILED"); - } - } - static int counter = 0; - - private static void launch(URL[] urls, final String className, - final String methodName) - { - final String uniqClassName = "testapp/Uniq" + counter; - final boolean saveStrongRef = forgetSomeStreams ? (counter % 5 == 4) : false; - - System.out.printf("%s: launch the app\n", uniqClassName); - Runnable launchIt = new Runnable() { - public void run() { - AppContext ctx = SunToolkit.createNewAppContext(); - - try { - Class appMain = - ctx.getContextClassLoader().loadClass(className); - Method launch = appMain.getDeclaredMethod(methodName, - strongRefs.getClass()); - - Constructor c = appMain.getConstructor(String.class, - problems.getClass()); - - Object o = c.newInstance(uniqClassName, problems); - - if (saveStrongRef) { - System.out.printf("%s: force strong ref\n", - uniqClassName); - launch.invoke(o, strongRefs); - } else { - HashMap empty = null; - launch.invoke(o, empty); - } - - ctx = null; - } catch (Throwable e) { - problems.add(e); - } finally { - doneSignal.countDown(); - } - } - }; - - MyClassLoader appClassLoader = new MyClassLoader(urls, uniqClassName); - - refs.put(appClassLoader, uniqClassName); - - Thread appThread = new Thread(appsThreadGroup, launchIt, - "AppThread" + counter++); - appThread.setContextClassLoader(appClassLoader); - - appThread.start(); - launchIt = null; - appThread = null; - appClassLoader = null; - } - - private static class MyClassLoader extends URLClassLoader { - - private static boolean verbose = - Boolean.getBoolean("verboseClassLoading"); - private String uniqClassName; - - public MyClassLoader(URL[] urls, String uniq) { - super(urls); - - uniqClassName = uniq; - } - - public Class loadClass(String name) throws ClassNotFoundException { - if (verbose) { - System.out.printf("%s: load class %s\n", uniqClassName, name); - } - if (uniqClassName.equals(name)) { - return Object.class; - } - return super.loadClass(name); - } - - public String toString() { - return "MyClassLoader(" + uniqClassName + ")"; - } - } -} diff --git a/test/jdk/javax/imageio/stream/StreamCloserLeak/testapp/Main.java b/test/jdk/javax/imageio/stream/StreamCloserLeak/testapp/Main.java deleted file mode 100644 index 18e481d6ecd..00000000000 --- a/test/jdk/javax/imageio/stream/StreamCloserLeak/testapp/Main.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. - * 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 testapp; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.concurrent.ConcurrentLinkedQueue; -import javax.imageio.stream.FileCacheImageInputStream; -import javax.imageio.stream.ImageInputStream; - -public class Main { - - public static void main(String[] args) { - Main o = new Main("testapp.some.class", null); - o.launch(null); - } - - private final String uniqClassName; - private final ConcurrentLinkedQueue problems; - - public Main(String uniq, ConcurrentLinkedQueue p) { - uniqClassName = uniq; - problems = p; - } - - public void launch(HashMap refs) { - System.out.printf("%s: current context class loader: %s\n", - uniqClassName, - Thread.currentThread().getContextClassLoader()); - try { - byte[] data = new byte[1024]; - ByteArrayInputStream bais = new ByteArrayInputStream(data); - MyImageInputStream iis = new MyImageInputStream(bais, - uniqClassName, - problems); - if (refs != null) { - System.out.printf("%s: added to strong store\n", - uniqClassName); - refs.put(uniqClassName, iis); - } - iis.read(); - //leave stream open : let's shutdown hook work! - } catch (IOException e) { - problems.add(e); - } - } - - private static class MyImageInputStream extends FileCacheImageInputStream { - private final String uniqClassName; - private ConcurrentLinkedQueue problems; - public MyImageInputStream(InputStream is, String uniq, - ConcurrentLinkedQueue p) throws IOException - { - super(is, new File("tmp")); - uniqClassName = uniq; - problems = p; - } - - @Override - public void close() throws IOException { - Test t = new Test(); - try { - t.doTest(uniqClassName); - } catch (Throwable e) { - problems.add(e); - } - - super.close(); - - problems = null; - } - } -} - -class Test { - public void doTest(String uniqClassName) throws ClassNotFoundException { - System.out.printf("%s: Current thread: %s\n", uniqClassName, - Thread.currentThread()); - - ClassLoader thisCL = this.getClass().getClassLoader(); - Class uniq = thisCL.loadClass(uniqClassName); - - System.out.printf("%s: test is done!\n",uniqClassName); - } -} diff --git a/test/jdk/javax/script/CommonSetup.sh b/test/jdk/javax/script/CommonSetup.sh index a03b767bc6d..4b59f9cbbc7 100644 --- a/test/jdk/javax/script/CommonSetup.sh +++ b/test/jdk/javax/script/CommonSetup.sh @@ -45,7 +45,7 @@ case "$OS" in OS="Windows" FS="\\" ;; - CYGWIN* ) + CYGWIN* | MSYS* | MINGW* ) PS=";" OS="Windows" FS="\\" diff --git a/test/jdk/javax/swing/JLabel/7004134/bug7004134.java b/test/jdk/javax/swing/JLabel/7004134/bug7004134.java index 7190dc9e010..2aaa5df7036 100644 --- a/test/jdk/javax/swing/JLabel/7004134/bug7004134.java +++ b/test/jdk/javax/swing/JLabel/7004134/bug7004134.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2026, Oracle and/or its affiliates. All rights reserved. * 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 @@ * @bug 7004134 * @summary JLabel containing a ToolTipText does no longer show ToolTip after browser refresh * @author Pavel Porvatov - * @modules java.desktop/sun.awt * @modules java.desktop/javax.swing:open */ -import sun.awt.SunToolkit; - import javax.swing.*; import java.awt.*; import java.awt.event.MouseEvent; @@ -45,7 +42,12 @@ public class bug7004134 { private static volatile int toolTipWidth; + private static Robot robot; + public static void main(String[] args) throws Exception { + + robot = new Robot(); + SwingUtilities.invokeAndWait(new Runnable() { public void run() { label = new JLabel("A JLabel used as object for an HTML-formatted tooltip"); @@ -59,7 +61,7 @@ public class bug7004134 { } }); - ((SunToolkit) SunToolkit.getDefaultToolkit()).realSync(); + robot.waitForIdle(); SwingUtilities.invokeAndWait(new Runnable() { public void run() { @@ -82,7 +84,6 @@ public class bug7004134 { Thread thread = new Thread(new ThreadGroup("Some ThreadGroup"), new Runnable() { public void run() { - SunToolkit.createNewAppContext(); try { SwingUtilities.invokeAndWait(new Runnable() { @@ -96,7 +97,7 @@ public class bug7004134 { } }); - ((SunToolkit) SunToolkit.getDefaultToolkit()).realSync(); + robot.waitForIdle(); SwingUtilities.invokeAndWait(new Runnable() { public void run() { diff --git a/test/jdk/javax/swing/plaf/basic/BasicSplitPaneUI/Test6657026.java b/test/jdk/javax/swing/plaf/basic/BasicSplitPaneUI/Test6657026.java index e14dfb0ed1f..53e7a04c335 100644 --- a/test/jdk/javax/swing/plaf/basic/BasicSplitPaneUI/Test6657026.java +++ b/test/jdk/javax/swing/plaf/basic/BasicSplitPaneUI/Test6657026.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2017, 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 @@ -29,8 +29,6 @@ * @modules java.desktop/sun.awt */ -import sun.awt.SunToolkit; - import java.awt.event.ActionEvent; import java.util.Set; import javax.swing.JSplitPane; @@ -60,7 +58,6 @@ public class Test6657026 extends BasicSplitPaneUI implements Runnable { } public void run() { - SunToolkit.createNewAppContext(); if (new JSplitPane().getFocusTraversalKeys(0).isEmpty()) { throw new Error("shared traversal keys"); } diff --git a/test/jdk/javax/swing/plaf/metal/OceanTheme/4969419/bug4969419.java b/test/jdk/javax/swing/plaf/metal/OceanTheme/4969419/bug4969419.java deleted file mode 100644 index 023f17f4c43..00000000000 --- a/test/jdk/javax/swing/plaf/metal/OceanTheme/4969419/bug4969419.java +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright (c) 2004, 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 4969419 - * @summary Tests that generated disabled icons have same look with Ocean - * and are updated when theme is switched - * @modules java.desktop/sun.awt - * @library /java/awt/regtesthelpers - * @build PassFailJFrame - * @key headful - * @run main/manual bug4969419 - */ - -import java.awt.Color; -import java.awt.Component; -import java.awt.Container; -import java.awt.FlowLayout; - -import javax.swing.BoxLayout; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JTabbedPane; -import javax.swing.JToggleButton; -import javax.swing.LookAndFeel; -import javax.swing.SwingConstants; -import javax.swing.SwingUtilities; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.plaf.metal.DefaultMetalTheme; -import javax.swing.plaf.metal.MetalLookAndFeel; -import javax.swing.plaf.metal.MetalTheme; - -import sun.awt.AppContext; - -public class bug4969419 { - static final String INSTRUCTIONS = """ - When the test starts you'll see several components with icons. - Use the bottom combo box and the "Set" button to switch between - the Ocean theme and DefaultMetalTheme. - - 1. Set the Ocean theme. Ensure all the icons are the same - Note that they all are of the same brightness: none of them - can be brighter or darker than the others. - - 2. Switch to DefaultMetalTheme. Ensure all the icons changed - (became slightly darker). - - 3. Switch back to Ocean. Ensure all the icons changed - (became brighter). - """; - - public static void main(String[] args) throws Exception { - UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); - PassFailJFrame.builder() - .title("bug4969419 Test Instructions") - .instructions(INSTRUCTIONS) - .columns(40) - .testUI(bug4969419::createUI) - .build() - .awaitAndCheck(); - } - - static JFrame createUI() { - JFrame frame = new JFrame("Metal Themes Icon Test"); - Container pane = frame.getContentPane(); - - LFSwitch lfswitch = new LFSwitch(pane); - if (!lfswitch.obtainOceanTheme()) { - throw new RuntimeException("No Ocean theme available"); - } - - pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS)); - - String prefix = System.getProperty("test.src", - System.getProperty("user.dir")) + System.getProperty("file.separator"); - ImageIcon icon = new ImageIcon(prefix + "duke.gif"); - - JPanel panel = new JPanel(); - JButton b = new JButton(icon); - b.setEnabled(false); - - JLabel label = new JLabel(icon, SwingConstants.LEFT); - label.setEnabled(false); - - JTabbedPane tp = new JTabbedPane(); - tp.addTab("", icon, new JPanel()); - tp.addTab("", icon, new JPanel()); - tp.setEnabledAt(0, false); - tp.setEnabledAt(1, false); - - JButton sb = new JButton(icon); - sb.setSelectedIcon(icon); - sb.setSelected(true); - sb.setEnabled(false); - - JToggleButton tb = new JToggleButton(icon); - tb.setEnabled(false); - - JToggleButton stb = new JToggleButton(icon); - stb.setSelectedIcon(icon); - stb.setSelected(true); - stb.setEnabled(false); - - pane.setBackground(Color.white); - panel.setBackground(Color.white); - b.setBackground(Color.white); - label.setBackground(Color.white); - tp.setBackground(Color.white); - sb.setBackground(Color.white); - tb.setBackground(Color.white); - stb.setBackground(Color.white); - - panel.add(b); - panel.add(label); - panel.add(tp); - panel.add(sb); - panel.add(tb); - panel.add(stb); - - pane.add(panel); - pane.add(lfswitch); - frame.setSize(400, 400); - return frame; - } - - static class LFSwitch extends JPanel { - private Component target; - static MetalTheme oceanTheme; - JComboBox lfcombo; - - public LFSwitch(Component target) { - this.target = target; - setLayout(new FlowLayout()); - lfcombo = new JComboBox(lookAndFeels); - add(lfcombo); - JButton setLfBut = new JButton("Set"); - add(setLfBut); - setLfBut.addActionListener(e -> setLf(lfcombo.getSelectedIndex(), - LFSwitch.this.target)); - } - - boolean obtainOceanTheme() { - if (oceanTheme != null) { - return true; - } - try { - UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); - SwingUtilities.updateComponentTreeUI(this); - } catch (Exception e) { - JOptionPane.showMessageDialog(this, - "Unexpected error: couldn't set Metal", "Error", - JOptionPane.ERROR_MESSAGE); - return false; - } - MetalTheme theme = (MetalTheme) AppContext.getAppContext(). - get("currentMetalTheme"); - if (theme == null || theme.getName() != "Ocean") { - JOptionPane.showMessageDialog(this, - "The Ocean theme is not the default Metal theme,\n" + - "but this test requires it to be default.\n" + - "Therefore simply click PASS"); - return false; - } - oceanTheme = theme; - return true; - } - - void setLf(int idx, final Component root) { - try { - UIManager.setLookAndFeel((LookAndFeel) lfs[idx]); - if (root != null) { - SwingUtilities.updateComponentTreeUI(root); - } - } catch (UnsupportedLookAndFeelException e) { - JOptionPane.showMessageDialog(root, - "The selected look and feel is unsupported on this platform", - "Error", JOptionPane.ERROR_MESSAGE); - } catch (Exception exc) { - JOptionPane.showMessageDialog(root, - "Error setting the selected look and feel", "Error", - JOptionPane.ERROR_MESSAGE); - } - } - - static Object[] lookAndFeels = { - "Metal (Ocean)", "Metal (DefaultMetalTheme)", - }; - static Object[] lfs = { - new MetalLookAndFeel() { - protected void createDefaultTheme() { - setCurrentTheme(oceanTheme); - } - }, - new MetalLookAndFeel() { - protected void createDefaultTheme() { - MetalTheme dt = new DefaultMetalTheme(); - setCurrentTheme(dt); - } - }, - }; - } -} diff --git a/test/jdk/javax/swing/text/html/parser/Parser/6990651/bug6990651.java b/test/jdk/javax/swing/text/html/parser/Parser/6990651/bug6990651.java index 0f8e3358eb6..91abdd32f3c 100644 --- a/test/jdk/javax/swing/text/html/parser/Parser/6990651/bug6990651.java +++ b/test/jdk/javax/swing/text/html/parser/Parser/6990651/bug6990651.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,7 @@ @bug 6990651 @summary Regression: NPE when refreshing embedded window since 6u22-b01 @author Pavel Porvatov - @modules java.desktop/sun.awt */ -import sun.awt.SunToolkit; import javax.swing.*; @@ -43,7 +41,6 @@ public class bug6990651 { Thread thread = new Thread(new ThreadGroup("Some ThreadGroup"), new Runnable() { public void run() { - SunToolkit.createNewAppContext(); try { SwingUtilities.invokeAndWait(new Runnable() { diff --git a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/CAInterop.java b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/CAInterop.java index 4ce58368002..15fcb2fb04f 100644 --- a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/CAInterop.java +++ b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/CAInterop.java @@ -290,9 +290,8 @@ * @summary Interoperability tests with Microsoft TLS root CAs * @library /test/lib * @build jtreg.SkippedException ValidatePathWithURL CAInterop - * @run main/othervm/manual -Djava.security.debug=certpath,ocsp CAInterop microsoftrsa2017 OCSP - * @run main/othervm/manual -Djava.security.debug=certpath,ocsp -Dcom.sun.security.ocsp.useget=false CAInterop microsoftrsa2017 OCSP - * @run main/othervm/manual -Djava.security.debug=certpath CAInterop microsoftrsa2017 CRL + * @run main/othervm/manual -Djava.security.debug=certpath,ocsp CAInterop microsoftrsa2017 DEFAULT + * @run main/othervm/manual -Djava.security.debug=certpath,ocsp -Dcom.sun.security.ocsp.useget=false CAInterop microsoftrsa2017 DEFAULT */ /* @@ -607,8 +606,8 @@ public class CAInterop { new CATestURLs("https://valid.business.ca22.ssl.buypass.no", "https://revoked.business.ca22.ssl.buypass.no"); case "buypassclass3ca" -> - new CATestURLs("https://valid.qcevident.ca23.ssl.buypass.no", - "https://revoked.qcevident.ca23.ssl.buypass.no"); + new CATestURLs("https://valid.evident.ca23.ssl.buypass.no", + "https://revoked.evident.ca23.ssl.buypass.no"); case "comodorsaca" -> new CATestURLs("https://comodorsacertificationauthority-ev.comodoca.com", diff --git a/test/jdk/sun/awt/AppContext/MultiThread/MultiThreadTest.java b/test/jdk/sun/awt/AppContext/MultiThread/MultiThreadTest.java deleted file mode 100644 index c4812ea39ba..00000000000 --- a/test/jdk/sun/awt/AppContext/MultiThread/MultiThreadTest.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 8019623 - * @summary Tests that AppContext.getAppContext() works correctly in multi-threads scenario. - * @author Leonid Romanov - * @modules java.desktop/sun.awt - */ - -import sun.awt.AppContext; - -public class MultiThreadTest { - private static final int NUM_THREADS = 2; - - private static AppContextGetter[] getters = new AppContextGetter[NUM_THREADS]; - - public static void main(String[] args) { - createAndStartThreads(); - compareAppContexts(); - } - - private static void createAndStartThreads() { - ThreadGroup systemGroup = getSystemThreadGroup(); - for (int i = 0; i < NUM_THREADS; ++i) { - ThreadGroup tg = new ThreadGroup(systemGroup, "AppContextGetter" + i); - getters[i] = new AppContextGetter(tg); - } - - for (int i = 0; i < NUM_THREADS; ++i) { - getters[i].start(); - } - - for (int i = 0; i < NUM_THREADS; ++i) { - try { - getters[i].join(); - } catch (InterruptedException e) { - // ignore - } - } - } - - private static ThreadGroup getSystemThreadGroup() { - ThreadGroup currentThreadGroup = - Thread.currentThread().getThreadGroup(); - ThreadGroup parentThreadGroup = currentThreadGroup.getParent(); - while (parentThreadGroup != null) { - currentThreadGroup = parentThreadGroup; - parentThreadGroup = currentThreadGroup.getParent(); - } - - return currentThreadGroup; - } - - private static void compareAppContexts() { - AppContext ctx = getters[0].getAppContext(); - for (int i = 1; i < NUM_THREADS; ++i) { - if (!ctx.equals(getters[i].getAppContext())) { - throw new RuntimeException("Unexpected AppContexts difference, could be a race condition"); - } - } - } - - private static class AppContextGetter extends Thread { - private AppContext appContext; - - public AppContextGetter(ThreadGroup tg) { - super(tg, tg.getName()); - } - - AppContext getAppContext() { - return appContext; - } - - @Override - public void run() { - appContext = AppContext.getAppContext(); - } - } -} diff --git a/test/jdk/sun/awt/font/ClassLoaderLeakTest.java b/test/jdk/sun/awt/font/ClassLoaderLeakTest.java index 319639f81b3..766ef2f97f0 100644 --- a/test/jdk/sun/awt/font/ClassLoaderLeakTest.java +++ b/test/jdk/sun/awt/font/ClassLoaderLeakTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,7 @@ * @run main/othervm ClassLoaderLeakTest FontManagerTest */ +import java.awt.Toolkit; import java.awt.Font; import java.awt.Graphics; import java.io.File; @@ -48,6 +49,7 @@ public class ClassLoaderLeakTest { private static Throwable launchFailure = null; public static void main(String[] args) { + Toolkit.getDefaultToolkit().getSystemEventQueue(); // load EQ in initial TG doneSignal = new CountDownLatch(1); launchSignal = new CountDownLatch(1); diff --git a/test/jdk/sun/jvmstat/testlibrary/utils.sh b/test/jdk/sun/jvmstat/testlibrary/utils.sh index a08ae37a99d..c0ceac45999 100644 --- a/test/jdk/sun/jvmstat/testlibrary/utils.sh +++ b/test/jdk/sun/jvmstat/testlibrary/utils.sh @@ -40,7 +40,7 @@ setup() { OS=`uname -s` case ${OS} in - Windows_* | CYGWIN*) + Windows_* | CYGWIN* | MSYS* | MINGW*) PS=";" FS="\\" ;; @@ -54,7 +54,7 @@ setup() { verify_os() { OS=`uname -s` case ${OS} in - Windows_95 | Windows_98 | Windows_ME | CYGWIN* ) + Windows_95 | Windows_98 | Windows_ME | CYGWIN* | MSYS* | MINGW* ) echo "Test bypassed: jvmstat feature not supported on ${OS}" exit 0 ;; diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageCommand.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageCommand.java index f73f8fe6077..733a087fe68 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageCommand.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageCommand.java @@ -48,6 +48,7 @@ import java.util.HashMap; import java.util.List; import java.util.ListIterator; import java.util.Map; +import java.util.NoSuchElementException; import java.util.Objects; import java.util.Optional; import java.util.OptionalInt; @@ -2012,9 +2013,65 @@ public class JPackageCommand extends CommandArguments { } } + addNoOpDMGScriptIfNeeded(); + return this; } + private void addNoOpDMGScriptIfNeeded() { + if (!checkIfNoOpDMGScriptIsNeeded()) { + return; + } + + Path resourceDir = getArgumentValue("--resource-dir", () -> null, Path::of); + if (resourceDir == null) { + resourceDir = TKit.createTempDirectory("resources-dir-noop-dmg-script") + .toAbsolutePath(); + setArgumentValue("--resource-dir", resourceDir); + } else if (!Files.isDirectory(resourceDir)) { + // If we have invalid resource dir, just keep it in case if test + // wants it. + return; + } + + final String baseName; + try { + baseName = installerName(); + } catch (RuntimeException _) { + return; + } + + final String scriptName = baseName + "-dmg-setup.scpt"; + if (Files.exists(resourceDir.resolve(scriptName))) { + // We already have script provided. Do not overwrite it. + return; + } + + // Create no-op DMG script + try { + Files.writeString(resourceDir.resolve(scriptName), "return\n", + StandardCharsets.UTF_8); + } catch (IOException ex) { + throw new UncheckedIOException(ex); + } + } + + private boolean checkIfNoOpDMGScriptIsNeeded() { + if (!TKit.isOSX()) { + return false; + } + + if (!hasArgument("--type")) { + return false; + } + + if (packageType() != PackageType.MAC_DMG) { + return false; + } + + return !ENABLE_DEFAULT_DMG_OSASCRIPT; + } + public String getPrintableCommandLine() { return createExecutor().getPrintableCommandLine(); } @@ -2294,6 +2351,10 @@ public class JPackageCommand extends CommandArguments { public static final String DEFAULT_VERSION = "1.0"; + private final static boolean ENABLE_DEFAULT_DMG_OSASCRIPT = TKit.getConfigBooleanProperty("enable-default-dmg-osascript").orElseGet(() -> { + return TKit.getConfigBooleanProperty("SQETest").orElse(false); + }); + // [HH:mm:ss.SSS] private static final Pattern TIMESTAMP_REGEXP = Pattern.compile( "^\\[\\d\\d:\\d\\d:\\d\\d.\\d\\d\\d\\] "); diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java index b587198bc1d..96226764b88 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java @@ -1244,6 +1244,21 @@ public final class TKit { return System.getProperty(getConfigPropertyName(propertyName)); } + static Optional getConfigBooleanProperty(String propertyName) { + return Optional.ofNullable(getConfigProperty(propertyName)) + .map(v -> { + if (v.equalsIgnoreCase("true")) { + return true; + } else if (v.equalsIgnoreCase("false")) { + return false; + } else { + throw new IllegalArgumentException(String.format( + "Invalid value of property %s: %s. Expected: true or false", + getConfigPropertyName(propertyName), v)); + } + }); + } + static String getConfigPropertyName(String propertyName) { return "jpackage.test." + propertyName; } diff --git a/test/jdk/tools/jpackage/run_tests.sh b/test/jdk/tools/jpackage/run_tests.sh index 4c72d4a2030..9d2a5d92e9b 100644 --- a/test/jdk/tools/jpackage/run_tests.sh +++ b/test/jdk/tools/jpackage/run_tests.sh @@ -251,7 +251,7 @@ if [ -n "$logfile" ]; then fi if [ -z "$run_all_tests" ]; then - jtreg_args+=(-Djpackage.test.SQETest=yes) + jtreg_args+=(-Djpackage.test.SQETest=true) fi if [ -n "$APPDATA" ]; then diff --git a/test/jdk/tools/launcher/MultipleJRE.sh b/test/jdk/tools/launcher/MultipleJRE.sh index fabfbca1d9c..ea6b29f7279 100644 --- a/test/jdk/tools/launcher/MultipleJRE.sh +++ b/test/jdk/tools/launcher/MultipleJRE.sh @@ -63,7 +63,7 @@ OS=`uname -s`; # IsWindows() { case "$OS" in - Windows* | CYGWIN* ) + Windows* | CYGWIN* | MSYS* | MINGW* ) printf "true" ;; * ) diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/TypeAnnotationsOnVariables.java b/test/langtools/tools/javac/annotations/typeAnnotations/TypeAnnotationsOnVariables.java index e5a1e5650d3..f89e3ff7398 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/TypeAnnotationsOnVariables.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/TypeAnnotationsOnVariables.java @@ -23,7 +23,7 @@ /* * @test - * @bug 8371155 8379550 + * @bug 8371155 8379550 8384843 * @summary Verify type annotations on local-like variables are propagated to * their types at an appropriate time. * @library /tools/lib @@ -56,7 +56,9 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Optional; +import java.util.function.Function; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -299,7 +301,7 @@ public class TypeAnnotationsOnVariables { Path testClass = classes.resolve("Test.class"); TestClassDesc testClassDesc = TestClassDesc.create(testClass); MethodModel oMethod = singletonValue(testClassDesc.name2Method().get("o")); - var oTypeAnnos = getAnnotations(oMethod); + var oTypeAnnos = getAnnotationsFromCode(oMethod); assertFalse(oTypeAnnos.isPresent(), () -> oTypeAnnos.toString()); checkTypeAnnotations(testClassDesc, @@ -337,11 +339,238 @@ public class TypeAnnotationsOnVariables { " Test$TypeAnno"); } + @Test + void explicitLambdaHeader1() throws Exception { + Path src = base.resolve("src"); + Path classes = base.resolve("classes"); + tb.writeJavaFiles(src, + """ + import java.lang.annotation.ElementType; + import java.lang.annotation.Target; + import java.util.function.BiConsumer; + import java.util.function.Consumer; + import java.util.List; + + class Test { + @Target(ElementType.TYPE_USE) + @interface TypeAnno { } + @Target(ElementType.TYPE_USE) + @interface TypeAnno2 { } + + static final Consumer> TEST1 = + (List<@TypeAnno String> arg1) -> {}; + static final BiConsumer, List<@TypeAnno2 String>> TEST2 = + (List<@TypeAnno String> arg11, List<@TypeAnno2 String> arg12) -> {}; + + private void test() { + Consumer> test1 = + (List<@TypeAnno String> arg2) -> {}; + BiConsumer, List<@TypeAnno2 String>> test2 = + (List<@TypeAnno String> arg21, List<@TypeAnno2 String> arg22) -> {}; + } + } + """); + Files.createDirectories(classes); + List actual = new ArrayList<>(); + new JavacTask(tb) + .options("-d", classes.toString()) + .files(tb.findJavaFiles(src)) + .callback(task -> { + task.addTaskListener(new TaskListener() { + @Override + public void finished(TaskEvent e) { + if (e.getKind() != TaskEvent.Kind.ANALYZE) { + return ; + } + Trees trees = Trees.instance(task); + new TreePathScanner() { + @Override + public Void visitVariable(VariableTree node, Void p) { + actual.add(node.getName() + ": " + typeToString(trees.getTypeMirror(getCurrentPath()))); + return super.visitVariable(node, p); + } + @Override + public Void visitLambdaExpression(LambdaExpressionTree node, Void p) { + actual.add(treeToString(node)+ ": " + typeToString(trees.getTypeMirror(getCurrentPath()))); + return super.visitLambdaExpression(node, p); + } + }.scan(e.getCompilationUnit(), null); + } + }); + }) + .run() + .writeAll(); + + List expected = List.of( + "TEST1: java.util.function.Consumer>", + "(List<@TypeAnno String> arg1)->{ }: java.util.function.Consumer>", + "arg1: java.util.List", + "TEST2: java.util.function.BiConsumer,java.util.List>", + "(List<@TypeAnno String> arg11, List<@TypeAnno2 String> arg12)->{ }: java.util.function.BiConsumer,java.util.List>", + "arg11: java.util.List", + "arg12: java.util.List", + "test1: java.util.function.Consumer>", + "(List<@TypeAnno String> arg2)->{ }: java.util.function.Consumer>", + "arg2: java.util.List", + "test2: java.util.function.BiConsumer,java.util.List>", + "(List<@TypeAnno String> arg21, List<@TypeAnno2 String> arg22)->{ }: java.util.function.BiConsumer,java.util.List>", + "arg21: java.util.List", + "arg22: java.util.List" + ); + + actual.forEach(System.out::println); + if (!expected.equals(actual)) { + throw new AssertionError("Expected: " + expected + ", but got: " + actual); + } + + Path testClass = classes.resolve("Test.class"); + TestClassDesc testClassDesc = TestClassDesc.create(testClass); + MethodModel clInit = singletonValue(testClassDesc.name2Method().get("")); + assertEmpty(getAnnotationsFromHeader(clInit)); + assertEmpty(getAnnotationsFromCode(clInit)); + + checkTypeAnnotations(testClassDesc, + "test", + this::getAnnotationsFromCode, + " 0: LTest$TypeAnno;(): LOCAL_VARIABLE, {start_pc=6, length=7, index=1}, location=[TYPE_ARGUMENT(0), TYPE_ARGUMENT(0)]", + " Test$TypeAnno", + " 1: LTest$TypeAnno;(): LOCAL_VARIABLE, {start_pc=12, length=1, index=2}, location=[TYPE_ARGUMENT(0), TYPE_ARGUMENT(0)]", + " Test$TypeAnno", + " 2: LTest$TypeAnno2;(): LOCAL_VARIABLE, {start_pc=12, length=1, index=2}, location=[TYPE_ARGUMENT(1), TYPE_ARGUMENT(0)]", + " Test$TypeAnno2"); + + checkTypeAnnotations(testClassDesc, + "lambda$static$0", + this::getAnnotationsFromHeader, + " 0: LTest$TypeAnno;(): METHOD_FORMAL_PARAMETER, param_index=0, location=[TYPE_ARGUMENT(0)]", + " Test$TypeAnno"); + + checkTypeAnnotations(testClassDesc, + "lambda$static$1", + this::getAnnotationsFromHeader, + " 0: LTest$TypeAnno;(): METHOD_FORMAL_PARAMETER, param_index=0, location=[TYPE_ARGUMENT(0)]", + " Test$TypeAnno", + " 1: LTest$TypeAnno2;(): METHOD_FORMAL_PARAMETER, param_index=1, location=[TYPE_ARGUMENT(0)]", + " Test$TypeAnno2"); + + checkTypeAnnotations(testClassDesc, + "lambda$test$0", + this::getAnnotationsFromHeader, + " 0: LTest$TypeAnno;(): METHOD_FORMAL_PARAMETER, param_index=0, location=[TYPE_ARGUMENT(0)]", + " Test$TypeAnno"); + + checkTypeAnnotations(testClassDesc, + "lambda$test$1", + this::getAnnotationsFromHeader, + " 0: LTest$TypeAnno;(): METHOD_FORMAL_PARAMETER, param_index=0, location=[TYPE_ARGUMENT(0)]", + " Test$TypeAnno", + " 1: LTest$TypeAnno2;(): METHOD_FORMAL_PARAMETER, param_index=1, location=[TYPE_ARGUMENT(0)]", + " Test$TypeAnno2"); + } + + @Test + void explicitLambdaHeader2() throws Exception { + Path src = base.resolve("src"); + Path classes = base.resolve("classes"); + tb.writeJavaFiles(src, + """ + import java.lang.annotation.ElementType; + import java.lang.annotation.Target; + import java.util.function.Consumer; + import java.util.List; + + class Test { + @Target(ElementType.TYPE_USE) + @interface TypeAnno { } + + static final Consumer> TEST = + (@TypeAnno List arg) -> {}; + + private void test() { + Consumer> test = + (@TypeAnno List arg) -> {}; + } + } + """); + Files.createDirectories(classes); + List actual = new ArrayList<>(); + new JavacTask(tb) + .options("-d", classes.toString()) + .files(tb.findJavaFiles(src)) + .callback(task -> { + task.addTaskListener(new TaskListener() { + @Override + public void finished(TaskEvent e) { + if (e.getKind() != TaskEvent.Kind.ANALYZE) { + return ; + } + Trees trees = Trees.instance(task); + new TreePathScanner() { + @Override + public Void visitVariable(VariableTree node, Void p) { + actual.add(node.getName() + ": " + typeToString(trees.getTypeMirror(getCurrentPath()))); + return super.visitVariable(node, p); + } + @Override + public Void visitLambdaExpression(LambdaExpressionTree node, Void p) { + actual.add(treeToString(node)+ ": " + typeToString(trees.getTypeMirror(getCurrentPath()))); + return super.visitLambdaExpression(node, p); + } + }.scan(e.getCompilationUnit(), null); + } + }); + }) + .run() + .writeAll(); + + List expected = List.of( + "TEST: java.util.function.Consumer>", + "(@TypeAnno List arg)->{ }: java.util.function.Consumer>", + "arg: java.util.@Test.TypeAnno List", + "test: java.util.function.Consumer>", + "(@TypeAnno List arg)->{ }: java.util.function.Consumer>", + "arg: java.util.@Test.TypeAnno List" + ); + + actual.forEach(System.out::println); + if (!expected.equals(actual)) { + throw new AssertionError("Expected: " + expected + ", but got: " + actual); + } + + Path testClass = classes.resolve("Test.class"); + TestClassDesc testClassDesc = TestClassDesc.create(testClass); + MethodModel clInit = singletonValue(testClassDesc.name2Method().get("")); + assertEmpty(getAnnotationsFromHeader(clInit)); + assertEmpty(getAnnotationsFromCode(clInit)); + MethodModel test = singletonValue(testClassDesc.name2Method().get("test")); + assertEmpty(getAnnotationsFromHeader(test)); + assertEmpty(getAnnotationsFromCode(test)); + + checkTypeAnnotations(testClassDesc, + "lambda$static$0", + this::getAnnotationsFromHeader, + " 0: LTest$TypeAnno;(): METHOD_FORMAL_PARAMETER, param_index=0", + " Test$TypeAnno"); + + checkTypeAnnotations(testClassDesc, + "lambda$test$0", + this::getAnnotationsFromHeader, + " 0: LTest$TypeAnno;(): METHOD_FORMAL_PARAMETER, param_index=0", + " Test$TypeAnno"); + } + private void checkTypeAnnotations(TestClassDesc testClassDesc, String lambdaMethodName, String... expectedEntries) throws IOException { + checkTypeAnnotations(testClassDesc, lambdaMethodName, this::getAnnotationsFromCode, expectedEntries); + } + + private void checkTypeAnnotations(TestClassDesc testClassDesc, + String lambdaMethodName, + Function> annotationsGetter, + String... expectedEntries) throws IOException { MethodModel lambdaMethod = singletonValue(testClassDesc.name2Method().get(lambdaMethodName)); - var lambdaTypeAnnos = getAnnotations(lambdaMethod); + var lambdaTypeAnnos = annotationsGetter.apply(lambdaMethod); if (expectedEntries.length == 0) { assertFalse(lambdaTypeAnnos.isPresent(), () -> lambdaTypeAnnos.toString()); } else { @@ -351,6 +580,7 @@ public class TypeAnnotationsOnVariables { () -> lambdaTypeAnnos.orElseThrow().annotations().toString()); checkJavapOutput(testClassDesc, + lambdaMethodName, List.of(expectedEntries)); } } @@ -360,13 +590,17 @@ public class TypeAnnotationsOnVariables { return values.get(0); } - private Optional getAnnotations(MethodModel m) { + private Optional getAnnotationsFromCode(MethodModel m) { return m.findAttribute(Attributes.code()) .orElseThrow() .findAttribute(Attributes.runtimeInvisibleTypeAnnotations()); } - void checkJavapOutput(TestClassDesc testClassDesc, List expectedOutput) throws IOException { + private Optional getAnnotationsFromHeader(MethodModel m) { + return m.findAttribute(Attributes.runtimeInvisibleTypeAnnotations()); + } + + void checkJavapOutput(TestClassDesc testClassDesc, String nameOfMethodToCheck, List expectedOutput) throws IOException { String javapOut = new JavapTask(tb) .options("-v", "-p") .classes(testClassDesc.pathToClass().toString()) @@ -385,15 +619,42 @@ public class TypeAnnotationsOnVariables { m.appendTail(expandedJavapOutBuilder); String expandedJavapOut = expandedJavapOutBuilder.toString(); + boolean inClass = false; + String currentFeature = null; + Map> feature2Text = new HashMap<>(); + + for (String line : expandedJavapOut.split("\\R")) { + if (line.equals("{")) { + inClass = true; + } else if (line.equals("}")) { + inClass = false; + currentFeature = null; + } else if (inClass && line.startsWith(" ") && line.charAt(2) != ' ') { + currentFeature = line; + } else if (currentFeature != null) { + feature2Text.computeIfAbsent(currentFeature, _ -> new ArrayList<>()) + .add(line); + } + } + + List> methodContents = feature2Text.entrySet().stream().filter(e -> e.getKey().contains(" " + nameOfMethodToCheck + "(")).map(Entry::getValue).toList(); + + assertEquals(1, methodContents.size(), methodContents.toString()); + + String linearMethodContents = methodContents.get(0).stream().collect(Collectors.joining("\n")); for (String expected : expectedOutput) { - if (!expandedJavapOut.contains(expected)) { - System.err.println(expandedJavapOut); + if (!linearMethodContents.contains(expected)) { + System.err.println(linearMethodContents); throw new AssertionError("unexpected output"); } } } + private void assertEmpty(Optional value) { + assertFalse(value.isPresent(), () -> value.toString()); + } + record TestClassDesc(Path pathToClass, Map> name2Method, Map cpIndex2Name) { diff --git a/test/langtools/tools/javac/launcher/ModuleSourceLauncherTests.java b/test/langtools/tools/javac/launcher/ModuleSourceLauncherTests.java index 44ae29dccaa..1d48592c42d 100644 --- a/test/langtools/tools/javac/launcher/ModuleSourceLauncherTests.java +++ b/test/langtools/tools/javac/launcher/ModuleSourceLauncherTests.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 @@ -23,9 +23,13 @@ /* * @test - * @bug 8304400 8332226 8346778 + * @bug 8304400 8332226 8346778 8377010 * @summary Test source launcher running Java programs contained in one module - * @modules jdk.compiler/com.sun.tools.javac.launcher + * @library /tools/lib + * @modules jdk.compiler/com.sun.tools.javac.api + * jdk.compiler/com.sun.tools.javac.launcher + * jdk.compiler/com.sun.tools.javac.main + * @build toolbox.JavaTask toolbox.JavacTask toolbox.ToolBox * @run junit ModuleSourceLauncherTests */ @@ -36,11 +40,16 @@ import org.junit.jupiter.api.io.TempDir; import java.nio.file.Files; import java.nio.file.Path; -import java.util.List; import java.util.Set; -import java.util.spi.ToolProvider; + +import toolbox.JavaTask; +import toolbox.JavacTask; +import toolbox.Task; +import toolbox.ToolBox; class ModuleSourceLauncherTests { + private final ToolBox tb = new ToolBox(); + @Test void testHelloModularWorld(@TempDir Path base) throws Exception { var packageFolder = Files.createDirectories(base.resolve("com/greetings")); @@ -176,8 +185,11 @@ class ModuleSourceLauncherTests { package foo; public record Foo() {} """); - var javac = ToolProvider.findFirst("javac").orElseThrow(); - javac.run(System.out, System.err, "--module-source-path", base.toString(), "--module", "foo", "-d", base.toString()); + new JavacTask(tb) + .options("--module-source-path", base.toString(), + "--module", "foo") + .outdir(base) + .run(); Files.createDirectories(base.resolve("bar", "bar")); Files.writeString(base.resolve("bar", "module-info.java"), @@ -198,34 +210,211 @@ class ModuleSourceLauncherTests { } """); - var command = List.of( - Path.of(System.getProperty("java.home"), "bin", "java").toString(), - "-p", ".", - "--enable-native-access", "foo,bar,baz,ALL-UNNAMED", - "bar/bar/Prog1.java"); - var redirectedOut = base.resolve("out.redirected"); - var redirectedErr = base.resolve("err.redirected"); - var process = new ProcessBuilder(command) - .directory(base.toFile()) - .redirectOutput(redirectedOut.toFile()) - .redirectError(redirectedErr.toFile()) - .start(); - var code = process.waitFor(); - var out = Files.readAllLines(redirectedOut); - var err = Files.readAllLines(redirectedErr); + var run = new JavaTask(tb) + .vmOptions("--module-path", base.toString(), + "--enable-native-access", "foo,bar,baz,ALL-UNNAMED") + .className(base.resolve("bar/bar/Prog1.java").toString()) + .run(); assertAll( - () -> assertEquals(0, code, out.toString()), () -> assertLinesMatch( """ Foo[] bar=true foo=true - """.lines(), out.stream()), + """.lines(), run.getOutputLines(Task.OutputKind.STDOUT).stream()), () -> assertLinesMatch( """ WARNING: Unknown module: baz specified to --enable-native-access - """.lines(), err.stream()) + """.lines(), run.getOutputLines(Task.OutputKind.STDERR).stream()) + ); + } + + @Test + void testInheritedMainFromOtherPackage(@TempDir Path base) throws Exception { + var appPackageDir = Files.createDirectories(base.resolve("app")); + var mainFile = Files.writeString(appPackageDir.resolve("Main.java"), + """ + package app; + import lib.Base; + public class Main extends Base {} + """); + var libPackageDir = Files.createDirectories(base.resolve("lib")); + Files.writeString(libPackageDir.resolve("Base.java"), + """ + package lib; + public class Base { + protected void main() { + System.out.println("same module separate packages"); + } + } + """); + Files.writeString(base.resolve("module-info.java"), + """ + module app {} + """); + + var run = Run.of(mainFile); + assertAll("Run -> " + run, + () -> assertTrue(run.stdErr().isEmpty()), + () -> assertLinesMatch( + """ + same module separate packages + """.lines(), + run.stdOut().lines()), + () -> assertNull(run.exception()) + ); + } + + @Test + void testInheritedStaticMainFromOtherPackage(@TempDir Path base) throws Exception { + var appPackageDir = Files.createDirectories(base.resolve("app")); + var mainFile = Files.writeString(appPackageDir.resolve("Main.java"), + """ + package app; + import lib.Base; + public class Main extends Base {} + """); + var libPackageDir = Files.createDirectories(base.resolve("lib")); + Files.writeString(libPackageDir.resolve("Base.java"), + """ + package lib; + public class Base { + protected static void main() { + System.out.println("static same module separate packages"); + } + } + """); + Files.writeString(base.resolve("module-info.java"), + """ + module app {} + """); + + var run = Run.of(mainFile); + assertAll("Run -> " + run, + () -> assertTrue(run.stdErr().isEmpty()), + () -> assertLinesMatch( + """ + static same module separate packages + """.lines(), + run.stdOut().lines()), + () -> assertNull(run.exception()) + ); + } + + @Test + void testInheritedMainFromOtherModule(@TempDir Path base) throws Exception { + var sourceRoot = base.resolve("src"); + var dependencyModuleDir = Files.createDirectories(sourceRoot.resolve("lib")); + Files.writeString(dependencyModuleDir.resolve("module-info.java"), + """ + module lib { + exports lib; + } + """); + var libPackageDir = Files.createDirectories(dependencyModuleDir.resolve("lib")); + Files.writeString(libPackageDir.resolve("Base.java"), + """ + package lib; + public class Base { + protected void main() { + System.out.println("main from across modules"); + } + } + """); + var compiledModule = Files.createDirectories(base.resolve("mods")); + new JavacTask(tb) + .options("--module-source-path", sourceRoot.toString(), + "--module", "lib") + .outdir(compiledModule) + .run(); + + var appModuleDir = Files.createDirectories(sourceRoot.resolve("app")); + var appPackageDir = Files.createDirectories(appModuleDir.resolve("app")); + var mainFile = Files.writeString(appPackageDir.resolve("Main.java"), + """ + package app; + import lib.Base; + public class Main extends Base {} + """); + Files.writeString(appModuleDir.resolve("module-info.java"), + """ + module app { + requires lib; + } + """); + + var run = new JavaTask(tb) + .vmOptions("--module-path", compiledModule.toString(), + "--add-modules", "lib") + .className(mainFile.toString()) + .run(); + + assertAll( + () -> assertLinesMatch( + """ + main from across modules + """.lines(), run.getOutputLines(Task.OutputKind.STDOUT).stream()), + () -> assertTrue(run.getOutput(Task.OutputKind.STDERR).isEmpty(), + run.getOutput(Task.OutputKind.STDERR)) + ); + } + + @Test + void testInheritedStaticMainFromOtherModule(@TempDir Path base) throws Exception { + var sourceRoot = base.resolve("src"); + var dependencyModuleDir = Files.createDirectories(sourceRoot.resolve("lib")); + Files.writeString(dependencyModuleDir.resolve("module-info.java"), + """ + module lib { + exports lib; + } + """); + var libPackageDir = Files.createDirectories(dependencyModuleDir.resolve("lib")); + Files.writeString(libPackageDir.resolve("Base.java"), + """ + package lib; + public class Base { + protected static void main() { + System.out.println("static main from across modules"); + } + } + """); + var compiledModule = Files.createDirectories(base.resolve("mods")); + new JavacTask(tb) + .options("--module-source-path", sourceRoot.toString(), + "--module", "lib") + .outdir(compiledModule) + .run(); + + var appModuleDir = Files.createDirectories(sourceRoot.resolve("app")); + var appPackageDir = Files.createDirectories(appModuleDir.resolve("app")); + var mainFile = Files.writeString(appPackageDir.resolve("Main.java"), + """ + package app; + import lib.Base; + public class Main extends Base {} + """); + Files.writeString(appModuleDir.resolve("module-info.java"), + """ + module app { + requires lib; + } + """); + + var run = new JavaTask(tb) + .vmOptions("--module-path", compiledModule.toString(), + "--add-modules", "lib") + .className(mainFile.toString()) + .run(); + + assertAll( + () -> assertLinesMatch( + """ + static main from across modules + """.lines(), run.getOutputLines(Task.OutputKind.STDOUT).stream()), + () -> assertTrue(run.getOutput(Task.OutputKind.STDERR).isEmpty(), + run.getOutput(Task.OutputKind.STDERR)) ); } diff --git a/test/langtools/tools/javac/launcher/SourceLauncherTest.java b/test/langtools/tools/javac/launcher/SourceLauncherTest.java index d0cf11a0327..0f912b74cdf 100644 --- a/test/langtools/tools/javac/launcher/SourceLauncherTest.java +++ b/test/langtools/tools/javac/launcher/SourceLauncherTest.java @@ -24,7 +24,7 @@ /* * @test * @bug 8192920 8204588 8246774 8248843 8268869 8235876 8328339 8335896 8344706 - * 8362237 8376534 + * 8362237 8376534 8379083 * @summary Test source launcher * @library /tools/lib * @modules jdk.compiler/com.sun.tools.javac.api @@ -159,6 +159,10 @@ public class SourceLauncherTest extends TestRunner { "}"); Files.copy(base.resolve("HelloWorld.java"), base.resolve("HelloWorld")); testSuccess(base.resolve("HelloWorld"), "Hello World! [1, 2, 3]\n"); + + // Re-run with a "stray" module descriptor being ignored + Files.writeString(base.resolve("module-info.java"), "module stray {}"); + testSuccess(base.resolve("HelloWorld"), "Hello World! [1, 2, 3]\n"); } @Test diff --git a/test/langtools/tools/javac/types/StackOverflowWhenClassExtendsTypeParam.java b/test/langtools/tools/javac/types/StackOverflowWhenClassExtendsTypeParam.java new file mode 100644 index 00000000000..e84a5c8772e --- /dev/null +++ b/test/langtools/tools/javac/types/StackOverflowWhenClassExtendsTypeParam.java @@ -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. + */ + +/* + * @test + * @bug 8383738 + * @summary Check that javac does not crashes with StackOverflowError when compiling + * a class that extends a type parameter. + * @library /tools/lib + * @modules + * jdk.compiler/com.sun.tools.javac.api + * jdk.compiler/com.sun.tools.javac.main + * @build toolbox.ToolBox toolbox.JavacTask + * @run junit ${test.main.class} + */ + +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import toolbox.JavacTask; +import toolbox.ToolBox; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInfo; +import toolbox.Task; + +public class StackOverflowWhenClassExtendsTypeParam { + + Path base; + ToolBox tb = new ToolBox(); + + @Test + void testIsDerivedRaw() throws Exception { + Path classes = base.resolve("classes"); + Files.createDirectories(classes); + new JavacTask(tb) + .options("-d", classes.toString()) + .sources(""" + class Test { + class A[]> implements T {} + class B[]> extends A> {} + } + """) + .run(Task.Expect.FAIL) + .writeAll(); + } + + @Test + void testCheckClassBounds() throws Exception { + Path classes = base.resolve("classes"); + Files.createDirectories(classes); + new JavacTask(tb) + .options("-d", classes.toString()) + .sources(""" + class Test { + interface I extends J { } + interface J extends T { } + } + """) + .run(Task.Expect.FAIL) + .writeAll(); + } + + @Test + void testTypesClosure() throws Exception { + Path classes = base.resolve("classes"); + Files.createDirectories(classes); + new JavacTask(tb) + .options("-d", classes.toString()) + .sources(""" + public class Test { + public static void main(String[] args) { + LayerThree> testInstance = new LayerThree<>() {}; + } + } + + class LayerOne { + } + + class LayerTwo, C extends LayerOne> extends C { + } + + class LayerThree> extends E { + } + """) + .run(Task.Expect.FAIL) + .writeAll(); + } + + @BeforeEach + public void setUp(TestInfo info) { + base = Paths.get(".") + .resolve(info.getTestMethod() + .orElseThrow() + .getName()); + } +} diff --git a/test/micro/org/openjdk/bench/vm/compiler/FpMinMaxIntrinsics.java b/test/micro/org/openjdk/bench/vm/compiler/FpMinMaxIntrinsics.java index 62c33f5fafe..b8518f25a01 100644 --- a/test/micro/org/openjdk/bench/vm/compiler/FpMinMaxIntrinsics.java +++ b/test/micro/org/openjdk/bench/vm/compiler/FpMinMaxIntrinsics.java @@ -54,8 +54,37 @@ public class FpMinMaxIntrinsics { c2 = COUNT - (s2 = step()); for (int i = 0; i < COUNT; i++) { - floats[i] = r.nextFloat(); - doubles[i] = r.nextDouble(); + final int mappedIndex = i % 100; + + if (mappedIndex >= 0 && mappedIndex < 10) { + // NaN + floats[i] = Float.NaN; + doubles[i] = Double.NaN; + } else if (mappedIndex >= 20 && mappedIndex < 30) { + // Equal (+0.0) + floats[i] = +0.0f; + doubles[i] = +0.0; + } else if (mappedIndex >= 40 && mappedIndex < 50) { + // Equal (-0.0) + floats[i] = -0.0f; + doubles[i] = -0.0; + } else if (mappedIndex >= 60 && mappedIndex < 70) { + // Descending + floats[i] = (float) (COUNT - i); + doubles[i] = (double) (COUNT - i); + } else if (mappedIndex >= 80 && mappedIndex < 90) { + // Ascending + floats[i] = (float) i; + doubles[i] = (double) i; + } else if (mappedIndex >= 90 && mappedIndex < 100) { + // Random (negative) + floats[i] = -r.nextFloat(); + doubles[i] = -r.nextDouble(); + } else { + // Random (positive) + floats[i] = r.nextFloat(); + doubles[i] = r.nextDouble(); + } } }