4552N/A * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A// os defines the interface to operating system; this includes traditional 0N/A// OS services (time, I/O) as well as other functionality with system- 0N/A// Platform-independent error return values from OS functions 0N/A // ensures that VMThread doesn't starve profiler 4552N/A// Executable parameter flag for os::commit_memory() and 4552N/A// os::commit_memory_or_exit(). 0N/A// Typedef for structured exception handling support 4552N/A // Same as pd_commit_memory() that either succeeds or calls 4552N/A // vm_exit_out_of_memory() with the specified mesg. 1601N/A static void init(
void);
// Called before command line parsing 1601N/A static void init_3(
void);
// Called at the end of vm init 0N/A // File names are case-insensitive on windows only 0N/A // Override me as needed 0N/A // Returns the elapsed time in seconds since the vm started. 0N/A // Returns real time in seconds since an arbitrary point 0N/A // Interface to the performance counter 342N/A // The "virtual time" of a thread is the amount of time a thread has 342N/A // actually run. The first function indicates whether the OS supports 342N/A // this functionality for the current thread, and if so: 342N/A // * the second enables vtime tracking (if that is required). 342N/A // * the third tells whether vtime is enabled. 342N/A // * the fourth returns the elapsed virtual time for the current 0N/A // Return current local time in a string (YYYY-MM-DD HH:MM:SS). 0N/A // It is MT safe, but not async-safe, as reading time zone 0N/A // information may require a lock on some platforms. 0N/A // Fill in buffer with current local time as an ISO-8601 string. 0N/A // E.g., YYYY-MM-DDThh:mm:ss.mmm+zzzz. 0N/A // Returns buffer, or NULL if it failed. 0N/A // Interface for detecting multiprocessor system 0N/A // Returns the number of CPUs this process is currently allowed to run on. 0N/A // Note that on some OSes this can change dynamically. 0N/A // Bind processes to processors. 0N/A // This is a two step procedure: 0N/A // first you generate a distribution of processes to processors, 0N/A // then you bind processes according to that distribution. 0N/A // Compute a distribution for number of processes to processors. 0N/A // Stores the processor id's into the distribution array argument. 0N/A // Returns true if it worked, false if it didn't. 0N/A // Binds the current process to a processor. 0N/A // Returns true if it worked, false if it didn't. 2842N/A // Give a name to the current thread. 0N/A // Interface for stack banging (predetect possible stack overflow for 0N/A // exception processing) There are guard pages, and above that shadow 0N/A // pages for stack overflow checking. 0N/A // OS interface to Virtual Memory 0N/A // Return the default page size. 0N/A // Return the page size to use for a region of memory. The min_pages argument 0N/A // is a hint intended to limit fragmentation; it says the returned page size 0N/A // should be <= region_max_size / min_pages. Because min_pages is a hint, 0N/A // this routine may return a size larger than region_max_size / min_pages. 0N/A // The current implementation ignores min_pages if a larger page size is an 0N/A // exact multiple of both region_min_size and region_max_size. This allows 0N/A // larger pages to be used when doing so would not cause fragmentation; in 0N/A // particular, a single page can be used when region_min_size == 0N/A // region_max_size == a supported page size. 2684N/A // Methods for tracing page sizes returned by the above method; enabled by 0N/A // TracePageSizes. The region_{min,max}_size parameters should be the values 0N/A // passed to page_size_for_region() and page_size should be the result of that 0N/A // call. The (optional) base and size parameters should come from the 0N/A // ReservedSpace base() and size() methods. 4552N/A // Same as commit_memory() that either succeeds or calls 4552N/A // vm_exit_out_of_memory() with the specified mesg. 0N/A // NUMA-specific interface 0N/A // Page manipulation 0N/A // reserve, commit and pin the entire memory region 0N/A // OS interface to polling page 0N/A // Routines used to serialize the thread state without using membars 0N/A // Since we write to the serialize page from every thread, we 0N/A // want stores to be on unique cache lines whenever possible 0N/A // in order to minimize CPU cross talk. We pre-compute the 0N/A // amount to shift the thread* to make this offset unique to 1078N/A // Previously this function calculated the exact address of this 1078N/A // thread's serialize page, and checked if the faulting address 1078N/A // was equal. However, some platforms mask off faulting addresses 1078N/A // to the page size, so now we just check that the address is 1078N/A // within the page. This makes the thread argument unnecessary, 1078N/A // but we retain the NULL check to preserve existing behaviour. 0N/A // thread id on Linux/64bit is 64bit, on Windows and Solaris, it's 32bit 0N/A static void yield();
// Yields to all threads with same priority 0N/A // platform-specific yield return immediately 0N/A // YIELD_SWITCHED and YIELD_NONREADY imply the platform supports a "strong" 0N/A // yield that can be used in lieu of blocking. 0N/A // run cmd in a separate process and return its exit code; or -1 on failures 0N/A // Set file to send error reports. 0N/A // os::exit() is merged with vm_exit() 0N/A // static void exit(int num); 0N/A // Terminate the VM, but don't exit the process 0N/A // Terminate with an error. Default is to generate a core file on platforms 0N/A // that support such things. This calls shutdown() and then aborts. 0N/A // Die immediately, no exit hook, no abort hook, no cleanup. 0N/A // Reading directories. 0N/A // Dynamic library extension 242N/A // Builds a platform-specific full library path given a ld path and lib name 0N/A // Symbol lookup, find nearest function name; basically it implements 0N/A // dladdr() for all platforms. Name of the nearest function is copied 0N/A // to buf. Distance from its base address is returned as offset. 0N/A // If function name is not found, buf[0] is set to '\0' and offset is 0N/A // Locate DLL/DSO. On success, full path of the library is copied to 0N/A // buf, and offset is set to be the distance between addr and the 0N/A // library's base address. On failure, buf[0] is set to '\0' and 0N/A // offset is set to -1. 0N/A // Loads .dll/.so and 0N/A // in case of error it checks if .dll/.so was built for the 0N/A // same architecture as Hotspot is running on 242N/A // lookup symbol in a shared library 0N/A // Print out system information; they are called by fatal error handler. 0N/A // Output format may be different on different platforms. 2149N/A // Determines whether the calling process is being debugged by a user-mode debugger. 2149N/A // wait for a key press if PauseAtExit is set 0N/A // The following two functions are used by fatal error handler to trace 0N/A // OS/compiler may have different convention or provide different API to 0N/A // We don't attempt to become a debugger, so we only follow frames if that 0N/A // does not require a lookup in the unwind table, which is part of the binary 0N/A // file but may be unsafe to read after a fatal error. So on x86, we can 0N/A // only walk stack if %ebp is used as frame pointer; on ia64, it's not 0N/A // possible to walk C stack without having the unwind table. 0N/A // return current frame. pc() and sp() are set to NULL on failure. 0N/A // Returns native Java library, loads if necessary 1601N/A // Returns true if we are running in a headless jre. 0N/A // Init os specific system properties values 0N/A // IO operations, non-JVM_ version. 0N/A // IO operations on binary files 0N/A // Thread Local Storage 0N/A // General allocation (must be MT-safe) 1887N/A // SocketInterface (ex HPI SocketInterface ) 0N/A // Printing 64 bit integers 0N/A // Support for signals (see JVM_RaiseSignal, JVM_RegisterSignal) 0N/A // random number generation 0N/A static long random();
// return 32bit pseudorandom number 0N/A // Structured OS Exception support 2085N/A // On Windows this will create an actual minidump, on Linux/Solaris it will simply check core dump limits 3866N/A // Get the default path to the core file 3866N/A // Returns the length of the string 0N/A // JVMTI & JVM monitoring and management support 0N/A // The thread_cpu_time() and current_thread_cpu_time() are only 0N/A // supported if is_thread_cpu_time_supported() returns true. 0N/A // They are not supported on Solaris T1. 0N/A // Thread CPU Time - return the fast estimate on a platform 0N/A // On Solaris - call gethrvtime (fast) - user time only 0N/A // On Linux - fast clock_gettime where available - user+sys 0N/A // - otherwise: very slow /proc fs - user+sys 0N/A // On Windows - GetThreadTimes - user+sys 0N/A // Thread CPU Time with user_sys_cpu_time parameter. 0N/A // If user_sys_cpu_time is true, user+sys time is returned. 0N/A // Otherwise, only user time is returned 0N/A // Return a bunch of info about the timers. 0N/A // Note that the returned info for these two functions may be different 0N/A // on some platforms 0N/A // System loadavg support. Returns -1 if load average cannot be obtained. 0N/A // Hook for os specific jvm options that we don't want to abort on seeing 2316N/A // Read file line by line. If line is longer than bsize, 2316N/A // rest of line is skipped. Returns number of bytes read or -1 on EOF 0N/A // Platform dependent stuff 1601N/A // debugging support (mostly used by debug.cpp but also fatal error handler) 0N/A // Thread priority helpers (implemented in OS-specific part) 0N/A // Hint to the underlying OS that a task switch would not be good. 0N/A // Void return because it's a hint and can fail. 0N/A // Used at creation if requested by the diagnostic flag PauseAtStartup. 0N/A // Causes the VM to wait until an external stimulus has been applied 0N/A // (for Unix, that stimulus is a signal, for Windows, an external 0N/A // ResumeThread call) 4141N/A // a thread starts in SR_RUNNING 4141N/A // * SR_SUSPEND_REQUEST when the WatcherThread wants to suspend it 4141N/A // SR_SUSPEND_REQUEST can go to 4141N/A // * SR_RUNNING if WatcherThread decides it waited for SR_SUSPENDED too long (timeout) 4141N/A // * SR_SUSPENDED if the stopped thread receives the signal and switches state 4141N/A // * SR_WAKEUP_REQUEST when the WatcherThread has done the work and wants to resume 4141N/A // SR_WAKEUP_REQUEST can go to 4141N/A // * SR_RUNNING when the stopped thread receives the signal 4141N/A // * SR_WAKEUP_REQUEST on timeout (resend the signal and try again) 4141N/A /* try to switch state from state "from" to state "to" 4141N/A * returns the state set after the method is complete 0N/A// Note that "PAUSE" is almost always used with synchronization 0N/A// so arguably we should provide Atomic::SpinPause() instead 0N/A// of the global SpinPause() with C linkage. 0N/A// It'd also be eligible for inlining on many platforms. 1879N/A#
endif // SHARE_VM_RUNTIME_OS_HPP