mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
8372754: Add wrapper for <cstdlib>
8369205: AIX build break in forbiddenFunctions.hpp Reviewed-by: mdoerr, tschatzl
This commit is contained in:
parent
383fe1efc3
commit
9a944e5587
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
|
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
@ -23,13 +23,13 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h> // do not reorder
|
#include "cppstdlib/cstdlib.hpp"
|
||||||
#include <stdint.h> // do not reorder
|
|
||||||
|
|
||||||
#include "immediate_aarch64.hpp"
|
#include "immediate_aarch64.hpp"
|
||||||
#include "metaprogramming/primitiveConversions.hpp"
|
#include "metaprogramming/primitiveConversions.hpp"
|
||||||
#include "utilities/globalDefinitions.hpp"
|
#include "utilities/globalDefinitions.hpp"
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
// there are at most 2^13 possible logical immediate encodings
|
// there are at most 2^13 possible logical immediate encodings
|
||||||
// however, some combinations of immr and imms are invalid
|
// however, some combinations of immr and imms are invalid
|
||||||
static const unsigned LI_TABLE_SIZE = (1 << 13);
|
static const unsigned LI_TABLE_SIZE = (1 << 13);
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
|
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
@ -22,10 +23,10 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _IMMEDIATE_H
|
#ifndef CPU_AARCH64_IMMEDIATE_AARCH64_HPP
|
||||||
#define _IMMEDIATE_H
|
#define CPU_AARCH64_IMMEDIATE_AARCH64_HPP
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* functions to map backwards and forwards between logical or floating
|
* functions to map backwards and forwards between logical or floating
|
||||||
@ -51,4 +52,4 @@ uint32_t encoding_for_logical_immediate(uint64_t immediate);
|
|||||||
uint64_t fp_immediate_for_encoding(uint32_t imm8, int is_dp);
|
uint64_t fp_immediate_for_encoding(uint32_t imm8, int is_dp);
|
||||||
uint32_t encoding_for_fp_immediate(float immediate);
|
uint32_t encoding_for_fp_immediate(float immediate);
|
||||||
|
|
||||||
#endif // _IMMEDIATE_H
|
#endif // CPU_AARCH64_IMMEDIATE_AARCH64_HPP
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2015, 2019 SAP SE. All rights reserved.
|
* Copyright (c) 2015, 2019 SAP SE. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
@ -23,15 +23,15 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "cppstdlib/cstdlib.hpp"
|
||||||
#include "libodm_aix.hpp"
|
#include "libodm_aix.hpp"
|
||||||
#include "misc_aix.hpp"
|
#include "misc_aix.hpp"
|
||||||
#include <stdlib.h>
|
|
||||||
#include <dlfcn.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "runtime/arguments.hpp"
|
#include "runtime/arguments.hpp"
|
||||||
#include "runtime/os.hpp"
|
#include "runtime/os.hpp"
|
||||||
#include "utilities/permitForbiddenFunctions.hpp"
|
#include "utilities/permitForbiddenFunctions.hpp"
|
||||||
|
|
||||||
|
#include <dlfcn.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
dynamicOdm::dynamicOdm() {
|
dynamicOdm::dynamicOdm() {
|
||||||
const char* libodmname = "/usr/lib/libodm.a(shr_64.o)";
|
const char* libodmname = "/usr/lib/libodm.a(shr_64.o)";
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2022, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2012, 2024 SAP SE. All rights reserved.
|
* Copyright (c) 2012, 2024 SAP SE. All rights reserved.
|
||||||
* Copyright (c) 2022, IBM Corp.
|
* Copyright (c) 2022, IBM Corp.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
@ -32,8 +32,9 @@
|
|||||||
#ifndef OS_AIX_LIBPERFSTAT_AIX_HPP
|
#ifndef OS_AIX_LIBPERFSTAT_AIX_HPP
|
||||||
#define OS_AIX_LIBPERFSTAT_AIX_HPP
|
#define OS_AIX_LIBPERFSTAT_AIX_HPP
|
||||||
|
|
||||||
|
#include "cppstdlib/cstdlib.hpp"
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// These are excerpts from the AIX 7.1 libperfstat.h -
|
// These are excerpts from the AIX 7.1 libperfstat.h -
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2022, 2024, IBM Corp.
|
* Copyright (c) 2022, 2024, IBM Corp.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
@ -23,6 +23,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "cppstdlib/cstdlib.hpp"
|
||||||
#include "jvm.h"
|
#include "jvm.h"
|
||||||
#include "libperfstat_aix.hpp"
|
#include "libperfstat_aix.hpp"
|
||||||
#include "memory/allocation.inline.hpp"
|
#include "memory/allocation.inline.hpp"
|
||||||
@ -46,7 +47,6 @@
|
|||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2023, 2024, Red Hat, Inc. and/or its affiliates.
|
* Copyright (c) 2023, 2024, Red Hat, Inc. and/or its affiliates.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
|
|
||||||
|
#include "cppstdlib/cstdlib.hpp"
|
||||||
#include "nmt/memMapPrinter.hpp"
|
#include "nmt/memMapPrinter.hpp"
|
||||||
#include "runtime/os.hpp"
|
#include "runtime/os.hpp"
|
||||||
#include "utilities/align.hpp"
|
#include "utilities/align.hpp"
|
||||||
@ -34,7 +35,6 @@
|
|||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <libproc.h>
|
#include <libproc.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2015, 2024 SAP SE. All rights reserved.
|
* Copyright (c) 2015, 2024 SAP SE. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
@ -27,6 +27,7 @@
|
|||||||
#include "code/vtableStubs.hpp"
|
#include "code/vtableStubs.hpp"
|
||||||
#include "compiler/compileBroker.hpp"
|
#include "compiler/compileBroker.hpp"
|
||||||
#include "compiler/disassembler.hpp"
|
#include "compiler/disassembler.hpp"
|
||||||
|
#include "cppstdlib/cstdlib.hpp"
|
||||||
#include "hugepages.hpp"
|
#include "hugepages.hpp"
|
||||||
#include "interpreter/interpreter.hpp"
|
#include "interpreter/interpreter.hpp"
|
||||||
#include "jvm.h"
|
#include "jvm.h"
|
||||||
@ -96,7 +97,6 @@
|
|||||||
# include <signal.h>
|
# include <signal.h>
|
||||||
# include <stdint.h>
|
# include <stdint.h>
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
# include <stdlib.h>
|
|
||||||
# include <string.h>
|
# include <string.h>
|
||||||
# include <sys/ioctl.h>
|
# include <sys/ioctl.h>
|
||||||
# include <sys/ipc.h>
|
# include <sys/ipc.h>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -22,6 +22,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "cppstdlib/cstdlib.hpp"
|
||||||
#include "jvm.h"
|
#include "jvm.h"
|
||||||
#include "memory/allocation.inline.hpp"
|
#include "memory/allocation.inline.hpp"
|
||||||
#include "os_linux.inline.hpp"
|
#include "os_linux.inline.hpp"
|
||||||
@ -40,7 +41,6 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2024, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -36,15 +36,12 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// POSIX puts _exit in <unistd.h>.
|
||||||
|
FORBID_IMPORTED_NORETURN_C_FUNCTION(void _exit(int), /* not noexcept */, "use os::exit")
|
||||||
|
|
||||||
// If needed, add os::strndup and use that instead.
|
// If needed, add os::strndup and use that instead.
|
||||||
FORBID_C_FUNCTION(char* strndup(const char*, size_t), noexcept, "don't use");
|
FORBID_C_FUNCTION(char* strndup(const char*, size_t), noexcept, "don't use");
|
||||||
|
|
||||||
// These are unimplementable for Windows, and they aren't useful for a
|
|
||||||
// POSIX implementation of NMT either.
|
|
||||||
// https://stackoverflow.com/questions/62962839/stdaligned-alloc-missing-from-visual-studio-2019
|
|
||||||
FORBID_C_FUNCTION(int posix_memalign(void**, size_t, size_t), noexcept, "don't use");
|
|
||||||
FORBID_C_FUNCTION(void* aligned_alloc(size_t, size_t), noexcept, "don't use");
|
|
||||||
|
|
||||||
// realpath with a null second argument mallocs a string for the result.
|
// realpath with a null second argument mallocs a string for the result.
|
||||||
// With a non-null second argument, there is a risk of buffer overrun.
|
// With a non-null second argument, there is a risk of buffer overrun.
|
||||||
PRAGMA_DIAG_PUSH
|
PRAGMA_DIAG_PUSH
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -23,6 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "classfile/classLoader.hpp"
|
#include "classfile/classLoader.hpp"
|
||||||
|
#include "cppstdlib/cstdlib.hpp"
|
||||||
#include "interpreter/interpreter.hpp"
|
#include "interpreter/interpreter.hpp"
|
||||||
#include "jvm.h"
|
#include "jvm.h"
|
||||||
#include "jvmtifiles/jvmti.h"
|
#include "jvmtifiles/jvmti.h"
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2024, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,15 +25,20 @@
|
|||||||
#ifndef OS_POSIX_PERMITFORBIDDENFUNCTIONS_POSIX_HPP
|
#ifndef OS_POSIX_PERMITFORBIDDENFUNCTIONS_POSIX_HPP
|
||||||
#define OS_POSIX_PERMITFORBIDDENFUNCTIONS_POSIX_HPP
|
#define OS_POSIX_PERMITFORBIDDENFUNCTIONS_POSIX_HPP
|
||||||
|
|
||||||
|
#include "cppstdlib/cstdlib.hpp"
|
||||||
#include "utilities/compilerWarnings.hpp"
|
#include "utilities/compilerWarnings.hpp"
|
||||||
#include "utilities/globalDefinitions.hpp"
|
#include "utilities/globalDefinitions.hpp"
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
// Provide wrappers for some functions otherwise forbidden from use in HotSpot.
|
// Provide wrappers for some functions otherwise forbidden from use in HotSpot.
|
||||||
// See forbiddenFunctions.hpp for details.
|
// See forbiddenFunctions.hpp for details.
|
||||||
|
|
||||||
namespace permit_forbidden_function {
|
namespace permit_forbidden_function {
|
||||||
BEGIN_ALLOW_FORBIDDEN_FUNCTIONS
|
BEGIN_ALLOW_FORBIDDEN_FUNCTIONS
|
||||||
|
|
||||||
|
[[noreturn]] inline void _exit(int status) { ::_exit(status); }
|
||||||
|
|
||||||
// Used by the POSIX implementation of os::realpath.
|
// Used by the POSIX implementation of os::realpath.
|
||||||
inline char* realpath(const char* path, char* resolved_path) {
|
inline char* realpath(const char* path, char* resolved_path) {
|
||||||
return ::realpath(path, resolved_path);
|
return ::realpath(path, resolved_path);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -30,6 +30,7 @@
|
|||||||
#include "code/vtableStubs.hpp"
|
#include "code/vtableStubs.hpp"
|
||||||
#include "compiler/compileBroker.hpp"
|
#include "compiler/compileBroker.hpp"
|
||||||
#include "compiler/disassembler.hpp"
|
#include "compiler/disassembler.hpp"
|
||||||
|
#include "cppstdlib/cstdlib.hpp"
|
||||||
#include "interpreter/interpreter.hpp"
|
#include "interpreter/interpreter.hpp"
|
||||||
#include "jvm.h"
|
#include "jvm.h"
|
||||||
#include "jvmtifiles/jvmti.h"
|
#include "jvmtifiles/jvmti.h"
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2024, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,6 +25,7 @@
|
|||||||
#ifndef OS_WINDOWS_PERMITFORBIDDENFUNCTIONS_WINDOWS_HPP
|
#ifndef OS_WINDOWS_PERMITFORBIDDENFUNCTIONS_WINDOWS_HPP
|
||||||
#define OS_WINDOWS_PERMITFORBIDDENFUNCTIONS_WINDOWS_HPP
|
#define OS_WINDOWS_PERMITFORBIDDENFUNCTIONS_WINDOWS_HPP
|
||||||
|
|
||||||
|
#include "cppstdlib/cstdlib.hpp"
|
||||||
#include "utilities/compilerWarnings.hpp"
|
#include "utilities/compilerWarnings.hpp"
|
||||||
#include "utilities/globalDefinitions.hpp"
|
#include "utilities/globalDefinitions.hpp"
|
||||||
|
|
||||||
@ -34,6 +35,8 @@
|
|||||||
namespace permit_forbidden_function {
|
namespace permit_forbidden_function {
|
||||||
BEGIN_ALLOW_FORBIDDEN_FUNCTIONS
|
BEGIN_ALLOW_FORBIDDEN_FUNCTIONS
|
||||||
|
|
||||||
|
[[noreturn]] inline void _exit(int status) { ::_exit(status); }
|
||||||
|
|
||||||
// Used by the Windows implementation of os::realpath.
|
// Used by the Windows implementation of os::realpath.
|
||||||
inline char* _fullpath(char* absPath, const char* relPath, size_t maxLength) {
|
inline char* _fullpath(char* absPath, const char* relPath, size_t maxLength) {
|
||||||
return ::_fullpath(absPath, relPath, maxLength);
|
return ::_fullpath(absPath, relPath, maxLength);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "cds/aotMetaspace.hpp"
|
#include "cds/aotMetaspace.hpp"
|
||||||
#include "cds/cdsConfig.hpp"
|
#include "cds/cdsConfig.hpp"
|
||||||
|
#include "cppstdlib/cstdlib.hpp"
|
||||||
#include "runtime/arguments.hpp"
|
#include "runtime/arguments.hpp"
|
||||||
#include "runtime/javaThread.hpp"
|
#include "runtime/javaThread.hpp"
|
||||||
#include "runtime/os.hpp"
|
#include "runtime/os.hpp"
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
|
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
|
||||||
* Copyright (c) 2021, Azul Systems, Inc. All rights reserved.
|
* Copyright (c) 2021, Azul Systems, Inc. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
@ -29,6 +29,7 @@
|
|||||||
#include "classfile/vmSymbols.hpp"
|
#include "classfile/vmSymbols.hpp"
|
||||||
#include "code/codeCache.hpp"
|
#include "code/codeCache.hpp"
|
||||||
#include "code/vtableStubs.hpp"
|
#include "code/vtableStubs.hpp"
|
||||||
|
#include "cppstdlib/cstdlib.hpp"
|
||||||
#include "interpreter/interpreter.hpp"
|
#include "interpreter/interpreter.hpp"
|
||||||
#include "jvm.h"
|
#include "jvm.h"
|
||||||
#include "logging/log.hpp"
|
#include "logging/log.hpp"
|
||||||
@ -63,7 +64,6 @@
|
|||||||
# include <signal.h>
|
# include <signal.h>
|
||||||
# include <errno.h>
|
# include <errno.h>
|
||||||
# include <dlfcn.h>
|
# include <dlfcn.h>
|
||||||
# include <stdlib.h>
|
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <sys/resource.h>
|
# include <sys/resource.h>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -26,6 +26,7 @@
|
|||||||
#include "classfile/vmSymbols.hpp"
|
#include "classfile/vmSymbols.hpp"
|
||||||
#include "code/codeCache.hpp"
|
#include "code/codeCache.hpp"
|
||||||
#include "code/vtableStubs.hpp"
|
#include "code/vtableStubs.hpp"
|
||||||
|
#include "cppstdlib/cstdlib.hpp"
|
||||||
#include "interpreter/interpreter.hpp"
|
#include "interpreter/interpreter.hpp"
|
||||||
#include "jvm.h"
|
#include "jvm.h"
|
||||||
#include "logging/log.hpp"
|
#include "logging/log.hpp"
|
||||||
@ -58,7 +59,6 @@
|
|||||||
# include <signal.h>
|
# include <signal.h>
|
||||||
# include <errno.h>
|
# include <errno.h>
|
||||||
# include <dlfcn.h>
|
# include <dlfcn.h>
|
||||||
# include <stdlib.h>
|
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <sys/resource.h>
|
# include <sys/resource.h>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
|
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
@ -28,6 +28,7 @@
|
|||||||
#include "code/codeCache.hpp"
|
#include "code/codeCache.hpp"
|
||||||
#include "code/vtableStubs.hpp"
|
#include "code/vtableStubs.hpp"
|
||||||
#include "code/nativeInst.hpp"
|
#include "code/nativeInst.hpp"
|
||||||
|
#include "cppstdlib/cstdlib.hpp"
|
||||||
#include "interpreter/interpreter.hpp"
|
#include "interpreter/interpreter.hpp"
|
||||||
#include "jvm.h"
|
#include "jvm.h"
|
||||||
#include "memory/allocation.inline.hpp"
|
#include "memory/allocation.inline.hpp"
|
||||||
@ -59,7 +60,6 @@
|
|||||||
# include <signal.h>
|
# include <signal.h>
|
||||||
# include <errno.h>
|
# include <errno.h>
|
||||||
# include <dlfcn.h>
|
# include <dlfcn.h>
|
||||||
# include <stdlib.h>
|
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <sys/resource.h>
|
# include <sys/resource.h>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2008, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,6 +25,7 @@
|
|||||||
#include "asm/assembler.inline.hpp"
|
#include "asm/assembler.inline.hpp"
|
||||||
#include "classfile/vmSymbols.hpp"
|
#include "classfile/vmSymbols.hpp"
|
||||||
#include "code/vtableStubs.hpp"
|
#include "code/vtableStubs.hpp"
|
||||||
|
#include "cppstdlib/cstdlib.hpp"
|
||||||
#include "interpreter/interpreter.hpp"
|
#include "interpreter/interpreter.hpp"
|
||||||
#include "jvm.h"
|
#include "jvm.h"
|
||||||
#include "memory/allocation.inline.hpp"
|
#include "memory/allocation.inline.hpp"
|
||||||
@ -57,7 +58,6 @@
|
|||||||
# include <signal.h>
|
# include <signal.h>
|
||||||
# include <errno.h>
|
# include <errno.h>
|
||||||
# include <dlfcn.h>
|
# include <dlfcn.h>
|
||||||
# include <stdlib.h>
|
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <sys/resource.h>
|
# include <sys/resource.h>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2012, 2025 SAP SE. All rights reserved.
|
* Copyright (c) 2012, 2025 SAP SE. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
@ -28,6 +28,7 @@
|
|||||||
#include "classfile/vmSymbols.hpp"
|
#include "classfile/vmSymbols.hpp"
|
||||||
#include "code/codeCache.hpp"
|
#include "code/codeCache.hpp"
|
||||||
#include "code/vtableStubs.hpp"
|
#include "code/vtableStubs.hpp"
|
||||||
|
#include "cppstdlib/cstdlib.hpp"
|
||||||
#include "interpreter/interpreter.hpp"
|
#include "interpreter/interpreter.hpp"
|
||||||
#include "jvm.h"
|
#include "jvm.h"
|
||||||
#include "memory/allocation.inline.hpp"
|
#include "memory/allocation.inline.hpp"
|
||||||
@ -62,7 +63,6 @@
|
|||||||
# include <signal.h>
|
# include <signal.h>
|
||||||
# include <errno.h>
|
# include <errno.h>
|
||||||
# include <dlfcn.h>
|
# include <dlfcn.h>
|
||||||
# include <stdlib.h>
|
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <sys/resource.h>
|
# include <sys/resource.h>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
|
* Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
@ -28,6 +28,7 @@
|
|||||||
#include "code/codeCache.hpp"
|
#include "code/codeCache.hpp"
|
||||||
#include "code/nativeInst.hpp"
|
#include "code/nativeInst.hpp"
|
||||||
#include "code/vtableStubs.hpp"
|
#include "code/vtableStubs.hpp"
|
||||||
|
#include "cppstdlib/cstdlib.hpp"
|
||||||
#include "interpreter/interpreter.hpp"
|
#include "interpreter/interpreter.hpp"
|
||||||
#include "jvm.h"
|
#include "jvm.h"
|
||||||
#include "memory/allocation.inline.hpp"
|
#include "memory/allocation.inline.hpp"
|
||||||
@ -61,7 +62,6 @@
|
|||||||
# include <pthread.h>
|
# include <pthread.h>
|
||||||
# include <signal.h>
|
# include <signal.h>
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
# include <stdlib.h>
|
|
||||||
# include <sys/mman.h>
|
# include <sys/mman.h>
|
||||||
# include <sys/resource.h>
|
# include <sys/resource.h>
|
||||||
# include <sys/socket.h>
|
# include <sys/socket.h>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2016, 2024 SAP SE. All rights reserved.
|
* Copyright (c) 2016, 2024 SAP SE. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
@ -30,6 +30,7 @@
|
|||||||
#include "code/nativeInst.hpp"
|
#include "code/nativeInst.hpp"
|
||||||
#include "code/vtableStubs.hpp"
|
#include "code/vtableStubs.hpp"
|
||||||
#include "compiler/disassembler.hpp"
|
#include "compiler/disassembler.hpp"
|
||||||
|
#include "cppstdlib/cstdlib.h"
|
||||||
#include "interpreter/interpreter.hpp"
|
#include "interpreter/interpreter.hpp"
|
||||||
#include "jvm.h"
|
#include "jvm.h"
|
||||||
#include "memory/allocation.inline.hpp"
|
#include "memory/allocation.inline.hpp"
|
||||||
@ -62,7 +63,6 @@
|
|||||||
# include <signal.h>
|
# include <signal.h>
|
||||||
# include <errno.h>
|
# include <errno.h>
|
||||||
# include <dlfcn.h>
|
# include <dlfcn.h>
|
||||||
# include <stdlib.h>
|
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <sys/resource.h>
|
# include <sys/resource.h>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -26,6 +26,7 @@
|
|||||||
#include "classfile/vmSymbols.hpp"
|
#include "classfile/vmSymbols.hpp"
|
||||||
#include "code/codeCache.hpp"
|
#include "code/codeCache.hpp"
|
||||||
#include "code/vtableStubs.hpp"
|
#include "code/vtableStubs.hpp"
|
||||||
|
#include "cppstdlib/cstdlib.hpp"
|
||||||
#include "interpreter/interpreter.hpp"
|
#include "interpreter/interpreter.hpp"
|
||||||
#include "jvm.h"
|
#include "jvm.h"
|
||||||
#include "logging/log.hpp"
|
#include "logging/log.hpp"
|
||||||
@ -59,7 +60,6 @@
|
|||||||
# include <signal.h>
|
# include <signal.h>
|
||||||
# include <errno.h>
|
# include <errno.h>
|
||||||
# include <dlfcn.h>
|
# include <dlfcn.h>
|
||||||
# include <stdlib.h>
|
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <sys/resource.h>
|
# include <sys/resource.h>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, Microsoft Corporation. All rights reserved.
|
* Copyright (c) 2020, Microsoft Corporation. All rights reserved.
|
||||||
* Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2022, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -28,6 +28,7 @@
|
|||||||
#include "code/codeCache.hpp"
|
#include "code/codeCache.hpp"
|
||||||
#include "code/vtableStubs.hpp"
|
#include "code/vtableStubs.hpp"
|
||||||
#include "code/nativeInst.hpp"
|
#include "code/nativeInst.hpp"
|
||||||
|
#include "cppstdlib/cstdlib.hpp"
|
||||||
#include "interpreter/interpreter.hpp"
|
#include "interpreter/interpreter.hpp"
|
||||||
#include "jvm.h"
|
#include "jvm.h"
|
||||||
#include "memory/allocation.inline.hpp"
|
#include "memory/allocation.inline.hpp"
|
||||||
@ -54,7 +55,6 @@
|
|||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
# include <signal.h>
|
# include <signal.h>
|
||||||
# include <errno.h>
|
# include <errno.h>
|
||||||
# include <stdlib.h>
|
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
# include <intrin.h>
|
# include <intrin.h>
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -42,6 +42,7 @@
|
|||||||
#include "classfile/vmClasses.hpp"
|
#include "classfile/vmClasses.hpp"
|
||||||
#include "classfile/vmSymbols.hpp"
|
#include "classfile/vmSymbols.hpp"
|
||||||
#include "compiler/compileBroker.hpp"
|
#include "compiler/compileBroker.hpp"
|
||||||
|
#include "cppstdlib/cstdlib.hpp"
|
||||||
#include "interpreter/bytecodeStream.hpp"
|
#include "interpreter/bytecodeStream.hpp"
|
||||||
#include "interpreter/oopMapCache.hpp"
|
#include "interpreter/oopMapCache.hpp"
|
||||||
#include "jimage.hpp"
|
#include "jimage.hpp"
|
||||||
@ -81,7 +82,6 @@
|
|||||||
#include "utilities/utf8.hpp"
|
#include "utilities/utf8.hpp"
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
// Entry point in java.dll for path canonicalization
|
// Entry point in java.dll for path canonicalization
|
||||||
|
|
||||||
|
|||||||
105
src/hotspot/share/cppstdlib/cstdlib.hpp
Normal file
105
src/hotspot/share/cppstdlib/cstdlib.hpp
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SHARE_CPPSTDLIB_CSTDLIB_HPP
|
||||||
|
#define SHARE_CPPSTDLIB_CSTDLIB_HPP
|
||||||
|
|
||||||
|
#include "utilities/compilerWarnings.hpp"
|
||||||
|
|
||||||
|
// HotSpot usage for <cstdlib>:
|
||||||
|
//
|
||||||
|
// Some functions are explicitly forbidden below. That may not be a complete
|
||||||
|
// list of all the functions we should forbid.
|
||||||
|
//
|
||||||
|
// We assume <cstdlib> provides definitions in the global namespace, in
|
||||||
|
// addition to providing them in the std namespace. We prefer to use the names
|
||||||
|
// in the global namespace.
|
||||||
|
|
||||||
|
BEGIN_ALLOW_FORBIDDEN_FUNCTIONS
|
||||||
|
#include "utilities/vmassert_uninstall.hpp"
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
|
#include "utilities/vmassert_reinstall.hpp" // don't reorder
|
||||||
|
END_ALLOW_FORBIDDEN_FUNCTIONS
|
||||||
|
|
||||||
|
// AIX may define malloc and calloc as macros when certain other features are
|
||||||
|
// present, causing us all sorts of grief.
|
||||||
|
// https://www.ibm.com/docs/en/openxl-c-and-cpp-aix/17.1.4?topic=compilers-memory-allocation
|
||||||
|
// Replace the macro definitions with something we can work with.
|
||||||
|
// AIX 7.3 no longer uses macro renaming when building with clang, instead
|
||||||
|
// using the same asm replacement approach as used below. This workaround can
|
||||||
|
// be removed once earlier versions are no longer supported as build platforms.
|
||||||
|
#if defined(AIX) && (defined(__VEC__) || defined(__AIXVEC))
|
||||||
|
#if defined(malloc) || defined(calloc)
|
||||||
|
#if !defined(malloc) || !defined(calloc)
|
||||||
|
#error "Inconsistent alloc macro mappings, expected both to be mapped."
|
||||||
|
#endif
|
||||||
|
// Remove the macros.
|
||||||
|
#undef malloc
|
||||||
|
#undef calloc
|
||||||
|
// Implement the mapping using gcc/clang asm name mapping.
|
||||||
|
extern "C" {
|
||||||
|
extern void* malloc(size_t) noexcept asm("vec_malloc");
|
||||||
|
extern void* calloc(size_t, size_t) noexcept asm("vec_calloc");
|
||||||
|
} // extern "C"
|
||||||
|
// Because the macros are in place when <cstdlib> brings names into the std
|
||||||
|
// namespace, macro replacement causes the expanded names to be added instead
|
||||||
|
// of the intended names. We can't remove std::vec_malloc and std::vec_calloc,
|
||||||
|
// but we do add the standard names in case someone uses them.
|
||||||
|
namespace std {
|
||||||
|
using ::malloc;
|
||||||
|
using ::calloc;
|
||||||
|
} // namespace std
|
||||||
|
#endif // Macro definition for malloc or calloc
|
||||||
|
#endif // AIX altivec allocator support
|
||||||
|
|
||||||
|
// Prefer os:: variants of these.
|
||||||
|
FORBID_IMPORTED_NORETURN_C_FUNCTION(void exit(int), noexcept, "use os::exit")
|
||||||
|
FORBID_IMPORTED_NORETURN_C_FUNCTION(void _Exit(int), noexcept, "use os::exit")
|
||||||
|
|
||||||
|
// Windows puts _exit in <stdlib.h>. POSIX puts it in <unistd.h>.
|
||||||
|
// We can't forbid it here when using clang if it's not in <stdlib.h> - see
|
||||||
|
// the clang definition for FORBIDDEN_FUNCTION_NORETURN_ATTRIBUTE.
|
||||||
|
#ifdef _WINDOWS
|
||||||
|
FORBID_IMPORTED_NORETURN_C_FUNCTION(void _exit(int), /* not noexcept */, "use os::exit")
|
||||||
|
#endif // _WINDOWS
|
||||||
|
|
||||||
|
// These functions return raw C-heap pointers or, in case of free(), take raw
|
||||||
|
// C-heap pointers. We generally want allocation to be done through NMT, using
|
||||||
|
// os::malloc and friends.
|
||||||
|
FORBID_IMPORTED_C_FUNCTION(void* malloc(size_t), noexcept, "use os::malloc");
|
||||||
|
FORBID_IMPORTED_C_FUNCTION(void free(void*), noexcept, "use os::free");
|
||||||
|
FORBID_IMPORTED_C_FUNCTION(void* calloc(size_t, size_t), noexcept, "use os::malloc and zero out manually");
|
||||||
|
FORBID_IMPORTED_C_FUNCTION(void* realloc(void*, size_t), noexcept, "use os::realloc");
|
||||||
|
|
||||||
|
// These are not provided (and are unimplementable?) by Windows.
|
||||||
|
// https://stackoverflow.com/questions/62962839/stdaligned-alloc-missing-from-visual-studio-2019
|
||||||
|
// They also aren't useful for a POSIX implementation of NMT.
|
||||||
|
#ifndef _WINDOWS
|
||||||
|
FORBID_C_FUNCTION(void* aligned_alloc(size_t, size_t), noexcept, "don't use");
|
||||||
|
FORBID_C_FUNCTION(int posix_memalign(void**, size_t, size_t), noexcept, "don't use");
|
||||||
|
#endif // !_WINDOWS
|
||||||
|
|
||||||
|
#endif // SHARE_CPPSTDLIB_CSTDLIB_HPP
|
||||||
@ -1,4 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2023, 2024, 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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
@ -141,7 +142,7 @@ struct ByteswapImpl : public ByteswapFallbackImpl<T, N> {};
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#elif defined(TARGET_COMPILER_visCPP)
|
#elif defined(TARGET_COMPILER_visCPP)
|
||||||
|
|
||||||
#include <cstdlib>
|
#include "cppstdlib/cstdlib.hpp"
|
||||||
|
|
||||||
#pragma intrinsic(_byteswap_ushort)
|
#pragma intrinsic(_byteswap_ushort)
|
||||||
#pragma intrinsic(_byteswap_ulong)
|
#pragma intrinsic(_byteswap_ulong)
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2024, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -32,12 +32,6 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
// Workaround for noreturn functions: exit, _exit, _Exit - see the clang
|
|
||||||
// definition of FORBIDDEN_FUNCTION_NORETURN_ATTRIBUTE.
|
|
||||||
#ifdef __clang__
|
|
||||||
#include <stdlib.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
#include "forbiddenFunctions_windows.hpp"
|
#include "forbiddenFunctions_windows.hpp"
|
||||||
#else
|
#else
|
||||||
@ -49,12 +43,6 @@
|
|||||||
// or have security concerns, either with preferred alternatives, or to be
|
// or have security concerns, either with preferred alternatives, or to be
|
||||||
// avoided entirely.
|
// avoided entirely.
|
||||||
|
|
||||||
FORBID_IMPORTED_NORETURN_C_FUNCTION(void exit(int), noexcept, "use os::exit")
|
|
||||||
FORBID_IMPORTED_NORETURN_C_FUNCTION(void _Exit(int), noexcept, "use os::exit")
|
|
||||||
|
|
||||||
// Windows puts _exit in <stdlib.h>, POSIX in <unistd.h>.
|
|
||||||
FORBID_IMPORTED_NORETURN_C_FUNCTION(void _exit(int), /* not noexcept */, "use os::exit")
|
|
||||||
|
|
||||||
FORBID_IMPORTED_C_FUNCTION(char* strerror(int), noexcept, "use os::strerror");
|
FORBID_IMPORTED_C_FUNCTION(char* strerror(int), noexcept, "use os::strerror");
|
||||||
FORBID_IMPORTED_C_FUNCTION(char* strtok(char*, const char*), noexcept, "use strtok_r");
|
FORBID_IMPORTED_C_FUNCTION(char* strtok(char*, const char*), noexcept, "use strtok_r");
|
||||||
|
|
||||||
@ -70,13 +58,8 @@ FORBID_C_FUNCTION(int vsprintf(char*, const char*, va_list), noexcept, "use os::
|
|||||||
FORBID_C_FUNCTION(int vsnprintf(char*, size_t, const char*, va_list), noexcept, "use os::vsnprintf");
|
FORBID_C_FUNCTION(int vsnprintf(char*, size_t, const char*, va_list), noexcept, "use os::vsnprintf");
|
||||||
PRAGMA_DIAG_POP
|
PRAGMA_DIAG_POP
|
||||||
|
|
||||||
// All of the following functions return raw C-heap pointers (sometimes as an
|
// All of the following functions return raw C-heap pointers. We generally
|
||||||
// option, e.g. realpath or getwd) or, in case of free(), take raw C-heap
|
// want allocation to be done through NMT.
|
||||||
// pointers. We generally want allocation to be done through NMT.
|
|
||||||
FORBID_IMPORTED_C_FUNCTION(void* malloc(size_t size), noexcept, "use os::malloc");
|
|
||||||
FORBID_IMPORTED_C_FUNCTION(void free(void *ptr), noexcept, "use os::free");
|
|
||||||
FORBID_IMPORTED_C_FUNCTION(void* calloc(size_t nmemb, size_t size), noexcept, "use os::malloc and zero out manually");
|
|
||||||
FORBID_IMPORTED_C_FUNCTION(void* realloc(void *ptr, size_t size), noexcept, "use os::realloc");
|
|
||||||
FORBID_IMPORTED_C_FUNCTION(char* strdup(const char *s), noexcept, "use os::strdup");
|
FORBID_IMPORTED_C_FUNCTION(char* strdup(const char *s), noexcept, "use os::strdup");
|
||||||
FORBID_IMPORTED_C_FUNCTION(wchar_t* wcsdup(const wchar_t *s), noexcept, "don't use");
|
FORBID_IMPORTED_C_FUNCTION(wchar_t* wcsdup(const wchar_t *s), noexcept, "don't use");
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -31,6 +31,8 @@
|
|||||||
// globally used constants & types, class (forward)
|
// globally used constants & types, class (forward)
|
||||||
// declarations and a few frequently used utility functions.
|
// declarations and a few frequently used utility functions.
|
||||||
|
|
||||||
|
#include "cppstdlib/cstdlib.hpp"
|
||||||
|
|
||||||
#include <alloca.h>
|
#include <alloca.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
@ -44,15 +46,6 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.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 <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -34,6 +34,8 @@
|
|||||||
// Need this on windows to get the math constants (e.g., M_PI).
|
// Need this on windows to get the math constants (e.g., M_PI).
|
||||||
#define _USE_MATH_DEFINES
|
#define _USE_MATH_DEFINES
|
||||||
|
|
||||||
|
#include "cppstdlib/cstdlib.hpp"
|
||||||
|
|
||||||
# include <ctype.h>
|
# include <ctype.h>
|
||||||
# include <fcntl.h>
|
# include <fcntl.h>
|
||||||
# include <float.h> // for _isnan
|
# include <float.h> // for _isnan
|
||||||
@ -45,7 +47,6 @@
|
|||||||
# include <stddef.h>// for offsetof
|
# include <stddef.h>// for offsetof
|
||||||
# include <stdint.h>
|
# include <stdint.h>
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
# include <stdlib.h>
|
|
||||||
# include <string.h>
|
# include <string.h>
|
||||||
# include <sys/stat.h>
|
# include <sys/stat.h>
|
||||||
# include <time.h>
|
# include <time.h>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2022 SAP SE. All rights reserved.
|
* Copyright (c) 2022 SAP SE. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
@ -26,6 +26,7 @@
|
|||||||
#ifndef SHARE_UTILITIES_PARSE_INTEGER_HPP
|
#ifndef SHARE_UTILITIES_PARSE_INTEGER_HPP
|
||||||
#define SHARE_UTILITIES_PARSE_INTEGER_HPP
|
#define SHARE_UTILITIES_PARSE_INTEGER_HPP
|
||||||
|
|
||||||
|
#include "cppstdlib/cstdlib.hpp"
|
||||||
#include "cppstdlib/limits.hpp"
|
#include "cppstdlib/limits.hpp"
|
||||||
#include "metaprogramming/enableIf.hpp"
|
#include "metaprogramming/enableIf.hpp"
|
||||||
#include "utilities/debug.hpp"
|
#include "utilities/debug.hpp"
|
||||||
@ -33,7 +34,6 @@
|
|||||||
#include "utilities/macros.hpp"
|
#include "utilities/macros.hpp"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
// *************************************************************************
|
// *************************************************************************
|
||||||
// ** Attention compatibility! **
|
// ** Attention compatibility! **
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2024, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,6 +25,7 @@
|
|||||||
#ifndef SHARE_UTILITIES_PERMITFORBIDDENFUNCTIONS_HPP
|
#ifndef SHARE_UTILITIES_PERMITFORBIDDENFUNCTIONS_HPP
|
||||||
#define SHARE_UTILITIES_PERMITFORBIDDENFUNCTIONS_HPP
|
#define SHARE_UTILITIES_PERMITFORBIDDENFUNCTIONS_HPP
|
||||||
|
|
||||||
|
#include "cppstdlib/cstdlib.hpp"
|
||||||
#include "utilities/compilerWarnings.hpp"
|
#include "utilities/compilerWarnings.hpp"
|
||||||
#include "utilities/globalDefinitions.hpp"
|
#include "utilities/globalDefinitions.hpp"
|
||||||
|
|
||||||
@ -34,6 +35,9 @@
|
|||||||
#include "permitForbiddenFunctions_posix.hpp"
|
#include "permitForbiddenFunctions_posix.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
// Provide wrappers for some functions otherwise forbidden from use in HotSpot.
|
// Provide wrappers for some functions otherwise forbidden from use in HotSpot.
|
||||||
//
|
//
|
||||||
// There may be special circumstances where an otherwise forbidden function
|
// There may be special circumstances where an otherwise forbidden function
|
||||||
@ -53,7 +57,6 @@ namespace permit_forbidden_function {
|
|||||||
BEGIN_ALLOW_FORBIDDEN_FUNCTIONS
|
BEGIN_ALLOW_FORBIDDEN_FUNCTIONS
|
||||||
|
|
||||||
[[noreturn]] inline void exit(int status) { ::exit(status); }
|
[[noreturn]] inline void exit(int status) { ::exit(status); }
|
||||||
[[noreturn]] inline void _exit(int status) { ::_exit(status); }
|
|
||||||
|
|
||||||
ATTRIBUTE_PRINTF(3, 0)
|
ATTRIBUTE_PRINTF(3, 0)
|
||||||
inline int vsnprintf(char* str, size_t size, const char* format, va_list ap) {
|
inline int vsnprintf(char* str, size_t size, const char* format, va_list ap) {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -22,6 +22,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "cppstdlib/cstdlib.hpp"
|
||||||
#include "jni.h"
|
#include "jni.h"
|
||||||
#include "runtime/os.hpp"
|
#include "runtime/os.hpp"
|
||||||
#include "runtime/thread.inline.hpp"
|
#include "runtime/thread.inline.hpp"
|
||||||
@ -31,7 +32,6 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -24,9 +24,9 @@
|
|||||||
#ifndef UNITTEST_HPP
|
#ifndef UNITTEST_HPP
|
||||||
#define UNITTEST_HPP
|
#define UNITTEST_HPP
|
||||||
|
|
||||||
|
#include "cppstdlib/cstdlib.hpp"
|
||||||
#include "utilities/globalDefinitions.hpp"
|
#include "utilities/globalDefinitions.hpp"
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#define GTEST_DONT_DEFINE_TEST 1
|
#define GTEST_DONT_DEFINE_TEST 1
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -21,6 +21,7 @@
|
|||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "cppstdlib/cstdlib.hpp"
|
||||||
#include "runtime/os.hpp"
|
#include "runtime/os.hpp"
|
||||||
#include "utilities/align.hpp"
|
#include "utilities/align.hpp"
|
||||||
#include "utilities/bitMap.inline.hpp"
|
#include "utilities/bitMap.inline.hpp"
|
||||||
@ -29,8 +30,6 @@
|
|||||||
#include "utilities/globalDefinitions.hpp"
|
#include "utilities/globalDefinitions.hpp"
|
||||||
#include "unittest.hpp"
|
#include "unittest.hpp"
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
typedef BitMap::idx_t idx_t;
|
typedef BitMap::idx_t idx_t;
|
||||||
typedef BitMap::bm_word_t bm_word_t;
|
typedef BitMap::bm_word_t bm_word_t;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user