8329257: AIX: Switch HOTSPOT_TOOLCHAIN_TYPE from xlc to gcc

Reviewed-by: jwaters, stuefe, kbarrett, mdoerr
This commit is contained in:
Joachim Kern 2024-04-15 08:46:36 +00:00 committed by Martin Doerr
parent 5404b4eafc
commit 3f1d9c441e
15 changed files with 44 additions and 248 deletions

View File

@ -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"

View File

@ -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
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
HOTSPOT_TOOLCHAIN_TYPE=visCPP
fi

View File

@ -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);

View File

@ -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) ||

View File

@ -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;
};

View File

@ -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.");

View File

@ -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

View File

@ -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 - print_context>");
// TODO: PPC port Disassembler::decode(pc, 16, 16, st);
st->cr();

View File

@ -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<T, 8> {
/*****************************************************************************
* GCC and compatible (including Clang)
*****************************************************************************/
#if defined(TARGET_COMPILER_gcc) || defined(TARGET_COMPILER_xlc)
#if defined(TARGET_COMPILER_gcc)
#if defined(__clang__) || defined(ASSERT)

View File

@ -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

View File

@ -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 <typename T> struct CountLeadingZerosImpl<T, 8> {
}
};
/*****************************************************************************
* IBM XL C/C++
*****************************************************************************/
#elif defined(TARGET_COMPILER_xlc)
#include <builtins.h>
template <typename T> struct CountLeadingZerosImpl<T, 1> {
static unsigned doit(T v) {
return __cntlz4((uint32_t)v & 0xFF) - 24u;
}
};
template <typename T> struct CountLeadingZerosImpl<T, 2> {
static unsigned doit(T v) {
return __cntlz4((uint32_t)v & 0xFFFF) - 16u;
}
};
template <typename T> struct CountLeadingZerosImpl<T, 4> {
static unsigned doit(T v) {
return __cntlz4(v);
}
};
template <typename T> struct CountLeadingZerosImpl<T, 8> {
static unsigned doit(T v) {
return __cntlz8(v);
}
};
/*****************************************************************************
* Fallback
*****************************************************************************/

View File

@ -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 <builtins.h>
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
*****************************************************************************/

View File

@ -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.

View File

@ -39,6 +39,14 @@
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
// 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 <wchar.h>
#include <math.h>
@ -50,7 +58,7 @@
#include <limits.h>
#include <errno.h>
#if defined(LINUX) || defined(_ALLBSD_SOURCE)
#if defined(LINUX) || defined(_ALLBSD_SOURCE) || defined(_AIX)
#include <signal.h>
#ifndef __OpenBSD__
#include <ucontext.h>
@ -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

View File

@ -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 <alloca.h>
#include <ctype.h>
#include <string.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
// 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 <wchar.h>
#include <math.h>
#include <time.h>
#include <fcntl.h>
#include <dlfcn.h>
#include <pthread.h>
#include <limits.h>
#include <errno.h>
#include <stdint.h>
#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 <builtins.h>
// 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<F>::operator new(size_t size) throw() {...}
#define NOINLINE __attribute__((__noinline__))
#define ALWAYSINLINE inline __attribute__((__always_inline__))
#endif // SHARE_UTILITIES_GLOBALDEFINITIONS_XLC_HPP