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() ||
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, "");
|
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 if (!Matcher::has_match_rule(Op_PopCountI)) return NULL;
342 break;
343
344 case vmIntrinsics::_bitCount_l:
345 if (!Matcher::has_match_rule(Op_PopCountL)) return NULL;
346 break;
347
348 case vmIntrinsics::_numberOfLeadingZeros_i:
349 if (!Matcher::match_rule_supported(Op_CountLeadingZerosI)) return NULL;
350 break;
351
352 case vmIntrinsics::_numberOfLeadingZeros_l:
353 if (!Matcher::match_rule_supported(Op_CountLeadingZerosL)) return NULL;
354 break;
355
356 case vmIntrinsics::_numberOfTrailingZeros_i:
357 if (!Matcher::match_rule_supported(Op_CountTrailingZerosI)) return NULL;
358 break;
359
360 case vmIntrinsics::_numberOfTrailingZeros_l:
361 if (!Matcher::match_rule_supported(Op_CountTrailingZerosL)) return NULL;
362 break;
363
364 case vmIntrinsics::_Reference_get:
365 // It is only when G1 is enabled that we absolutely
366 // need to use the intrinsic version of Reference.get()
367 // so that the value in the referent field, if necessary,
368 // can be registered by the pre-barrier code.
369 if (!UseG1GC) return NULL;
370 break;
371
372 default:
373 assert(id <= vmIntrinsics::LAST_COMPILER_INLINE, "caller responsibility");
374 assert(id != vmIntrinsics::_Object_init && id != vmIntrinsics::_invoke, "enum out of order?");
375 break;
376 }
377
378 // -XX:-InlineClassNatives disables natives from the Class class.
379 // The flag applies to all reflective calls, notably Array.newArray
380 // (visible to Java programmers as Array.newInstance).
381 if (m->holder()->name() == ciSymbol::java_lang_Class() ||
418 char buf[1000];
419 const char* str = vmIntrinsics::short_name_as_C_string(intrinsic_id(), buf, sizeof(buf));
420 tty->print_cr("Intrinsic %s", str);
421 }
422 #endif
423
424 if (kit.try_to_inline()) {
425 if (PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) {
426 CompileTask::print_inlining(kit.callee(), jvms->depth() - 1, kit.bci(), is_virtual() ? "(intrinsic, virtual)" : "(intrinsic)");
427 }
428 C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_worked);
429 if (C->log()) {
430 C->log()->elem("intrinsic id='%s'%s nodes='%d'",
431 vmIntrinsics::name_at(intrinsic_id()),
432 (is_virtual() ? " virtual='1'" : ""),
433 C->unique() - nodes);
434 }
435 return kit.transfer_exceptions_into_jvms();
436 }
437
438 // The intrinsic bailed out
439 if (PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) {
440 const char* msg = is_virtual() ? "failed to inline (intrinsic, virtual)" : "failed to inline (intrinsic)";
441 if (jvms->has_method()) {
442 // Not a root compile.
443 CompileTask::print_inlining(kit.callee(), jvms->depth() - 1, kit.bci(), msg);
444 } else {
445 // Root compile
446 tty->print("Did not generate intrinsic %s%s at bci:%d in",
447 vmIntrinsics::name_at(intrinsic_id()),
448 (is_virtual() ? " (virtual)" : ""), kit.bci());
449 }
450 }
451 C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_failed);
452 return NULL;
453 }
454
455 bool LibraryCallKit::try_to_inline() {
456 // Handle symbolic names for otherwise undistinguished boolean switches:
457 const bool is_store = true;
458 const bool is_native_ptr = true;
459 const bool is_static = true;
460
461 if (!jvms()->has_method()) {
462 // Root JVMState has a null method.
463 assert(map()->memory()->Opcode() == Op_Parm, "");
|