/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "classfile/classLoader.hpp"
#include "classfile/symbolTable.hpp"
#include "classfile/systemDictionary.hpp"
#include "code/codeCache.hpp"
#include "compiler/compileBroker.hpp"
#include "compiler/compilerOracle.hpp"
#include "interpreter/bytecodeHistogram.hpp"
#include "memory/genCollectedHeap.hpp"
#include "memory/oopFactory.hpp"
#include "memory/universe.hpp"
#include "oops/constantPoolOop.hpp"
#include "oops/generateOopMap.hpp"
#include "oops/instanceKlass.hpp"
#include "oops/instanceKlassKlass.hpp"
#include "oops/instanceOop.hpp"
#include "oops/methodOop.hpp"
#include "oops/objArrayOop.hpp"
#include "oops/oop.inline.hpp"
#include "oops/symbol.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/aprofiler.hpp"
#include "runtime/arguments.hpp"
#include "runtime/biasedLocking.hpp"
#include "runtime/compilationPolicy.hpp"
#include "runtime/fprofiler.hpp"
#include "runtime/interfaceSupport.hpp"
#include "runtime/memprofiler.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/statSampler.hpp"
#include "runtime/vm_operations.hpp"
#include "services/memReporter.hpp"
#include "services/memTracker.hpp"
#include "trace/tracing.hpp"
#include "utilities/dtrace.hpp"
#include "utilities/globalDefinitions.hpp"
#include "utilities/histogram.hpp"
#include "utilities/vmError.hpp"
#ifdef TARGET_ARCH_x86
# include "vm_version_x86.hpp"
#endif
#ifdef TARGET_ARCH_sparc
# include "vm_version_sparc.hpp"
#endif
#ifdef TARGET_ARCH_zero
# include "vm_version_zero.hpp"
#endif
#ifdef TARGET_ARCH_arm
# include "vm_version_arm.hpp"
#endif
#ifdef TARGET_ARCH_ppc
# include "vm_version_ppc.hpp"
#endif
#ifdef TARGET_OS_FAMILY_linux
# include "thread_linux.inline.hpp"
#endif
#ifdef TARGET_OS_FAMILY_solaris
# include "thread_solaris.inline.hpp"
#endif
#ifdef TARGET_OS_FAMILY_windows
# include "thread_windows.inline.hpp"
#endif
#ifdef TARGET_OS_FAMILY_bsd
# include "thread_bsd.inline.hpp"
#endif
#ifndef SERIALGC
#include "gc_implementation/parallelScavenge/psScavenge.hpp"
#endif
#ifdef COMPILER1
#include "c1/c1_Compiler.hpp"
#include "c1/c1_Runtime1.hpp"
#endif
#ifdef COMPILER2
#include "code/compiledIC.hpp"
#include "compiler/methodLiveness.hpp"
#include "opto/compile.hpp"
#include "opto/indexSet.hpp"
#include "opto/runtime.hpp"
#endif
#ifndef USDT2
#endif /* !USDT2 */
#ifndef PRODUCT
// Statistics printing (method invocation histogram)
}
}
if ((m->method_data() != NULL) &&
}
}
// %%% there can be 32-bit overflow here
return ((*b)->invocation_count() + (*b)->compiled_invocation_count())
- ((*a)->invocation_count() + (*a)->compiled_invocation_count());
}
void print_method_invocation_histogram() {
//
tty->print_cr("Histogram Over MethodOop Invocation Counters (cutoff = %d):", MethodHistogramCutoff);
int c = m->invocation_count() + m->compiled_invocation_count();
if (c >= MethodHistogramCutoff) m->print_invocation_count();
int_total += m->invocation_count();
comp_total += m->compiled_invocation_count();
if (m->is_final()) final_total += c;
if (m->is_static()) static_total += c;
if (m->is_synchronized()) synch_total += c;
if (m->is_native()) nativ_total += c;
if (m->is_accessor()) acces_total += c;
}
}
void print_method_profiling_data() {
if (count > 0) {
//m->print_name(tty);
m->print_invocation_count();
m->print_codes();
}
}
}
void print_bytecode_count() {
}
}
// General statistics printing (profiling ...)
void print_statistics() {
#ifdef ASSERT
if (CountRuntimeCalls) {
extern Histogram *RuntimeHistogram;
}
if (CountJNICalls) {
extern Histogram *JNIHistogram;
JNIHistogram->print();
}
if (CountJVMCalls) {
extern Histogram *JVMHistogram;
JVMHistogram->print();
}
#endif
if (MemProfiling) {
MemProfiler::disengage();
}
if (CITime) {
}
#ifdef COMPILER1
}
#endif /* COMPILER1 */
#ifdef COMPILER2
#ifndef COMPILER1
#endif //COMPILER1
os::print_statistics();
}
}
if (TimeLivenessAnalysis) {
}
#ifdef ASSERT
if (CollectIndexSetStatistics) {
}
#endif // ASSERT
#endif // COMPILER2
if (CountCompiledCalls) {
}
}
if (TimeCompiler) {
}
if (TimeCompilationPolicy) {
}
if (TimeOopMap) {
}
if (ProfilerCheckIntervals) {
}
}
BytecodeCounter::print();
}
if (PrintBytecodePairHistogram) {
}
if (PrintCodeCache) {
}
if (PrintCodeCache2) {
}
if (PrintClassStatistics) {
}
if (PrintMethodStatistics) {
}
if (PrintVtableStats) {
}
if (VerifyOops) {
}
if (PrintMallocStatistics) {
alloc_stats.print();
}
if (PrintSystemDictionaryAtExit) {
}
if (PrintBiasedLockingStatistics) {
}
#ifdef ENABLE_ZAP_DEAD_LOCALS
#ifdef COMPILER2
if (ZapDeadCompiledLocals) {
tty->print_cr("OptoRuntime::ZapDeadCompiledLocals_count = %d", OptoRuntime::ZapDeadCompiledLocals_count);
}
#endif // COMPILER2
#endif // ENABLE_ZAP_DEAD_LOCALS
// Native memory tracking data
if (PrintNMTStatistics) {
if (MemTracker::is_on()) {
} else {
}
}
}
#else // PRODUCT MODE STATISTICS
void print_statistics() {
if (CITime) {
}
#ifdef COMPILER2
}
#endif
if (PrintBiasedLockingStatistics) {
}
// Native memory tracking data
if (PrintNMTStatistics) {
if (MemTracker::is_on()) {
} else {
}
}
}
#endif
// Helper class for registering on_exit calls through JVM_OnExit
extern "C" {
typedef void (*__exit_proc)(void);
}
private:
// void (*_proc)(void);
public:
// ExitProc(void (*proc)(void)) {
}
};
// Linked list of registered on_exit procedures
extern "C" {
// Classic vm does not throw an exception in case the allocation failed,
exit_procs = entry;
}
}
}
// Note: before_exit() can be executed only once, if more than one threads
// are trying to shutdown the VM at the same time, only one thread
// can run before_exit() and all other threads must wait.
#define BEFORE_EXIT_NOT_RUN 0
// Note: don't use a Mutex to guard the entire before_exit(), as
// JVMTI post_thread_end_event and post_vm_death_event will run native code.
// A CAS or OSMutex would work just fine but then we need to manipulate
// thread state for Safepoint. Here we use Monitor wait() and notify_all()
// for synchronization.
switch (_before_exit_status) {
case BEFORE_EXIT_NOT_RUN:
break;
case BEFORE_EXIT_RUNNING:
while (_before_exit_status == BEFORE_EXIT_RUNNING) {
BeforeExit_lock->wait();
}
return;
case BEFORE_EXIT_DONE:
return;
}
}
// The only difference between this and Win32's _onexit procs is that
// this version is invoked before any threads get killed.
delete current;
}
// Hang forever on exit if we're reporting an error.
if (ShowMessageBoxOnError && is_error_reported()) {
os::infinite_sleep();
}
// Terminate watcher thread - must before disenrolling any periodic task
if (PeriodicTask::num_tasks() > 0)
WatcherThread::stop();
// Print statistics gathered (profiling ...)
if (Arguments::has_profile()) {
}
// shut down the StatSampler task
StatSampler::disengage();
StatSampler::destroy();
// We do not need to explicitly stop concurrent GC threads because the
// JVM will be taken down at a safepoint when such threads are inactive --
// except for some concurrent G1 threads, see (comment in)
// Threads::destroy_vm().
if (PrintGCDetails) {
}
if (Arguments::has_alloc_profile()) {
// Do one last collection to enumerate all the objects
// allocated since the last one.
AllocationProfiler::print(0);
}
if (PrintBytecodeHistogram) {
}
if (JvmtiExport::should_post_thread_life()) {
}
if (event.should_commit()) {
}
// Always call even when there are not JVMTI environments yet, since environments
// may be attached late and JVMTI must track phases of VM execution
// Terminate the signal thread
// Note: we don't wait until it actually dies.
}
// Shutdown NMT before exit. Otherwise,
// it will run into trouble when system destroys static variables.
}
// we have serious problems -- just exit
}
// Fire off a VM_Exit operation to bring VM to a safepoint and exit
if (thread->is_Java_thread())
// should never reach here; but in case something wrong with VM Thread.
} else {
// VM thread is gone, just exit
}
}
void notify_vm_shutdown() {
// For now, just a dtrace probe.
#ifndef USDT2
#else /* USDT2 */
#endif /* USDT2 */
}
}
void vm_perform_shutdown_actions() {
// Warning: do not call 'exit_globals()' here. All threads are still running.
// Calling 'exit_globals()' will disable thread-local-storage and cause all
// kinds of assertions to trigger in debug mode.
if (is_init_completed()) {
// We are leaving the VM, set state to native (in case any OS exit
// handlers call back to the VM)
// Must always be walkable or have no last_Java_frame when in
// thread_in_native
}
}
}
void vm_shutdown()
{
}
}
}
else {
}
}
if (ShowMessageBoxOnError && WizardMode) {
fatal("Error occurred during initialization of VM");
}
}
// If there are exceptions on this thread it must be cleared
// first and here. Any future calls to EXCEPTION_MARK requires
// that no pending exceptions exist.
if (HAS_PENDING_EXCEPTION) {
}
// Failure during initialization, we don't want to dump core
vm_abort(false);
}
// Failure during initialization, we don't want to dump core
vm_abort(false);
}
// Failure during initialization, we don't want to dump core
vm_abort(false);
}
vm_shutdown();
}
// JDK older than 1.6
_current._partially_initialized = true;
} else {
// We represent "1.5.0" as "5.0", but 1.4.2 as itself.
micro = 0;
}
}
}
// This is only called when current is less than 1.6 and we've gotten
// far enough in the initialization to determine the exact version.
if (major < 5) {
// JDK verison sequence: 1.2.x, 1.3.x, 1.4.x, 5.0.x, 6.0.x, etc.
major = 1;
}
}
void JDK_Version_init() {
}
return
}
}
if (is_partially_initialized()) {
"Invalid JDK version comparison during initialization");
return -1;
} else {
uint64_t e = encode_jdk_version(*this);
return (e > o) ? 1 : ((e == o) ? 0 : -1);
}
}
if (!is_valid()) {
} else if (is_partially_initialized()) {
} else {
index += jio_snprintf(
if (_micro > 0) {
}
if (_update > 0) {
}
if (_special > 0) {
}
if (_build > 0) {
}
}
}