From 3f1d9c441ea98910d9483e133bccfac784db393d Mon Sep 17 00:00:00 2001 From: Joachim Kern Date: Mon, 15 Apr 2024 08:46:36 +0000 Subject: [PATCH] 8329257: AIX: Switch HOTSPOT_TOOLCHAIN_TYPE from xlc to gcc Reviewed-by: jwaters, stuefe, kbarrett, mdoerr --- make/autoconf/flags-cflags.m4 | 2 +- make/autoconf/toolchain.m4 | 6 +- src/hotspot/os/aix/loadlib_aix.cpp | 4 +- src/hotspot/os/aix/os_aix.cpp | 16 +-- src/hotspot/os/aix/os_aix.hpp | 10 +- src/hotspot/os/aix/porting_aix.cpp | 6 +- src/hotspot/os/posix/os_posix.cpp | 2 +- src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp | 20 +-- src/hotspot/share/utilities/byteswap.hpp | 4 +- .../share/utilities/compilerWarnings_xlc.hpp | 30 ---- .../share/utilities/count_leading_zeros.hpp | 33 +---- .../share/utilities/count_trailing_zeros.hpp | 17 +-- src/hotspot/share/utilities/debug.hpp | 2 +- .../share/utilities/globalDefinitions_gcc.hpp | 12 +- .../share/utilities/globalDefinitions_xlc.hpp | 128 ------------------ 15 files changed, 44 insertions(+), 248 deletions(-) delete mode 100644 src/hotspot/share/utilities/compilerWarnings_xlc.hpp delete mode 100644 src/hotspot/share/utilities/globalDefinitions_xlc.hpp diff --git a/make/autoconf/flags-cflags.m4 b/make/autoconf/flags-cflags.m4 index 97a3ec14ecd..c96b289084c 100644 --- a/make/autoconf/flags-cflags.m4 +++ b/make/autoconf/flags-cflags.m4 @@ -459,7 +459,7 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER], CFLAGS_OS_DEF_JVM="-D_ALLBSD_SOURCE -D_DARWIN_C_SOURCE -D_XOPEN_SOURCE" CFLAGS_OS_DEF_JDK="-D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT" elif test "x$OPENJDK_TARGET_OS" = xaix; then - CFLAGS_OS_DEF_JVM="-DAIX -D_LARGE_FILES" + CFLAGS_OS_DEF_JVM="-DAIX -Dalloca'(size)'=__builtin_alloca'(size)' -D_LARGE_FILES" CFLAGS_OS_DEF_JDK="-D_LARGE_FILES" elif test "x$OPENJDK_TARGET_OS" = xbsd; then CFLAGS_OS_DEF_JDK="-D_ALLBSD_SOURCE" diff --git a/make/autoconf/toolchain.m4 b/make/autoconf/toolchain.m4 index acccac3e320..aceb6edb79d 100644 --- a/make/autoconf/toolchain.m4 +++ b/make/autoconf/toolchain.m4 @@ -953,11 +953,7 @@ AC_DEFUN_ONCE([TOOLCHAIN_MISC_CHECKS], # Setup hotspot lecagy names for toolchains HOTSPOT_TOOLCHAIN_TYPE=$TOOLCHAIN_TYPE if test "x$TOOLCHAIN_TYPE" = xclang; then - if test "x$OPENJDK_TARGET_OS" = xaix; then - HOTSPOT_TOOLCHAIN_TYPE=xlc - else - HOTSPOT_TOOLCHAIN_TYPE=gcc - fi + HOTSPOT_TOOLCHAIN_TYPE=gcc elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then HOTSPOT_TOOLCHAIN_TYPE=visCPP fi diff --git a/src/hotspot/os/aix/loadlib_aix.cpp b/src/hotspot/os/aix/loadlib_aix.cpp index 107f2783ff5..bc21aef3836 100644 --- a/src/hotspot/os/aix/loadlib_aix.cpp +++ b/src/hotspot/os/aix/loadlib_aix.cpp @@ -117,8 +117,8 @@ static void print_entry(const loaded_module_t* lm, outputStream* os) { ", data: " INTPTR_FORMAT " - " INTPTR_FORMAT " " "%s", (lm->is_in_vm ? '*' : ' '), - lm->text, (uintptr_t)lm->text + lm->text_len, - lm->data, (uintptr_t)lm->data + lm->data_len, + p2i(lm->text), (uintptr_t)lm->text + lm->text_len, + p2i(lm->data), (uintptr_t)lm->data + lm->data_len, lm->path); if (lm->member) { os->print("(%s)", lm->member); diff --git a/src/hotspot/os/aix/os_aix.cpp b/src/hotspot/os/aix/os_aix.cpp index 39400db75e1..71a9aa576ea 100644 --- a/src/hotspot/os/aix/os_aix.cpp +++ b/src/hotspot/os/aix/os_aix.cpp @@ -23,10 +23,6 @@ * */ -// According to the AIX OS doc #pragma alloca must be used -// with C++ compiler before referencing the function alloca() -#pragma alloca - // no precompiled headers #include "classfile/vmSymbols.hpp" #include "code/vtableStubs.hpp" @@ -606,8 +602,8 @@ static void *thread_native_entry(Thread *thread) { address low_address = thread->stack_end(); address high_address = thread->stack_base(); lt.print("Thread is alive (tid: " UINTX_FORMAT ", kernel thread id: " UINTX_FORMAT - ", stack [" PTR_FORMAT " - " PTR_FORMAT " (" SIZE_FORMAT "k using %uk pages)).", - os::current_thread_id(), (uintx) kernel_thread_id, low_address, high_address, + ", stack [" PTR_FORMAT " - " PTR_FORMAT " (" SIZE_FORMAT "k using %luk pages)).", + os::current_thread_id(), (uintx) kernel_thread_id, p2i(low_address), p2i(high_address), (high_address - low_address) / K, os::Aix::query_pagesize(low_address) / K); } @@ -1354,8 +1350,8 @@ struct vmembk_t { void print_on(outputStream* os) const { os->print("[" PTR_FORMAT " - " PTR_FORMAT "] (" UINTX_FORMAT - " bytes, %d %s pages), %s", - addr, addr + size - 1, size, size / pagesize, describe_pagesize(pagesize), + " bytes, %ld %s pages), %s", + p2i(addr), p2i(addr) + size - 1, size, size / pagesize, describe_pagesize(pagesize), (type == VMEM_SHMATED ? "shmat" : "mmap") ); } @@ -1939,7 +1935,7 @@ static bool checked_mprotect(char* addr, size_t size, int prot) { if (!rc) { const char* const s_errno = os::errno_name(errno); - warning("mprotect(" PTR_FORMAT "-" PTR_FORMAT ", 0x%X) failed (%s).", addr, addr + size, prot, s_errno); + warning("mprotect(" PTR_FORMAT "-" PTR_FORMAT ", 0x%X) failed (%s).", p2i(addr), p2i(addr) + size, prot, s_errno); return false; } @@ -2356,7 +2352,7 @@ void os::set_native_thread_name(const char *name) { bool os::find(address addr, outputStream* st) { - st->print(PTR_FORMAT ": ", addr); + st->print(PTR_FORMAT ": ", p2i(addr)); loaded_module_t lm; if (LoadedLibraries::find_for_text_address(addr, &lm) || diff --git a/src/hotspot/os/aix/os_aix.hpp b/src/hotspot/os/aix/os_aix.hpp index 7f4f3c7e8cc..759bc552bb7 100644 --- a/src/hotspot/os/aix/os_aix.hpp +++ b/src/hotspot/os/aix/os_aix.hpp @@ -120,19 +120,19 @@ class os::Aix { struct meminfo_t { // Amount of virtual memory (in units of 4 KB pages) - unsigned long long virt_total; + size_t virt_total; // Amount of real memory, in bytes - unsigned long long real_total; + size_t real_total; // Amount of free real memory, in bytes - unsigned long long real_free; + size_t real_free; // Total amount of paging space, in bytes - unsigned long long pgsp_total; + size_t pgsp_total; // Amount of free paging space, in bytes - unsigned long long pgsp_free; + size_t pgsp_free; }; diff --git a/src/hotspot/os/aix/porting_aix.cpp b/src/hotspot/os/aix/porting_aix.cpp index 68233097b49..c06d4ad9a7f 100644 --- a/src/hotspot/os/aix/porting_aix.cpp +++ b/src/hotspot/os/aix/porting_aix.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2023 SAP SE. All rights reserved. + * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -741,7 +741,7 @@ void AixNativeCallstack::print_callstack_for_context(outputStream* st, const uco st->print("(invalid) "); goto cleanup; } else { - st->print("(base - 0x%X) ", PTRDIFF_BYTES(stack_base, cur_sp)); + st->print("(base - 0x%lX) ", PTRDIFF_BYTES(stack_base, cur_sp)); } st->cr(); @@ -797,7 +797,7 @@ void AixNativeCallstack::print_callstack_for_context(outputStream* st, const uco st->print_cr("trying to recover and find backchain..."); sp = try_find_backchain(sp_last, stack_base, stack_size); if (sp) { - st->print_cr("found something which looks like a backchain at " PTR_FORMAT ", after 0x%x bytes... ", + st->print_cr("found something which looks like a backchain at " PTR_FORMAT ", after 0x%lx bytes... ", p2i(sp), PTRDIFF_BYTES(sp, sp_last)); } else { st->print_cr("did not find a backchain, giving up."); diff --git a/src/hotspot/os/posix/os_posix.cpp b/src/hotspot/os/posix/os_posix.cpp index d2de5b30484..76a6080305b 100644 --- a/src/hotspot/os/posix/os_posix.cpp +++ b/src/hotspot/os/posix/os_posix.cpp @@ -508,7 +508,7 @@ void os::Posix::print_rlimit_info(outputStream* st) { #if defined(AIX) st->print(", NPROC "); - st->print("%d", sysconf(_SC_CHILD_MAX)); + st->print("%ld", sysconf(_SC_CHILD_MAX)); print_rlimit(st, ", THREADS", RLIMIT_THREADS); #else diff --git a/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp b/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp index e1e81d673a7..8711c9a89b3 100644 --- a/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp +++ b/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2023 SAP SE. All rights reserved. + * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -261,7 +261,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, else if (sig == SIGTRAP && TrapBasedICMissChecks && nativeInstruction_at(pc)->is_sigtrap_ic_miss_check()) { if (TraceTraps) { - tty->print_cr("trap: ic_miss_check at " INTPTR_FORMAT " (SIGTRAP)", pc); + tty->print_cr("trap: ic_miss_check at " INTPTR_FORMAT " (SIGTRAP)", p2i(pc)); } stub = SharedRuntime::get_ic_miss_stub(); goto run_stub; @@ -271,7 +271,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, else if (sig == SIGTRAP && TrapBasedNullChecks && nativeInstruction_at(pc)->is_sigtrap_null_check()) { if (TraceTraps) { - tty->print_cr("trap: null_check at " INTPTR_FORMAT " (SIGTRAP)", pc); + tty->print_cr("trap: null_check at " INTPTR_FORMAT " (SIGTRAP)", p2i(pc)); } stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL); goto run_stub; @@ -282,7 +282,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, CodeCache::contains((void*) pc) && MacroAssembler::uses_implicit_null_check(info->si_addr)) { if (TraceTraps) { - tty->print_cr("trap: null_check at " INTPTR_FORMAT " (SIGSEGV)", pc); + tty->print_cr("trap: null_check at " INTPTR_FORMAT " (SIGSEGV)", p2i(pc)); } stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL); } @@ -292,7 +292,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, else if (sig == SIGTRAP && TrapBasedRangeChecks && nativeInstruction_at(pc)->is_sigtrap_range_check()) { if (TraceTraps) { - tty->print_cr("trap: range_check at " INTPTR_FORMAT " (SIGTRAP)", pc); + tty->print_cr("trap: range_check at " INTPTR_FORMAT " (SIGTRAP)", p2i(pc)); } stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL); goto run_stub; @@ -435,12 +435,12 @@ void os::print_context(outputStream *st, const void *context) { const ucontext_t* uc = (const ucontext_t*)context; st->print_cr("Registers:"); - st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.jmp_context.iar); - st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.jmp_context.lr); - st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.jmp_context.ctr); + st->print("pc =" INTPTR_FORMAT " ", (unsigned long)uc->uc_mcontext.jmp_context.iar); + st->print("lr =" INTPTR_FORMAT " ", (unsigned long)uc->uc_mcontext.jmp_context.lr); + st->print("ctr=" INTPTR_FORMAT " ", (unsigned long)uc->uc_mcontext.jmp_context.ctr); st->cr(); for (int i = 0; i < 32; i++) { - st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.jmp_context.gpr[i]); + st->print("r%-2d=" INTPTR_FORMAT " ", i, (unsigned long)uc->uc_mcontext.jmp_context.gpr[i]); if (i % 3 == 2) st->cr(); } st->cr(); @@ -464,7 +464,7 @@ void os::print_tos_pc(outputStream *st, const void *context) { st->cr(); // Try to decode the instructions. - st->print_cr("Decoded instructions: (pc=" PTR_FORMAT ")", pc); + st->print_cr("Decoded instructions: (pc=" PTR_FORMAT ")", p2i(pc)); st->print(""); // TODO: PPC port Disassembler::decode(pc, 16, 16, st); st->cr(); diff --git a/src/hotspot/share/utilities/byteswap.hpp b/src/hotspot/share/utilities/byteswap.hpp index d5ece7e00cd..fba0775cf49 100644 --- a/src/hotspot/share/utilities/byteswap.hpp +++ b/src/hotspot/share/utilities/byteswap.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Google and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Google and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -88,7 +88,7 @@ struct ByteswapFallbackImpl { /***************************************************************************** * GCC and compatible (including Clang) *****************************************************************************/ -#if defined(TARGET_COMPILER_gcc) || defined(TARGET_COMPILER_xlc) +#if defined(TARGET_COMPILER_gcc) #if defined(__clang__) || defined(ASSERT) diff --git a/src/hotspot/share/utilities/compilerWarnings_xlc.hpp b/src/hotspot/share/utilities/compilerWarnings_xlc.hpp deleted file mode 100644 index 76782c105af..00000000000 --- a/src/hotspot/share/utilities/compilerWarnings_xlc.hpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -#ifndef SHARE_UTILITIES_COMPILERWARNINGS_XLC_HPP -#define SHARE_UTILITIES_COMPILERWARNINGS_XLC_HPP - -// Nothing here yet. - -#endif // SHARE_UTILITIES_COMPILERWARNINGS_XLC_HPP diff --git a/src/hotspot/share/utilities/count_leading_zeros.hpp b/src/hotspot/share/utilities/count_leading_zeros.hpp index 612a6efbc3a..d6cbed9a355 100644 --- a/src/hotspot/share/utilities/count_leading_zeros.hpp +++ b/src/hotspot/share/utilities/count_leading_zeros.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 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 @@ -123,37 +123,6 @@ template struct CountLeadingZerosImpl { } }; -/***************************************************************************** - * IBM XL C/C++ - *****************************************************************************/ -#elif defined(TARGET_COMPILER_xlc) - -#include - -template struct CountLeadingZerosImpl { - static unsigned doit(T v) { - return __cntlz4((uint32_t)v & 0xFF) - 24u; - } -}; - -template struct CountLeadingZerosImpl { - static unsigned doit(T v) { - return __cntlz4((uint32_t)v & 0xFFFF) - 16u; - } -}; - -template struct CountLeadingZerosImpl { - static unsigned doit(T v) { - return __cntlz4(v); - } -}; - -template struct CountLeadingZerosImpl { - static unsigned doit(T v) { - return __cntlz8(v); - } -}; - /***************************************************************************** * Fallback *****************************************************************************/ diff --git a/src/hotspot/share/utilities/count_trailing_zeros.hpp b/src/hotspot/share/utilities/count_trailing_zeros.hpp index b9e55d0fa24..59cda41daff 100644 --- a/src/hotspot/share/utilities/count_trailing_zeros.hpp +++ b/src/hotspot/share/utilities/count_trailing_zeros.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, 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 @@ -84,21 +84,6 @@ inline unsigned count_trailing_zeros_64(uint64_t x) { return index; } -/***************************************************************************** - * IBM XL C/C++ - *****************************************************************************/ -#elif defined(TARGET_COMPILER_xlc) - -#include - -inline unsigned count_trailing_zeros_32(uint32_t x) { - return __cnttz4(x); -} - -inline unsigned count_trailing_zeros_64(uint64_t x) { - return __cnttz8(x); -} - /***************************************************************************** * Unknown toolchain *****************************************************************************/ diff --git a/src/hotspot/share/utilities/debug.hpp b/src/hotspot/share/utilities/debug.hpp index 3a9adda9054..d21439c35ca 100644 --- a/src/hotspot/share/utilities/debug.hpp +++ b/src/hotspot/share/utilities/debug.hpp @@ -106,7 +106,7 @@ public: // constant evaluation in the compiler. We don't do something like that now, // because we need a fallback when we don't have any mechanism for detecting // constant evaluation. -#if defined(TARGET_COMPILER_gcc) || defined(TARGET_COMPILER_xlc) +#if defined(TARGET_COMPILER_gcc) // Both __has_builtin and __builtin_is_constant_evaluated are available in our // minimum required versions of gcc and clang. diff --git a/src/hotspot/share/utilities/globalDefinitions_gcc.hpp b/src/hotspot/share/utilities/globalDefinitions_gcc.hpp index 06bb22687d8..4267cdb2746 100644 --- a/src/hotspot/share/utilities/globalDefinitions_gcc.hpp +++ b/src/hotspot/share/utilities/globalDefinitions_gcc.hpp @@ -39,6 +39,14 @@ #include #include #include +// In stdlib.h on AIX malloc is defined as a macro causing +// compiler errors when resolving them in different depths as it +// happens in the log tags. This avoids the macro. +#if (defined(__VEC__) || defined(__AIXVEC)) && defined(AIX) \ + && defined(__open_xl_version__) && __open_xl_version__ >= 17 + #undef malloc + extern void *malloc(size_t) asm("vec_malloc"); +#endif #include #include @@ -50,7 +58,7 @@ #include #include -#if defined(LINUX) || defined(_ALLBSD_SOURCE) +#if defined(LINUX) || defined(_ALLBSD_SOURCE) || defined(_AIX) #include #ifndef __OpenBSD__ #include @@ -83,7 +91,7 @@ // checking for nanness #if defined(__APPLE__) inline int g_isnan(double f) { return isnan(f); } -#elif defined(LINUX) || defined(_ALLBSD_SOURCE) +#elif defined(LINUX) || defined(_ALLBSD_SOURCE) || defined(_AIX) inline int g_isnan(float f) { return isnan(f); } inline int g_isnan(double f) { return isnan(f); } #else diff --git a/src/hotspot/share/utilities/globalDefinitions_xlc.hpp b/src/hotspot/share/utilities/globalDefinitions_xlc.hpp deleted file mode 100644 index 9595452d399..00000000000 --- a/src/hotspot/share/utilities/globalDefinitions_xlc.hpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2023 SAP SE. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -#ifndef SHARE_UTILITIES_GLOBALDEFINITIONS_XLC_HPP -#define SHARE_UTILITIES_GLOBALDEFINITIONS_XLC_HPP - -#include "jni.h" - -// This file holds compiler-dependent includes, -// globally used constants & types, class (forward) -// declarations and a few frequently used utility functions. - -#include -#include -#include -#include -#include -#include -#include -// In stdlib.h on AIX malloc is defined as a macro causing -// compiler errors when resolving them in different depths as it -// happens in the log tags. This avoids the macro. -#if (defined(__VEC__) || defined(__AIXVEC)) && defined(AIX) \ - && defined(__open_xl_version__) && __open_xl_version__ >= 17 - #undef malloc - extern void *malloc(size_t) asm("vec_malloc"); -#endif - -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include - -#if defined(__open_xl_version__) - #if __open_xl_version__ < 17 - #error "open xlc < 17 not supported" - #endif -#else - #error "xlc version not supported, macro __open_xl_version__ not found" -#endif - -#ifndef _AIX -#error "missing AIX-specific definition _AIX" -#endif - -// Use XLC compiler builtins instead of inline assembler -#define USE_XLC_BUILTINS - -#ifdef USE_XLC_BUILTINS -#include -// XLC V10 and higher provide the prototype for __dcbtst (void *); -#endif // USE_XLC_BUILTINS - -// NULL vs NULL_WORD: -// Some platform/tool-chain combinations can't assign NULL to an integer -// type so we define NULL_WORD to use in those contexts. -#define NULL_WORD 0L - -// checking for nanness -inline int g_isnan(float f) { return isnan(f); } -inline int g_isnan(double f) { return isnan(f); } - -// Checking for finiteness -inline int g_isfinite(jfloat f) { return finite(f); } -inline int g_isfinite(jdouble f) { return finite(f); } - -// Formatting. -#ifdef _LP64 -#define FORMAT64_MODIFIER "l" -#else // !_LP64 -#define FORMAT64_MODIFIER "ll" -#endif // _LP64 - -// Cannot use xlc's offsetof as implementation of hotspot's -// offset_of(), because xlc warns about applying offsetof() to non-POD -// object and xlc cannot compile the expression offsetof(DataLayout, -// _cells[index]) in DataLayout::cell_offset() . Therefore we define -// offset_of as it is defined for gcc. -#define offset_of(klass,field) (size_t)((intx)&(((klass*)16)->field) - 16) - -#define THREAD_LOCAL __thread - -// Inlining support -// -// Be aware that for function/method declarations, xlC only supports the following -// syntax (i.e. the attribute must be placed AFTER the function/method declarator): -// -// void* operator new(size_t size) throw() NOINLINE; -// -// For function/method definitions, the more common placement BEFORE the -// function/method declarator seems to be supported as well: -// -// NOINLINE void* CHeapObj::operator new(size_t size) throw() {...} - -#define NOINLINE __attribute__((__noinline__)) -#define ALWAYSINLINE inline __attribute__((__always_inline__)) - -#endif // SHARE_UTILITIES_GLOBALDEFINITIONS_XLC_HPP