Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8265101: Remove unnecessary functions in os*.inline.hpp #3475

Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion src/hotspot/cpu/x86/frame_x86.cpp
Expand Up @@ -34,7 +34,6 @@
#include "runtime/handles.inline.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/monitorChunk.hpp"
#include "runtime/os.inline.hpp"
#include "runtime/signature.hpp"
#include "runtime/stackWatermarkSet.hpp"
#include "runtime/stubCodeGenerator.hpp"
Expand Down
3 changes: 1 addition & 2 deletions src/hotspot/cpu/x86/nativeInst_x86.hpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021, 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 "asm/assembler.hpp"
#include "runtime/icache.hpp"
#include "runtime/os.hpp"
#include "runtime/safepointMechanism.hpp"

// We have interfaces for the following instructions:
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/zero/vm_version_ext_zero.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2021, 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 All @@ -24,7 +24,7 @@

#include "memory/allocation.hpp"
#include "memory/allocation.inline.hpp"
#include "runtime/os.inline.hpp"
#include "runtime/os.hpp"
#include "vm_version_ext_zero.hpp"

// VM_Version_Ext statics
Expand Down
60 changes: 60 additions & 0 deletions src/hotspot/os/posix/os_posix.cpp
Expand Up @@ -53,11 +53,13 @@
#include <dirent.h>
#include <dlfcn.h>
#include <grp.h>
#include <netdb.h>
#include <pwd.h>
#include <pthread.h>
#include <signal.h>
#include <sys/mman.h>
#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/utsname.h>
#include <sys/wait.h>
Expand Down Expand Up @@ -631,6 +633,22 @@ bool os::has_allocatable_memory_limit(size_t* limit) {
#endif
}

void os::dll_unload(void *lib) {
::dlclose(lib);
}

jlong os::lseek(int fd, jlong offset, int whence) {
return (jlong) BSD_ONLY(::lseek) NOT_BSD(::lseek64)(fd, offset, whence);
}

int os::fsync(int fd) {
return ::fsync(fd);
}

int os::ftruncate(int fd, jlong length) {
return BSD_ONLY(::ftruncate) NOT_BSD(::ftruncate64)(fd, length);
}

const char* os::get_current_directory(char *buf, size_t buflen) {
return getcwd(buf, buflen);
}
Expand All @@ -639,10 +657,20 @@ FILE* os::open(int fd, const char* mode) {
return ::fdopen(fd, mode);
}

size_t os::write(int fd, const void *buf, unsigned int nBytes) {
size_t res;
RESTARTABLE((size_t) ::write(fd, buf, (size_t) nBytes), res);
return res;
}

ssize_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
return ::pread(fd, buf, nBytes, offset);
}

int os::close(int fd) {
return ::close(fd);
}

void os::flockfile(FILE* fp) {
::flockfile(fp);
}
Expand All @@ -666,6 +694,38 @@ int os::closedir(DIR *dirp) {
return ::closedir(dirp);
}

int os::socket_close(int fd) {
return ::close(fd);
}

int os::socket(int domain, int type, int protocol) {
return ::socket(domain, type, protocol);
}

int os::recv(int fd, char* buf, size_t nBytes, uint flags) {
RESTARTABLE_RETURN_INT(::recv(fd, buf, nBytes, flags));
}

int os::send(int fd, char* buf, size_t nBytes, uint flags) {
RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, flags));
}

int os::raw_send(int fd, char* buf, size_t nBytes, uint flags) {
return os::send(fd, buf, nBytes, flags);
}

int os::connect(int fd, struct sockaddr* him, socklen_t len) {
RESTARTABLE_RETURN_INT(::connect(fd, him, len));
}

struct hostent* os::get_host_by_name(char* name) {
return ::gethostbyname(name);
}

void os::exit(int num) {
::exit(num);
}

// Builds a platform dependent Agent_OnLoad_<lib_name> function name
// which is used to find statically linked in agents.
// Parameters:
Expand Down
2 changes: 0 additions & 2 deletions src/hotspot/os/posix/os_posix.hpp
Expand Up @@ -22,8 +22,6 @@
*
*/

#include "runtime/os.hpp"

#ifndef OS_POSIX_OS_POSIX_HPP
#define OS_POSIX_OS_POSIX_HPP

Expand Down
59 changes: 0 additions & 59 deletions src/hotspot/os/posix/os_posix.inline.hpp
Expand Up @@ -43,69 +43,10 @@
return _result; \
} while(false)


inline void os::dll_unload(void *lib) {
::dlclose(lib);
}

inline jlong os::lseek(int fd, jlong offset, int whence) {
return (jlong) BSD_ONLY(::lseek) NOT_BSD(::lseek64)(fd, offset, whence);
}

inline int os::fsync(int fd) {
return ::fsync(fd);
}

inline int os::ftruncate(int fd, jlong length) {
return BSD_ONLY(::ftruncate) NOT_BSD(::ftruncate64)(fd, length);
}

// Aix does not have NUMA support but need these for compilation.
inline bool os::numa_has_static_binding() { AIX_ONLY(ShouldNotReachHere();) return true; }
inline bool os::numa_has_group_homing() { AIX_ONLY(ShouldNotReachHere();) return false; }

inline size_t os::write(int fd, const void *buf, unsigned int nBytes) {
size_t res;
RESTARTABLE((size_t) ::write(fd, buf, (size_t) nBytes), res);
return res;
}

inline int os::close(int fd) {
return ::close(fd);
}

inline int os::socket_close(int fd) {
return ::close(fd);
}

inline int os::socket(int domain, int type, int protocol) {
return ::socket(domain, type, protocol);
}

inline int os::recv(int fd, char* buf, size_t nBytes, uint flags) {
RESTARTABLE_RETURN_INT(::recv(fd, buf, nBytes, flags));
}

inline int os::send(int fd, char* buf, size_t nBytes, uint flags) {
RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, flags));
}

inline int os::raw_send(int fd, char* buf, size_t nBytes, uint flags) {
return os::send(fd, buf, nBytes, flags);
}

inline int os::connect(int fd, struct sockaddr* him, socklen_t len) {
RESTARTABLE_RETURN_INT(::connect(fd, him, len));
}

inline struct hostent* os::get_host_by_name(char* name) {
return ::gethostbyname(name);
}

inline void os::exit(int num) {
::exit(num);
}

// Platform Mutex/Monitor implementation

inline void os::PlatformMutex::lock() {
Expand Down
22 changes: 22 additions & 0 deletions src/hotspot/os/windows/os_windows.cpp
Expand Up @@ -1200,6 +1200,16 @@ void os::die() {
win32::exit_process_or_thread(win32::EPT_PROCESS_DIE, -1);
}

const char* os::dll_file_extension() { return ".dll"; }

void os::dll_unload(void *lib) {
::FreeLibrary((HMODULE)lib);
}

void* os::dll_lookup(void *lib, const char *name) {
return (void*)::GetProcAddress((HMODULE)lib, name);
}

// Directory routines copied from src/win32/native/java/io/dirent_md.c
// * dirent_md.c 1.15 00/02/02
//
Expand Down Expand Up @@ -4653,6 +4663,18 @@ FILE* os::open(int fd, const char* mode) {
return ::_fdopen(fd, mode);
}

size_t os::write(int fd, const void *buf, unsigned int nBytes) {
return ::write(fd, buf, nBytes);
}

int os::close(int fd) {
return ::close(fd);
}

void os::exit(int num) {
win32::exit_process_or_thread(win32::EPT_PROCESS, num);
}

// Is a (classpath) directory empty?
bool os::dir_is_empty(const char* path) {
errno_t err;
Expand Down
22 changes: 0 additions & 22 deletions src/hotspot/os/windows/os_windows.inline.hpp
Expand Up @@ -28,16 +28,6 @@
#include "runtime/os.hpp"
#include "runtime/thread.hpp"

inline const char* os::dll_file_extension() { return ".dll"; }

inline void os::dll_unload(void *lib) {
::FreeLibrary((HMODULE)lib);
}

inline void* os::dll_lookup(void *lib, const char *name) {
return (void*)::GetProcAddress((HMODULE)lib, name);
}

inline bool os::uses_stack_guard_pages() {
return true;
}
Expand All @@ -63,18 +53,6 @@ inline void os::map_stack_shadow_pages(address sp) {
inline bool os::numa_has_static_binding() { return true; }
inline bool os::numa_has_group_homing() { return false; }

inline size_t os::write(int fd, const void *buf, unsigned int nBytes) {
return ::write(fd, buf, nBytes);
}

inline int os::close(int fd) {
return ::close(fd);
}

inline void os::exit(int num) {
win32::exit_process_or_thread(win32::EPT_PROCESS, num);
}

// Platform Mutex/Monitor implementation

inline os::PlatformMutex::PlatformMutex() {
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/classfile/classLoader.cpp
Expand Up @@ -65,7 +65,7 @@
#include "runtime/interfaceSupport.inline.hpp"
#include "runtime/java.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/os.inline.hpp"
#include "runtime/os.hpp"
#include "runtime/perfData.hpp"
#include "runtime/threadCritical.hpp"
#include "runtime/timer.hpp"
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/compiler/directivesParser.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2021, 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,7 @@
#include "compiler/directivesParser.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/resourceArea.hpp"
#include "runtime/os.inline.hpp"
#include "runtime/os.hpp"
#include <string.h>

void DirectivesParser::push_tmp(CompilerDirectives* dir) {
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/compiler/disassembler.cpp
Expand Up @@ -36,7 +36,7 @@
#include "memory/universe.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/os.inline.hpp"
#include "runtime/os.hpp"
#include "runtime/stubCodeGenerator.hpp"
#include "runtime/stubRoutines.hpp"
#include "utilities/resourceHash.hpp"
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2021, 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,7 @@
#include "oops/markWord.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/atomic.hpp"
#include "runtime/os.inline.hpp"
#include "runtime/os.hpp"
#include "services/memTracker.hpp"
#include "utilities/align.hpp"
#include "utilities/bitMap.inline.hpp"
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/gc/parallel/mutableNUMASpace.cpp
Expand Up @@ -33,6 +33,7 @@
#include "oops/typeArrayOop.hpp"
#include "runtime/atomic.hpp"
#include "runtime/java.hpp"
#include "runtime/os.inline.hpp"
#include "runtime/thread.inline.hpp"
#include "runtime/threadSMR.hpp"
#include "utilities/align.hpp"
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/gc/shared/gcInitLogger.cpp
Expand Up @@ -29,6 +29,7 @@
#include "logging/log.hpp"
#include "oops/compressedOops.hpp"
#include "runtime/globals.hpp"
#include "runtime/os.hpp"
#include "runtime/vm_version.hpp"
#include "utilities/globalDefinitions.hpp"

Expand Down
3 changes: 2 additions & 1 deletion src/hotspot/share/gc/shared/gcTraceTime.inline.hpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2021, 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,6 +28,7 @@
#include "gc/shared/gcTimer.hpp"
#include "gc/shared/gcTraceTime.hpp"
#include "logging/log.hpp"
#include "runtime/os.hpp"
#include "utilities/ticks.hpp"

inline GCTraceTimeDriver::GCTraceTimeDriver(
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/shared/workerPolicy.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2021, 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,7 +28,7 @@
#include "logging/log.hpp"
#include "memory/universe.hpp"
#include "runtime/globals_extension.hpp"
#include "runtime/os.inline.hpp"
#include "runtime/os.hpp"
#include "runtime/vm_version.hpp"

uint WorkerPolicy::_parallel_worker_threads = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/z/zErrno.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2021, 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 All @@ -23,7 +23,7 @@

#include "precompiled.hpp"
#include "gc/z/zErrno.hpp"
#include "runtime/os.inline.hpp"
#include "runtime/os.hpp"

#include <errno.h>
#include <string.h>
Expand Down