src/share/vm/runtime/sharedRuntime.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File JDK-8015774 Sdiff src/share/vm/runtime

src/share/vm/runtime/sharedRuntime.cpp

Print this page




2444         if (shared_entry != NULL) {
2445           assert(shared_entry->compare_code(buf->code_begin(), buffer.insts_size(), total_args_passed, sig_bt),
2446                  "code must match");
2447           // Release the one just created and return the original
2448           _adapters->free_entry(entry);
2449           return shared_entry;
2450         } else  {
2451           entry->save_code(buf->code_begin(), buffer.insts_size(), total_args_passed, sig_bt);
2452         }
2453       }
2454 #endif
2455 
2456       B = AdapterBlob::create(&buffer);
2457       NOT_PRODUCT(insts_size = buffer.insts_size());
2458     }
2459     if (B == NULL) {
2460       // CodeCache is full, disable compilation
2461       // Ought to log this but compile log is only per compile thread
2462       // and we're some non descript Java thread.
2463       MutexUnlocker mu(AdapterHandlerLibrary_lock);
2464       CompileBroker::handle_full_code_cache();
2465       return NULL; // Out of CodeCache space
2466     }
2467     entry->relocate(B->content_begin());
2468 #ifndef PRODUCT
2469     // debugging suppport
2470     if (PrintAdapterHandlers || PrintStubCode) {
2471       ttyLocker ttyl;
2472       entry->print_adapter_on(tty);
2473       tty->print_cr("i2c argument handler #%d for: %s %s (%d bytes generated)",
2474                     _adapters->number_of_entries(), (method->is_static() ? "static" : "receiver"),
2475                     method->signature()->as_C_string(), insts_size);
2476       tty->print_cr("c2i argument handler starts at %p",entry->get_c2i_entry());
2477       if (Verbose || PrintStubCode) {
2478         address first_pc = entry->base_address();
2479         if (first_pc != NULL) {
2480           Disassembler::decode(first_pc, first_pc + insts_size);
2481           tty->cr();
2482         }
2483       }
2484     }


2621                                                   method,
2622                                                   compile_id,
2623                                                   sig_bt,
2624                                                   regs,
2625                                                   ret_type);
2626     }
2627   }
2628 
2629   // Must unlock before calling set_code
2630 
2631   // Install the generated code.
2632   if (nm != NULL) {
2633     if (PrintCompilation) {
2634       ttyLocker ttyl;
2635       CompileTask::print_compilation(tty, nm, method->is_static() ? "(static)" : "");
2636     }
2637     method->set_code(method, nm);
2638     nm->post_compiled_method_load_event();
2639   } else {
2640     // CodeCache is full, disable compilation
2641     CompileBroker::handle_full_code_cache();
2642   }
2643   return nm;
2644 }
2645 
2646 JRT_ENTRY_NO_ASYNC(void, SharedRuntime::block_for_jni_critical(JavaThread* thread))
2647   assert(thread == JavaThread::current(), "must be");
2648   // The code is about to enter a JNI lazy critical native method and
2649   // _needs_gc is true, so if this thread is already in a critical
2650   // section then just return, otherwise this thread should block
2651   // until needs_gc has been cleared.
2652   if (thread->in_critical()) {
2653     return;
2654   }
2655   // Lock and unlock a critical section to give the system a chance to block
2656   GC_locker::lock_critical(thread);
2657   GC_locker::unlock_critical(thread);
2658 JRT_END
2659 
2660 #ifdef HAVE_DTRACE_H
2661 // Create a dtrace nmethod for this method.  The wrapper converts the




2444         if (shared_entry != NULL) {
2445           assert(shared_entry->compare_code(buf->code_begin(), buffer.insts_size(), total_args_passed, sig_bt),
2446                  "code must match");
2447           // Release the one just created and return the original
2448           _adapters->free_entry(entry);
2449           return shared_entry;
2450         } else  {
2451           entry->save_code(buf->code_begin(), buffer.insts_size(), total_args_passed, sig_bt);
2452         }
2453       }
2454 #endif
2455 
2456       B = AdapterBlob::create(&buffer);
2457       NOT_PRODUCT(insts_size = buffer.insts_size());
2458     }
2459     if (B == NULL) {
2460       // CodeCache is full, disable compilation
2461       // Ought to log this but compile log is only per compile thread
2462       // and we're some non descript Java thread.
2463       MutexUnlocker mu(AdapterHandlerLibrary_lock);
2464       CompileBroker::handle_full_code_cache(CodeBlobType::NonMethod);
2465       return NULL; // Out of CodeCache space
2466     }
2467     entry->relocate(B->content_begin());
2468 #ifndef PRODUCT
2469     // debugging suppport
2470     if (PrintAdapterHandlers || PrintStubCode) {
2471       ttyLocker ttyl;
2472       entry->print_adapter_on(tty);
2473       tty->print_cr("i2c argument handler #%d for: %s %s (%d bytes generated)",
2474                     _adapters->number_of_entries(), (method->is_static() ? "static" : "receiver"),
2475                     method->signature()->as_C_string(), insts_size);
2476       tty->print_cr("c2i argument handler starts at %p",entry->get_c2i_entry());
2477       if (Verbose || PrintStubCode) {
2478         address first_pc = entry->base_address();
2479         if (first_pc != NULL) {
2480           Disassembler::decode(first_pc, first_pc + insts_size);
2481           tty->cr();
2482         }
2483       }
2484     }


2621                                                   method,
2622                                                   compile_id,
2623                                                   sig_bt,
2624                                                   regs,
2625                                                   ret_type);
2626     }
2627   }
2628 
2629   // Must unlock before calling set_code
2630 
2631   // Install the generated code.
2632   if (nm != NULL) {
2633     if (PrintCompilation) {
2634       ttyLocker ttyl;
2635       CompileTask::print_compilation(tty, nm, method->is_static() ? "(static)" : "");
2636     }
2637     method->set_code(method, nm);
2638     nm->post_compiled_method_load_event();
2639   } else {
2640     // CodeCache is full, disable compilation
2641     CompileBroker::handle_full_code_cache(CodeBlobType::MethodNonProfiled);
2642   }
2643   return nm;
2644 }
2645 
2646 JRT_ENTRY_NO_ASYNC(void, SharedRuntime::block_for_jni_critical(JavaThread* thread))
2647   assert(thread == JavaThread::current(), "must be");
2648   // The code is about to enter a JNI lazy critical native method and
2649   // _needs_gc is true, so if this thread is already in a critical
2650   // section then just return, otherwise this thread should block
2651   // until needs_gc has been cleared.
2652   if (thread->in_critical()) {
2653     return;
2654   }
2655   // Lock and unlock a critical section to give the system a chance to block
2656   GC_locker::lock_critical(thread);
2657   GC_locker::unlock_critical(thread);
2658 JRT_END
2659 
2660 #ifdef HAVE_DTRACE_H
2661 // Create a dtrace nmethod for this method.  The wrapper converts the


src/share/vm/runtime/sharedRuntime.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File