Skip to content
Permalink
Browse files
8265101: Remove unnecessary functions in os*.inline.hpp
Reviewed-by: dholmes, kbarrett
  • Loading branch information
iklam committed Apr 22, 2021
1 parent 28c35ae commit 33b6378f1e8f999a7cd06c53a0c8dd72bf91872b
Showing 58 changed files with 159 additions and 148 deletions.
@@ -35,7 +35,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"
@@ -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
@@ -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:
@@ -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
@@ -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
@@ -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>
@@ -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);
}
@@ -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);
}
@@ -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:
@@ -22,8 +22,6 @@
*
*/

#include "runtime/os.hpp"

#ifndef OS_POSIX_OS_POSIX_HPP
#define OS_POSIX_OS_POSIX_HPP

@@ -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() {
@@ -1190,6 +1190,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
//
@@ -4643,6 +4653,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;
@@ -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;
}
@@ -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() {
@@ -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"
@@ -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
@@ -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) {
@@ -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"
@@ -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
@@ -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"
@@ -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"
@@ -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"

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

1 comment on commit 33b6378

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 33b6378 Apr 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.