src/hotspot/share/runtime/sharedRuntime.cpp
changeset 57710 05ff6e27de45
parent 57584 9d82a35b6ff7
child 57777 90ead0febf56
equal deleted inserted replaced
57709:155b084cf384 57710:05ff6e27de45
  2847  * back to java blocking if a safepoint is in progress.
  2847  * back to java blocking if a safepoint is in progress.
  2848  */
  2848  */
  2849 void AdapterHandlerLibrary::create_native_wrapper(const methodHandle& method) {
  2849 void AdapterHandlerLibrary::create_native_wrapper(const methodHandle& method) {
  2850   ResourceMark rm;
  2850   ResourceMark rm;
  2851   nmethod* nm = NULL;
  2851   nmethod* nm = NULL;
       
  2852   address critical_entry = NULL;
  2852 
  2853 
  2853   assert(method->is_native(), "must be native");
  2854   assert(method->is_native(), "must be native");
  2854   assert(method->is_method_handle_intrinsic() ||
  2855   assert(method->is_method_handle_intrinsic() ||
  2855          method->has_native_function(), "must have something valid to call!");
  2856          method->has_native_function(), "must have something valid to call!");
       
  2857 
       
  2858   if (CriticalJNINatives && !method->is_method_handle_intrinsic()) {
       
  2859     // We perform the I/O with transition to native before acquiring AdapterHandlerLibrary_lock.
       
  2860     critical_entry = NativeLookup::lookup_critical_entry(method);
       
  2861   }
  2856 
  2862 
  2857   {
  2863   {
  2858     // Perform the work while holding the lock, but perform any printing outside the lock
  2864     // Perform the work while holding the lock, but perform any printing outside the lock
  2859     MutexLocker mu(AdapterHandlerLibrary_lock);
  2865     MutexLocker mu(AdapterHandlerLibrary_lock);
  2860     // See if somebody beat us to it
  2866     // See if somebody beat us to it
  2896       // are just trampolines so the argument registers must be outgoing ones.
  2902       // are just trampolines so the argument registers must be outgoing ones.
  2897       const bool is_outgoing = method->is_method_handle_intrinsic();
  2903       const bool is_outgoing = method->is_method_handle_intrinsic();
  2898       int comp_args_on_stack = SharedRuntime::java_calling_convention(sig_bt, regs, total_args_passed, is_outgoing);
  2904       int comp_args_on_stack = SharedRuntime::java_calling_convention(sig_bt, regs, total_args_passed, is_outgoing);
  2899 
  2905 
  2900       // Generate the compiled-to-native wrapper code
  2906       // Generate the compiled-to-native wrapper code
  2901       nm = SharedRuntime::generate_native_wrapper(&_masm, method, compile_id, sig_bt, regs, ret_type);
  2907       nm = SharedRuntime::generate_native_wrapper(&_masm, method, compile_id, sig_bt, regs, ret_type, critical_entry);
  2902 
  2908 
  2903       if (nm != NULL) {
  2909       if (nm != NULL) {
  2904         method->set_code(method, nm);
  2910         method->set_code(method, nm);
  2905 
  2911 
  2906         DirectiveSet* directive = DirectivesStack::getDefaultDirective(CompileBroker::compiler(CompLevel_simple));
  2912         DirectiveSet* directive = DirectivesStack::getDefaultDirective(CompileBroker::compiler(CompLevel_simple));