< prev index next >

src/share/vm/runtime/os.cpp

Print this page




 274         // Each module also prints an extra carriage return after its output.
 275         VM_PrintThreads op;
 276         VMThread::execute(&op);
 277         VM_PrintJNI jni_op;
 278         VMThread::execute(&jni_op);
 279         VM_FindDeadlocks op1(tty);
 280         VMThread::execute(&op1);
 281         Universe::print_heap_at_SIGBREAK();
 282         if (PrintClassHistogram) {
 283           VM_GC_HeapInspection op1(tty, true /* force full GC before heap inspection */);
 284           VMThread::execute(&op1);
 285         }
 286         if (JvmtiExport::should_post_data_dump()) {
 287           JvmtiExport::post_data_dump();
 288         }
 289         break;
 290       }
 291       default: {
 292         // Dispatch the signal to java
 293         HandleMark hm(THREAD);
 294         Klass* k = SystemDictionary::resolve_or_null(vmSymbols::jdk_internal_misc_Signal(), THREAD);
 295         KlassHandle klass (THREAD, k);
 296         if (klass.not_null()) {
 297           JavaValue result(T_VOID);
 298           JavaCallArguments args;
 299           args.push_int(sig);
 300           JavaCalls::call_static(
 301             &result,
 302             klass,
 303             vmSymbols::dispatch_name(),
 304             vmSymbols::int_void_signature(),
 305             &args,
 306             THREAD
 307           );
 308         }
 309         if (HAS_PENDING_EXCEPTION) {
 310           // tty is initialized early so we don't expect it to be null, but
 311           // if it is we can't risk doing an initialization that might
 312           // trigger additional out-of-memory conditions
 313           if (tty != NULL) {
 314             char klass_name[256];
 315             char tmp_sig_name[16];
 316             const char* sig_name = "UNKNOWN";


 335   // decisions depending on large page support and the calculated large page size.
 336   large_page_init();
 337 
 338   // We need to adapt the configured number of stack protection pages given
 339   // in 4K pages to the actual os page size. We must do this before setting
 340   // up minimal stack sizes etc. in os::init_2().
 341   JavaThread::set_stack_red_zone_size     (align_size_up(StackRedPages      * 4 * K, vm_page_size()));
 342   JavaThread::set_stack_yellow_zone_size  (align_size_up(StackYellowPages   * 4 * K, vm_page_size()));
 343   JavaThread::set_stack_reserved_zone_size(align_size_up(StackReservedPages * 4 * K, vm_page_size()));
 344   JavaThread::set_stack_shadow_zone_size  (align_size_up(StackShadowPages   * 4 * K, vm_page_size()));
 345 
 346   // VM version initialization identifies some characteristics of the
 347   // platform that are used during ergonomic decisions.
 348   VM_Version::init_before_ergo();
 349 }
 350 
 351 void os::signal_init(TRAPS) {
 352   if (!ReduceSignalUsage) {
 353     // Setup JavaThread for processing signals
 354     Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_Thread(), true, CHECK);
 355     instanceKlassHandle klass (THREAD, k);
 356     instanceHandle thread_oop = klass->allocate_instance_handle(CHECK);
 357 
 358     const char thread_name[] = "Signal Dispatcher";
 359     Handle string = java_lang_String::create_from_str(thread_name, CHECK);
 360 
 361     // Initialize thread_oop to put it into the system threadGroup
 362     Handle thread_group (THREAD, Universe::system_thread_group());
 363     JavaValue result(T_VOID);
 364     JavaCalls::call_special(&result, thread_oop,
 365                            klass,
 366                            vmSymbols::object_initializer_name(),
 367                            vmSymbols::threadgroup_string_void_signature(),
 368                            thread_group,
 369                            string,
 370                            CHECK);
 371 
 372     KlassHandle group(THREAD, SystemDictionary::ThreadGroup_klass());
 373     JavaCalls::call_special(&result,
 374                             thread_group,
 375                             group,
 376                             vmSymbols::add_method_name(),
 377                             vmSymbols::thread_void_signature(),
 378                             thread_oop,         // ARG 1
 379                             CHECK);
 380 
 381     os::signal_init_pd();
 382 
 383     { MutexLocker mu(Threads_lock);
 384       JavaThread* signal_thread = new JavaThread(&signal_thread_entry);
 385 
 386       // At this point it may be possible that no osthread was created for the
 387       // JavaThread due to lack of memory. We would have to throw an exception
 388       // in that case. However, since this must work and we do not allow
 389       // exceptions anyway, check and abort if this fails.
 390       if (signal_thread == NULL || signal_thread->osthread() == NULL) {
 391         vm_exit_during_initialization("java.lang.OutOfMemoryError",
 392                                       os::native_thread_creation_failed_msg());




 274         // Each module also prints an extra carriage return after its output.
 275         VM_PrintThreads op;
 276         VMThread::execute(&op);
 277         VM_PrintJNI jni_op;
 278         VMThread::execute(&jni_op);
 279         VM_FindDeadlocks op1(tty);
 280         VMThread::execute(&op1);
 281         Universe::print_heap_at_SIGBREAK();
 282         if (PrintClassHistogram) {
 283           VM_GC_HeapInspection op1(tty, true /* force full GC before heap inspection */);
 284           VMThread::execute(&op1);
 285         }
 286         if (JvmtiExport::should_post_data_dump()) {
 287           JvmtiExport::post_data_dump();
 288         }
 289         break;
 290       }
 291       default: {
 292         // Dispatch the signal to java
 293         HandleMark hm(THREAD);
 294         Klass* klass = SystemDictionary::resolve_or_null(vmSymbols::jdk_internal_misc_Signal(), THREAD);
 295         if (klass != NULL) {

 296           JavaValue result(T_VOID);
 297           JavaCallArguments args;
 298           args.push_int(sig);
 299           JavaCalls::call_static(
 300             &result,
 301             klass,
 302             vmSymbols::dispatch_name(),
 303             vmSymbols::int_void_signature(),
 304             &args,
 305             THREAD
 306           );
 307         }
 308         if (HAS_PENDING_EXCEPTION) {
 309           // tty is initialized early so we don't expect it to be null, but
 310           // if it is we can't risk doing an initialization that might
 311           // trigger additional out-of-memory conditions
 312           if (tty != NULL) {
 313             char klass_name[256];
 314             char tmp_sig_name[16];
 315             const char* sig_name = "UNKNOWN";


 334   // decisions depending on large page support and the calculated large page size.
 335   large_page_init();
 336 
 337   // We need to adapt the configured number of stack protection pages given
 338   // in 4K pages to the actual os page size. We must do this before setting
 339   // up minimal stack sizes etc. in os::init_2().
 340   JavaThread::set_stack_red_zone_size     (align_size_up(StackRedPages      * 4 * K, vm_page_size()));
 341   JavaThread::set_stack_yellow_zone_size  (align_size_up(StackYellowPages   * 4 * K, vm_page_size()));
 342   JavaThread::set_stack_reserved_zone_size(align_size_up(StackReservedPages * 4 * K, vm_page_size()));
 343   JavaThread::set_stack_shadow_zone_size  (align_size_up(StackShadowPages   * 4 * K, vm_page_size()));
 344 
 345   // VM version initialization identifies some characteristics of the
 346   // platform that are used during ergonomic decisions.
 347   VM_Version::init_before_ergo();
 348 }
 349 
 350 void os::signal_init(TRAPS) {
 351   if (!ReduceSignalUsage) {
 352     // Setup JavaThread for processing signals
 353     Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_Thread(), true, CHECK);
 354     InstanceKlass* ik = InstanceKlass::cast(k);
 355     instanceHandle thread_oop = ik->allocate_instance_handle(CHECK);
 356 
 357     const char thread_name[] = "Signal Dispatcher";
 358     Handle string = java_lang_String::create_from_str(thread_name, CHECK);
 359 
 360     // Initialize thread_oop to put it into the system threadGroup
 361     Handle thread_group (THREAD, Universe::system_thread_group());
 362     JavaValue result(T_VOID);
 363     JavaCalls::call_special(&result, thread_oop,
 364                            ik,
 365                            vmSymbols::object_initializer_name(),
 366                            vmSymbols::threadgroup_string_void_signature(),
 367                            thread_group,
 368                            string,
 369                            CHECK);
 370 
 371     Klass* group = SystemDictionary::ThreadGroup_klass();
 372     JavaCalls::call_special(&result,
 373                             thread_group,
 374                             group,
 375                             vmSymbols::add_method_name(),
 376                             vmSymbols::thread_void_signature(),
 377                             thread_oop,         // ARG 1
 378                             CHECK);
 379 
 380     os::signal_init_pd();
 381 
 382     { MutexLocker mu(Threads_lock);
 383       JavaThread* signal_thread = new JavaThread(&signal_thread_entry);
 384 
 385       // At this point it may be possible that no osthread was created for the
 386       // JavaThread due to lack of memory. We would have to throw an exception
 387       // in that case. However, since this must work and we do not allow
 388       // exceptions anyway, check and abort if this fails.
 389       if (signal_thread == NULL || signal_thread->osthread() == NULL) {
 390         vm_exit_during_initialization("java.lang.OutOfMemoryError",
 391                                       os::native_thread_creation_failed_msg());


< prev index next >