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

src/share/vm/runtime/sharedRuntime.cpp

Print this page




2405       if (VerifyAdapterSharing) {
2406         if (shared_entry != NULL) {
2407           assert(shared_entry->compare_code(buf->code_begin(), buffer.insts_size()), "code must match");
2408           // Release the one just created and return the original
2409           _adapters->free_entry(entry);
2410           return shared_entry;
2411         } else  {
2412           entry->save_code(buf->code_begin(), buffer.insts_size());
2413         }
2414       }
2415 #endif
2416 
2417       new_adapter = AdapterBlob::create(&buffer);
2418       NOT_PRODUCT(insts_size = buffer.insts_size());
2419     }
2420     if (new_adapter == NULL) {
2421       // CodeCache is full, disable compilation
2422       // Ought to log this but compile log is only per compile thread
2423       // and we're some non descript Java thread.
2424       MutexUnlocker mu(AdapterHandlerLibrary_lock);
2425       CompileBroker::handle_full_code_cache();
2426       return NULL; // Out of CodeCache space
2427     }
2428     entry->relocate(new_adapter->content_begin());
2429 #ifndef PRODUCT
2430     // debugging suppport
2431     if (PrintAdapterHandlers || PrintStubCode) {
2432       ttyLocker ttyl;
2433       entry->print_adapter_on(tty);
2434       tty->print_cr("i2c argument handler #%d for: %s %s %s (%d bytes generated)",
2435                     _adapters->number_of_entries(), (method->is_static() ? "static" : "receiver"),
2436                     method->signature()->as_C_string(), fingerprint->as_string(), insts_size);
2437       tty->print_cr("c2i argument handler starts at %p", entry->get_c2i_entry());
2438       if (Verbose || PrintStubCode) {
2439         address first_pc = entry->base_address();
2440         if (first_pc != NULL) {
2441           Disassembler::decode(first_pc, first_pc + insts_size);
2442           tty->cr();
2443         }
2444       }
2445     }


2579 
2580       // Generate the compiled-to-native wrapper code
2581       nm = SharedRuntime::generate_native_wrapper(&_masm, method, compile_id, sig_bt, regs, ret_type);
2582 
2583       if (nm != NULL) {
2584         method->set_code(method, nm);
2585       }
2586     }
2587   } // Unlock AdapterHandlerLibrary_lock
2588 
2589 
2590   // Install the generated code.
2591   if (nm != NULL) {
2592     if (PrintCompilation) {
2593       ttyLocker ttyl;
2594       CompileTask::print_compilation(tty, nm, method->is_static() ? "(static)" : "");
2595     }
2596     nm->post_compiled_method_load_event();
2597   } else {
2598     // CodeCache is full, disable compilation
2599     CompileBroker::handle_full_code_cache();
2600   }
2601 }
2602 
2603 JRT_ENTRY_NO_ASYNC(void, SharedRuntime::block_for_jni_critical(JavaThread* thread))
2604   assert(thread == JavaThread::current(), "must be");
2605   // The code is about to enter a JNI lazy critical native method and
2606   // _needs_gc is true, so if this thread is already in a critical
2607   // section then just return, otherwise this thread should block
2608   // until needs_gc has been cleared.
2609   if (thread->in_critical()) {
2610     return;
2611   }
2612   // Lock and unlock a critical section to give the system a chance to block
2613   GC_locker::lock_critical(thread);
2614   GC_locker::unlock_critical(thread);
2615 JRT_END
2616 
2617 #ifdef HAVE_DTRACE_H
2618 /**
2619  * Create a dtrace nmethod for this method.  The wrapper converts the




2405       if (VerifyAdapterSharing) {
2406         if (shared_entry != NULL) {
2407           assert(shared_entry->compare_code(buf->code_begin(), buffer.insts_size()), "code must match");
2408           // Release the one just created and return the original
2409           _adapters->free_entry(entry);
2410           return shared_entry;
2411         } else  {
2412           entry->save_code(buf->code_begin(), buffer.insts_size());
2413         }
2414       }
2415 #endif
2416 
2417       new_adapter = AdapterBlob::create(&buffer);
2418       NOT_PRODUCT(insts_size = buffer.insts_size());
2419     }
2420     if (new_adapter == NULL) {
2421       // CodeCache is full, disable compilation
2422       // Ought to log this but compile log is only per compile thread
2423       // and we're some non descript Java thread.
2424       MutexUnlocker mu(AdapterHandlerLibrary_lock);
2425       CompileBroker::handle_full_code_cache(CodeBlobType::NonMethod);
2426       return NULL; // Out of CodeCache space
2427     }
2428     entry->relocate(new_adapter->content_begin());
2429 #ifndef PRODUCT
2430     // debugging suppport
2431     if (PrintAdapterHandlers || PrintStubCode) {
2432       ttyLocker ttyl;
2433       entry->print_adapter_on(tty);
2434       tty->print_cr("i2c argument handler #%d for: %s %s %s (%d bytes generated)",
2435                     _adapters->number_of_entries(), (method->is_static() ? "static" : "receiver"),
2436                     method->signature()->as_C_string(), fingerprint->as_string(), insts_size);
2437       tty->print_cr("c2i argument handler starts at %p", entry->get_c2i_entry());
2438       if (Verbose || PrintStubCode) {
2439         address first_pc = entry->base_address();
2440         if (first_pc != NULL) {
2441           Disassembler::decode(first_pc, first_pc + insts_size);
2442           tty->cr();
2443         }
2444       }
2445     }


2579 
2580       // Generate the compiled-to-native wrapper code
2581       nm = SharedRuntime::generate_native_wrapper(&_masm, method, compile_id, sig_bt, regs, ret_type);
2582 
2583       if (nm != NULL) {
2584         method->set_code(method, nm);
2585       }
2586     }
2587   } // Unlock AdapterHandlerLibrary_lock
2588 
2589 
2590   // Install the generated code.
2591   if (nm != NULL) {
2592     if (PrintCompilation) {
2593       ttyLocker ttyl;
2594       CompileTask::print_compilation(tty, nm, method->is_static() ? "(static)" : "");
2595     }
2596     nm->post_compiled_method_load_event();
2597   } else {
2598     // CodeCache is full, disable compilation
2599     CompileBroker::handle_full_code_cache(CodeBlobType::MethodNonProfiled);
2600   }
2601 }
2602 
2603 JRT_ENTRY_NO_ASYNC(void, SharedRuntime::block_for_jni_critical(JavaThread* thread))
2604   assert(thread == JavaThread::current(), "must be");
2605   // The code is about to enter a JNI lazy critical native method and
2606   // _needs_gc is true, so if this thread is already in a critical
2607   // section then just return, otherwise this thread should block
2608   // until needs_gc has been cleared.
2609   if (thread->in_critical()) {
2610     return;
2611   }
2612   // Lock and unlock a critical section to give the system a chance to block
2613   GC_locker::lock_critical(thread);
2614   GC_locker::unlock_critical(thread);
2615 JRT_END
2616 
2617 #ifdef HAVE_DTRACE_H
2618 /**
2619  * 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