src/share/vm/opto/library_call.cpp

Print this page




 320   case vmIntrinsics::_copyOfRange:
 321     if (!InlineObjectCopy)  return NULL;
 322     // These also use the arraycopy intrinsic mechanism:
 323     if (!InlineArrayCopy)  return NULL;
 324     break;
 325   case vmIntrinsics::_checkIndex:
 326     // We do not intrinsify this.  The optimizer does fine with it.
 327     return NULL;
 328 
 329   case vmIntrinsics::_get_AtomicLong:
 330   case vmIntrinsics::_attemptUpdate:
 331     if (!InlineAtomicLong)  return NULL;
 332     break;
 333 
 334   case vmIntrinsics::_getCallerClass:
 335     if (!UseNewReflection)  return NULL;
 336     if (!InlineReflectionGetCallerClass)  return NULL;
 337     if (!JDK_Version::is_gte_jdk14x_version())  return NULL;
 338     break;
 339 
 340   case vmIntrinsics::_bitCount_i:
 341   case vmIntrinsics::_bitCount_l:
 342     if (!UsePopCountInstruction)  return NULL;
 343     break;
 344 
 345   case vmIntrinsics::_Reference_get:
 346     // It is only when G1 is enabled that we absolutely
 347     // need to use the intrinsic version of Reference.get()
 348     // so that the value in the referent field, if necessary,
 349     // can be registered by the pre-barrier code.
 350     if (!UseG1GC) return NULL;
 351     break;
 352 
 353  default:
 354     assert(id <= vmIntrinsics::LAST_COMPILER_INLINE, "caller responsibility");
 355     assert(id != vmIntrinsics::_Object_init && id != vmIntrinsics::_invoke, "enum out of order?");
 356     break;
 357   }
 358 
 359   // -XX:-InlineClassNatives disables natives from the Class class.
 360   // The flag applies to all reflective calls, notably Array.newArray
 361   // (visible to Java programmers as Array.newInstance).
 362   if (m->holder()->name() == ciSymbol::java_lang_Class() ||
 363       m->holder()->name() == ciSymbol::java_lang_reflect_Array()) {
 364     if (!InlineClassNatives)  return NULL;


 399     char buf[1000];
 400     const char* str = vmIntrinsics::short_name_as_C_string(intrinsic_id(), buf, sizeof(buf));
 401     tty->print_cr("Intrinsic %s", str);
 402   }
 403 #endif
 404 
 405   if (kit.try_to_inline()) {
 406     if (PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) {
 407       CompileTask::print_inlining(kit.callee(), jvms->depth() - 1, kit.bci(), is_virtual() ? "(intrinsic, virtual)" : "(intrinsic)");
 408     }
 409     C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_worked);
 410     if (C->log()) {
 411       C->log()->elem("intrinsic id='%s'%s nodes='%d'",
 412                      vmIntrinsics::name_at(intrinsic_id()),
 413                      (is_virtual() ? " virtual='1'" : ""),
 414                      C->unique() - nodes);
 415     }
 416     return kit.transfer_exceptions_into_jvms();
 417   }
 418 
 419   if (PrintIntrinsics) {


 420     if (jvms->has_method()) {
 421       // Not a root compile.
 422       tty->print("Did not inline intrinsic %s%s at bci:%d in",
 423                  vmIntrinsics::name_at(intrinsic_id()),
 424                  (is_virtual() ? " (virtual)" : ""), kit.bci());
 425       kit.caller()->print_short_name(tty);
 426       tty->print_cr(" (%d bytes)", kit.caller()->code_size());
 427     } else {
 428       // Root compile
 429       tty->print("Did not generate intrinsic %s%s at bci:%d in",
 430                vmIntrinsics::name_at(intrinsic_id()),
 431                (is_virtual() ? " (virtual)" : ""), kit.bci());
 432     }
 433   }
 434   C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_failed);
 435   return NULL;
 436 }
 437 
 438 bool LibraryCallKit::try_to_inline() {
 439   // Handle symbolic names for otherwise undistinguished boolean switches:
 440   const bool is_store       = true;
 441   const bool is_native_ptr  = true;
 442   const bool is_static      = true;
 443 
 444   if (!jvms()->has_method()) {
 445     // Root JVMState has a null method.
 446     assert(map()->memory()->Opcode() == Op_Parm, "");




 320   case vmIntrinsics::_copyOfRange:
 321     if (!InlineObjectCopy)  return NULL;
 322     // These also use the arraycopy intrinsic mechanism:
 323     if (!InlineArrayCopy)  return NULL;
 324     break;
 325   case vmIntrinsics::_checkIndex:
 326     // We do not intrinsify this.  The optimizer does fine with it.
 327     return NULL;
 328 
 329   case vmIntrinsics::_get_AtomicLong:
 330   case vmIntrinsics::_attemptUpdate:
 331     if (!InlineAtomicLong)  return NULL;
 332     break;
 333 
 334   case vmIntrinsics::_getCallerClass:
 335     if (!UseNewReflection)  return NULL;
 336     if (!InlineReflectionGetCallerClass)  return NULL;
 337     if (!JDK_Version::is_gte_jdk14x_version())  return NULL;
 338     break;
 339 





 340   case vmIntrinsics::_Reference_get:
 341     // It is only when G1 is enabled that we absolutely
 342     // need to use the intrinsic version of Reference.get()
 343     // so that the value in the referent field, if necessary,
 344     // can be registered by the pre-barrier code.
 345     if (!UseG1GC) return NULL;
 346     break;
 347 
 348  default:
 349     assert(id <= vmIntrinsics::LAST_COMPILER_INLINE, "caller responsibility");
 350     assert(id != vmIntrinsics::_Object_init && id != vmIntrinsics::_invoke, "enum out of order?");
 351     break;
 352   }
 353 
 354   // -XX:-InlineClassNatives disables natives from the Class class.
 355   // The flag applies to all reflective calls, notably Array.newArray
 356   // (visible to Java programmers as Array.newInstance).
 357   if (m->holder()->name() == ciSymbol::java_lang_Class() ||
 358       m->holder()->name() == ciSymbol::java_lang_reflect_Array()) {
 359     if (!InlineClassNatives)  return NULL;


 394     char buf[1000];
 395     const char* str = vmIntrinsics::short_name_as_C_string(intrinsic_id(), buf, sizeof(buf));
 396     tty->print_cr("Intrinsic %s", str);
 397   }
 398 #endif
 399 
 400   if (kit.try_to_inline()) {
 401     if (PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) {
 402       CompileTask::print_inlining(kit.callee(), jvms->depth() - 1, kit.bci(), is_virtual() ? "(intrinsic, virtual)" : "(intrinsic)");
 403     }
 404     C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_worked);
 405     if (C->log()) {
 406       C->log()->elem("intrinsic id='%s'%s nodes='%d'",
 407                      vmIntrinsics::name_at(intrinsic_id()),
 408                      (is_virtual() ? " virtual='1'" : ""),
 409                      C->unique() - nodes);
 410     }
 411     return kit.transfer_exceptions_into_jvms();
 412   }
 413 
 414   // The intrinsic bailed out
 415   if (PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) {
 416     const char* msg = is_virtual() ? "failed to inline (intrinsic, virtual)" : "failed to inline (intrinsic)";
 417     if (jvms->has_method()) {
 418       // Not a root compile.
 419       CompileTask::print_inlining(kit.callee(), jvms->depth() - 1, kit.bci(), msg);




 420     } else {
 421       // Root compile
 422       tty->print("Did not generate intrinsic %s%s at bci:%d in",
 423                vmIntrinsics::name_at(intrinsic_id()),
 424                (is_virtual() ? " (virtual)" : ""), kit.bci());
 425     }
 426   }
 427   C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_failed);
 428   return NULL;
 429 }
 430 
 431 bool LibraryCallKit::try_to_inline() {
 432   // Handle symbolic names for otherwise undistinguished boolean switches:
 433   const bool is_store       = true;
 434   const bool is_native_ptr  = true;
 435   const bool is_static      = true;
 436 
 437   if (!jvms()->has_method()) {
 438     // Root JVMState has a null method.
 439     assert(map()->memory()->Opcode() == Op_Parm, "");