3454 if ( callee->is_native()) return "native method"; 3455 if ( callee->is_abstract()) return "abstract method"; 3456 if (!callee->can_be_compiled()) return "not compilable (disabled)"; 3457 if (!callee->can_be_parsed()) return "cannot be parsed"; 3458 return NULL; 3459 } 3460 3461 // negative filter: should callee NOT be inlined? returns NULL, ok to inline, or rejection msg 3462 const char* GraphBuilder::should_not_inline(ciMethod* callee) const { 3463 if ( compilation()->directive()->should_not_inline(callee)) return "disallowed by CompileCommand"; 3464 if ( callee->dont_inline()) return "don't inline by annotation"; 3465 return NULL; 3466 } 3467 3468 void GraphBuilder::build_graph_for_intrinsic(ciMethod* callee, bool ignore_return) { 3469 vmIntrinsics::ID id = callee->intrinsic_id(); 3470 assert(id != vmIntrinsics::_none, "must be a VM intrinsic"); 3471 3472 // Some intrinsics need special IR nodes. 3473 switch(id) { 3474 case vmIntrinsics::_getObject : append_unsafe_get_obj(callee, T_OBJECT, false); return; 3475 case vmIntrinsics::_getBoolean : append_unsafe_get_obj(callee, T_BOOLEAN, false); return; 3476 case vmIntrinsics::_getByte : append_unsafe_get_obj(callee, T_BYTE, false); return; 3477 case vmIntrinsics::_getShort : append_unsafe_get_obj(callee, T_SHORT, false); return; 3478 case vmIntrinsics::_getChar : append_unsafe_get_obj(callee, T_CHAR, false); return; 3479 case vmIntrinsics::_getInt : append_unsafe_get_obj(callee, T_INT, false); return; 3480 case vmIntrinsics::_getLong : append_unsafe_get_obj(callee, T_LONG, false); return; 3481 case vmIntrinsics::_getFloat : append_unsafe_get_obj(callee, T_FLOAT, false); return; 3482 case vmIntrinsics::_getDouble : append_unsafe_get_obj(callee, T_DOUBLE, false); return; 3483 case vmIntrinsics::_putObject : append_unsafe_put_obj(callee, T_OBJECT, false); return; 3484 case vmIntrinsics::_putBoolean : append_unsafe_put_obj(callee, T_BOOLEAN, false); return; 3485 case vmIntrinsics::_putByte : append_unsafe_put_obj(callee, T_BYTE, false); return; 3486 case vmIntrinsics::_putShort : append_unsafe_put_obj(callee, T_SHORT, false); return; 3487 case vmIntrinsics::_putChar : append_unsafe_put_obj(callee, T_CHAR, false); return; 3488 case vmIntrinsics::_putInt : append_unsafe_put_obj(callee, T_INT, false); return; 3489 case vmIntrinsics::_putLong : append_unsafe_put_obj(callee, T_LONG, false); return; 3490 case vmIntrinsics::_putFloat : append_unsafe_put_obj(callee, T_FLOAT, false); return; 3491 case vmIntrinsics::_putDouble : append_unsafe_put_obj(callee, T_DOUBLE, false); return; 3492 case vmIntrinsics::_getShortUnaligned : append_unsafe_get_obj(callee, T_SHORT, false); return; 3493 case vmIntrinsics::_getCharUnaligned : append_unsafe_get_obj(callee, T_CHAR, false); return; 3494 case vmIntrinsics::_getIntUnaligned : append_unsafe_get_obj(callee, T_INT, false); return; 3495 case vmIntrinsics::_getLongUnaligned : append_unsafe_get_obj(callee, T_LONG, false); return; 3496 case vmIntrinsics::_putShortUnaligned : append_unsafe_put_obj(callee, T_SHORT, false); return; 3497 case vmIntrinsics::_putCharUnaligned : append_unsafe_put_obj(callee, T_CHAR, false); return; 3498 case vmIntrinsics::_putIntUnaligned : append_unsafe_put_obj(callee, T_INT, false); return; 3499 case vmIntrinsics::_putLongUnaligned : append_unsafe_put_obj(callee, T_LONG, false); return; 3500 case vmIntrinsics::_getObjectVolatile : append_unsafe_get_obj(callee, T_OBJECT, true); return; 3501 case vmIntrinsics::_getBooleanVolatile : append_unsafe_get_obj(callee, T_BOOLEAN, true); return; 3502 case vmIntrinsics::_getByteVolatile : append_unsafe_get_obj(callee, T_BYTE, true); return; 3503 case vmIntrinsics::_getShortVolatile : append_unsafe_get_obj(callee, T_SHORT, true); return; 3504 case vmIntrinsics::_getCharVolatile : append_unsafe_get_obj(callee, T_CHAR, true); return; 3505 case vmIntrinsics::_getIntVolatile : append_unsafe_get_obj(callee, T_INT, true); return; 3506 case vmIntrinsics::_getLongVolatile : append_unsafe_get_obj(callee, T_LONG, true); return; 3507 case vmIntrinsics::_getFloatVolatile : append_unsafe_get_obj(callee, T_FLOAT, true); return; 3508 case vmIntrinsics::_getDoubleVolatile : append_unsafe_get_obj(callee, T_DOUBLE, true); return; 3509 case vmIntrinsics::_putObjectVolatile : append_unsafe_put_obj(callee, T_OBJECT, true); return; 3510 case vmIntrinsics::_putBooleanVolatile : append_unsafe_put_obj(callee, T_BOOLEAN, true); return; 3511 case vmIntrinsics::_putByteVolatile : append_unsafe_put_obj(callee, T_BYTE, true); return; 3512 case vmIntrinsics::_putShortVolatile : append_unsafe_put_obj(callee, T_SHORT, true); return; 3513 case vmIntrinsics::_putCharVolatile : append_unsafe_put_obj(callee, T_CHAR, true); return; 3514 case vmIntrinsics::_putIntVolatile : append_unsafe_put_obj(callee, T_INT, true); return; 3515 case vmIntrinsics::_putLongVolatile : append_unsafe_put_obj(callee, T_LONG, true); return; 3516 case vmIntrinsics::_putFloatVolatile : append_unsafe_put_obj(callee, T_FLOAT, true); return; 3517 case vmIntrinsics::_putDoubleVolatile : append_unsafe_put_obj(callee, T_DOUBLE, true); return; 3518 case vmIntrinsics::_compareAndSetLong: 3519 case vmIntrinsics::_compareAndSetInt: 3520 case vmIntrinsics::_compareAndSetObject: append_unsafe_CAS(callee); return; 3521 case vmIntrinsics::_getAndAddInt: 3522 case vmIntrinsics::_getAndAddLong : append_unsafe_get_and_set_obj(callee, true); return; 3523 case vmIntrinsics::_getAndSetInt : 3524 case vmIntrinsics::_getAndSetLong : 3525 case vmIntrinsics::_getAndSetObject : append_unsafe_get_and_set_obj(callee, false); return; 3526 case vmIntrinsics::_getCharStringU : append_char_access(callee, false); return; 3527 case vmIntrinsics::_putCharStringU : append_char_access(callee, true); return; 3528 default: 3529 break; 3530 } 3531 3532 // create intrinsic node 3533 const bool has_receiver = !callee->is_static(); 3534 ValueType* result_type = as_ValueType(callee->return_type()); 3535 ValueStack* state_before = copy_state_for_exception(); 3536 3537 Values* args = state()->pop_arguments(callee->arg_size()); 3538 3539 if (is_profiling()) { 3540 // Don't profile in the special case where the root method 3541 // is the intrinsic 3542 if (callee != method()) { 3543 // Note that we'd collect profile data in this method if we wanted it. 3544 compilation()->set_would_profile(true); 3545 if (profile_calls()) { | 3454 if ( callee->is_native()) return "native method"; 3455 if ( callee->is_abstract()) return "abstract method"; 3456 if (!callee->can_be_compiled()) return "not compilable (disabled)"; 3457 if (!callee->can_be_parsed()) return "cannot be parsed"; 3458 return NULL; 3459 } 3460 3461 // negative filter: should callee NOT be inlined? returns NULL, ok to inline, or rejection msg 3462 const char* GraphBuilder::should_not_inline(ciMethod* callee) const { 3463 if ( compilation()->directive()->should_not_inline(callee)) return "disallowed by CompileCommand"; 3464 if ( callee->dont_inline()) return "don't inline by annotation"; 3465 return NULL; 3466 } 3467 3468 void GraphBuilder::build_graph_for_intrinsic(ciMethod* callee, bool ignore_return) { 3469 vmIntrinsics::ID id = callee->intrinsic_id(); 3470 assert(id != vmIntrinsics::_none, "must be a VM intrinsic"); 3471 3472 // Some intrinsics need special IR nodes. 3473 switch(id) { 3474 case vmIntrinsics::_getReference : append_unsafe_get_obj(callee, T_OBJECT, false); return; 3475 case vmIntrinsics::_getBoolean : append_unsafe_get_obj(callee, T_BOOLEAN, false); return; 3476 case vmIntrinsics::_getByte : append_unsafe_get_obj(callee, T_BYTE, false); return; 3477 case vmIntrinsics::_getShort : append_unsafe_get_obj(callee, T_SHORT, false); return; 3478 case vmIntrinsics::_getChar : append_unsafe_get_obj(callee, T_CHAR, false); return; 3479 case vmIntrinsics::_getInt : append_unsafe_get_obj(callee, T_INT, false); return; 3480 case vmIntrinsics::_getLong : append_unsafe_get_obj(callee, T_LONG, false); return; 3481 case vmIntrinsics::_getFloat : append_unsafe_get_obj(callee, T_FLOAT, false); return; 3482 case vmIntrinsics::_getDouble : append_unsafe_get_obj(callee, T_DOUBLE, false); return; 3483 case vmIntrinsics::_putReference : append_unsafe_put_obj(callee, T_OBJECT, false); return; 3484 case vmIntrinsics::_putBoolean : append_unsafe_put_obj(callee, T_BOOLEAN, false); return; 3485 case vmIntrinsics::_putByte : append_unsafe_put_obj(callee, T_BYTE, false); return; 3486 case vmIntrinsics::_putShort : append_unsafe_put_obj(callee, T_SHORT, false); return; 3487 case vmIntrinsics::_putChar : append_unsafe_put_obj(callee, T_CHAR, false); return; 3488 case vmIntrinsics::_putInt : append_unsafe_put_obj(callee, T_INT, false); return; 3489 case vmIntrinsics::_putLong : append_unsafe_put_obj(callee, T_LONG, false); return; 3490 case vmIntrinsics::_putFloat : append_unsafe_put_obj(callee, T_FLOAT, false); return; 3491 case vmIntrinsics::_putDouble : append_unsafe_put_obj(callee, T_DOUBLE, false); return; 3492 case vmIntrinsics::_getShortUnaligned : append_unsafe_get_obj(callee, T_SHORT, false); return; 3493 case vmIntrinsics::_getCharUnaligned : append_unsafe_get_obj(callee, T_CHAR, false); return; 3494 case vmIntrinsics::_getIntUnaligned : append_unsafe_get_obj(callee, T_INT, false); return; 3495 case vmIntrinsics::_getLongUnaligned : append_unsafe_get_obj(callee, T_LONG, false); return; 3496 case vmIntrinsics::_putShortUnaligned : append_unsafe_put_obj(callee, T_SHORT, false); return; 3497 case vmIntrinsics::_putCharUnaligned : append_unsafe_put_obj(callee, T_CHAR, false); return; 3498 case vmIntrinsics::_putIntUnaligned : append_unsafe_put_obj(callee, T_INT, false); return; 3499 case vmIntrinsics::_putLongUnaligned : append_unsafe_put_obj(callee, T_LONG, false); return; 3500 case vmIntrinsics::_getReferenceVolatile : append_unsafe_get_obj(callee, T_OBJECT, true); return; 3501 case vmIntrinsics::_getBooleanVolatile : append_unsafe_get_obj(callee, T_BOOLEAN, true); return; 3502 case vmIntrinsics::_getByteVolatile : append_unsafe_get_obj(callee, T_BYTE, true); return; 3503 case vmIntrinsics::_getShortVolatile : append_unsafe_get_obj(callee, T_SHORT, true); return; 3504 case vmIntrinsics::_getCharVolatile : append_unsafe_get_obj(callee, T_CHAR, true); return; 3505 case vmIntrinsics::_getIntVolatile : append_unsafe_get_obj(callee, T_INT, true); return; 3506 case vmIntrinsics::_getLongVolatile : append_unsafe_get_obj(callee, T_LONG, true); return; 3507 case vmIntrinsics::_getFloatVolatile : append_unsafe_get_obj(callee, T_FLOAT, true); return; 3508 case vmIntrinsics::_getDoubleVolatile : append_unsafe_get_obj(callee, T_DOUBLE, true); return; 3509 case vmIntrinsics::_putReferenceVolatile : append_unsafe_put_obj(callee, T_OBJECT, true); return; 3510 case vmIntrinsics::_putBooleanVolatile : append_unsafe_put_obj(callee, T_BOOLEAN, true); return; 3511 case vmIntrinsics::_putByteVolatile : append_unsafe_put_obj(callee, T_BYTE, true); return; 3512 case vmIntrinsics::_putShortVolatile : append_unsafe_put_obj(callee, T_SHORT, true); return; 3513 case vmIntrinsics::_putCharVolatile : append_unsafe_put_obj(callee, T_CHAR, true); return; 3514 case vmIntrinsics::_putIntVolatile : append_unsafe_put_obj(callee, T_INT, true); return; 3515 case vmIntrinsics::_putLongVolatile : append_unsafe_put_obj(callee, T_LONG, true); return; 3516 case vmIntrinsics::_putFloatVolatile : append_unsafe_put_obj(callee, T_FLOAT, true); return; 3517 case vmIntrinsics::_putDoubleVolatile : append_unsafe_put_obj(callee, T_DOUBLE, true); return; 3518 case vmIntrinsics::_compareAndSetLong: 3519 case vmIntrinsics::_compareAndSetInt: 3520 case vmIntrinsics::_compareAndSetReference : append_unsafe_CAS(callee); return; 3521 case vmIntrinsics::_getAndAddInt: 3522 case vmIntrinsics::_getAndAddLong : append_unsafe_get_and_set_obj(callee, true); return; 3523 case vmIntrinsics::_getAndSetInt : 3524 case vmIntrinsics::_getAndSetLong : 3525 case vmIntrinsics::_getAndSetReference : append_unsafe_get_and_set_obj(callee, false); return; 3526 case vmIntrinsics::_getCharStringU : append_char_access(callee, false); return; 3527 case vmIntrinsics::_putCharStringU : append_char_access(callee, true); return; 3528 default: 3529 break; 3530 } 3531 3532 // create intrinsic node 3533 const bool has_receiver = !callee->is_static(); 3534 ValueType* result_type = as_ValueType(callee->return_type()); 3535 ValueStack* state_before = copy_state_for_exception(); 3536 3537 Values* args = state()->pop_arguments(callee->arg_size()); 3538 3539 if (is_profiling()) { 3540 // Don't profile in the special case where the root method 3541 // is the intrinsic 3542 if (callee != method()) { 3543 // Note that we'd collect profile data in this method if we wanted it. 3544 compilation()->set_would_profile(true); 3545 if (profile_calls()) { |