diff --git a/src/hotspot/cpu/aarch64/aarch64.ad b/src/hotspot/cpu/aarch64/aarch64.ad index d6f3cace0a9..501d9df08c1 100644 --- a/src/hotspot/cpu/aarch64/aarch64.ad +++ b/src/hotspot/cpu/aarch64/aarch64.ad @@ -2575,7 +2575,7 @@ Assembler::Condition to_assembler_cond(BoolTest::mask cond) { } // Binary src (Replicate con) -bool is_valid_sve_arith_imm_pattern(Node* n, Node* m) { +static bool is_valid_sve_arith_imm_pattern(Node* n, Node* m) { if (n == nullptr || m == nullptr) { return false; } @@ -2616,7 +2616,7 @@ bool is_valid_sve_arith_imm_pattern(Node* n, Node* m) { // (XorV src (Replicate m1)) // (XorVMask src (MaskAll m1)) -bool is_vector_bitwise_not_pattern(Node* n, Node* m) { +static bool is_vector_bitwise_not_pattern(Node* n, Node* m) { if (n != nullptr && m != nullptr) { return (n->Opcode() == Op_XorV || n->Opcode() == Op_XorVMask) && VectorNode::is_all_ones_vector(m); diff --git a/src/hotspot/cpu/aarch64/frame_aarch64.cpp b/src/hotspot/cpu/aarch64/frame_aarch64.cpp index c5b2ff8a4c0..8d0fa8895d1 100644 --- a/src/hotspot/cpu/aarch64/frame_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/frame_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -678,7 +678,7 @@ static void printbc(Method *m, intptr_t bcx) { printf("%s : %s ==> %s\n", m->name_and_sig_as_C_string(), buf, name); } -void internal_pf(uintptr_t sp, uintptr_t fp, uintptr_t pc, uintptr_t bcx) { +static void internal_pf(uintptr_t sp, uintptr_t fp, uintptr_t pc, uintptr_t bcx) { if (! fp) return; diff --git a/src/hotspot/cpu/aarch64/immediate_aarch64.cpp b/src/hotspot/cpu/aarch64/immediate_aarch64.cpp index 3d87fde2b5b..7caafc19fbd 100644 --- a/src/hotspot/cpu/aarch64/immediate_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/immediate_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -53,7 +53,7 @@ struct li_pair { static struct li_pair InverseLITable[LI_TABLE_SIZE]; // comparator to sort entries in the inverse table -int compare_immediate_pair(const void *i1, const void *i2) +static int compare_immediate_pair(const void *i1, const void *i2) { struct li_pair *li1 = (struct li_pair *)i1; struct li_pair *li2 = (struct li_pair *)i2; @@ -142,7 +142,7 @@ static inline uint32_t uimm(uint32_t val, int hi, int lo) // result // a bit string containing count copies of input bit string // -uint64_t replicate(uint64_t bits, int nbits, int count) +static uint64_t replicate(uint64_t bits, int nbits, int count) { assert(count > 0, "must be"); assert(nbits > 0, "must be"); @@ -231,8 +231,8 @@ uint64_t replicate(uint64_t bits, int nbits, int count) // For historical reasons the implementation of this function is much // more convoluted than is really necessary. -int expandLogicalImmediate(uint32_t immN, uint32_t immr, - uint32_t imms, uint64_t &bimm) +static int expandLogicalImmediate(uint32_t immN, uint32_t immr, + uint32_t imms, uint64_t &bimm) { int len; // ought to be <= 6 uint32_t levels; // 6 bits @@ -446,4 +446,3 @@ uint32_t encoding_for_fp_immediate(float immediate) res = (s << 7) | (r << 4) | f; return res; } - diff --git a/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp b/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp index b6a27abf0f3..7088cf33cf6 100644 --- a/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp +++ b/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1207,9 +1207,10 @@ void LIRGenerator::do_vectorizedMismatch(Intrinsic* x) { __ move(result_reg, result); } +#ifndef _LP64 // _i2l, _i2f, _i2d, _l2i, _l2f, _l2d, _f2i, _f2l, _f2d, _d2i, _d2l, _d2f // _i2b, _i2c, _i2s -LIR_Opr fixed_register_for(BasicType type) { +static LIR_Opr fixed_register_for(BasicType type) { switch (type) { case T_FLOAT: return FrameMap::fpu0_float_opr; case T_DOUBLE: return FrameMap::fpu0_double_opr; @@ -1218,6 +1219,7 @@ LIR_Opr fixed_register_for(BasicType type) { default: ShouldNotReachHere(); return LIR_OprFact::illegalOpr; } } +#endif void LIRGenerator::do_Convert(Convert* x) { #ifdef _LP64 diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.cpp b/src/hotspot/cpu/x86/macroAssembler_x86.cpp index 7496bddb39a..f0e7a08dd5f 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp @@ -4120,8 +4120,9 @@ static void restore_xmm_register(MacroAssembler* masm, int offset, XMMRegister r } } -int register_section_sizes(RegSet gp_registers, XMMRegSet xmm_registers, bool save_fpu, - int& gp_area_size, int& fp_area_size, int& xmm_area_size) { +static int register_section_sizes(RegSet gp_registers, XMMRegSet xmm_registers, + bool save_fpu, int& gp_area_size, + int& fp_area_size, int& xmm_area_size) { gp_area_size = align_up(gp_registers.size() * Register::max_slots_per_register * VMRegImpl::stack_slot_size, StackAlignmentInBytes); diff --git a/src/hotspot/cpu/x86/peephole_x86_64.cpp b/src/hotspot/cpu/x86/peephole_x86_64.cpp index 8c956aeb053..92a29490eda 100644 --- a/src/hotspot/cpu/x86/peephole_x86_64.cpp +++ b/src/hotspot/cpu/x86/peephole_x86_64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,8 +33,8 @@ // lea d, [s1 + s2] and // mov d, s1; shl d, s2 into // lea d, [s1 << s2] with s2 = 1, 2, 3 -bool lea_coalesce_helper(Block* block, int block_index, PhaseCFG* cfg_, PhaseRegAlloc* ra_, - MachNode* (*new_root)(), uint inst0_rule, bool imm) { +static bool lea_coalesce_helper(Block* block, int block_index, PhaseCFG* cfg_, PhaseRegAlloc* ra_, + MachNode* (*new_root)(), uint inst0_rule, bool imm) { MachNode* inst0 = block->get_node(block_index)->as_Mach(); assert(inst0->rule() == inst0_rule, "sanity"); @@ -136,7 +136,7 @@ bool lea_coalesce_helper(Block* block, int block_index, PhaseCFG* cfg_, PhaseReg // This helper func takes a condition and returns the flags that need to be set for the condition // It uses the same flags as the test instruction, so if the e.g. the overflow bit is required, // this func returns clears_overflow, as that is what the test instruction does and what the downstream path expects -juint map_condition_to_required_test_flags(Assembler::Condition condition) { +static juint map_condition_to_required_test_flags(Assembler::Condition condition) { switch (condition) { case Assembler::Condition::zero: // Same value as equal case Assembler::Condition::notZero: // Same value as notEqual diff --git a/src/hotspot/cpu/x86/stubRoutines_x86.cpp b/src/hotspot/cpu/x86/stubRoutines_x86.cpp index 3be83eed9d2..bc1cbdbba26 100644 --- a/src/hotspot/cpu/x86/stubRoutines_x86.cpp +++ b/src/hotspot/cpu/x86/stubRoutines_x86.cpp @@ -279,7 +279,7 @@ uint32_t _crc32c_pow_2k_table[TILL_CYCLE]; // because _crc32c_pow_2k_table[TILL_ // A. Kadatch and B. Jenkins / Everything we know about CRC but afraid to forget September 3, 2010 8 // Listing 1: Multiplication of normalized polynomials // "a" and "b" occupy D least significant bits. -uint32_t crc32c_multiply(uint32_t a, uint32_t b) { +static uint32_t crc32c_multiply(uint32_t a, uint32_t b) { uint32_t product = 0; uint32_t b_pow_x_table[D + 1]; // b_pow_x_table[k] = (b * x**k) mod P b_pow_x_table[0] = b; @@ -303,7 +303,7 @@ uint32_t crc32c_multiply(uint32_t a, uint32_t b) { #undef P // A. Kadatch and B. Jenkins / Everything we know about CRC but afraid to forget September 3, 2010 9 -void crc32c_init_pow_2k(void) { +static void crc32c_init_pow_2k(void) { // _crc32c_pow_2k_table(0) = // x^(2^k) mod P(x) = x mod P(x) = x // Since we are operating on a reflected values @@ -318,7 +318,7 @@ void crc32c_init_pow_2k(void) { } // x^N mod P(x) -uint32_t crc32c_f_pow_n(uint32_t n) { +static uint32_t crc32c_f_pow_n(uint32_t n) { // result = 1 (polynomial) uint32_t one, result = 0x80000000, i = 0; diff --git a/src/hotspot/cpu/x86/x86.ad b/src/hotspot/cpu/x86/x86.ad index a31548eb8c3..6df02d280bc 100644 --- a/src/hotspot/cpu/x86/x86.ad +++ b/src/hotspot/cpu/x86/x86.ad @@ -1358,7 +1358,7 @@ int HandlerImpl::emit_deopt_handler(CodeBuffer& cbuf) { return offset; } -Assembler::Width widthForType(BasicType bt) { +static Assembler::Width widthForType(BasicType bt) { if (bt == T_BYTE) { return Assembler::B; } else if (bt == T_SHORT) { diff --git a/src/hotspot/cpu/x86/x86_32.ad b/src/hotspot/cpu/x86/x86_32.ad index cad53ca6d5a..2fe655a5767 100644 --- a/src/hotspot/cpu/x86/x86_32.ad +++ b/src/hotspot/cpu/x86/x86_32.ad @@ -504,7 +504,7 @@ void emit_cmpfp_fixup(MacroAssembler& _masm) { __ bind(exit); } -void emit_cmpfp3(MacroAssembler& _masm, Register dst) { +static void emit_cmpfp3(MacroAssembler& _masm, Register dst) { Label done; __ movl(dst, -1); __ jcc(Assembler::parity, done); diff --git a/src/hotspot/cpu/x86/x86_64.ad b/src/hotspot/cpu/x86/x86_64.ad index d1a19e452c6..a8136688cde 100644 --- a/src/hotspot/cpu/x86/x86_64.ad +++ b/src/hotspot/cpu/x86/x86_64.ad @@ -519,7 +519,7 @@ int CallDynamicJavaDirectNode::compute_padding(int current_offset) const } // This could be in MacroAssembler but it's fairly C2 specific -void emit_cmpfp_fixup(MacroAssembler& _masm) { +static void emit_cmpfp_fixup(MacroAssembler& _masm) { Label exit; __ jccb(Assembler::noParity, exit); __ pushf(); @@ -539,7 +539,7 @@ void emit_cmpfp_fixup(MacroAssembler& _masm) { __ bind(exit); } -void emit_cmpfp3(MacroAssembler& _masm, Register dst) { +static void emit_cmpfp3(MacroAssembler& _masm, Register dst) { Label done; __ movl(dst, -1); __ jcc(Assembler::parity, done); @@ -558,10 +558,10 @@ void emit_cmpfp3(MacroAssembler& _masm, Register dst) { // je # // |-jz -> a | b # a & b // | -> a # -void emit_fp_min_max(MacroAssembler& _masm, XMMRegister dst, - XMMRegister a, XMMRegister b, - XMMRegister xmmt, Register rt, - bool min, bool single) { +static void emit_fp_min_max(MacroAssembler& _masm, XMMRegister dst, + XMMRegister a, XMMRegister b, + XMMRegister xmmt, Register rt, + bool min, bool single) { Label nan, zero, below, above, done; diff --git a/src/hotspot/os/bsd/os_bsd.cpp b/src/hotspot/os/bsd/os_bsd.cpp index ddceab14ffb..dbc18794cfe 100644 --- a/src/hotspot/os/bsd/os_bsd.cpp +++ b/src/hotspot/os/bsd/os_bsd.cpp @@ -1268,7 +1268,8 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) { } #endif // !__APPLE__ -int _print_dll_info_cb(const char * name, address base_address, address top_address, void * param) { +static int _print_dll_info_cb(const char * name, address base_address, + address top_address, void * param) { outputStream * out = (outputStream *) param; out->print_cr(INTPTR_FORMAT " \t%s", (intptr_t)base_address, name); return 0; diff --git a/src/hotspot/os/posix/signals_posix.cpp b/src/hotspot/os/posix/signals_posix.cpp index eaadb367315..6a958f8903b 100644 --- a/src/hotspot/os/posix/signals_posix.cpp +++ b/src/hotspot/os/posix/signals_posix.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -340,7 +340,7 @@ static const struct { //////////////////////////////////////////////////////////////////////////////// // sun.misc.Signal and BREAK_SIGNAL support -void jdk_misc_signal_init() { +static void jdk_misc_signal_init() { // Initialize signal structures ::memset((void*)pending_signals, 0, sizeof(pending_signals)); @@ -380,7 +380,7 @@ int os::signal_wait() { //////////////////////////////////////////////////////////////////////////////// // signal chaining support -struct sigaction* get_chained_signal_action(int sig) { +static struct sigaction* get_chained_signal_action(int sig) { struct sigaction *actp = nullptr; if (libjsig_is_loaded) { @@ -1245,7 +1245,7 @@ int os::get_signal_number(const char* signal_name) { return -1; } -void set_signal_handler(int sig) { +static void set_signal_handler(int sig) { // Check for overwrite. struct sigaction oldAct; sigaction(sig, (struct sigaction*)nullptr, &oldAct); @@ -1292,7 +1292,7 @@ void set_signal_handler(int sig) { // install signal handlers for signals that HotSpot needs to // handle in order to support Java-level exception handling. -void install_signal_handlers() { +static void install_signal_handlers() { // signal-chaining typedef void (*signal_setting_t)(); signal_setting_t begin_signal_setting = nullptr; @@ -1723,7 +1723,7 @@ static void SR_handler(int sig, siginfo_t* siginfo, void* context) { errno = old_errno; } -int SR_initialize() { +static int SR_initialize() { struct sigaction act; char *s; // Get signal number to use for suspend/resume diff --git a/src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp b/src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp index 2074f6319c9..c73e83996ff 100644 --- a/src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp +++ b/src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -350,7 +350,7 @@ frame os::get_sender_for_C_frame(frame* fr) { return frame(fr->sender_sp(), fr->link(), fr->sender_pc()); } -intptr_t* _get_previous_fp() { +static intptr_t* _get_previous_fp() { #if defined(__clang__) || defined(__llvm__) intptr_t **ebp; __asm__("mov %%" SPELL_REG_FP ", %0":"=r"(ebp)); diff --git a/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp b/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp index 219f8d828a4..4dcaedf71da 100644 --- a/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp +++ b/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -164,7 +164,7 @@ frame os::get_sender_for_C_frame(frame* fr) { return frame(fr->sender_sp(), fr->link(), fr->sender_pc()); } -intptr_t* _get_previous_fp() { +static intptr_t* _get_previous_fp() { #if defined(__clang__) intptr_t **ebp; __asm__ __volatile__ ("mov %%" SPELL_REG_FP ", %0":"=r"(ebp):); diff --git a/src/hotspot/share/c1/c1_GraphBuilder.cpp b/src/hotspot/share/c1/c1_GraphBuilder.cpp index 6e5fb99242c..396c83c6ab9 100644 --- a/src/hotspot/share/c1/c1_GraphBuilder.cpp +++ b/src/hotspot/share/c1/c1_GraphBuilder.cpp @@ -523,7 +523,7 @@ inline bool BlockListBuilder::is_successor(BlockBegin* block, BlockBegin* sux) { #ifndef PRODUCT -int compare_depth_first(BlockBegin** a, BlockBegin** b) { +static int compare_depth_first(BlockBegin** a, BlockBegin** b) { return (*a)->depth_first_number() - (*b)->depth_first_number(); } diff --git a/src/hotspot/share/c1/c1_LinearScan.cpp b/src/hotspot/share/c1/c1_LinearScan.cpp index 9e9195a0d60..a4d955e52a0 100644 --- a/src/hotspot/share/c1/c1_LinearScan.cpp +++ b/src/hotspot/share/c1/c1_LinearScan.cpp @@ -1446,12 +1446,12 @@ int LinearScan::interval_cmp(Interval** a, Interval** b) { } } -#ifndef PRODUCT -int interval_cmp(Interval* const& l, Interval* const& r) { +#ifdef ASSERT +static int interval_cmp(Interval* const& l, Interval* const& r) { return l->from() - r->from(); } -bool find_interval(Interval* interval, IntervalArray* intervals) { +static bool find_interval(Interval* interval, IntervalArray* intervals) { bool found; int idx = intervals->find_sorted<Interval*, interval_cmp>(interval, found); @@ -2303,11 +2303,11 @@ void assert_no_register_values(GrowableArray<MonitorValue*>* values) { } } -void assert_equal(Location l1, Location l2) { +static void assert_equal(Location l1, Location l2) { assert(l1.where() == l2.where() && l1.type() == l2.type() && l1.offset() == l2.offset(), ""); } -void assert_equal(ScopeValue* v1, ScopeValue* v2) { +static void assert_equal(ScopeValue* v1, ScopeValue* v2) { if (v1->is_location()) { assert(v2->is_location(), ""); assert_equal(((LocationValue*)v1)->location(), ((LocationValue*)v2)->location()); @@ -2328,12 +2328,12 @@ void assert_equal(ScopeValue* v1, ScopeValue* v2) { } } -void assert_equal(MonitorValue* m1, MonitorValue* m2) { +static void assert_equal(MonitorValue* m1, MonitorValue* m2) { assert_equal(m1->owner(), m2->owner()); assert_equal(m1->basic_lock(), m2->basic_lock()); } -void assert_equal(IRScopeDebugInfo* d1, IRScopeDebugInfo* d2) { +static void assert_equal(IRScopeDebugInfo* d1, IRScopeDebugInfo* d2) { assert(d1->scope() == d2->scope(), "not equal"); assert(d1->bci() == d2->bci(), "not equal"); @@ -2375,7 +2375,7 @@ void assert_equal(IRScopeDebugInfo* d1, IRScopeDebugInfo* d2) { } } -void check_stack_depth(CodeEmitInfo* info, int stack_end) { +static void check_stack_depth(CodeEmitInfo* info, int stack_end) { if (info->stack()->bci() != SynchronizationEntryBCI && !info->scope()->method()->is_native()) { Bytecodes::Code code = info->scope()->method()->java_code_at_bci(info->stack()->bci()); switch (code) { diff --git a/src/hotspot/share/c1/c1_Optimizer.cpp b/src/hotspot/share/c1/c1_Optimizer.cpp index 6cd282d02ad..dd428a5895b 100644 --- a/src/hotspot/share/c1/c1_Optimizer.cpp +++ b/src/hotspot/share/c1/c1_Optimizer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -335,7 +335,7 @@ void Optimizer::eliminate_conditional_expressions() { } // This removes others' relation to block, but doesn't empty block's lists -void disconnect_from_graph(BlockBegin* block) { +static void disconnect_from_graph(BlockBegin* block) { for (int p = 0; p < block->number_of_preds(); p++) { BlockBegin* pred = block->pred_at(p); int idx; diff --git a/src/hotspot/share/cds/filemap.cpp b/src/hotspot/share/cds/filemap.cpp index 5a0bf2e61b5..f6e02594b5c 100644 --- a/src/hotspot/share/cds/filemap.cpp +++ b/src/hotspot/share/cds/filemap.cpp @@ -1664,9 +1664,9 @@ void FileMapInfo::close() { /* * Same as os::map_memory() but also pretouches if AlwaysPreTouch is enabled. */ -char* map_memory(int fd, const char* file_name, size_t file_offset, - char *addr, size_t bytes, bool read_only, - bool allow_exec, MEMFLAGS flags = mtNone) { +static char* map_memory(int fd, const char* file_name, size_t file_offset, + char *addr, size_t bytes, bool read_only, + bool allow_exec, MEMFLAGS flags = mtNone) { char* mem = os::map_memory(fd, file_name, file_offset, addr, bytes, AlwaysPreTouch ? false : read_only, allow_exec, flags); diff --git a/src/hotspot/share/classfile/altHashing.cpp b/src/hotspot/share/classfile/altHashing.cpp index 158a8a232a7..1d43d6ebf1e 100644 --- a/src/hotspot/share/classfile/altHashing.cpp +++ b/src/hotspot/share/classfile/altHashing.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -120,7 +120,7 @@ static void halfsiphash_init64(uint32_t v[4], uint64_t seed) { v[1] ^= 0xee; } -uint32_t halfsiphash_finish32(uint32_t v[4], int rounds) { +static uint32_t halfsiphash_finish32(uint32_t v[4], int rounds) { v[2] ^= 0xff; halfsiphash_rounds(v, rounds); return (v[1] ^ v[3]); diff --git a/src/hotspot/share/classfile/classLoader.cpp b/src/hotspot/share/classfile/classLoader.cpp index 43aa82b67f8..9ce49b71734 100644 --- a/src/hotspot/share/classfile/classLoader.cpp +++ b/src/hotspot/share/classfile/classLoader.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -134,7 +134,8 @@ ClassPathEntry* ClassLoader::_last_module_path_entry = nullptr; #endif // helper routines -bool string_starts_with(const char* str, const char* str_to_find) { +#if INCLUDE_CDS +static bool string_starts_with(const char* str, const char* str_to_find) { size_t str_len = strlen(str); size_t str_to_find_len = strlen(str_to_find); if (str_to_find_len > str_len) { @@ -142,6 +143,7 @@ bool string_starts_with(const char* str, const char* str_to_find) { } return (strncmp(str, str_to_find, str_to_find_len) == 0); } +#endif static const char* get_jimage_version_string() { static char version_string[10] = ""; @@ -1009,8 +1011,8 @@ const char* ClassLoader::file_name_for_class_name(const char* class_name, return file_name; } -ClassPathEntry* find_first_module_cpe(ModuleEntry* mod_entry, - const GrowableArray<ModuleClassPathList*>* const module_list) { +static ClassPathEntry* find_first_module_cpe(ModuleEntry* mod_entry, + const GrowableArray<ModuleClassPathList*>* const module_list) { int num_of_entries = module_list->length(); const Symbol* class_module_name = mod_entry->name(); @@ -1355,7 +1357,7 @@ void ClassLoader::initialize(TRAPS) { setup_bootstrap_search_path(THREAD); } -char* lookup_vm_resource(JImageFile *jimage, const char *jimage_version, const char *path) { +static char* lookup_vm_resource(JImageFile *jimage, const char *jimage_version, const char *path) { jlong size; JImageLocationRef location = (*JImageFindResource)(jimage, "java.base", jimage_version, path, &size); if (location == 0) diff --git a/src/hotspot/share/classfile/loaderConstraints.cpp b/src/hotspot/share/classfile/loaderConstraints.cpp index e6021e00d33..99d0c07ed42 100644 --- a/src/hotspot/share/classfile/loaderConstraints.cpp +++ b/src/hotspot/share/classfile/loaderConstraints.cpp @@ -296,8 +296,8 @@ void LoaderConstraintTable::purge_loader_constraints() { _loader_constraint_table->unlink(&purge); } -void log_ldr_constraint_msg(Symbol* class_name, const char* reason, - ClassLoaderData* loader1, ClassLoaderData* loader2) { +static void log_ldr_constraint_msg(Symbol* class_name, const char* reason, + ClassLoaderData* loader1, ClassLoaderData* loader2) { LogTarget(Info, class, loader, constraints) lt; if (lt.is_enabled()) { ResourceMark rm; diff --git a/src/hotspot/share/classfile/modules.cpp b/src/hotspot/share/classfile/modules.cpp index bd4be93b868..4664d9565d3 100644 --- a/src/hotspot/share/classfile/modules.cpp +++ b/src/hotspot/share/classfile/modules.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -259,7 +259,7 @@ static void define_javabase_module(Handle module_handle, jstring version, jstrin } // Caller needs ResourceMark. -void throw_dup_pkg_exception(const char* module_name, PackageEntry* package, TRAPS) { +static void throw_dup_pkg_exception(const char* module_name, PackageEntry* package, TRAPS) { const char* package_name = package->name()->as_C_string(); if (package->module()->is_named()) { THROW_MSG(vmSymbols::java_lang_IllegalStateException(), diff --git a/src/hotspot/share/classfile/placeholders.cpp b/src/hotspot/share/classfile/placeholders.cpp index 1bb5f878704..a6a86473ea7 100644 --- a/src/hotspot/share/classfile/placeholders.cpp +++ b/src/hotspot/share/classfile/placeholders.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -198,8 +198,8 @@ void PlaceholderEntry::set_supername(Symbol* supername) { // All threads examining the placeholder table must hold the // SystemDictionary_lock, so we don't need special precautions // on store ordering here. -PlaceholderEntry* add_entry(Symbol* class_name, ClassLoaderData* loader_data, - Symbol* supername){ +static PlaceholderEntry* add_entry(Symbol* class_name, ClassLoaderData* loader_data, + Symbol* supername){ assert_locked_or_safepoint(SystemDictionary_lock); assert(class_name != nullptr, "adding nullptr obj"); @@ -213,7 +213,7 @@ PlaceholderEntry* add_entry(Symbol* class_name, ClassLoaderData* loader_data, } // Remove a placeholder object. -void remove_entry(Symbol* class_name, ClassLoaderData* loader_data) { +static void remove_entry(Symbol* class_name, ClassLoaderData* loader_data) { assert_locked_or_safepoint(SystemDictionary_lock); PlaceholderKey key(class_name, loader_data); diff --git a/src/hotspot/share/classfile/stringTable.cpp b/src/hotspot/share/classfile/stringTable.cpp index 9e96340d82b..be2971288ef 100644 --- a/src/hotspot/share/classfile/stringTable.cpp +++ b/src/hotspot/share/classfile/stringTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -122,7 +122,7 @@ volatile bool _alt_hash = false; static bool _rehashed = false; static uint64_t _alt_hash_seed = 0; -unsigned int hash_string(const jchar* s, int len, bool useAlt) { +static unsigned int hash_string(const jchar* s, int len, bool useAlt) { return useAlt ? AltHashing::halfsiphash_32(_alt_hash_seed, s, len) : java_lang_String::hash_code(s, len); diff --git a/src/hotspot/share/classfile/systemDictionary.cpp b/src/hotspot/share/classfile/systemDictionary.cpp index 82c20a962ce..f2a88f00e0d 100644 --- a/src/hotspot/share/classfile/systemDictionary.cpp +++ b/src/hotspot/share/classfile/systemDictionary.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -212,13 +212,13 @@ void SystemDictionary::set_platform_loader(ClassLoaderData *cld) { // ---------------------------------------------------------------------------- // Parallel class loading check -bool is_parallelCapable(Handle class_loader) { +static bool is_parallelCapable(Handle class_loader) { if (class_loader.is_null()) return true; return java_lang_ClassLoader::parallelCapable(class_loader()); } // ---------------------------------------------------------------------------- // ParallelDefineClass flag does not apply to bootclass loader -bool is_parallelDefine(Handle class_loader) { +static bool is_parallelDefine(Handle class_loader) { if (class_loader.is_null()) return false; if (AllowParallelDefineClass && java_lang_ClassLoader::parallelCapable(class_loader())) { return true; @@ -280,7 +280,7 @@ Symbol* SystemDictionary::class_name_symbol(const char* name, Symbol* exception, #ifdef ASSERT // Used to verify that class loading succeeded in adding k to the dictionary. -void verify_dictionary_entry(Symbol* class_name, InstanceKlass* k) { +static void verify_dictionary_entry(Symbol* class_name, InstanceKlass* k) { MutexLocker mu(SystemDictionary_lock); ClassLoaderData* loader_data = k->class_loader_data(); Dictionary* dictionary = loader_data->dictionary(); diff --git a/src/hotspot/share/classfile/systemDictionaryShared.cpp b/src/hotspot/share/classfile/systemDictionaryShared.cpp index 29748352684..44d7da5c4a4 100644 --- a/src/hotspot/share/classfile/systemDictionaryShared.cpp +++ b/src/hotspot/share/classfile/systemDictionaryShared.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1348,7 +1348,7 @@ void SystemDictionaryShared::update_shared_entry(InstanceKlass* k, int id) { info->_id = id; } -const char* class_loader_name_for_shared(Klass* k) { +static const char* class_loader_name_for_shared(Klass* k) { assert(k != nullptr, "Sanity"); assert(k->is_shared(), "Must be"); assert(k->is_instance_klass(), "Must be"); diff --git a/src/hotspot/share/compiler/compileBroker.cpp b/src/hotspot/share/compiler/compileBroker.cpp index 1ade28278ae..3a251128914 100644 --- a/src/hotspot/share/compiler/compileBroker.cpp +++ b/src/hotspot/share/compiler/compileBroker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -582,7 +582,7 @@ CompilerCounters::CompilerCounters() { // c2 uses explicit CompilerPhaseType idToPhase mapping in opto/phasetype.hpp, // so if c2 is used, it should be always registered first. // This function is called during vm initialization. -void register_jfr_phasetype_serializer(CompilerType compiler_type) { +static void register_jfr_phasetype_serializer(CompilerType compiler_type) { ResourceMark rm; static bool first_registration = true; if (compiler_type == compiler_jvmci) { diff --git a/src/hotspot/share/compiler/compilerOracle.cpp b/src/hotspot/share/compiler/compilerOracle.cpp index 089fc5a4d99..a8eee10fac5 100644 --- a/src/hotspot/share/compiler/compilerOracle.cpp +++ b/src/hotspot/share/compiler/compilerOracle.cpp @@ -48,7 +48,7 @@ static const char* optiontype_names[] = { #undef enum_of_types }; -const char* optiontype2name(enum OptionType type) { +static const char* optiontype2name(enum OptionType type) { return optiontype_names[static_cast<int>(type)]; } @@ -58,7 +58,7 @@ static enum OptionType option_types[] = { #undef enum_of_options }; -enum OptionType option2type(enum CompileCommand option) { +static enum OptionType option2type(enum CompileCommand option) { return option_types[static_cast<int>(option)]; } @@ -68,7 +68,7 @@ static const char* option_names[] = { #undef enum_of_options }; -const char* option2name(enum CompileCommand option) { +static const char* option2name(enum CompileCommand option) { return option_names[static_cast<int>(option)]; } @@ -108,7 +108,7 @@ static bool print_final_memstat_report = false; // A filter for quick lookup if an option is set static bool option_filter[static_cast<int>(CompileCommand::Unknown) + 1] = { 0 }; -void command_set_in_filter(enum CompileCommand option) { +static void command_set_in_filter(enum CompileCommand option) { assert(option != CompileCommand::Unknown, "sanity"); assert(option2type(option) != OptionType::Unknown, "sanity"); @@ -120,7 +120,7 @@ void command_set_in_filter(enum CompileCommand option) { option_filter[static_cast<int>(option)] = true; } -bool has_command(enum CompileCommand option) { +static bool has_command(enum CompileCommand option) { return option_filter[static_cast<int>(option)]; } @@ -547,7 +547,7 @@ enum OptionType CompilerOracle::parse_option_type(const char* type_str) { return OptionType::Unknown; } -void print_tip() { // CMH Update info +static void print_tip() { // CMH Update info tty->cr(); tty->print_cr("Usage: '-XX:CompileCommand=<option>,<method pattern>' - to set boolean option to true"); tty->print_cr("Usage: '-XX:CompileCommand=<option>,<method pattern>,<value>'"); @@ -555,13 +555,13 @@ void print_tip() { // CMH Update info tty->cr(); } -void print_option(enum CompileCommand option, const char* name, enum OptionType type) { +static void print_option(enum CompileCommand option, const char* name, enum OptionType type) { if (type != OptionType::Unknown) { tty->print_cr(" %s (%s)", name, optiontype2name(type)); } } -void print_commands() { +static void print_commands() { tty->cr(); tty->print_cr("All available options:"); #define enum_of_options(option, name, ctype) print_option(CompileCommand::option, name, OptionType::ctype); @@ -621,7 +621,7 @@ static void usage() { tty->cr(); }; -int skip_whitespace(char* &line) { +static int skip_whitespace(char* &line) { // Skip any leading spaces int whitespace_read = 0; sscanf(line, "%*[ \t]%n", &whitespace_read); @@ -629,7 +629,7 @@ int skip_whitespace(char* &line) { return whitespace_read; } -void skip_comma(char* &line) { +static void skip_comma(char* &line) { // Skip any leading spaces if (*line == ',') { line++; diff --git a/src/hotspot/share/compiler/methodMatcher.cpp b/src/hotspot/share/compiler/methodMatcher.cpp index 3e2ee288c80..de2e4e82bba 100644 --- a/src/hotspot/share/compiler/methodMatcher.cpp +++ b/src/hotspot/share/compiler/methodMatcher.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -246,7 +246,7 @@ static MethodMatcher::Mode check_mode(char name[], const char*& error_msg) { } // Skip any leading spaces -void skip_leading_spaces(char*& line, int* total_bytes_read ) { +static void skip_leading_spaces(char*& line, int* total_bytes_read ) { int bytes_read = 0; sscanf(line, "%*[ \t]%n", &bytes_read); if (bytes_read > 0) { diff --git a/src/hotspot/share/gc/parallel/psParallelCompact.cpp b/src/hotspot/share/gc/parallel/psParallelCompact.cpp index e45b6085112..d7bfe5242a9 100644 --- a/src/hotspot/share/gc/parallel/psParallelCompact.cpp +++ b/src/hotspot/share/gc/parallel/psParallelCompact.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -246,7 +246,7 @@ void PSParallelCompact::print_region_ranges() { } } -void +static void print_generic_summary_region(size_t i, const ParallelCompactData::RegionData* c) { #define REGION_IDX_FORMAT SIZE_FORMAT_W(7) @@ -312,7 +312,7 @@ print_generic_summary_data(ParallelCompactData& summary_data, } } -void +static void print_initial_summary_data(ParallelCompactData& summary_data, const MutableSpace* space) { if (space->top() == space->bottom()) { @@ -393,7 +393,7 @@ print_initial_summary_data(ParallelCompactData& summary_data, max_reclaimed_ratio_region, max_dead_to_right, max_live_to_right, max_reclaimed_ratio); } -void +static void print_initial_summary_data(ParallelCompactData& summary_data, SpaceInfo* space_info) { if (!log_develop_is_enabled(Trace, gc, compaction)) { diff --git a/src/hotspot/share/gc/shared/gcId.cpp b/src/hotspot/share/gc/shared/gcId.cpp index 646de833910..8d123386180 100644 --- a/src/hotspot/share/gc/shared/gcId.cpp +++ b/src/hotspot/share/gc/shared/gcId.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,7 +43,7 @@ void GCId::set_printer(GCIdPrinter* printer) { _printer = printer; } -NamedThread* currentNamedthread() { +static NamedThread* currentNamedthread() { assert(Thread::current()->is_Named_thread(), "This thread must be NamedThread"); return (NamedThread*)Thread::current(); } diff --git a/src/hotspot/share/gc/shared/weakProcessor.cpp b/src/hotspot/share/gc/shared/weakProcessor.cpp index 02ef9bbe88d..8adf3fab7d5 100644 --- a/src/hotspot/share/gc/shared/weakProcessor.cpp +++ b/src/hotspot/share/gc/shared/weakProcessor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,7 +41,7 @@ #include "prims/jvmtiTagMap.hpp" #endif // INCLUDE_JVMTI -void notify_jvmti_tagmaps() { +static void notify_jvmti_tagmaps() { #if INCLUDE_JVMTI // Notify JVMTI tagmaps that a STW weak reference processing might be // clearing entries, so the tagmaps need cleaning. Doing this here allows diff --git a/src/hotspot/share/gc/x/xDirector.cpp b/src/hotspot/share/gc/x/xDirector.cpp index 05ef3623741..e1c69bd05b7 100644 --- a/src/hotspot/share/gc/x/xDirector.cpp +++ b/src/hotspot/share/gc/x/xDirector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -168,7 +168,7 @@ static double select_gc_workers(double serial_gc_time, double parallelizable_gc_ return gc_workers; } -XDriverRequest rule_allocation_rate_dynamic() { +static XDriverRequest rule_allocation_rate_dynamic() { if (!XStatCycle::is_time_trustable()) { // Rule disabled return GCCause::_no_gc; diff --git a/src/hotspot/share/gc/z/zDirector.cpp b/src/hotspot/share/gc/z/zDirector.cpp index 417ac33a6f8..47e24063ead 100644 --- a/src/hotspot/share/gc/z/zDirector.cpp +++ b/src/hotspot/share/gc/z/zDirector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -143,11 +143,11 @@ static double select_young_gc_workers(const ZDirectorStats& stats, double serial return gc_workers; } -ZDriverRequest rule_minor_allocation_rate_dynamic(const ZDirectorStats& stats, - double serial_gc_time_passed, - double parallel_gc_time_passed, - bool conservative_alloc_rate, - size_t capacity) { +static ZDriverRequest rule_minor_allocation_rate_dynamic(const ZDirectorStats& stats, + double serial_gc_time_passed, + double parallel_gc_time_passed, + bool conservative_alloc_rate, + size_t capacity) { if (!stats._old_stats._cycle._is_time_trustable) { // Rule disabled return ZDriverRequest(GCCause::_no_gc, ZYoungGCThreads, 0); @@ -214,9 +214,9 @@ ZDriverRequest rule_minor_allocation_rate_dynamic(const ZDirectorStats& stats, return ZDriverRequest(GCCause::_z_allocation_rate, actual_gc_workers, 0); } -ZDriverRequest rule_soft_minor_allocation_rate_dynamic(const ZDirectorStats& stats, - double serial_gc_time_passed, - double parallel_gc_time_passed) { +static ZDriverRequest rule_soft_minor_allocation_rate_dynamic(const ZDirectorStats& stats, + double serial_gc_time_passed, + double parallel_gc_time_passed) { return rule_minor_allocation_rate_dynamic(stats, 0.0 /* serial_gc_time_passed */, 0.0 /* parallel_gc_time_passed */, @@ -224,9 +224,9 @@ ZDriverRequest rule_soft_minor_allocation_rate_dynamic(const ZDirectorStats& sta stats._heap._soft_max_heap_size /* capacity */); } -ZDriverRequest rule_semi_hard_minor_allocation_rate_dynamic(const ZDirectorStats& stats, - double serial_gc_time_passed, - double parallel_gc_time_passed) { +static ZDriverRequest rule_semi_hard_minor_allocation_rate_dynamic(const ZDirectorStats& stats, + double serial_gc_time_passed, + double parallel_gc_time_passed) { return rule_minor_allocation_rate_dynamic(stats, 0.0 /* serial_gc_time_passed */, 0.0 /* parallel_gc_time_passed */, @@ -234,9 +234,9 @@ ZDriverRequest rule_semi_hard_minor_allocation_rate_dynamic(const ZDirectorStats ZHeap::heap()->max_capacity() /* capacity */); } -ZDriverRequest rule_hard_minor_allocation_rate_dynamic(const ZDirectorStats& stats, - double serial_gc_time_passed, - double parallel_gc_time_passed) { +static ZDriverRequest rule_hard_minor_allocation_rate_dynamic(const ZDirectorStats& stats, + double serial_gc_time_passed, + double parallel_gc_time_passed) { return rule_minor_allocation_rate_dynamic(stats, 0.0 /* serial_gc_time_passed */, 0.0 /* parallel_gc_time_passed */, diff --git a/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleWriter.cpp b/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleWriter.cpp index 2c2d7fe7b3d..87851c71cdb 100644 --- a/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleWriter.cpp +++ b/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleWriter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -199,7 +199,7 @@ static ArrayInfo* array_infos = nullptr; static FieldTable* field_infos = nullptr; static RootDescriptionInfo* root_infos = nullptr; -int __write_sample_info__(JfrCheckpointWriter* writer, const void* si) { +static int __write_sample_info__(JfrCheckpointWriter* writer, const void* si) { assert(writer != nullptr, "invariant"); assert(si != nullptr, "invariant"); const OldObjectSampleInfo* const oosi = (const OldObjectSampleInfo*)si; @@ -224,7 +224,7 @@ static void write_sample_infos(JfrCheckpointWriter& writer) { } } -int __write_reference_info__(JfrCheckpointWriter* writer, const void* ri) { +static int __write_reference_info__(JfrCheckpointWriter* writer, const void* ri) { assert(writer != nullptr, "invariant"); assert(ri != nullptr, "invariant"); const ReferenceInfo* const ref_info = (const ReferenceInfo*)ri; @@ -246,7 +246,7 @@ static void write_reference_infos(JfrCheckpointWriter& writer) { } } -int __write_array_info__(JfrCheckpointWriter* writer, const void* ai) { +static int __write_array_info__(JfrCheckpointWriter* writer, const void* ai) { assert(writer != nullptr, "invariant"); assert(ai != nullptr, "invariant"); const ObjectSampleArrayInfo* const osai = (const ObjectSampleArrayInfo*)ai; @@ -283,7 +283,7 @@ static void write_array_infos(JfrCheckpointWriter& writer) { } } -int __write_field_info__(JfrCheckpointWriter* writer, const void* fi) { +static int __write_field_info__(JfrCheckpointWriter* writer, const void* fi) { assert(writer != nullptr, "invariant"); assert(fi != nullptr, "invariant"); const FieldTable::FieldInfoEntry* field_info_entry = (const FieldTable::FieldInfoEntry*)fi; @@ -340,7 +340,7 @@ static const char* description(const ObjectSampleRootDescriptionInfo* osdi) { return description.description(); } -int __write_root_description_info__(JfrCheckpointWriter* writer, const void* di) { +static int __write_root_description_info__(JfrCheckpointWriter* writer, const void* di) { assert(writer != nullptr, "invariant"); assert(di != nullptr, "invariant"); const ObjectSampleRootDescriptionInfo* const osdi = (const ObjectSampleRootDescriptionInfo*)di; @@ -367,11 +367,11 @@ typedef JfrTypeWriterImplHost<const ObjectSampleRootDescriptionInfo*, __write_ro typedef JfrTypeWriterHost<RootDescriptionWriterImpl, TYPE_OLDOBJECTGCROOT> RootDescriptionWriter; -int _edge_reference_compare_(uintptr_t lhs, uintptr_t rhs) { +static int _edge_reference_compare_(uintptr_t lhs, uintptr_t rhs) { return lhs > rhs ? 1 : (lhs < rhs) ? -1 : 0; } -int _root_desc_compare_(const ObjectSampleRootDescriptionInfo*const & lhs, const ObjectSampleRootDescriptionInfo* const& rhs) { +static int _root_desc_compare_(const ObjectSampleRootDescriptionInfo*const & lhs, const ObjectSampleRootDescriptionInfo* const& rhs) { const uintptr_t lhs_ref = lhs->_data._root_edge->reference().addr<uintptr_t>(); const uintptr_t rhs_ref = rhs->_data._root_edge->reference().addr<uintptr_t>(); return _edge_reference_compare_(lhs_ref, rhs_ref); diff --git a/src/hotspot/share/jfr/periodic/sampling/jfrThreadSampler.cpp b/src/hotspot/share/jfr/periodic/sampling/jfrThreadSampler.cpp index 0ab787a7f3a..5cef25c54cb 100644 --- a/src/hotspot/share/jfr/periodic/sampling/jfrThreadSampler.cpp +++ b/src/hotspot/share/jfr/periodic/sampling/jfrThreadSampler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -668,7 +668,7 @@ JfrThreadSampling::~JfrThreadSampling() { } #ifdef ASSERT -void assert_periods(const JfrThreadSampler* sampler, int64_t java_period_millis, int64_t native_period_millis) { +static void assert_periods(const JfrThreadSampler* sampler, int64_t java_period_millis, int64_t native_period_millis) { assert(sampler != nullptr, "invariant"); assert(sampler->get_java_period() == java_period_millis, "invariant"); assert(sampler->get_native_period() == native_period_millis, "invariant"); diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp index 31a4c3f25e9..3ef7abd8a43 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp @@ -1089,14 +1089,14 @@ static int write_symbol(JfrCheckpointWriter* writer, SymbolEntryPtr entry, bool return 1; } -int write__symbol(JfrCheckpointWriter* writer, const void* e) { +static int write__symbol(JfrCheckpointWriter* writer, const void* e) { assert(e != nullptr, "invariant"); SymbolEntryPtr entry = static_cast<SymbolEntryPtr>(e); set_serialized(entry); return write_symbol(writer, entry, false); } -int write__symbol__leakp(JfrCheckpointWriter* writer, const void* e) { +static int write__symbol__leakp(JfrCheckpointWriter* writer, const void* e) { assert(e != nullptr, "invariant"); SymbolEntryPtr entry = static_cast<SymbolEntryPtr>(e); return write_symbol(writer, entry, true); @@ -1110,14 +1110,14 @@ static int write_string(JfrCheckpointWriter* writer, StringEntryPtr entry, bool return 1; } -int write__string(JfrCheckpointWriter* writer, const void* e) { +static int write__string(JfrCheckpointWriter* writer, const void* e) { assert(e != nullptr, "invariant"); StringEntryPtr entry = static_cast<StringEntryPtr>(e); set_serialized(entry); return write_string(writer, entry, false); } -int write__string__leakp(JfrCheckpointWriter* writer, const void* e) { +static int write__string__leakp(JfrCheckpointWriter* writer, const void* e) { assert(e != nullptr, "invariant"); StringEntryPtr entry = static_cast<StringEntryPtr>(e); return write_string(writer, entry, true); diff --git a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp index 0999363688f..ca375073313 100644 --- a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp +++ b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp @@ -1380,7 +1380,7 @@ C2V_END /* * Used by matches() to convert a ResolvedJavaMethod[] to an array of Method*. */ -GrowableArray<Method*>* init_resolved_methods(jobjectArray methods, JVMCIEnv* JVMCIENV) { +static GrowableArray<Method*>* init_resolved_methods(jobjectArray methods, JVMCIEnv* JVMCIENV) { objArrayOop methods_oop = (objArrayOop) JNIHandles::resolve(methods); GrowableArray<Method*>* resolved_methods = new GrowableArray<Method*>(methods_oop->length()); for (int i = 0; i < methods_oop->length(); i++) { @@ -1399,7 +1399,7 @@ GrowableArray<Method*>* init_resolved_methods(jobjectArray methods, JVMCIEnv* JV * The ResolvedJavaMethod[] array is converted to a Method* array that is then cached in the resolved_methods_ref in/out parameter. * In case of a match, the matching ResolvedJavaMethod is returned in matched_jvmci_method_ref. */ -bool matches(jobjectArray methods, Method* method, GrowableArray<Method*>** resolved_methods_ref, Handle* matched_jvmci_method_ref, Thread* THREAD, JVMCIEnv* JVMCIENV) { +static bool matches(jobjectArray methods, Method* method, GrowableArray<Method*>** resolved_methods_ref, Handle* matched_jvmci_method_ref, Thread* THREAD, JVMCIEnv* JVMCIENV) { GrowableArray<Method*>* resolved_methods = *resolved_methods_ref; if (resolved_methods == nullptr) { resolved_methods = init_resolved_methods(methods, JVMCIENV); @@ -1420,7 +1420,7 @@ bool matches(jobjectArray methods, Method* method, GrowableArray<Method*>** reso /* * Resolves an interface call to a concrete method handle. */ -methodHandle resolve_interface_call(Klass* spec_klass, Symbol* name, Symbol* signature, JavaCallArguments* args, TRAPS) { +static methodHandle resolve_interface_call(Klass* spec_klass, Symbol* name, Symbol* signature, JavaCallArguments* args, TRAPS) { CallInfo callinfo; Handle receiver = args->receiver(); Klass* recvrKlass = receiver.is_null() ? (Klass*)nullptr : receiver->klass(); @@ -1435,7 +1435,7 @@ methodHandle resolve_interface_call(Klass* spec_klass, Symbol* name, Symbol* sig /* * Used by c2v_iterateFrames to make a new vframeStream at the given compiled frame id (stack pointer) and vframe id. */ -void resync_vframestream_to_compiled_frame(vframeStream& vfst, intptr_t* stack_pointer, int vframe_id, JavaThread* thread, TRAPS) { +static void resync_vframestream_to_compiled_frame(vframeStream& vfst, intptr_t* stack_pointer, int vframe_id, JavaThread* thread, TRAPS) { vfst = vframeStream(thread); while (vfst.frame_id() != stack_pointer && !vfst.at_end()) { vfst.next(); @@ -1458,7 +1458,7 @@ void resync_vframestream_to_compiled_frame(vframeStream& vfst, intptr_t* stack_p /* * Used by c2v_iterateFrames. Returns an array of any unallocated scope objects or null if none. */ -GrowableArray<ScopeValue*>* get_unallocated_objects_or_null(GrowableArray<ScopeValue*>* scope_objects) { +static GrowableArray<ScopeValue*>* get_unallocated_objects_or_null(GrowableArray<ScopeValue*>* scope_objects) { GrowableArray<ScopeValue*>* unallocated = nullptr; for (int i = 0; i < scope_objects->length(); i++) { ObjectValue* sv = (ObjectValue*) scope_objects->at(i); diff --git a/src/hotspot/share/memory/metaspace/virtualSpaceNode.cpp b/src/hotspot/share/memory/metaspace/virtualSpaceNode.cpp index dc5f7a6cdf1..84f9c9ecc43 100644 --- a/src/hotspot/share/memory/metaspace/virtualSpaceNode.cpp +++ b/src/hotspot/share/memory/metaspace/virtualSpaceNode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2021 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -56,12 +56,12 @@ namespace metaspace { #define LOGFMT_ARGS p2i(this), p2i(_base) #ifdef ASSERT -void check_pointer_is_aligned_to_commit_granule(const MetaWord* p) { +static void check_pointer_is_aligned_to_commit_granule(const MetaWord* p) { assert(is_aligned(p, Settings::commit_granule_bytes()), "Pointer not aligned to commit granule size: " PTR_FORMAT ".", p2i(p)); } -void check_word_size_is_aligned_to_commit_granule(size_t word_size) { +static void check_word_size_is_aligned_to_commit_granule(size_t word_size) { assert(is_aligned(word_size, Settings::commit_granule_words()), "Not aligned to commit granule size: " SIZE_FORMAT ".", word_size); } diff --git a/src/hotspot/share/memory/universe.cpp b/src/hotspot/share/memory/universe.cpp index dfeb6b11f6f..2a3d532725f 100644 --- a/src/hotspot/share/memory/universe.cpp +++ b/src/hotspot/share/memory/universe.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -298,7 +298,7 @@ void Universe::check_alignment(uintx size, uintx alignment, const char* name) { } } -void initialize_basic_type_klass(Klass* k, TRAPS) { +static void initialize_basic_type_klass(Klass* k, TRAPS) { Klass* ok = vmClasses::Object_klass(); #if INCLUDE_CDS if (UseSharedSpaces) { @@ -924,11 +924,11 @@ void universe_oopstorage_init() { Universe::oopstorage_init(); } -void initialize_known_method(LatestMethodCache* method_cache, - InstanceKlass* ik, - const char* method, - Symbol* signature, - bool is_static, TRAPS) +static void initialize_known_method(LatestMethodCache* method_cache, + InstanceKlass* ik, + const char* method, + Symbol* signature, + bool is_static, TRAPS) { TempNewSymbol name = SymbolTable::new_symbol(method); Method* m = nullptr; diff --git a/src/hotspot/share/oops/constMethod.cpp b/src/hotspot/share/oops/constMethod.cpp index 8b4b509323f..a6a93d6f48a 100644 --- a/src/hotspot/share/oops/constMethod.cpp +++ b/src/hotspot/share/oops/constMethod.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -384,7 +384,7 @@ AnnotationArray** ConstMethod::default_annotations_addr() const { return (AnnotationArray**)constMethod_end() - offset; } -Array<u1>* copy_annotations(ClassLoaderData* loader_data, AnnotationArray* from, TRAPS) { +static Array<u1>* copy_annotations(ClassLoaderData* loader_data, AnnotationArray* from, TRAPS) { int length = from->length(); Array<u1>* a = MetadataFactory::new_array<u1>(loader_data, length, 0, CHECK_NULL); memcpy((void*)a->adr_at(0), (void*)from->adr_at(0), length); diff --git a/src/hotspot/share/oops/cpCache.cpp b/src/hotspot/share/oops/cpCache.cpp index daa094baa7e..43e30a9ca3c 100644 --- a/src/hotspot/share/oops/cpCache.cpp +++ b/src/hotspot/share/oops/cpCache.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -453,7 +453,7 @@ void ConstantPoolCache::set_archived_references(int root_index) { #endif #if INCLUDE_JVMTI -void log_adjust(const char* entry_type, Method* old_method, Method* new_method, bool* trace_name_printed) { +static void log_adjust(const char* entry_type, Method* old_method, Method* new_method, bool* trace_name_printed) { ResourceMark rm; if (!(*trace_name_printed)) { diff --git a/src/hotspot/share/oops/klassVtable.cpp b/src/hotspot/share/oops/klassVtable.cpp index ece1ad3c6de..cbc379709f1 100644 --- a/src/hotspot/share/oops/klassVtable.cpp +++ b/src/hotspot/share/oops/klassVtable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1442,7 +1442,7 @@ class InterfaceVisiterClosure : public StackObj { }; // Visit all interfaces with at least one itable method -void visit_all_interfaces(Array<InstanceKlass*>* transitive_intf, InterfaceVisiterClosure *blk) { +static void visit_all_interfaces(Array<InstanceKlass*>* transitive_intf, InterfaceVisiterClosure *blk) { // Handle array argument for(int i = 0; i < transitive_intf->length(); i++) { InstanceKlass* intf = transitive_intf->at(i); diff --git a/src/hotspot/share/opto/addnode.cpp b/src/hotspot/share/opto/addnode.cpp index 1b921933004..443086b6737 100644 --- a/src/hotspot/share/opto/addnode.cpp +++ b/src/hotspot/share/opto/addnode.cpp @@ -764,7 +764,7 @@ Node* OrINode::Identity(PhaseGVN* phase) { } // Find shift value for Integer or Long OR. -Node* rotate_shift(PhaseGVN* phase, Node* lshift, Node* rshift, int mask) { +static Node* rotate_shift(PhaseGVN* phase, Node* lshift, Node* rshift, int mask) { // val << norm_con_shift | val >> ({32|64} - norm_con_shift) => rotate_left val, norm_con_shift const TypeInt* lshift_t = phase->type(lshift)->isa_int(); const TypeInt* rshift_t = phase->type(rshift)->isa_int(); @@ -1080,7 +1080,7 @@ const Type* XorLNode::Value(PhaseGVN* phase) const { return AddNode::Value(phase); } -Node* build_min_max_int(Node* a, Node* b, bool is_max) { +static Node* build_min_max_int(Node* a, Node* b, bool is_max) { if (is_max) { return new MaxINode(a, b); } else { @@ -1312,7 +1312,7 @@ const Type *MinINode::add_ring( const Type *t0, const Type *t1 ) const { // // Note: we assume that SubL was already replaced by an AddL, and that the stride // has its sign flipped: SubL(limit, stride) -> AddL(limit, -stride). -Node* fold_subI_no_underflow_pattern(Node* n, PhaseGVN* phase) { +static Node* fold_subI_no_underflow_pattern(Node* n, PhaseGVN* phase) { assert(n->Opcode() == Op_MaxL || n->Opcode() == Op_MinL, "sanity"); // Check that the two clamps have the correct values. jlong clamp = (n->Opcode() == Op_MaxL) ? min_jint : max_jint; diff --git a/src/hotspot/share/opto/doCall.cpp b/src/hotspot/share/opto/doCall.cpp index 122da9b447c..0a5e27ed5b1 100644 --- a/src/hotspot/share/opto/doCall.cpp +++ b/src/hotspot/share/opto/doCall.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,15 +50,15 @@ #include "jfr/jfr.hpp" #endif -void print_trace_type_profile(outputStream* out, int depth, ciKlass* prof_klass, int site_count, int receiver_count) { +static void print_trace_type_profile(outputStream* out, int depth, ciKlass* prof_klass, int site_count, int receiver_count) { CompileTask::print_inline_indent(depth, out); out->print(" \\-> TypeProfile (%d/%d counts) = ", receiver_count, site_count); prof_klass->name()->print_symbol_on(out); out->cr(); } -void trace_type_profile(Compile* C, ciMethod* method, int depth, int bci, ciMethod* prof_method, - ciKlass* prof_klass, int site_count, int receiver_count) { +static void trace_type_profile(Compile* C, ciMethod* method, int depth, int bci, ciMethod* prof_method, + ciKlass* prof_klass, int site_count, int receiver_count) { if (TraceTypeProfile || C->print_inlining()) { outputStream* out = tty; if (!C->print_inlining()) { diff --git a/src/hotspot/share/opto/intrinsicnode.cpp b/src/hotspot/share/opto/intrinsicnode.cpp index 7d8894c8bdf..010579722bb 100644 --- a/src/hotspot/share/opto/intrinsicnode.cpp +++ b/src/hotspot/share/opto/intrinsicnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -174,7 +174,7 @@ Node* CompressBitsNode::Ideal(PhaseGVN* phase, bool can_reshape) { return nullptr; } -Node* compress_expand_identity(PhaseGVN* phase, Node* n) { +static Node* compress_expand_identity(PhaseGVN* phase, Node* n) { BasicType bt = n->bottom_type()->basic_type(); // compress(x, 0) == 0, expand(x, 0) == 0 if(phase->type(n->in(2))->higher_equal(TypeInteger::zero(bt))) return n->in(2); diff --git a/src/hotspot/share/opto/loopnode.cpp b/src/hotspot/share/opto/loopnode.cpp index 38fc36cec06..fdfbab09b8f 100644 --- a/src/hotspot/share/opto/loopnode.cpp +++ b/src/hotspot/share/opto/loopnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -5071,7 +5071,7 @@ bool PhaseIdealLoop::verify_loop_ctrl(Node* n, const PhaseIdealLoop* phase_verif } } -int compare_tree(IdealLoopTree* const& a, IdealLoopTree* const& b) { +static int compare_tree(IdealLoopTree* const& a, IdealLoopTree* const& b) { assert(a != nullptr && b != nullptr, "must be"); return a->_head->_idx - b->_head->_idx; } diff --git a/src/hotspot/share/opto/node.cpp b/src/hotspot/share/opto/node.cpp index 44c37768cdc..dee4ce80d35 100644 --- a/src/hotspot/share/opto/node.cpp +++ b/src/hotspot/share/opto/node.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1632,7 +1632,7 @@ void visit_nodes(Node* start, Callback callback, bool traverse_output, bool only } // BFS traverse from start, return node with idx -Node* find_node_by_idx(Node* start, uint idx, bool traverse_output, bool only_ctrl) { +static Node* find_node_by_idx(Node* start, uint idx, bool traverse_output, bool only_ctrl) { ResourceMark rm; Node* result = nullptr; auto callback = [&] (Node* n) { @@ -1648,11 +1648,11 @@ Node* find_node_by_idx(Node* start, uint idx, bool traverse_output, bool only_ct return result; } -int node_idx_cmp(const Node** n1, const Node** n2) { +static int node_idx_cmp(const Node** n1, const Node** n2) { return (*n1)->_idx - (*n2)->_idx; } -void find_nodes_by_name(Node* start, const char* name) { +static void find_nodes_by_name(Node* start, const char* name) { ResourceMark rm; GrowableArray<const Node*> ns; auto callback = [&] (const Node* n) { @@ -1667,7 +1667,7 @@ void find_nodes_by_name(Node* start, const char* name) { } } -void find_nodes_by_dump(Node* start, const char* pattern) { +static void find_nodes_by_dump(Node* start, const char* pattern) { ResourceMark rm; GrowableArray<const Node*> ns; auto callback = [&] (const Node* n) { diff --git a/src/hotspot/share/opto/reg_split.cpp b/src/hotspot/share/opto/reg_split.cpp index 8e5247e93b6..35b2618c64c 100644 --- a/src/hotspot/share/opto/reg_split.cpp +++ b/src/hotspot/share/opto/reg_split.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -289,7 +289,7 @@ int PhaseChaitin::split_USE(MachSpillCopyNode::SpillType spill_type, Node *def, //------------------------------clone_node---------------------------- // Clone node with anti dependence check. -Node* clone_node(Node* def, Block *b, Compile* C) { +static Node* clone_node(Node* def, Block *b, Compile* C) { if (def->needs_anti_dependence_check()) { #ifdef ASSERT if (PrintOpto && WizardMode) { diff --git a/src/hotspot/share/opto/vectorization.cpp b/src/hotspot/share/opto/vectorization.cpp index 98b996339fa..a8374cbcd20 100644 --- a/src/hotspot/share/opto/vectorization.cpp +++ b/src/hotspot/share/opto/vectorization.cpp @@ -1272,7 +1272,7 @@ AlignmentSolution* AlignmentSolver::solve() const { } #ifdef ASSERT -void print_con_or_idx(const Node* n) { +static void print_con_or_idx(const Node* n) { if (n == nullptr) { tty->print("(0)"); } else if (n->is_ConI()) { diff --git a/src/hotspot/share/prims/jvmtiExport.cpp b/src/hotspot/share/prims/jvmtiExport.cpp index eee5b2a70fa..0a436b2778e 100644 --- a/src/hotspot/share/prims/jvmtiExport.cpp +++ b/src/hotspot/share/prims/jvmtiExport.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2437,7 +2437,7 @@ void JvmtiExport::post_native_method_bind(Method* method, address* function_ptr) } // Returns a record containing inlining information for the given nmethod -jvmtiCompiledMethodLoadInlineRecord* create_inline_record(nmethod* nm) { +static jvmtiCompiledMethodLoadInlineRecord* create_inline_record(nmethod* nm) { jint numstackframes = 0; jvmtiCompiledMethodLoadInlineRecord* record = (jvmtiCompiledMethodLoadInlineRecord*)NEW_RESOURCE_OBJ(jvmtiCompiledMethodLoadInlineRecord); record->header.kind = JVMTI_CMLR_INLINE_INFO; diff --git a/src/hotspot/share/prims/resolvedMethodTable.cpp b/src/hotspot/share/prims/resolvedMethodTable.cpp index 4ff09c6581b..0dd96357506 100644 --- a/src/hotspot/share/prims/resolvedMethodTable.cpp +++ b/src/hotspot/share/prims/resolvedMethodTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -53,7 +53,7 @@ static const size_t GROW_HINT = 32; static const size_t ResolvedMethodTableSizeLog = 10; -unsigned int method_hash(const Method* method) { +static unsigned int method_hash(const Method* method) { unsigned int hash = method->method_holder()->class_loader_data()->identity_hash(); hash = (hash * 31) ^ method->klass_name()->identity_hash(); hash = (hash * 31) ^ method->name()->identity_hash(); diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index 8a4b54a2258..dfd5eec6b4f 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -1364,7 +1364,7 @@ void Arguments::no_shared_spaces(const char* message) { } } -void set_object_alignment() { +static void set_object_alignment() { // Object alignment. assert(is_power_of_2(ObjectAlignmentInBytes), "ObjectAlignmentInBytes must be power of 2"); MinObjAlignmentInBytes = ObjectAlignmentInBytes; @@ -2009,11 +2009,12 @@ jint Arguments::parse_vm_init_args(const JavaVMInitArgs *vm_options_args, return JNI_OK; } +#if !INCLUDE_JVMTI // Checks if name in command-line argument -agent{lib,path}:name[=options] // represents a valid JDWP agent. is_path==true denotes that we // are dealing with -agentpath (case where name is a path), otherwise with // -agentlib -bool valid_jdwp_agent(char *name, bool is_path) { +static bool valid_jdwp_agent(char *name, bool is_path) { char *_name; const char *_jdwp = "jdwp"; size_t _len_jdwp, _len_prefix; @@ -2053,6 +2054,7 @@ bool valid_jdwp_agent(char *name, bool is_path) { return false; } +#endif int Arguments::process_patch_mod_option(const char* patch_mod_tail, bool* patch_mod_javabase) { // --patch-module=<module>=<file>(<pathsep><file>)* diff --git a/src/hotspot/share/runtime/deoptimization.cpp b/src/hotspot/share/runtime/deoptimization.cpp index 3a391cad77a..e8f443ed1e0 100644 --- a/src/hotspot/share/runtime/deoptimization.cpp +++ b/src/hotspot/share/runtime/deoptimization.cpp @@ -1448,7 +1448,7 @@ public: } }; -int compare(ReassignedField* left, ReassignedField* right) { +static int compare(ReassignedField* left, ReassignedField* right) { return left->_offset - right->_offset; } diff --git a/src/hotspot/share/runtime/flags/jvmFlag.cpp b/src/hotspot/share/runtime/flags/jvmFlag.cpp index 395504f626f..005cd84f214 100644 --- a/src/hotspot/share/runtime/flags/jvmFlag.cpp +++ b/src/hotspot/share/runtime/flags/jvmFlag.cpp @@ -133,7 +133,7 @@ JVMFlag::MsgType JVMFlag::get_locked_message(char* buf, int buflen) const { // Fills current line up to requested position. // Should the current position already be past the requested position, // one separator blank is enforced. -void fill_to_pos(outputStream* st, unsigned int req_pos) { +static void fill_to_pos(outputStream* st, unsigned int req_pos) { if ((unsigned int)st->position() < req_pos) { st->fill_to(req_pos); // need to fill with blanks to reach req_pos } else { diff --git a/src/hotspot/share/runtime/java.cpp b/src/hotspot/share/runtime/java.cpp index 05a65b8fa0e..79f201263a1 100644 --- a/src/hotspot/share/runtime/java.cpp +++ b/src/hotspot/share/runtime/java.cpp @@ -100,7 +100,7 @@ GrowableArray<Method*>* collected_profiled_methods; -int compare_methods(Method** a, Method** b) { +static int compare_methods(Method** a, Method** b) { // compiled_invocation_count() returns int64_t, forcing the entire expression // to be evaluated as int64_t. Overflow is not an issue. int64_t diff = (((*b)->invocation_count() + (*b)->compiled_invocation_count()) @@ -108,7 +108,7 @@ int compare_methods(Method** a, Method** b) { return (diff < 0) ? -1 : (diff > 0) ? 1 : 0; } -void collect_profiled_methods(Method* m) { +static void collect_profiled_methods(Method* m) { Thread* thread = Thread::current(); methodHandle mh(thread, m); if ((m->method_data() != nullptr) && @@ -117,7 +117,7 @@ void collect_profiled_methods(Method* m) { } } -void print_method_profiling_data() { +static void print_method_profiling_data() { if ((ProfileInterpreter COMPILER1_PRESENT(|| C1UpdateMethodData)) && (PrintMethodData || CompilerOracle::should_print_methods())) { ResourceMark rm; @@ -162,7 +162,7 @@ void print_method_profiling_data() { GrowableArray<Method*>* collected_invoked_methods; -void collect_invoked_methods(Method* m) { +static void collect_invoked_methods(Method* m) { if (m->invocation_count() + m->compiled_invocation_count() >= 1) { collected_invoked_methods->push(m); } @@ -172,7 +172,7 @@ void collect_invoked_methods(Method* m) { // Invocation count accumulators should be unsigned long to shift the // overflow border. Longer-running workloads tend to create invocation // counts which already overflow 32-bit counters for individual methods. -void print_method_invocation_histogram() { +static void print_method_invocation_histogram() { ResourceMark rm; collected_invoked_methods = new GrowableArray<Method*>(1024); SystemDictionary::methods_do(collect_invoked_methods); @@ -226,7 +226,7 @@ void print_method_invocation_histogram() { SharedRuntime::print_call_statistics(comp_total); } -void print_bytecode_count() { +static void print_bytecode_count() { if (CountBytecodes || TraceBytecodes || StopInterpreterAt) { tty->print_cr("[BytecodeCounter::counter_value = %d]", BytecodeCounter::counter_value()); } @@ -234,8 +234,8 @@ void print_bytecode_count() { #else -void print_method_invocation_histogram() {} -void print_bytecode_count() {} +static void print_method_invocation_histogram() {} +static void print_bytecode_count() {} #endif // PRODUCT @@ -570,7 +570,7 @@ void vm_direct_exit(int code, const char* message) { vm_direct_exit(code); } -void vm_perform_shutdown_actions() { +static void vm_perform_shutdown_actions() { if (is_init_completed()) { Thread* thread = Thread::current_or_null(); if (thread != nullptr && thread->is_Java_thread()) { @@ -605,7 +605,7 @@ void vm_abort(bool dump_core) { ShouldNotReachHere(); } -void vm_notify_during_cds_dumping(const char* error, const char* message) { +static void vm_notify_during_cds_dumping(const char* error, const char* message) { if (error != nullptr) { tty->print_cr("Error occurred during CDS dumping"); tty->print("%s", error); @@ -625,7 +625,7 @@ void vm_exit_during_cds_dumping(const char* error, const char* message) { vm_abort(false); } -void vm_notify_during_shutdown(const char* error, const char* message) { +static void vm_notify_during_shutdown(const char* error, const char* message) { if (error != nullptr) { tty->print_cr("Error occurred during initialization of VM"); tty->print("%s", error); diff --git a/src/hotspot/share/runtime/javaThread.cpp b/src/hotspot/share/runtime/javaThread.cpp index fb91fc41360..0ec1236785b 100644 --- a/src/hotspot/share/runtime/javaThread.cpp +++ b/src/hotspot/share/runtime/javaThread.cpp @@ -263,7 +263,7 @@ void JavaThread::allocate_threadObj(Handle thread_group, const char* thread_name jlong* JavaThread::_jvmci_old_thread_counters; -bool jvmci_counters_include(JavaThread* thread) { +static bool jvmci_counters_include(JavaThread* thread) { return !JVMCICountersExcludeCompiler || !thread->is_Compiler_thread(); } @@ -282,7 +282,7 @@ void JavaThread::collect_counters(jlong* array, int length) { } // Attempt to enlarge the array for per thread counters. -jlong* resize_counters_array(jlong* old_counters, int current_size, int new_size) { +static jlong* resize_counters_array(jlong* old_counters, int current_size, int new_size) { jlong* new_counters = NEW_C_HEAP_ARRAY_RETURN_NULL(jlong, new_size, mtJVMCI); if (new_counters == nullptr) { return nullptr; @@ -1456,7 +1456,7 @@ void JavaThread::metadata_do(MetadataClosure* f) { } // Printing -const char* _get_thread_state_name(JavaThreadState _thread_state) { +static const char* _get_thread_state_name(JavaThreadState _thread_state) { switch (_thread_state) { case _thread_uninitialized: return "_thread_uninitialized"; case _thread_new: return "_thread_new"; diff --git a/src/hotspot/share/runtime/os.cpp b/src/hotspot/share/runtime/os.cpp index 88c52e19ab6..9af30e28538 100644 --- a/src/hotspot/share/runtime/os.cpp +++ b/src/hotspot/share/runtime/os.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1288,7 +1288,7 @@ void os::print_location(outputStream* st, intptr_t x, bool verbose) { st->print_cr(INTPTR_FORMAT " is an unknown value", p2i(addr)); } -bool is_pointer_bad(intptr_t* ptr) { +static bool is_pointer_bad(intptr_t* ptr) { return !is_aligned(ptr, sizeof(uintptr_t)) || !os::is_readable_pointer(ptr); } diff --git a/src/hotspot/share/runtime/sharedRuntimeTrans.cpp b/src/hotspot/share/runtime/sharedRuntimeTrans.cpp index 40baf4fc768..491705d8d7f 100644 --- a/src/hotspot/share/runtime/sharedRuntimeTrans.cpp +++ b/src/hotspot/share/runtime/sharedRuntimeTrans.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -440,7 +440,7 @@ bp[] = {1.0, 1.5,}, ivln2_h = 1.44269502162933349609e+00, /* 0x3FF71547, 0x60000000 =24b 1/ln2*/ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/ -double __ieee754_pow(double x, double y) { +static double __ieee754_pow(double x, double y) { double z,ax,z_h,z_l,p_h,p_l; double y1,t1,t2,r,s,t,u,v,w; int i0,i1,i,j,k,yisint,n; diff --git a/src/hotspot/share/runtime/synchronizer.cpp b/src/hotspot/share/runtime/synchronizer.cpp index 3a4eb4d0d1a..6498330b190 100644 --- a/src/hotspot/share/runtime/synchronizer.cpp +++ b/src/hotspot/share/runtime/synchronizer.cpp @@ -251,7 +251,7 @@ ObjectMonitor* MonitorList::Iterator::next() { #endif // ndef DTRACE_ENABLED // This exists only as a workaround of dtrace bug 6254741 -int dtrace_waited_probe(ObjectMonitor* monitor, Handle obj, JavaThread* thr) { +static int dtrace_waited_probe(ObjectMonitor* monitor, Handle obj, JavaThread* thr) { DTRACE_MONITOR_PROBE(waited, monitor, obj(), thr); return 0; } diff --git a/src/hotspot/share/runtime/threads.cpp b/src/hotspot/share/runtime/threads.cpp index d40fb3a9f91..063594ab5e3 100644 --- a/src/hotspot/share/runtime/threads.cpp +++ b/src/hotspot/share/runtime/threads.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, Azul Systems, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -1118,7 +1118,7 @@ void Threads::change_thread_claim_token() { } #ifdef ASSERT -void assert_thread_claimed(const char* kind, Thread* t, uintx expected) { +static void assert_thread_claimed(const char* kind, Thread* t, uintx expected) { const uintx token = t->threads_do_token(); assert(token == expected, "%s " PTR_FORMAT " has incorrect value " UINTX_FORMAT " != " diff --git a/src/hotspot/share/services/attachListener.cpp b/src/hotspot/share/services/attachListener.cpp index 630ceb8e998..545563ba8ec 100644 --- a/src/hotspot/share/services/attachListener.cpp +++ b/src/hotspot/share/services/attachListener.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -218,7 +218,7 @@ static jint jcmd(AttachOperation* op, outputStream* out) { // arg0: Name of the dump file // arg1: "-live" or "-all" // arg2: Compress level -jint dump_heap(AttachOperation* op, outputStream* out) { +static jint dump_heap(AttachOperation* op, outputStream* out) { const char* path = op->arg(0); if (path == nullptr || path[0] == '\0') { out->print_cr("No dump file specified"); diff --git a/src/hotspot/share/services/management.cpp b/src/hotspot/share/services/management.cpp index 8e9249f5a61..390f6d0686b 100644 --- a/src/hotspot/share/services/management.cpp +++ b/src/hotspot/share/services/management.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1460,7 +1460,7 @@ JVM_END // Utility function used by jmm_GetVMGlobals. Returns false if flag type // can't be determined, true otherwise. If false is returned, then *global // will be incomplete and invalid. -bool add_global_entry(Handle name, jmmVMGlobal *global, JVMFlag *flag, TRAPS) { +static bool add_global_entry(Handle name, jmmVMGlobal *global, JVMFlag *flag, TRAPS) { Handle flag_name; if (name() == nullptr) { flag_name = java_lang_String::create_from_str(flag->name(), CHECK_false); diff --git a/src/hotspot/share/utilities/exceptions.cpp b/src/hotspot/share/utilities/exceptions.cpp index 97dd88165e0..3e0683999e1 100644 --- a/src/hotspot/share/utilities/exceptions.cpp +++ b/src/hotspot/share/utilities/exceptions.cpp @@ -470,7 +470,7 @@ void Exceptions::count_out_of_memory_exceptions(Handle exception) { } } -void print_oom_count(outputStream* st, const char *err, int count) { +static void print_oom_count(outputStream* st, const char *err, int count) { if (count > 0) { st->print_cr("OutOfMemoryError %s=%d", err, count); } diff --git a/src/hotspot/share/utilities/globalDefinitions.cpp b/src/hotspot/share/utilities/globalDefinitions.cpp index 27af0fd6e83..79ffd6fd2cd 100644 --- a/src/hotspot/share/utilities/globalDefinitions.cpp +++ b/src/hotspot/share/utilities/globalDefinitions.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -60,7 +60,7 @@ uint64_t OopEncodingHeapMax = 0; // Something to help porters sleep at night #ifdef ASSERT -BasicType char2type(int ch) { +static BasicType char2type(int ch) { switch (ch) { #define EACH_SIG(ch, bt, ignore) \ case ch: return bt; diff --git a/src/hotspot/share/utilities/json.cpp b/src/hotspot/share/utilities/json.cpp index baa15b435db..6665f6fdc34 100644 --- a/src/hotspot/share/utilities/json.cpp +++ b/src/hotspot/share/utilities/json.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,7 @@ #include "utilities/ostream.hpp" #include <math.h> -const char* strchrnul_(const char *s, int c) { +static const char* strchrnul_(const char *s, int c) { const char* tmp = strchr(s, c); return tmp == nullptr ? s + strlen(s) : tmp; } diff --git a/src/hotspot/share/utilities/ostream.cpp b/src/hotspot/share/utilities/ostream.cpp index 2cc46adf54a..a1575b3d2c6 100644 --- a/src/hotspot/share/utilities/ostream.cpp +++ b/src/hotspot/share/utilities/ostream.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -429,7 +429,7 @@ xmlStream* xtty; #define EXTRACHARLEN 32 #define CURRENTAPPX ".current" // convert YYYY-MM-DD HH:MM:SS to YYYY-MM-DD_HH-MM-SS -char* get_datetime_string(char *buf, size_t len) { +static char* get_datetime_string(char *buf, size_t len) { os::local_time_string(buf, len); int i = (int)strlen(buf); while (--i >= 0) { diff --git a/test/hotspot/gtest/classfile/test_symbolTable.cpp b/test/hotspot/gtest/classfile/test_symbolTable.cpp index 10f9560530e..73cf27220d4 100644 --- a/test/hotspot/gtest/classfile/test_symbolTable.cpp +++ b/test/hotspot/gtest/classfile/test_symbolTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,7 @@ // Helper to avoid interference from the cleanup delay queue by draining it // immediately after creation. -TempNewSymbol stable_temp_symbol(Symbol* sym) { +static TempNewSymbol stable_temp_symbol(Symbol* sym) { TempNewSymbol t = sym; TempSymbolCleanupDelayer::drain_queue(); return t; diff --git a/test/hotspot/gtest/oops/test_oop.cpp b/test/hotspot/gtest/oops/test_oop.cpp index 16dd319fa0d..b50ee5a56aa 100644 --- a/test/hotspot/gtest/oops/test_oop.cpp +++ b/test/hotspot/gtest/oops/test_oop.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ static unsigned char memory[32]; -oop fake_object() { +static oop fake_object() { return cast_to_oop(memory); } diff --git a/test/hotspot/gtest/os/linux/test_cgroupSubsystem_linux.cpp b/test/hotspot/gtest/os/linux/test_cgroupSubsystem_linux.cpp index cfac19185a3..3b8e6929730 100644 --- a/test/hotspot/gtest/os/linux/test_cgroupSubsystem_linux.cpp +++ b/test/hotspot/gtest/os/linux/test_cgroupSubsystem_linux.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,12 +34,12 @@ // Utilities -bool file_exists(const char* filename) { +static bool file_exists(const char* filename) { struct stat st; return os::stat(filename, &st) == 0; } -char* temp_file(const char* prefix) { +static char* temp_file(const char* prefix) { const testing::TestInfo* test_info = ::testing::UnitTest::GetInstance()->current_test_info(); stringStream path; path.print_raw(os::get_temp_directory()); @@ -49,7 +49,7 @@ char* temp_file(const char* prefix) { return path.as_string(true); } -void delete_file(const char* filename) { +static void delete_file(const char* filename) { if (!file_exists(filename)) { return; } @@ -66,7 +66,7 @@ public: }; }; -void fill_file(const char* path, const char* content) { +static void fill_file(const char* path, const char* content) { delete_file(path); FILE* fp = os::fopen(path, "w"); if (fp == nullptr) { diff --git a/test/hotspot/gtest/runtime/test_safefetch.cpp b/test/hotspot/gtest/runtime/test_safefetch.cpp index 3e217cc63da..721944b05d9 100644 --- a/test/hotspot/gtest/runtime/test_safefetch.cpp +++ b/test/hotspot/gtest/runtime/test_safefetch.cpp @@ -47,7 +47,7 @@ static intptr_t* const good_addressN = dataN + 1; static int* const good_address32 = data32 + 1; -void test_safefetchN_positive() { +static void test_safefetchN_positive() { intptr_t a = SafeFetchN(good_addressN, 1); ASSERT_EQ(patternN, a); }