mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
Merge remote-tracking branch 'jdk/master' into accelerated-triggers
This commit is contained in:
commit
b3d52a5480
@ -167,11 +167,6 @@ void VM_Version::common_initialize() {
|
||||
(unaligned_scalar.value() == MISALIGNED_SCALAR_FAST));
|
||||
}
|
||||
|
||||
if (FLAG_IS_DEFAULT(AlignVector)) {
|
||||
FLAG_SET_DEFAULT(AlignVector,
|
||||
unaligned_vector.value() != MISALIGNED_VECTOR_FAST);
|
||||
}
|
||||
|
||||
#ifdef __riscv_ztso
|
||||
// Hotspot is compiled with TSO support, it will only run on hardware which
|
||||
// supports Ztso
|
||||
@ -242,6 +237,11 @@ void VM_Version::c2_initialize() {
|
||||
}
|
||||
}
|
||||
|
||||
if (FLAG_IS_DEFAULT(AlignVector)) {
|
||||
FLAG_SET_DEFAULT(AlignVector,
|
||||
unaligned_vector.value() != MISALIGNED_VECTOR_FAST);
|
||||
}
|
||||
|
||||
// NOTE: Make sure codes dependent on UseRVV are put after MaxVectorSize initialize,
|
||||
// as there are extra checks inside it which could disable UseRVV
|
||||
// in some situations.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -6086,7 +6086,7 @@ void MacroAssembler::generate_fill(BasicType t, bool aligned,
|
||||
vpbroadcastd(xtmp, xtmp, Assembler::AVX_512bit);
|
||||
|
||||
subptr(count, 16 << shift);
|
||||
jccb(Assembler::less, L_check_fill_32_bytes);
|
||||
jcc(Assembler::less, L_check_fill_32_bytes);
|
||||
align(16);
|
||||
|
||||
BIND(L_fill_64_bytes_loop_avx3);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -32,14 +32,10 @@ const KRegister::KRegisterImpl all_KRegisterImpls [KRegister::number_
|
||||
|
||||
const char * Register::RegisterImpl::name() const {
|
||||
static const char *const names[number_of_registers] = {
|
||||
#ifdef _LP64
|
||||
"rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi",
|
||||
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
|
||||
"r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
|
||||
"r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31"
|
||||
#else
|
||||
"eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi"
|
||||
#endif // _LP64
|
||||
};
|
||||
return is_valid() ? names[encoding()] : "noreg";
|
||||
}
|
||||
@ -54,11 +50,9 @@ const char* FloatRegister::FloatRegisterImpl::name() const {
|
||||
const char* XMMRegister::XMMRegisterImpl::name() const {
|
||||
static const char *const names[number_of_registers] = {
|
||||
"xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7"
|
||||
#ifdef _LP64
|
||||
,"xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15"
|
||||
,"xmm16", "xmm17", "xmm18", "xmm19", "xmm20", "xmm21", "xmm22", "xmm23"
|
||||
,"xmm24", "xmm25", "xmm26", "xmm27", "xmm28", "xmm29", "xmm30", "xmm31"
|
||||
#endif // _LP64
|
||||
};
|
||||
return is_valid() ? names[encoding()] : "xnoreg";
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -34,7 +34,7 @@
|
||||
class VMRegImpl;
|
||||
typedef VMRegImpl* VMReg;
|
||||
|
||||
// The implementation of integer registers for the x86/x64 architectures.
|
||||
// The implementation of integer registers for the x64 architectures.
|
||||
class Register {
|
||||
private:
|
||||
int _encoding;
|
||||
@ -44,11 +44,9 @@ private:
|
||||
public:
|
||||
inline friend constexpr Register as_Register(int encoding);
|
||||
|
||||
enum {
|
||||
number_of_registers = LP64_ONLY( 32 ) NOT_LP64( 8 ),
|
||||
number_of_byte_registers = LP64_ONLY( 32 ) NOT_LP64( 4 ),
|
||||
max_slots_per_register = LP64_ONLY( 2 ) NOT_LP64( 1 )
|
||||
};
|
||||
static const int number_of_registers = 32;
|
||||
static const int number_of_byte_registers = 32;
|
||||
static const int max_slots_per_register = 2;
|
||||
|
||||
class RegisterImpl: public AbstractRegisterImpl {
|
||||
friend class Register;
|
||||
@ -79,11 +77,9 @@ public:
|
||||
|
||||
// Actually available GP registers for use, depending on actual CPU capabilities and flags.
|
||||
static int available_gp_registers() {
|
||||
#ifdef _LP64
|
||||
if (!UseAPX) {
|
||||
return number_of_registers / 2;
|
||||
}
|
||||
#endif // _LP64
|
||||
return number_of_registers;
|
||||
}
|
||||
};
|
||||
@ -116,9 +112,8 @@ constexpr Register rsp = as_Register(4);
|
||||
constexpr Register rbp = as_Register(5);
|
||||
constexpr Register rsi = as_Register(6);
|
||||
constexpr Register rdi = as_Register(7);
|
||||
#ifdef _LP64
|
||||
constexpr Register r8 = as_Register( 8);
|
||||
constexpr Register r9 = as_Register( 9);
|
||||
constexpr Register r8 = as_Register(8);
|
||||
constexpr Register r9 = as_Register(9);
|
||||
constexpr Register r10 = as_Register(10);
|
||||
constexpr Register r11 = as_Register(11);
|
||||
constexpr Register r12 = as_Register(12);
|
||||
@ -141,7 +136,6 @@ constexpr Register r28 = as_Register(28);
|
||||
constexpr Register r29 = as_Register(29);
|
||||
constexpr Register r30 = as_Register(30);
|
||||
constexpr Register r31 = as_Register(31);
|
||||
#endif // _LP64
|
||||
|
||||
|
||||
// The implementation of x87 floating point registers for the ia32 architecture.
|
||||
@ -154,10 +148,8 @@ private:
|
||||
public:
|
||||
inline friend constexpr FloatRegister as_FloatRegister(int encoding);
|
||||
|
||||
enum {
|
||||
number_of_registers = 8,
|
||||
max_slots_per_register = 2
|
||||
};
|
||||
static const int number_of_registers = 8;
|
||||
static const int max_slots_per_register = 2;
|
||||
|
||||
class FloatRegisterImpl: public AbstractRegisterImpl {
|
||||
friend class FloatRegister;
|
||||
@ -217,10 +209,8 @@ private:
|
||||
public:
|
||||
inline friend constexpr XMMRegister as_XMMRegister(int encoding);
|
||||
|
||||
enum {
|
||||
number_of_registers = LP64_ONLY( 32 ) NOT_LP64( 8 ),
|
||||
max_slots_per_register = LP64_ONLY( 16 ) NOT_LP64( 16 ) // 512-bit
|
||||
};
|
||||
static const int number_of_registers = 32;
|
||||
static const int max_slots_per_register = 16; // 512-bit
|
||||
|
||||
class XMMRegisterImpl: public AbstractRegisterImpl {
|
||||
friend class XMMRegister;
|
||||
@ -250,11 +240,9 @@ public:
|
||||
|
||||
// Actually available XMM registers for use, depending on actual CPU capabilities and flags.
|
||||
static int available_xmm_registers() {
|
||||
#ifdef _LP64
|
||||
if (UseAVX < 3) {
|
||||
return number_of_registers / 2;
|
||||
}
|
||||
#endif // _LP64
|
||||
return number_of_registers;
|
||||
}
|
||||
};
|
||||
@ -287,7 +275,6 @@ constexpr XMMRegister xmm4 = as_XMMRegister( 4);
|
||||
constexpr XMMRegister xmm5 = as_XMMRegister( 5);
|
||||
constexpr XMMRegister xmm6 = as_XMMRegister( 6);
|
||||
constexpr XMMRegister xmm7 = as_XMMRegister( 7);
|
||||
#ifdef _LP64
|
||||
constexpr XMMRegister xmm8 = as_XMMRegister( 8);
|
||||
constexpr XMMRegister xmm9 = as_XMMRegister( 9);
|
||||
constexpr XMMRegister xmm10 = as_XMMRegister(10);
|
||||
@ -312,7 +299,6 @@ constexpr XMMRegister xmm28 = as_XMMRegister(28);
|
||||
constexpr XMMRegister xmm29 = as_XMMRegister(29);
|
||||
constexpr XMMRegister xmm30 = as_XMMRegister(30);
|
||||
constexpr XMMRegister xmm31 = as_XMMRegister(31);
|
||||
#endif // _LP64
|
||||
|
||||
|
||||
// The implementation of AVX-512 opmask registers.
|
||||
@ -394,25 +380,17 @@ constexpr KRegister k7 = as_KRegister(7);
|
||||
// Define a class that exports it.
|
||||
class ConcreteRegisterImpl : public AbstractRegisterImpl {
|
||||
public:
|
||||
enum {
|
||||
max_gpr = Register::number_of_registers * Register::max_slots_per_register,
|
||||
max_fpr = max_gpr + FloatRegister::number_of_registers * FloatRegister::max_slots_per_register,
|
||||
max_xmm = max_fpr + XMMRegister::number_of_registers * XMMRegister::max_slots_per_register,
|
||||
max_kpr = max_xmm + KRegister::number_of_registers * KRegister::max_slots_per_register,
|
||||
static const int max_gpr = Register::number_of_registers * Register::max_slots_per_register;
|
||||
static const int max_fpr = max_gpr + FloatRegister::number_of_registers * FloatRegister::max_slots_per_register;
|
||||
static const int max_xmm = max_fpr + XMMRegister::number_of_registers * XMMRegister::max_slots_per_register;
|
||||
static const int max_kpr = max_xmm + KRegister::number_of_registers * KRegister::max_slots_per_register;
|
||||
|
||||
// A big enough number for C2: all the registers plus flags
|
||||
// This number must be large enough to cover REG_COUNT (defined by c2) registers.
|
||||
// There is no requirement that any ordering here matches any ordering c2 gives
|
||||
// it's optoregs.
|
||||
|
||||
// x86_32.ad defines additional dummy FILL0-FILL7 registers, in order to tally
|
||||
// REG_COUNT (computed by ADLC based on the number of reg_defs seen in .ad files)
|
||||
// with ConcreteRegisterImpl::number_of_registers additional count of 8 is being
|
||||
// added for 32 bit jvm.
|
||||
number_of_registers = max_kpr + // gpr/fpr/xmm/kpr
|
||||
NOT_LP64( 8 + ) // FILL0-FILL7 in x86_32.ad
|
||||
1 // eflags
|
||||
};
|
||||
static const int number_of_registers = max_kpr + // gpr/fpr/xmm/kpr
|
||||
1; // eflags
|
||||
};
|
||||
|
||||
template <>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -32,9 +32,7 @@ void VMRegImpl::set_regName() {
|
||||
int i;
|
||||
for (i = 0; i < ConcreteRegisterImpl::max_gpr ; ) {
|
||||
regName[i++] = reg->name();
|
||||
#ifdef AMD64
|
||||
regName[i++] = reg->name();
|
||||
#endif // AMD64
|
||||
reg = reg->successor();
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -52,14 +52,8 @@ inline bool is_KRegister() {
|
||||
}
|
||||
|
||||
inline Register as_Register() {
|
||||
|
||||
assert( is_Register(), "must be");
|
||||
// Yuk
|
||||
#ifdef AMD64
|
||||
assert(is_Register(), "must be");
|
||||
return ::as_Register(value() >> 1);
|
||||
#else
|
||||
return ::as_Register(value());
|
||||
#endif // AMD64
|
||||
}
|
||||
|
||||
inline FloatRegister as_FloatRegister() {
|
||||
@ -82,9 +76,6 @@ inline KRegister as_KRegister() {
|
||||
|
||||
inline bool is_concrete() {
|
||||
assert(is_reg(), "must be");
|
||||
#ifndef AMD64
|
||||
if (is_Register()) return true;
|
||||
#endif // AMD64
|
||||
// Do not use is_XMMRegister() here as it depends on the UseAVX setting.
|
||||
if (value() >= ConcreteRegisterImpl::max_fpr && value() < ConcreteRegisterImpl::max_xmm) {
|
||||
int base = value() - ConcreteRegisterImpl::max_fpr;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -26,7 +26,7 @@
|
||||
#define CPU_X86_VMREG_X86_INLINE_HPP
|
||||
|
||||
inline VMReg Register::RegisterImpl::as_VMReg() const {
|
||||
return VMRegImpl::as_VMReg(encoding() LP64_ONLY( << 1 ));
|
||||
return VMRegImpl::as_VMReg(encoding() << 1);
|
||||
}
|
||||
|
||||
inline VMReg FloatRegister::FloatRegisterImpl::as_VMReg() const {
|
||||
|
||||
@ -66,9 +66,6 @@
|
||||
#endif
|
||||
|
||||
// open(2) flags
|
||||
#ifndef O_CLOEXEC
|
||||
#define O_CLOEXEC 02000000
|
||||
#endif
|
||||
#ifndef O_TMPFILE
|
||||
#define O_TMPFILE (020000000 | O_DIRECTORY)
|
||||
#endif
|
||||
|
||||
@ -4878,31 +4878,8 @@ int os::open(const char *path, int oflag, int mode) {
|
||||
// All file descriptors that are opened in the Java process and not
|
||||
// specifically destined for a subprocess should have the close-on-exec
|
||||
// flag set. If we don't set it, then careless 3rd party native code
|
||||
// might fork and exec without closing all appropriate file descriptors,
|
||||
// and this in turn might:
|
||||
//
|
||||
// - cause end-of-file to fail to be detected on some file
|
||||
// descriptors, resulting in mysterious hangs, or
|
||||
//
|
||||
// - might cause an fopen in the subprocess to fail on a system
|
||||
// suffering from bug 1085341.
|
||||
//
|
||||
// (Yes, the default setting of the close-on-exec flag is a Unix
|
||||
// design flaw)
|
||||
//
|
||||
// See:
|
||||
// 1085341: 32-bit stdio routines should support file descriptors >255
|
||||
// 4843136: (process) pipe file descriptor from Runtime.exec not being closed
|
||||
// 6339493: (process) Runtime.exec does not close all file descriptors on Solaris 9
|
||||
//
|
||||
// Modern Linux kernels (after 2.6.23 2007) support O_CLOEXEC with open().
|
||||
// O_CLOEXEC is preferable to using FD_CLOEXEC on an open file descriptor
|
||||
// because it saves a system call and removes a small window where the flag
|
||||
// is unset. On ancient Linux kernels the O_CLOEXEC flag will be ignored
|
||||
// and we fall back to using FD_CLOEXEC (see below).
|
||||
#ifdef O_CLOEXEC
|
||||
// might fork and exec without closing all appropriate file descriptors.
|
||||
oflag |= O_CLOEXEC;
|
||||
#endif
|
||||
|
||||
int fd = ::open(path, oflag, mode);
|
||||
if (fd == -1) return -1;
|
||||
@ -4925,21 +4902,6 @@ int os::open(const char *path, int oflag, int mode) {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef FD_CLOEXEC
|
||||
// Validate that the use of the O_CLOEXEC flag on open above worked.
|
||||
// With recent kernels, we will perform this check exactly once.
|
||||
static sig_atomic_t O_CLOEXEC_is_known_to_work = 0;
|
||||
if (!O_CLOEXEC_is_known_to_work) {
|
||||
int flags = ::fcntl(fd, F_GETFD);
|
||||
if (flags != -1) {
|
||||
if ((flags & FD_CLOEXEC) != 0)
|
||||
O_CLOEXEC_is_known_to_work = 1;
|
||||
else
|
||||
::fcntl(fd, F_SETFD, flags | FD_CLOEXEC);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
@ -1371,6 +1371,7 @@ void AOTCodeAddressTable::init_extrs() {
|
||||
SET_ADDRESS(_extrs, ShenandoahRuntime::load_reference_barrier_phantom_narrow);
|
||||
#endif
|
||||
#if INCLUDE_ZGC
|
||||
SET_ADDRESS(_extrs, ZBarrierSetRuntime::load_barrier_on_oop_field_preloaded_addr());
|
||||
SET_ADDRESS(_extrs, ZBarrierSetRuntime::load_barrier_on_phantom_oop_field_preloaded_addr());
|
||||
#if defined(AMD64)
|
||||
SET_ADDRESS(_extrs, &ZPointerLoadShift);
|
||||
|
||||
@ -687,8 +687,8 @@ HeapWord* G1CollectedHeap::attempt_allocation_humongous(size_t word_size) {
|
||||
// before the allocation is that we avoid having to keep track of the newly
|
||||
// allocated memory while we do a GC.
|
||||
// Only try that if we can actually perform a GC.
|
||||
if (is_init_completed() && policy()->need_to_start_conc_mark("concurrent humongous allocation",
|
||||
word_size)) {
|
||||
if (is_init_completed() &&
|
||||
policy()->need_to_start_conc_mark("concurrent humongous allocation", word_size)) {
|
||||
try_collect(word_size, GCCause::_g1_humongous_allocation, collection_counters(this));
|
||||
}
|
||||
|
||||
|
||||
@ -108,7 +108,7 @@ void G1FullGCMarker::follow_array_chunk(objArrayOop array, int index) {
|
||||
push_objarray(array, end_index);
|
||||
}
|
||||
|
||||
array->oop_iterate_range(mark_closure(), beg_index, end_index);
|
||||
array->oop_iterate_elements_range(mark_closure(), beg_index, end_index);
|
||||
}
|
||||
|
||||
inline void G1FullGCMarker::follow_object(oop obj) {
|
||||
|
||||
@ -238,9 +238,9 @@ void G1ParScanThreadState::do_partial_array(PartialArrayState* state, bool stole
|
||||
G1HeapRegionAttr dest_attr = _g1h->region_attr(to_array);
|
||||
G1SkipCardMarkSetter x(&_scanner, dest_attr.is_new_survivor());
|
||||
// Process claimed task.
|
||||
to_array->oop_iterate_range(&_scanner,
|
||||
checked_cast<int>(claim._start),
|
||||
checked_cast<int>(claim._end));
|
||||
to_array->oop_iterate_elements_range(&_scanner,
|
||||
checked_cast<int>(claim._start),
|
||||
checked_cast<int>(claim._end));
|
||||
}
|
||||
|
||||
MAYBE_INLINE_EVACUATION
|
||||
@ -260,7 +260,7 @@ void G1ParScanThreadState::start_partial_objarray(oop from_obj,
|
||||
// Process the initial chunk. No need to process the type in the
|
||||
// klass, as it will already be handled by processing the built-in
|
||||
// module.
|
||||
to_array->oop_iterate_range(&_scanner, 0, checked_cast<int>(initial_chunk_size));
|
||||
to_array->oop_iterate_elements_range(&_scanner, 0, checked_cast<int>(initial_chunk_size));
|
||||
}
|
||||
|
||||
MAYBE_INLINE_EVACUATION
|
||||
|
||||
@ -412,7 +412,7 @@ void SerialFullGC::follow_array_chunk(objArrayOop array, int index) {
|
||||
const int stride = MIN2(len - beg_index, (int) ObjArrayMarkingStride);
|
||||
const int end_index = beg_index + stride;
|
||||
|
||||
array->oop_iterate_range(&mark_and_push_closure, beg_index, end_index);
|
||||
array->oop_iterate_elements_range(&mark_and_push_closure, beg_index, end_index);
|
||||
|
||||
if (end_index < len) {
|
||||
SerialFullGC::push_objarray(array, end_index); // Push the continuation.
|
||||
|
||||
@ -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
|
||||
@ -22,8 +22,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "cppstdlib/new.hpp"
|
||||
#include "gc/shared/workerUtils.hpp"
|
||||
#include "runtime/atomicAccess.hpp"
|
||||
#include "runtime/atomic.hpp"
|
||||
#include "runtime/mutexLocker.hpp"
|
||||
|
||||
// *** WorkerThreadsBarrierSync
|
||||
@ -80,21 +81,21 @@ void WorkerThreadsBarrierSync::abort() {
|
||||
|
||||
SubTasksDone::SubTasksDone(uint n) :
|
||||
_tasks(nullptr), _n_tasks(n) {
|
||||
_tasks = NEW_C_HEAP_ARRAY(bool, n, mtInternal);
|
||||
_tasks = NEW_C_HEAP_ARRAY(Atomic<bool>, n, mtInternal);
|
||||
for (uint i = 0; i < _n_tasks; i++) {
|
||||
_tasks[i] = false;
|
||||
::new (&_tasks[i]) Atomic<bool>(false);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ASSERT
|
||||
void SubTasksDone::all_tasks_claimed_impl(uint skipped[], size_t skipped_size) {
|
||||
if (AtomicAccess::cmpxchg(&_verification_done, false, true)) {
|
||||
if (!_verification_done.compare_set(false, true)) {
|
||||
// another thread has done the verification
|
||||
return;
|
||||
}
|
||||
// all non-skipped tasks are claimed
|
||||
for (uint i = 0; i < _n_tasks; ++i) {
|
||||
if (!_tasks[i]) {
|
||||
if (!_tasks[i].load_relaxed()) {
|
||||
auto is_skipped = false;
|
||||
for (size_t j = 0; j < skipped_size; ++j) {
|
||||
if (i == skipped[j]) {
|
||||
@ -109,27 +110,27 @@ void SubTasksDone::all_tasks_claimed_impl(uint skipped[], size_t skipped_size) {
|
||||
for (size_t i = 0; i < skipped_size; ++i) {
|
||||
auto task_index = skipped[i];
|
||||
assert(task_index < _n_tasks, "Array in range.");
|
||||
assert(!_tasks[task_index], "%d is both claimed and skipped.", task_index);
|
||||
assert(!_tasks[task_index].load_relaxed(), "%d is both claimed and skipped.", task_index);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
bool SubTasksDone::try_claim_task(uint t) {
|
||||
assert(t < _n_tasks, "bad task id.");
|
||||
return !_tasks[t] && !AtomicAccess::cmpxchg(&_tasks[t], false, true);
|
||||
return !_tasks[t].load_relaxed() && _tasks[t].compare_set(false, true);
|
||||
}
|
||||
|
||||
SubTasksDone::~SubTasksDone() {
|
||||
assert(_verification_done, "all_tasks_claimed must have been called.");
|
||||
FREE_C_HEAP_ARRAY(bool, _tasks);
|
||||
assert(_verification_done.load_relaxed(), "all_tasks_claimed must have been called.");
|
||||
FREE_C_HEAP_ARRAY(Atomic<bool>, _tasks);
|
||||
}
|
||||
|
||||
// *** SequentialSubTasksDone
|
||||
|
||||
bool SequentialSubTasksDone::try_claim_task(uint& t) {
|
||||
t = _num_claimed;
|
||||
t = _num_claimed.load_relaxed();
|
||||
if (t < _num_tasks) {
|
||||
t = AtomicAccess::add(&_num_claimed, 1u) - 1;
|
||||
t = _num_claimed.fetch_then_add(1u);
|
||||
}
|
||||
return t < _num_tasks;
|
||||
}
|
||||
|
||||
@ -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
|
||||
@ -28,6 +28,7 @@
|
||||
#include "cppstdlib/type_traits.hpp"
|
||||
#include "memory/allocation.hpp"
|
||||
#include "metaprogramming/enableIf.hpp"
|
||||
#include "runtime/atomic.hpp"
|
||||
#include "runtime/mutex.hpp"
|
||||
#include "utilities/debug.hpp"
|
||||
#include "utilities/globalDefinitions.hpp"
|
||||
@ -79,11 +80,11 @@ public:
|
||||
// enumeration type.
|
||||
|
||||
class SubTasksDone: public CHeapObj<mtInternal> {
|
||||
volatile bool* _tasks;
|
||||
Atomic<bool>* _tasks;
|
||||
uint _n_tasks;
|
||||
|
||||
// make sure verification logic is run exactly once to avoid duplicate assertion failures
|
||||
DEBUG_ONLY(volatile bool _verification_done = false;)
|
||||
DEBUG_ONLY(Atomic<bool> _verification_done;)
|
||||
void all_tasks_claimed_impl(uint skipped[], size_t skipped_size) NOT_DEBUG_RETURN;
|
||||
|
||||
NONCOPYABLE(SubTasksDone);
|
||||
@ -127,7 +128,7 @@ public:
|
||||
class SequentialSubTasksDone : public CHeapObj<mtInternal> {
|
||||
|
||||
uint _num_tasks; // Total number of tasks available.
|
||||
volatile uint _num_claimed; // Number of tasks claimed.
|
||||
Atomic<uint> _num_claimed; // Number of tasks claimed.
|
||||
|
||||
NONCOPYABLE(SequentialSubTasksDone);
|
||||
|
||||
@ -135,7 +136,8 @@ public:
|
||||
SequentialSubTasksDone(uint num_tasks) : _num_tasks(num_tasks), _num_claimed(0) { }
|
||||
~SequentialSubTasksDone() {
|
||||
// Claiming may try to claim more tasks than there are.
|
||||
assert(_num_claimed >= _num_tasks, "Claimed %u tasks of %u", _num_claimed, _num_tasks);
|
||||
assert(_num_claimed.load_relaxed() >= _num_tasks,
|
||||
"Claimed %u tasks of %u", _num_claimed.load_relaxed(), _num_tasks);
|
||||
}
|
||||
|
||||
// Attempt to claim the next unclaimed task in the sequence,
|
||||
|
||||
@ -354,7 +354,7 @@ void ShenandoahRegionPartitions::make_all_regions_unavailable() {
|
||||
_empty_region_counts[partition_id] = 0;
|
||||
_used[partition_id] = 0;
|
||||
_humongous_waste[partition_id] = 0;
|
||||
_available[partition_id] = FreeSetUnderConstruction;
|
||||
_available[partition_id] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2514,6 +2514,10 @@ void ShenandoahFreeSet::move_regions_from_collector_to_mutator(size_t max_xfer_r
|
||||
void ShenandoahFreeSet::prepare_to_rebuild(size_t &young_trashed_regions, size_t &old_trashed_regions,
|
||||
size_t &first_old_region, size_t &last_old_region, size_t &old_region_count) {
|
||||
shenandoah_assert_heaplocked();
|
||||
assert(rebuild_lock() != nullptr, "sanity");
|
||||
rebuild_lock()->lock(false);
|
||||
// This resets all state information, removing all regions from all sets.
|
||||
clear();
|
||||
log_debug(gc, free)("Rebuilding FreeSet");
|
||||
|
||||
// Place regions that have alloc_capacity into the old_collector set if they identify as is_old() or the
|
||||
@ -2545,6 +2549,9 @@ size_t ShenandoahFreeSet::finish_rebuild(size_t young_trashed_regions, size_t ol
|
||||
_total_young_regions = _heap->num_regions() - old_region_count;
|
||||
_total_global_regions = _heap->num_regions();
|
||||
establish_old_collector_alloc_bias();
|
||||
|
||||
// Release the rebuild lock now. What remains in this function is read-only
|
||||
rebuild_lock()->unlock();
|
||||
_partitions.assert_bounds(true);
|
||||
log_status();
|
||||
return mutator_free;
|
||||
@ -3088,7 +3095,7 @@ void ShenandoahFreeSet::log_status() {
|
||||
size_t max_humongous = max_contig * ShenandoahHeapRegion::region_size_bytes();
|
||||
// capacity() is capacity of mutator
|
||||
// used() is used of mutator
|
||||
size_t free = capacity() - used();
|
||||
size_t free = capacity_holding_lock() - used_holding_lock();
|
||||
// Since certain regions that belonged to the Mutator free partition at the time of most recent rebuild may have been
|
||||
// retired, the sum of used and capacities within regions that are still in the Mutator free partition may not match
|
||||
// my internally tracked values of used() and free().
|
||||
|
||||
@ -28,9 +28,13 @@
|
||||
|
||||
#include "gc/shenandoah/shenandoahHeap.hpp"
|
||||
#include "gc/shenandoah/shenandoahHeapRegionSet.hpp"
|
||||
#include "gc/shenandoah/shenandoahLock.hpp"
|
||||
#include "gc/shenandoah/shenandoahSimpleBitMap.hpp"
|
||||
#include "logging/logStream.hpp"
|
||||
|
||||
typedef ShenandoahLock ShenandoahRebuildLock;
|
||||
typedef ShenandoahLocker ShenandoahRebuildLocker;
|
||||
|
||||
// Each ShenandoahHeapRegion is associated with a ShenandoahFreeSetPartitionId.
|
||||
enum class ShenandoahFreeSetPartitionId : uint8_t {
|
||||
Mutator, // Region is in the Mutator free set: available memory is available to mutators.
|
||||
@ -139,8 +143,6 @@ public:
|
||||
ShenandoahRegionPartitions(size_t max_regions, ShenandoahFreeSet* free_set);
|
||||
~ShenandoahRegionPartitions() {}
|
||||
|
||||
static const size_t FreeSetUnderConstruction = SIZE_MAX;
|
||||
|
||||
inline idx_t max() const { return _max; }
|
||||
|
||||
// At initialization, reset OldCollector tallies
|
||||
@ -352,6 +354,16 @@ public:
|
||||
return _available[int(which_partition)];
|
||||
}
|
||||
|
||||
// Return available_in assuming caller does not hold the heap lock but does hold the rebuild_lock.
|
||||
// The returned value may be "slightly stale" because we do not assure that every fetch of this value
|
||||
// sees the most recent update of this value. Requiring the caller to hold the rebuild_lock assures
|
||||
// that we don't see "bogus" values that are "worse than stale". During rebuild of the freeset, the
|
||||
// value of _available is not reliable.
|
||||
inline size_t available_in_locked_for_rebuild(ShenandoahFreeSetPartitionId which_partition) const {
|
||||
assert (which_partition < NumPartitions, "selected free set must be valid");
|
||||
return _available[int(which_partition)];
|
||||
}
|
||||
|
||||
// Returns bytes of humongous waste
|
||||
inline size_t humongous_waste(ShenandoahFreeSetPartitionId which_partition) const {
|
||||
assert (which_partition < NumPartitions, "selected free set must be valid");
|
||||
@ -359,23 +371,6 @@ public:
|
||||
return _humongous_waste[int(which_partition)];
|
||||
}
|
||||
|
||||
// Return available_in assuming caller does not hold the heap lock. In production builds, available is
|
||||
// returned without acquiring the lock. In debug builds, the global heap lock is acquired in order to
|
||||
// enforce a consistency assert.
|
||||
inline size_t available_in_not_locked(ShenandoahFreeSetPartitionId which_partition) const {
|
||||
assert (which_partition < NumPartitions, "selected free set must be valid");
|
||||
shenandoah_assert_not_heaplocked();
|
||||
#ifdef ASSERT
|
||||
ShenandoahHeapLocker locker(ShenandoahHeap::heap()->lock());
|
||||
assert((_available[int(which_partition)] == FreeSetUnderConstruction) ||
|
||||
(_available[int(which_partition)] == _capacity[int(which_partition)] - _used[int(which_partition)]),
|
||||
"Expect available (%zu) equals capacity (%zu) - used (%zu) for partition %s",
|
||||
_available[int(which_partition)], _capacity[int(which_partition)], _used[int(which_partition)],
|
||||
partition_membership_name(idx_t(which_partition)));
|
||||
#endif
|
||||
return _available[int(which_partition)];
|
||||
}
|
||||
|
||||
inline void set_capacity_of(ShenandoahFreeSetPartitionId which_partition, size_t value);
|
||||
|
||||
inline void set_used_by(ShenandoahFreeSetPartitionId which_partition, size_t value) {
|
||||
@ -446,6 +441,15 @@ private:
|
||||
// Temporarily holds mutator_Free allocatable bytes between prepare_to_rebuild() and finish_rebuild()
|
||||
size_t _prepare_to_rebuild_mutator_free;
|
||||
|
||||
// This locks the rebuild process (in combination with the global heap lock). Whenever we rebuild the free set,
|
||||
// we first acquire the global heap lock and then we acquire this _rebuild_lock in a nested context. Threads that
|
||||
// need to check available, acquire only the _rebuild_lock to make sure that they are not obtaining the value of
|
||||
// available for a partially reconstructed free-set.
|
||||
//
|
||||
// Note that there is rank ordering of nested locks to prevent deadlock. All threads that need to acquire both
|
||||
// locks will acquire them in the same order: first the global heap lock and then the rebuild lock.
|
||||
ShenandoahRebuildLock _rebuild_lock;
|
||||
|
||||
HeapWord* allocate_aligned_plab(size_t size, ShenandoahAllocRequest& req, ShenandoahHeapRegion* r);
|
||||
|
||||
size_t _total_humongous_waste;
|
||||
@ -641,10 +645,12 @@ private:
|
||||
void log_status();
|
||||
|
||||
public:
|
||||
static const size_t FreeSetUnderConstruction = ShenandoahRegionPartitions::FreeSetUnderConstruction;
|
||||
|
||||
ShenandoahFreeSet(ShenandoahHeap* heap, size_t max_regions);
|
||||
|
||||
ShenandoahRebuildLock* rebuild_lock() {
|
||||
return &_rebuild_lock;
|
||||
}
|
||||
|
||||
inline size_t max_regions() const { return _partitions.max(); }
|
||||
ShenandoahFreeSetPartitionId membership(size_t index) const { return _partitions.membership(index); }
|
||||
inline void shrink_interval_if_range_modifies_either_boundary(ShenandoahFreeSetPartitionId partition,
|
||||
@ -821,13 +827,29 @@ public:
|
||||
// Note that capacity is the number of regions that had available memory at most recent rebuild. It is not the
|
||||
// entire size of the young or global generation. (Regions within the generation that were fully utilized at time of
|
||||
// rebuild are not counted as part of capacity.)
|
||||
inline size_t capacity() const { return _partitions.capacity_of(ShenandoahFreeSetPartitionId::Mutator); }
|
||||
|
||||
inline size_t used() const { return _partitions.used_by(ShenandoahFreeSetPartitionId::Mutator); }
|
||||
inline size_t reserved() const { return _partitions.capacity_of(ShenandoahFreeSetPartitionId::Collector); }
|
||||
inline size_t available() const { return _partitions.available_in_not_locked(ShenandoahFreeSetPartitionId::Mutator); }
|
||||
inline size_t available_holding_lock() const
|
||||
{ return _partitions.available_in(ShenandoahFreeSetPartitionId::Mutator); }
|
||||
inline size_t capacity_holding_lock() const {
|
||||
shenandoah_assert_heaplocked();
|
||||
return _partitions.capacity_of(ShenandoahFreeSetPartitionId::Mutator);
|
||||
}
|
||||
inline size_t capacity_not_holding_lock() {
|
||||
shenandoah_assert_not_heaplocked();
|
||||
ShenandoahRebuildLocker locker(rebuild_lock());
|
||||
return _partitions.capacity_of(ShenandoahFreeSetPartitionId::Mutator);
|
||||
}
|
||||
inline size_t used_holding_lock() const {
|
||||
shenandoah_assert_heaplocked();
|
||||
return _partitions.used_by(ShenandoahFreeSetPartitionId::Mutator);
|
||||
}
|
||||
inline size_t used_not_holding_lock() {
|
||||
shenandoah_assert_not_heaplocked();
|
||||
ShenandoahRebuildLocker locker(rebuild_lock());
|
||||
return _partitions.used_by(ShenandoahFreeSetPartitionId::Mutator);
|
||||
}
|
||||
inline size_t available() {
|
||||
shenandoah_assert_not_heaplocked();
|
||||
ShenandoahRebuildLocker locker(rebuild_lock());
|
||||
return _partitions.available_in_locked_for_rebuild(ShenandoahFreeSetPartitionId::Mutator);
|
||||
}
|
||||
|
||||
inline size_t total_humongous_waste() const { return _total_humongous_waste; }
|
||||
inline size_t humongous_waste_in_mutator() const { return _partitions.humongous_waste(ShenandoahFreeSetPartitionId::Mutator); }
|
||||
|
||||
@ -1114,16 +1114,17 @@ void ShenandoahFullGC::phase5_epilog() {
|
||||
ShenandoahPostCompactClosure post_compact;
|
||||
heap->heap_region_iterate(&post_compact);
|
||||
heap->collection_set()->clear();
|
||||
size_t young_cset_regions, old_cset_regions;
|
||||
size_t first_old, last_old, num_old;
|
||||
heap->free_set()->prepare_to_rebuild(young_cset_regions, old_cset_regions, first_old, last_old, num_old);
|
||||
|
||||
// We also do not expand old generation size following Full GC because we have scrambled age populations and
|
||||
// no longer have objects separated by age into distinct regions.
|
||||
if (heap->mode()->is_generational()) {
|
||||
ShenandoahGenerationalFullGC::compute_balances();
|
||||
size_t young_cset_regions, old_cset_regions, first_old, last_old, num_old;
|
||||
ShenandoahFreeSet* free_set = heap->free_set();
|
||||
{
|
||||
free_set->prepare_to_rebuild(young_cset_regions, old_cset_regions, first_old, last_old, num_old);
|
||||
// We also do not expand old generation size following Full GC because we have scrambled age populations and
|
||||
// no longer have objects separated by age into distinct regions.
|
||||
if (heap->mode()->is_generational()) {
|
||||
ShenandoahGenerationalFullGC::compute_balances();
|
||||
}
|
||||
free_set->finish_rebuild(young_cset_regions, old_cset_regions, num_old);
|
||||
}
|
||||
|
||||
size_t mutator_free = heap->free_set()->finish_rebuild(young_cset_regions, old_cset_regions, num_old);
|
||||
heap->set_mutator_free_after_updaterefs(mutator_free);
|
||||
|
||||
|
||||
@ -819,10 +819,9 @@ void ShenandoahGeneration::prepare_regions_and_collection_set(bool concurrent) {
|
||||
ShenandoahGCPhase phase(concurrent ? ShenandoahPhaseTimings::final_rebuild_freeset :
|
||||
ShenandoahPhaseTimings::degen_gc_final_rebuild_freeset);
|
||||
ShenandoahHeapLocker locker(heap->lock());
|
||||
size_t young_cset_regions, old_cset_regions;
|
||||
|
||||
// We are preparing for evacuation. At this time, we ignore cset region tallies.
|
||||
size_t first_old, last_old, num_old;
|
||||
size_t young_cset_regions, old_cset_regions, first_old, last_old, num_old;
|
||||
_free_set->prepare_to_rebuild(young_cset_regions, old_cset_regions, first_old, last_old, num_old);
|
||||
|
||||
if (heap->mode()->is_generational()) {
|
||||
|
||||
@ -434,7 +434,6 @@ jint ShenandoahHeap::initialize() {
|
||||
old_generation()->set_promoted_reserve((size_t) 0);
|
||||
}
|
||||
|
||||
|
||||
// We are initializing free set. We ignore cset region tallies.
|
||||
size_t young_trash_regions, old_trash_regions, first_old, last_old, num_old;
|
||||
_free_set->prepare_to_rebuild(young_trash_regions, old_trash_regions, first_old, last_old, num_old);
|
||||
@ -1674,7 +1673,7 @@ void ShenandoahHeap::verify(VerifyOption vo) {
|
||||
}
|
||||
}
|
||||
size_t ShenandoahHeap::tlab_capacity() const {
|
||||
return _free_set->capacity();
|
||||
return _free_set->capacity_not_holding_lock();
|
||||
}
|
||||
|
||||
class ObjectIterateScanRootClosure : public BasicOopIterateClosure {
|
||||
@ -2154,7 +2153,7 @@ GCTracer* ShenandoahHeap::tracer() {
|
||||
}
|
||||
|
||||
size_t ShenandoahHeap::tlab_used() const {
|
||||
return _free_set->used();
|
||||
return _free_set->used_not_holding_lock();
|
||||
}
|
||||
|
||||
bool ShenandoahHeap::try_cancel_gc(GCCause::Cause cause) {
|
||||
@ -2544,8 +2543,7 @@ void ShenandoahHeap::rebuild_free_set(bool concurrent) {
|
||||
ShenandoahPhaseTimings::final_update_refs_rebuild_freeset :
|
||||
ShenandoahPhaseTimings::degen_gc_final_update_refs_rebuild_freeset);
|
||||
ShenandoahHeapLocker locker(lock());
|
||||
size_t young_cset_regions, old_cset_regions;
|
||||
size_t first_old_region, last_old_region, old_region_count;
|
||||
size_t young_cset_regions, old_cset_regions, first_old_region, last_old_region, old_region_count;
|
||||
_free_set->prepare_to_rebuild(young_cset_regions, old_cset_regions, first_old_region, last_old_region, old_region_count);
|
||||
// If there are no old regions, first_old_region will be greater than last_old_region
|
||||
assert((first_old_region > last_old_region) ||
|
||||
@ -2564,13 +2562,14 @@ void ShenandoahHeap::rebuild_free_set(bool concurrent) {
|
||||
// The computation of bytes_of_allocation_runway_before_gc_trigger is quite conservative so consider all of this
|
||||
// available for transfer to old. Note that transfer of humongous regions does not impact available.
|
||||
ShenandoahGenerationalHeap* gen_heap = ShenandoahGenerationalHeap::heap();
|
||||
size_t allocation_runway = gen_heap->young_generation()->heuristics()->bytes_of_allocation_runway_before_gc_trigger(young_cset_regions);
|
||||
size_t allocation_runway =
|
||||
gen_heap->young_generation()->heuristics()->bytes_of_allocation_runway_before_gc_trigger(young_cset_regions);
|
||||
gen_heap->compute_old_generation_balance(allocation_runway, old_cset_regions);
|
||||
|
||||
// Total old_available may have been expanded to hold anticipated promotions. We trigger if the fragmented available
|
||||
// memory represents more than 16 regions worth of data. Note that fragmentation may increase when we promote regular
|
||||
// regions in place when many of these regular regions have an abundant amount of available memory within them. Fragmentation
|
||||
// will decrease as promote-by-copy consumes the available memory within these partially consumed regions.
|
||||
// regions in place when many of these regular regions have an abundant amount of available memory within them.
|
||||
// Fragmentation will decrease as promote-by-copy consumes the available memory within these partially consumed regions.
|
||||
//
|
||||
// We consider old-gen to have excessive fragmentation if more than 12.5% of old-gen is free memory that resides
|
||||
// within partially consumed regions of memory.
|
||||
|
||||
@ -167,7 +167,7 @@ inline void ShenandoahMark::do_chunked_array_start(ShenandoahObjToScanQueue* q,
|
||||
|
||||
if (len <= (int) ObjArrayMarkingStride*2) {
|
||||
// A few slices only, process directly
|
||||
array->oop_iterate_range(cl, 0, len);
|
||||
array->oop_iterate_elements_range(cl, 0, len);
|
||||
} else {
|
||||
int bits = log2i_graceful(len);
|
||||
// Compensate for non-power-of-two arrays, cover the array in excess:
|
||||
@ -216,7 +216,7 @@ inline void ShenandoahMark::do_chunked_array_start(ShenandoahObjToScanQueue* q,
|
||||
// Process the irregular tail, if present
|
||||
int from = last_idx;
|
||||
if (from < len) {
|
||||
array->oop_iterate_range(cl, from, len);
|
||||
array->oop_iterate_elements_range(cl, from, len);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -248,7 +248,7 @@ inline void ShenandoahMark::do_chunked_array(ShenandoahObjToScanQueue* q, T* cl,
|
||||
assert (0 < to && to <= len, "to is sane: %d/%d", to, len);
|
||||
#endif
|
||||
|
||||
array->oop_iterate_range(cl, from, to);
|
||||
array->oop_iterate_elements_range(cl, from, to);
|
||||
}
|
||||
|
||||
template <ShenandoahGenerationType GENERATION>
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
|
||||
ShenandoahMetricsSnapshot::ShenandoahMetricsSnapshot(ShenandoahFreeSet* free_set)
|
||||
: _free_set(free_set)
|
||||
, _used_before(free_set->used())
|
||||
, _used_before(free_set->used_not_holding_lock())
|
||||
, _if_before(free_set->internal_fragmentation())
|
||||
, _ef_before(free_set->external_fragmentation()) {
|
||||
}
|
||||
@ -38,7 +38,6 @@ ShenandoahMetricsSnapshot::ShenandoahMetricsSnapshot(ShenandoahFreeSet* free_set
|
||||
bool ShenandoahMetricsSnapshot::is_good_progress() const {
|
||||
// Under the critical threshold?
|
||||
const size_t free_actual = _free_set->available();
|
||||
assert(free_actual != ShenandoahFreeSet::FreeSetUnderConstruction, "Avoid this race");
|
||||
|
||||
// ShenandoahCriticalFreeThreshold is expressed as a percentage. We multiply this percentage by 1/100th
|
||||
// of the soft max capacity to determine whether the available memory within the mutator partition of the
|
||||
@ -52,7 +51,7 @@ bool ShenandoahMetricsSnapshot::is_good_progress() const {
|
||||
}
|
||||
|
||||
// Freed up enough?
|
||||
const size_t used_after = _free_set->used();
|
||||
const size_t used_after = _free_set->used_not_holding_lock();
|
||||
const size_t progress_actual = (_used_before > used_after) ? _used_before - used_after : 0;
|
||||
const size_t progress_expected = ShenandoahHeapRegion::region_size_bytes();
|
||||
const bool prog_used = progress_actual >= progress_expected;
|
||||
|
||||
@ -412,7 +412,11 @@ void ShenandoahOldGeneration::prepare_regions_and_collection_set(bool concurrent
|
||||
ShenandoahGCPhase phase(concurrent ?
|
||||
ShenandoahPhaseTimings::final_rebuild_freeset :
|
||||
ShenandoahPhaseTimings::degen_gc_final_rebuild_freeset);
|
||||
ShenandoahFreeSet* free_set = heap->free_set();
|
||||
ShenandoahHeapLocker locker(heap->lock());
|
||||
|
||||
// This is completion of old-gen marking. We rebuild in order to reclaim immediate garbage and to
|
||||
// prepare for subsequent mixed evacuations.
|
||||
size_t young_trash_regions, old_trash_regions, first_old, last_old, num_old;
|
||||
heap->free_set()->prepare_to_rebuild(young_trash_regions, old_trash_regions, first_old, last_old, num_old);
|
||||
// At the end of old-gen, we may find that we have reclaimed immediate garbage, allowing a longer allocation runway.
|
||||
|
||||
@ -456,7 +456,7 @@ void ZHeapIterator::follow_array_chunk(const ZHeapIteratorContext& context, cons
|
||||
|
||||
// Follow array chunk
|
||||
ZHeapIteratorOopClosure<false /* VisitReferents */> cl(this, context, obj);
|
||||
ZIterator::oop_iterate_range(obj, &cl, start, end);
|
||||
ZIterator::oop_iterate_elements_range(obj, &cl, start, end);
|
||||
}
|
||||
|
||||
template <bool VisitWeaks>
|
||||
|
||||
@ -41,7 +41,7 @@ public:
|
||||
static void oop_iterate(oop obj, OopClosureT* cl);
|
||||
|
||||
template <typename OopClosureT>
|
||||
static void oop_iterate_range(objArrayOop obj, OopClosureT* cl, int start, int end);
|
||||
static void oop_iterate_elements_range(objArrayOop obj, OopClosureT* cl, int start, int end);
|
||||
|
||||
// This function skips invisible roots
|
||||
template <typename Function>
|
||||
|
||||
@ -66,9 +66,9 @@ void ZIterator::oop_iterate(oop obj, OopClosureT* cl) {
|
||||
}
|
||||
|
||||
template <typename OopClosureT>
|
||||
void ZIterator::oop_iterate_range(objArrayOop obj, OopClosureT* cl, int start, int end) {
|
||||
void ZIterator::oop_iterate_elements_range(objArrayOop obj, OopClosureT* cl, int start, int end) {
|
||||
assert(!is_invisible_object_array(obj), "not safe");
|
||||
obj->oop_iterate_range(cl, start, end);
|
||||
obj->oop_iterate_elements_range(cl, start, end);
|
||||
}
|
||||
|
||||
template <typename Function>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -32,6 +32,7 @@
|
||||
#include "jfr/recorder/repository/jfrEmergencyDump.hpp"
|
||||
#include "jfr/recorder/repository/jfrRepository.hpp"
|
||||
#include "jfr/recorder/service/jfrOptionSet.hpp"
|
||||
#include "jfr/recorder/service/jfrRecorderService.hpp"
|
||||
#include "jfr/support/jfrClassDefineEvent.hpp"
|
||||
#include "jfr/support/jfrKlassExtension.hpp"
|
||||
#include "jfr/support/jfrResolution.hpp"
|
||||
@ -43,6 +44,7 @@
|
||||
#include "runtime/java.hpp"
|
||||
#include "runtime/javaThread.hpp"
|
||||
|
||||
|
||||
bool Jfr::is_enabled() {
|
||||
return JfrRecorder::is_enabled();
|
||||
}
|
||||
@ -153,9 +155,9 @@ void Jfr::on_resolution(const Method* caller, const Method* target, TRAPS) {
|
||||
}
|
||||
#endif
|
||||
|
||||
void Jfr::on_vm_shutdown(bool emit_old_object_samples, bool emit_event_shutdown, bool halt) {
|
||||
void Jfr::on_vm_shutdown(bool exception_handler /* false */, bool halt /* false */, bool oom /* false */) {
|
||||
if (!halt && JfrRecorder::is_recording()) {
|
||||
JfrEmergencyDump::on_vm_shutdown(emit_old_object_samples, emit_event_shutdown);
|
||||
JfrEmergencyDump::on_vm_shutdown(exception_handler, oom);
|
||||
}
|
||||
}
|
||||
|
||||
@ -173,6 +175,12 @@ bool Jfr::on_start_flight_recording_option(const JavaVMOption** option, char* de
|
||||
return JfrOptionSet::parse_start_flight_recording_option(option, delimiter);
|
||||
}
|
||||
|
||||
void Jfr::on_report_java_out_of_memory() {
|
||||
if (CrashOnOutOfMemoryError && JfrRecorder::is_recording()) {
|
||||
JfrRecorderService::emit_leakprofiler_events_on_oom();
|
||||
}
|
||||
}
|
||||
|
||||
#if INCLUDE_CDS
|
||||
void Jfr::on_restoration(const Klass* k, JavaThread* jt) {
|
||||
assert(k != nullptr, "invariant");
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -71,7 +71,7 @@ class Jfr : AllStatic {
|
||||
static void on_resolution(const Method* caller, const Method* target, TRAPS);
|
||||
static void on_java_thread_start(JavaThread* starter, JavaThread* startee);
|
||||
static void on_set_current_thread(JavaThread* jt, oop thread);
|
||||
static void on_vm_shutdown(bool emit_old_object_samples, bool emit_event_shutdown, bool halt = false);
|
||||
static void on_vm_shutdown(bool exception_handler = false, bool halt = false, bool oom = false);
|
||||
static void on_vm_error_report(outputStream* st);
|
||||
static bool on_flight_recorder_option(const JavaVMOption** option, char* delimiter);
|
||||
static bool on_start_flight_recording_option(const JavaVMOption** option, char* delimiter);
|
||||
@ -79,6 +79,7 @@ class Jfr : AllStatic {
|
||||
static void initialize_main_thread(JavaThread* jt);
|
||||
static bool has_sample_request(JavaThread* jt);
|
||||
static void check_and_process_sample_request(JavaThread* jt);
|
||||
static void on_report_java_out_of_memory();
|
||||
CDS_ONLY(static void on_restoration(const Klass* k, JavaThread* jt);)
|
||||
};
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -364,8 +364,7 @@ JVM_ENTRY_NO_ENV(void, jfr_set_force_instrumentation(JNIEnv* env, jclass jvm, jb
|
||||
JVM_END
|
||||
|
||||
NO_TRANSITION(void, jfr_emit_old_object_samples(JNIEnv* env, jclass jvm, jlong cutoff_ticks, jboolean emit_all, jboolean skip_bfs))
|
||||
JfrRecorderService service;
|
||||
service.emit_leakprofiler_events(cutoff_ticks, emit_all == JNI_TRUE, skip_bfs == JNI_TRUE);
|
||||
JfrRecorderService::emit_leakprofiler_events(cutoff_ticks, emit_all == JNI_TRUE, skip_bfs == JNI_TRUE);
|
||||
NO_TRANSITION_END
|
||||
|
||||
JVM_ENTRY_NO_ENV(void, jfr_exclude_thread(JNIEnv* env, jclass jvm, jobject t))
|
||||
|
||||
@ -232,41 +232,50 @@ void JfrSamplerThread::task_stacktrace(JfrSampleRequestType type, JavaThread** l
|
||||
JavaThread* start = nullptr;
|
||||
elapsedTimer sample_time;
|
||||
sample_time.start();
|
||||
ThreadsListHandle tlh;
|
||||
// Resolve a sample session relative start position index into the thread list array.
|
||||
// In cases where the last sampled thread is null or not-null but stale, find_index() returns -1.
|
||||
_cur_index = tlh.list()->find_index_of_JavaThread(*last_thread);
|
||||
JavaThread* current = _cur_index != -1 ? *last_thread : nullptr;
|
||||
{
|
||||
/*
|
||||
* Take the Threads_lock for three purposes:
|
||||
*
|
||||
* 1) Avoid sampling right through a safepoint,
|
||||
* which could result in touching oops in case of virtual threads.
|
||||
* 2) Prevent JFR from issuing an epoch rotation while the sampler thread
|
||||
* is actively processing a thread in state native, as both threads are outside the safepoint protocol.
|
||||
* 3) Some operating systems (BSD / Mac) require a process lock when sending a signal with pthread_kill.
|
||||
* Holding the Threads_lock prevents a JavaThread from calling os::create_thread(), which also takes the process lock.
|
||||
* In a sense, we provide a coarse signal mask, so we can always send the resume signal.
|
||||
*/
|
||||
MutexLocker tlock(Threads_lock);
|
||||
ThreadsListHandle tlh;
|
||||
// Resolve a sample session relative start position index into the thread list array.
|
||||
// In cases where the last sampled thread is null or not-null but stale, find_index() returns -1.
|
||||
_cur_index = tlh.list()->find_index_of_JavaThread(*last_thread);
|
||||
JavaThread* current = _cur_index != -1 ? *last_thread : nullptr;
|
||||
|
||||
while (num_samples < sample_limit) {
|
||||
current = next_thread(tlh.list(), start, current);
|
||||
if (current == nullptr) {
|
||||
break;
|
||||
}
|
||||
if (is_excluded(current)) {
|
||||
continue;
|
||||
}
|
||||
if (start == nullptr) {
|
||||
start = current; // remember the thread where we started to attempt sampling
|
||||
}
|
||||
bool success;
|
||||
if (JAVA_SAMPLE == type) {
|
||||
success = sample_java_thread(current);
|
||||
} else {
|
||||
assert(type == NATIVE_SAMPLE, "invariant");
|
||||
success = sample_native_thread(current);
|
||||
}
|
||||
if (success) {
|
||||
num_samples++;
|
||||
}
|
||||
if (SafepointSynchronize::is_at_safepoint()) {
|
||||
// For _thread_in_native, we cannot get the Threads_lock.
|
||||
// For _thread_in_Java, well, there are none.
|
||||
break;
|
||||
while (num_samples < sample_limit) {
|
||||
current = next_thread(tlh.list(), start, current);
|
||||
if (current == nullptr) {
|
||||
break;
|
||||
}
|
||||
if (is_excluded(current)) {
|
||||
continue;
|
||||
}
|
||||
if (start == nullptr) {
|
||||
start = current; // remember the thread where we started to attempt sampling
|
||||
}
|
||||
bool success;
|
||||
if (JAVA_SAMPLE == type) {
|
||||
success = sample_java_thread(current);
|
||||
} else {
|
||||
assert(type == NATIVE_SAMPLE, "invariant");
|
||||
success = sample_native_thread(current);
|
||||
}
|
||||
if (success) {
|
||||
num_samples++;
|
||||
}
|
||||
}
|
||||
|
||||
*last_thread = current; // remember the thread we last attempted to sample
|
||||
}
|
||||
|
||||
*last_thread = current; // remember the thread we last attempted to sample
|
||||
sample_time.stop();
|
||||
log_trace(jfr)("JFR thread sampling done in %3.7f secs with %d java %d native samples",
|
||||
sample_time.seconds(), type == JAVA_SAMPLE ? num_samples : 0, type == NATIVE_SAMPLE ? num_samples : 0);
|
||||
@ -297,6 +306,7 @@ class OSThreadSampler : public SuspendedThreadTask {
|
||||
// Sampling a thread in state _thread_in_Java
|
||||
// involves a platform-specific thread suspend and CPU context retrieval.
|
||||
bool JfrSamplerThread::sample_java_thread(JavaThread* jt) {
|
||||
assert_lock_strong(Threads_lock);
|
||||
if (jt->thread_state() != _thread_in_Java) {
|
||||
return false;
|
||||
}
|
||||
@ -328,6 +338,7 @@ static JfrSamplerThread* _sampler_thread = nullptr;
|
||||
// without thread suspension and CPU context retrieval,
|
||||
// if we carefully order the loads of the thread state.
|
||||
bool JfrSamplerThread::sample_native_thread(JavaThread* jt) {
|
||||
assert_lock_strong(Threads_lock);
|
||||
if (jt->thread_state() != _thread_in_native) {
|
||||
return false;
|
||||
}
|
||||
@ -343,22 +354,6 @@ bool JfrSamplerThread::sample_native_thread(JavaThread* jt) {
|
||||
|
||||
SafepointMechanism::arm_local_poll_release(jt);
|
||||
|
||||
// Take the Threads_lock for two purposes:
|
||||
// 1) Avoid sampling through a safepoint which could result
|
||||
// in touching oops in case of virtual threads.
|
||||
// 2) Prevent JFR from issuing an epoch rotation while the sampler thread
|
||||
// is actively processing a thread in native, as both threads are now
|
||||
// outside the safepoint protocol.
|
||||
|
||||
// OrderAccess::fence() as part of acquiring the lock prevents loads from floating up.
|
||||
JfrMutexTryLock lock(Threads_lock);
|
||||
|
||||
if (!lock.acquired()) {
|
||||
// Remove the native sample request and release the potentially waiting thread.
|
||||
JfrSampleMonitor jsm(tl);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Separate the arming of the poll (above) from the reading of JavaThread state (below).
|
||||
if (UseSystemMemoryBarrier) {
|
||||
SystemMemoryBarrier::emit();
|
||||
@ -367,7 +362,6 @@ bool JfrSamplerThread::sample_native_thread(JavaThread* jt) {
|
||||
}
|
||||
|
||||
if (jt->thread_state() != _thread_in_native || !jt->has_last_Java_frame()) {
|
||||
assert_lock_strong(Threads_lock);
|
||||
JfrSampleMonitor jsm(tl);
|
||||
if (jsm.is_waiting()) {
|
||||
// The thread has already returned from native,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -38,6 +38,8 @@
|
||||
#include "runtime/mutexLocker.hpp"
|
||||
#include "runtime/os.hpp"
|
||||
#include "runtime/thread.inline.hpp"
|
||||
#include "runtime/vmOperations.hpp"
|
||||
#include "runtime/vmThread.hpp"
|
||||
#include "utilities/growableArray.hpp"
|
||||
#include "utilities/ostream.hpp"
|
||||
|
||||
@ -460,15 +462,6 @@ static void release_locks(Thread* thread) {
|
||||
assert(thread != nullptr, "invariant");
|
||||
assert(!thread->is_Java_thread() || JavaThread::cast(thread)->thread_state() == _thread_in_vm, "invariant");
|
||||
|
||||
#ifdef ASSERT
|
||||
Mutex* owned_lock = thread->owned_locks();
|
||||
while (owned_lock != nullptr) {
|
||||
Mutex* next = owned_lock->next();
|
||||
owned_lock->unlock();
|
||||
owned_lock = next;
|
||||
}
|
||||
#endif // ASSERT
|
||||
|
||||
if (Threads_lock->owned_by_self()) {
|
||||
Threads_lock->unlock();
|
||||
}
|
||||
@ -550,17 +543,14 @@ class JavaThreadInVMAndNative : public StackObj {
|
||||
}
|
||||
};
|
||||
|
||||
static void post_events(bool emit_old_object_samples, bool emit_event_shutdown, Thread* thread) {
|
||||
if (emit_old_object_samples) {
|
||||
LeakProfiler::emit_events(max_jlong, false, false);
|
||||
}
|
||||
if (emit_event_shutdown) {
|
||||
static void post_events(bool exception_handler, bool oom, Thread * thread) {
|
||||
if (exception_handler) {
|
||||
EventShutdown e;
|
||||
e.set_reason("VM Error");
|
||||
e.set_reason(oom ? "CrashOnOutOfMemoryError" : "VM Error");
|
||||
e.commit();
|
||||
}
|
||||
EventDumpReason event;
|
||||
event.set_reason(emit_old_object_samples ? "Out of Memory" : "Crash");
|
||||
event.set_reason(exception_handler && oom ? "CrashOnOutOfMemoryError" : exception_handler ? "Crash" : "Out of Memory");
|
||||
event.set_recordingId(-1);
|
||||
event.commit();
|
||||
}
|
||||
@ -594,20 +584,40 @@ static bool guard_reentrancy() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void JfrEmergencyDump::on_vm_shutdown(bool emit_old_object_samples, bool emit_event_shutdown) {
|
||||
void JfrEmergencyDump::on_vm_shutdown(bool exception_handler, bool oom) {
|
||||
if (!guard_reentrancy()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Thread* const thread = Thread::current_or_null_safe();
|
||||
assert(thread != nullptr, "invariant");
|
||||
if (thread->is_Watcher_thread()) {
|
||||
log_info(jfr, system)("The Watcher thread crashed so no jfr emergency dump will be generated.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Ensure a JavaThread is _thread_in_vm when we make this call
|
||||
JavaThreadInVMAndNative jtivm(thread);
|
||||
post_events(exception_handler, oom, thread);
|
||||
|
||||
if (thread->is_Watcher_thread()) {
|
||||
// We cannot attempt an emergency dump using the Watcher thread
|
||||
// because we rely on the WatcherThread task "is_error_reported()",
|
||||
// to exit the VM after a hardcoded timeout, should the relatively
|
||||
// risky operation of an emergency dump fail (deadlock, livelock).
|
||||
log_warning(jfr, system)
|
||||
("The Watcher thread crashed so no jfr emergency dump will be generated.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (thread->is_VM_thread()) {
|
||||
const VM_Operation* const operation = VMThread::vm_operation();
|
||||
if (operation != nullptr && operation->type() == VM_Operation::VMOp_JFROldObject) {
|
||||
// We will not be able to issue a rotation because the rotation lock
|
||||
// is held by the JFR Recorder Thread that issued the VM_Operation.
|
||||
log_warning(jfr, system)
|
||||
("The VM Thread crashed as part of emitting leak profiler events so no jfr emergency dump will be generated.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
release_locks(thread);
|
||||
post_events(emit_old_object_samples, emit_event_shutdown, thread);
|
||||
|
||||
// if JavaThread, transition to _thread_in_native to issue a final flushpoint
|
||||
NoHandleMark nhm;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -39,7 +39,7 @@ class JfrEmergencyDump : AllStatic {
|
||||
static const char* chunk_path(const char* repository_path);
|
||||
static void on_vm_error(const char* repository_path);
|
||||
static void on_vm_error_report(outputStream* st, const char* repository_path);
|
||||
static void on_vm_shutdown(bool emit_old_object_samples, bool emit_event_shutdown);
|
||||
static void on_vm_shutdown(bool exception_handler, bool oom);
|
||||
};
|
||||
|
||||
#endif // SHARE_JFR_RECORDER_REPOSITORY_JFREMERGENCYDUMP_HPP
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -34,7 +34,8 @@
|
||||
(MSGBIT(MSG_START)) | \
|
||||
(MSGBIT(MSG_CLONE_IN_MEMORY)) | \
|
||||
(MSGBIT(MSG_VM_ERROR)) | \
|
||||
(MSGBIT(MSG_FLUSHPOINT)) \
|
||||
(MSGBIT(MSG_FLUSHPOINT)) | \
|
||||
(MSGBIT(MSG_EMIT_LEAKP_REFCHAINS)) \
|
||||
)
|
||||
|
||||
static JfrPostBox* _instance = nullptr;
|
||||
@ -165,7 +166,7 @@ void JfrPostBox::notify_waiters() {
|
||||
assert(JfrMsg_lock->owned_by_self(), "incrementing _msg_handled_serial is protected by JfrMsg_lock.");
|
||||
// Update made visible on release of JfrMsg_lock via fence instruction in Monitor::IUnlock.
|
||||
++_msg_handled_serial;
|
||||
JfrMsg_lock->notify();
|
||||
JfrMsg_lock->notify_all();
|
||||
}
|
||||
|
||||
// safeguard to ensure no threads are left waiting
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2020, 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
|
||||
@ -43,6 +43,7 @@ enum JFR_Msg {
|
||||
MSG_SHUTDOWN,
|
||||
MSG_VM_ERROR,
|
||||
MSG_FLUSHPOINT,
|
||||
MSG_EMIT_LEAKP_REFCHAINS,
|
||||
MSG_NO_OF_MSGS
|
||||
};
|
||||
|
||||
@ -51,23 +52,25 @@ enum JFR_Msg {
|
||||
*
|
||||
* Synchronous messages (posting thread waits for message completion):
|
||||
*
|
||||
* MSG_CLONE_IN_MEMORY (0) ; MSGBIT(MSG_CLONE_IN_MEMORY) == (1 << 0) == 0x1
|
||||
* MSG_START(1) ; MSGBIT(MSG_START) == (1 << 0x1) == 0x2
|
||||
* MSG_STOP (2) ; MSGBIT(MSG_STOP) == (1 << 0x2) == 0x4
|
||||
* MSG_ROTATE (3) ; MSGBIT(MSG_ROTATE) == (1 << 0x3) == 0x8
|
||||
* MSG_VM_ERROR (8) ; MSGBIT(MSG_VM_ERROR) == (1 << 0x8) == 0x100
|
||||
* MSG_FLUSHPOINT (9) ; MSGBIT(MSG_FLUSHPOINT) == (1 << 0x9) == 0x200
|
||||
* MSG_CLONE_IN_MEMORY (0) ; MSGBIT(MSG_CLONE_IN_MEMORY) == (1 << 0) == 0x1
|
||||
* MSG_START(1) ; MSGBIT(MSG_START) == (1 << 0x1) == 0x2
|
||||
* MSG_STOP (2) ; MSGBIT(MSG_STOP) == (1 << 0x2) == 0x4
|
||||
* MSG_ROTATE (3) ; MSGBIT(MSG_ROTATE) == (1 << 0x3) == 0x8
|
||||
* MSG_VM_ERROR (8) ; MSGBIT(MSG_VM_ERROR) == (1 << 0x8) == 0x100
|
||||
* MSG_FLUSHPOINT (9) ; MSGBIT(MSG_FLUSHPOINT) == (1 << 0x9) == 0x200
|
||||
* MSG_EMIT_LEAKP_REFCHAINS (10); MSGBIT(MSG_EMIT_LEAKP_REFCHAINS) == (1 << 0xa) == 0x400
|
||||
*
|
||||
* Asynchronous messages (posting thread returns immediately upon deposit):
|
||||
*
|
||||
* MSG_FULLBUFFER (4) ; MSGBIT(MSG_FULLBUFFER) == (1 << 0x4) == 0x10
|
||||
* MSG_CHECKPOINT (5) ; MSGBIT(CHECKPOINT) == (1 << 0x5) == 0x20
|
||||
* MSG_WAKEUP (6) ; MSGBIT(WAKEUP) == (1 << 0x6) == 0x40
|
||||
* MSG_SHUTDOWN (7) ; MSGBIT(MSG_SHUTDOWN) == (1 << 0x7) == 0x80
|
||||
* MSG_FULLBUFFER (4) ; MSGBIT(MSG_FULLBUFFER) == (1 << 0x4) == 0x10
|
||||
* MSG_CHECKPOINT (5) ; MSGBIT(CHECKPOINT) == (1 << 0x5) == 0x20
|
||||
* MSG_WAKEUP (6) ; MSGBIT(WAKEUP) == (1 << 0x6) == 0x40
|
||||
* MSG_SHUTDOWN (7) ; MSGBIT(MSG_SHUTDOWN) == (1 << 0x7) == 0x80
|
||||
*/
|
||||
|
||||
class JfrPostBox : public JfrCHeapObj {
|
||||
friend class JfrRecorder;
|
||||
friend class JfrRecorderService;
|
||||
public:
|
||||
void post(JFR_Msg msg);
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -55,6 +55,7 @@
|
||||
#include "runtime/safepoint.hpp"
|
||||
#include "runtime/vmOperations.hpp"
|
||||
#include "runtime/vmThread.hpp"
|
||||
#include "utilities/growableArray.hpp"
|
||||
|
||||
// incremented on each flushpoint
|
||||
static u8 flushpoint_id = 0;
|
||||
@ -391,6 +392,7 @@ class JfrSafepointWriteVMOperation : public VM_Operation {
|
||||
JfrRecorderService::JfrRecorderService() :
|
||||
_checkpoint_manager(JfrCheckpointManager::instance()),
|
||||
_chunkwriter(JfrRepository::chunkwriter()),
|
||||
_post_box(JfrPostBox::instance()),
|
||||
_repository(JfrRepository::instance()),
|
||||
_stack_trace_repository(JfrStackTraceRepository::instance()),
|
||||
_storage(JfrStorage::instance()),
|
||||
@ -670,17 +672,173 @@ void JfrRecorderService::evaluate_chunk_size_for_rotation() {
|
||||
JfrChunkRotation::evaluate(_chunkwriter);
|
||||
}
|
||||
|
||||
void JfrRecorderService::emit_leakprofiler_events(int64_t cutoff_ticks, bool emit_all, bool skip_bfs) {
|
||||
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_native(JavaThread::current()));
|
||||
// Take the rotation lock to exclude flush() during event emits. This is because event emit
|
||||
// also creates a number checkpoint events. Those checkpoint events require a future typeset checkpoint
|
||||
// event for completeness, i.e. to be generated before being flushed to a segment.
|
||||
// The upcoming flush() or rotation() after event emit completes this typeset checkpoint
|
||||
// and serializes all event emit checkpoint events to the same segment.
|
||||
JfrRotationLock lock;
|
||||
// Take the rotation lock before the transition.
|
||||
JavaThread* current_thread = JavaThread::current();
|
||||
MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, current_thread));
|
||||
ThreadInVMfromNative transition(current_thread);
|
||||
LeakProfiler::emit_events(cutoff_ticks, emit_all, skip_bfs);
|
||||
// LeakProfiler event serialization support.
|
||||
|
||||
struct JfrLeakProfilerEmitRequest {
|
||||
int64_t cutoff_ticks;
|
||||
bool emit_all;
|
||||
bool skip_bfs;
|
||||
bool oom;
|
||||
};
|
||||
|
||||
typedef GrowableArrayCHeap<JfrLeakProfilerEmitRequest, mtTracing> JfrLeakProfilerEmitRequestQueue;
|
||||
static JfrLeakProfilerEmitRequestQueue* _queue = nullptr;
|
||||
constexpr const static int64_t _no_path_to_gc_roots = 0;
|
||||
static bool _oom_emit_request_posted = false;
|
||||
static bool _oom_emit_request_delivered = false;
|
||||
|
||||
static inline bool exclude_paths_to_gc_roots(int64_t cutoff_ticks) {
|
||||
return cutoff_ticks <= _no_path_to_gc_roots;
|
||||
}
|
||||
|
||||
static void enqueue(const JfrLeakProfilerEmitRequest& request) {
|
||||
assert(JfrRotationLock::is_owner(), "invariant");
|
||||
if (_queue == nullptr) {
|
||||
_queue = new JfrLeakProfilerEmitRequestQueue(4);
|
||||
}
|
||||
assert(_queue != nullptr, "invariant");
|
||||
assert(!_oom_emit_request_posted, "invariant");
|
||||
if (request.oom) {
|
||||
_oom_emit_request_posted = true;
|
||||
}
|
||||
_queue->append(request);
|
||||
}
|
||||
|
||||
static JfrLeakProfilerEmitRequest dequeue() {
|
||||
assert(JfrRotationLock::is_owner(), "invariant");
|
||||
assert(_queue != nullptr, "invariant");
|
||||
assert(_queue->is_nonempty(), "invariant");
|
||||
const JfrLeakProfilerEmitRequest& request = _queue->first();
|
||||
_queue->remove_at(0);
|
||||
return request;
|
||||
}
|
||||
|
||||
// This version of emit excludes path-to-gc-roots, i.e. it skips reference chains.
|
||||
static void emit_leakprofiler_events(bool emit_all, bool skip_bfs, JavaThread* jt) {
|
||||
assert(jt != nullptr, "invariant");
|
||||
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_native(jt));
|
||||
// Take the rotation lock to exclude flush() during event emits. This is because the event emit operation
|
||||
// also creates a number of checkpoint events. Those checkpoint events require a future typeset checkpoint
|
||||
// event for completeness, i.e., to be generated before being flushed to a segment.
|
||||
// The upcoming flush() or rotation() after event emit completes this typeset checkpoint
|
||||
// and serializes all checkpoint events to the same segment.
|
||||
JfrRotationLock lock;
|
||||
// Take the rotation lock before the thread transition, to avoid blocking safepoints.
|
||||
if (_oom_emit_request_posted) {
|
||||
// A request to emit leakprofiler events in response to CrashOnOutOfMemoryError
|
||||
// is pending or has already been completed. We are about to crash at any time now.
|
||||
assert(CrashOnOutOfMemoryError, "invariant");
|
||||
return;
|
||||
}
|
||||
MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, jt));
|
||||
ThreadInVMfromNative transition(jt);
|
||||
// Since we are not requesting path-to-gc-roots, i.e., reference chains, we need not issue a VM_Operation.
|
||||
// Therefore, we can let the requesting thread process the request directly, since it already holds the requisite lock.
|
||||
LeakProfiler::emit_events(_no_path_to_gc_roots, emit_all, skip_bfs);
|
||||
}
|
||||
|
||||
void JfrRecorderService::transition_and_post_leakprofiler_emit_msg(JavaThread* jt) {
|
||||
assert(jt != nullptr, "invariant");
|
||||
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_native(jt);)
|
||||
assert(!JfrRotationLock::is_owner(), "invariant");
|
||||
// Transition to _thread_in_VM and post a synchronous message to the JFR Recorder Thread
|
||||
// for it to process our enqueued request, which includes paths-to-gc-roots, i.e., reference chains.
|
||||
MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, jt));
|
||||
ThreadInVMfromNative transition(jt);
|
||||
_post_box.post(MSG_EMIT_LEAKP_REFCHAINS);
|
||||
}
|
||||
|
||||
// This version of emit includes path-to-gc-roots, i.e., it includes in the request traversing of reference chains.
|
||||
// Traversing reference chains is performed as part of a VM_Operation, and we initiate it from the JFR Recorder Thread.
|
||||
// Because multiple threads can concurrently report_on_java_out_of_memory(), having them all post a synchronous JFR msg,
|
||||
// they rendezvous at a safepoint in a convenient state, ThreadBlockInVM. This mechanism prevents any thread from racing past
|
||||
// this point and begin executing VMError::report_and_die(), until at least one oom request has been delivered.
|
||||
void JfrRecorderService::emit_leakprofiler_events_paths_to_gc_roots(int64_t cutoff_ticks,
|
||||
bool emit_all,
|
||||
bool skip_bfs,
|
||||
bool oom,
|
||||
JavaThread* jt) {
|
||||
assert(jt != nullptr, "invariant");
|
||||
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_native(jt);)
|
||||
assert(!exclude_paths_to_gc_roots(cutoff_ticks), "invariant");
|
||||
|
||||
{
|
||||
JfrRotationLock lock;
|
||||
// Take the rotation lock to read and post a request for the JFR Recorder Thread.
|
||||
if (_oom_emit_request_posted) {
|
||||
if (!oom) {
|
||||
// A request to emit leakprofiler events in response to CrashOnOutOfMemoryError
|
||||
// is pending or has already been completed. We are about to crash at any time now.
|
||||
assert(CrashOnOutOfMemoryError, "invariant");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
assert(!_oom_emit_request_posted, "invariant");
|
||||
JfrLeakProfilerEmitRequest request = { cutoff_ticks, emit_all, skip_bfs, oom };
|
||||
enqueue(request);
|
||||
}
|
||||
}
|
||||
JfrRecorderService service;
|
||||
service.transition_and_post_leakprofiler_emit_msg(jt);
|
||||
}
|
||||
|
||||
// Leakprofiler serialization request, the jdk.jfr.internal.JVM.emitOldObjectSamples() Java entry point.
|
||||
void JfrRecorderService::emit_leakprofiler_events(int64_t cutoff_ticks,
|
||||
bool emit_all,
|
||||
bool skip_bfs) {
|
||||
JavaThread* const jt = JavaThread::current();
|
||||
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_native(jt);)
|
||||
if (exclude_paths_to_gc_roots(cutoff_ticks)) {
|
||||
::emit_leakprofiler_events(emit_all, skip_bfs, jt);
|
||||
return;
|
||||
}
|
||||
emit_leakprofiler_events_paths_to_gc_roots(cutoff_ticks, emit_all, skip_bfs, /* oom */ false, jt);
|
||||
}
|
||||
|
||||
// Leakprofiler serialization request, the report_on_java_out_of_memory VM entry point.
|
||||
void JfrRecorderService::emit_leakprofiler_events_on_oom() {
|
||||
assert(CrashOnOutOfMemoryError, "invariant");
|
||||
if (EventOldObjectSample::is_enabled()) {
|
||||
JavaThread* const jt = JavaThread::current();
|
||||
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_vm(jt);)
|
||||
ThreadToNativeFromVM transition(jt);
|
||||
emit_leakprofiler_events_paths_to_gc_roots(max_jlong, false, false, /* oom */ true, jt);
|
||||
}
|
||||
}
|
||||
|
||||
// The worker routine for the JFR Recorder Thread when processing MSG_EMIT_LEAKP_REFCHAINS messages.
|
||||
void JfrRecorderService::emit_leakprofiler_events() {
|
||||
JavaThread* const jt = JavaThread::current();
|
||||
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_native(jt));
|
||||
// Take the rotation lock before the transition.
|
||||
JfrRotationLock lock;
|
||||
if (_oom_emit_request_delivered) {
|
||||
// A request to emit leakprofiler events in response to CrashOnOutOfMemoryError
|
||||
// has already been completed. We are about to crash at any time now.
|
||||
assert(_oom_emit_request_posted, "invariant");
|
||||
assert(CrashOnOutOfMemoryError, "invariant");
|
||||
return;
|
||||
}
|
||||
|
||||
assert(_queue->is_nonempty(), "invariant");
|
||||
|
||||
{
|
||||
MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, jt));
|
||||
ThreadInVMfromNative transition(jt);
|
||||
while (_queue->is_nonempty()) {
|
||||
const JfrLeakProfilerEmitRequest& request = dequeue();
|
||||
LeakProfiler::emit_events(request.cutoff_ticks, request.emit_all, request.skip_bfs);
|
||||
if (_oom_emit_request_posted && request.oom) {
|
||||
assert(CrashOnOutOfMemoryError, "invariant");
|
||||
_oom_emit_request_delivered = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If processing involved an out-of-memory request, issue an immediate flush operation.
|
||||
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_native(jt));
|
||||
if (_chunkwriter.is_valid() && _oom_emit_request_delivered) {
|
||||
invoke_flush();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -27,19 +27,23 @@
|
||||
|
||||
#include "jfr/utilities/jfrAllocation.hpp"
|
||||
|
||||
class JavaThread;
|
||||
class JfrCheckpointManager;
|
||||
class JfrChunkWriter;
|
||||
class JfrPostBox;
|
||||
class JfrRepository;
|
||||
class JfrStackTraceRepository;
|
||||
class JfrStorage;
|
||||
class JfrStringPool;
|
||||
|
||||
class JfrRecorderService : public StackObj {
|
||||
friend class Jfr;
|
||||
friend class JfrSafepointClearVMOperation;
|
||||
friend class JfrSafepointWriteVMOperation;
|
||||
private:
|
||||
JfrCheckpointManager& _checkpoint_manager;
|
||||
JfrChunkWriter& _chunkwriter;
|
||||
JfrPostBox& _post_box;
|
||||
JfrRepository& _repository;
|
||||
JfrStackTraceRepository& _stack_trace_repository;
|
||||
JfrStorage& _storage;
|
||||
@ -64,6 +68,14 @@ class JfrRecorderService : public StackObj {
|
||||
void invoke_safepoint_write();
|
||||
void post_safepoint_write();
|
||||
|
||||
void transition_and_post_leakprofiler_emit_msg(JavaThread* jt);
|
||||
|
||||
static void emit_leakprofiler_events_on_oom();
|
||||
static void emit_leakprofiler_events_paths_to_gc_roots(int64_t cutoff_ticks,
|
||||
bool emit_all,
|
||||
bool skip_bfs,
|
||||
bool oom,
|
||||
JavaThread* jt);
|
||||
public:
|
||||
JfrRecorderService();
|
||||
void start();
|
||||
@ -72,8 +84,12 @@ class JfrRecorderService : public StackObj {
|
||||
void flushpoint();
|
||||
void process_full_buffers();
|
||||
void evaluate_chunk_size_for_rotation();
|
||||
void emit_leakprofiler_events(int64_t cutoff_ticks, bool emit_all, bool skip_bfs);
|
||||
void emit_leakprofiler_events();
|
||||
|
||||
static bool is_recording();
|
||||
static void emit_leakprofiler_events(int64_t cutoff_ticks,
|
||||
bool emit_all,
|
||||
bool skip_bfs);
|
||||
};
|
||||
|
||||
#endif // SHARE_JFR_RECORDER_SERVICE_JFRRECORDERSERVICE_HPP
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -44,6 +44,7 @@ void recorderthread_entry(JavaThread* thread, JavaThread* unused) {
|
||||
#define ROTATE (msgs & (MSGBIT(MSG_ROTATE)|MSGBIT(MSG_STOP)))
|
||||
#define FLUSHPOINT (msgs & (MSGBIT(MSG_FLUSHPOINT)))
|
||||
#define PROCESS_FULL_BUFFERS (msgs & (MSGBIT(MSG_ROTATE)|MSGBIT(MSG_STOP)|MSGBIT(MSG_FULLBUFFER)))
|
||||
#define LEAKPROFILER_REFCHAINS (msgs & MSGBIT(MSG_EMIT_LEAKP_REFCHAINS))
|
||||
|
||||
JfrPostBox& post_box = JfrRecorderThreadEntry::post_box();
|
||||
log_debug(jfr, system)("Recorder thread STARTED");
|
||||
@ -70,6 +71,9 @@ void recorderthread_entry(JavaThread* thread, JavaThread* unused) {
|
||||
if (PROCESS_FULL_BUFFERS) {
|
||||
service.process_full_buffers();
|
||||
}
|
||||
if (LEAKPROFILER_REFCHAINS) {
|
||||
service.emit_leakprofiler_events();
|
||||
}
|
||||
// Check amount of data written to chunk already
|
||||
// if it warrants asking for a new chunk.
|
||||
service.evaluate_chunk_size_for_rotation();
|
||||
@ -98,5 +102,5 @@ void recorderthread_entry(JavaThread* thread, JavaThread* unused) {
|
||||
#undef ROTATE
|
||||
#undef FLUSHPOINT
|
||||
#undef PROCESS_FULL_BUFFERS
|
||||
#undef SCAVENGE
|
||||
#undef LEAKPROFILER_REFCHAINS
|
||||
}
|
||||
|
||||
@ -135,17 +135,16 @@ class ObjArrayKlass : public ArrayKlass {
|
||||
template <typename T, typename OopClosureType>
|
||||
inline void oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr);
|
||||
|
||||
// Iterate over oop elements within [start, end), and metadata.
|
||||
template <typename T, class OopClosureType>
|
||||
inline void oop_oop_iterate_range(objArrayOop a, OopClosureType* closure, int start, int end);
|
||||
|
||||
public:
|
||||
// Iterate over all oop elements.
|
||||
// Iterate over all oop elements, and no metadata.
|
||||
template <typename T, class OopClosureType>
|
||||
inline void oop_oop_iterate_elements(objArrayOop a, OopClosureType* closure);
|
||||
|
||||
// Iterate over oop elements within index range [start, end), and no metadata.
|
||||
template <typename T, class OopClosureType>
|
||||
inline void oop_oop_iterate_elements_range(objArrayOop a, OopClosureType* closure, int start, int end);
|
||||
|
||||
private:
|
||||
// Iterate over all oop elements with indices within mr.
|
||||
// Iterate over all oop elements bounded by addresses [low, high), and no metadata.
|
||||
template <typename T, class OopClosureType>
|
||||
inline void oop_oop_iterate_elements_bounded(objArrayOop a, OopClosureType* closure, void* low, void* high);
|
||||
|
||||
|
||||
@ -38,10 +38,18 @@
|
||||
|
||||
template <typename T, class OopClosureType>
|
||||
void ObjArrayKlass::oop_oop_iterate_elements(objArrayOop a, OopClosureType* closure) {
|
||||
T* p = (T*)a->base();
|
||||
T* const end = p + a->length();
|
||||
oop_oop_iterate_elements_range<T>(a, closure, 0, a->length());
|
||||
}
|
||||
|
||||
for (;p < end; p++) {
|
||||
// Like oop_oop_iterate but only iterates over a specified range and only used
|
||||
// for objArrayOops.
|
||||
template <typename T, class OopClosureType>
|
||||
void ObjArrayKlass::oop_oop_iterate_elements_range(objArrayOop a, OopClosureType* closure, int start, int end) {
|
||||
T* base = (T*)a->base();
|
||||
T* p = base + start;
|
||||
T* const end_p = base + end;
|
||||
|
||||
for (;p < end_p; ++p) {
|
||||
Devirtualizer::do_oop(closure, p);
|
||||
}
|
||||
}
|
||||
@ -98,24 +106,4 @@ void ObjArrayKlass::oop_oop_iterate_bounded(oop obj, OopClosureType* closure, Me
|
||||
oop_oop_iterate_elements_bounded<T>(a, closure, mr.start(), mr.end());
|
||||
}
|
||||
|
||||
// Like oop_oop_iterate but only iterates over a specified range and only used
|
||||
// for objArrayOops.
|
||||
template <typename T, class OopClosureType>
|
||||
void ObjArrayKlass::oop_oop_iterate_range(objArrayOop a, OopClosureType* closure, int start, int end) {
|
||||
T* low = (T*)a->base() + start;
|
||||
T* high = (T*)a->base() + end;
|
||||
|
||||
oop_oop_iterate_elements_bounded<T>(a, closure, low, high);
|
||||
}
|
||||
|
||||
// Placed here to resolve include cycle between objArrayKlass.inline.hpp and objArrayOop.inline.hpp
|
||||
template <typename OopClosureType>
|
||||
void objArrayOopDesc::oop_iterate_range(OopClosureType* blk, int start, int end) {
|
||||
if (UseCompressedOops) {
|
||||
((ObjArrayKlass*)klass())->oop_oop_iterate_range<narrowOop>(this, blk, start, end);
|
||||
} else {
|
||||
((ObjArrayKlass*)klass())->oop_oop_iterate_range<oop>(this, blk, start, end);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SHARE_OOPS_OBJARRAYKLASS_INLINE_HPP
|
||||
|
||||
@ -83,9 +83,9 @@ class objArrayOopDesc : public arrayOopDesc {
|
||||
Klass* element_klass();
|
||||
|
||||
public:
|
||||
// special iterators for index ranges, returns size of object
|
||||
// Special iterators for an element index range.
|
||||
template <typename OopClosureType>
|
||||
void oop_iterate_range(OopClosureType* blk, int start, int end);
|
||||
void oop_iterate_elements_range(OopClosureType* blk, int start, int end);
|
||||
};
|
||||
|
||||
// See similar requirement for oopDesc.
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
|
||||
#include "oops/access.hpp"
|
||||
#include "oops/arrayOop.hpp"
|
||||
#include "oops/objArrayKlass.inline.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "runtime/globals.hpp"
|
||||
|
||||
@ -51,4 +52,13 @@ inline void objArrayOopDesc::obj_at_put(int index, oop value) {
|
||||
HeapAccess<IS_ARRAY>::oop_store_at(as_oop(), offset, value);
|
||||
}
|
||||
|
||||
template <typename OopClosureType>
|
||||
void objArrayOopDesc::oop_iterate_elements_range(OopClosureType* blk, int start, int end) {
|
||||
if (UseCompressedOops) {
|
||||
((ObjArrayKlass*)klass())->oop_oop_iterate_elements_range<narrowOop>(this, blk, start, end);
|
||||
} else {
|
||||
((ObjArrayKlass*)klass())->oop_oop_iterate_elements_range<oop>(this, blk, start, end);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SHARE_OOPS_OBJARRAYOOP_INLINE_HPP
|
||||
|
||||
@ -1195,7 +1195,7 @@ const Type* XorLNode::Value(PhaseGVN* phase) const {
|
||||
return AddNode::Value(phase);
|
||||
}
|
||||
|
||||
Node* MaxNode::build_min_max_int(Node* a, Node* b, bool is_max) {
|
||||
Node* MinMaxNode::build_min_max_int(Node* a, Node* b, bool is_max) {
|
||||
if (is_max) {
|
||||
return new MaxINode(a, b);
|
||||
} else {
|
||||
@ -1203,7 +1203,7 @@ Node* MaxNode::build_min_max_int(Node* a, Node* b, bool is_max) {
|
||||
}
|
||||
}
|
||||
|
||||
Node* MaxNode::build_min_max_long(PhaseGVN* phase, Node* a, Node* b, bool is_max) {
|
||||
Node* MinMaxNode::build_min_max_long(PhaseGVN* phase, Node* a, Node* b, bool is_max) {
|
||||
if (is_max) {
|
||||
return new MaxLNode(phase->C, a, b);
|
||||
} else {
|
||||
@ -1211,7 +1211,7 @@ Node* MaxNode::build_min_max_long(PhaseGVN* phase, Node* a, Node* b, bool is_max
|
||||
}
|
||||
}
|
||||
|
||||
Node* MaxNode::build_min_max(Node* a, Node* b, bool is_max, bool is_unsigned, const Type* t, PhaseGVN& gvn) {
|
||||
Node* MinMaxNode::build_min_max(Node* a, Node* b, bool is_max, bool is_unsigned, const Type* t, PhaseGVN& gvn) {
|
||||
bool is_int = gvn.type(a)->isa_int();
|
||||
assert(is_int || gvn.type(a)->isa_long(), "int or long inputs");
|
||||
assert(is_int == (gvn.type(b)->isa_int() != nullptr), "inconsistent inputs");
|
||||
@ -1243,7 +1243,7 @@ Node* MaxNode::build_min_max(Node* a, Node* b, bool is_max, bool is_unsigned, co
|
||||
return res;
|
||||
}
|
||||
|
||||
Node* MaxNode::build_min_max_diff_with_zero(Node* a, Node* b, bool is_max, const Type* t, PhaseGVN& gvn) {
|
||||
Node* MinMaxNode::build_min_max_diff_with_zero(Node* a, Node* b, bool is_max, const Type* t, PhaseGVN& gvn) {
|
||||
bool is_int = gvn.type(a)->isa_int();
|
||||
assert(is_int || gvn.type(a)->isa_long(), "int or long inputs");
|
||||
assert(is_int == (gvn.type(b)->isa_int() != nullptr), "inconsistent inputs");
|
||||
@ -1290,7 +1290,7 @@ static bool can_overflow(const TypeLong* t, jlong c) {
|
||||
// Let <x, x_off> = x_operands and <y, y_off> = y_operands.
|
||||
// If x == y and neither add(x, x_off) nor add(y, y_off) overflow, return
|
||||
// add(x, op(x_off, y_off)). Otherwise, return nullptr.
|
||||
Node* MaxNode::extract_add(PhaseGVN* phase, ConstAddOperands x_operands, ConstAddOperands y_operands) {
|
||||
Node* MinMaxNode::extract_add(PhaseGVN* phase, ConstAddOperands x_operands, ConstAddOperands y_operands) {
|
||||
Node* x = x_operands.first;
|
||||
Node* y = y_operands.first;
|
||||
int opcode = Opcode();
|
||||
@ -1327,7 +1327,7 @@ static ConstAddOperands as_add_with_constant(Node* n) {
|
||||
return ConstAddOperands(x, c_type->is_int()->get_con());
|
||||
}
|
||||
|
||||
Node* MaxNode::IdealI(PhaseGVN* phase, bool can_reshape) {
|
||||
Node* MinMaxNode::IdealI(PhaseGVN* phase, bool can_reshape) {
|
||||
Node* n = AddNode::Ideal(phase, can_reshape);
|
||||
if (n != nullptr) {
|
||||
return n;
|
||||
@ -1401,7 +1401,7 @@ Node* MaxINode::Identity(PhaseGVN* phase) {
|
||||
return in(2);
|
||||
}
|
||||
|
||||
return MaxNode::Identity(phase);
|
||||
return MinMaxNode::Identity(phase);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -1434,7 +1434,7 @@ Node* MinINode::Identity(PhaseGVN* phase) {
|
||||
return in(1);
|
||||
}
|
||||
|
||||
return MaxNode::Identity(phase);
|
||||
return MinMaxNode::Identity(phase);
|
||||
}
|
||||
|
||||
//------------------------------add_ring---------------------------------------
|
||||
@ -1564,7 +1564,7 @@ Node* MaxLNode::Identity(PhaseGVN* phase) {
|
||||
return in(2);
|
||||
}
|
||||
|
||||
return MaxNode::Identity(phase);
|
||||
return MinMaxNode::Identity(phase);
|
||||
}
|
||||
|
||||
Node* MaxLNode::Ideal(PhaseGVN* phase, bool can_reshape) {
|
||||
@ -1596,7 +1596,7 @@ Node* MinLNode::Identity(PhaseGVN* phase) {
|
||||
return in(1);
|
||||
}
|
||||
|
||||
return MaxNode::Identity(phase);
|
||||
return MinMaxNode::Identity(phase);
|
||||
}
|
||||
|
||||
Node* MinLNode::Ideal(PhaseGVN* phase, bool can_reshape) {
|
||||
@ -1610,7 +1610,7 @@ Node* MinLNode::Ideal(PhaseGVN* phase, bool can_reshape) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int MaxNode::opposite_opcode() const {
|
||||
int MinMaxNode::opposite_opcode() const {
|
||||
if (Opcode() == max_opcode()) {
|
||||
return min_opcode();
|
||||
} else {
|
||||
@ -1621,7 +1621,7 @@ int MaxNode::opposite_opcode() const {
|
||||
|
||||
// Given a redundant structure such as Max/Min(A, Max/Min(B, C)) where A == B or A == C, return the useful part of the structure.
|
||||
// 'operation' is the node expected to be the inner 'Max/Min(B, C)', and 'operand' is the node expected to be the 'A' operand of the outer node.
|
||||
Node* MaxNode::find_identity_operation(Node* operation, Node* operand) {
|
||||
Node* MinMaxNode::find_identity_operation(Node* operation, Node* operand) {
|
||||
if (operation->Opcode() == Opcode() || operation->Opcode() == opposite_opcode()) {
|
||||
Node* n1 = operation->in(1);
|
||||
Node* n2 = operation->in(2);
|
||||
@ -1645,17 +1645,17 @@ Node* MaxNode::find_identity_operation(Node* operation, Node* operand) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Node* MaxNode::Identity(PhaseGVN* phase) {
|
||||
Node* MinMaxNode::Identity(PhaseGVN* phase) {
|
||||
if (in(1) == in(2)) {
|
||||
return in(1);
|
||||
}
|
||||
|
||||
Node* identity_1 = MaxNode::find_identity_operation(in(2), in(1));
|
||||
Node* identity_1 = MinMaxNode::find_identity_operation(in(2), in(1));
|
||||
if (identity_1 != nullptr) {
|
||||
return identity_1;
|
||||
}
|
||||
|
||||
Node* identity_2 = MaxNode::find_identity_operation(in(1), in(2));
|
||||
Node* identity_2 = MinMaxNode::find_identity_operation(in(1), in(2));
|
||||
if (identity_2 != nullptr) {
|
||||
return identity_2;
|
||||
}
|
||||
|
||||
@ -324,14 +324,16 @@ public:
|
||||
//------------------------------MaxNode----------------------------------------
|
||||
// Max (or min) of 2 values. Included with the ADD nodes because it inherits
|
||||
// all the behavior of addition on a ring.
|
||||
class MaxNode : public AddNode {
|
||||
class MinMaxNode : public AddNode {
|
||||
private:
|
||||
static Node* build_min_max(Node* a, Node* b, bool is_max, bool is_unsigned, const Type* t, PhaseGVN& gvn);
|
||||
static Node* build_min_max_diff_with_zero(Node* a, Node* b, bool is_max, const Type* t, PhaseGVN& gvn);
|
||||
Node* extract_add(PhaseGVN* phase, ConstAddOperands x_operands, ConstAddOperands y_operands);
|
||||
|
||||
public:
|
||||
MaxNode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
|
||||
MinMaxNode(Node* in1, Node* in2) : AddNode(in1, in2) {
|
||||
init_class_id(Class_MinMax);
|
||||
}
|
||||
virtual int Opcode() const = 0;
|
||||
virtual int max_opcode() const = 0;
|
||||
virtual int min_opcode() const = 0;
|
||||
@ -373,9 +375,9 @@ public:
|
||||
//------------------------------MaxINode---------------------------------------
|
||||
// Maximum of 2 integers. Included with the ADD nodes because it inherits
|
||||
// all the behavior of addition on a ring.
|
||||
class MaxINode : public MaxNode {
|
||||
class MaxINode : public MinMaxNode {
|
||||
public:
|
||||
MaxINode( Node *in1, Node *in2 ) : MaxNode(in1,in2) {}
|
||||
MaxINode(Node* in1, Node* in2) : MinMaxNode(in1, in2) {}
|
||||
virtual int Opcode() const;
|
||||
virtual const Type *add_ring( const Type *, const Type * ) const;
|
||||
virtual const Type *add_id() const { return TypeInt::make(min_jint); }
|
||||
@ -390,9 +392,9 @@ public:
|
||||
//------------------------------MinINode---------------------------------------
|
||||
// MINimum of 2 integers. Included with the ADD nodes because it inherits
|
||||
// all the behavior of addition on a ring.
|
||||
class MinINode : public MaxNode {
|
||||
class MinINode : public MinMaxNode {
|
||||
public:
|
||||
MinINode( Node *in1, Node *in2 ) : MaxNode(in1,in2) {}
|
||||
MinINode(Node* in1, Node* in2) : MinMaxNode(in1, in2) {}
|
||||
virtual int Opcode() const;
|
||||
virtual const Type *add_ring( const Type *, const Type * ) const;
|
||||
virtual const Type *add_id() const { return TypeInt::make(max_jint); }
|
||||
@ -406,9 +408,9 @@ public:
|
||||
|
||||
//------------------------------MaxLNode---------------------------------------
|
||||
// MAXimum of 2 longs.
|
||||
class MaxLNode : public MaxNode {
|
||||
class MaxLNode : public MinMaxNode {
|
||||
public:
|
||||
MaxLNode(Compile* C, Node* in1, Node* in2) : MaxNode(in1, in2) {
|
||||
MaxLNode(Compile* C, Node* in1, Node* in2) : MinMaxNode(in1, in2) {
|
||||
init_flags(Flag_is_macro);
|
||||
C->add_macro_node(this);
|
||||
}
|
||||
@ -425,9 +427,9 @@ public:
|
||||
|
||||
//------------------------------MinLNode---------------------------------------
|
||||
// MINimum of 2 longs.
|
||||
class MinLNode : public MaxNode {
|
||||
class MinLNode : public MinMaxNode {
|
||||
public:
|
||||
MinLNode(Compile* C, Node* in1, Node* in2) : MaxNode(in1, in2) {
|
||||
MinLNode(Compile* C, Node* in1, Node* in2) : MinMaxNode(in1, in2) {
|
||||
init_flags(Flag_is_macro);
|
||||
C->add_macro_node(this);
|
||||
}
|
||||
@ -444,9 +446,9 @@ public:
|
||||
|
||||
//------------------------------MaxFNode---------------------------------------
|
||||
// Maximum of 2 floats.
|
||||
class MaxFNode : public MaxNode {
|
||||
class MaxFNode : public MinMaxNode {
|
||||
public:
|
||||
MaxFNode(Node *in1, Node *in2) : MaxNode(in1, in2) {}
|
||||
MaxFNode(Node* in1, Node* in2) : MinMaxNode(in1, in2) {}
|
||||
virtual int Opcode() const;
|
||||
virtual const Type *add_ring(const Type*, const Type*) const;
|
||||
virtual const Type *add_id() const { return TypeF::NEG_INF; }
|
||||
@ -458,9 +460,9 @@ public:
|
||||
|
||||
//------------------------------MinFNode---------------------------------------
|
||||
// Minimum of 2 floats.
|
||||
class MinFNode : public MaxNode {
|
||||
class MinFNode : public MinMaxNode {
|
||||
public:
|
||||
MinFNode(Node *in1, Node *in2) : MaxNode(in1, in2) {}
|
||||
MinFNode(Node* in1, Node* in2) : MinMaxNode(in1, in2) {}
|
||||
virtual int Opcode() const;
|
||||
virtual const Type *add_ring(const Type*, const Type*) const;
|
||||
virtual const Type *add_id() const { return TypeF::POS_INF; }
|
||||
@ -472,9 +474,9 @@ public:
|
||||
|
||||
//------------------------------MaxHFNode--------------------------------------
|
||||
// Maximum of 2 half floats.
|
||||
class MaxHFNode : public MaxNode {
|
||||
class MaxHFNode : public MinMaxNode {
|
||||
public:
|
||||
MaxHFNode(Node* in1, Node* in2) : MaxNode(in1, in2) {}
|
||||
MaxHFNode(Node* in1, Node* in2) : MinMaxNode(in1, in2) {}
|
||||
virtual int Opcode() const;
|
||||
virtual const Type* add_ring(const Type*, const Type*) const;
|
||||
virtual const Type* add_id() const { return TypeH::NEG_INF; }
|
||||
@ -486,9 +488,9 @@ public:
|
||||
|
||||
//------------------------------MinHFNode---------------------------------------
|
||||
// Minimum of 2 half floats.
|
||||
class MinHFNode : public MaxNode {
|
||||
class MinHFNode : public MinMaxNode {
|
||||
public:
|
||||
MinHFNode(Node* in1, Node* in2) : MaxNode(in1, in2) {}
|
||||
MinHFNode(Node* in1, Node* in2) : MinMaxNode(in1, in2) {}
|
||||
virtual int Opcode() const;
|
||||
virtual const Type* add_ring(const Type*, const Type*) const;
|
||||
virtual const Type* add_id() const { return TypeH::POS_INF; }
|
||||
@ -500,9 +502,9 @@ public:
|
||||
|
||||
//------------------------------MaxDNode---------------------------------------
|
||||
// Maximum of 2 doubles.
|
||||
class MaxDNode : public MaxNode {
|
||||
class MaxDNode : public MinMaxNode {
|
||||
public:
|
||||
MaxDNode(Node *in1, Node *in2) : MaxNode(in1, in2) {}
|
||||
MaxDNode(Node* in1, Node* in2) : MinMaxNode(in1, in2) {}
|
||||
virtual int Opcode() const;
|
||||
virtual const Type *add_ring(const Type*, const Type*) const;
|
||||
virtual const Type *add_id() const { return TypeD::NEG_INF; }
|
||||
@ -514,9 +516,9 @@ public:
|
||||
|
||||
//------------------------------MinDNode---------------------------------------
|
||||
// Minimum of 2 doubles.
|
||||
class MinDNode : public MaxNode {
|
||||
class MinDNode : public MinMaxNode {
|
||||
public:
|
||||
MinDNode(Node *in1, Node *in2) : MaxNode(in1, in2) {}
|
||||
MinDNode(Node* in1, Node* in2) : MinMaxNode(in1, in2) {}
|
||||
virtual int Opcode() const;
|
||||
virtual const Type *add_ring(const Type*, const Type*) const;
|
||||
virtual const Type *add_id() const { return TypeD::POS_INF; }
|
||||
|
||||
@ -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
|
||||
@ -1058,6 +1058,39 @@ void ConnectionGraph::updates_after_load_split(Node* data_phi, Node* previous_lo
|
||||
// "new_load" might actually be a constant, parameter, etc.
|
||||
if (new_load->is_Load()) {
|
||||
Node* new_addp = new_load->in(MemNode::Address);
|
||||
|
||||
// If new_load is a Load but not from an AddP, it means that the load is folded into another
|
||||
// load. And since this load is not from a field, we cannot create a unique type for it.
|
||||
// For example:
|
||||
//
|
||||
// if (b) {
|
||||
// Holder h1 = new Holder();
|
||||
// Object o = ...;
|
||||
// h.o = o.getClass();
|
||||
// } else {
|
||||
// Holder h2 = ...;
|
||||
// }
|
||||
// Holder h = Phi(h1, h2);
|
||||
// Object r = h.o;
|
||||
//
|
||||
// Then, splitting r through the merge point results in:
|
||||
//
|
||||
// if (b) {
|
||||
// Holder h1 = new Holder();
|
||||
// Object o = ...;
|
||||
// h.o = o.getClass();
|
||||
// Object o1 = h.o;
|
||||
// } else {
|
||||
// Holder h2 = ...;
|
||||
// Object o2 = h2.o;
|
||||
// }
|
||||
// Object r = Phi(o1, o2);
|
||||
//
|
||||
// In this case, o1 is folded to o.getClass() which is a Load but not from an AddP, but from
|
||||
// an OopHandle that is loaded from the Klass of o.
|
||||
if (!new_addp->is_AddP()) {
|
||||
continue;
|
||||
}
|
||||
Node* base = get_addp_base(new_addp);
|
||||
|
||||
// The base might not be something that we can create an unique
|
||||
|
||||
@ -979,9 +979,9 @@ bool PhaseIdealLoop::create_loop_nest(IdealLoopTree* loop, Node_List &old_new) {
|
||||
|
||||
Node* inner_iters_max = nullptr;
|
||||
if (stride_con > 0) {
|
||||
inner_iters_max = MaxNode::max_diff_with_zero(limit, outer_phi, TypeInteger::bottom(bt), _igvn);
|
||||
inner_iters_max = MinMaxNode::max_diff_with_zero(limit, outer_phi, TypeInteger::bottom(bt), _igvn);
|
||||
} else {
|
||||
inner_iters_max = MaxNode::max_diff_with_zero(outer_phi, limit, TypeInteger::bottom(bt), _igvn);
|
||||
inner_iters_max = MinMaxNode::max_diff_with_zero(outer_phi, limit, TypeInteger::bottom(bt), _igvn);
|
||||
}
|
||||
|
||||
Node* inner_iters_limit = _igvn.integercon(iters_limit, bt);
|
||||
@ -989,7 +989,7 @@ bool PhaseIdealLoop::create_loop_nest(IdealLoopTree* loop, Node_List &old_new) {
|
||||
// Long.MIN_VALUE to Long.MAX_VALUE for instance). Use an unsigned
|
||||
// min.
|
||||
const TypeInteger* inner_iters_actual_range = TypeInteger::make(0, iters_limit, Type::WidenMin, bt);
|
||||
Node* inner_iters_actual = MaxNode::unsigned_min(inner_iters_max, inner_iters_limit, inner_iters_actual_range, _igvn);
|
||||
Node* inner_iters_actual = MinMaxNode::unsigned_min(inner_iters_max, inner_iters_limit, inner_iters_actual_range, _igvn);
|
||||
|
||||
Node* inner_iters_actual_int;
|
||||
if (bt == T_LONG) {
|
||||
@ -1618,7 +1618,7 @@ void PhaseIdealLoop::transform_long_range_checks(int stride_con, const Node_List
|
||||
Node* max_jint_plus_one_long = longcon((jlong)max_jint + 1);
|
||||
Node* max_range = new AddLNode(max_jint_plus_one_long, L);
|
||||
register_new_node(max_range, entry_control);
|
||||
R = MaxNode::unsigned_min(R, max_range, TypeLong::POS, _igvn);
|
||||
R = MinMaxNode::unsigned_min(R, max_range, TypeLong::POS, _igvn);
|
||||
set_subtree_ctrl(R, true);
|
||||
}
|
||||
|
||||
@ -1717,9 +1717,9 @@ void PhaseIdealLoop::transform_long_range_checks(int stride_con, const Node_List
|
||||
}
|
||||
|
||||
Node* PhaseIdealLoop::clamp(Node* R, Node* L, Node* H) {
|
||||
Node* min = MaxNode::signed_min(R, H, TypeLong::LONG, _igvn);
|
||||
Node* min = MinMaxNode::signed_min(R, H, TypeLong::LONG, _igvn);
|
||||
set_subtree_ctrl(min, true);
|
||||
Node* max = MaxNode::signed_max(L, min, TypeLong::LONG, _igvn);
|
||||
Node* max = MinMaxNode::signed_max(L, min, TypeLong::LONG, _igvn);
|
||||
set_subtree_ctrl(max, true);
|
||||
return max;
|
||||
}
|
||||
@ -3485,14 +3485,14 @@ void OuterStripMinedLoopNode::adjust_strip_mined_loop(PhaseIterGVN* igvn) {
|
||||
// the loop body to be run for LoopStripMiningIter.
|
||||
Node* max = nullptr;
|
||||
if (stride > 0) {
|
||||
max = MaxNode::max_diff_with_zero(limit, iv_phi, TypeInt::INT, *igvn);
|
||||
max = MinMaxNode::max_diff_with_zero(limit, iv_phi, TypeInt::INT, *igvn);
|
||||
} else {
|
||||
max = MaxNode::max_diff_with_zero(iv_phi, limit, TypeInt::INT, *igvn);
|
||||
max = MinMaxNode::max_diff_with_zero(iv_phi, limit, TypeInt::INT, *igvn);
|
||||
}
|
||||
// sub is positive and can be larger than the max signed int
|
||||
// value. Use an unsigned min.
|
||||
Node* const_iters = igvn->intcon(scaled_iters);
|
||||
Node* min = MaxNode::unsigned_min(max, const_iters, TypeInt::make(0, scaled_iters, Type::WidenMin), *igvn);
|
||||
Node* min = MinMaxNode::unsigned_min(max, const_iters, TypeInt::make(0, scaled_iters, Type::WidenMin), *igvn);
|
||||
// min is the number of iterations for the next inner loop execution:
|
||||
// unsigned_min(max(limit - iv_phi, 0), scaled_iters) if stride > 0
|
||||
// unsigned_min(max(iv_phi - limit, 0), scaled_iters) if stride < 0
|
||||
|
||||
@ -2577,11 +2577,11 @@ void PhaseMacroExpand::eliminate_opaque_looplimit_macro_nodes() {
|
||||
// a CMoveL construct now. At least until here, the type could be computed
|
||||
// precisely. CMoveL is not so smart, but we can give it at least the best
|
||||
// type we know abouot n now.
|
||||
Node* repl = MaxNode::signed_max(n->in(1), n->in(2), _igvn.type(n), _igvn);
|
||||
Node* repl = MinMaxNode::signed_max(n->in(1), n->in(2), _igvn.type(n), _igvn);
|
||||
_igvn.replace_node(n, repl);
|
||||
success = true;
|
||||
} else if (n->Opcode() == Op_MinL) {
|
||||
Node* repl = MaxNode::signed_min(n->in(1), n->in(2), _igvn.type(n), _igvn);
|
||||
Node* repl = MinMaxNode::signed_min(n->in(1), n->in(2), _igvn.type(n), _igvn);
|
||||
_igvn.replace_node(n, repl);
|
||||
success = true;
|
||||
}
|
||||
|
||||
@ -271,9 +271,9 @@ Node* CMoveNode::Ideal_minmax(PhaseGVN* phase, CMoveNode* cmove) {
|
||||
|
||||
// Create the Min/Max node based on the type and kind
|
||||
if (cmp_op == Op_CmpL) {
|
||||
return MaxNode::build_min_max_long(phase, cmp_l, cmp_r, is_max);
|
||||
return MinMaxNode::build_min_max_long(phase, cmp_l, cmp_r, is_max);
|
||||
} else {
|
||||
return MaxNode::build_min_max_int(cmp_l, cmp_r, is_max);
|
||||
return MinMaxNode::build_min_max_int(cmp_l, cmp_r, is_max);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -130,6 +130,7 @@ class MemBarNode;
|
||||
class MemBarStoreStoreNode;
|
||||
class MemNode;
|
||||
class MergeMemNode;
|
||||
class MinMaxNode;
|
||||
class MoveNode;
|
||||
class MulNode;
|
||||
class MultiNode;
|
||||
@ -809,6 +810,7 @@ public:
|
||||
DEFINE_CLASS_ID(AddP, Node, 9)
|
||||
DEFINE_CLASS_ID(BoxLock, Node, 10)
|
||||
DEFINE_CLASS_ID(Add, Node, 11)
|
||||
DEFINE_CLASS_ID(MinMax, Add, 0)
|
||||
DEFINE_CLASS_ID(Mul, Node, 12)
|
||||
DEFINE_CLASS_ID(ClearArray, Node, 14)
|
||||
DEFINE_CLASS_ID(Halt, Node, 15)
|
||||
@ -986,6 +988,7 @@ public:
|
||||
DEFINE_CLASS_QUERY(MemBar)
|
||||
DEFINE_CLASS_QUERY(MemBarStoreStore)
|
||||
DEFINE_CLASS_QUERY(MergeMem)
|
||||
DEFINE_CLASS_QUERY(MinMax)
|
||||
DEFINE_CLASS_QUERY(Move)
|
||||
DEFINE_CLASS_QUERY(Mul)
|
||||
DEFINE_CLASS_QUERY(Multi)
|
||||
|
||||
@ -762,26 +762,36 @@ bool PhaseGVN::is_dominator_helper(Node *d, Node *n, bool linear_only) {
|
||||
//------------------------------dead_loop_check--------------------------------
|
||||
// Check for a simple dead loop when a data node references itself directly
|
||||
// or through an other data node excluding cons and phis.
|
||||
void PhaseGVN::dead_loop_check( Node *n ) {
|
||||
// Phi may reference itself in a loop
|
||||
if (n != nullptr && !n->is_dead_loop_safe() && !n->is_CFG()) {
|
||||
// Do 2 levels check and only data inputs.
|
||||
bool no_dead_loop = true;
|
||||
uint cnt = n->req();
|
||||
for (uint i = 1; i < cnt && no_dead_loop; i++) {
|
||||
Node *in = n->in(i);
|
||||
if (in == n) {
|
||||
no_dead_loop = false;
|
||||
} else if (in != nullptr && !in->is_dead_loop_safe()) {
|
||||
uint icnt = in->req();
|
||||
for (uint j = 1; j < icnt && no_dead_loop; j++) {
|
||||
if (in->in(j) == n || in->in(j) == in)
|
||||
no_dead_loop = false;
|
||||
}
|
||||
void PhaseGVN::dead_loop_check(Node* n) {
|
||||
// Phi may reference itself in a loop.
|
||||
if (n == nullptr || n->is_dead_loop_safe() || n->is_CFG()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Do 2 levels check and only data inputs.
|
||||
for (uint i = 1; i < n->req(); i++) {
|
||||
Node* in = n->in(i);
|
||||
if (in == n) {
|
||||
n->dump_bfs(100, nullptr, "");
|
||||
fatal("Dead loop detected, node references itself: %s (%d)",
|
||||
n->Name(), n->_idx);
|
||||
}
|
||||
|
||||
if (in == nullptr || in->is_dead_loop_safe()) {
|
||||
continue;
|
||||
}
|
||||
for (uint j = 1; j < in->req(); j++) {
|
||||
if (in->in(j) == n) {
|
||||
n->dump_bfs(100, nullptr, "");
|
||||
fatal("Dead loop detected, node input references current node: %s (%d) -> %s (%d)",
|
||||
in->Name(), in->_idx, n->Name(), n->_idx);
|
||||
}
|
||||
if (in->in(j) == in) {
|
||||
n->dump_bfs(100, nullptr, "");
|
||||
fatal("Dead loop detected, node input references itself: %s (%d)",
|
||||
in->Name(), in->_idx);
|
||||
}
|
||||
}
|
||||
if (!no_dead_loop) { n->dump_bfs(100, nullptr, ""); }
|
||||
assert(no_dead_loop, "dead loop detected");
|
||||
}
|
||||
}
|
||||
|
||||
@ -2623,6 +2633,15 @@ void PhaseIterGVN::add_users_of_use_to_worklist(Node* n, Node* use, Unique_Node_
|
||||
}
|
||||
}
|
||||
}
|
||||
// Check for Max/Min(A, Max/Min(B, C)) where A == B or A == C
|
||||
if (use->is_MinMax()) {
|
||||
for (DUIterator_Fast i2max, i2 = use->fast_outs(i2max); i2 < i2max; i2++) {
|
||||
Node* u = use->fast_out(i2);
|
||||
if (u->Opcode() == use->Opcode()) {
|
||||
worklist.push(u);
|
||||
}
|
||||
}
|
||||
}
|
||||
auto enqueue_init_mem_projs = [&](ProjNode* proj) {
|
||||
add_users_to_worklist0(proj, worklist);
|
||||
};
|
||||
|
||||
@ -1122,7 +1122,7 @@ Node* make_last(Node* initL, jint stride, Node* limitL, PhaseIdealLoop* phase) {
|
||||
Node* last = new AddLNode(initL, k_mul_stride);
|
||||
|
||||
// Make sure that the last does not lie "before" init.
|
||||
Node* last_clamped = MaxNode::build_min_max_long(&igvn, initL, last, stride > 0);
|
||||
Node* last_clamped = MinMaxNode::build_min_max_long(&igvn, initL, last, stride > 0);
|
||||
|
||||
phase->register_new_node_with_ctrl_of(diffL, initL);
|
||||
phase->register_new_node_with_ctrl_of(diffL_m1, initL);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -64,7 +64,6 @@
|
||||
#include "runtime/vm_version.hpp"
|
||||
#include "services/management.hpp"
|
||||
#include "utilities/align.hpp"
|
||||
#include "utilities/checkedCast.hpp"
|
||||
#include "utilities/debug.hpp"
|
||||
#include "utilities/defaultStream.hpp"
|
||||
#include "utilities/macros.hpp"
|
||||
@ -1207,16 +1206,22 @@ bool Arguments::process_settings_file(const char* file_name, bool should_exist,
|
||||
}
|
||||
|
||||
char token[1024];
|
||||
int pos = 0;
|
||||
size_t pos = 0;
|
||||
|
||||
bool in_white_space = true;
|
||||
bool in_comment = false;
|
||||
bool in_quote = false;
|
||||
int quote_c = 0;
|
||||
char quote_c = 0;
|
||||
bool result = true;
|
||||
|
||||
int c = getc(stream);
|
||||
while(c != EOF && pos < (int)(sizeof(token)-1)) {
|
||||
int c_or_eof = getc(stream);
|
||||
while (c_or_eof != EOF && pos < (sizeof(token) - 1)) {
|
||||
// We have checked the c_or_eof for EOF. getc should only ever return the
|
||||
// EOF or an unsigned char converted to an int. We cast down to a char to
|
||||
// avoid the char to int promotions we would otherwise do in the comparisons
|
||||
// below (which would be incorrect if we ever compared to a non-ascii char),
|
||||
// and the int to char conversions we would otherwise do in the assignments.
|
||||
const char c = static_cast<char>(c_or_eof);
|
||||
if (in_white_space) {
|
||||
if (in_comment) {
|
||||
if (c == '\n') in_comment = false;
|
||||
@ -1224,7 +1229,7 @@ bool Arguments::process_settings_file(const char* file_name, bool should_exist,
|
||||
if (c == '#') in_comment = true;
|
||||
else if (!isspace((unsigned char) c)) {
|
||||
in_white_space = false;
|
||||
token[pos++] = checked_cast<char>(c);
|
||||
token[pos++] = c;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -1244,10 +1249,10 @@ bool Arguments::process_settings_file(const char* file_name, bool should_exist,
|
||||
} else if (in_quote && (c == quote_c)) {
|
||||
in_quote = false;
|
||||
} else {
|
||||
token[pos++] = checked_cast<char>(c);
|
||||
token[pos++] = c;
|
||||
}
|
||||
}
|
||||
c = getc(stream);
|
||||
c_or_eof = getc(stream);
|
||||
}
|
||||
if (pos > 0) {
|
||||
token[pos] = '\0';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -466,10 +466,7 @@ void before_exit(JavaThread* thread, bool halt) {
|
||||
event.commit();
|
||||
}
|
||||
|
||||
// 2nd argument (emit_event_shutdown) should be set to false
|
||||
// because EventShutdown would be emitted at Threads::destroy_vm().
|
||||
// (one of the callers of before_exit())
|
||||
JFR_ONLY(Jfr::on_vm_shutdown(true, false, halt);)
|
||||
JFR_ONLY(Jfr::on_vm_shutdown(false, halt);)
|
||||
|
||||
// Stop the WatcherThread. We do this before disenrolling various
|
||||
// PeriodicTasks to reduce the likelihood of races.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -63,6 +63,9 @@
|
||||
#include "utilities/nativeStackPrinter.hpp"
|
||||
#include "utilities/unsigned5.hpp"
|
||||
#include "utilities/vmError.hpp"
|
||||
#if INCLUDE_JFR
|
||||
#include "jfr/jfr.hpp"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
@ -262,6 +265,8 @@ void report_untested(const char* file, int line, const char* message) {
|
||||
void report_java_out_of_memory(const char* message) {
|
||||
static int out_of_memory_reported = 0;
|
||||
|
||||
JFR_ONLY(Jfr::on_report_java_out_of_memory();)
|
||||
|
||||
// A number of threads may attempt to report OutOfMemoryError at around the
|
||||
// same time. To avoid dumping the heap or executing the data collection
|
||||
// commands multiple times we just do it once when the first threads reports
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2024 SAP SE. All rights reserved.
|
||||
* Copyright (c) 2023, 2025, Red Hat, Inc. and/or its affiliates.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
@ -1898,7 +1898,7 @@ void VMError::report_and_die(int id, const char* message, const char* detail_fmt
|
||||
log.set_fd(-1);
|
||||
}
|
||||
|
||||
JFR_ONLY(Jfr::on_vm_shutdown(static_cast<VMErrorType>(_id) == OOM_JAVA_HEAP_FATAL, true);)
|
||||
JFR_ONLY(Jfr::on_vm_shutdown(true, false, static_cast<VMErrorType>(_id) == OOM_JAVA_HEAP_FATAL);)
|
||||
|
||||
if (PrintNMTStatistics) {
|
||||
fdStream fds(fd_out);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1994, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1994, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -1448,6 +1448,7 @@ public final class Integer extends Number
|
||||
* @param divisor the value doing the dividing
|
||||
* @return the unsigned quotient of the first argument divided by
|
||||
* the second argument
|
||||
* @throws ArithmeticException if the divisor is zero
|
||||
* @see #remainderUnsigned
|
||||
* @since 1.8
|
||||
*/
|
||||
@ -1466,6 +1467,7 @@ public final class Integer extends Number
|
||||
* @param divisor the value doing the dividing
|
||||
* @return the unsigned remainder of the first argument divided by
|
||||
* the second argument
|
||||
* @throws ArithmeticException if the divisor is zero
|
||||
* @see #divideUnsigned
|
||||
* @since 1.8
|
||||
*/
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1994, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1994, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -1411,6 +1411,7 @@ public final class Long extends Number
|
||||
* @param divisor the value doing the dividing
|
||||
* @return the unsigned quotient of the first argument divided by
|
||||
* the second argument
|
||||
* @throws ArithmeticException if the divisor is zero
|
||||
* @see #remainderUnsigned
|
||||
* @since 1.8
|
||||
*/
|
||||
@ -1434,6 +1435,7 @@ public final class Long extends Number
|
||||
* @param divisor the value doing the dividing
|
||||
* @return the unsigned remainder of the first argument divided by
|
||||
* the second argument
|
||||
* @throws ArithmeticException if the divisor is zero
|
||||
* @see #divideUnsigned
|
||||
* @since 1.8
|
||||
*/
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -64,9 +64,6 @@ final class SSLConfiguration implements Cloneable {
|
||||
// the configured named groups for the "supported_groups" extensions
|
||||
String[] namedGroups;
|
||||
|
||||
// the maximum protocol version of enabled protocols
|
||||
ProtocolVersion maximumProtocolVersion;
|
||||
|
||||
// Configurations per SSLSocket or SSLEngine instance.
|
||||
boolean isClientMode;
|
||||
boolean enableSessionCreation;
|
||||
@ -249,13 +246,6 @@ final class SSLConfiguration implements Cloneable {
|
||||
CustomizedServerSignatureSchemes.signatureSchemes :
|
||||
SupportedSigSchemes.DEFAULT;
|
||||
this.namedGroups = NamedGroup.SupportedGroups.namedGroups;
|
||||
this.maximumProtocolVersion = ProtocolVersion.NONE;
|
||||
for (ProtocolVersion pv : enabledProtocols) {
|
||||
if (pv.compareTo(maximumProtocolVersion) > 0) {
|
||||
this.maximumProtocolVersion = pv;
|
||||
}
|
||||
}
|
||||
|
||||
// Configurations per SSLSocket or SSLEngine instance.
|
||||
this.isClientMode = isClientMode;
|
||||
this.enableSessionCreation = true;
|
||||
@ -323,13 +313,6 @@ final class SSLConfiguration implements Cloneable {
|
||||
sa = params.getProtocols();
|
||||
if (sa != null) {
|
||||
this.enabledProtocols = ProtocolVersion.namesOf(sa);
|
||||
|
||||
this.maximumProtocolVersion = ProtocolVersion.NONE;
|
||||
for (ProtocolVersion pv : enabledProtocols) {
|
||||
if (pv.compareTo(maximumProtocolVersion) > 0) {
|
||||
this.maximumProtocolVersion = pv;
|
||||
}
|
||||
}
|
||||
} // otherwise, use the default values
|
||||
|
||||
if (params.getNeedClientAuth()) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -144,7 +144,6 @@ final class TransportContext implements ConnectionContext {
|
||||
|
||||
// initial security parameters
|
||||
this.conSession = new SSLSessionImpl();
|
||||
this.protocolVersion = this.sslConfig.maximumProtocolVersion;
|
||||
this.clientVerifyData = emptyByteArray;
|
||||
this.serverVerifyData = emptyByteArray;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1995, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -729,12 +729,13 @@ Java_java_lang_ProcessImpl_forkAndExec(JNIEnv *env,
|
||||
|
||||
if ((fds[0] == -1 && pipe(in) < 0) ||
|
||||
(fds[1] == -1 && pipe(out) < 0) ||
|
||||
(fds[2] == -1 && pipe(err) < 0) ||
|
||||
(fds[2] == -1 && !redirectErrorStream && pipe(err) < 0) || // if not redirecting create the pipe
|
||||
(pipe(childenv) < 0) ||
|
||||
(pipe(fail) < 0)) {
|
||||
throwInternalIOException(env, errno, "Bad file descriptor", mode);
|
||||
goto Catch;
|
||||
}
|
||||
|
||||
c->fds[0] = fds[0];
|
||||
c->fds[1] = fds[1];
|
||||
c->fds[2] = fds[2];
|
||||
@ -764,17 +765,19 @@ Java_java_lang_ProcessImpl_forkAndExec(JNIEnv *env,
|
||||
assert(resultPid != 0);
|
||||
|
||||
if (resultPid < 0) {
|
||||
char * failMessage = "unknown";
|
||||
switch (c->mode) {
|
||||
case MODE_VFORK:
|
||||
throwInternalIOException(env, errno, "vfork failed", c->mode);
|
||||
failMessage = "vfork failed";
|
||||
break;
|
||||
case MODE_FORK:
|
||||
throwInternalIOException(env, errno, "fork failed", c->mode);
|
||||
failMessage = "fork failed";
|
||||
break;
|
||||
case MODE_POSIX_SPAWN:
|
||||
throwInternalIOException(env, errno, "posix_spawn failed", c->mode);
|
||||
failMessage = "posix_spawn failed";
|
||||
break;
|
||||
}
|
||||
throwInternalIOException(env, errno, failMessage, c->mode);
|
||||
goto Catch;
|
||||
}
|
||||
close(fail[1]); fail[1] = -1; /* See: WhyCantJohnnyExec (childproc.c) */
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2020, 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
|
||||
@ -162,8 +162,7 @@ void DAUDIO_GetFormats(INT32 mixerIndex, INT32 deviceID, int isSource, void* cre
|
||||
sampleRate, // sample rate
|
||||
DAUDIO_PCM, // only accept PCM
|
||||
bits == 8 ? FALSE : TRUE, // signed
|
||||
bits == 8 ? FALSE // little-endian for 8bit
|
||||
: UTIL_IsBigEndianPlatform());
|
||||
FALSE); // all supported macOS versions run on LE
|
||||
}
|
||||
}
|
||||
// add default format
|
||||
@ -175,7 +174,7 @@ void DAUDIO_GetFormats(INT32 mixerIndex, INT32 deviceID, int isSource, void* cre
|
||||
defSampleRate, // sample rate
|
||||
DAUDIO_PCM, // PCM
|
||||
TRUE, // signed
|
||||
UTIL_IsBigEndianPlatform()); // native endianness
|
||||
FALSE); // native endianness; all supported macOS versions run on LE
|
||||
}
|
||||
|
||||
TRACE0("<<DAUDIO_GetFormats\n");
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -67,6 +67,7 @@ public class MotifBorders {
|
||||
this.lightShadow = lightShadow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
|
||||
g.setColor((isRaised) ? lightShadow : darkShadow);
|
||||
g.drawLine(x, y, x+w-1, y); // top
|
||||
@ -77,6 +78,7 @@ public class MotifBorders {
|
||||
g.drawLine(x+w-1, y+h-1, x+w-1, y+1); // right
|
||||
}
|
||||
|
||||
@Override
|
||||
public Insets getBorderInsets(Component c, Insets insets) {
|
||||
insets.set(1, 1, 1, 1);
|
||||
return insets;
|
||||
@ -99,6 +101,7 @@ public class MotifBorders {
|
||||
this.focus = focus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
|
||||
if (c.hasFocus()) {
|
||||
g.setColor(focus);
|
||||
@ -109,6 +112,7 @@ public class MotifBorders {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Insets getBorderInsets(Component c, Insets insets) {
|
||||
insets.set(1, 1, 1, 1);
|
||||
return insets;
|
||||
@ -130,6 +134,7 @@ public class MotifBorders {
|
||||
this.focus = focus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
|
||||
boolean isPressed = false;
|
||||
boolean hasFocus = false;
|
||||
@ -187,6 +192,7 @@ public class MotifBorders {
|
||||
g.drawLine(bx1+1, by2, bx2, by2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Insets getBorderInsets(Component c, Insets insets) {
|
||||
int thickness = (c instanceof JButton && ((JButton)c).isDefaultCapable())? 8 : 2;
|
||||
insets.set(thickness, thickness, thickness, thickness);
|
||||
@ -202,6 +208,7 @@ public class MotifBorders {
|
||||
super(shadow, highlight, darkShadow, focus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintBorder(Component c, Graphics g, int x, int y,
|
||||
int width, int height) {
|
||||
if (c instanceof AbstractButton) {
|
||||
@ -223,6 +230,7 @@ public class MotifBorders {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Insets getBorderInsets(Component c, Insets insets) {
|
||||
insets.set(2, 2, 3, 3);
|
||||
return insets;
|
||||
@ -236,6 +244,7 @@ public class MotifBorders {
|
||||
super(shadow, highlight, darkShadow, focus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
|
||||
if (!(c instanceof JMenuBar)) {
|
||||
return;
|
||||
@ -249,6 +258,7 @@ public class MotifBorders {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Insets getBorderInsets(Component c, Insets insets) {
|
||||
insets.set(6, 6, 6, 6);
|
||||
return insets;
|
||||
@ -297,6 +307,7 @@ public class MotifBorders {
|
||||
return frameShadow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Insets getBorderInsets(Component c, Insets newInsets) {
|
||||
newInsets.set(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE);
|
||||
return newInsets;
|
||||
@ -424,6 +435,7 @@ public class MotifBorders {
|
||||
* <b>drawTitleBar</b>, <b>drawLeftBorder</b>, <b>drawRightBorder</b> and
|
||||
* <b>drawBottomBorder</b>.
|
||||
*/
|
||||
@Override
|
||||
public void paintBorder(Component c, Graphics g,
|
||||
int x, int y, int width, int height) {
|
||||
if (isActiveFrame()) {
|
||||
@ -487,6 +499,7 @@ public class MotifBorders {
|
||||
|
||||
/** Draws the InternalFrameBorder's top border.
|
||||
*/
|
||||
@Override
|
||||
protected boolean drawTopBorder(Component c, Graphics g,
|
||||
int x, int y, int width, int height) {
|
||||
if (super.drawTopBorder(c, g, x, y, width, height) &&
|
||||
@ -506,6 +519,7 @@ public class MotifBorders {
|
||||
|
||||
/** Draws the InternalFrameBorder's left border.
|
||||
*/
|
||||
@Override
|
||||
protected boolean drawLeftBorder(Component c, Graphics g, int x, int y,
|
||||
int width, int height) {
|
||||
if (super.drawLeftBorder(c, g, x, y, width, height) &&
|
||||
@ -525,6 +539,7 @@ public class MotifBorders {
|
||||
|
||||
/** Draws the InternalFrameBorder's right border.
|
||||
*/
|
||||
@Override
|
||||
protected boolean drawRightBorder(Component c, Graphics g, int x, int y,
|
||||
int width, int height) {
|
||||
if (super.drawRightBorder(c, g, x, y, width, height) &&
|
||||
@ -545,6 +560,7 @@ public class MotifBorders {
|
||||
|
||||
/** Draws the InternalFrameBorder's bottom border.
|
||||
*/
|
||||
@Override
|
||||
protected boolean drawBottomBorder(Component c, Graphics g, int x, int y,
|
||||
int width, int height) {
|
||||
if (super.drawBottomBorder(c, g, x, y, width, height) &&
|
||||
@ -567,6 +583,7 @@ public class MotifBorders {
|
||||
}
|
||||
|
||||
// Returns true if the associated internal frame has focus.
|
||||
@Override
|
||||
protected boolean isActiveFrame() {
|
||||
return frame.isSelected();
|
||||
}
|
||||
@ -667,6 +684,7 @@ public class MotifBorders {
|
||||
* @param width the width of the painted border
|
||||
* @param height the height of the painted border
|
||||
*/
|
||||
@Override
|
||||
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
|
||||
if (!(c instanceof JPopupMenu)) {
|
||||
return;
|
||||
@ -713,6 +731,7 @@ public class MotifBorders {
|
||||
* @param c the component for which this border insets value applies
|
||||
* @param insets the object to be reinitialized
|
||||
*/
|
||||
@Override
|
||||
public Insets getBorderInsets(Component c, Insets insets) {
|
||||
if (!(c instanceof JPopupMenu)) {
|
||||
return insets;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -42,6 +42,7 @@ public class MotifButtonListener extends BasicButtonListener {
|
||||
super(b);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkOpacity(AbstractButton b) {
|
||||
b.setOpaque( false );
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -74,6 +74,7 @@ public class MotifButtonUI extends BasicButtonUI {
|
||||
// ********************************
|
||||
// Create Listeners
|
||||
// ********************************
|
||||
@Override
|
||||
protected BasicButtonListener createButtonListener(AbstractButton b){
|
||||
return new MotifButtonListener(b);
|
||||
}
|
||||
@ -81,6 +82,7 @@ public class MotifButtonUI extends BasicButtonUI {
|
||||
// ********************************
|
||||
// Install Defaults
|
||||
// ********************************
|
||||
@Override
|
||||
public void installDefaults(AbstractButton b) {
|
||||
super.installDefaults(b);
|
||||
if(!defaults_initialized) {
|
||||
@ -90,6 +92,7 @@ public class MotifButtonUI extends BasicButtonUI {
|
||||
LookAndFeel.installProperty(b, "opaque", Boolean.FALSE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallDefaults(AbstractButton b) {
|
||||
super.uninstallDefaults(b);
|
||||
defaults_initialized = false;
|
||||
@ -106,12 +109,14 @@ public class MotifButtonUI extends BasicButtonUI {
|
||||
// ********************************
|
||||
// Paint Methods
|
||||
// ********************************
|
||||
@Override
|
||||
public void paint(Graphics g, JComponent c) {
|
||||
fillContentArea( g, (AbstractButton)c , c.getBackground() );
|
||||
super.paint(g,c);
|
||||
}
|
||||
|
||||
// Overridden to ensure we don't paint icon over button borders.
|
||||
@Override
|
||||
protected void paintIcon(Graphics g, JComponent c, Rectangle iconRect) {
|
||||
Shape oldClip = g.getClip();
|
||||
Rectangle newClip =
|
||||
@ -127,10 +132,12 @@ public class MotifButtonUI extends BasicButtonUI {
|
||||
g.setClip(oldClip);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect){
|
||||
// focus painting is handled by the border
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintButtonPressed(Graphics g, AbstractButton b) {
|
||||
|
||||
fillContentArea( g, b , selectColor );
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -50,12 +50,14 @@ public class MotifCheckBoxMenuItemUI extends BasicCheckBoxMenuItemUI
|
||||
return new MotifCheckBoxMenuItemUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installListeners() {
|
||||
super.installListeners();
|
||||
changeListener = createChangeListener(menuItem);
|
||||
menuItem.addChangeListener(changeListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallListeners() {
|
||||
super.uninstallListeners();
|
||||
menuItem.removeChangeListener(changeListener);
|
||||
@ -66,23 +68,28 @@ public class MotifCheckBoxMenuItemUI extends BasicCheckBoxMenuItemUI
|
||||
}
|
||||
|
||||
protected class ChangeHandler implements ChangeListener {
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
JMenuItem c = (JMenuItem)e.getSource();
|
||||
LookAndFeel.installProperty(c, "borderPainted", c.isArmed());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MouseInputListener createMouseInputListener(JComponent c) {
|
||||
return new MouseInputHandler();
|
||||
}
|
||||
|
||||
|
||||
protected class MouseInputHandler implements MouseInputListener {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {}
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
MenuSelectionManager manager = MenuSelectionManager.defaultManager();
|
||||
manager.setSelectedPath(getPath());
|
||||
}
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
MenuSelectionManager manager =
|
||||
MenuSelectionManager.defaultManager();
|
||||
@ -99,11 +106,15 @@ public class MotifCheckBoxMenuItemUI extends BasicCheckBoxMenuItemUI
|
||||
manager.processMouseEvent(e);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {}
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {}
|
||||
@Override
|
||||
public void mouseDragged(MouseEvent e) {
|
||||
MenuSelectionManager.defaultManager().processMouseEvent(e);
|
||||
}
|
||||
@Override
|
||||
public void mouseMoved(MouseEvent e) { }
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -60,6 +60,7 @@ public class MotifCheckBoxUI extends MotifRadioButtonUI {
|
||||
return motifCheckBoxUI;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPropertyPrefix() {
|
||||
return propertyPrefix;
|
||||
}
|
||||
@ -67,6 +68,7 @@ public class MotifCheckBoxUI extends MotifRadioButtonUI {
|
||||
// ********************************
|
||||
// Defaults
|
||||
// ********************************
|
||||
@Override
|
||||
public void installDefaults(AbstractButton b) {
|
||||
super.installDefaults(b);
|
||||
if(!defaults_initialized) {
|
||||
@ -75,6 +77,7 @@ public class MotifCheckBoxUI extends MotifRadioButtonUI {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallDefaults(AbstractButton b) {
|
||||
super.uninstallDefaults(b);
|
||||
defaults_initialized = false;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -65,6 +65,7 @@ public class MotifComboBoxUI extends BasicComboBoxUI implements Serializable {
|
||||
return new MotifComboBoxUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void installUI(JComponent c) {
|
||||
super.installUI(c);
|
||||
arrowIcon = new MotifComboBoxArrowIcon(UIManager.getColor("controlHighlight"),
|
||||
@ -72,6 +73,7 @@ public class MotifComboBoxUI extends BasicComboBoxUI implements Serializable {
|
||||
UIManager.getColor("control"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getMinimumSize( JComponent c ) {
|
||||
if ( !isMinimumSizeDirty ) {
|
||||
return new Dimension( cachedMinimumSize );
|
||||
@ -89,6 +91,7 @@ public class MotifComboBoxUI extends BasicComboBoxUI implements Serializable {
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ComboPopup createPopup() {
|
||||
return new MotifComboPopup( comboBox );
|
||||
}
|
||||
@ -106,10 +109,12 @@ public class MotifComboBoxUI extends BasicComboBoxUI implements Serializable {
|
||||
/**
|
||||
* Motif combo popup should not track the mouse in the list.
|
||||
*/
|
||||
@Override
|
||||
public MouseMotionListener createListMouseMotionListener() {
|
||||
return new MouseMotionAdapter() {};
|
||||
}
|
||||
|
||||
@Override
|
||||
public KeyListener createKeyListener() {
|
||||
return super.createKeyListener();
|
||||
}
|
||||
@ -121,6 +126,7 @@ public class MotifComboBoxUI extends BasicComboBoxUI implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installComponents() {
|
||||
if ( comboBox.isEditable() ) {
|
||||
addEditor();
|
||||
@ -129,11 +135,13 @@ public class MotifComboBoxUI extends BasicComboBoxUI implements Serializable {
|
||||
comboBox.add( currentValuePane );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallComponents() {
|
||||
removeEditor();
|
||||
comboBox.removeAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g, JComponent c) {
|
||||
boolean hasFocus = comboBox.hasFocus();
|
||||
Rectangle r;
|
||||
@ -180,6 +188,7 @@ public class MotifComboBoxUI extends BasicComboBoxUI implements Serializable {
|
||||
currentValuePane.removeAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintCurrentValue(Graphics g,Rectangle bounds,boolean hasFocus) {
|
||||
ListCellRenderer<Object> renderer = comboBox.getRenderer();
|
||||
Component c;
|
||||
@ -226,6 +235,7 @@ public class MotifComboBoxUI extends BasicComboBoxUI implements Serializable {
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Rectangle rectangleForCurrentValue() {
|
||||
int width = comboBox.getWidth();
|
||||
int height = comboBox.getHeight();
|
||||
@ -251,11 +261,13 @@ public class MotifComboBoxUI extends BasicComboBoxUI implements Serializable {
|
||||
return arrowIcon.getIconWidth() + (3 * HORIZ_MARGIN) + 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configureEditor() {
|
||||
super.configureEditor();
|
||||
editor.setBackground( UIManager.getColor( "text" ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LayoutManager createLayoutManager() {
|
||||
return new ComboBoxLayoutManager();
|
||||
}
|
||||
@ -273,6 +285,7 @@ public class MotifComboBoxUI extends BasicComboBoxUI implements Serializable {
|
||||
public ComboBoxLayoutManager() {
|
||||
MotifComboBoxUI.this.super();
|
||||
}
|
||||
@Override
|
||||
public void layoutContainer(Container parent) {
|
||||
if ( motifGetEditor() != null ) {
|
||||
Rectangle cvb = rectangleForCurrentValue();
|
||||
@ -298,6 +311,7 @@ public class MotifComboBoxUI extends BasicComboBoxUI implements Serializable {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void paintIcon(Component c, Graphics g, int xo, int yo) {
|
||||
int w = getIconWidth();
|
||||
int h = getIconHeight();
|
||||
@ -322,10 +336,12 @@ public class MotifComboBoxUI extends BasicComboBoxUI implements Serializable {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconWidth() {
|
||||
return 11;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconHeight() {
|
||||
return 11;
|
||||
}
|
||||
@ -336,6 +352,7 @@ public class MotifComboBoxUI extends BasicComboBoxUI implements Serializable {
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
@Override
|
||||
protected PropertyChangeListener createPropertyChangeListener() {
|
||||
return new MotifPropertyChangeListener();
|
||||
}
|
||||
@ -345,6 +362,7 @@ public class MotifComboBoxUI extends BasicComboBoxUI implements Serializable {
|
||||
*/
|
||||
private class MotifPropertyChangeListener
|
||||
extends BasicComboBoxUI.PropertyChangeHandler {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent e) {
|
||||
super.propertyChange(e);
|
||||
String propertyName = e.getPropertyName();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -74,6 +74,7 @@ public class MotifDesktopIconUI extends BasicDesktopIconUI
|
||||
public MotifDesktopIconUI() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installDefaults(){
|
||||
super.installDefaults();
|
||||
setDefaultIcon(UIManager.getIcon("DesktopIcon.icon"));
|
||||
@ -94,12 +95,15 @@ public class MotifDesktopIconUI extends BasicDesktopIconUI
|
||||
JLayeredPane.putLayer(desktopIcon, JLayeredPane.getLayer(frame));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installComponents(){
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallComponents(){
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installListeners(){
|
||||
super.installListeners();
|
||||
desktopIconActionListener = createDesktopIconActionListener();
|
||||
@ -149,6 +153,7 @@ public class MotifDesktopIconUI extends BasicDesktopIconUI
|
||||
return new DesktopIconMouseListener();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallDefaults(){
|
||||
super.uninstallDefaults();
|
||||
desktopIcon.setLayout(null);
|
||||
@ -156,6 +161,7 @@ public class MotifDesktopIconUI extends BasicDesktopIconUI
|
||||
desktopIcon.remove(iconLabel);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallListeners(){
|
||||
super.uninstallListeners();
|
||||
iconButton.removeActionListener(desktopIconActionListener);
|
||||
@ -163,6 +169,7 @@ public class MotifDesktopIconUI extends BasicDesktopIconUI
|
||||
sysMenuTitlePane.uninstallListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getMinimumSize(JComponent c) {
|
||||
JInternalFrame iframe = desktopIcon.getInternalFrame();
|
||||
|
||||
@ -180,10 +187,12 @@ public class MotifDesktopIconUI extends BasicDesktopIconUI
|
||||
return new Dimension(w, h);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getPreferredSize(JComponent c) {
|
||||
return getMinimumSize(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getMaximumSize(JComponent c){
|
||||
return getMinimumSize(c);
|
||||
}
|
||||
@ -213,26 +222,33 @@ public class MotifDesktopIconUI extends BasicDesktopIconUI
|
||||
|
||||
// Forward mouse events to titlebar for moves.
|
||||
addMouseMotionListener(new MouseMotionListener() {
|
||||
@Override
|
||||
public void mouseDragged(MouseEvent e) {
|
||||
forwardEventToParent(e);
|
||||
}
|
||||
@Override
|
||||
public void mouseMoved(MouseEvent e) {
|
||||
forwardEventToParent(e);
|
||||
}
|
||||
});
|
||||
addMouseListener(new MouseListener() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
forwardEventToParent(e);
|
||||
}
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
forwardEventToParent(e);
|
||||
}
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
forwardEventToParent(e);
|
||||
}
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
forwardEventToParent(e);
|
||||
}
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
forwardEventToParent(e);
|
||||
}
|
||||
@ -251,16 +267,19 @@ public class MotifDesktopIconUI extends BasicDesktopIconUI
|
||||
getParent().dispatchEvent(newEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean isFocusTraversable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getMinimumSize() {
|
||||
return new Dimension(defaultIcon.getIconWidth() + 1,
|
||||
LABEL_HEIGHT + LABEL_DIVIDER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getPreferredSize() {
|
||||
String title = frame.getTitle();
|
||||
FontMetrics fm = frame.getFontMetrics(defaultTitleFont);
|
||||
@ -271,6 +290,7 @@ public class MotifDesktopIconUI extends BasicDesktopIconUI
|
||||
return new Dimension(w, LABEL_HEIGHT + LABEL_DIVIDER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
super.paint(g);
|
||||
|
||||
@ -308,28 +328,35 @@ public class MotifDesktopIconUI extends BasicDesktopIconUI
|
||||
this.icon = icon;
|
||||
// Forward mouse events to titlebar for moves.
|
||||
addMouseMotionListener(new MouseMotionListener() {
|
||||
@Override
|
||||
public void mouseDragged(MouseEvent e) {
|
||||
forwardEventToParent(e);
|
||||
}
|
||||
@Override
|
||||
public void mouseMoved(MouseEvent e) {
|
||||
forwardEventToParent(e);
|
||||
}
|
||||
});
|
||||
addMouseListener(new MouseListener() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
forwardEventToParent(e);
|
||||
}
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
forwardEventToParent(e);
|
||||
}
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
if (!systemMenu.isShowing()) {
|
||||
forwardEventToParent(e);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
forwardEventToParent(e);
|
||||
}
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
forwardEventToParent(e);
|
||||
}
|
||||
@ -347,6 +374,7 @@ public class MotifDesktopIconUI extends BasicDesktopIconUI
|
||||
getParent().dispatchEvent(newEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean isFocusTraversable() {
|
||||
return false;
|
||||
@ -355,6 +383,7 @@ public class MotifDesktopIconUI extends BasicDesktopIconUI
|
||||
|
||||
|
||||
protected class DesktopIconActionListener implements ActionListener {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e){
|
||||
systemMenu.show(iconButton, 0, getDesktopIcon().getHeight());
|
||||
}
|
||||
@ -362,6 +391,7 @@ public class MotifDesktopIconUI extends BasicDesktopIconUI
|
||||
|
||||
protected class DesktopIconMouseListener extends MouseAdapter {
|
||||
// if we drag or move we should deengage the popup
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e){
|
||||
if (e.getClickCount() > 1) {
|
||||
try {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -59,6 +59,7 @@ public class MotifDesktopPaneUI extends javax.swing.plaf.basic.BasicDesktopPaneU
|
||||
public MotifDesktopPaneUI() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installDesktopManager() {
|
||||
desktopManager = desktop.getDesktopManager();
|
||||
if(desktopManager == null) {
|
||||
@ -75,6 +76,7 @@ public class MotifDesktopPaneUI extends javax.swing.plaf.basic.BasicDesktopPaneU
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
private static class DragPane extends JComponent {
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
g.setColor(Color.darkGray);
|
||||
g.drawRect(0, 0, getWidth()-1, getHeight()-1);
|
||||
@ -92,6 +94,7 @@ public class MotifDesktopPaneUI extends javax.swing.plaf.basic.BasicDesktopPaneU
|
||||
int iconWidth, iconHeight;
|
||||
|
||||
// PENDING(klobad) this should be optimized
|
||||
@Override
|
||||
public void setBoundsForFrame(JComponent f, int newX, int newY,
|
||||
int newWidth, int newHeight) {
|
||||
if(!usingDragPane) {
|
||||
@ -112,6 +115,7 @@ public class MotifDesktopPaneUI extends javax.swing.plaf.basic.BasicDesktopPaneU
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beginDraggingFrame(JComponent f) {
|
||||
usingDragPane = false;
|
||||
if(f.getParent() instanceof JLayeredPane) {
|
||||
@ -125,10 +129,12 @@ public class MotifDesktopPaneUI extends javax.swing.plaf.basic.BasicDesktopPaneU
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dragFrame(JComponent f, int newX, int newY) {
|
||||
setBoundsForFrame(f, newX, newY, f.getWidth(), f.getHeight());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endDraggingFrame(JComponent f) {
|
||||
if(usingDragPane) {
|
||||
layeredPaneForDragPane.remove(dragPane);
|
||||
@ -143,6 +149,7 @@ public class MotifDesktopPaneUI extends javax.swing.plaf.basic.BasicDesktopPaneU
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beginResizingFrame(JComponent f, int direction) {
|
||||
usingDragPane = false;
|
||||
if(f.getParent() instanceof JLayeredPane) {
|
||||
@ -157,11 +164,13 @@ public class MotifDesktopPaneUI extends javax.swing.plaf.basic.BasicDesktopPaneU
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resizeFrame(JComponent f, int newX, int newY,
|
||||
int newWidth, int newHeight) {
|
||||
setBoundsForFrame(f, newX, newY, newWidth, newHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endResizingFrame(JComponent f) {
|
||||
if(usingDragPane) {
|
||||
JLayeredPane p = (JLayeredPane)f.getParent();
|
||||
@ -172,6 +181,7 @@ public class MotifDesktopPaneUI extends javax.swing.plaf.basic.BasicDesktopPaneU
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void iconifyFrame(JInternalFrame f) {
|
||||
JInternalFrame.JDesktopIcon icon = f.getDesktopIcon();
|
||||
Point p = icon.getLocation();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -55,6 +55,7 @@ public class MotifEditorPaneUI extends BasicEditorPaneUI {
|
||||
*
|
||||
* @return the caret object
|
||||
*/
|
||||
@Override
|
||||
protected Caret createCaret() {
|
||||
return MotifTextUI.createCaret();
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -141,6 +141,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
super(filechooser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFileName() {
|
||||
if(filenameTextField != null) {
|
||||
return filenameTextField.getText();
|
||||
@ -149,30 +150,37 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFileName(String filename) {
|
||||
if(filenameTextField != null) {
|
||||
filenameTextField.setText(filename);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDirectoryName() {
|
||||
return pathField.getText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDirectoryName(String dirname) {
|
||||
pathField.setText(dirname);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ensureFileIsVisible(JFileChooser fc, File f) {
|
||||
// PENDING(jeff)
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rescanCurrentDirectory(JFileChooser fc) {
|
||||
getModel().validateFileCache();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PropertyChangeListener createPropertyChangeListener(JFileChooser fc) {
|
||||
return new PropertyChangeListener() {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent e) {
|
||||
String prop = e.getPropertyName();
|
||||
if(prop.equals(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY)) {
|
||||
@ -266,10 +274,12 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
return new MotifFileChooserUI((JFileChooser)c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void installUI(JComponent c) {
|
||||
super.installUI(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninstallUI(JComponent c) {
|
||||
c.removePropertyChangeListener(filterComboBoxModel);
|
||||
approveButton.removeActionListener(getApproveSelectionAction());
|
||||
@ -277,11 +287,13 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
super.uninstallUI(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void installComponents(JFileChooser fc) {
|
||||
fc.setLayout(new BorderLayout(10, 10));
|
||||
fc.setAlignmentX(JComponent.CENTER_ALIGNMENT);
|
||||
|
||||
JPanel interior = new JPanel() {
|
||||
@Override
|
||||
public Insets getInsets() {
|
||||
return insets;
|
||||
}
|
||||
@ -305,6 +317,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
}
|
||||
|
||||
JTextField tmp1 = new JTextField(curDirName, 35) {
|
||||
@Override
|
||||
public Dimension getMaximumSize() {
|
||||
Dimension d = super.getMaximumSize();
|
||||
d.height = getPreferredSize().height;
|
||||
@ -340,6 +353,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
leftPanel.add(l);
|
||||
|
||||
JComboBox<FileFilter> tmp2 = new JComboBox<FileFilter>() {
|
||||
@Override
|
||||
public Dimension getMaximumSize() {
|
||||
Dimension d = super.getMaximumSize();
|
||||
d.height = getPreferredSize().height;
|
||||
@ -417,6 +431,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
interior.add(fileNameLabel);
|
||||
|
||||
JTextField tmp3 = new JTextField(35) {
|
||||
@Override
|
||||
public Dimension getMaximumSize() {
|
||||
Dimension d = super.getMaximumSize();
|
||||
d.height = getPreferredSize().height;
|
||||
@ -441,6 +456,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
buttonPanel.add(Box.createGlue());
|
||||
|
||||
JButton tmp4 = new JButton(getApproveButtonText(fc)) {
|
||||
@Override
|
||||
public Dimension getMaximumSize() {
|
||||
return new Dimension(MAX_SIZE.width, this.getPreferredSize().height);
|
||||
}
|
||||
@ -456,6 +472,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
buttonPanel.add(Box.createGlue());
|
||||
|
||||
JButton updateButton = new JButton(updateButtonText) {
|
||||
@Override
|
||||
public Dimension getMaximumSize() {
|
||||
return new Dimension(MAX_SIZE.width, this.getPreferredSize().height);
|
||||
}
|
||||
@ -470,6 +487,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
buttonPanel.add(Box.createGlue());
|
||||
|
||||
JButton cancelButton = new JButton(cancelButtonText) {
|
||||
@Override
|
||||
public Dimension getMaximumSize() {
|
||||
return new Dimension(MAX_SIZE.width, this.getPreferredSize().height);
|
||||
}
|
||||
@ -484,6 +502,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
buttonPanel.add(Box.createGlue());
|
||||
|
||||
JButton helpButton = new JButton(helpButtonText) {
|
||||
@Override
|
||||
public Dimension getMaximumSize() {
|
||||
return new Dimension(MAX_SIZE.width, this.getPreferredSize().height);
|
||||
}
|
||||
@ -520,6 +539,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninstallComponents(JFileChooser fc) {
|
||||
fc.removeAll();
|
||||
bottomPanel = null;
|
||||
@ -528,6 +548,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installStrings(JFileChooser fc) {
|
||||
super.installStrings(fc);
|
||||
|
||||
@ -555,11 +576,13 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
return SwingUtilities2.getUIDefaultsInt(key, l);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installIcons(JFileChooser fc) {
|
||||
// Since motif doesn't have button icons, leave this empty
|
||||
// which overrides the supertype icon loading
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallIcons(JFileChooser fc) {
|
||||
// Since motif doesn't have button icons, leave this empty
|
||||
// which overrides the supertype icon loading
|
||||
@ -580,6 +603,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
fileList.addListSelectionListener(createListSelectionListener(getFileChooser()));
|
||||
fileList.addMouseListener(createDoubleClickListener(getFileChooser(), fileList));
|
||||
fileList.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
JFileChooser chooser = getFileChooser();
|
||||
if (SwingUtilities.isLeftMouseButton(e) && !chooser.isMultiSelectionEnabled()) {
|
||||
@ -650,6 +674,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
protected class FileCellRenderer extends DefaultListCellRenderer {
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList<?> list, Object value, int index,
|
||||
boolean isSelected, boolean cellHasFocus) {
|
||||
|
||||
@ -665,6 +690,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
protected class DirectoryCellRenderer extends DefaultListCellRenderer {
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList<?> list, Object value, int index,
|
||||
boolean isSelected, boolean cellHasFocus) {
|
||||
|
||||
@ -684,18 +710,22 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
getModel().addListDataListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return getModel().getDirectories().size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getElementAt(int index) {
|
||||
return getModel().getDirectories().elementAt(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void intervalAdded(ListDataEvent e) {
|
||||
fireIntervalAdded(this, e.getIndex0(), e.getIndex1());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void intervalRemoved(ListDataEvent e) {
|
||||
fireIntervalRemoved(this, e.getIndex0(), e.getIndex1());
|
||||
}
|
||||
@ -709,6 +739,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
|
||||
// PENDING(jeff) - fire the correct interval changed - currently sending
|
||||
// out that everything has changed
|
||||
@Override
|
||||
public void contentsChanged(ListDataEvent e) {
|
||||
fireContentsChanged();
|
||||
}
|
||||
@ -721,6 +752,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
getModel().addListDataListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return getModel().getFiles().size();
|
||||
}
|
||||
@ -733,14 +765,17 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
return getModel().getFiles().indexOf(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getElementAt(int index) {
|
||||
return getModel().getFiles().elementAt(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void intervalAdded(ListDataEvent e) {
|
||||
fireIntervalAdded(this, e.getIndex0(), e.getIndex1());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void intervalRemoved(ListDataEvent e) {
|
||||
fireIntervalRemoved(this, e.getIndex0(), e.getIndex1());
|
||||
}
|
||||
@ -753,6 +788,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
}
|
||||
|
||||
// PENDING(jeff) - fire the interval changed
|
||||
@Override
|
||||
public void contentsChanged(ListDataEvent e) {
|
||||
fireContentsChanged();
|
||||
}
|
||||
@ -779,6 +815,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
*/
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
public class FilterComboBoxRenderer extends DefaultListCellRenderer {
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList<?> list,
|
||||
Object value, int index, boolean isSelected,
|
||||
boolean cellHasFocus) {
|
||||
@ -805,6 +842,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
filters = getFileChooser().getChoosableFileFilters();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent e) {
|
||||
String prop = e.getPropertyName();
|
||||
if(prop.equals(JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY)) {
|
||||
@ -815,6 +853,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelectedItem(Object filter) {
|
||||
if(filter != null) {
|
||||
getFileChooser().setFileFilter((FileFilter) filter);
|
||||
@ -822,6 +861,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getSelectedItem() {
|
||||
// Ensure that the current filter is in the list.
|
||||
// NOTE: we shouldn't have to do this, since JFileChooser adds
|
||||
@ -843,6 +883,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
return getFileChooser().getFileFilter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
if(filters != null) {
|
||||
return filters.length;
|
||||
@ -851,6 +892,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileFilter getElementAt(int index) {
|
||||
if(index > getSize() - 1) {
|
||||
// This shouldn't happen. Try to recover gracefully.
|
||||
@ -864,6 +906,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JButton getApproveButton(JFileChooser fc) {
|
||||
return approveButton;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -93,6 +93,7 @@ public class MotifIconFactory implements Serializable
|
||||
private Color highlight = UIManager.getColor("controlHighlight");
|
||||
private Color lightShadow = UIManager.getColor("controlLightShadow");
|
||||
|
||||
@Override
|
||||
public void paintIcon(Component c, Graphics g, int x, int y) {
|
||||
AbstractButton b = (AbstractButton) c;
|
||||
ButtonModel model = b.getModel();
|
||||
@ -158,10 +159,12 @@ public class MotifIconFactory implements Serializable
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconWidth() {
|
||||
return csize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconHeight() {
|
||||
return csize;
|
||||
}
|
||||
@ -258,6 +261,7 @@ public class MotifIconFactory implements Serializable
|
||||
private Color highlight = UIManager.getColor("controlHighlight");
|
||||
private Color shadow = UIManager.getColor("controlShadow");
|
||||
|
||||
@Override
|
||||
public void paintIcon(Component c, Graphics g, int x, int y) {
|
||||
// fill interior
|
||||
AbstractButton b = (AbstractButton) c;
|
||||
@ -303,10 +307,12 @@ public class MotifIconFactory implements Serializable
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconWidth() {
|
||||
return 14;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconHeight() {
|
||||
return 14;
|
||||
}
|
||||
@ -315,10 +321,13 @@ public class MotifIconFactory implements Serializable
|
||||
@SuppressWarnings("serial") // Same-version serialization only
|
||||
private static class MenuItemCheckIcon implements Icon, UIResource, Serializable
|
||||
{
|
||||
@Override
|
||||
public void paintIcon(Component c,Graphics g, int x, int y)
|
||||
{
|
||||
}
|
||||
@Override
|
||||
public int getIconWidth() { return 0; }
|
||||
@Override
|
||||
public int getIconHeight() { return 0; }
|
||||
} // end class MenuItemCheckIcon
|
||||
|
||||
@ -326,10 +335,13 @@ public class MotifIconFactory implements Serializable
|
||||
@SuppressWarnings("serial") // Same-version serialization only
|
||||
private static class MenuItemArrowIcon implements Icon, UIResource, Serializable
|
||||
{
|
||||
@Override
|
||||
public void paintIcon(Component c,Graphics g, int x, int y)
|
||||
{
|
||||
}
|
||||
@Override
|
||||
public int getIconWidth() { return 0; }
|
||||
@Override
|
||||
public int getIconHeight() { return 0; }
|
||||
} // end class MenuItemArrowIcon
|
||||
|
||||
@ -340,6 +352,7 @@ public class MotifIconFactory implements Serializable
|
||||
private Color shadow = UIManager.getColor("controlShadow");
|
||||
private Color highlight = UIManager.getColor("controlHighlight");
|
||||
|
||||
@Override
|
||||
public void paintIcon(Component c, Graphics g, int x, int y) {
|
||||
AbstractButton b = (AbstractButton) c;
|
||||
ButtonModel model = b.getModel();
|
||||
@ -414,7 +427,9 @@ public class MotifIconFactory implements Serializable
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public int getIconWidth() { return 10; }
|
||||
@Override
|
||||
public int getIconHeight() { return 10; }
|
||||
} // End class MenuArrowIcon
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -66,20 +66,24 @@ public class MotifInternalFrameTitlePane
|
||||
super(frame);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installDefaults() {
|
||||
setFont(UIManager.getFont("InternalFrame.titleFont"));
|
||||
setPreferredSize(new Dimension(100, BUTTON_SIZE));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallListeners() {
|
||||
// Get around protected method in superclass
|
||||
super.uninstallListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PropertyChangeListener createPropertyChangeListener() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LayoutManager createLayout() {
|
||||
return this;
|
||||
}
|
||||
@ -88,6 +92,7 @@ public class MotifInternalFrameTitlePane
|
||||
return systemMenu;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void assembleSystemMenu() {
|
||||
systemMenu = new JPopupMenu();
|
||||
JMenuItem mi = systemMenu.add(restoreAction);
|
||||
@ -106,12 +111,14 @@ public class MotifInternalFrameTitlePane
|
||||
|
||||
systemButton = new SystemButton();
|
||||
systemButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
systemMenu.show(systemButton, 0, BUTTON_SIZE);
|
||||
}
|
||||
});
|
||||
|
||||
systemButton.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mousePressed(MouseEvent evt) {
|
||||
try {
|
||||
frame.setSelected(true);
|
||||
@ -137,6 +144,7 @@ public class MotifInternalFrameTitlePane
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createButtons() {
|
||||
minimizeButton = new MinimizeButton();
|
||||
minimizeButton.addActionListener(iconifyAction);
|
||||
@ -146,6 +154,7 @@ public class MotifInternalFrameTitlePane
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void addSubComponents() {
|
||||
title = new Title(frame.getTitle());
|
||||
title.setFont(getFont());
|
||||
@ -156,6 +165,7 @@ public class MotifInternalFrameTitlePane
|
||||
add(maximizeButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
}
|
||||
|
||||
@ -165,9 +175,11 @@ public class MotifInternalFrameTitlePane
|
||||
shadow = s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
String prop = evt.getPropertyName();
|
||||
JInternalFrame f = (JInternalFrame)evt.getSource();
|
||||
@ -194,16 +206,21 @@ public class MotifInternalFrameTitlePane
|
||||
enableActions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addLayoutComponent(String name, Component c) {}
|
||||
@Override
|
||||
public void removeLayoutComponent(Component c) {}
|
||||
@Override
|
||||
public Dimension preferredLayoutSize(Container c) {
|
||||
return minimumLayoutSize(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension minimumLayoutSize(Container c) {
|
||||
return new Dimension(100, BUTTON_SIZE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void layoutContainer(Container c) {
|
||||
int w = getWidth();
|
||||
systemButton.setBounds(0, 0, BUTTON_SIZE, BUTTON_SIZE);
|
||||
@ -226,6 +243,7 @@ public class MotifInternalFrameTitlePane
|
||||
title.setBounds(BUTTON_SIZE, 0, x, BUTTON_SIZE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void showSystemMenu(){
|
||||
systemMenu.show(systemButton, 0, BUTTON_SIZE);
|
||||
}
|
||||
@ -245,23 +263,28 @@ public class MotifInternalFrameTitlePane
|
||||
setBorderPainted(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean isFocusTraversable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestFocus() {
|
||||
// ignore request.
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getMinimumSize() {
|
||||
return buttonDimension;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getPreferredSize() {
|
||||
return buttonDimension;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
Dimension d = getSize();
|
||||
int maxX = d.width - 1;
|
||||
@ -284,6 +307,7 @@ public class MotifInternalFrameTitlePane
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
private class MinimizeButton extends FrameButton {
|
||||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
super.paintComponent(g);
|
||||
g.setColor(highlight);
|
||||
@ -297,6 +321,7 @@ public class MotifInternalFrameTitlePane
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
private class MaximizeButton extends FrameButton {
|
||||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
super.paintComponent(g);
|
||||
int max = BUTTON_SIZE - 5;
|
||||
@ -312,9 +337,12 @@ public class MotifInternalFrameTitlePane
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
private class SystemButton extends FrameButton {
|
||||
@Override
|
||||
public boolean isFocusTraversable() { return false; }
|
||||
@Override
|
||||
public void requestFocus() {}
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
super.paintComponent(g);
|
||||
g.setColor(highlight);
|
||||
@ -339,26 +367,33 @@ public class MotifInternalFrameTitlePane
|
||||
|
||||
// Forward mouse events to titlebar for moves.
|
||||
addMouseMotionListener(new MouseMotionListener() {
|
||||
@Override
|
||||
public void mouseDragged(MouseEvent e) {
|
||||
forwardEventToParent(e);
|
||||
}
|
||||
@Override
|
||||
public void mouseMoved(MouseEvent e) {
|
||||
forwardEventToParent(e);
|
||||
}
|
||||
});
|
||||
addMouseListener(new MouseListener() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
forwardEventToParent(e);
|
||||
}
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
forwardEventToParent(e);
|
||||
}
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
forwardEventToParent(e);
|
||||
}
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
forwardEventToParent(e);
|
||||
}
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
forwardEventToParent(e);
|
||||
}
|
||||
@ -377,6 +412,7 @@ public class MotifInternalFrameTitlePane
|
||||
getParent().dispatchEvent(newEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
super.paintComponent(g);
|
||||
if (frame.isSelected()) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -81,11 +81,13 @@ public class MotifInternalFrameUI extends BasicInternalFrameUI {
|
||||
super(w);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void installUI(JComponent c) {
|
||||
super.installUI(c);
|
||||
setColors((JInternalFrame)c);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installDefaults() {
|
||||
Border frameBorder = frame.getBorder();
|
||||
frame.setLayout(internalFrameLayout = createLayoutManager());
|
||||
@ -95,6 +97,7 @@ public class MotifInternalFrameUI extends BasicInternalFrameUI {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void installKeyboardActions(){
|
||||
super.installKeyboardActions();
|
||||
// We replace the
|
||||
@ -103,6 +106,7 @@ public class MotifInternalFrameUI extends BasicInternalFrameUI {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void uninstallDefaults() {
|
||||
LookAndFeel.uninstallBorder(frame);
|
||||
frame.setLayout(null);
|
||||
@ -113,15 +117,18 @@ public class MotifInternalFrameUI extends BasicInternalFrameUI {
|
||||
return frame;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent createNorthPane(JInternalFrame w) {
|
||||
titlePane = new MotifInternalFrameTitlePane(w);
|
||||
return titlePane;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getMaximumSize(JComponent x) {
|
||||
return Toolkit.getDefaultToolkit().getScreenSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallKeyboardActions(){
|
||||
super.uninstallKeyboardActions();
|
||||
if (isKeyBindingRegistered()){
|
||||
@ -132,6 +139,7 @@ public class MotifInternalFrameUI extends BasicInternalFrameUI {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupMenuOpenKey(){
|
||||
super.setupMenuOpenKey();
|
||||
ActionMap map = SwingUtilities.getUIActionMap(frame);
|
||||
@ -141,9 +149,11 @@ public class MotifInternalFrameUI extends BasicInternalFrameUI {
|
||||
// titlePane ivar in BasicInternalFrameUI, making supers action throw
|
||||
// an NPE for us.
|
||||
map.put("showSystemMenu", new AbstractAction(){
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e){
|
||||
titlePane.showSystemMenu();
|
||||
}
|
||||
@Override
|
||||
public boolean isEnabled(){
|
||||
return isKeyBindingActive();
|
||||
}
|
||||
@ -151,13 +161,16 @@ public class MotifInternalFrameUI extends BasicInternalFrameUI {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupMenuCloseKey(){
|
||||
ActionMap map = SwingUtilities.getUIActionMap(frame);
|
||||
if (map != null) {
|
||||
map.put("hideSystemMenu", new AbstractAction(){
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e){
|
||||
titlePane.hideSystemMenu();
|
||||
}
|
||||
@Override
|
||||
public boolean isEnabled(){
|
||||
return isKeyBindingActive();
|
||||
}
|
||||
@ -184,6 +197,7 @@ public class MotifInternalFrameUI extends BasicInternalFrameUI {
|
||||
if (diActionMap == null) {
|
||||
diActionMap = new ActionMapUIResource();
|
||||
diActionMap.put("hideSystemMenu", new AbstractAction(){
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e){
|
||||
JInternalFrame.JDesktopIcon icon = getFrame().
|
||||
getDesktopIcon();
|
||||
@ -191,6 +205,7 @@ public class MotifInternalFrameUI extends BasicInternalFrameUI {
|
||||
getUI();
|
||||
micon.hideSystemMenu();
|
||||
}
|
||||
@Override
|
||||
public boolean isEnabled(){
|
||||
return isKeyBindingActive();
|
||||
}
|
||||
@ -201,12 +216,14 @@ public class MotifInternalFrameUI extends BasicInternalFrameUI {
|
||||
|
||||
/** This method is called when the frame becomes selected.
|
||||
*/
|
||||
@Override
|
||||
protected void activateFrame(JInternalFrame f) {
|
||||
super.activateFrame(f);
|
||||
setColors(f);
|
||||
}
|
||||
/** This method is called when the frame is no longer selected.
|
||||
*/
|
||||
@Override
|
||||
protected void deactivateFrame(JInternalFrame f) {
|
||||
setColors(f);
|
||||
super.deactivateFrame(f);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -56,24 +56,29 @@ import sun.swing.SwingUtilities2;
|
||||
@Deprecated(since="13", forRemoval=true)
|
||||
public class MotifLookAndFeel extends BasicLookAndFeel
|
||||
{
|
||||
@Override
|
||||
public String getName() {
|
||||
return "CDE/Motif";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getID() {
|
||||
return "Motif";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "The CDE/Motif Look and Feel";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isNativeLookAndFeel() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isSupportedLookAndFeel() {
|
||||
return true;
|
||||
}
|
||||
@ -87,6 +92,7 @@ public class MotifLookAndFeel extends BasicLookAndFeel
|
||||
* values, otherwise we create color objects whose values match
|
||||
* the default CDE/Motif colors.
|
||||
*/
|
||||
@Override
|
||||
protected void initSystemColorDefaults(UIDefaults table)
|
||||
{
|
||||
String[] defaultSystemColors = {
|
||||
@ -123,6 +129,7 @@ public class MotifLookAndFeel extends BasicLookAndFeel
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void initClassDefaults(UIDefaults table)
|
||||
{
|
||||
super.initClassDefaults(table);
|
||||
@ -178,6 +185,7 @@ public class MotifLookAndFeel extends BasicLookAndFeel
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void initComponentDefaults(UIDefaults table)
|
||||
{
|
||||
super.initComponentDefaults(table);
|
||||
@ -255,36 +263,42 @@ public class MotifLookAndFeel extends BasicLookAndFeel
|
||||
));
|
||||
|
||||
Object menuItemCheckIcon = new UIDefaults.LazyValue() {
|
||||
@Override
|
||||
public Object createValue(UIDefaults table) {
|
||||
return MotifIconFactory.getMenuItemCheckIcon();
|
||||
}
|
||||
};
|
||||
|
||||
Object menuItemArrowIcon = new UIDefaults.LazyValue() {
|
||||
@Override
|
||||
public Object createValue(UIDefaults table) {
|
||||
return MotifIconFactory.getMenuItemArrowIcon();
|
||||
}
|
||||
};
|
||||
|
||||
Object menuArrowIcon = new UIDefaults.LazyValue() {
|
||||
@Override
|
||||
public Object createValue(UIDefaults table) {
|
||||
return MotifIconFactory.getMenuArrowIcon();
|
||||
}
|
||||
};
|
||||
|
||||
Object checkBoxIcon = new UIDefaults.LazyValue() {
|
||||
@Override
|
||||
public Object createValue(UIDefaults table) {
|
||||
return MotifIconFactory.getCheckBoxIcon();
|
||||
}
|
||||
};
|
||||
|
||||
Object radioButtonIcon = new UIDefaults.LazyValue() {
|
||||
@Override
|
||||
public Object createValue(UIDefaults table) {
|
||||
return MotifIconFactory.getRadioButtonIcon();
|
||||
}
|
||||
};
|
||||
|
||||
Object unselectedTabBackground = new UIDefaults.LazyValue() {
|
||||
@Override
|
||||
public Object createValue(UIDefaults table) {
|
||||
Color c = table.getColor("control");
|
||||
return new ColorUIResource(Math.max((int)(c.getRed()*.85),0),
|
||||
@ -294,6 +308,7 @@ public class MotifLookAndFeel extends BasicLookAndFeel
|
||||
};
|
||||
|
||||
Object unselectedTabForeground = new UIDefaults.LazyValue() {
|
||||
@Override
|
||||
public Object createValue(UIDefaults table) {
|
||||
Color c = table.getColor("controlText");
|
||||
return new ColorUIResource(Math.max((int)(c.getRed()*.85),0),
|
||||
@ -303,6 +318,7 @@ public class MotifLookAndFeel extends BasicLookAndFeel
|
||||
};
|
||||
|
||||
Object unselectedTabShadow = new UIDefaults.LazyValue() {
|
||||
@Override
|
||||
public Object createValue(UIDefaults table) {
|
||||
Color c = table.getColor("control");
|
||||
Color base = new Color(Math.max((int)(c.getRed()*.85),0),
|
||||
@ -313,6 +329,7 @@ public class MotifLookAndFeel extends BasicLookAndFeel
|
||||
};
|
||||
|
||||
Object unselectedTabHighlight = new UIDefaults.LazyValue() {
|
||||
@Override
|
||||
public Object createValue(UIDefaults table) {
|
||||
Color c = table.getColor("control");
|
||||
Color base = new Color(Math.max((int)(c.getRed()*.85),0),
|
||||
@ -462,18 +479,21 @@ public class MotifLookAndFeel extends BasicLookAndFeel
|
||||
"icons/TreeClosed.gif");
|
||||
|
||||
Object treeLeafIcon = new UIDefaults.LazyValue() {
|
||||
@Override
|
||||
public Object createValue(UIDefaults table) {
|
||||
return MotifTreeCellRenderer.loadLeafIcon();
|
||||
}
|
||||
};
|
||||
|
||||
Object treeExpandedIcon = new UIDefaults.LazyValue() {
|
||||
@Override
|
||||
public Object createValue(UIDefaults table) {
|
||||
return MotifTreeUI.MotifExpandedIcon.createExpandedIcon();
|
||||
}
|
||||
};
|
||||
|
||||
Object treeCollapsedIcon = new UIDefaults.LazyValue() {
|
||||
@Override
|
||||
public Object createValue(UIDefaults table) {
|
||||
return MotifTreeUI.MotifCollapsedIcon.createCollapsedIcon();
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -50,12 +50,14 @@ public class MotifMenuItemUI extends BasicMenuItemUI
|
||||
return new MotifMenuItemUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installListeners() {
|
||||
super.installListeners();
|
||||
changeListener = createChangeListener(menuItem);
|
||||
menuItem.addChangeListener(changeListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallListeners() {
|
||||
super.uninstallListeners();
|
||||
menuItem.removeChangeListener(changeListener);
|
||||
@ -65,12 +67,14 @@ public class MotifMenuItemUI extends BasicMenuItemUI
|
||||
return new ChangeHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MouseInputListener createMouseInputListener(JComponent c) {
|
||||
return new MouseInputHandler();
|
||||
}
|
||||
|
||||
protected class ChangeHandler implements ChangeListener {
|
||||
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
JMenuItem c = (JMenuItem)e.getSource();
|
||||
LookAndFeel.installProperty(c, "borderPainted",
|
||||
@ -79,11 +83,14 @@ public class MotifMenuItemUI extends BasicMenuItemUI
|
||||
}
|
||||
|
||||
protected class MouseInputHandler implements MouseInputListener {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {}
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
MenuSelectionManager manager = MenuSelectionManager.defaultManager();
|
||||
manager.setSelectedPath(getPath());
|
||||
}
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
MenuSelectionManager manager =
|
||||
MenuSelectionManager.defaultManager();
|
||||
@ -97,11 +104,15 @@ public class MotifMenuItemUI extends BasicMenuItemUI
|
||||
manager.processMouseEvent(e);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {}
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {}
|
||||
@Override
|
||||
public void mouseDragged(MouseEvent e) {
|
||||
MenuSelectionManager.defaultManager().processMouseEvent(e);
|
||||
}
|
||||
@Override
|
||||
public void mouseMoved(MouseEvent e) { }
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -33,15 +33,19 @@ import javax.swing.MenuSelectionManager;
|
||||
* @author Arnaud Weber
|
||||
*/
|
||||
class MotifMenuMouseListener extends MouseAdapter {
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
MenuSelectionManager.defaultManager().processMouseEvent(e);
|
||||
}
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
MenuSelectionManager.defaultManager().processMouseEvent(e);
|
||||
}
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
MenuSelectionManager.defaultManager().processMouseEvent(e);
|
||||
}
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
MenuSelectionManager.defaultManager().processMouseEvent(e);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -33,10 +33,12 @@ import javax.swing.MenuSelectionManager;
|
||||
* @author Arnaud Weber
|
||||
*/
|
||||
class MotifMenuMouseMotionListener implements MouseMotionListener {
|
||||
@Override
|
||||
public void mouseDragged(MouseEvent e) {
|
||||
MenuSelectionManager.defaultManager().processMouseEvent(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseMoved(MouseEvent e) {
|
||||
MenuSelectionManager.defaultManager().processMouseEvent(e);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -61,6 +61,7 @@ public class MotifMenuUI extends BasicMenuUI
|
||||
// menuItem.removeChangeListener(changeListener);
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected ChangeListener createChangeListener(JComponent c) {
|
||||
return new MotifChangeHandler((JMenu)c, this);
|
||||
}
|
||||
@ -76,6 +77,7 @@ public class MotifMenuUI extends BasicMenuUI
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MouseInputListener createMouseInputListener(JComponent c) {
|
||||
return new MouseInputHandler();
|
||||
}
|
||||
@ -86,6 +88,7 @@ public class MotifMenuUI extends BasicMenuUI
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
JMenuItem c = (JMenuItem)e.getSource();
|
||||
if (c.isArmed() || c.isSelected()) {
|
||||
@ -100,7 +103,9 @@ public class MotifMenuUI extends BasicMenuUI
|
||||
}
|
||||
|
||||
protected class MouseInputHandler implements MouseInputListener {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {}
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
MenuSelectionManager manager = MenuSelectionManager.defaultManager();
|
||||
JMenu menu = (JMenu)e.getComponent();
|
||||
@ -129,6 +134,7 @@ public class MotifMenuUI extends BasicMenuUI
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
MenuSelectionManager manager =
|
||||
MenuSelectionManager.defaultManager();
|
||||
@ -139,11 +145,15 @@ public class MotifMenuUI extends BasicMenuUI
|
||||
manager.processMouseEvent(e);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {}
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {}
|
||||
@Override
|
||||
public void mouseDragged(MouseEvent e) {
|
||||
MenuSelectionManager.defaultManager().processMouseEvent(e);
|
||||
}
|
||||
@Override
|
||||
public void mouseMoved(MouseEvent e) { }
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -57,6 +57,7 @@ public class MotifOptionPaneUI extends BasicOptionPaneUI
|
||||
* Creates and returns a Container containing the buttons. The buttons
|
||||
* are created by calling <code>getButtons</code>.
|
||||
*/
|
||||
@Override
|
||||
protected Container createButtonArea() {
|
||||
Container b = super.createButtonArea();
|
||||
|
||||
@ -69,17 +70,21 @@ public class MotifOptionPaneUI extends BasicOptionPaneUI
|
||||
/**
|
||||
* Returns null, CDE/Motif does not impose a minimum size.
|
||||
*/
|
||||
@Override
|
||||
public Dimension getMinimumOptionPaneSize() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Container createSeparator() {
|
||||
return new JPanel() {
|
||||
|
||||
@Override
|
||||
public Dimension getPreferredSize() {
|
||||
return new Dimension(10, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
int width = getWidth();
|
||||
g.setColor(Color.darkGray);
|
||||
@ -95,6 +100,7 @@ public class MotifOptionPaneUI extends BasicOptionPaneUI
|
||||
* <code>getIcon</code> to <code>top</code>. This is messaged from
|
||||
* <code>createMessageArea</code>
|
||||
*/
|
||||
@Override
|
||||
protected void addIcon(Container top) {
|
||||
/* Create the icon. */
|
||||
Icon sideIcon = getIcon();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -55,6 +55,7 @@ public class MotifPasswordFieldUI extends BasicPasswordFieldUI {
|
||||
*
|
||||
* @return the caret object
|
||||
*/
|
||||
@Override
|
||||
protected Caret createCaret() {
|
||||
return MotifTextUI.createCaret();
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -47,6 +47,7 @@ public class MotifPopupMenuSeparatorUI extends MotifSeparatorUI
|
||||
return new MotifPopupMenuSeparatorUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint( Graphics g, JComponent c )
|
||||
{
|
||||
Dimension s = c.getSize();
|
||||
@ -58,6 +59,7 @@ public class MotifPopupMenuSeparatorUI extends MotifSeparatorUI
|
||||
g.drawLine( 0, 1, s.width, 1 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getPreferredSize( JComponent c )
|
||||
{
|
||||
return new Dimension( 0, 2 );
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -61,6 +61,7 @@ public class MotifPopupMenuUI extends BasicPopupMenuUI {
|
||||
/* This has to deal with the fact that the title may be wider than
|
||||
the widest child component.
|
||||
*/
|
||||
@Override
|
||||
public Dimension getPreferredSize(JComponent c) {
|
||||
LayoutManager layout = c.getLayout();
|
||||
Dimension d = layout.preferredLayoutSize(c);
|
||||
@ -94,10 +95,12 @@ public class MotifPopupMenuUI extends BasicPopupMenuUI {
|
||||
|
||||
protected ChangeListener createChangeListener(JPopupMenu m) {
|
||||
return new ChangeListener() {
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean isPopupTrigger(MouseEvent e) {
|
||||
return ((e.getID()==MouseEvent.MOUSE_PRESSED)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -55,12 +55,14 @@ public class MotifRadioButtonMenuItemUI extends BasicRadioButtonMenuItemUI
|
||||
return new MotifRadioButtonMenuItemUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installListeners() {
|
||||
super.installListeners();
|
||||
changeListener = createChangeListener(menuItem);
|
||||
menuItem.addChangeListener(changeListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallListeners() {
|
||||
super.uninstallListeners();
|
||||
menuItem.removeChangeListener(changeListener);
|
||||
@ -72,23 +74,28 @@ public class MotifRadioButtonMenuItemUI extends BasicRadioButtonMenuItemUI
|
||||
|
||||
@SuppressWarnings("serial") // Same-version serialization only
|
||||
protected class ChangeHandler implements ChangeListener, Serializable {
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
JMenuItem c = (JMenuItem)e.getSource();
|
||||
LookAndFeel.installProperty(c, "borderPainted", c.isArmed());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MouseInputListener createMouseInputListener(JComponent c) {
|
||||
return new MouseInputHandler();
|
||||
}
|
||||
|
||||
|
||||
protected class MouseInputHandler implements MouseInputListener {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {}
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
MenuSelectionManager manager = MenuSelectionManager.defaultManager();
|
||||
manager.setSelectedPath(getPath());
|
||||
}
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
MenuSelectionManager manager =
|
||||
MenuSelectionManager.defaultManager();
|
||||
@ -105,11 +112,15 @@ public class MotifRadioButtonMenuItemUI extends BasicRadioButtonMenuItemUI
|
||||
manager.processMouseEvent(e);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {}
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {}
|
||||
@Override
|
||||
public void mouseDragged(MouseEvent e) {
|
||||
MenuSelectionManager.defaultManager().processMouseEvent(e);
|
||||
}
|
||||
@Override
|
||||
public void mouseMoved(MouseEvent e) { }
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -68,6 +68,7 @@ public class MotifRadioButtonUI extends BasicRadioButtonUI {
|
||||
// ********************************
|
||||
// Install Defaults
|
||||
// ********************************
|
||||
@Override
|
||||
public void installDefaults(AbstractButton b) {
|
||||
super.installDefaults(b);
|
||||
if(!defaults_initialized) {
|
||||
@ -76,6 +77,7 @@ public class MotifRadioButtonUI extends BasicRadioButtonUI {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallDefaults(AbstractButton b) {
|
||||
super.uninstallDefaults(b);
|
||||
defaults_initialized = false;
|
||||
@ -92,6 +94,7 @@ public class MotifRadioButtonUI extends BasicRadioButtonUI {
|
||||
// ********************************
|
||||
// Paint Methods
|
||||
// ********************************
|
||||
@Override
|
||||
protected void paintFocus(Graphics g, Rectangle t, Dimension d){
|
||||
g.setColor(getFocusColor());
|
||||
g.drawRect(0,0,d.width-1,d.height-1);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -64,6 +64,7 @@ public class MotifScrollBarButton extends BasicArrowButton
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Dimension getPreferredSize() {
|
||||
switch (direction) {
|
||||
case NORTH:
|
||||
@ -76,18 +77,22 @@ public class MotifScrollBarButton extends BasicArrowButton
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getMinimumSize() {
|
||||
return getPreferredSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getMaximumSize() {
|
||||
return getPreferredSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFocusTraversable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g)
|
||||
{
|
||||
int w = getWidth();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -52,6 +52,7 @@ public class MotifScrollBarUI extends BasicScrollBarUI
|
||||
return new MotifScrollBarUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getPreferredSize(JComponent c) {
|
||||
Insets insets = c.getInsets();
|
||||
int dx = insets.left + insets.right;
|
||||
@ -61,19 +62,23 @@ public class MotifScrollBarUI extends BasicScrollBarUI
|
||||
: new Dimension(dx + 33, dy + 11);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JButton createDecreaseButton(int orientation) {
|
||||
return new MotifScrollBarButton(orientation);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JButton createIncreaseButton(int orientation) {
|
||||
return new MotifScrollBarButton(orientation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintTrack(Graphics g, JComponent c, Rectangle trackBounds) {
|
||||
g.setColor(trackColor);
|
||||
g.fillRect(trackBounds.x, trackBounds.y, trackBounds.width, trackBounds.height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) {
|
||||
if (thumbBounds.isEmpty() || !scrollbar.isEnabled()) {
|
||||
return;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -64,22 +64,27 @@ public class MotifSliderUI extends BasicSliderUI {
|
||||
return new MotifSliderUI((JSlider)b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getPreferredHorizontalSize() {
|
||||
return PREFERRED_HORIZONTAL_SIZE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getPreferredVerticalSize() {
|
||||
return PREFERRED_VERTICAL_SIZE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getMinimumHorizontalSize() {
|
||||
return MINIMUM_HORIZONTAL_SIZE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getMinimumVerticalSize() {
|
||||
return MINIMUM_VERTICAL_SIZE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Dimension getThumbSize() {
|
||||
if ( slider.getOrientation() == JSlider.HORIZONTAL ) {
|
||||
return new Dimension( 30, 15 );
|
||||
@ -89,12 +94,15 @@ public class MotifSliderUI extends BasicSliderUI {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintFocus(Graphics g) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintTrack(Graphics g) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintThumb(Graphics g) {
|
||||
Rectangle knobBounds = thumbRect;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -84,6 +84,7 @@ public class MotifSplitPaneDivider extends BasicSplitPaneDivider
|
||||
* overrides to hardcode the size of the divider
|
||||
* PENDING(jeff) - rewrite JSplitPane so that this isn't needed
|
||||
*/
|
||||
@Override
|
||||
public void setDividerSize(int newSize) {
|
||||
Insets insets = getInsets();
|
||||
int borderSize = 0;
|
||||
@ -109,6 +110,7 @@ public class MotifSplitPaneDivider extends BasicSplitPaneDivider
|
||||
*/
|
||||
// PENDING(jeff) - the thumb's location and size is currently hard coded.
|
||||
// It should be dynamic.
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
Color bgColor = getBackground();
|
||||
Dimension size = getSize();
|
||||
@ -179,6 +181,7 @@ public class MotifSplitPaneDivider extends BasicSplitPaneDivider
|
||||
/**
|
||||
* The minimums size is the same as the preferredSize
|
||||
*/
|
||||
@Override
|
||||
public Dimension getMinimumSize() {
|
||||
return getPreferredSize();
|
||||
}
|
||||
@ -187,6 +190,7 @@ public class MotifSplitPaneDivider extends BasicSplitPaneDivider
|
||||
* Sets the SplitPaneUI that is using the receiver. This is completely
|
||||
* overridden from super to create a different MouseHandler.
|
||||
*/
|
||||
@Override
|
||||
public void setBasicSplitPaneUI(BasicSplitPaneUI newUI) {
|
||||
if (splitPane != null) {
|
||||
splitPane.removePropertyChangeListener(this);
|
||||
@ -268,6 +272,7 @@ public class MotifSplitPaneDivider extends BasicSplitPaneDivider
|
||||
* in.
|
||||
*/
|
||||
private class MotifMouseHandler extends MouseHandler {
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
// Constrain the mouse pressed to the thumb.
|
||||
if (e.getSource() == MotifSplitPaneDivider.this &&
|
||||
@ -277,6 +282,7 @@ public class MotifSplitPaneDivider extends BasicSplitPaneDivider
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseMoved(MouseEvent e) {
|
||||
if (getDragger() != null) {
|
||||
return;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -51,6 +51,7 @@ public class MotifSplitPaneUI extends BasicSplitPaneUI
|
||||
/**
|
||||
* Creates the default divider.
|
||||
*/
|
||||
@Override
|
||||
public BasicSplitPaneDivider createDefaultDivider() {
|
||||
return new MotifSplitPaneDivider(this);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -61,6 +61,7 @@ public class MotifTabbedPaneUI extends BasicTabbedPaneUI
|
||||
// UI Installation/De-installation
|
||||
|
||||
|
||||
@Override
|
||||
protected void installDefaults() {
|
||||
super.installDefaults();
|
||||
|
||||
@ -70,6 +71,7 @@ public class MotifTabbedPaneUI extends BasicTabbedPaneUI
|
||||
unselectedTabHighlight = UIManager.getColor("TabbedPane.unselectedTabHighlight");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallDefaults() {
|
||||
super.uninstallDefaults();
|
||||
|
||||
@ -81,6 +83,7 @@ public class MotifTabbedPaneUI extends BasicTabbedPaneUI
|
||||
|
||||
// UI Rendering
|
||||
|
||||
@Override
|
||||
protected void paintContentBorderTopEdge(Graphics g, int tabPlacement,
|
||||
int selectedIndex,
|
||||
int x, int y, int w, int h) {
|
||||
@ -104,6 +107,7 @@ public class MotifTabbedPaneUI extends BasicTabbedPaneUI
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintContentBorderBottomEdge(Graphics g, int tabPlacement,
|
||||
int selectedIndex,
|
||||
int x, int y, int w, int h) {
|
||||
@ -126,6 +130,7 @@ public class MotifTabbedPaneUI extends BasicTabbedPaneUI
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintContentBorderRightEdge(Graphics g, int tabPlacement,
|
||||
int selectedIndex,
|
||||
int x, int y, int w, int h) {
|
||||
@ -148,6 +153,7 @@ public class MotifTabbedPaneUI extends BasicTabbedPaneUI
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintTabBackground(Graphics g,
|
||||
int tabPlacement, int tabIndex,
|
||||
int x, int y, int w, int h,
|
||||
@ -174,6 +180,7 @@ public class MotifTabbedPaneUI extends BasicTabbedPaneUI
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintTabBorder(Graphics g,
|
||||
int tabPlacement, int tabIndex,
|
||||
int x, int y, int w, int h,
|
||||
@ -225,6 +232,7 @@ public class MotifTabbedPaneUI extends BasicTabbedPaneUI
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintFocusIndicator(Graphics g, int tabPlacement,
|
||||
Rectangle[] rects, int tabIndex,
|
||||
Rectangle iconRect, Rectangle textRect,
|
||||
@ -263,10 +271,12 @@ public class MotifTabbedPaneUI extends BasicTabbedPaneUI
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getTabRunIndent(int tabPlacement, int run) {
|
||||
return run*3;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getTabRunOverlay(int tabPlacement) {
|
||||
tabRunOverlay = (tabPlacement == LEFT || tabPlacement == RIGHT)?
|
||||
(int)Math.round((float)maxTabWidth * .10) :
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -57,6 +57,7 @@ public class MotifTextAreaUI extends BasicTextAreaUI {
|
||||
*
|
||||
* @return the caret object
|
||||
*/
|
||||
@Override
|
||||
protected Caret createCaret() {
|
||||
return MotifTextUI.createCaret();
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -55,6 +55,7 @@ public class MotifTextFieldUI extends BasicTextFieldUI {
|
||||
*
|
||||
* @return the caret object
|
||||
*/
|
||||
@Override
|
||||
protected Caret createCaret() {
|
||||
return MotifTextUI.createCaret();
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -55,6 +55,7 @@ public class MotifTextPaneUI extends BasicTextPaneUI {
|
||||
*
|
||||
* @return the caret object
|
||||
*/
|
||||
@Override
|
||||
protected Caret createCaret() {
|
||||
return MotifTextUI.createCaret();
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -75,6 +75,7 @@ public class MotifTextUI {
|
||||
* @param e the focus event
|
||||
* @see FocusListener#focusGained
|
||||
*/
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
super.focusGained(e);
|
||||
getComponent().repaint();
|
||||
@ -88,6 +89,7 @@ public class MotifTextUI {
|
||||
* @param e the focus event
|
||||
* @see FocusListener#focusLost
|
||||
*/
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
super.focusLost(e);
|
||||
getComponent().repaint();
|
||||
@ -101,6 +103,7 @@ public class MotifTextUI {
|
||||
* @param r the current location of the caret, does nothing if null
|
||||
* @see #paint
|
||||
*/
|
||||
@Override
|
||||
protected void damage(Rectangle r) {
|
||||
if (r != null) {
|
||||
x = r.x - IBeamOverhang - 1;
|
||||
@ -121,6 +124,7 @@ public class MotifTextUI {
|
||||
* @param g the graphics context
|
||||
* @see #damage
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void paint(Graphics g) {
|
||||
if(isVisible()) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -71,6 +71,7 @@ public class MotifToggleButtonUI extends BasicToggleButtonUI
|
||||
// ********************************
|
||||
// Install Defaults
|
||||
// ********************************
|
||||
@Override
|
||||
public void installDefaults(AbstractButton b) {
|
||||
super.installDefaults(b);
|
||||
if(!defaults_initialized) {
|
||||
@ -80,6 +81,7 @@ public class MotifToggleButtonUI extends BasicToggleButtonUI
|
||||
LookAndFeel.installProperty(b, "opaque", Boolean.FALSE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallDefaults(AbstractButton b) {
|
||||
super.uninstallDefaults(b);
|
||||
defaults_initialized = false;
|
||||
@ -96,6 +98,7 @@ public class MotifToggleButtonUI extends BasicToggleButtonUI
|
||||
// ********************************
|
||||
// Paint Methods
|
||||
// ********************************
|
||||
@Override
|
||||
protected void paintButtonPressed(Graphics g, AbstractButton b) {
|
||||
if (b.isContentAreaFilled()) {
|
||||
Color oldColor = g.getColor();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -70,6 +70,7 @@ public class MotifTreeCellRenderer extends DefaultTreeCellRenderer
|
||||
highlight = UIManager.getColor("Tree.iconHighlight");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintIcon(Component c, Graphics g, int x, int y) {
|
||||
g.setColor(bg);
|
||||
|
||||
@ -90,10 +91,12 @@ public class MotifTreeCellRenderer extends DefaultTreeCellRenderer
|
||||
g.drawLine(x + 9, y + 8, x + 7, y + 6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconWidth() {
|
||||
return LEAF_SIZE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconHeight() {
|
||||
return LEAF_SIZE;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -54,12 +54,14 @@ public class MotifTreeUI extends BasicTreeUI
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void installUI(JComponent c) {
|
||||
super.installUI(c);
|
||||
}
|
||||
|
||||
// BasicTreeUI overrides
|
||||
|
||||
@Override
|
||||
protected void paintVerticalLine( Graphics g, JComponent c, int x, int top, int bottom )
|
||||
{
|
||||
if (tree.getComponentOrientation().isLeftToRight()) {
|
||||
@ -69,6 +71,7 @@ public class MotifTreeUI extends BasicTreeUI
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintHorizontalLine( Graphics g, JComponent c, int y, int left, int right )
|
||||
{
|
||||
g.fillRect( left, y, right - left + 1, 2 );
|
||||
@ -96,6 +99,7 @@ public class MotifTreeUI extends BasicTreeUI
|
||||
return new MotifExpandedIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintIcon(Component c, Graphics g, int x, int y) {
|
||||
g.setColor(highlight);
|
||||
g.drawLine(x, y, x+SIZE-1, y);
|
||||
@ -113,7 +117,9 @@ public class MotifTreeUI extends BasicTreeUI
|
||||
g.drawLine(x+3, y+HALF_SIZE, x+SIZE-4, y+HALF_SIZE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconWidth() { return SIZE; }
|
||||
@Override
|
||||
public int getIconHeight() { return SIZE; }
|
||||
}
|
||||
|
||||
@ -126,6 +132,7 @@ public class MotifTreeUI extends BasicTreeUI
|
||||
return new MotifCollapsedIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintIcon(Component c, Graphics g, int x, int y) {
|
||||
super.paintIcon(c, g, x, y);
|
||||
g.drawLine(x + HALF_SIZE-1, y + 3, x + HALF_SIZE-1, y + (SIZE - 4));
|
||||
@ -141,6 +148,7 @@ public class MotifTreeUI extends BasicTreeUI
|
||||
* Returns the default cell renderer that is used to do the
|
||||
* stamping of each node.
|
||||
*/
|
||||
@Override
|
||||
public TreeCellRenderer createDefaultCellRenderer() {
|
||||
return new MotifTreeCellRenderer();
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,6 +25,7 @@
|
||||
|
||||
package com.sun.media.sound;
|
||||
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
@ -40,12 +41,6 @@ final class Platform {
|
||||
|
||||
private static boolean isNativeLibLoaded;
|
||||
|
||||
// SYSTEM CHARACTERISTICS
|
||||
// vary according to hardware architecture
|
||||
|
||||
// intel is little-endian. sparc is big-endian.
|
||||
private static boolean bigEndian;
|
||||
|
||||
static {
|
||||
loadLibraries();
|
||||
}
|
||||
@ -66,7 +61,7 @@ final class Platform {
|
||||
* Determine whether the system is big-endian.
|
||||
*/
|
||||
static boolean isBigEndian() {
|
||||
return bigEndian;
|
||||
return ByteOrder.nativeOrder().equals(ByteOrder.BIG_ENDIAN);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -82,9 +77,6 @@ final class Platform {
|
||||
if (Printer.err) Printer.err("Couldn't load library "+libName+": "+t.toString());
|
||||
isNativeLibLoaded = false;
|
||||
}
|
||||
if (isNativeLibLoaded) {
|
||||
bigEndian = nIsBigEndian();
|
||||
}
|
||||
}
|
||||
|
||||
static boolean isMidiIOEnabled() {
|
||||
@ -98,7 +90,4 @@ final class Platform {
|
||||
static boolean isDirectAudioEnabled() {
|
||||
return isNativeLibLoaded;
|
||||
}
|
||||
|
||||
// the following native method is implemented in Platform.c
|
||||
private static native boolean nIsBigEndian();
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user