hotspot/src/share/vm/runtime/sharedRuntime.cpp
changeset 8872 36680c58660e
parent 8495 a4959965eaa3
child 8883 5569135acca3
equal deleted inserted replaced
8871:5c3b26c4119e 8872:36680c58660e
  2477 
  2477 
  2478 // Create a native wrapper for this native method.  The wrapper converts the
  2478 // Create a native wrapper for this native method.  The wrapper converts the
  2479 // java compiled calling convention to the native convention, handlizes
  2479 // java compiled calling convention to the native convention, handlizes
  2480 // arguments, and transitions to native.  On return from the native we transition
  2480 // arguments, and transitions to native.  On return from the native we transition
  2481 // back to java blocking if a safepoint is in progress.
  2481 // back to java blocking if a safepoint is in progress.
  2482 nmethod *AdapterHandlerLibrary::create_native_wrapper(methodHandle method) {
  2482 nmethod *AdapterHandlerLibrary::create_native_wrapper(methodHandle method, int compile_id) {
  2483   ResourceMark rm;
  2483   ResourceMark rm;
  2484   nmethod* nm = NULL;
  2484   nmethod* nm = NULL;
  2485 
       
  2486   if (PrintCompilation) {
       
  2487     ttyLocker ttyl;
       
  2488     tty->print("---   n%s ", (method->is_synchronized() ? "s" : " "));
       
  2489     method->print_short_name(tty);
       
  2490     if (method->is_static()) {
       
  2491       tty->print(" (static)");
       
  2492     }
       
  2493     tty->cr();
       
  2494   }
       
  2495 
  2485 
  2496   assert(method->has_native_function(), "must have something valid to call!");
  2486   assert(method->has_native_function(), "must have something valid to call!");
  2497 
  2487 
  2498   {
  2488   {
  2499     // perform the work while holding the lock, but perform any printing outside the lock
  2489     // perform the work while holding the lock, but perform any printing outside the lock
  2535       comp_args_on_stack = SharedRuntime::java_calling_convention(sig_bt, regs, total_args_passed, false);
  2525       comp_args_on_stack = SharedRuntime::java_calling_convention(sig_bt, regs, total_args_passed, false);
  2536 
  2526 
  2537       // Generate the compiled-to-native wrapper code
  2527       // Generate the compiled-to-native wrapper code
  2538       nm = SharedRuntime::generate_native_wrapper(&_masm,
  2528       nm = SharedRuntime::generate_native_wrapper(&_masm,
  2539                                                   method,
  2529                                                   method,
       
  2530                                                   compile_id,
  2540                                                   total_args_passed,
  2531                                                   total_args_passed,
  2541                                                   comp_args_on_stack,
  2532                                                   comp_args_on_stack,
  2542                                                   sig_bt,regs,
  2533                                                   sig_bt,regs,
  2543                                                   ret_type);
  2534                                                   ret_type);
  2544     }
  2535     }
  2546 
  2537 
  2547   // Must unlock before calling set_code
  2538   // Must unlock before calling set_code
  2548 
  2539 
  2549   // Install the generated code.
  2540   // Install the generated code.
  2550   if (nm != NULL) {
  2541   if (nm != NULL) {
       
  2542     if (PrintCompilation) {
       
  2543       ttyLocker ttyl;
       
  2544       CompileTask::print_compilation(tty, nm, method->is_static() ? "(static)" : "");
       
  2545     }
  2551     method->set_code(method, nm);
  2546     method->set_code(method, nm);
  2552     nm->post_compiled_method_load_event();
  2547     nm->post_compiled_method_load_event();
  2553   } else {
  2548   } else {
  2554     // CodeCache is full, disable compilation
  2549     // CodeCache is full, disable compilation
  2555     CompileBroker::handle_full_code_cache();
  2550     CompileBroker::handle_full_code_cache();