Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/hotspot/os/aix/libodm_aix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <string.h>
#include "runtime/arguments.hpp"
#include "runtime/os.hpp"
#include "utilities/permitForbiddenFunctions.hpp"


dynamicOdm::dynamicOdm() {
Expand Down Expand Up @@ -60,7 +59,7 @@ dynamicOdm::~dynamicOdm() {
}


void odmWrapper::clean_data() { if (_data) { permit_forbidden_function::free(_data); _data = nullptr; } }
void odmWrapper::clean_data() { if (_data) { free(_data); _data = nullptr; } }


int odmWrapper::class_offset(const char *field, bool is_aix_5)
Expand Down
17 changes: 8 additions & 9 deletions src/hotspot/os/aix/loadlib_aix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include "logging/log.hpp"
#include "utilities/debug.hpp"
#include "utilities/ostream.hpp"
#include "utilities/permitForbiddenFunctions.hpp"

// For loadquery()
#include <sys/ldr.h>
Expand All @@ -56,7 +55,7 @@ class StringList {
// Enlarge list. If oom, leave old list intact and return false.
bool enlarge() {
int cap2 = _cap + 64;
char** l2 = (char**) permit_forbidden_function::realloc(_list, sizeof(char*) * cap2);
char** l2 = (char**) ::realloc(_list, sizeof(char*) * cap2);
if (!l2) {
return false;
}
Expand All @@ -74,7 +73,7 @@ class StringList {
}
}
assert0(_cap > _num);
char* s2 = permit_forbidden_function::strdup(s);
char* s2 = ::strdup(s);
if (!s2) {
return nullptr;
}
Expand Down Expand Up @@ -168,7 +167,7 @@ static void free_entry_list(loaded_module_t** start) {
loaded_module_t* lm = *start;
while (lm) {
loaded_module_t* const lm2 = lm->next;
permit_forbidden_function::free(lm);
::free(lm);
lm = lm2;
}
*start = nullptr;
Expand All @@ -191,7 +190,7 @@ static bool reload_table() {
uint8_t* buffer = nullptr;
size_t buflen = 1024;
for (;;) {
buffer = (uint8_t*) permit_forbidden_function::realloc(buffer, buflen);
buffer = (uint8_t*) ::realloc(buffer, buflen);
if (loadquery(L_GETINFO, buffer, buflen) == -1) {
if (errno == ENOMEM) {
buflen *= 2;
Expand All @@ -211,7 +210,7 @@ static bool reload_table() {

for (;;) {

loaded_module_t* lm = (loaded_module_t*) permit_forbidden_function::malloc(sizeof(loaded_module_t));
loaded_module_t* lm = (loaded_module_t*) ::malloc(sizeof(loaded_module_t));
if (!lm) {
log_warning(os)("OOM.");
goto cleanup;
Expand All @@ -227,7 +226,7 @@ static bool reload_table() {
lm->path = g_stringlist.add(ldi->ldinfo_filename);
if (!lm->path) {
log_warning(os)("OOM.");
permit_forbidden_function::free(lm);
free(lm);
goto cleanup;
}

Expand All @@ -249,7 +248,7 @@ static bool reload_table() {
lm->member = g_stringlist.add(p_mbr_name);
if (!lm->member) {
log_warning(os)("OOM.");
permit_forbidden_function::free(lm);
free(lm);
goto cleanup;
}
} else {
Expand Down Expand Up @@ -297,7 +296,7 @@ static bool reload_table() {
free_entry_list(&new_list);
}

permit_forbidden_function::free(buffer);
::free(buffer);

return rc;

Expand Down
9 changes: 4 additions & 5 deletions src/hotspot/os/aix/os_aix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
#include "utilities/defaultStream.hpp"
#include "utilities/events.hpp"
#include "utilities/growableArray.hpp"
#include "utilities/permitForbiddenFunctions.hpp"
#include "utilities/vmError.hpp"
#if INCLUDE_JFR
#include "jfr/support/jfrNativeLibraryLoadEvent.hpp"
Expand Down Expand Up @@ -365,9 +364,9 @@ static void query_multipage_support() {
// or by environment variable LDR_CNTRL (suboption DATAPSIZE). If none is given,
// default should be 4K.
{
void* p = permit_forbidden_function::malloc(16*M);
void* p = ::malloc(16*M);
g_multipage_support.datapsize = os::Aix::query_pagesize(p);
permit_forbidden_function::free(p);
::free(p);
}

// Query default shm page size (LDR_CNTRL SHMPSIZE).
Expand Down Expand Up @@ -1410,7 +1409,7 @@ static struct {
} vmem;

static void vmembk_add(char* addr, size_t size, size_t pagesize, int type) {
vmembk_t* p = (vmembk_t*) permit_forbidden_function::malloc(sizeof(vmembk_t));
vmembk_t* p = (vmembk_t*) ::malloc(sizeof(vmembk_t));
assert0(p);
if (p) {
MiscUtils::AutoCritSect lck(&vmem.cs);
Expand Down Expand Up @@ -1439,7 +1438,7 @@ static void vmembk_remove(vmembk_t* p0) {
for (vmembk_t** pp = &(vmem.first); *pp; pp = &((*pp)->next)) {
if (*pp == p0) {
*pp = p0->next;
permit_forbidden_function::free(p0);
::free(p0);
return;
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/hotspot/os/aix/porting_aix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#include "runtime/os.hpp"
#include "utilities/align.hpp"
#include "utilities/debug.hpp"
#include "utilities/permitForbiddenFunctions.hpp"
#include <cxxabi.h>
#include <sys/debug.h>
#include <pthread.h>
Expand Down Expand Up @@ -251,7 +250,7 @@ bool AixSymbols::get_function_name (
p_name[namelen-1] = '\0';
}
if (demangled_name != nullptr) {
permit_forbidden_function::free(demangled_name);
ALLOW_C_FUNCTION(::free, ::free(demangled_name));
}
}
} else {
Expand Down Expand Up @@ -1082,7 +1081,7 @@ void* Aix_dlopen(const char* filename, int Flags, int *eno, const char** error_r
if (g_handletable_used == max_handletable) {
// No place in array anymore; increase array.
unsigned new_max = MAX2(max_handletable * 2, init_num_handles);
struct handletableentry* new_tab = (struct handletableentry*) permit_forbidden_function::realloc(p_handletable, new_max * sizeof(struct handletableentry));
struct handletableentry* new_tab = (struct handletableentry*)::realloc(p_handletable, new_max * sizeof(struct handletableentry));
assert(new_tab != nullptr, "no more memory for handletable");
if (new_tab == nullptr) {
*error_report = "dlopen: no more memory for handletable";
Expand Down
10 changes: 4 additions & 6 deletions src/hotspot/os/bsd/decoder_machO.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2023, 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
Expand Down Expand Up @@ -28,8 +28,6 @@
#include "decoder_machO.hpp"
#include "jvm.h"
#include "memory/allocation.inline.hpp"
#include "utilities/globalDefinitions.hpp"
#include "utilities/permitForbiddenFunctions.hpp"

#include <cxxabi.h>
#include <mach-o/loader.h>
Expand All @@ -45,9 +43,9 @@ bool MachODecoder::demangle(const char* symbol, char *buf, int buflen) {
// may use different malloc/realloc mechanism that allocates 'buf'.
if ((result = abi::__cxa_demangle(symbol, nullptr, nullptr, &status)) != nullptr) {
jio_snprintf(buf, buflen, "%s", result);
// call c library's free
permit_forbidden_function::free(result);
return true;
// call c library's free
::free(result);
return true;
}
return false;
}
Expand Down
9 changes: 4 additions & 5 deletions src/hotspot/os/linux/decoder_linux.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2023, 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
Expand Down Expand Up @@ -27,7 +27,6 @@
#include "utilities/decoder_elf.hpp"
#include "utilities/elfFile.hpp"
#include "utilities/globalDefinitions.hpp"
#include "utilities/permitForbiddenFunctions.hpp"

#include <cxxabi.h>

Expand All @@ -47,9 +46,9 @@ bool ElfDecoder::demangle(const char* symbol, char *buf, int buflen) {
// may use different malloc/realloc mechanism that allocates 'buf'.
if ((result = abi::__cxa_demangle(symbol, nullptr, nullptr, &status)) != nullptr) {
jio_snprintf(buf, buflen, "%s", result);
// call c library's free
permit_forbidden_function::free(result);
return true;
// call c library's free
ALLOW_C_FUNCTION(::free, ::free(result);)
return true;
}
return false;
}
Expand Down
11 changes: 5 additions & 6 deletions src/hotspot/os/linux/gc/z/zMountPoint_linux.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2023, 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
Expand Down Expand Up @@ -29,7 +29,6 @@
#include "runtime/globals.hpp"
#include "runtime/os.hpp"
#include "utilities/globalDefinitions.hpp"
#include "utilities/permitForbiddenFunctions.hpp"

#include <stdio.h>
#include <unistd.h>
Expand Down Expand Up @@ -64,11 +63,11 @@ char* ZMountPoint::get_mountpoint(const char* line, const char* filesystem) cons
strcmp(line_filesystem, filesystem) != 0 ||
access(line_mountpoint, R_OK|W_OK|X_OK) != 0) {
// Not a matching or accessible filesystem
permit_forbidden_function::free(line_mountpoint);
ALLOW_C_FUNCTION(::free, ::free(line_mountpoint);)
line_mountpoint = nullptr;
}

permit_forbidden_function::free(line_filesystem);
ALLOW_C_FUNCTION(::free, ::free(line_filesystem);)

return line_mountpoint;
}
Expand All @@ -92,14 +91,14 @@ void ZMountPoint::get_mountpoints(const char* filesystem, ZArray<char*>* mountpo
}

// readline will return malloced memory. Need raw ::free, not os::free.
permit_forbidden_function::free(line);
ALLOW_C_FUNCTION(::free, ::free(line);)
fclose(fd);
}

void ZMountPoint::free_mountpoints(ZArray<char*>* mountpoints) const {
ZArrayIterator<char*> iter(mountpoints);
for (char* mountpoint; iter.next(&mountpoint);) {
permit_forbidden_function::free(mountpoint); // *not* os::free
ALLOW_C_FUNCTION(::free, ::free(mountpoint);) // *not* os::free
}
mountpoints->clear();
}
Expand Down
11 changes: 5 additions & 6 deletions src/hotspot/os/linux/mallocInfoDcmd.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 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
Expand Down Expand Up @@ -27,7 +27,6 @@
#include "os_linux.hpp"
#include "utilities/globalDefinitions.hpp"
#include "utilities/ostream.hpp"
#include "utilities/permitForbiddenFunctions.hpp"

#include <malloc.h>

Expand All @@ -37,15 +36,15 @@ void MallocInfoDcmd::execute(DCmdSource source, TRAPS) {
#ifdef __GLIBC__
char* buf;
size_t size;
FILE* stream = ::open_memstream(&buf, &size);
ALLOW_C_FUNCTION(::open_memstream, FILE* stream = ::open_memstream(&buf, &size);)
if (stream == nullptr) {
_output->print_cr("Error: Could not call malloc_info(3)");
return;
}

int err = os::Linux::malloc_info(stream);
if (err == 0) {
fflush(stream);
ALLOW_C_FUNCTION(::fflush, fflush(stream);)
_output->print_raw(buf);
_output->cr();
} else if (err == -1) {
Expand All @@ -55,8 +54,8 @@ void MallocInfoDcmd::execute(DCmdSource source, TRAPS) {
} else {
ShouldNotReachHere();
}
::fclose(stream);
permit_forbidden_function::free(buf);
ALLOW_C_FUNCTION(::fclose, ::fclose(stream);)
ALLOW_C_FUNCTION(::free, ::free(buf);)
#else
_output->print_cr(malloc_info_unavailable);
#endif // __GLIBC__
Expand Down
54 changes: 0 additions & 54 deletions src/hotspot/os/posix/forbiddenFunctions_posix.hpp

This file was deleted.

Loading