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




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


2620 
2621       // Generate the compiled-to-native wrapper code
2622       nm = SharedRuntime::generate_native_wrapper(&_masm, method, compile_id, sig_bt, regs, ret_type);
2623 
2624       if (nm != NULL) {
2625         method->set_code(method, nm);
2626       }
2627     }
2628   } // Unlock AdapterHandlerLibrary_lock
2629 
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     nm->post_compiled_method_load_event();
2638   } else {
2639     // CodeCache is full, disable compilation
2640     CompileBroker::handle_full_code_cache();
2641   }
2642 }
2643 
2644 JRT_ENTRY_NO_ASYNC(void, SharedRuntime::block_for_jni_critical(JavaThread* thread))
2645   assert(thread == JavaThread::current(), "must be");
2646   // The code is about to enter a JNI lazy critical native method and
2647   // _needs_gc is true, so if this thread is already in a critical
2648   // section then just return, otherwise this thread should block
2649   // until needs_gc has been cleared.
2650   if (thread->in_critical()) {
2651     return;
2652   }
2653   // Lock and unlock a critical section to give the system a chance to block
2654   GC_locker::lock_critical(thread);
2655   GC_locker::unlock_critical(thread);
2656 JRT_END
2657 
2658 #ifdef HAVE_DTRACE_H
2659 // Create a dtrace nmethod for this method.  The wrapper converts the
2660 // java compiled calling convention to the native convention, makes a dummy call




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


2620 
2621       // Generate the compiled-to-native wrapper code
2622       nm = SharedRuntime::generate_native_wrapper(&_masm, method, compile_id, sig_bt, regs, ret_type);
2623 
2624       if (nm != NULL) {
2625         method->set_code(method, nm);
2626       }
2627     }
2628   } // Unlock AdapterHandlerLibrary_lock
2629 
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     nm->post_compiled_method_load_event();
2638   } else {
2639     // CodeCache is full, disable compilation
2640     CompileBroker::handle_full_code_cache(CodeBlobType::MethodNonProfiled);
2641   }
2642 }
2643 
2644 JRT_ENTRY_NO_ASYNC(void, SharedRuntime::block_for_jni_critical(JavaThread* thread))
2645   assert(thread == JavaThread::current(), "must be");
2646   // The code is about to enter a JNI lazy critical native method and
2647   // _needs_gc is true, so if this thread is already in a critical
2648   // section then just return, otherwise this thread should block
2649   // until needs_gc has been cleared.
2650   if (thread->in_critical()) {
2651     return;
2652   }
2653   // Lock and unlock a critical section to give the system a chance to block
2654   GC_locker::lock_critical(thread);
2655   GC_locker::unlock_critical(thread);
2656 JRT_END
2657 
2658 #ifdef HAVE_DTRACE_H
2659 // Create a dtrace nmethod for this method.  The wrapper converts the
2660 // java compiled calling convention to the native convention, makes a dummy call


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