src/share/vm/runtime/java.cpp

Wed, 19 Mar 2008 09:58:01 -0400

author
sbohne
date
Wed, 19 Mar 2008 09:58:01 -0400
changeset 496
5a76ab815e34
parent 435
a61af66fc99e
child 631
d1605aabd0a1
child 662
8d852b81e775
permissions
-rw-r--r--

6667833: Remove CacheTimeMillis
Summary: Remove -XX:+CacheTimeMillis option and associated functionality
Reviewed-by: acorn, never

duke@435 1 /*
duke@435 2 * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
duke@435 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@435 20 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@435 21 * have any questions.
duke@435 22 *
duke@435 23 */
duke@435 24
duke@435 25 #include "incls/_precompiled.incl"
duke@435 26 #include "incls/_java.cpp.incl"
duke@435 27
duke@435 28 HS_DTRACE_PROBE_DECL(hotspot, vm__shutdown);
duke@435 29
duke@435 30 #ifndef PRODUCT
duke@435 31
duke@435 32 // Statistics printing (method invocation histogram)
duke@435 33
duke@435 34 GrowableArray<methodOop>* collected_invoked_methods;
duke@435 35
duke@435 36 void collect_invoked_methods(methodOop m) {
duke@435 37 if (m->invocation_count() + m->compiled_invocation_count() >= 1 ) {
duke@435 38 collected_invoked_methods->push(m);
duke@435 39 }
duke@435 40 }
duke@435 41
duke@435 42
duke@435 43 GrowableArray<methodOop>* collected_profiled_methods;
duke@435 44
duke@435 45 void collect_profiled_methods(methodOop m) {
duke@435 46 methodHandle mh(Thread::current(), m);
duke@435 47 if ((m->method_data() != NULL) &&
duke@435 48 (PrintMethodData || CompilerOracle::should_print(mh))) {
duke@435 49 collected_profiled_methods->push(m);
duke@435 50 }
duke@435 51 }
duke@435 52
duke@435 53
duke@435 54 int compare_methods(methodOop* a, methodOop* b) {
duke@435 55 // %%% there can be 32-bit overflow here
duke@435 56 return ((*b)->invocation_count() + (*b)->compiled_invocation_count())
duke@435 57 - ((*a)->invocation_count() + (*a)->compiled_invocation_count());
duke@435 58 }
duke@435 59
duke@435 60
duke@435 61 void print_method_invocation_histogram() {
duke@435 62 ResourceMark rm;
duke@435 63 HandleMark hm;
duke@435 64 collected_invoked_methods = new GrowableArray<methodOop>(1024);
duke@435 65 SystemDictionary::methods_do(collect_invoked_methods);
duke@435 66 collected_invoked_methods->sort(&compare_methods);
duke@435 67 //
duke@435 68 tty->cr();
duke@435 69 tty->print_cr("Histogram Over MethodOop Invocation Counters (cutoff = %d):", MethodHistogramCutoff);
duke@435 70 tty->cr();
duke@435 71 tty->print_cr("____Count_(I+C)____Method________________________Module_________________");
duke@435 72 unsigned total = 0, int_total = 0, comp_total = 0, static_total = 0, final_total = 0,
duke@435 73 synch_total = 0, nativ_total = 0, acces_total = 0;
duke@435 74 for (int index = 0; index < collected_invoked_methods->length(); index++) {
duke@435 75 methodOop m = collected_invoked_methods->at(index);
duke@435 76 int c = m->invocation_count() + m->compiled_invocation_count();
duke@435 77 if (c >= MethodHistogramCutoff) m->print_invocation_count();
duke@435 78 int_total += m->invocation_count();
duke@435 79 comp_total += m->compiled_invocation_count();
duke@435 80 if (m->is_final()) final_total += c;
duke@435 81 if (m->is_static()) static_total += c;
duke@435 82 if (m->is_synchronized()) synch_total += c;
duke@435 83 if (m->is_native()) nativ_total += c;
duke@435 84 if (m->is_accessor()) acces_total += c;
duke@435 85 }
duke@435 86 tty->cr();
duke@435 87 total = int_total + comp_total;
duke@435 88 tty->print_cr("Invocations summary:");
duke@435 89 tty->print_cr("\t%9d (%4.1f%%) interpreted", int_total, 100.0 * int_total / total);
duke@435 90 tty->print_cr("\t%9d (%4.1f%%) compiled", comp_total, 100.0 * comp_total / total);
duke@435 91 tty->print_cr("\t%9d (100%%) total", total);
duke@435 92 tty->print_cr("\t%9d (%4.1f%%) synchronized", synch_total, 100.0 * synch_total / total);
duke@435 93 tty->print_cr("\t%9d (%4.1f%%) final", final_total, 100.0 * final_total / total);
duke@435 94 tty->print_cr("\t%9d (%4.1f%%) static", static_total, 100.0 * static_total / total);
duke@435 95 tty->print_cr("\t%9d (%4.1f%%) native", nativ_total, 100.0 * nativ_total / total);
duke@435 96 tty->print_cr("\t%9d (%4.1f%%) accessor", acces_total, 100.0 * acces_total / total);
duke@435 97 tty->cr();
duke@435 98 SharedRuntime::print_call_statistics(comp_total);
duke@435 99 }
duke@435 100
duke@435 101 void print_method_profiling_data() {
duke@435 102 ResourceMark rm;
duke@435 103 HandleMark hm;
duke@435 104 collected_profiled_methods = new GrowableArray<methodOop>(1024);
duke@435 105 SystemDictionary::methods_do(collect_profiled_methods);
duke@435 106 collected_profiled_methods->sort(&compare_methods);
duke@435 107
duke@435 108 int count = collected_profiled_methods->length();
duke@435 109 if (count > 0) {
duke@435 110 for (int index = 0; index < count; index++) {
duke@435 111 methodOop m = collected_profiled_methods->at(index);
duke@435 112 ttyLocker ttyl;
duke@435 113 tty->print_cr("------------------------------------------------------------------------");
duke@435 114 //m->print_name(tty);
duke@435 115 m->print_invocation_count();
duke@435 116 tty->cr();
duke@435 117 m->print_codes();
duke@435 118 }
duke@435 119 tty->print_cr("------------------------------------------------------------------------");
duke@435 120 }
duke@435 121 }
duke@435 122
duke@435 123 void print_bytecode_count() {
duke@435 124 if (CountBytecodes || TraceBytecodes || StopInterpreterAt) {
duke@435 125 tty->print_cr("[BytecodeCounter::counter_value = %d]", BytecodeCounter::counter_value());
duke@435 126 }
duke@435 127 }
duke@435 128
duke@435 129 AllocStats alloc_stats;
duke@435 130
duke@435 131
duke@435 132
duke@435 133 // General statistics printing (profiling ...)
duke@435 134
duke@435 135 void print_statistics() {
duke@435 136
duke@435 137 #ifdef ASSERT
duke@435 138
duke@435 139 if (CountRuntimeCalls) {
duke@435 140 extern Histogram *RuntimeHistogram;
duke@435 141 RuntimeHistogram->print();
duke@435 142 }
duke@435 143
duke@435 144 if (CountJNICalls) {
duke@435 145 extern Histogram *JNIHistogram;
duke@435 146 JNIHistogram->print();
duke@435 147 }
duke@435 148
duke@435 149 if (CountJVMCalls) {
duke@435 150 extern Histogram *JVMHistogram;
duke@435 151 JVMHistogram->print();
duke@435 152 }
duke@435 153
duke@435 154 #endif
duke@435 155
duke@435 156 if (MemProfiling) {
duke@435 157 MemProfiler::disengage();
duke@435 158 }
duke@435 159
duke@435 160 if (CITime) {
duke@435 161 CompileBroker::print_times();
duke@435 162 }
duke@435 163
duke@435 164 #ifdef COMPILER1
duke@435 165 if ((PrintC1Statistics || LogVMOutput || LogCompilation) && UseCompiler) {
duke@435 166 FlagSetting fs(DisplayVMOutput, DisplayVMOutput && PrintC1Statistics);
duke@435 167 Runtime1::print_statistics();
duke@435 168 Deoptimization::print_statistics();
duke@435 169 nmethod::print_statistics();
duke@435 170 }
duke@435 171 #endif /* COMPILER1 */
duke@435 172
duke@435 173 #ifdef COMPILER2
duke@435 174 if ((PrintOptoStatistics || LogVMOutput || LogCompilation) && UseCompiler) {
duke@435 175 FlagSetting fs(DisplayVMOutput, DisplayVMOutput && PrintOptoStatistics);
duke@435 176 Compile::print_statistics();
duke@435 177 #ifndef COMPILER1
duke@435 178 Deoptimization::print_statistics();
duke@435 179 nmethod::print_statistics();
duke@435 180 #endif //COMPILER1
duke@435 181 SharedRuntime::print_statistics();
duke@435 182 os::print_statistics();
duke@435 183 }
duke@435 184
duke@435 185 if (PrintLockStatistics || PrintPreciseBiasedLockingStatistics) {
duke@435 186 OptoRuntime::print_named_counters();
duke@435 187 }
duke@435 188
duke@435 189 if (TimeLivenessAnalysis) {
duke@435 190 MethodLiveness::print_times();
duke@435 191 }
duke@435 192 #ifdef ASSERT
duke@435 193 if (CollectIndexSetStatistics) {
duke@435 194 IndexSet::print_statistics();
duke@435 195 }
duke@435 196 #endif // ASSERT
duke@435 197 #endif // COMPILER2
duke@435 198 if (CountCompiledCalls) {
duke@435 199 print_method_invocation_histogram();
duke@435 200 }
duke@435 201 if (ProfileInterpreter || Tier1UpdateMethodData) {
duke@435 202 print_method_profiling_data();
duke@435 203 }
duke@435 204 if (TimeCompiler) {
duke@435 205 COMPILER2_PRESENT(Compile::print_timers();)
duke@435 206 }
duke@435 207 if (TimeCompilationPolicy) {
duke@435 208 CompilationPolicy::policy()->print_time();
duke@435 209 }
duke@435 210 if (TimeOopMap) {
duke@435 211 GenerateOopMap::print_time();
duke@435 212 }
duke@435 213 if (ProfilerCheckIntervals) {
duke@435 214 PeriodicTask::print_intervals();
duke@435 215 }
duke@435 216 if (PrintSymbolTableSizeHistogram) {
duke@435 217 SymbolTable::print_histogram();
duke@435 218 }
duke@435 219 if (CountBytecodes || TraceBytecodes || StopInterpreterAt) {
duke@435 220 BytecodeCounter::print();
duke@435 221 }
duke@435 222 if (PrintBytecodePairHistogram) {
duke@435 223 BytecodePairHistogram::print();
duke@435 224 }
duke@435 225
duke@435 226 if (PrintCodeCache) {
duke@435 227 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
duke@435 228 CodeCache::print();
duke@435 229 }
duke@435 230
duke@435 231 if (PrintCodeCache2) {
duke@435 232 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
duke@435 233 CodeCache::print_internals();
duke@435 234 }
duke@435 235
duke@435 236 if (PrintClassStatistics) {
duke@435 237 SystemDictionary::print_class_statistics();
duke@435 238 }
duke@435 239 if (PrintMethodStatistics) {
duke@435 240 SystemDictionary::print_method_statistics();
duke@435 241 }
duke@435 242
duke@435 243 if (PrintVtableStats) {
duke@435 244 klassVtable::print_statistics();
duke@435 245 klassItable::print_statistics();
duke@435 246 }
duke@435 247 if (VerifyOops) {
duke@435 248 tty->print_cr("+VerifyOops count: %d", StubRoutines::verify_oop_count());
duke@435 249 }
duke@435 250
duke@435 251 print_bytecode_count();
duke@435 252 if (WizardMode) {
duke@435 253 tty->print("allocation stats: ");
duke@435 254 alloc_stats.print();
duke@435 255 tty->cr();
duke@435 256 }
duke@435 257
duke@435 258 if (PrintSystemDictionaryAtExit) {
duke@435 259 SystemDictionary::print();
duke@435 260 }
duke@435 261
duke@435 262 if (PrintBiasedLockingStatistics) {
duke@435 263 BiasedLocking::print_counters();
duke@435 264 }
duke@435 265
duke@435 266 #ifdef ENABLE_ZAP_DEAD_LOCALS
duke@435 267 #ifdef COMPILER2
duke@435 268 if (ZapDeadCompiledLocals) {
duke@435 269 tty->print_cr("Compile::CompiledZap_count = %d", Compile::CompiledZap_count);
duke@435 270 tty->print_cr("OptoRuntime::ZapDeadCompiledLocals_count = %d", OptoRuntime::ZapDeadCompiledLocals_count);
duke@435 271 }
duke@435 272 #endif // COMPILER2
duke@435 273 #endif // ENABLE_ZAP_DEAD_LOCALS
duke@435 274 }
duke@435 275
duke@435 276 #else // PRODUCT MODE STATISTICS
duke@435 277
duke@435 278 void print_statistics() {
duke@435 279
duke@435 280 if (CITime) {
duke@435 281 CompileBroker::print_times();
duke@435 282 }
duke@435 283 #ifdef COMPILER2
duke@435 284 if (PrintPreciseBiasedLockingStatistics) {
duke@435 285 OptoRuntime::print_named_counters();
duke@435 286 }
duke@435 287 #endif
duke@435 288 if (PrintBiasedLockingStatistics) {
duke@435 289 BiasedLocking::print_counters();
duke@435 290 }
duke@435 291 }
duke@435 292
duke@435 293 #endif
duke@435 294
duke@435 295
duke@435 296 // Helper class for registering on_exit calls through JVM_OnExit
duke@435 297
duke@435 298 extern "C" {
duke@435 299 typedef void (*__exit_proc)(void);
duke@435 300 }
duke@435 301
duke@435 302 class ExitProc : public CHeapObj {
duke@435 303 private:
duke@435 304 __exit_proc _proc;
duke@435 305 // void (*_proc)(void);
duke@435 306 ExitProc* _next;
duke@435 307 public:
duke@435 308 // ExitProc(void (*proc)(void)) {
duke@435 309 ExitProc(__exit_proc proc) {
duke@435 310 _proc = proc;
duke@435 311 _next = NULL;
duke@435 312 }
duke@435 313 void evaluate() { _proc(); }
duke@435 314 ExitProc* next() const { return _next; }
duke@435 315 void set_next(ExitProc* next) { _next = next; }
duke@435 316 };
duke@435 317
duke@435 318
duke@435 319 // Linked list of registered on_exit procedures
duke@435 320
duke@435 321 static ExitProc* exit_procs = NULL;
duke@435 322
duke@435 323
duke@435 324 extern "C" {
duke@435 325 void register_on_exit_function(void (*func)(void)) {
duke@435 326 ExitProc *entry = new ExitProc(func);
duke@435 327 // Classic vm does not throw an exception in case the allocation failed,
duke@435 328 if (entry != NULL) {
duke@435 329 entry->set_next(exit_procs);
duke@435 330 exit_procs = entry;
duke@435 331 }
duke@435 332 }
duke@435 333 }
duke@435 334
duke@435 335 // Note: before_exit() can be executed only once, if more than one threads
duke@435 336 // are trying to shutdown the VM at the same time, only one thread
duke@435 337 // can run before_exit() and all other threads must wait.
duke@435 338 void before_exit(JavaThread * thread) {
duke@435 339 #define BEFORE_EXIT_NOT_RUN 0
duke@435 340 #define BEFORE_EXIT_RUNNING 1
duke@435 341 #define BEFORE_EXIT_DONE 2
duke@435 342 static jint volatile _before_exit_status = BEFORE_EXIT_NOT_RUN;
duke@435 343
duke@435 344 // Note: don't use a Mutex to guard the entire before_exit(), as
duke@435 345 // JVMTI post_thread_end_event and post_vm_death_event will run native code.
duke@435 346 // A CAS or OSMutex would work just fine but then we need to manipulate
duke@435 347 // thread state for Safepoint. Here we use Monitor wait() and notify_all()
duke@435 348 // for synchronization.
duke@435 349 { MutexLocker ml(BeforeExit_lock);
duke@435 350 switch (_before_exit_status) {
duke@435 351 case BEFORE_EXIT_NOT_RUN:
duke@435 352 _before_exit_status = BEFORE_EXIT_RUNNING;
duke@435 353 break;
duke@435 354 case BEFORE_EXIT_RUNNING:
duke@435 355 while (_before_exit_status == BEFORE_EXIT_RUNNING) {
duke@435 356 BeforeExit_lock->wait();
duke@435 357 }
duke@435 358 assert(_before_exit_status == BEFORE_EXIT_DONE, "invalid state");
duke@435 359 return;
duke@435 360 case BEFORE_EXIT_DONE:
duke@435 361 return;
duke@435 362 }
duke@435 363 }
duke@435 364
duke@435 365 // The only difference between this and Win32's _onexit procs is that
duke@435 366 // this version is invoked before any threads get killed.
duke@435 367 ExitProc* current = exit_procs;
duke@435 368 while (current != NULL) {
duke@435 369 ExitProc* next = current->next();
duke@435 370 current->evaluate();
duke@435 371 delete current;
duke@435 372 current = next;
duke@435 373 }
duke@435 374
duke@435 375 // Hang forever on exit if we're reporting an error.
duke@435 376 if (ShowMessageBoxOnError && is_error_reported()) {
duke@435 377 os::infinite_sleep();
duke@435 378 }
duke@435 379
duke@435 380 // Terminate watcher thread - must before disenrolling any periodic task
duke@435 381 WatcherThread::stop();
duke@435 382
duke@435 383 // Print statistics gathered (profiling ...)
duke@435 384 if (Arguments::has_profile()) {
duke@435 385 FlatProfiler::disengage();
duke@435 386 FlatProfiler::print(10);
duke@435 387 }
duke@435 388
duke@435 389 // shut down the StatSampler task
duke@435 390 StatSampler::disengage();
duke@435 391 StatSampler::destroy();
duke@435 392
duke@435 393 #ifndef SERIALGC
duke@435 394 // stop CMS threads
duke@435 395 if (UseConcMarkSweepGC) {
duke@435 396 ConcurrentMarkSweepThread::stop();
duke@435 397 }
duke@435 398 #endif // SERIALGC
duke@435 399
duke@435 400 // Print GC/heap related information.
duke@435 401 if (PrintGCDetails) {
duke@435 402 Universe::print();
duke@435 403 AdaptiveSizePolicyOutput(0);
duke@435 404 }
duke@435 405
duke@435 406
duke@435 407 if (Arguments::has_alloc_profile()) {
duke@435 408 HandleMark hm;
duke@435 409 // Do one last collection to enumerate all the objects
duke@435 410 // allocated since the last one.
duke@435 411 Universe::heap()->collect(GCCause::_allocation_profiler);
duke@435 412 AllocationProfiler::disengage();
duke@435 413 AllocationProfiler::print(0);
duke@435 414 }
duke@435 415
duke@435 416 if (PrintBytecodeHistogram) {
duke@435 417 BytecodeHistogram::print();
duke@435 418 }
duke@435 419
duke@435 420 if (JvmtiExport::should_post_thread_life()) {
duke@435 421 JvmtiExport::post_thread_end(thread);
duke@435 422 }
duke@435 423 // Always call even when there are not JVMTI environments yet, since environments
duke@435 424 // may be attached late and JVMTI must track phases of VM execution
duke@435 425 JvmtiExport::post_vm_death();
duke@435 426 Threads::shutdown_vm_agents();
duke@435 427
duke@435 428 // Terminate the signal thread
duke@435 429 // Note: we don't wait until it actually dies.
duke@435 430 os::terminate_signal_thread();
duke@435 431
duke@435 432 print_statistics();
duke@435 433 Universe::heap()->print_tracing_info();
duke@435 434
duke@435 435 VTune::exit();
duke@435 436
duke@435 437 { MutexLocker ml(BeforeExit_lock);
duke@435 438 _before_exit_status = BEFORE_EXIT_DONE;
duke@435 439 BeforeExit_lock->notify_all();
duke@435 440 }
duke@435 441
duke@435 442 #undef BEFORE_EXIT_NOT_RUN
duke@435 443 #undef BEFORE_EXIT_RUNNING
duke@435 444 #undef BEFORE_EXIT_DONE
duke@435 445 }
duke@435 446
duke@435 447 void vm_exit(int code) {
duke@435 448 Thread* thread = ThreadLocalStorage::thread_index() == -1 ? NULL
duke@435 449 : ThreadLocalStorage::get_thread_slow();
duke@435 450 if (thread == NULL) {
duke@435 451 // we have serious problems -- just exit
duke@435 452 vm_direct_exit(code);
duke@435 453 }
duke@435 454
duke@435 455 if (VMThread::vm_thread() != NULL) {
duke@435 456 // Fire off a VM_Exit operation to bring VM to a safepoint and exit
duke@435 457 VM_Exit op(code);
duke@435 458 if (thread->is_Java_thread())
duke@435 459 ((JavaThread*)thread)->set_thread_state(_thread_in_vm);
duke@435 460 VMThread::execute(&op);
duke@435 461 // should never reach here; but in case something wrong with VM Thread.
duke@435 462 vm_direct_exit(code);
duke@435 463 } else {
duke@435 464 // VM thread is gone, just exit
duke@435 465 vm_direct_exit(code);
duke@435 466 }
duke@435 467 ShouldNotReachHere();
duke@435 468 }
duke@435 469
duke@435 470 void notify_vm_shutdown() {
duke@435 471 // For now, just a dtrace probe.
duke@435 472 HS_DTRACE_PROBE(hotspot, vm__shutdown);
duke@435 473 }
duke@435 474
duke@435 475 void vm_direct_exit(int code) {
duke@435 476 notify_vm_shutdown();
duke@435 477 ::exit(code);
duke@435 478 }
duke@435 479
duke@435 480 void vm_perform_shutdown_actions() {
duke@435 481 // Warning: do not call 'exit_globals()' here. All threads are still running.
duke@435 482 // Calling 'exit_globals()' will disable thread-local-storage and cause all
duke@435 483 // kinds of assertions to trigger in debug mode.
duke@435 484 if (is_init_completed()) {
duke@435 485 Thread* thread = Thread::current();
duke@435 486 if (thread->is_Java_thread()) {
duke@435 487 // We are leaving the VM, set state to native (in case any OS exit
duke@435 488 // handlers call back to the VM)
duke@435 489 JavaThread* jt = (JavaThread*)thread;
duke@435 490 // Must always be walkable or have no last_Java_frame when in
duke@435 491 // thread_in_native
duke@435 492 jt->frame_anchor()->make_walkable(jt);
duke@435 493 jt->set_thread_state(_thread_in_native);
duke@435 494 }
duke@435 495 }
duke@435 496 notify_vm_shutdown();
duke@435 497 }
duke@435 498
duke@435 499 void vm_shutdown()
duke@435 500 {
duke@435 501 vm_perform_shutdown_actions();
duke@435 502 os::shutdown();
duke@435 503 }
duke@435 504
duke@435 505 void vm_abort() {
duke@435 506 vm_perform_shutdown_actions();
duke@435 507 os::abort(PRODUCT_ONLY(false));
duke@435 508 ShouldNotReachHere();
duke@435 509 }
duke@435 510
duke@435 511 void vm_notify_during_shutdown(const char* error, const char* message) {
duke@435 512 if (error != NULL) {
duke@435 513 tty->print_cr("Error occurred during initialization of VM");
duke@435 514 tty->print("%s", error);
duke@435 515 if (message != NULL) {
duke@435 516 tty->print_cr(": %s", message);
duke@435 517 }
duke@435 518 else {
duke@435 519 tty->cr();
duke@435 520 }
duke@435 521 }
duke@435 522 if (ShowMessageBoxOnError && WizardMode) {
duke@435 523 fatal("Error occurred during initialization of VM");
duke@435 524 }
duke@435 525 }
duke@435 526
duke@435 527 void vm_exit_during_initialization(Handle exception) {
duke@435 528 tty->print_cr("Error occurred during initialization of VM");
duke@435 529 // If there are exceptions on this thread it must be cleared
duke@435 530 // first and here. Any future calls to EXCEPTION_MARK requires
duke@435 531 // that no pending exceptions exist.
duke@435 532 Thread *THREAD = Thread::current();
duke@435 533 if (HAS_PENDING_EXCEPTION) {
duke@435 534 CLEAR_PENDING_EXCEPTION;
duke@435 535 }
duke@435 536 java_lang_Throwable::print(exception, tty);
duke@435 537 tty->cr();
duke@435 538 java_lang_Throwable::print_stack_trace(exception(), tty);
duke@435 539 tty->cr();
duke@435 540 vm_notify_during_shutdown(NULL, NULL);
duke@435 541 vm_abort();
duke@435 542 }
duke@435 543
duke@435 544 void vm_exit_during_initialization(symbolHandle ex, const char* message) {
duke@435 545 ResourceMark rm;
duke@435 546 vm_notify_during_shutdown(ex->as_C_string(), message);
duke@435 547 vm_abort();
duke@435 548 }
duke@435 549
duke@435 550 void vm_exit_during_initialization(const char* error, const char* message) {
duke@435 551 vm_notify_during_shutdown(error, message);
duke@435 552 vm_abort();
duke@435 553 }
duke@435 554
duke@435 555 void vm_shutdown_during_initialization(const char* error, const char* message) {
duke@435 556 vm_notify_during_shutdown(error, message);
duke@435 557 vm_shutdown();
duke@435 558 }
duke@435 559
duke@435 560 jdk_version_info JDK_Version::_version_info = {0};
duke@435 561 bool JDK_Version::_pre_jdk16_version = false;
duke@435 562 int JDK_Version::_jdk_version = 0;
duke@435 563
duke@435 564 void JDK_Version::initialize() {
duke@435 565 void *lib_handle = os::native_java_library();
duke@435 566 jdk_version_info_fn_t func =
duke@435 567 CAST_TO_FN_PTR(jdk_version_info_fn_t, hpi::dll_lookup(lib_handle, "JDK_GetVersionInfo0"));
duke@435 568
duke@435 569 if (func == NULL) {
duke@435 570 // JDK older than 1.6
duke@435 571 _pre_jdk16_version = true;
duke@435 572 return;
duke@435 573 }
duke@435 574
duke@435 575 if (func != NULL) {
duke@435 576 (*func)(&_version_info, sizeof(_version_info));
duke@435 577 }
duke@435 578 if (jdk_major_version() == 1) {
duke@435 579 _jdk_version = jdk_minor_version();
duke@435 580 } else {
duke@435 581 // If the release version string is changed to n.x.x (e.g. 7.0.0) in a future release
duke@435 582 _jdk_version = jdk_major_version();
duke@435 583 }
duke@435 584 }
duke@435 585
duke@435 586 void JDK_Version_init() {
duke@435 587 JDK_Version::initialize();
duke@435 588 }

mercurial