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

src/share/vm/runtime/sharedRuntime.cpp

Print this page




2404 #ifdef ASSERT
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::NonNMethod);
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     }


2577       const bool is_outgoing = method->is_method_handle_intrinsic();
2578       int comp_args_on_stack = SharedRuntime::java_calling_convention(sig_bt, regs, total_args_passed, is_outgoing);
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




2404 #ifdef ASSERT
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       return NULL; // Out of CodeCache space
2425     }
2426     entry->relocate(new_adapter->content_begin());
2427 #ifndef PRODUCT
2428     // debugging suppport
2429     if (PrintAdapterHandlers || PrintStubCode) {
2430       ttyLocker ttyl;
2431       entry->print_adapter_on(tty);
2432       tty->print_cr("i2c argument handler #%d for: %s %s %s (%d bytes generated)",
2433                     _adapters->number_of_entries(), (method->is_static() ? "static" : "receiver"),
2434                     method->signature()->as_C_string(), fingerprint->as_string(), insts_size);
2435       tty->print_cr("c2i argument handler starts at %p", entry->get_c2i_entry());
2436       if (Verbose || PrintStubCode) {
2437         address first_pc = entry->base_address();
2438         if (first_pc != NULL) {
2439           Disassembler::decode(first_pc, first_pc + insts_size);
2440           tty->cr();
2441         }
2442       }
2443     }


2575       const bool is_outgoing = method->is_method_handle_intrinsic();
2576       int comp_args_on_stack = SharedRuntime::java_calling_convention(sig_bt, regs, total_args_passed, is_outgoing);
2577 
2578       // Generate the compiled-to-native wrapper code
2579       nm = SharedRuntime::generate_native_wrapper(&_masm, method, compile_id, sig_bt, regs, ret_type);
2580 
2581       if (nm != NULL) {
2582         method->set_code(method, nm);
2583       }
2584     }
2585   } // Unlock AdapterHandlerLibrary_lock
2586 
2587 
2588   // Install the generated code.
2589   if (nm != NULL) {
2590     if (PrintCompilation) {
2591       ttyLocker ttyl;
2592       CompileTask::print_compilation(tty, nm, method->is_static() ? "(static)" : "");
2593     }
2594     nm->post_compiled_method_load_event();



2595   }
2596 }
2597 
2598 JRT_ENTRY_NO_ASYNC(void, SharedRuntime::block_for_jni_critical(JavaThread* thread))
2599   assert(thread == JavaThread::current(), "must be");
2600   // The code is about to enter a JNI lazy critical native method and
2601   // _needs_gc is true, so if this thread is already in a critical
2602   // section then just return, otherwise this thread should block
2603   // until needs_gc has been cleared.
2604   if (thread->in_critical()) {
2605     return;
2606   }
2607   // Lock and unlock a critical section to give the system a chance to block
2608   GC_locker::lock_critical(thread);
2609   GC_locker::unlock_critical(thread);
2610 JRT_END
2611 
2612 #ifdef HAVE_DTRACE_H
2613 /**
2614  * 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