equal
deleted
inserted
replaced
109 _is_c1_compilable = false; |
109 _is_c1_compilable = false; |
110 _is_c2_compilable = false; |
110 _is_c2_compilable = false; |
111 _can_be_parsed = false; |
111 _can_be_parsed = false; |
112 } |
112 } |
113 } else { |
113 } else { |
114 CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops()); |
114 DEBUG_ONLY(CompilerThread::current()->check_possible_safepoint()); |
115 } |
115 } |
116 |
116 |
117 if (h_m()->method_holder()->is_linked()) { |
117 if (h_m()->method_holder()->is_linked()) { |
118 _can_be_statically_bound = h_m()->can_be_statically_bound(); |
118 _can_be_statically_bound = h_m()->can_be_statically_bound(); |
119 } else { |
119 } else { |
460 } |
460 } |
461 #endif // COMPILER1 |
461 #endif // COMPILER1 |
462 |
462 |
463 |
463 |
464 // ------------------------------------------------------------------ |
464 // ------------------------------------------------------------------ |
|
465 // ciMethod::check_overflow |
|
466 // |
|
467 // Check whether the profile counter is overflowed and adjust if true. |
|
468 // For invoke* it will turn negative values into max_jint, |
|
469 // and for checkcast/aastore/instanceof turn positive values into min_jint. |
|
470 int ciMethod::check_overflow(int c, Bytecodes::Code code) { |
|
471 switch (code) { |
|
472 case Bytecodes::_aastore: // fall-through |
|
473 case Bytecodes::_checkcast: // fall-through |
|
474 case Bytecodes::_instanceof: { |
|
475 return (c > 0 ? min_jint : c); // always non-positive |
|
476 } |
|
477 default: { |
|
478 assert(Bytecodes::is_invoke(code), "%s", Bytecodes::name(code)); |
|
479 return (c < 0 ? max_jint : c); // always non-negative |
|
480 } |
|
481 } |
|
482 } |
|
483 |
|
484 |
|
485 // ------------------------------------------------------------------ |
465 // ciMethod::call_profile_at_bci |
486 // ciMethod::call_profile_at_bci |
466 // |
487 // |
467 // Get the ciCallProfile for the invocation of this method. |
488 // Get the ciCallProfile for the invocation of this method. |
468 // Also reports receiver types for non-call type checks (if TypeProfileCasts). |
489 // Also reports receiver types for non-call type checks (if TypeProfileCasts). |
469 ciCallProfile ciMethod::call_profile_at_bci(int bci) { |
490 ciCallProfile ciMethod::call_profile_at_bci(int bci) { |
471 ciCallProfile result; |
492 ciCallProfile result; |
472 if (method_data() != NULL && method_data()->is_mature()) { |
493 if (method_data() != NULL && method_data()->is_mature()) { |
473 ciProfileData* data = method_data()->bci_to_data(bci); |
494 ciProfileData* data = method_data()->bci_to_data(bci); |
474 if (data != NULL && data->is_CounterData()) { |
495 if (data != NULL && data->is_CounterData()) { |
475 // Every profiled call site has a counter. |
496 // Every profiled call site has a counter. |
476 int count = data->as_CounterData()->count(); |
497 int count = check_overflow(data->as_CounterData()->count(), java_code_at_bci(bci)); |
477 |
498 |
478 if (!data->is_ReceiverTypeData()) { |
499 if (!data->is_ReceiverTypeData()) { |
479 result._receiver_count[0] = 0; // that's a definite zero |
500 result._receiver_count[0] = 0; // that's a definite zero |
480 } else { // ReceiverTypeData is a subclass of CounterData |
501 } else { // ReceiverTypeData is a subclass of CounterData |
481 ciReceiverTypeData* call = (ciReceiverTypeData*)data->as_ReceiverTypeData(); |
502 ciReceiverTypeData* call = (ciReceiverTypeData*)data->as_ReceiverTypeData(); |
500 } |
521 } |
501 } |
522 } |
502 for (uint i = 0; i < call->row_limit(); i++) { |
523 for (uint i = 0; i < call->row_limit(); i++) { |
503 ciKlass* receiver = call->receiver(i); |
524 ciKlass* receiver = call->receiver(i); |
504 if (receiver == NULL) continue; |
525 if (receiver == NULL) continue; |
505 int rcount = call->receiver_count(i) + epsilon; |
526 int rcount = saturated_add(call->receiver_count(i), epsilon); |
506 if (rcount == 0) rcount = 1; // Should be valid value |
527 if (rcount == 0) rcount = 1; // Should be valid value |
507 receivers_count_total += rcount; |
528 receivers_count_total = saturated_add(receivers_count_total, rcount); |
508 // Add the receiver to result data. |
529 // Add the receiver to result data. |
509 result.add_receiver(receiver, rcount); |
530 result.add_receiver(receiver, rcount); |
510 // If we extend profiling to record methods, |
531 // If we extend profiling to record methods, |
511 // we will set result._method also. |
532 // we will set result._method also. |
512 } |
533 } |
532 // Make the count consistent if this is a call profile. If count is |
553 // Make the count consistent if this is a call profile. If count is |
533 // zero or less, presume that this is a typecheck profile and |
554 // zero or less, presume that this is a typecheck profile and |
534 // do nothing. Otherwise, increase count to be the sum of all |
555 // do nothing. Otherwise, increase count to be the sum of all |
535 // receiver's counts. |
556 // receiver's counts. |
536 if (count >= 0) { |
557 if (count >= 0) { |
537 count += receivers_count_total; |
558 count = saturated_add(count, receivers_count_total); |
538 } |
559 } |
539 } |
560 } |
540 result._count = count; |
561 result._count = count; |
541 } |
562 } |
542 } |
563 } |
931 check_is_loaded(); |
952 check_is_loaded(); |
932 VM_ENTRY_MARK; |
953 VM_ENTRY_MARK; |
933 return get_Method()->is_ignored_by_security_stack_walk(); |
954 return get_Method()->is_ignored_by_security_stack_walk(); |
934 } |
955 } |
935 |
956 |
|
957 // ------------------------------------------------------------------ |
|
958 // ciMethod::needs_clinit_barrier |
|
959 // |
|
960 bool ciMethod::needs_clinit_barrier() const { |
|
961 check_is_loaded(); |
|
962 return is_static() && !holder()->is_initialized(); |
|
963 } |
936 |
964 |
937 // ------------------------------------------------------------------ |
965 // ------------------------------------------------------------------ |
938 // invokedynamic support |
966 // invokedynamic support |
939 |
967 |
940 // ------------------------------------------------------------------ |
968 // ------------------------------------------------------------------ |
1102 if (is_c1_compile(env->comp_level())) { |
1130 if (is_c1_compile(env->comp_level())) { |
1103 _is_c1_compilable = false; |
1131 _is_c1_compilable = false; |
1104 } else { |
1132 } else { |
1105 _is_c2_compilable = false; |
1133 _is_c2_compilable = false; |
1106 } |
1134 } |
1107 get_Method()->set_not_compilable(env->comp_level(), true, reason); |
1135 get_Method()->set_not_compilable(reason, env->comp_level()); |
1108 } |
1136 } |
1109 |
1137 |
1110 // ------------------------------------------------------------------ |
1138 // ------------------------------------------------------------------ |
1111 // ciMethod::can_be_osr_compiled |
1139 // ciMethod::can_be_osr_compiled |
1112 // |
1140 // |
1424 } |
1452 } |
1425 |
1453 |
1426 // ------------------------------------------------------------------ |
1454 // ------------------------------------------------------------------ |
1427 |
1455 |
1428 static BasicType erase_to_word_type(BasicType bt) { |
1456 static BasicType erase_to_word_type(BasicType bt) { |
1429 if (is_subword_type(bt)) return T_INT; |
1457 if (is_subword_type(bt)) return T_INT; |
1430 if (bt == T_ARRAY) return T_OBJECT; |
1458 if (is_reference_type(bt)) return T_OBJECT; |
1431 return bt; |
1459 return bt; |
1432 } |
1460 } |
1433 |
1461 |
1434 static bool basic_types_match(ciType* t1, ciType* t2) { |
1462 static bool basic_types_match(ciType* t1, ciType* t2) { |
1435 if (t1 == t2) return true; |
1463 if (t1 == t2) return true; |