8232211: Remove dead code from os.hpp|cpp

Reviewed-by: dholmes, dcubed, rehn
This commit is contained in:
Claes Redestad 2019-10-17 00:00:13 +02:00
parent 31afddccae
commit 638fe2b833
17 changed files with 2 additions and 316 deletions

@ -1034,8 +1034,6 @@ jlong os::elapsed_frequency() {
}
bool os::supports_vtime() { return true; }
bool os::enable_vtime() { return false; }
bool os::vtime_enabled() { return false; }
double os::elapsedVTime() {
struct rusage usage;
@ -3625,11 +3623,6 @@ void os::set_native_thread_name(const char *name) {
return;
}
bool os::distribute_processes(uint length, uint* distribution) {
// Not yet implemented.
return false;
}
bool os::bind_to_processor(uint processor_id) {
// Not yet implemented.
return false;

@ -44,7 +44,6 @@ class Aix {
static julong _physical_memory;
static pthread_t _main_thread;
static Mutex* _createThread_lock;
static int _page_size;
// -1 = uninitialized, 0 = AIX, 1 = OS/400 (PASE)
@ -90,8 +89,6 @@ class Aix {
public:
static void init_thread_fpu_state();
static pthread_t main_thread(void) { return _main_thread; }
static void set_createThread_lock(Mutex* lk) { _createThread_lock = lk; }
static Mutex* createThread_lock(void) { return _createThread_lock; }
static void hotspot_sigmask(Thread* thread);
// Given an address, returns the size of the page backing that address

@ -64,8 +64,6 @@ inline void os::dll_unload(void *lib) {
::dlclose(lib);
}
inline const int os::default_file_open_flags() { return 0;}
inline jlong os::lseek(int fd, jlong offset, int whence) {
return (jlong) ::lseek64(fd, offset, whence);
}

@ -877,8 +877,6 @@ jlong os::elapsed_frequency() {
}
bool os::supports_vtime() { return true; }
bool os::enable_vtime() { return false; }
bool os::vtime_enabled() { return false; }
double os::elapsedVTime() {
// better than nothing, but not much
@ -3282,11 +3280,6 @@ void os::set_native_thread_name(const char *name) {
#endif
}
bool os::distribute_processes(uint length, uint* distribution) {
// Not yet implemented.
return false;
}
bool os::bind_to_processor(uint processor_id) {
// Not yet implemented.
return false;

@ -67,8 +67,6 @@ inline void os::dll_unload(void *lib) {
::dlclose(lib);
}
inline const int os::default_file_open_flags() { return 0;}
inline jlong os::lseek(int fd, jlong offset, int whence) {
return (jlong) ::lseek(fd, offset, whence);
}

@ -148,11 +148,9 @@ uintptr_t os::Linux::_initial_thread_stack_size = 0;
int (*os::Linux::_pthread_getcpuclockid)(pthread_t, clockid_t *) = NULL;
int (*os::Linux::_pthread_setname_np)(pthread_t, const char*) = NULL;
Mutex* os::Linux::_createThread_lock = NULL;
pthread_t os::Linux::_main_thread;
int os::Linux::_page_size = -1;
bool os::Linux::_supports_fast_thread_cpu_time = false;
uint32_t os::Linux::_os_version = 0;
const char * os::Linux::_glibc_version = NULL;
const char * os::Linux::_libpthread_version = NULL;
@ -1364,8 +1362,6 @@ jlong os::elapsed_frequency() {
}
bool os::supports_vtime() { return true; }
bool os::enable_vtime() { return false; }
bool os::vtime_enabled() { return false; }
double os::elapsedVTime() {
struct rusage usage;
@ -4823,48 +4819,6 @@ jlong os::Linux::fast_thread_cpu_time(clockid_t clockid) {
return (tp.tv_sec * NANOSECS_PER_SEC) + tp.tv_nsec;
}
void os::Linux::initialize_os_info() {
assert(_os_version == 0, "OS info already initialized");
struct utsname _uname;
uint32_t major;
uint32_t minor;
uint32_t fix;
int rc;
// Kernel version is unknown if
// verification below fails.
_os_version = 0x01000000;
rc = uname(&_uname);
if (rc != -1) {
rc = sscanf(_uname.release,"%d.%d.%d", &major, &minor, &fix);
if (rc == 3) {
if (major < 256 && minor < 256 && fix < 256) {
// Kernel version format is as expected,
// set it overriding unknown state.
_os_version = (major << 16) |
(minor << 8 ) |
(fix << 0 ) ;
}
}
}
}
uint32_t os::Linux::os_version() {
assert(_os_version != 0, "not initialized");
return _os_version & 0x00FFFFFF;
}
bool os::Linux::os_version_is_known() {
assert(_os_version != 0, "not initialized");
return _os_version & 0x01000000 ? false : true;
}
/////
// glibc on Linux platform uses non-documented flag
// to indicate, that some special sort of signal
@ -5084,8 +5038,6 @@ void os::init(void) {
Linux::initialize_system_info();
Linux::initialize_os_info();
os::Linux::CPUPerfTicks pticks;
bool res = os::Linux::get_tick_information(&pticks, -1);
@ -5262,9 +5214,6 @@ jint os::init_2(void) {
}
}
// Initialize lock used to serialize thread creation (see os::create_thread)
Linux::set_createThread_lock(new Mutex(Mutex::leaf, "createThread_lock", false));
// at-exit methods are called in the reverse order of their registration.
// atexit functions are called on return from main or as a result of a
// call to exit(3C). There can be only 32 of these functions registered
@ -5465,11 +5414,6 @@ void os::set_native_thread_name(const char *name) {
}
}
bool os::distribute_processes(uint length, uint* distribution) {
// Not yet implemented.
return false;
}
bool os::bind_to_processor(uint processor_id) {
// Not yet implemented.
return false;

@ -55,20 +55,10 @@ class Linux {
static GrowableArray<int>* _cpu_to_node;
static GrowableArray<int>* _nindex_to_node;
// 0x00000000 = uninitialized,
// 0x01000000 = kernel version unknown,
// otherwise a 32-bit number:
// Ox00AABBCC
// AA, Major Version
// BB, Minor Version
// CC, Fix Version
static uint32_t _os_version;
protected:
static julong _physical_memory;
static pthread_t _main_thread;
static Mutex* _createThread_lock;
static int _page_size;
static julong available_memory();
@ -136,8 +126,6 @@ class Linux {
// returns kernel thread id (similar to LWP id on Solaris), which can be
// used to access /proc
static pid_t gettid();
static void set_createThread_lock(Mutex* lk) { _createThread_lock = lk; }
static Mutex* createThread_lock(void) { return _createThread_lock; }
static void hotspot_sigmask(Thread* thread);
static address initial_thread_stack_bottom(void) { return _initial_thread_stack_bottom; }
@ -196,7 +184,6 @@ class Linux {
// Stack overflow handling
static bool manually_expand_stack(JavaThread * t, address addr);
static int max_register_window_saves_before_flushing();
// fast POSIX clocks support
static void fast_thread_clock_init(void);
@ -211,10 +198,6 @@ class Linux {
static jlong fast_thread_cpu_time(clockid_t clockid);
static void initialize_os_info();
static bool os_version_is_known();
static uint32_t os_version();
// Stack repair handling
// none present

@ -59,8 +59,6 @@ inline void os::dll_unload(void *lib) {
::dlclose(lib);
}
inline const int os::default_file_open_flags() { return 0;}
inline jlong os::lseek(int fd, jlong offset, int whence) {
return (jlong) ::lseek64(fd, offset, whence);
}

@ -167,11 +167,6 @@ size_t os::lasterror(char *buf, size_t len) {
return n;
}
bool os::is_debugger_attached() {
// not implemented
return false;
}
void os::wait_for_keypress_at_exit(void) {
// don't do anything on posix platforms
return;

@ -265,8 +265,6 @@ void os::Solaris::try_enable_extended_io() {
}
}
static int _processors_online = 0;
jint os::Solaris::_os_thread_limit = 0;
volatile jint os::Solaris::_os_thread_count = 0;
@ -291,7 +289,6 @@ static volatile hrtime_t max_hrtime = 0;
void os::Solaris::initialize_system_info() {
set_processor_count(sysconf(_SC_NPROCESSORS_CONF));
_processors_online = sysconf(_SC_NPROCESSORS_ONLN);
_physical_memory = (julong)sysconf(_SC_PHYS_PAGES) *
(julong)sysconf(_SC_PAGESIZE);
}
@ -320,7 +317,6 @@ int os::active_processor_count() {
// Query the number of cpus available to us.
if (pset_info(pset, NULL, &pset_cpus, NULL) == 0) {
assert(pset_cpus > 0 && pset_cpus <= online_cpus, "sanity check");
_processors_online = pset_cpus;
return pset_cpus;
}
}
@ -328,136 +324,6 @@ int os::active_processor_count() {
return online_cpus;
}
static bool find_processors_in_pset(psetid_t pset,
processorid_t** id_array,
uint_t* id_length) {
bool result = false;
// Find the number of processors in the processor set.
if (pset_info(pset, NULL, id_length, NULL) == 0) {
// Make up an array to hold their ids.
*id_array = NEW_C_HEAP_ARRAY(processorid_t, *id_length, mtInternal);
// Fill in the array with their processor ids.
if (pset_info(pset, NULL, id_length, *id_array) == 0) {
result = true;
}
}
return result;
}
// Callers of find_processors_online() must tolerate imprecise results --
// the system configuration can change asynchronously because of DR
// or explicit psradm operations.
//
// We also need to take care that the loop (below) terminates as the
// number of processors online can change between the _SC_NPROCESSORS_ONLN
// request and the loop that builds the list of processor ids. Unfortunately
// there's no reliable way to determine the maximum valid processor id,
// so we use a manifest constant, MAX_PROCESSOR_ID, instead. See p_online
// man pages, which claim the processor id set is "sparse, but
// not too sparse". MAX_PROCESSOR_ID is used to ensure that we eventually
// exit the loop.
//
// In the future we'll be able to use sysconf(_SC_CPUID_MAX), but that's
// not available on S8.0.
static bool find_processors_online(processorid_t** id_array,
uint* id_length) {
const processorid_t MAX_PROCESSOR_ID = 100000;
// Find the number of processors online.
*id_length = sysconf(_SC_NPROCESSORS_ONLN);
// Make up an array to hold their ids.
*id_array = NEW_C_HEAP_ARRAY(processorid_t, *id_length, mtInternal);
// Processors need not be numbered consecutively.
long found = 0;
processorid_t next = 0;
while (found < *id_length && next < MAX_PROCESSOR_ID) {
processor_info_t info;
if (processor_info(next, &info) == 0) {
// NB, PI_NOINTR processors are effectively online ...
if (info.pi_state == P_ONLINE || info.pi_state == P_NOINTR) {
(*id_array)[found] = next;
found += 1;
}
}
next += 1;
}
if (found < *id_length) {
// The loop above didn't identify the expected number of processors.
// We could always retry the operation, calling sysconf(_SC_NPROCESSORS_ONLN)
// and re-running the loop, above, but there's no guarantee of progress
// if the system configuration is in flux. Instead, we just return what
// we've got. Note that in the worst case find_processors_online() could
// return an empty set. (As a fall-back in the case of the empty set we
// could just return the ID of the current processor).
*id_length = found;
}
return true;
}
static bool assign_distribution(processorid_t* id_array,
uint id_length,
uint* distribution,
uint distribution_length) {
// We assume we can assign processorid_t's to uint's.
assert(sizeof(processorid_t) == sizeof(uint),
"can't convert processorid_t to uint");
// Quick check to see if we won't succeed.
if (id_length < distribution_length) {
return false;
}
// Assign processor ids to the distribution.
// Try to shuffle processors to distribute work across boards,
// assuming 4 processors per board.
const uint processors_per_board = ProcessDistributionStride;
// Find the maximum processor id.
processorid_t max_id = 0;
for (uint m = 0; m < id_length; m += 1) {
max_id = MAX2(max_id, id_array[m]);
}
// The next id, to limit loops.
const processorid_t limit_id = max_id + 1;
// Make up markers for available processors.
bool* available_id = NEW_C_HEAP_ARRAY(bool, limit_id, mtInternal);
for (uint c = 0; c < limit_id; c += 1) {
available_id[c] = false;
}
for (uint a = 0; a < id_length; a += 1) {
available_id[id_array[a]] = true;
}
// Step by "boards", then by "slot", copying to "assigned".
// NEEDS_CLEANUP: The assignment of processors should be stateful,
// remembering which processors have been assigned by
// previous calls, etc., so as to distribute several
// independent calls of this method. What we'd like is
// It would be nice to have an API that let us ask
// how many processes are bound to a processor,
// but we don't have that, either.
// In the short term, "board" is static so that
// subsequent distributions don't all start at board 0.
static uint board = 0;
uint assigned = 0;
// Until we've found enough processors ....
while (assigned < distribution_length) {
// ... find the next available processor in the board.
for (uint slot = 0; slot < processors_per_board; slot += 1) {
uint try_id = board * processors_per_board + slot;
if ((try_id < limit_id) && (available_id[try_id] == true)) {
distribution[assigned] = try_id;
available_id[try_id] = false;
assigned += 1;
break;
}
}
board += 1;
if (board * processors_per_board + 0 >= limit_id) {
board = 0;
}
}
FREE_C_HEAP_ARRAY(bool, available_id);
return true;
}
void os::set_native_thread_name(const char *name) {
if (Solaris::_pthread_setname_np != NULL) {
// Only the first 31 bytes of 'name' are processed by pthread_setname_np
@ -470,31 +336,6 @@ void os::set_native_thread_name(const char *name) {
}
}
bool os::distribute_processes(uint length, uint* distribution) {
bool result = false;
// Find the processor id's of all the available CPUs.
processorid_t* id_array = NULL;
uint id_length = 0;
// There are some races between querying information and using it,
// since processor sets can change dynamically.
psetid_t pset = PS_NONE;
// Are we running in a processor set?
if ((pset_bind(PS_QUERY, P_PID, P_MYID, &pset) == 0) && pset != PS_NONE) {
result = find_processors_in_pset(pset, &id_array, &id_length);
} else {
result = find_processors_online(&id_array, &id_length);
}
if (result == true) {
if (id_length >= length) {
result = assign_distribution(id_array, id_length, distribution, length);
} else {
result = false;
}
}
FREE_C_HEAP_ARRAY(processorid_t, id_array);
return result;
}
bool os::bind_to_processor(uint processor_id) {
// We assume that a processorid_t can be stored in a uint.
assert(sizeof(uint) == sizeof(processorid_t),
@ -1237,8 +1078,6 @@ bool os::getTimesSecs(double* process_real_time,
}
bool os::supports_vtime() { return true; }
bool os::enable_vtime() { return false; }
bool os::vtime_enabled() { return false; }
double os::elapsedVTime() {
return (double)gethrvtime() / (double)hrtime_hz;

@ -271,10 +271,6 @@ class Solaris {
static void correct_stack_boundaries_for_primordial_thread(Thread* thr);
// Stack overflow handling
static int max_register_window_saves_before_flushing();
// Stack repair handling
// none present

@ -61,8 +61,6 @@ inline void os::map_stack_shadow_pages(address sp) {
inline void os::dll_unload(void *lib) { ::dlclose(lib); }
inline const int os::default_file_open_flags() { return 0;}
//////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

@ -826,11 +826,6 @@ void os::set_native_thread_name(const char *name) {
} __except(EXCEPTION_EXECUTE_HANDLER) {}
}
bool os::distribute_processes(uint length, uint* distribution) {
// Not yet implemented.
return false;
}
bool os::bind_to_processor(uint processor_id) {
// Not yet implemented.
return false;
@ -911,8 +906,6 @@ FILETIME java_to_windows_time(jlong l) {
}
bool os::supports_vtime() { return true; }
bool os::enable_vtime() { return false; }
bool os::vtime_enabled() { return false; }
double os::elapsedVTime() {
FILETIME created;
@ -3904,12 +3897,6 @@ void os::win32::setmode_streams() {
_setmode(_fileno(stderr), _O_BINARY);
}
bool os::is_debugger_attached() {
return IsDebuggerPresent() ? true : false;
}
void os::wait_for_keypress_at_exit(void) {
if (PauseAtExit) {
fprintf(stderr, "Press any key to continue...\n");

@ -30,8 +30,6 @@
inline const char* os::dll_file_extension() { return ".dll"; }
inline const int os::default_file_open_flags() { return O_BINARY | O_NOINHERIT;}
inline void os::dll_unload(void *lib) {
::FreeLibrary((HMODULE)lib);
}

@ -86,12 +86,6 @@ size_t os::Posix::_compiler_thread_min_stack_allowed = 104 * K;
size_t os::Posix::_java_thread_min_stack_allowed = 86 * K;
size_t os::Posix::_vm_internal_thread_min_stack_allowed = 128 * K;
int os::Solaris::max_register_window_saves_before_flushing() {
// We should detect this at run time. For now, filling
// in with a constant.
return 8;
}
static void handle_unflushed_register_windows(gwindows_t *win) {
int restore_count = win->wbcnt;
int i;

@ -1630,7 +1630,6 @@ jint G1CollectedHeap::initialize_young_gen_sampling_thread() {
}
jint G1CollectedHeap::initialize() {
os::enable_vtime();
// Necessary to satisfy locking discipline assertions.

@ -47,8 +47,6 @@ class frame;
// OS services (time, I/O) as well as other functionality with system-
// dependent code.
typedef void (*dll_func)(...);
class Thread;
class JavaThread;
class NativeCallStack;
@ -195,14 +193,9 @@ class os: AllStatic {
// The "virtual time" of a thread is the amount of time a thread has
// actually run. The first function indicates whether the OS supports
// this functionality for the current thread, and if so:
// * the second enables vtime tracking (if that is required).
// * the third tells whether vtime is enabled.
// * the fourth returns the elapsed virtual time for the current
// thread.
// this functionality for the current thread, and if so the second
// returns the elapsed virtual time for the current thread.
static bool supports_vtime();
static bool enable_vtime();
static bool vtime_enabled();
static double elapsedVTime();
// Return current local time in a string (YYYY-MM-DD HH:MM:SS).
@ -254,14 +247,6 @@ class os: AllStatic {
return _initial_active_processor_count;
}
// Bind processes to processors.
// This is a two step procedure:
// first you generate a distribution of processes to processors,
// then you bind processes according to that distribution.
// Compute a distribution for number of processes to processors.
// Stores the processor id's into the distribution array argument.
// Returns true if it worked, false if it didn't.
static bool distribute_processes(uint length, uint* distribution);
// Binds the current process to a processor.
// Returns true if it worked, false if it didn't.
static bool bind_to_processor(uint processor_id);
@ -496,7 +481,6 @@ class os: AllStatic {
static void verify_stack_alignment() PRODUCT_RETURN;
static bool message_box(const char* title, const char* message);
static char* do_you_want_to_debug(const char* message);
// run cmd in a separate process and return its exit code; or -1 on failures
static int fork_and_exec(char *cmd, bool use_vfork_if_available = false);
@ -520,7 +504,6 @@ class os: AllStatic {
static void die();
// File i/o operations
static const int default_file_open_flags();
static int open(const char *path, int oflag, int mode);
static FILE* open(int fd, const char* mode);
static FILE* fopen(const char* path, const char* mode);
@ -668,9 +651,6 @@ class os: AllStatic {
// Will not change the value of errno.
static const char* errno_name(int e);
// Determines whether the calling process is being debugged by a user-mode debugger.
static bool is_debugger_attached();
// wait for a key press if PauseAtExit is set
static void wait_for_keypress_at_exit(void);
@ -966,10 +946,6 @@ class os: AllStatic {
return _state == SR_RUNNING;
}
bool is_suspend_request() const {
return _state == SR_SUSPEND_REQUEST;
}
bool is_suspended() const {
return _state == SR_SUSPENDED;
}